ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 setBaseSkillId ($a_val)
 Set base skill id.
 getBaseSkillId ()
 Get base skill id.
 setTemplateRefId ($a_val)
 Set template reference id.
 getTemplateRefId ()
 Get template reference id.
 readResources ()
 Read resources.
 save ()
 Save resources.
 getResources ()
 Get resources.
 getResourcesOfLevel ($a_level_id)
 Get resoures for level id.
 setResourceAsTrigger ($a_level_id, $a_rep_ref_id, $a_trigger=true)
 Set resource as trigger.
 setResourceAsImparting ($a_level_id, $a_rep_ref_id, $a_imparting=true)
 Set resource as imparting resource.

Static Public Member Functions

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

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

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().

{
$this->setBaseSkillId($a_skill_id);
$this->setTemplateRefId($a_tref_id);
if ($a_skill_id > 0)
{
$this->readResources();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilSkillResources::getBaseSkillId ( )

Get base skill id.

Returns
int base skill id

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

References $base_skill_id.

{
}
ilSkillResources::getResources ( )

Get resources.

Returns

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

References $resources.

Referenced by save().

{
}

+ Here is the caller graph for this function:

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.

{
$ret = (is_array($this->resources[$a_level_id]))
? $this->resources[$a_level_id]
: array();
return $ret;
}
ilSkillResources::getTemplateRefId ( )

Get template reference id.

Returns
int template reference id

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

References $tref_id.

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

Get usage info.

Parameters
@return

Implements ilSkillUsageInfo.

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

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

{
global $ilDB;
include_once("./Services/Skill/classes/class.ilSkillUsage.php");
"skl_skill_resource", "rep_ref_id", "base_skill_id");
}

+ Here is the call graph for this function:

ilSkillResources::readResources ( )

Read resources.

Parameters
@return

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

References $ilDB.

Referenced by __construct().

{
global $ilDB, $tree;
$set = $ilDB->query("SELECT * FROM skl_skill_resource ".
" WHERE base_skill_id = ".$ilDB->quote($this->getBaseSkillId(), "integer").
" AND tref_id = ".$ilDB->quote($this->getTemplateRefId(), "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
if ($tree->isInTree($rec["rep_ref_id"]))
{
$this->resources[$rec["level_id"]][$rec["rep_ref_id"]] = array(
"level_id" => $rec["level_id"],
"rep_ref_id" => $rec["rep_ref_id"],
"trigger" => $rec["ltrigger"],
"imparting" => $rec["imparting"]
);
}
}
}

+ Here is the caller graph for this function:

ilSkillResources::save ( )

Save resources.

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

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

{
global $ilDB;
$ilDB->manipulate("DELETE FROM skl_skill_resource WHERE ".
" base_skill_id = ".$ilDB->quote((int) $this->getBaseSkillId(), "integer").
" AND tref_id = ".$ilDB->quote((int) $this->getTemplateRefId(), "integer")
);
foreach ($this->getResources() as $level_id => $l)
{
foreach ($l as $ref_id => $r)
{
if ($r["imparting"] || $r["trigger"])
{
$ilDB->manipulate("INSERT INTO skl_skill_resource ".
"(base_skill_id, tref_id, level_id, rep_ref_id, imparting, ltrigger) VALUES (".
$ilDB->quote((int) $this->getBaseSkillId(), "integer").",".
$ilDB->quote((int) $this->getTemplateRefId(), "integer").",".
$ilDB->quote((int) $level_id, "integer").",".
$ilDB->quote((int) $ref_id, "integer").",".
$ilDB->quote((int) $r["imparting"], "integer").",".
$ilDB->quote((int) $r["trigger"], "integer").
")");
}
}
}
}

+ Here is the call graph for this function:

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().

{
$this->base_skill_id = (int) $a_val;
}

+ Here is the caller graph for this function:

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.

{
if (!is_array($this->resources[$a_level_id]))
{
$this->resources[$a_level_id] = array();
}
if (!is_array($this->resources[$a_level_id][$a_rep_ref_id]))
{
$this->resources[$a_level_id][$a_rep_ref_id] = array();
}
$this->resources[$a_level_id][$a_rep_ref_id]["imparting"] = $a_imparting;
}
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.

{
if (!is_array($this->resources[$a_level_id]))
{
$this->resources[$a_level_id] = array();
}
if (!is_array($this->resources[$a_level_id][$a_rep_ref_id]))
{
$this->resources[$a_level_id][$a_rep_ref_id] = array();
}
$this->resources[$a_level_id][$a_rep_ref_id]["trigger"] = $a_trigger;
}
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().

{
$this->tref_id = (int) $a_val;
}

+ Here is the caller graph for this function:

Field Documentation

ilSkillResources::$base_skill_id
protected

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

Referenced by getBaseSkillId().

ilSkillResources::$resources = array()
protected

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

Referenced by getResources().

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: