4include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
 
   41        $this->db = 
$DIC->database();
 
   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                            "Description" => 
"text",
 
  160                            "SelfEval" => 
"integer",
 
  161                            "OrderNr" => 
"integer",
 
  162                            "Status" => 
"integer",
 
  163                            "TemplateId" => 
"integer" 
  167        if ($a_entity == 
"skl_templ_subtree") {
 
  168            switch ($a_version) {
 
  171                            "SklTreeId" => 
"integer",
 
  172                            "TopNode" => 
"integer",
 
  173                            "Child" => 
"integer",
 
  174                            "Parent" => 
"integer",
 
  175                            "Depth" => 
"integer",
 
  178                            "Description" => 
"text",
 
  179                            "SelfEval" => 
"integer",
 
  180                            "OrderNr" => 
"integer",
 
  181                            "Status" => 
"integer" 
  185        if ($a_entity == 
"skl_level") {
 
  186            switch ($a_version) {
 
  189                            "LevelId" => 
"integer",
 
  190                            "SkillId" => 
"integer",
 
  193                            "Description" => 
"text" 
  197        if ($a_entity == 
"skl_prof") {
 
  198            switch ($a_version) {
 
  203                            "Description" => 
"text" 
  207        if ($a_entity == 
"skl_prof_level") {
 
  208            switch ($a_version) {
 
  211                            "ProfileId" => 
"integer",
 
  212                            "BaseSkillId" => 
"integer",
 
  213                            "TrefId" => 
"integer",
 
  214                            "LevelId" => 
"integer" 
  227    public function readData($a_entity, $a_version, $a_ids, $a_field = 
"")
 
  231        $this->data = array();
 
  233        if (!is_array($a_ids)) {
 
  234            $a_ids = array($a_ids);
 
  236        if ($a_entity == 
"skmg") {      
 
  237            switch ($a_version) {
 
  239                    if ($this->
getMode() == self::MODE_SKILLS) {
 
  240                        $this->data[] = array(
"Mode" => 
"Skills");
 
  241                    } elseif ($this->
getMode() == self::MODE_PROFILES) {
 
  242                        $this->data[] = array(
"Mode" => 
"Profiles");
 
  248        if ($a_entity == 
"skl_subtree") {       
 
  249            switch ($a_version) {
 
  251                    foreach ($a_ids as $id) {
 
  252                        $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id));
 
  253                        foreach ($sub as $s) {
 
  255                                "SELECT * FROM skl_templ_ref " .
 
  256                                " WHERE skl_node_id = " . 
$ilDB->quote($s[
"child"], 
"integer")
 
  258                            $rec = 
$ilDB->fetchAssoc($set);
 
  260                            $top_node = ($s[
"child"] == $id)
 
  263                            $this->data[] = array(
 
  264                                    "SklTreeId" => $s[
"skl_tree_id"],
 
  265                                    "TopNode" => $top_node,
 
  266                                    "Child" => $s[
"child"],
 
  267                                    "Parent" => $s[
"parent"],
 
  268                                    "Depth" => $s[
"depth"],
 
  269                                    "Type" => $s[
"type"],
 
  270                                    "Title" => $s[
"title"],
 
  271                                    "Description" => $s[
"description"],
 
  272                                    "SelfEval" => $s[
"self_eval"],
 
  273                                    "OrderNr" => $s[
"order_nr"],
 
  274                                    "Status" => $s[
"status"],
 
  275                                    "TemplateId" => (
int) $rec[
"templ_id"]
 
  284        if ($a_entity == 
"skl_templ_subtree") { 
 
  285            switch ($a_version) {
 
  287                    foreach ($a_ids as $id) {
 
  288                        $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id));
 
  289                        foreach ($sub as $s) {
 
  290                            $top_node = ($s[
"child"] == $id)
 
  293                            $this->data[] = array(
 
  294                                    "SklTreeId" => $s[
"skl_tree_id"],
 
  295                                    "TopNode" => $top_node,
 
  296                                    "Child" => $s[
"child"],
 
  297                                    "Parent" => $s[
"parent"],
 
  298                                    "Depth" => $s[
"depth"],
 
  299                                    "Type" => $s[
"type"],
 
  300                                    "Title" => $s[
"title"],
 
  301                                    "Description" => $s[
"description"],
 
  302                                    "SelfEval" => $s[
"self_eval"],
 
  303                                    "OrderNr" => $s[
"order_nr"],
 
  304                                    "Status" => $s[
"status"]
 
  313        if ($a_entity == 
"skl_level") {
 
  314            switch ($a_version) {
 
  317                            " FROM skl_level WHERE " .
 
  318                            $ilDB->in(
"skill_id", $a_ids, 
false, 
"integer") . 
" ORDER BY skill_id ASC, nr ASC");
 
  324        if ($a_entity == 
"skl_prof") {
 
  325            switch ($a_version) {
 
  328                            " FROM skl_profile WHERE " .
 
  329                            $ilDB->in(
"id", $a_ids, 
false, 
"integer"));
 
  335        if ($a_entity == 
"skl_prof_level") {
 
  336            switch ($a_version) {
 
  339                            " FROM skl_profile_level WHERE " .
 
  340                            $ilDB->in(
"profile_id", $a_ids, 
false, 
"integer"));
 
  354        include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
 
  359                if ($this->
getMode() == self::MODE_SKILLS) {
 
  362                    $exp_types = array(
"skll", 
"scat", 
"sctr", 
"sktr");
 
  363                    if (!is_array($sel_nodes)) {
 
  364                        $childs = $this->skill_tree->getChildsByTypeFilter($this->skill_tree->readRootId(), $exp_types);
 
  366                        $skl_subtree_deps = array();
 
  367                        foreach ($childs as 
$c) {
 
  368                            $skl_subtree_deps[] = 
$c[
"child"];
 
  371                        foreach ($sel_nodes as 
$n) {
 
  373                                $skl_subtree_deps[] = 
$n;
 
  379                    $ref_nodes = array();
 
  380                    if (is_array($skl_subtree_deps)) {
 
  381                        foreach ($skl_subtree_deps as $id) {
 
  383                                $ref_nodes[$id] = $id;
 
  385                                $sub = $this->skill_tree->getSubTree($this->skill_tree->getNodeData($id), 
true, 
"sktr");
 
  386                                foreach ($sub as $s) {
 
  387                                    $ref_nodes[$s[
"child"]] = $s[
"child"];
 
  393                    $set = 
$ilDB->query(
"SELECT DISTINCT(templ_id) FROM skl_templ_ref " .
 
  394                            " WHERE " . 
$ilDB->in(
"skl_node_id", $ref_nodes, 
false, 
"integer"));
 
  395                    while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  396                        $deps[
"skl_templ_subtree"][
"ids"][] = $rec[
"templ_id"];
 
  400                    $deps[
"skl_subtree"][
"ids"] = $skl_subtree_deps;
 
  401                } elseif ($this->
getMode() == self::MODE_PROFILES) {
 
  403                        $deps[
"skl_prof"][
"ids"][] = $p_id;
 
  410            case "skl_templ_subtree":
 
  412                if (in_array($a_rec[
"Type"], array(
"skll", 
"sktp"))) {
 
  413                    $deps[
"skl_level"][
"ids"][] = $a_rec[
"Child"];
 
  418                $deps[
"skl_prof_level"][
"ids"][] = $a_rec[
"Id"];
 
  432    public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 
  434        $source_inst_id = $a_mapping->getInstallId();
 
  437                if ($a_rec[
"TopNode"] == 1) {
 
  438                    $parent = $this->skill_tree_root_id;
 
  440                    $order = $a_rec[
"OrderNr"] + $this->init_top_order_nr;
 
  442                    $parent = (int) $a_mapping->getMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Parent"]);
 
  443                    $status = $a_rec[
"Status"];
 
  444                    $order = $a_rec[
"OrderNr"];
 
  446                switch ($a_rec[
"Type"]) {
 
  448                        include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
 
  450                        $scat->setTitle($a_rec[
"Title"]);
 
  451                        $scat->setDescription($a_rec[
"Description"]);
 
  452                        $scat->setImportId(
"il_" . $source_inst_id . 
"_scat_" . $a_rec[
"Child"]);
 
  453                        $scat->setSelfEvaluation($a_rec[
"SelfEval"]);
 
  454                        $scat->setOrderNr($order);
 
  455                        $scat->setStatus($status);
 
  458                        $a_mapping->addMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Child"], $scat->getId());
 
  462                        include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
 
  464                        $skll->setTitle($a_rec[
"Title"]);
 
  465                        $skll->setDescription($a_rec[
"Description"]);
 
  466                        $skll->setImportId(
"il_" . $source_inst_id . 
"_skll_" . $a_rec[
"Child"]);
 
  467                        $skll->setSelfEvaluation($a_rec[
"SelfEval"]);
 
  468                        $skll->setOrderNr($order);
 
  469                        $skll->setStatus($status);
 
  472                        $a_mapping->addMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Child"], $skll->getId());
 
  476                        $template_id = (int) $a_mapping->getMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"TemplateId"]);
 
  478                        if ($template_id > 0) {
 
  479                            include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
 
  481                            $sktr->setTitle($a_rec[
"Title"]);
 
  482                            $sktr->setDescription($a_rec[
"Description"]);
 
  483                            $sktr->setImportId(
"il_" . $source_inst_id . 
"_sktr_" . $a_rec[
"Child"]);
 
  484                            $sktr->setSelfEvaluation($a_rec[
"SelfEval"]);
 
  485                            $sktr->setOrderNr($order);
 
  486                            $sktr->setSkillTemplateId($template_id);
 
  487                            $sktr->setStatus($status);
 
  490                            $a_mapping->addMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Child"], $sktr->getId());
 
  497            case "skl_templ_subtree":
 
  498                if ($a_rec[
"TopNode"] == 1) {
 
  499                    $parent = $this->skill_tree_root_id;
 
  500                    $order = $a_rec[
"OrderNr"] + $this->init_templ_top_order_nr;
 
  502                    $parent = (int) $a_mapping->getMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Parent"]);
 
  503                    $order = $a_rec[
"OrderNr"];
 
  505                switch ($a_rec[
"Type"]) {
 
  507                        include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
 
  509                        $sctp->setTitle($a_rec[
"Title"]);
 
  510                        $sctp->setDescription($a_rec[
"Description"]);
 
  511                        $sctp->setImportId(
"il_" . $source_inst_id . 
"_sctp_" . $a_rec[
"Child"]);
 
  512                        $sctp->setOrderNr($order);
 
  515                        $a_mapping->addMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Child"], $sctp->getId());
 
  519                        include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
 
  521                        $sktp->setTitle($a_rec[
"Title"]);
 
  522                        $sktp->setDescription($a_rec[
"Description"]);
 
  523                        $sktp->setImportId(
"il_" . $source_inst_id . 
"_sktp_" . $a_rec[
"Child"]);
 
  524                        $sktp->setOrderNr($order);
 
  527                        $a_mapping->addMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"Child"], $sktp->getId());
 
  533                $skill_id = (int) $a_mapping->getMapping(
"Services/Skill", 
"skl_tree", $a_rec[
"SkillId"]);
 
  535                if (in_array(
$type, array(
"skll", 
"sktp"))) {
 
  536                    if (
$type == 
"skll") {
 
  541                    $skill->addLevel($a_rec[
"Title"], $a_rec[
"Description"], 
"il_" . $source_inst_id . 
"_sklv_" . $a_rec[
"LevelId"]);
 
  547                include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
 
  549                $prof->setTitle($a_rec[
"Title"]);
 
  550                $prof->setDescription($a_rec[
"Description"]);
 
  552                $a_mapping->addMapping(
"Services/Skill", 
"skl_prof", $a_rec[
"Id"], $prof->getId());
 
  555            case "skl_prof_level":
 
  556                $profile_id = (int) $a_mapping->getMapping(
"Services/Skill", 
"skl_prof", $a_rec[
"ProfileId"]);
 
  557                if ($profile_id > 0) {
 
  558                    include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
 
  559                    include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
 
  565                    $level_id = $tref_id = $base_skill = 0;
 
  566                    foreach ($level_id_data as $l) {
 
  568                        foreach ($skill_data as $s) {
 
  572                                $level_id = $l[
"level_id"];
 
  573                                $base_skill = $s[
"skill_id"];
 
  574                                $tref_id = $s[
"tref_id"];
 
  579                        $prof->addSkillLevel($base_skill, $tref_id, $level_id);
 
An exception for terminatinating execution or to throw for unit testing.
static getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
Get common skill ids for import IDs (newest first)
static lookupLevelSkillId($a_id)
Lookup level skill id.
static getLevelIdForImportId($a_source_inst_id, $a_level_import_id)
Get level ids for import IDs (newest first)
A dataset contains in data in a common structure that can be shared and transformed for different pur...
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 ...
getCurrentInstallationId()
Get current installation id.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
__construct()
Constructor.
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.
setSelectedNodes($a_val)
Set export selected nodes.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getSelectedNodes()
Get export selected nodes.
getTypes($a_entity, $a_version)
Get field types for entity.
getSelectedProfiles()
Get selected profiles.
getSupportedVersions()
Get supported versions.
setSelectedProfiles($a_val)
Set selected profiles.
Skill Template Reference.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
static _lookupType($a_obj_id)
Lookup Type.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc