ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSkillResources Class Reference

Manages resources for skills. More...

+ Inheritance diagram for ilSkillResources:
+ Collaboration diagram for ilSkillResources:

Public Member Functions

 __construct ($a_skill_id=0, $a_tref_id=0)
 Constructor. More...
 
 setBaseSkillId ($a_val)
 Set base skill id. More...
 
 getBaseSkillId ()
 Get base skill id. More...
 
 setTemplateRefId ($a_val)
 Set template reference id. More...
 
 getTemplateRefId ()
 Get template reference id. More...
 
 readResources ()
 Read resources. More...
 
 save ()
 Save resources. More...
 
 getResources ()
 Get resources. More...
 
 getResourcesOfLevel ($a_level_id)
 Get resoures for level id. More...
 
 setResourceAsTrigger ($a_level_id, $a_rep_ref_id, $a_trigger=true)
 Set resource as trigger. More...
 
 setResourceAsImparting ($a_level_id, $a_rep_ref_id, $a_imparting=true)
 Set resource as imparting resource. More...
 

Static Public Member Functions

static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info. More...
 

Protected Attributes

 $base_skill_id
 
 $tref_id
 
 $resources = array()
 

Detailed Description

Manages resources for skills.

This is not about user assigned materials, it is about resources that are assigned to skill levels in the competence management administration of ILIAS.

This can be either triggers (e.g. a course that triggers a competence level) or resources that impart the knowledge of a competence level. Imparting does not necessarily mean that it triggers a competence level.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ /

Definition at line 21 of file class.ilSkillResources.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillResources::__construct (   $a_skill_id = 0,
  $a_tref_id = 0 
)

Constructor.

Parameters
int$a_skill_idbase skill id
int$a_tref_idtemplate reference id (0, if no template is involved)

Definition at line 43 of file class.ilSkillResources.php.

References readResources(), setBaseSkillId(), and setTemplateRefId().

44  {
45  $this->setBaseSkillId($a_skill_id);
46  $this->setTemplateRefId($a_tref_id);
47 
48  if ($a_skill_id > 0)
49  {
50  $this->readResources();
51  }
52  }
setBaseSkillId($a_val)
Set base skill id.
readResources()
Read resources.
setTemplateRefId($a_val)
Set template reference id.
+ Here is the call graph for this function:

Member Function Documentation

◆ getBaseSkillId()

ilSkillResources::getBaseSkillId ( )

Get base skill id.

Returns
int base skill id

Definition at line 69 of file class.ilSkillResources.php.

References $base_skill_id.

70  {
71  return $this->base_skill_id;
72  }

◆ getResources()

ilSkillResources::getResources ( )

Get resources.

Returns

Definition at line 158 of file class.ilSkillResources.php.

References $resources.

Referenced by save().

159  {
160  return $this->resources;
161  }
+ Here is the caller graph for this function:

◆ getResourcesOfLevel()

ilSkillResources::getResourcesOfLevel (   $a_level_id)

Get resoures for level id.

Parameters
int$a_level_idlevel id
Returns
array array of resources

Definition at line 169 of file class.ilSkillResources.php.

References $ret, and array.

170  {
171  $ret = (is_array($this->resources[$a_level_id]))
172  ? $this->resources[$a_level_id]
173  : array();
174 
175  return $ret;
176  }
Create styles array
The data for the language used.
$ret
Definition: parser.php:6

◆ getTemplateRefId()

ilSkillResources::getTemplateRefId ( )

Get template reference id.

Returns
int template reference id

Definition at line 89 of file class.ilSkillResources.php.

References $tref_id.

90  {
91  return $this->tref_id;
92  }

◆ getUsageInfo()

static ilSkillResources::getUsageInfo (   $a_cskill_ids,
$a_usages 
)
static

Get usage info.

Parameters

Implements ilSkillUsageInfo.

Definition at line 226 of file class.ilSkillResources.php.

References $ilDB, ilSkillUsage\getUsageInfoGeneric(), and ilSkillUsage\RESOURCE.

227  {
228  global $ilDB;
229 
230  include_once("./Services/Skill/classes/class.ilSkillUsage.php");
232  "skl_skill_resource", "rep_ref_id", "base_skill_id");
233  }
static getUsageInfoGeneric($a_cskill_ids, &$a_usages, $a_usage_type, $a_table, $a_key_field, $a_skill_field="skill_id", $a_tref_field="tref_id")
Get standard usage query.
global $ilDB
+ Here is the call graph for this function:

◆ readResources()

ilSkillResources::readResources ( )

Read resources.

Parameters

Definition at line 100 of file class.ilSkillResources.php.

References $ilDB, and array.

Referenced by __construct().

101  {
102  global $ilDB, $tree;
103 
104  $set = $ilDB->query("SELECT * FROM skl_skill_resource ".
105  " WHERE base_skill_id = ".$ilDB->quote($this->getBaseSkillId(), "integer").
106  " AND tref_id = ".$ilDB->quote($this->getTemplateRefId(), "integer")
107  );
108  while ($rec = $ilDB->fetchAssoc($set))
109  {
110  if ($tree->isInTree($rec["rep_ref_id"]))
111  {
112  $this->resources[$rec["level_id"]][$rec["rep_ref_id"]] = array(
113  "level_id" => $rec["level_id"],
114  "rep_ref_id" => $rec["rep_ref_id"],
115  "trigger" => $rec["ltrigger"],
116  "imparting" => $rec["imparting"]
117  );
118  }
119  }
120  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ save()

ilSkillResources::save ( )

Save resources.

Definition at line 125 of file class.ilSkillResources.php.

References $ilDB, $l, $r, $ref_id, and getResources().

126  {
127  global $ilDB;
128 
129  $ilDB->manipulate("DELETE FROM skl_skill_resource WHERE ".
130  " base_skill_id = ".$ilDB->quote((int) $this->getBaseSkillId(), "integer").
131  " AND tref_id = ".$ilDB->quote((int) $this->getTemplateRefId(), "integer")
132  );
133  foreach ($this->getResources() as $level_id => $l)
134  {
135  foreach ($l as $ref_id => $r)
136  {
137  if ($r["imparting"] || $r["trigger"])
138  {
139  $ilDB->manipulate("INSERT INTO skl_skill_resource ".
140  "(base_skill_id, tref_id, level_id, rep_ref_id, imparting, ltrigger) VALUES (".
141  $ilDB->quote((int) $this->getBaseSkillId(), "integer").",".
142  $ilDB->quote((int) $this->getTemplateRefId(), "integer").",".
143  $ilDB->quote((int) $level_id, "integer").",".
144  $ilDB->quote((int) $ref_id, "integer").",".
145  $ilDB->quote((int) $r["imparting"], "integer").",".
146  $ilDB->quote((int) $r["trigger"], "integer").
147  ")");
148  }
149  }
150  }
151  }
$r
Definition: example_031.php:79
getResources()
Get resources.
global $l
Definition: afr.php:30
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the call graph for this function:

◆ setBaseSkillId()

ilSkillResources::setBaseSkillId (   $a_val)

Set base skill id.

Parameters
int$a_valbase skill id

Definition at line 59 of file class.ilSkillResources.php.

Referenced by __construct().

60  {
61  $this->base_skill_id = (int) $a_val;
62  }
+ Here is the caller graph for this function:

◆ setResourceAsImparting()

ilSkillResources::setResourceAsImparting (   $a_level_id,
  $a_rep_ref_id,
  $a_imparting = true 
)

Set resource as imparting resource.

Parameters
int$a_level_idlevel id
int$a_rep_ref_idrepository resource ref id
bool$a_impartingimparting knowledge true/false

Definition at line 206 of file class.ilSkillResources.php.

References array.

207  {
208  if (!is_array($this->resources[$a_level_id]))
209  {
210  $this->resources[$a_level_id] = array();
211  }
212  if (!is_array($this->resources[$a_level_id][$a_rep_ref_id]))
213  {
214  $this->resources[$a_level_id][$a_rep_ref_id] = array();
215  }
216 
217  $this->resources[$a_level_id][$a_rep_ref_id]["imparting"] = $a_imparting;
218  }
Create styles array
The data for the language used.

◆ setResourceAsTrigger()

ilSkillResources::setResourceAsTrigger (   $a_level_id,
  $a_rep_ref_id,
  $a_trigger = true 
)

Set resource as trigger.

Parameters
int$a_level_idlevel id
int$a_rep_ref_idrepository resource ref id
bool$a_triggertrigger true/false

Definition at line 185 of file class.ilSkillResources.php.

References array.

186  {
187  if (!is_array($this->resources[$a_level_id]))
188  {
189  $this->resources[$a_level_id] = array();
190  }
191  if (!is_array($this->resources[$a_level_id][$a_rep_ref_id]))
192  {
193  $this->resources[$a_level_id][$a_rep_ref_id] = array();
194  }
195 
196  $this->resources[$a_level_id][$a_rep_ref_id]["trigger"] = $a_trigger;
197  }
Create styles array
The data for the language used.

◆ setTemplateRefId()

ilSkillResources::setTemplateRefId (   $a_val)

Set template reference id.

Parameters
int$a_valtemplate reference id

Definition at line 79 of file class.ilSkillResources.php.

Referenced by __construct().

80  {
81  $this->tref_id = (int) $a_val;
82  }
+ Here is the caller graph for this function:

Field Documentation

◆ $base_skill_id

ilSkillResources::$base_skill_id
protected

Definition at line 23 of file class.ilSkillResources.php.

Referenced by getBaseSkillId().

◆ $resources

ilSkillResources::$resources = array()
protected

Definition at line 35 of file class.ilSkillResources.php.

Referenced by getResources().

◆ $tref_id

ilSkillResources::$tref_id
protected

Definition at line 24 of file class.ilSkillResources.php.

Referenced by getTemplateRefId().


The documentation for this class was generated from the following file: