4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
41 $this->db = $DIC->database();
42 parent::__construct();
43 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
45 $this->skill_tree_root_id = $this->skill_tree->readRootId();
47 $this->init_top_order_nr = $this->skill_tree->getMaxOrderNr($this->skill_tree_root_id);
48 $this->init_templ_top_order_nr = $this->skill_tree->getMaxOrderNr($this->skill_tree_root_id,
true);
78 $this->selected_nodes = $a_val;
98 $this->selected_profiles = $a_val;
118 return array(
"5.1.0");
129 return "http://www.ilias.de/xml/Services/Skill/" . $a_entity;
140 if ($a_entity ==
"skmg") {
141 switch ($a_version) {
148 if ($a_entity ==
"skl_subtree") {
149 switch ($a_version) {
152 "SklTreeId" =>
"integer",
153 "TopNode" =>
"integer",
154 "Child" =>
"integer",
155 "Parent" =>
"integer",
156 "Depth" =>
"integer",
159 "SelfEval" =>
"integer",
160 "OrderNr" =>
"integer",
161 "Status" =>
"integer",
162 "TemplateId" =>
"integer" 166 if ($a_entity ==
"skl_templ_subtree") {
167 switch ($a_version) {
170 "SklTreeId" =>
"integer",
171 "TopNode" =>
"integer",
172 "Child" =>
"integer",
173 "Parent" =>
"integer",
174 "Depth" =>
"integer",
177 "SelfEval" =>
"integer",
178 "OrderNr" =>
"integer",
179 "Status" =>
"integer" 183 if ($a_entity ==
"skl_level") {
184 switch ($a_version) {
187 "LevelId" =>
"integer",
188 "SkillId" =>
"integer",
191 "Description" =>
"text" 195 if ($a_entity ==
"skl_prof") {
196 switch ($a_version) {
201 "Description" =>
"text" 205 if ($a_entity ==
"skl_prof_level") {
206 switch ($a_version) {
209 "ProfileId" =>
"integer",
210 "BaseSkillId" =>
"integer",
211 "TrefId" =>
"integer",
212 "LevelId" =>
"integer" 225 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
231 if (!is_array($a_ids)) {
232 $a_ids =
array($a_ids);
234 if ($a_entity ==
"skmg") {
235 switch ($a_version) {
237 if ($this->
getMode() == self::MODE_SKILLS) {
238 $this->
data[] =
array(
"Mode" =>
"Skills");
239 } elseif ($this->
getMode() == self::MODE_PROFILES) {
240 $this->
data[] =
array(
"Mode" =>
"Profiles");
246 if ($a_entity ==
"skl_subtree") {
247 switch ($a_version) {
249 foreach ($a_ids as
$id) {
250 $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id));
251 foreach ($sub as
$s) {
253 "SELECT * FROM skl_templ_ref " .
254 " WHERE skl_node_id = " .
$ilDB->quote($s[
"child"],
"integer")
256 $rec =
$ilDB->fetchAssoc($set);
258 $top_node = ($s[
"child"] ==
$id)
262 "SklTreeId" => $s[
"skl_tree_id"],
263 "TopNode" => $top_node,
264 "Child" => $s[
"child"],
265 "Parent" => $s[
"parent"],
266 "Depth" => $s[
"depth"],
267 "Type" => $s[
"type"],
268 "Title" => $s[
"title"],
269 "SelfEval" => $s[
"self_eval"],
270 "OrderNr" => $s[
"order_nr"],
271 "Status" => $s[
"status"],
272 "TemplateId" => (
int) $rec[
"templ_id"]
281 if ($a_entity ==
"skl_templ_subtree") {
282 switch ($a_version) {
284 foreach ($a_ids as
$id) {
285 $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id));
286 foreach ($sub as
$s) {
287 $top_node = ($s[
"child"] ==
$id)
291 "SklTreeId" => $s[
"skl_tree_id"],
292 "TopNode" => $top_node,
293 "Child" => $s[
"child"],
294 "Parent" => $s[
"parent"],
295 "Depth" => $s[
"depth"],
296 "Type" => $s[
"type"],
297 "Title" => $s[
"title"],
298 "SelfEval" => $s[
"self_eval"],
299 "OrderNr" => $s[
"order_nr"],
300 "Status" => $s[
"status"]
309 if ($a_entity ==
"skl_level") {
310 switch ($a_version) {
313 " FROM skl_level WHERE " .
314 $ilDB->in(
"skill_id", $a_ids,
false,
"integer") .
" ORDER BY skill_id ASC, nr ASC");
320 if ($a_entity ==
"skl_prof") {
321 switch ($a_version) {
324 " FROM skl_profile WHERE " .
325 $ilDB->in(
"id", $a_ids,
false,
"integer"));
331 if ($a_entity ==
"skl_prof_level") {
332 switch ($a_version) {
335 " FROM skl_profile_level WHERE " .
336 $ilDB->in(
"profile_id", $a_ids,
false,
"integer"));
350 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
355 if ($this->
getMode() == self::MODE_SKILLS) {
358 $exp_types =
array(
"skll",
"scat",
"sctr",
"sktr");
359 if (!is_array($sel_nodes)) {
360 $childs = $this->skill_tree->getChildsByTypeFilter($this->skill_tree->readRootId(), $exp_types);
362 $skl_subtree_deps =
array();
363 foreach ($childs as $c) {
364 $skl_subtree_deps[] = $c[
"child"];
367 foreach ($sel_nodes as
$n) {
369 $skl_subtree_deps[] =
$n;
375 $ref_nodes =
array();
376 if (is_array($skl_subtree_deps)) {
377 foreach ($skl_subtree_deps as
$id) {
381 $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id),
true,
"sktr");
382 foreach ($sub as
$s) {
383 $ref_nodes[$s[
"child"]] = $s[
"child"];
389 $set =
$ilDB->query(
"SELECT DISTINCT(templ_id) FROM skl_templ_ref " .
390 " WHERE " .
$ilDB->in(
"skl_node_id", $ref_nodes,
false,
"integer"));
391 while ($rec =
$ilDB->fetchAssoc($set)) {
392 $deps[
"skl_templ_subtree"][
"ids"][] = $rec[
"templ_id"];
396 $deps[
"skl_subtree"][
"ids"] = $skl_subtree_deps;
397 } elseif ($this->
getMode() == self::MODE_PROFILES) {
399 $deps[
"skl_prof"][
"ids"][] = $p_id;
406 case "skl_templ_subtree":
408 if (in_array($a_rec[
"Type"],
array(
"skll",
"sktp"))) {
409 $deps[
"skl_level"][
"ids"][] = $a_rec[
"Child"];
414 $deps[
"skl_prof_level"][
"ids"][] = $a_rec[
"Id"];
428 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
430 $source_inst_id = $a_mapping->getInstallId();
433 if ($a_rec[
"TopNode"] == 1) {
434 $parent = $this->skill_tree_root_id;
436 $order = $a_rec[
"OrderNr"] + $this->init_top_order_nr;
438 $parent = (int) $a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Parent"]);
439 $status = $a_rec[
"Status"];
440 $order = $a_rec[
"OrderNr"];
442 switch ($a_rec[
"Type"]) {
444 include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
446 $scat->setTitle($a_rec[
"Title"]);
447 $scat->setImportId(
"il_" . $source_inst_id .
"_scat_" . $a_rec[
"Child"]);
448 $scat->setSelfEvaluation($a_rec[
"SelfEval"]);
449 $scat->setOrderNr($order);
450 $scat->setStatus($status);
453 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $scat->getId());
457 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
459 $skll->setTitle($a_rec[
"Title"]);
460 $skll->setImportId(
"il_" . $source_inst_id .
"_skll_" . $a_rec[
"Child"]);
461 $skll->setSelfEvaluation($a_rec[
"SelfEval"]);
462 $skll->setOrderNr($order);
463 $skll->setStatus($status);
466 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $skll->getId());
470 $template_id = (int) $a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"TemplateId"]);
473 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
475 $sktr->setTitle($a_rec[
"Title"]);
476 $sktr->setImportId(
"il_" . $source_inst_id .
"_sktr_" . $a_rec[
"Child"]);
477 $sktr->setSelfEvaluation($a_rec[
"SelfEval"]);
478 $sktr->setOrderNr($order);
480 $sktr->setStatus($status);
483 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $sktr->getId());
490 case "skl_templ_subtree":
491 if ($a_rec[
"TopNode"] == 1) {
492 $parent = $this->skill_tree_root_id;
493 $order = $a_rec[
"OrderNr"] + $this->init_templ_top_order_nr;
495 $parent = (int) $a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Parent"]);
496 $order = $a_rec[
"OrderNr"];
498 switch ($a_rec[
"Type"]) {
500 include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
502 $sctp->setTitle($a_rec[
"Title"]);
503 $sctp->setImportId(
"il_" . $source_inst_id .
"_sctp_" . $a_rec[
"Child"]);
504 $sctp->setOrderNr($order);
507 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $sctp->getId());
511 include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
513 $sktp->setTitle($a_rec[
"Title"]);
514 $sktp->setImportId(
"il_" . $source_inst_id .
"_sktp_" . $a_rec[
"Child"]);
515 $sktp->setOrderNr($order);
518 $a_mapping->addMapping(
"Services/Skill",
"skl_tree", $a_rec[
"Child"], $sktp->getId());
524 $skill_id = (int) $a_mapping->getMapping(
"Services/Skill",
"skl_tree", $a_rec[
"SkillId"]);
527 if (
$type ==
"skll") {
532 $skill->addLevel($a_rec[
"Title"], $a_rec[
"Description"],
"il_" . $source_inst_id .
"_sklv_" . $a_rec[
"LevelId"]);
538 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
540 $prof->setTitle($a_rec[
"Title"]);
541 $prof->setDescription($a_rec[
"Description"]);
543 $a_mapping->addMapping(
"Services/Skill",
"skl_prof", $a_rec[
"Id"], $prof->getId());
546 case "skl_prof_level":
547 $profile_id = (int) $a_mapping->getMapping(
"Services/Skill",
"skl_prof", $a_rec[
"ProfileId"]);
548 if ($profile_id > 0) {
549 include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
550 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
556 $level_id = $tref_id = $base_skill = 0;
557 foreach ($level_id_data as
$l) {
559 foreach ($skill_data as
$s) {
563 $level_id = $l[
"level_id"];
564 $base_skill = $s[
"skill_id"];
565 $tref_id = $s[
"tref_id"];
570 $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.
if(!array_key_exists('StateId', $_REQUEST)) $id
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)