ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSkillUsage Class Reference

Skill usage. More...

+ Inheritance diagram for ilSkillUsage:
+ Collaboration diagram for ilSkillUsage:

Public Member Functions

 getAllUsagesInfo ($a_cskill_ids)
 Get all usages info.
 getAllUsagesInfoOfSubtree ($a_skill_id, $a_tref_id=0)
 Get all usages info of subtree.
 getAllUsagesInfoOfSubtrees ($a_cskill_ids)
 Get all usages info of subtree.

Static Public Member Functions

static setUsage ($a_obj_id, $a_skill_id, $a_tref_id, $a_use=true)
 Set usage.
static getUsages ($a_skill_id, $a_tref_id)
 Get usages.
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info.
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.
static getTypeInfoString ($a_type)
 Get type info string.
static getObjTypeString ($a_type)
 Get type info string.

Data Fields

const TYPE_GENERAL = "gen"
const USER_ASSIGNED = "user"
const PERSONAL_SKILL = "pers"
const USER_MATERIAL = "mat"
const SELF_EVAL = "seval"
const PROFILE = "prof"
const RESOURCE = "res"

Protected Attributes

 $classes = array("ilBasicSkill", "ilPersonalSkill", "ilSkillProfile", "ilSkillResources", "ilSkillUsage")

Detailed Description

Skill usage.

With this class a general skill use by an object (identified by its obj_id) is registered or unregistered.

The class maintains skill usages of the following types

  • GENERAL: General use submitted by an object, saved in table "skl_usage"
  • USER_ASSIGNED: Skill level is assigned to a user (tables skl_user_skill_level and skl_user_has_level)
  • PERSONAL_SKILL: table skl_personal_skill (do we need that?)
  • USER_MATERIAL: User has assigned material to the skill
  • SELF_EVAL: User has self evaluated (may be USER_ASSIGNED in the future)
  • PROFILE: Skill is used in skill profile (table "skl_profile_level")
  • RESOURCE: A resource is assigned to a skill level (table "skl_skill_resource")
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 26 of file class.ilSkillUsage.php.

Member Function Documentation

ilSkillUsage::getAllUsagesInfo (   $a_cskill_ids)

Get all usages info.

Parameters
arrayof common skill ids ("skill_id" => skill_id, "tref_id" => tref_id)
Returns
array usages

Definition at line 150 of file class.ilSkillUsage.php.

References $classes, and getUsageInfo().

Referenced by getAllUsagesInfoOfSubtree(), and getAllUsagesInfoOfSubtrees().

{
$usages = array();
foreach ($classes as $class)
{
// make static call
include_once("./Services/Skill/classes/class.".$class.".php");
//call_user_func($class.'::getUsageInfo', $a_cskill_ids, $usages);
$class::getUsageInfo($a_cskill_ids, $usages);
}
return $usages;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillUsage::getAllUsagesInfoOfSubtree (   $a_skill_id,
  $a_tref_id = 0 
)

Get all usages info of subtree.

Parameters
int$a_skill_idskill node id
int$a_tref_idtref id
Returns
array usages

Definition at line 172 of file class.ilSkillUsage.php.

References getAllUsagesInfo().

{
// get nodes
include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
$vtree = new ilVirtualSkillTree();
$nodes = $vtree->getSubTreeForCSkillId($a_skill_id.":".$a_tref_id);
return $this->getAllUsagesInfo($nodes);
}

+ Here is the call graph for this function:

ilSkillUsage::getAllUsagesInfoOfSubtrees (   $a_cskill_ids)

Get all usages info of subtree.

Parameters
array$a_cskill_idsarray of common skill ids ("skill_id" => skill_id, "tref_id" => tref_id)
Returns
array usages

Definition at line 188 of file class.ilSkillUsage.php.

References $n, and getAllUsagesInfo().

{
// get nodes
include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
$vtree = new ilVirtualSkillTree();
$allnodes = array();
foreach ($a_cskill_ids as $s)
{
$nodes = $vtree->getSubTreeForCSkillId($s["skill_id"].":".$s["tref_id"]);
foreach ($nodes as $n)
{
$allnodes[] = $n;
}
}
return $this->getAllUsagesInfo($allnodes);
}

+ Here is the call graph for this function:

static ilSkillUsage::getObjTypeString (   $a_type)
static

Get type info string.

Parameters
@return

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

References $lng.

Referenced by ilSkillUsageTableGUI\fillRow().

{
global $lng;
switch ($a_type)
{
case self::TYPE_GENERAL:
case self::RESOURCE:
return $lng->txt("skmg_usage_obj_objects");
break;
case self::USER_ASSIGNED:
case self::PERSONAL_SKILL:
case self::USER_MATERIAL:
case self::SELF_EVAL:
return $lng->txt("skmg_usage_obj_users");
break;
case self::PROFILE:
return $lng->txt("skmg_usage_obj_profiles");
break;
}
return $lng->txt("skmg_usage_type_info_".$a_type);
}

+ Here is the caller graph for this function:

static ilSkillUsage::getTypeInfoString (   $a_type)
static

Get type info string.

Parameters
string$a_typeusage type
Returns
string lang string

Definition at line 213 of file class.ilSkillUsage.php.

References $lng.

Referenced by ilSkillUsageTableGUI\fillRow().

{
global $lng;
return $lng->txt("skmg_usage_type_info_".$a_type);
}

+ Here is the caller graph for this function:

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

Get usage info.

Parameters
array$a_cskill_idsskill ids
array$a_usagesusages array

Implements ilSkillUsageInfo.

Definition at line 106 of file class.ilSkillUsage.php.

References getUsageInfoGeneric(), and TYPE_GENERAL.

Referenced by getAllUsagesInfo().

{
global $ilDB;
"skl_usage", "obj_id");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSkillUsage::getUsageInfoGeneric (   $a_cskill_ids,
$a_usages,
  $a_usage_type,
  $a_table,
  $a_key_field,
  $a_skill_field = "skill_id",
  $a_tref_field = "tref_id" 
)
static

Get standard usage query.

Parameters
array$a_cskill_idsskill ids
array$a_usagesusages array

Definition at line 120 of file class.ilSkillUsage.php.

Referenced by getUsageInfo(), ilSkillResources\getUsageInfo(), ilPersonalSkill\getUsageInfo(), ilSkillProfile\getUsageInfo(), and ilBasicSkill\getUsageInfo().

{
global $ilDB;
$w = "WHERE";
$q = "SELECT ".$a_key_field.", ".$a_skill_field.", ".$a_tref_field." FROM ".$a_table." ";
foreach ($a_cskill_ids as $sk)
{
$q.= $w." (".$a_skill_field." = ".$ilDB->quote($sk["skill_id"], "integer").
" AND ".$a_tref_field." = ".$ilDB->quote($sk["tref_id"], "integer").") ";
$w = "OR";
}
$q.= " GROUP BY ".$a_key_field.", ".$a_skill_field.", ".$a_tref_field;
$set = $ilDB->query($q);
while ($rec = $ilDB->fetchAssoc($set))
{
$a_usages[$rec[$a_skill_field].":".$rec[$a_tref_field]][$a_usage_type][] =
array("key" => $rec[$a_key_field]);
}
}

+ Here is the caller graph for this function:

static ilSkillUsage::getUsages (   $a_skill_id,
  $a_tref_id 
)
static

Get usages.

Parameters
int$a_skill_idskill id
int$a_tref_idtref id
Returns
array of int object ids

Definition at line 83 of file class.ilSkillUsage.php.

{
global $ilDB;
$set = $ilDB->query("SELECT obj_id FROM skl_usage ".
" WHERE skill_id = ".$ilDB->quote($a_skill_id, "integer").
" AND tref_id = ".$ilDB->quote($a_tref_id, "integer")
);
$obj_ids = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$obj_ids[] = $rec["obj_id"];
}
return $obj_ids;
}
static ilSkillUsage::setUsage (   $a_obj_id,
  $a_skill_id,
  $a_tref_id,
  $a_use = true 
)
static

Set usage.

Parameters
int$a_obj_idobject id
int$a_skill_idskill id
int$a_tref_idtref id
bool$a_usein use true/false

Definition at line 50 of file class.ilSkillUsage.php.

Referenced by ilSurveySkill\addQuestionSkillAssignment(), and ilSurveySkill\removeUsagesOfSkills().

{
global $ilDB;
if ($a_use)
{
$ilDB->replace("skl_usage",
array(
"obj_id" => array("integer", $a_obj_id),
"skill_id" => array("integer", $a_skill_id),
"tref_id" => array("integer", $a_tref_id)
),
array()
);
}
else
{
$ilDB->manipulate($q = "DELETE FROM skl_usage WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND skill_id = ".$ilDB->quote($a_skill_id, "integer").
" AND tref_id = ".$ilDB->quote($a_tref_id, "integer")
);
//echo $q; exit;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilSkillUsage::$classes = array("ilBasicSkill", "ilPersonalSkill", "ilSkillProfile", "ilSkillResources", "ilSkillUsage")
protected

Definition at line 40 of file class.ilSkillUsage.php.

Referenced by getAllUsagesInfo().

const ilSkillUsage::PERSONAL_SKILL = "pers"

Definition at line 30 of file class.ilSkillUsage.php.

Referenced by ilPersonalSkill\getUsageInfo().

const ilSkillUsage::PROFILE = "prof"

Definition at line 33 of file class.ilSkillUsage.php.

Referenced by ilSkillProfile\getUsageInfo().

const ilSkillUsage::RESOURCE = "res"

Definition at line 34 of file class.ilSkillUsage.php.

Referenced by ilSkillResources\getUsageInfo().

const ilSkillUsage::SELF_EVAL = "seval"

Definition at line 32 of file class.ilSkillUsage.php.

Referenced by ilPersonalSkill\getUsageInfo().

const ilSkillUsage::TYPE_GENERAL = "gen"

Definition at line 28 of file class.ilSkillUsage.php.

Referenced by getUsageInfo().

const ilSkillUsage::USER_ASSIGNED = "user"

Definition at line 29 of file class.ilSkillUsage.php.

Referenced by ilBasicSkill\getUsageInfo().

const ilSkillUsage::USER_MATERIAL = "mat"

Definition at line 31 of file class.ilSkillUsage.php.

Referenced by ilPersonalSkill\getUsageInfo().


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