5 include_once(
"./Services/Skill/interfaces/interface.ilSkillUsageInfo.php");
40 protected $classes =
array(
"ilBasicSkill",
"ilPersonalSkill",
"ilSkillProfile",
"ilSkillResources",
"ilSkillUsage");
50 public static function setUsage($a_obj_id, $a_skill_id, $a_tref_id, $a_use =
true)
54 $ilDB = $DIC->database();
60 "obj_id" =>
array(
"integer", $a_obj_id),
61 "skill_id" =>
array(
"integer", $a_skill_id),
62 "tref_id" =>
array(
"integer", $a_tref_id)
68 $q =
"DELETE FROM skl_usage WHERE " .
69 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
70 " AND skill_id = " .
$ilDB->quote($a_skill_id,
"integer") .
71 " AND tref_id = " .
$ilDB->quote($a_tref_id,
"integer")
84 public static function getUsages($a_skill_id, $a_tref_id)
88 $ilDB = $DIC->database();
91 "SELECT obj_id FROM skl_usage " .
92 " WHERE skill_id = " .
$ilDB->quote($a_skill_id,
"integer") .
93 " AND tref_id = " .
$ilDB->quote($a_tref_id,
"integer")
96 while ($rec =
$ilDB->fetchAssoc($set)) {
97 $obj_ids[] = $rec[
"obj_id"];
113 $ilDB = $DIC->database();
115 self::getUsageInfoGeneric(
136 $a_skill_field =
"skill_id",
137 $a_tref_field =
"tref_id" 141 $ilDB = $DIC->database();
143 if (count($a_cskill_ids) == 0) {
148 $q =
"SELECT " . $a_key_field .
", " . $a_skill_field .
", " . $a_tref_field .
" FROM " . $a_table .
" ";
149 foreach ($a_cskill_ids as $sk) {
150 $q.=
$w .
" (" . $a_skill_field .
" = " .
$ilDB->quote($sk[
"skill_id"],
"integer") .
151 " AND " . $a_tref_field .
" = " .
$ilDB->quote($sk[
"tref_id"],
"integer") .
") ";
154 $q.=
" GROUP BY " . $a_key_field .
", " . $a_skill_field .
", " . $a_tref_field;
156 $set =
$ilDB->query($q);
157 while ($rec =
$ilDB->fetchAssoc($set)) {
158 $a_usages[$rec[$a_skill_field] .
":" . $rec[$a_tref_field]][$a_usage_type][] =
159 array(
"key" => $rec[$a_key_field]);
177 include_once(
"./Services/Skill/classes/class." . $class .
".php");
179 $class::getUsageInfo($a_cskill_ids, $usages);
194 include_once(
"./Services/Skill/classes/class.ilVirtualSkillTree.php");
196 $nodes = $vtree->getSubTreeForCSkillId($a_skill_id .
":" . $a_tref_id);
210 include_once(
"./Services/Skill/classes/class.ilVirtualSkillTree.php");
213 foreach ($a_cskill_ids as
$s) {
214 $nodes = $vtree->getSubTreeForCSkillId($s[
"skill_id"] .
":" . $s[
"tref_id"]);
215 foreach ($nodes as
$n) {
232 $skill_logger->debug(
"ilSkillUsage: getAllUsagesOfTemplate(" . $a_tempate_id .
")");
235 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
239 $cskill_ids =
array();
240 foreach ($trefs as $tref) {
241 $cskill_ids[] =
array(
"skill_id" => $a_tempate_id,
"tref_id" => $tref);
242 $skill_logger->debug(
"ilSkillUsage: ... skill_id: " . $a_tempate_id .
", tref_id: " . $tref .
".");
245 $skill_logger->debug(
"ilSkillUsage: ... count cskill_ids: " . count($cskill_ids) .
".");
260 $lng = $DIC->language();
262 return $lng->txt(
"skmg_usage_type_info_" .
$a_type);
275 $lng = $DIC->language();
278 case self::TYPE_GENERAL:
280 return $lng->txt(
"skmg_usage_obj_objects");
283 case self::USER_ASSIGNED:
284 case self::PERSONAL_SKILL:
285 case self::USER_MATERIAL:
286 case self::SELF_EVAL:
287 return $lng->txt(
"skmg_usage_obj_users");
291 return $lng->txt(
"skmg_usage_obj_profiles");
295 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 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 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 getLogger($a_component_id)
Get component logger.
static getUsages($a_skill_id, $a_tref_id)
Get usages.