ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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)
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
- 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 ...> ... 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...
 
 getCollection (array $record, string $entity, string $schema_version, string $field, string $value)
 

Data Fields

const MODE_SKILLS = ""
 
const MODE_PROFILES = "prof"
 
- Data Fields inherited from ilDataSet
const DATASET_NS = 'http://www.ilias.de/Services/DataSet/ds/4_3'
 
const DATASET_NS_PREFIX = 'ds'
 
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
ILIAS ResourceStorage Services $irss
 
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 39 of file class.ilSkillDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillDataSet::__construct ( )

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

References $DIC, and ILIAS\MetaData\Repository\Validation\Data\__construct().

66  {
67  global $DIC;
68 
69  $this->db = $DIC->database();
71 
72  $this->skill_manager = $DIC->skills()->internal()->manager();
73  $this->skill_tree_factory = $DIC->skills()->internal()->factory()->tree();
74  $this->skill_factory = $DIC->skills()->internal()->factory();
75  $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
76  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ 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[]}>

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

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

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

◆ getMode()

ilSkillDataSet::getMode ( )

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

References $mode.

Referenced by getDependencies(), and readData().

83  : string
84  {
85  return $this->mode;
86  }
+ Here is the caller graph for this function:

◆ getSelectedNodes()

ilSkillDataSet::getSelectedNodes ( )
Returns
int[]

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

References $selected_nodes.

Referenced by getDependencies().

99  : array
100  {
101  return $this->selected_nodes;
102  }
+ Here is the caller graph for this function:

◆ getSelectedProfiles()

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

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

References $selected_profiles.

Referenced by getDependencies().

115  : array
116  {
118  }
+ Here is the caller graph for this function:

◆ getSkillTreeId()

ilSkillDataSet::getSkillTreeId ( )

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

References $skill_tree_id.

Referenced by importRecord(), and readData().

125  : int
126  {
127  return $this->skill_tree_id;
128  }
+ Here is the caller graph for this function:

◆ getSupportedVersions()

ilSkillDataSet::getSupportedVersions ( )
Returns
string[]

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

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

◆ getTypes()

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

Get field types for entity.

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

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

◆ getXmlNamespace()

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

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

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

◆ importRecord()

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

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

References $skill_tree_root_id, ilSkillTreeNode\_lookupType(), ilImportMapping\addMapping(), ilBasicSkill\getCommonSkillIdForImportId(), ilDataSet\getCurrentInstallationId(), ilImportMapping\getInstallId(), ilBasicSkill\getLevelIdForImportId(), ilImportMapping\getMapping(), getSkillTreeId(), ILIAS\Repository\int(), ilBasicSkill\lookupLevelSkillId(), and ilSkillTreeNode\STATUS_DRAFT.

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

◆ readData()

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

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

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

285  : void
286  {
287  $ilDB = $this->db;
288 
289  $this->data = [];
290 
291  if (!is_array($a_ids)) {
292  $a_ids = array($a_ids);
293  }
294  if ($a_entity == "skmg") {
295  switch ($a_version) {
296  case "5.1.0":
297  case "7.0":
298  if ($this->getMode() == self::MODE_SKILLS) {
299  $this->data[] = array("Mode" => "Skills");
300  } elseif ($this->getMode() == self::MODE_PROFILES) {
301  $this->data[] = array("Mode" => "Profiles");
302  }
303  break;
304  case "8.0":
305  $this->data[] = [
306  "Id" => $this->getSkillTreeId()
307  ];
308  break;
309  }
310  }
311  if ($a_entity == "skee") { // dummy node
312  switch ($a_version) {
313  case "8.0":
314  foreach ($a_ids as $id) {
315  if ($this->getMode() == self::MODE_SKILLS) {
316  $this->data[] = array(
317  "Id" => $id,
318  "Mode" => "Skills"
319  );
320  } elseif ($this->getMode() == self::MODE_PROFILES) {
321  $this->data[] = array(
322  "Id" => $id,
323  "Mode" => "Profiles"
324  );
325  }
326  }
327  break;
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  if ($a_entity == "skl_templ_subtree") { // get template subtree for template id
369  switch ($a_version) {
370  case "5.1.0":
371  case "7.0":
372  case "8.0":
373  foreach ($a_ids as $id) {
374  $skill_tree = $this->tree_repo->getTreeForNodeId($id);
375  $sub = $skill_tree->getSubTree($skill_tree->getNodeData($id));
376  foreach ($sub as $s) {
377  $top_node = ($s["child"] == $id)
378  ? 1
379  : 0;
380  $this->data[] = array(
381  "SklTreeId" => $s["skl_tree_id"],
382  "TopNode" => $top_node,
383  "Child" => $s["child"],
384  "Parent" => $s["parent"],
385  "Depth" => $s["depth"],
386  "Type" => $s["type"],
387  "Title" => $s["title"],
388  "Description" => $s["description"],
389  "SelfEval" => $s["self_eval"],
390  "OrderNr" => $s["order_nr"],
391  "Status" => $s["status"]
392  );
393  }
394  }
395  break;
396  }
397  }
398 
399  if ($a_entity == "skl_level") {
400  switch ($a_version) {
401  case "5.1.0":
402  case "7.0":
403  case "8.0":
404  $this->getDirectDataFromQuery("SELECT id level_id, skill_id, nr, title, description" .
405  " FROM skl_level WHERE " .
406  $ilDB->in("skill_id", $a_ids, false, "integer") . " ORDER BY skill_id ASC, nr ASC");
407  break;
408  }
409  }
410 
411  if ($a_entity == "skl_prof") {
412  switch ($a_version) {
413  case "5.1.0":
414  case "7.0":
415  $this->getDirectDataFromQuery("SELECT id, title, description" .
416  " FROM skl_profile WHERE " .
417  $ilDB->in("id", $a_ids, false, "integer"));
418  break;
419  case "8.0":
420  $set = $ilDB->query(
421  "SELECT id, title, description FROM skl_profile " .
422  " WHERE " . $ilDB->in("id", $a_ids, false, "integer")
423  );
424  while ($rec = $ilDB->fetchAssoc($set)) {
425  $this->data[] = [
426  "Id" => $rec["id"],
427  "Title" => $rec["title"],
428  "Description" => $rec["description"],
429  "SkillTreeId" => $this->getSkillTreeId()
430  ];
431  }
432  break;
433  }
434  }
435 
436  if ($a_entity == "skl_local_prof") {
437  switch ($a_version) {
438  case "7.0":
439  foreach ($a_ids as $obj_id) {
440  $obj_ref_id = ilObject::_getAllReferences($obj_id);
441  $obj_ref_id = end($obj_ref_id);
442  $profiles = $this->skill_manager->getProfileManager()->getLocalProfilesForObject($obj_ref_id);
443  $profile_ids = [];
444  foreach ($profiles as $p) {
445  $profile_ids[] = $p->getId();
446  }
447  $set = $ilDB->query(
448  "SELECT * FROM skl_profile " .
449  " WHERE " . $ilDB->in("id", $profile_ids, false, "integer")
450  );
451  while ($rec = $ilDB->fetchAssoc($set)) {
452  $this->data[] = [
453  "Id" => $rec["id"],
454  "Title" => $rec["title"],
455  "Description" => $rec["description"],
456  "RefId" => $obj_ref_id
457  ];
458  }
459  }
460  break;
461  case "8.0":
462  foreach ($a_ids as $obj_id) {
463  $obj_ref_id = ilObject::_getAllReferences((int)$obj_id);
464  $obj_ref_id = end($obj_ref_id);
465  $profiles = $this->skill_manager->getProfileManager()->getLocalProfilesForObject($obj_ref_id);
466  $profile_ids = [];
467  foreach ($profiles as $p) {
468  $profile_ids[] = $p->getId();
469  }
470  $set = $ilDB->query(
471  "SELECT * FROM skl_profile " .
472  " WHERE " . $ilDB->in("id", $profile_ids, false, "integer")
473  );
474  while ($rec = $ilDB->fetchAssoc($set)) {
475  $this->data[] = [
476  "Id" => $rec["id"],
477  "Title" => $rec["title"],
478  "Description" => $rec["description"],
479  "RefId" => $obj_ref_id,
480  "SkillTreeId" => $this->getSkillTreeId()
481  ];
482  }
483  }
484  break;
485  }
486  }
487 
488  if ($a_entity == "skl_prof_level") {
489  switch ($a_version) {
490  case "5.1.0":
491  $this->getDirectDataFromQuery("SELECT profile_id, base_skill_id, tref_id, level_id" .
492  " FROM skl_profile_level WHERE " .
493  $ilDB->in("profile_id", $a_ids, false, "integer"));
494  break;
495  case "7.0":
496  case "8.0":
497  $this->getDirectDataFromQuery("SELECT profile_id, base_skill_id, tref_id, level_id, order_nr" .
498  " FROM skl_profile_level WHERE " .
499  $ilDB->in("profile_id", $a_ids, false, "integer"));
500  break;
501  }
502  }
503  }
static _getAllReferences(int $id)
get all reference ids for object ID
ilDBInterface $db
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 ...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ setMode()

ilSkillDataSet::setMode ( string  $a_val)

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

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

◆ setSelectedNodes()

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

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

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

◆ setSelectedProfiles()

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

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

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

◆ setSkillTreeId()

ilSkillDataSet::setSkillTreeId ( int  $skill_tree_id)

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

References $skill_tree_id.

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

Field Documentation

◆ $init_templ_top_order_nr

int ilSkillDataSet::$init_templ_top_order_nr = 0
protected

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

◆ $init_top_order_nr

int ilSkillDataSet::$init_top_order_nr = 0
protected

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

◆ $mode

string ilSkillDataSet::$mode = ""
protected

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

Referenced by getMode().

◆ $selected_nodes

array ilSkillDataSet::$selected_nodes = []
protected

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

Referenced by getSelectedNodes().

◆ $selected_profiles

array ilSkillDataSet::$selected_profiles = []
protected

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

Referenced by getSelectedProfiles().

◆ $skill_factory

SkillInternalFactoryService ilSkillDataSet::$skill_factory
protected

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

◆ $skill_manager

SkillInternalManagerService ilSkillDataSet::$skill_manager
protected

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

◆ $skill_tree_factory

SkillTreeFactory ilSkillDataSet::$skill_tree_factory
protected

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

◆ $skill_tree_id

int ilSkillDataSet::$skill_tree_id = 0
protected

Definition at line 45 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 46 of file class.ilSkillDataSet.php.

Referenced by importRecord().

◆ $tree_repo

ilSkillTreeRepository ilSkillDataSet::$tree_repo
protected

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

◆ MODE_PROFILES

const ilSkillDataSet::MODE_PROFILES = "prof"

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

◆ MODE_SKILLS

const ilSkillDataSet::MODE_SKILLS = ""

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


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