4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
39 parent::__construct();
40 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
42 $this->skill_tree_root_id = $this->skill_tree->readRootId();
44 $this->init_top_order_nr = $this->skill_tree->getMaxOrderNr($this->skill_tree_root_id);
45 $this->init_templ_top_order_nr = $this->skill_tree->getMaxOrderNr($this->skill_tree_root_id,
true);
75 $this->selected_nodes = $a_val;
95 $this->selected_profiles = $a_val;
115 return array(
"5.1.0");
126 return "http://www.ilias.de/xml/Services/Skill/".$a_entity;
137 if ($a_entity ==
"skmg")
147 if ($a_entity ==
"skl_subtree")
153 "SklTreeId" =>
"integer",
154 "TopNode" =>
"integer",
155 "Child" =>
"integer",
156 "Parent" =>
"integer",
157 "Depth" =>
"integer",
160 "SelfEval" =>
"integer",
161 "OrderNr" =>
"integer",
162 "Status" =>
"integer",
163 "TemplateId" =>
"integer" 167 if ($a_entity ==
"skl_templ_subtree")
173 "SklTreeId" =>
"integer",
174 "TopNode" =>
"integer",
175 "Child" =>
"integer",
176 "Parent" =>
"integer",
177 "Depth" =>
"integer",
180 "SelfEval" =>
"integer",
181 "OrderNr" =>
"integer",
182 "Status" =>
"integer" 186 if ($a_entity ==
"skl_level")
192 "LevelId" =>
"integer",
193 "SkillId" =>
"integer",
196 "Description" =>
"text" 200 if ($a_entity ==
"skl_prof")
208 "Description" =>
"text" 212 if ($a_entity ==
"skl_prof_level")
218 "ProfileId" =>
"integer",
219 "BaseSkillId" =>
"integer",
220 "TrefId" =>
"integer",
221 "LevelId" =>
"integer" 234 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
240 if (!is_array($a_ids))
242 $a_ids =
array($a_ids);
244 if ($a_entity ==
"skmg")
249 if ($this->
getMode() == self::MODE_SKILLS)
251 $this->
data[] =
array(
"Mode" =>
"Skills");
253 else if ($this->
getMode() == self::MODE_PROFILES)
255 $this->
data[] =
array(
"Mode" =>
"Profiles");
261 if ($a_entity ==
"skl_subtree")
266 foreach ($a_ids as $id)
268 $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id));
271 $set = $ilDB->query(
"SELECT * FROM skl_templ_ref ".
272 " WHERE skl_node_id = ".$ilDB->quote($s[
"child"],
"integer")
274 $rec = $ilDB->fetchAssoc($set);
276 $top_node = ($s[
"child"] == $id)
280 "SklTreeId" => $s[
"skl_tree_id"],
281 "TopNode" => $top_node,
282 "Child" => $s[
"child"],
283 "Parent" => $s[
"parent"],
284 "Depth" => $s[
"depth"],
285 "Type" => $s[
"type"],
286 "Title" => $s[
"title"],
287 "SelfEval" => $s[
"self_eval"],
288 "OrderNr" => $s[
"order_nr"],
289 "Status" => $s[
"status"],
290 "TemplateId" => (
int) $rec[
"templ_id"]
299 if ($a_entity ==
"skl_templ_subtree")
304 foreach ($a_ids as $id)
306 $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id));
309 $top_node = ($s[
"child"] == $id)
313 "SklTreeId" => $s[
"skl_tree_id"],
314 "TopNode" => $top_node,
315 "Child" => $s[
"child"],
316 "Parent" => $s[
"parent"],
317 "Depth" => $s[
"depth"],
318 "Type" => $s[
"type"],
319 "Title" => $s[
"title"],
320 "SelfEval" => $s[
"self_eval"],
321 "OrderNr" => $s[
"order_nr"],
322 "Status" => $s[
"status"]
331 if ($a_entity ==
"skl_level")
337 " FROM skl_level WHERE ".
338 $ilDB->in(
"skill_id", $a_ids,
false,
"integer").
" ORDER BY skill_id ASC, nr ASC");
344 if ($a_entity ==
"skl_prof")
350 " FROM skl_profile WHERE ".
351 $ilDB->in(
"id", $a_ids,
false,
"integer"));
357 if ($a_entity ==
"skl_prof_level")
363 " FROM skl_profile_level WHERE ".
364 $ilDB->in(
"profile_id", $a_ids,
false,
"integer"));
379 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
385 if ($this->
getMode() == self::MODE_SKILLS)
389 $exp_types =
array(
"skll",
"scat",
"sctr",
"sktr");
390 if (!is_array($sel_nodes))
392 $childs = $this->skill_tree->getChildsByTypeFilter($this->skill_tree->readRootId(), $exp_types);
394 $skl_subtree_deps =
array();
395 foreach ($childs as $c)
397 $skl_subtree_deps[] = $c[
"child"];
401 foreach ($sel_nodes as
$n)
405 $skl_subtree_deps[] =
$n;
411 $ref_nodes =
array();
412 if (is_array($skl_subtree_deps))
414 foreach ($skl_subtree_deps as $id)
418 $ref_nodes[$id] = $id;
421 $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id),
true,
"sktr");
424 $ref_nodes[$s[
"child"]] = $s[
"child"];
430 $set = $ilDB->query(
"SELECT DISTINCT(templ_id) FROM skl_templ_ref " .
431 " WHERE " . $ilDB->in(
"skl_node_id", $ref_nodes,
false,
"integer"));
432 while ($rec = $ilDB->fetchAssoc($set))
434 $deps[
"skl_templ_subtree"][
"ids"][] = $rec[
"templ_id"];
438 $deps[
"skl_subtree"][
"ids"] = $skl_subtree_deps;
440 else if ($this->
getMode() == self::MODE_PROFILES)
444 $deps[
"skl_prof"][
"ids"][] = $p_id;
451 case "skl_templ_subtree":
453 if (in_array($a_rec[
"Type"],
array(
"skll",
"sktp")))
455 $deps[
"skl_level"][
"ids"][] = $a_rec[
"Child"];
460 $deps[
"skl_prof_level"][
"ids"][] = $a_rec[
"Id"];
474 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
476 $source_inst_id = $a_mapping->getInstallId();
480 if ($a_rec[
"TopNode"] == 1)
482 $parent = $this->skill_tree_root_id;
484 $order = $a_rec[
"OrderNr"] + $this->init_top_order_nr;
487 $parent = (int)$a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Parent"]);
488 $status = $a_rec[
"Status"];
489 $order = $a_rec[
"OrderNr"];
491 switch ($a_rec[
"Type"])
494 include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
496 $scat->setTitle($a_rec[
"Title"]);
497 $scat->setImportId(
"il_" . $source_inst_id .
"_scat_" . $a_rec[
"Child"]);
498 $scat->setSelfEvaluation($a_rec[
"SelfEval"]);
499 $scat->setOrderNr($order);
500 $scat->setStatus($status);
503 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $scat->getId());
507 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
509 $skll->setTitle($a_rec[
"Title"]);
510 $skll->setImportId(
"il_" . $source_inst_id .
"_skll_" . $a_rec[
"Child"]);
511 $skll->setSelfEvaluation($a_rec[
"SelfEval"]);
512 $skll->setOrderNr($order);
513 $skll->setStatus($status);
516 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $skll->getId());
520 $template_id = (int)$a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"TemplateId"]);
524 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
526 $sktr->setTitle($a_rec[
"Title"]);
527 $sktr->setImportId(
"il_" . $source_inst_id .
"_sktr_" . $a_rec[
"Child"]);
528 $sktr->setSelfEvaluation($a_rec[
"SelfEval"]);
529 $sktr->setOrderNr($order);
531 $sktr->setStatus($status);
534 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $sktr->getId());
541 case "skl_templ_subtree":
542 if ($a_rec[
"TopNode"] == 1)
544 $parent = $this->skill_tree_root_id;
545 $order = $a_rec[
"OrderNr"] + $this->init_templ_top_order_nr;
548 $parent = (int)$a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Parent"]);
549 $order = $a_rec[
"OrderNr"];
551 switch ($a_rec[
"Type"])
554 include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
556 $sctp->setTitle($a_rec[
"Title"]);
557 $sctp->setImportId(
"il_" . $source_inst_id .
"_sctp_" . $a_rec[
"Child"]);
558 $sctp->setOrderNr($order);
561 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $sctp->getId());
565 include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
567 $sktp->setTitle($a_rec[
"Title"]);
568 $sktp->setImportId(
"il_" . $source_inst_id .
"_sktp_" . $a_rec[
"Child"]);
569 $sktp->setOrderNr($order);
572 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $sktp->getId());
578 $skill_id = (int)$a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"SkillId"]);
580 if (in_array($type,
array(
"skll",
"sktp")))
589 $skill->addLevel($a_rec[
"Title"], $a_rec[
"Description"],
"il_" . $source_inst_id .
"_sklv_" . $a_rec[
"LevelId"]);
595 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
597 $prof->setTitle($a_rec[
"Title"]);
598 $prof->setDescription($a_rec[
"Description"]);
600 $a_mapping->addMapping(
"Services/Skill",
"skl_prof", $a_rec[
"Id"], $prof->getId());
603 case "skl_prof_level":
604 $profile_id = (int)$a_mapping->getMapping(
"Services/Skill",
"skl_prof", $a_rec[
"ProfileId"]);
607 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
608 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
614 $level_id = $tref_id = $base_skill = 0;
615 foreach($level_id_data as
$l)
618 foreach ($skill_data as $s)
624 $level_id = $l[
"level_id"];
625 $base_skill = $s[
"skill_id"];
626 $tref_id = $s[
"tref_id"];
632 $prof->addSkillLevel($base_skill, $tref_id, $level_id);
getSelectedNodes()
Get export selected nodes.
setSelectedNodes($a_val)
Set export selected nodes.
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
Skill Template Reference.
__construct()
Constructor.
static getLevelIdForImportId($a_source_inst_id, $a_level_import_id)
Get level ids for import IDs (newest first)
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
getSupportedVersions()
Get supported versions.
static _lookupType($a_obj_id)
Lookup Type.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
getCurrentInstallationId()
Get current installation id.
Create styles array
The data for the language used.
setSelectedProfiles($a_val)
Set selected profiles.
getSelectedProfiles()
Get selected profiles.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
static lookupLevelSkillId($a_id)
Lookup level skill id.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getTypes($a_entity, $a_version)
Get field types for entity.
static getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
Get common skill ids for import IDs (newest first)