5 include_once(
"./Services/Skill/interfaces/interface.ilSkillUsageInfo.php");
40 protected $classes =
array(
"ilBasicSkill",
"ilPersonalSkill",
"ilSkillProfile",
"ilSkillResources",
"ilSkillUsage");
50 static function setUsage($a_obj_id, $a_skill_id, $a_tref_id, $a_use =
true)
56 $ilDB->replace(
"skl_usage",
58 "obj_id" =>
array(
"integer", $a_obj_id),
59 "skill_id" =>
array(
"integer", $a_skill_id),
60 "tref_id" =>
array(
"integer", $a_tref_id)
67 $ilDB->manipulate($q =
"DELETE FROM skl_usage WHERE ".
68 " obj_id = ".$ilDB->quote($a_obj_id,
"integer").
69 " AND skill_id = ".$ilDB->quote($a_skill_id,
"integer").
70 " AND tref_id = ".$ilDB->quote($a_tref_id,
"integer")
87 $set = $ilDB->query(
"SELECT obj_id FROM skl_usage ".
88 " WHERE skill_id = ".$ilDB->quote($a_skill_id,
"integer").
89 " AND tref_id = ".$ilDB->quote($a_tref_id,
"integer")
92 while ($rec = $ilDB->fetchAssoc($set))
94 $obj_ids[] = $rec[
"obj_id"];
111 "skl_usage",
"obj_id");
121 $a_skill_field =
"skill_id", $a_tref_field =
"tref_id")
125 if (count($a_cskill_ids) == 0)
131 $q =
"SELECT ".$a_key_field.
", ".$a_skill_field.
", ".$a_tref_field.
" FROM ".$a_table.
" ";
132 foreach ($a_cskill_ids as $sk)
134 $q.=
$w.
" (".$a_skill_field.
" = ".$ilDB->quote($sk[
"skill_id"],
"integer").
135 " AND ".$a_tref_field.
" = ".$ilDB->quote($sk[
"tref_id"],
"integer").
") ";
138 $q.=
" GROUP BY ".$a_key_field.
", ".$a_skill_field.
", ".$a_tref_field;
140 $set = $ilDB->query($q);
141 while ($rec = $ilDB->fetchAssoc($set))
143 $a_usages[$rec[$a_skill_field].
":".$rec[$a_tref_field]][$a_usage_type][] =
144 array(
"key" => $rec[$a_key_field]);
163 include_once(
"./Services/Skill/classes/class.".$class.
".php");
165 $class::getUsageInfo($a_cskill_ids, $usages);
180 include_once(
"./Services/Skill/classes/class.ilVirtualSkillTree.php");
182 $nodes = $vtree->getSubTreeForCSkillId($a_skill_id.
":".$a_tref_id);
196 include_once(
"./Services/Skill/classes/class.ilVirtualSkillTree.php");
199 foreach ($a_cskill_ids as $s)
201 $nodes = $vtree->getSubTreeForCSkillId($s[
"skill_id"].
":".$s[
"tref_id"]);
202 foreach ($nodes as
$n)
220 $skill_logger->debug(
"ilSkillUsage: getAllUsagesOfTemplate(".$a_tempate_id.
")");
223 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
227 $cskill_ids =
array();
228 foreach ($trefs as $tref)
230 $cskill_ids[] =
array(
"skill_id" => $a_tempate_id,
"tref_id" => $tref);
231 $skill_logger->debug(
"ilSkillUsage: ... skill_id: ".$a_tempate_id.
", tref_id: ".$tref.
".");
234 $skill_logger->debug(
"ilSkillUsage: ... count cskill_ids: ".count($cskill_ids).
".");
249 return $lng->txt(
"skmg_usage_type_info_".
$a_type);
264 case self::TYPE_GENERAL:
266 return $lng->txt(
"skmg_usage_obj_objects");
269 case self::USER_ASSIGNED:
270 case self::PERSONAL_SKILL:
271 case self::USER_MATERIAL:
272 case self::SELF_EVAL:
273 return $lng->txt(
"skmg_usage_obj_users");
277 return $lng->txt(
"skmg_usage_obj_profiles");
281 return $lng->txt(
"skmg_usage_type_info_".
$a_type);
Get info on usages of skills.
getAllUsagesInfoOfSubtrees($a_cskill_ids)
Get all usages info of subtree.
getAllUsagesInfoOfSubtree($a_skill_id, $a_tref_id=0)
Get all usages info of subtree.
static _lookupTrefIdsForTemplateId($a_tid)
Get all tref ids for a template id.
getAllUsagesInfo($a_cskill_ids)
Get all usages info.
static getObjTypeString($a_type)
Get type info string.
getAllUsagesOfTemplate($a_tempate_id)
Get all usages of template.
static setUsage($a_obj_id, $a_skill_id, $a_tref_id, $a_use=true)
Set usage.
static getUsageInfo($a_cskill_ids, &$a_usages)
Get usage info.
static getTypeInfoString($a_type)
Get type info string.
Create styles array
The data for the language used.
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 getLogger($a_component_id)
Get component logger.
static getUsages($a_skill_id, $a_tref_id)
Get usages.