ILIAS  release_8 Revision v8.24
ilSkillDataSet Class Reference

Skill Data set class. More...

+ Inheritance diagram for ilSkillDataSet:
+ Collaboration diagram for ilSkillDataSet:

Public Member Functions

 __construct ()
 
 setMode (string $a_val)
 
 getMode ()
 
 setSelectedNodes (array $a_val)
 
 getSelectedNodes ()
 
 setSelectedProfiles (array $a_val)
 
 getSelectedProfiles ()
 
 setSkillTreeId (int $skill_tree_id)
 
 getSkillTreeId ()
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 
 init (string $a_entity, string $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 setExportDirectories (string $a_relative, string $a_absolute)
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setDSPrefix (string $a_val)
 
 getDSPrefix ()
 
 getDSPrefixString ()
 
 getDirectDataFromQuery (string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper (string $a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text" > <ftype name="field_2" type="date" > <ftype name="field_3" type="integer" > </types> <types ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> More...
 
 addRecordsXml (ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
 afterXmlRecordWriting (string $a_entity, string $a_version, array $a_set)
 
 getNamespaces (array &$namespaces, string $a_entity, string $a_schema_version)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 getXmlTypes (string $a_entity, string $a_version)
 Get xml types. More...
 
 getXMLEntityName (string $a_entity, string $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag (string $a_entity, string $a_schema_version)
 Get entity tag. More...
 
 setImport (ilSurveyImporter $a_val)
 
 getImport ()
 
 setCurrentInstallationId (string $a_val)
 
 getCurrentInstallationId ()
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 

Data Fields

const MODE_SKILLS = ""
 
const MODE_PROFILES = "prof"
 
- Data Fields inherited from ilDataSet
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
int $dircnt = 0
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 Get field types for entity. More...
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
- Protected Member Functions inherited from ilDataSet
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
 createObjectExportId (string $a_type, string $a_id)
 Build ilias export id. More...
 
 parseObjectExportId (string $a_id, ?string $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Protected Attributes

ilSkillTreeRepository $tree_repo
 
int $skill_tree_id = 0
 
int $skill_tree_root_id = 0
 
int $init_top_order_nr = 0
 
int $init_templ_top_order_nr = 0
 
array $selected_nodes = []
 
array $selected_profiles = []
 
string $mode = ""
 
SkillInternalManagerService $skill_manager
 
SkillTreeFactory $skill_tree_factory
 
SkillInternalFactoryService $skill_factory
 
- Protected Attributes inherited from ilDataSet
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $relative_export_dir = ""
 
string $absolute_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 

Detailed Description

Skill Data set class.

This class implements the following entities:

  • skmg: Skill management top entity (no data, only dependecies)
  • skee: Skill tree
  • skl_subtree: Skill subtree (includes data of skl_tree, skl_tree_node and skl_templ_ref)
  • skl_templ_subtree: Skill template subtree (includes data of skl_tree and skl_tree_node)
  • skl_level: Skill levels
  • skl_prof: skill profiles (different mode)
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 38 of file class.ilSkillDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillDataSet::__construct ( )

Reimplemented from ilDataSet.

Definition at line 64 of file class.ilSkillDataSet.php.

65 {
66 global $DIC;
67
68 $this->db = $DIC->database();
70
71 $this->skill_manager = $DIC->skills()->internal()->manager();
72 $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
73 $this->skill_factory = $DIC->skills()->internal()->factory();
74 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
75 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDependencies()

ilSkillDataSet::getDependencies ( string  $a_entity,
string  $a_version,
?array  $a_rec = null,
?array  $a_ids = null 
)
protected
Parameters
array{Idint, Child: int, Type: string} $a_rec
Returns
array<string, array{ids: int[]}>

Reimplemented from ilDataSet.

Definition at line 515 of file class.ilSkillDataSet.php.

520 : array {
522
523
524 switch ($a_entity) {
525 case "skmg":
526 $deps["skee"]["ids"] = $a_ids;
527 return $deps;
528
529 case "skee":
530 if (!isset($a_rec["Id"]) || is_null($a_rec["Id"])) {
531 return [];
532 }
533 $skill_tree = $this->skill_tree_factory->getTreeById((int) $a_rec["Id"]);
534
535 $deps = [];
536 if ($this->getMode() == self::MODE_SKILLS) {
537 // determine top nodes of main tree to be exported and all referenced template nodes
538 $sel_nodes = $this->getSelectedNodes();
539 $exp_types = array("skll", "scat", "sctr", "sktr");
540 if (!isset($sel_nodes) || count($sel_nodes) === 0) {
541 $childs = $skill_tree->getChildsByTypeFilter($skill_tree->readRootId(), $exp_types);
542 $skl_subtree_deps = [];
543 foreach ($childs as $c) {
544 $skl_subtree_deps[] = (int) $c["child"];
545 }
546 } else {
547 $skl_subtree_deps = [];
548 foreach ($sel_nodes as $n) {
549 if (in_array(ilSkillTreeNode::_lookupType($n), $exp_types)) {
550 $skl_subtree_deps[] = $n;
551 }
552 }
553 }
554
555 // determine template subtrees
556 $ref_nodes = [];
557 if (is_array($skl_subtree_deps)) {
558 foreach ($skl_subtree_deps as $id) {
559 if (ilSkillTreeNode::_lookupType($id) == "sktr") {
560 $ref_nodes[$id] = $id;
561 } else {
562 $sub = $skill_tree->getSubTree($skill_tree->getNodeData($id), true, ["sktr"]);
563 foreach ($sub as $s) {
564 $ref_nodes[$s["child"]] = $s["child"];
565 }
566 }
567 }
568 }
569
570 $set = $ilDB->query("SELECT DISTINCT(templ_id) FROM skl_templ_ref " .
571 " WHERE " . $ilDB->in("skl_node_id", $ref_nodes, false, "integer"));
572 while ($rec = $ilDB->fetchAssoc($set)) {
573 $deps["skl_templ_subtree"]["ids"][] = (int) $rec["templ_id"];
574 }
575
576 // export subtree after templates
577 $deps["skl_subtree"]["ids"] = $skl_subtree_deps;
578 } elseif ($this->getMode() == self::MODE_PROFILES) {
579 foreach ($this->getSelectedProfiles() as $p_id) {
580 $deps["skl_prof"]["ids"][] = $p_id;
581 }
582 }
583 return $deps;
584
585 case "skl_subtree":
586 case "skl_templ_subtree":
587 $deps = [];
588 if (in_array($a_rec["Type"], array("skll", "sktp"))) {
589 $deps["skl_level"]["ids"][] = $a_rec["Child"];
590 }
591 return $deps;
592
593 case "skl_prof":
594 case "skl_local_prof":
595 $deps["skl_prof_level"]["ids"][] = $a_rec["Id"] ?? null;
596 return $deps;
597 }
598
599 return [];
600 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ilDBInterface $db
static _lookupType(int $a_obj_id)
$c
Definition: cli.php:38

References $c, $id, $ilDB, ilSkillTreeNode\_lookupType(), getMode(), getSelectedNodes(), getSelectedProfiles(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getMode()

ilSkillDataSet::getMode ( )

Definition at line 82 of file class.ilSkillDataSet.php.

82 : string
83 {
84 return $this->mode;
85 }

References $mode.

Referenced by getDependencies(), and readData().

+ Here is the caller graph for this function:

◆ getSelectedNodes()

ilSkillDataSet::getSelectedNodes ( )
Returns
int[]

Definition at line 98 of file class.ilSkillDataSet.php.

98 : array
99 {
101 }

References $selected_nodes.

Referenced by getDependencies().

+ Here is the caller graph for this function:

◆ getSelectedProfiles()

ilSkillDataSet::getSelectedProfiles ( )
Returns
int[] (profile ids)

Definition at line 114 of file class.ilSkillDataSet.php.

114 : array
115 {
117 }

References $selected_profiles.

Referenced by getDependencies().

+ Here is the caller graph for this function:

◆ getSkillTreeId()

ilSkillDataSet::getSkillTreeId ( )

Definition at line 124 of file class.ilSkillDataSet.php.

124 : int
125 {
127 }

References $skill_tree_id.

Referenced by readData().

+ Here is the caller graph for this function:

◆ getSupportedVersions()

ilSkillDataSet::getSupportedVersions ( )
Returns
string[]

Reimplemented from ilDataSet.

Definition at line 132 of file class.ilSkillDataSet.php.

132 : array
133 {
134 return array("5.1.0", "7.0", "8.0");
135 }

◆ getTypes()

ilSkillDataSet::getTypes ( string  $a_entity,
string  $a_version 
)
protected

Get field types for entity.

Reimplemented from ilDataSet.

Definition at line 145 of file class.ilSkillDataSet.php.

145 : array
146 {
147 if ($a_entity == "skmg") {
148 switch ($a_version) {
149 case "5.1.0":
150 case "7.0":
151 return array(
152 "Mode" => "text"
153 );
154 case "8.0":
155 return array(
156 "Id" => "integer"
157 );
158 }
159 }
160 if ($a_entity == "skee") {
161 switch ($a_version) {
162 case "8.0":
163 return array(
164 "Id" => "integer",
165 "Mode" => "text"
166 );
167 }
168 }
169 if ($a_entity == "skl_subtree") {
170 switch ($a_version) {
171 case "5.1.0":
172 case "7.0":
173 case "8.0":
174 return array(
175 "SklTreeId" => "integer",
176 "TopNode" => "integer",
177 "Child" => "integer",
178 "Parent" => "integer",
179 "Depth" => "integer",
180 "Type" => "text",
181 "Title" => "text",
182 "Description" => "text",
183 "SelfEval" => "integer",
184 "OrderNr" => "integer",
185 "Status" => "integer",
186 "TemplateId" => "integer"
187 );
188 }
189 }
190 if ($a_entity == "skl_templ_subtree") {
191 switch ($a_version) {
192 case "5.1.0":
193 case "7.0":
194 case "8.0":
195 return array(
196 "SklTreeId" => "integer",
197 "TopNode" => "integer",
198 "Child" => "integer",
199 "Parent" => "integer",
200 "Depth" => "integer",
201 "Type" => "text",
202 "Title" => "text",
203 "Description" => "text",
204 "SelfEval" => "integer",
205 "OrderNr" => "integer",
206 "Status" => "integer"
207 );
208 }
209 }
210 if ($a_entity == "skl_level") {
211 switch ($a_version) {
212 case "5.1.0":
213 case "7.0":
214 case "8.0":
215 return array(
216 "LevelId" => "integer",
217 "SkillId" => "integer",
218 "Nr" => "integer",
219 "Title" => "text",
220 "Description" => "text"
221 );
222 }
223 }
224 if ($a_entity == "skl_prof") {
225 switch ($a_version) {
226 case "5.1.0":
227 case "7.0":
228 return array(
229 "Id" => "integer",
230 "Title" => "text",
231 "Description" => "text"
232 );
233 case "8.0":
234 return array(
235 "Id" => "integer",
236 "Title" => "text",
237 "Description" => "text",
238 "SkillTreeId" => "integer"
239 );
240 }
241 }
242 if ($a_entity == "skl_local_prof") {
243 switch ($a_version) {
244 case "7.0":
245 return array(
246 "Id" => "integer",
247 "Title" => "text",
248 "Description" => "text",
249 "RefId" => "integer"
250 );
251 case "8.0":
252 return array(
253 "Id" => "integer",
254 "Title" => "text",
255 "Description" => "text",
256 "RefId" => "integer",
257 "SkillTreeId" => "integer"
258 );
259 }
260 }
261 if ($a_entity == "skl_prof_level") {
262 switch ($a_version) {
263 case "5.1.0":
264 return array(
265 "ProfileId" => "integer",
266 "BaseSkillId" => "integer",
267 "TrefId" => "integer",
268 "LevelId" => "integer"
269 );
270 case "7.0":
271 case "8.0":
272 return array(
273 "ProfileId" => "integer",
274 "BaseSkillId" => "integer",
275 "TrefId" => "integer",
276 "LevelId" => "integer",
277 "OrderNr" => "integer"
278 );
279 }
280 }
281 return [];
282 }

◆ getXmlNamespace()

ilSkillDataSet::getXmlNamespace ( string  $a_entity,
string  $a_schema_version 
)
protected

Reimplemented from ilDataSet.

Definition at line 137 of file class.ilSkillDataSet.php.

137 : string
138 {
139 return "http://www.ilias.de/xml/Services/Skill/" . $a_entity;
140 }

◆ importRecord()

ilSkillDataSet::importRecord ( string  $a_entity,
array  $a_types,
array  $a_rec,
ilImportMapping  $a_mapping,
string  $a_schema_version 
)

Needs to be overwritten for import use case.

Reimplemented from ilDataSet.

Definition at line 602 of file class.ilSkillDataSet.php.

608 : void {
609 $skill_tree = $this->skill_tree_factory->getTreeById($this->getSkillTreeId());
610 $skill_tree_root_id = $skill_tree->readRootId();
611 $tree_node_manager = $this->skill_manager->getTreeNodeManager($this->getSkillTreeId());
612
613 $init_top_order_nr = $skill_tree->getMaxOrderNr($skill_tree_root_id);
614 $init_templ_top_order_nr = $skill_tree->getMaxOrderNr($skill_tree_root_id, true);
615
616 $source_inst_id = $a_mapping->getInstallId();
617 switch ($a_entity) {
618 case "skl_subtree":
619 if ($a_rec["TopNode"] == 1) {
620 $parent = $skill_tree_root_id;
622 $order = (int) $a_rec["OrderNr"] + $init_top_order_nr;
623 } else {
624 $parent = (int) $a_mapping->getMapping("Services/Skill", "skl_tree", $a_rec["Parent"]);
625 $status = (int) $a_rec["Status"];
626 $order = (int) $a_rec["OrderNr"];
627 }
628 switch ($a_rec["Type"]) {
629 case "scat":
630 $scat = new ilSkillCategory();
631 $scat->setTitle($a_rec["Title"]);
632 $scat->setDescription($a_rec["Description"] ?? "");
633 $scat->setImportId("il_" . $source_inst_id . "_scat_" . $a_rec["Child"]);
634 $scat->setSelfEvaluation((bool) $a_rec["SelfEval"]);
635 $scat->setOrderNr($order);
636 $scat->setStatus($status);
637 $scat->create();
638 $tree_node_manager->putIntoTree($scat, $parent);
639 $a_mapping->addMapping("Services/Skill", "skl_tree", $a_rec["Child"], $scat->getId());
640 break;
641
642 case "skll":
643 $skll = new ilBasicSkill();
644 $skll->setTitle($a_rec["Title"]);
645 $skll->setDescription($a_rec["Description"] ?? "");
646 $skll->setImportId("il_" . $source_inst_id . "_skll_" . $a_rec["Child"]);
647 $skll->setSelfEvaluation((bool) $a_rec["SelfEval"]);
648 $skll->setOrderNr($order);
649 $skll->setStatus($status);
650 $skll->create();
651 $tree_node_manager->putIntoTree($skll, $parent);
652 $a_mapping->addMapping("Services/Skill", "skl_tree", $a_rec["Child"], $skll->getId());
653 break;
654
655 case "sktr":
656 $template_id = (int) $a_mapping->getMapping("Services/Skill", "skl_tree", $a_rec["TemplateId"]);
657 // only create template references, if referenced template is found (template trees are imported first)
658 if ($template_id > 0) {
659 $sktr = new ilSkillTemplateReference();
660 $sktr->setTitle($a_rec["Title"]);
661 $sktr->setDescription($a_rec["Description"] ?? "");
662 $sktr->setImportId("il_" . $source_inst_id . "_sktr_" . $a_rec["Child"]);
663 $sktr->setSelfEvaluation((bool) $a_rec["SelfEval"]);
664 $sktr->setOrderNr($order);
665 $sktr->setSkillTemplateId($template_id);
666 $sktr->setStatus($status);
667 $sktr->create();
668 $tree_node_manager->putIntoTree($sktr, $parent);
669 $a_mapping->addMapping("Services/Skill", "skl_tree", $a_rec["Child"], $sktr->getId());
670 }
671 break;
672
673 }
674 break;
675
676 case "skl_templ_subtree":
677 if ($a_rec["TopNode"] == 1) {
678 $parent = $skill_tree_root_id;
679 $order = (int) $a_rec["OrderNr"] + $init_templ_top_order_nr;
680 } else {
681 $parent = (int) $a_mapping->getMapping("Services/Skill", "skl_tree", $a_rec["Parent"]);
682 $order = (int) $a_rec["OrderNr"];
683 }
684 switch ($a_rec["Type"]) {
685 case "sctp":
686 $sctp = new ilSkillTemplateCategory();
687 $sctp->setTitle($a_rec["Title"]);
688 $sctp->setDescription($a_rec["Description"] ?? "");
689 $sctp->setImportId("il_" . $source_inst_id . "_sctp_" . $a_rec["Child"]);
690 $sctp->setOrderNr($order);
691 $sctp->create();
692 $tree_node_manager->putIntoTree($sctp, $parent);
693 $a_mapping->addMapping("Services/Skill", "skl_tree", $a_rec["Child"], $sctp->getId());
694 break;
695
696 case "sktp":
697 $sktp = new ilBasicSkillTemplate();
698 $sktp->setTitle($a_rec["Title"]);
699 $sktp->setDescription($a_rec["Description"] ?? "");
700 $sktp->setImportId("il_" . $source_inst_id . "_sktp_" . $a_rec["Child"]);
701 $sktp->setOrderNr($order);
702 $sktp->create();
703 $tree_node_manager->putIntoTree($sktp, $parent);
704 $a_mapping->addMapping("Services/Skill", "skl_tree", $a_rec["Child"], $sktp->getId());
705 break;
706 }
707 break;
708
709 case "skl_level":
710 $skill_id = (int) $a_mapping->getMapping("Services/Skill", "skl_tree", $a_rec["SkillId"]);
712 if (in_array($type, array("skll", "sktp"))) {
713 if ($type == "skll") {
714 $skill = new ilBasicSkill($skill_id);
715 } else {
716 $skill = new ilBasicSkillTemplate($skill_id);
717 }
718 $skill->addLevel($a_rec["Title"], $a_rec["Description"], "il_" . $source_inst_id . "_sklv_" . $a_rec["LevelId"]);
719 $skill->update();
720 }
721 break;
722
723 case "skl_prof":
724 $profile = $this->skill_factory->profile(
725 0,
726 $a_rec["Title"],
727 $a_rec["Description"] ?? "",
728 $this->getSkillTreeId()
729 );
730 $new_profile = $this->skill_manager->getProfileManager()->createProfile($profile);
731
732 $a_mapping->addMapping("Services/Skill", "skl_prof", $a_rec["Id"], $new_profile->getId());
733 break;
734
735 case "skl_local_prof":
736 $profile = $this->skill_factory->profile(
737 0,
738 $a_rec["Title"],
739 $a_rec["Description"] ?? "",
740 $this->getSkillTreeId(),
741 "",
742 $a_rec["RefId"]
743 );
744 $new_profile = $this->skill_manager->getProfileManager()->createProfile($profile);
745
746 $a_mapping->addMapping("Services/Skill", "skl_local_prof", $a_rec["Id"], $new_profile->getId());
747 break;
748
749 case "skl_prof_level":
750 $profile_id = (int) $a_mapping->getMapping("Services/Skill", "skl_prof", $a_rec["ProfileId"])
751 ? (int) $a_mapping->getMapping("Services/Skill", "skl_prof", $a_rec["ProfileId"])
752 : (int) $a_mapping->getMapping("Services/Skill", "skl_local_prof", $a_rec["ProfileId"]);
753 if ($profile_id > 0) {
754 $prof = $this->skill_manager->getProfileManager()->getById($profile_id);
755 $level_id_data = ilBasicSkill::getLevelIdForImportId($this->getCurrentInstallationId(), $a_rec["LevelId"]);
756 $skill_data = ilBasicSkill::getCommonSkillIdForImportId($this->getCurrentInstallationId(), $a_rec["BaseSkillId"], $a_rec["TrefId"]);
757 $level_id = $tref_id = $base_skill = 0;
758 foreach ($level_id_data as $l) {
759 reset($skill_data);
760 foreach ($skill_data as $s) {
761 // echo "<br>=".ilBasicSkill::lookupLevelSkillId($l["level_id"])."=".$s["skill_id"]."=";
762
763 if ($level_id == 0 && ilBasicSkill::lookupLevelSkillId($l["level_id"]) == $s["skill_id"]) {
764 $level_id = $l["level_id"];
765 $base_skill = $s["skill_id"];
766 $tref_id = $s["tref_id"];
767 }
768 }
769 }
770 if ($level_id > 0) {
771 $prof->addSkillLevel($base_skill, $tref_id, $level_id, $a_rec["OrderNr"]);
772 }
773 $this->skill_manager->getProfileManager()->updateProfile($prof);
774 }
775 break;
776 }
777 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupLevelSkillId(int $a_id)
static getCommonSkillIdForImportId(int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
getCurrentInstallationId()
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type

References $type, ilSkillTreeNode\_lookupType(), ilImportMapping\addMapping(), ilBasicSkill\getCommonSkillIdForImportId(), ilBasicSkill\getLevelIdForImportId(), ilImportMapping\getMapping(), ILIAS\Repository\int(), ilBasicSkill\lookupLevelSkillId(), and ilSkillTreeNode\STATUS_DRAFT.

+ Here is the call graph for this function:

◆ readData()

ilSkillDataSet::readData ( string  $a_entity,
string  $a_version,
array  $a_ids 
)

Read data from DB.

This should result in the abstract field structure of the version set in the constructor.

Reimplemented from ilDataSet.

Definition at line 284 of file class.ilSkillDataSet.php.

284 : void
285 {
287
288 $this->data = [];
289
290 if (!is_array($a_ids)) {
291 $a_ids = array($a_ids);
292 }
293 if ($a_entity == "skmg") {
294 switch ($a_version) {
295 case "5.1.0":
296 case "7.0":
297 if ($this->getMode() == self::MODE_SKILLS) {
298 $this->data[] = array("Mode" => "Skills");
299 } elseif ($this->getMode() == self::MODE_PROFILES) {
300 $this->data[] = array("Mode" => "Profiles");
301 }
302 break;
303 case "8.0":
304 $this->data[] = [
305 "Id" => $this->getSkillTreeId()
306 ];
307 break;
308 }
309 }
310 if ($a_entity == "skee") { // dummy node
311 switch ($a_version) {
312 case "8.0":
313 foreach ($a_ids as $id) {
314 if ($this->getMode() == self::MODE_SKILLS) {
315 $this->data[] = array(
316 "Id" => $id,
317 "Mode" => "Skills"
318 );
319 } elseif ($this->getMode() == self::MODE_PROFILES) {
320 $this->data[] = array(
321 "Id" => $id,
322 "Mode" => "Profiles"
323 );
324 }
325 }
326 break;
327
328 }
329 }
330 if ($a_entity == "skl_subtree") { // get subtree for top node
331 switch ($a_version) {
332 case "5.1.0":
333 case "7.0":
334 case "8.0":
335 foreach ($a_ids as $id) {
336 $skill_tree = $this->tree_repo->getTreeForNodeId($id);
337 $sub = $skill_tree->getSubTree($skill_tree->getNodeData($id));
338 foreach ($sub as $s) {
339 $set = $ilDB->query(
340 "SELECT * FROM skl_templ_ref " .
341 " WHERE skl_node_id = " . $ilDB->quote($s["child"], "integer")
342 );
343 $rec = $ilDB->fetchAssoc($set);
344
345 $top_node = ($s["child"] == $id)
346 ? 1
347 : 0;
348 $this->data[] = array(
349 "SklTreeId" => $s["skl_tree_id"],
350 "TopNode" => $top_node,
351 "Child" => $s["child"],
352 "Parent" => $s["parent"],
353 "Depth" => $s["depth"],
354 "Type" => $s["type"],
355 "Title" => $s["title"],
356 "Description" => $s["description"],
357 "SelfEval" => $s["self_eval"],
358 "OrderNr" => $s["order_nr"],
359 "Status" => $s["status"],
360 "TemplateId" => (int) ($rec["templ_id"] ?? 0)
361 );
362 }
363 }
364 break;
365
366 }
367 }
368
369 if ($a_entity == "skl_templ_subtree") { // get template subtree for template id
370 switch ($a_version) {
371 case "5.1.0":
372 case "7.0":
373 case "8.0":
374 foreach ($a_ids as $id) {
375 $skill_tree = $this->tree_repo->getTreeForNodeId($id);
376 $sub = $skill_tree->getSubTree($skill_tree->getNodeData($id));
377 foreach ($sub as $s) {
378 $top_node = ($s["child"] == $id)
379 ? 1
380 : 0;
381 $this->data[] = array(
382 "SklTreeId" => $s["skl_tree_id"],
383 "TopNode" => $top_node,
384 "Child" => $s["child"],
385 "Parent" => $s["parent"],
386 "Depth" => $s["depth"],
387 "Type" => $s["type"],
388 "Title" => $s["title"],
389 "Description" => $s["description"],
390 "SelfEval" => $s["self_eval"],
391 "OrderNr" => $s["order_nr"],
392 "Status" => $s["status"]
393 );
394 }
395 }
396 break;
397
398 }
399 }
400
401 if ($a_entity == "skl_level") {
402 switch ($a_version) {
403 case "5.1.0":
404 case "7.0":
405 case "8.0":
406 $this->getDirectDataFromQuery("SELECT id level_id, skill_id, nr, title, description" .
407 " FROM skl_level WHERE " .
408 $ilDB->in("skill_id", $a_ids, false, "integer") . " ORDER BY skill_id ASC, nr ASC");
409 break;
410
411 }
412 }
413
414 if ($a_entity == "skl_prof") {
415 switch ($a_version) {
416 case "5.1.0":
417 case "7.0":
418 $this->getDirectDataFromQuery("SELECT id, title, description" .
419 " FROM skl_profile WHERE " .
420 $ilDB->in("id", $a_ids, false, "integer"));
421 break;
422 case "8.0":
423 $set = $ilDB->query(
424 "SELECT id, title, description FROM skl_profile " .
425 " WHERE " . $ilDB->in("id", $a_ids, false, "integer")
426 );
427 while ($rec = $ilDB->fetchAssoc($set)) {
428 $this->data[] = [
429 "Id" => $rec["id"],
430 "Title" => $rec["title"],
431 "Description" => $rec["description"],
432 "SkillTreeId" => $this->getSkillTreeId()
433 ];
434 }
435 break;
436
437 }
438 }
439
440 if ($a_entity == "skl_local_prof") {
441 switch ($a_version) {
442 case "7.0":
443 foreach ($a_ids as $obj_id) {
444 $obj_ref_id = ilObject::_getAllReferences($obj_id);
445 $obj_ref_id = end($obj_ref_id);
446 $profiles = $this->skill_manager->getProfileManager()->getLocalProfilesForObject($obj_ref_id);
447 $profile_ids = [];
448 foreach ($profiles as $p) {
449 $profile_ids[] = $p["id"];
450 }
451 $set = $ilDB->query(
452 "SELECT * FROM skl_profile " .
453 " WHERE " . $ilDB->in("id", $profile_ids, false, "integer")
454 );
455 while ($rec = $ilDB->fetchAssoc($set)) {
456 $this->data[] = [
457 "Id" => $rec["id"],
458 "Title" => $rec["title"],
459 "Description" => $rec["description"],
460 "RefId" => $obj_ref_id
461 ];
462 }
463 }
464 break;
465 case "8.0":
466 foreach ($a_ids as $obj_id) {
467 $obj_ref_id = ilObject::_getAllReferences((int)$obj_id);
468 $obj_ref_id = end($obj_ref_id);
469 $profiles = $this->skill_manager->getProfileManager()->getLocalProfilesForObject($obj_ref_id);
470 $profile_ids = [];
471 foreach ($profiles as $p) {
472 $profile_ids[] = $p["id"];
473 }
474 $set = $ilDB->query(
475 "SELECT * FROM skl_profile " .
476 " WHERE " . $ilDB->in("id", $profile_ids, false, "integer")
477 );
478 while ($rec = $ilDB->fetchAssoc($set)) {
479 $this->data[] = [
480 "Id" => $rec["id"],
481 "Title" => $rec["title"],
482 "Description" => $rec["description"],
483 "RefId" => $obj_ref_id,
484 "SkillTreeId" => $this->getSkillTreeId()
485 ];
486 }
487 }
488 break;
489
490 }
491 }
492
493 if ($a_entity == "skl_prof_level") {
494 switch ($a_version) {
495 case "5.1.0":
496 $this->getDirectDataFromQuery("SELECT profile_id, base_skill_id, tref_id, level_id" .
497 " FROM skl_profile_level WHERE " .
498 $ilDB->in("profile_id", $a_ids, false, "integer"));
499 break;
500 case "7.0":
501 case "8.0":
502 $this->getDirectDataFromQuery("SELECT profile_id, base_skill_id, tref_id, level_id, order_nr" .
503 " FROM skl_profile_level WHERE " .
504 $ilDB->in("profile_id", $a_ids, false, "integer"));
505 break;
506 }
507 }
508 }
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static _getAllReferences(int $id)
get all reference ids for object ID

References ilDataSet\$db, $id, $ilDB, ilObject\_getAllReferences(), ilDataSet\getDirectDataFromQuery(), getMode(), and getSkillTreeId().

+ Here is the call graph for this function:

◆ setMode()

ilSkillDataSet::setMode ( string  $a_val)

Definition at line 77 of file class.ilSkillDataSet.php.

77 : void
78 {
79 $this->mode = $a_val;
80 }

◆ setSelectedNodes()

ilSkillDataSet::setSelectedNodes ( array  $a_val)
Parameters
int[]$a_val

Definition at line 90 of file class.ilSkillDataSet.php.

90 : void
91 {
92 $this->selected_nodes = $a_val;
93 }

◆ setSelectedProfiles()

ilSkillDataSet::setSelectedProfiles ( array  $a_val)
Parameters
int[]$a_val(profile ids)

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

106 : void
107 {
108 $this->selected_profiles = $a_val;
109 }

◆ setSkillTreeId()

ilSkillDataSet::setSkillTreeId ( int  $skill_tree_id)

Definition at line 119 of file class.ilSkillDataSet.php.

119 : void
120 {
121 $this->skill_tree_id = $skill_tree_id;
122 }

References $skill_tree_id.

Field Documentation

◆ $init_templ_top_order_nr

int ilSkillDataSet::$init_templ_top_order_nr = 0
protected

Definition at line 47 of file class.ilSkillDataSet.php.

◆ $init_top_order_nr

int ilSkillDataSet::$init_top_order_nr = 0
protected

Definition at line 46 of file class.ilSkillDataSet.php.

◆ $mode

string ilSkillDataSet::$mode = ""
protected

Definition at line 58 of file class.ilSkillDataSet.php.

Referenced by getMode().

◆ $selected_nodes

array ilSkillDataSet::$selected_nodes = []
protected

Definition at line 52 of file class.ilSkillDataSet.php.

Referenced by getSelectedNodes().

◆ $selected_profiles

array ilSkillDataSet::$selected_profiles = []
protected

Definition at line 57 of file class.ilSkillDataSet.php.

Referenced by getSelectedProfiles().

◆ $skill_factory

SkillInternalFactoryService ilSkillDataSet::$skill_factory
protected

Definition at line 62 of file class.ilSkillDataSet.php.

◆ $skill_manager

SkillInternalManagerService ilSkillDataSet::$skill_manager
protected

Definition at line 60 of file class.ilSkillDataSet.php.

◆ $skill_tree_factory

SkillTreeFactory ilSkillDataSet::$skill_tree_factory
protected

Definition at line 61 of file class.ilSkillDataSet.php.

◆ $skill_tree_id

int ilSkillDataSet::$skill_tree_id = 0
protected

Definition at line 44 of file class.ilSkillDataSet.php.

Referenced by getSkillTreeId(), and setSkillTreeId().

◆ $skill_tree_root_id

int ilSkillDataSet::$skill_tree_root_id = 0
protected

Definition at line 45 of file class.ilSkillDataSet.php.

◆ $tree_repo

ilSkillTreeRepository ilSkillDataSet::$tree_repo
protected

Definition at line 42 of file class.ilSkillDataSet.php.

◆ MODE_PROFILES

const ilSkillDataSet::MODE_PROFILES = "prof"

Definition at line 41 of file class.ilSkillDataSet.php.

◆ MODE_SKILLS

const ilSkillDataSet::MODE_SKILLS = ""

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


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