ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBasicSkill Class Reference

Basic Skill. More...

+ Inheritance diagram for ilBasicSkill:
+ Collaboration diagram for ilBasicSkill:

Public Member Functions

 __construct ($a_id=0)
 Constructor @access public. More...
 
 read ()
 Read data from database. More...
 
 create ()
 Create skill. More...
 
 delete ()
 Delete skill. More...
 
 copy ()
 Copy basic skill. More...
 
 addLevel ($a_title, $a_description, $a_import_id="")
 Add new level. More...
 
 getMaxLevelNr ()
 Get maximum level nr. More...
 
 getLevelData ($a_id=0)
 Get level data. More...
 
 updateLevelOrder ($order)
 Update level order. More...
 
 deleteLevel ($a_id)
 Delete level. More...
 
 fixLevelNumbering ()
 Fix level numbering. More...
 
 getSkillForLevelId ($a_level_id)
 Get skill for level id. More...
 
 getMaxLevelPerType ($a_tref_id, $a_type, $a_user_id=0, $a_self_eval=0)
 Get max levels per type. More...
 
 getAllLevelEntriesOfUser ($a_tref_id, $a_user_id=0, $a_self_eval=0)
 Get all level entries. More...
 
 getAllHistoricLevelEntriesOfUser ($a_tref_id, $a_user_id=0, $a_eval_by=0)
 Get all historic level entries. More...
 
 getMaxLevelPerObject ($a_tref_id, $a_object_id, $a_user_id=0, $a_self_eval=0)
 Get max levels per object. More...
 
 getMaxLevel ($a_tref_id, $a_user_id=0, $a_self_eval=0)
 Get max levels per object. More...
 
 getLastLevelPerObject ($a_tref_id, $a_object_id, $a_user_id=0, $a_self_eval=0)
 Get last level set per object. More...
 
 getLastUpdatePerObject ($a_tref_id, $a_object_id, $a_user_id=0, $a_self_eval=0)
 Get last update per object. More...
 
 getTitleForCertificate ()
 Get title for certificate. More...
 
 getShortTitleForCertificate ()
 Get short title for certificate. More...
 
- Public Member Functions inherited from ilSkillTreeNode
 __construct ($a_id=0)
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setType ($a_type)
 Set type. More...
 
 getType ()
 Get type. More...
 
 setId ($a_id)
 Set Node ID. More...
 
 getId ()
 Get Node ID. More...
 
 setSelfEvaluation ($a_val)
 Set self evaluation. More...
 
 getSelfEvaluation ()
 Get self evaluation. More...
 
 setOrderNr ($a_val)
 Set order nr. More...
 
 getOrderNr ()
 Get order nr. More...
 
 setImportId ($a_val)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 getCreationDate ()
 Get creation date. More...
 
 read ()
 Read Data of Node. More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory More...
 
 setStatus ($a_val)
 Set status. More...
 
 getStatus ()
 Get status. More...
 
 create ()
 Create Node. More...
 
 update ()
 Update Node. More...
 
 delete ()
 Delete Node. More...
 

Static Public Member Functions

static lookupLevelTitle ($a_id)
 Lookup level title. More...
 
static lookupLevelDescription ($a_id)
 Lookup level description. More...
 
static lookupLevelSkillId ($a_id)
 Lookup level skill id. More...
 
static writeLevelTitle ($a_id, $a_title)
 Write level title. More...
 
static writeLevelDescription ($a_id, $a_description)
 Write level description. More...
 
static resetUserSkillLevelStatus ($a_user_id, $a_skill_id, $a_tref_id=0, $a_trigger_ref_id=0, $a_self_eval=false)
 Reset skill level status. More...
 
static getNewAchievementsPerUser ($a_timestamp, $a_timestamp_to=null, $a_user_id=0, $a_self_eval=0)
 Get new achievements. More...
 
static writeUserSkillLevelStatus ( $a_level_id, $a_user_id, $a_trigger_ref_id, $a_tref_id=0, $a_status=ilBasicSkill::ACHIEVED, $a_force=false, $a_self_eval=false, $a_unique_identifier="")
 Write skill level status. More...
 
static removeAllUserSkillLevelStatusOfObject ($a_user_id, $a_trigger_obj_id, $a_self_eval=false, $a_unique_identifier="")
 Remove a user skill completely. More...
 
static removeAllUserData ($a_user_id)
 Remove all data of a user. More...
 
static hasSelfEvaluated ($a_user_id, $a_skill_id, $a_tref_id)
 Has use self evaluated a skill? More...
 
static _lookupCertificate ($a_skill_id, $a_skill_level_id)
 Checks whether a skill level has a certificate or not. More...
 
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info. More...
 
static getCommonSkillIdForImportId ($a_source_inst_id, $a_skill_import_id, $a_tref_import_id=0)
 Get common skill ids for import IDs (newest first) More...
 
static getLevelIdForImportId ($a_source_inst_id, $a_level_import_id)
 Get level ids for import IDs (newest first) More...
 
static getLevelIdForImportIdMatchSkill ($a_source_inst_id, $a_level_import_id, $a_skill_import_id, $a_tref_import_id=0)
 Get level ids for import Ids matching common skills. More...
 
- Static Public Member Functions inherited from ilSkillTreeNode
static getAllStatus ()
 Get all status. More...
 
static getStatusInfo ($a_status)
 Get status info. More...
 
static _lookupTitle ($a_obj_id, $a_tref_id=0)
 Lookup Title. More...
 
static _lookupSelfEvaluation ($a_obj_id)
 Lookup self evaluation. More...
 
static _lookupStatus ($a_obj_id)
 Lookup Status. More...
 
static _lookupType ($a_obj_id)
 Lookup Type. More...
 
static _writeTitle ($a_obj_id, $a_title)
 Write Title. More...
 
static _writeOrderNr ($a_obj_id, $a_nr)
 Write Order Nr. More...
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 Put this object into the skill tree. More...
 
static getTree ($a_slm_obj_id)
 Get scorm module editing tree. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types. More...
 
static clipboardCut ($a_tree_id, $a_ids)
 Cut and copy a set of skills/skill categories into the clipboard. More...
 
static clipboardCopy ($a_tree_id, $a_ids)
 Copy a set of skills/skill categories into the clipboard. More...
 
static insertItemsFromClip ($a_type, $a_obj_id)
 Insert basic skills from clipboard. More...
 
static clearClipboard ()
 Remove all skill items from clipboard. More...
 
static pasteTree ( $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_add_suffix=false)
 Paste item (tree) from clipboard to skill tree. More...
 
static isInTree ($a_id)
 Is id in tree? More...
 
static getAllSelfEvaluationNodes ()
 Get all self evaluation nodes. More...
 
static getTopTemplates ()
 Get top skill templates and template categories. More...
 
static getSelectableSkills ()
 Get selectable skills. More...
 
static saveChildsOrder ($a_par_id, $a_childs_order, $a_templates=false)
 Save childs order. More...
 
static getIconPath ($a_obj_id, $a_type, $a_size="", $a_status=0)
 Get icon path. More...
 
static findSkills ($a_term)
 Find skills. More...
 
static getAllCSkillIdsForNodeIds (array $a_node_ids)
 Get all possible common skill IDs for node IDs. More...
 
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get title of an assigned item. More...
 

Data Fields

const ACHIEVED = 1
 
const NOT_ACHIEVED = 0
 
const EVAL_BY_OTHERS_ = 0
 
const EVAL_BY_SELF = 1
 
const EVAL_BY_ALL = 2
 
 $id
 
- Data Fields inherited from ilSkillTreeNode
const STATUS_PUBLISH = 0
 
const STATUS_DRAFT = 1
 
const STATUS_OUTDATED = 2
 
 $type
 
 $id
 
 $title
 

Static Protected Member Functions

static lookupLevelProperty ($a_id, $a_prop)
 Lookup level property. More...
 
static writeLevelProperty ($a_id, $a_prop, $a_value, $a_type)
 Write level property. More...
 
static hasRecentSelfEvaluation ($a_user_id, $a_skill_id, $a_tref_id=0, $a_trigger_ref_id=0)
 Has recent self evaluation. More...
 
- Static Protected Member Functions inherited from ilSkillTreeNode
static _lookup ($a_obj_id, $a_field)
 Lookup Title. More...
 

Protected Attributes

 $db
 
 $user
 
- Protected Attributes inherited from ilSkillTreeNode
 $db
 

Additional Inherited Members

- Protected Member Functions inherited from ilSkillTreeNode
 setCreationDate ($a_val)
 Set creation date. More...
 

Detailed Description

Basic Skill.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilBasicSkill.php.

Constructor & Destructor Documentation

◆ __construct()

ilBasicSkill::__construct (   $a_id = 0)

Constructor @access public.

Reimplemented from ilSkillTreeNode.

Reimplemented in ilBasicSkillTemplate.

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

42 {
43 global $DIC;
44
45 $this->db = $DIC->database();
46 $this->user = $DIC->user();
47 parent::__construct($a_id);
48 $this->setType("skll");
49 }
user()
Definition: user.php:4
setType($a_type)
Set type.
global $DIC
Definition: saml.php:7

References $DIC, ilSkillTreeNode\setType(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupCertificate()

static ilBasicSkill::_lookupCertificate (   $a_skill_id,
  $a_skill_level_id 
)
static

Checks whether a skill level has a certificate or not.

Parameters
intskill id
intskill level id
Returns
true/false

Definition at line 1016 of file class.ilBasicSkill.php.

1017 {
1018 $certificatefile = CLIENT_WEB_DIR . "/certificates/skill/" .
1019 ((int) $a_skill_id) . "/" . ((int) $a_skill_level_id) . "/certificate.xml";
1020 if (@file_exists($certificatefile)) {
1021 return true;
1022 } else {
1023 return false;
1024 }
1025 }

◆ addLevel()

ilBasicSkill::addLevel (   $a_title,
  $a_description,
  $a_import_id = "" 
)

Add new level.

Parameters
stringtitle
stringdescription

Definition at line 123 of file class.ilBasicSkill.php.

124 {
126
127 $nr = $this->getMaxLevelNr();
128 $nid = $ilDB->nextId("skl_level");
129 $ilDB->insert("skl_level", array(
130 "id" => array("integer", $nid),
131 "skill_id" => array("integer", $this->getId()),
132 "nr" => array("integer", $nr + 1),
133 "title" => array("text", $a_title),
134 "description" => array("clob", $a_description),
135 "import_id" => array("text", $a_import_id),
136 "creation_date" => array("timestamp", ilUtil::now())
137 ));
138 }
getMaxLevelNr()
Get maximum level nr.
static now()
Return current timestamp in Y-m-d H:i:s format.
global $ilDB

References $db, $ilDB, ilSkillTreeNode\getId(), getMaxLevelNr(), and ilUtil\now().

+ Here is the call graph for this function:

◆ copy()

ilBasicSkill::copy ( )

Copy basic skill.

Reimplemented in ilBasicSkillTemplate.

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

92 {
93 $skill = new ilBasicSkill();
94 $skill->setTitle($this->getTitle());
95 $skill->setType($this->getType());
96 $skill->setSelfEvaluation($this->getSelfEvaluation());
97 $skill->setOrderNr($this->getOrderNr());
98 $skill->create();
99
100 $levels = $this->getLevelData();
101 if (sizeof($levels)) {
102 foreach ($levels as $item) {
103 $skill->addLevel($item["title"], $item["description"]);
104 }
105 }
106 $skill->update();
107
108 return $skill;
109 }
getLevelData($a_id=0)
Get level data.
getOrderNr()
Get order nr.
getSelfEvaluation()
Get self evaluation.

References getLevelData(), ilSkillTreeNode\getOrderNr(), ilSkillTreeNode\getSelfEvaluation(), ilSkillTreeNode\getTitle(), and ilSkillTreeNode\getType().

+ Here is the call graph for this function:

◆ create()

ilBasicSkill::create ( )

Create skill.

Reimplemented from ilSkillTreeNode.

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

64 {
65 parent::create();
66 }

◆ delete()

ilBasicSkill::delete ( )

Delete skill.

Reimplemented from ilSkillTreeNode.

Definition at line 71 of file class.ilBasicSkill.php.

72 {
74
75 $ilDB->manipulate(
76 "DELETE FROM skl_level WHERE "
77 . " skill_id = " . $ilDB->quote($this->getId(), "integer")
78 );
79
80 $ilDB->manipulate(
81 "DELETE FROM skl_user_has_level WHERE "
82 . " skill_id = " . $ilDB->quote($this->getId(), "integer")
83 );
84
85 parent::delete();
86 }

References $db, and $ilDB.

◆ deleteLevel()

ilBasicSkill::deleteLevel (   $a_id)

Delete level.

Parameters

return

Definition at line 309 of file class.ilBasicSkill.php.

310 {
312
313 $ilDB->manipulate(
314 "DELETE FROM skl_level WHERE "
315 . " id = " . $ilDB->quote($a_id, "integer")
316 );
317 }

References $db, and $ilDB.

◆ fixLevelNumbering()

ilBasicSkill::fixLevelNumbering ( )

Fix level numbering.

Parameters

return

Definition at line 325 of file class.ilBasicSkill.php.

326 {
328
329 $set = $ilDB->query(
330 "SELECT id, nr FROM skl_level WHERE " .
331 " skill_id = " . $ilDB->quote($this->getId(), "integer") .
332 " ORDER BY nr ASC"
333 );
334 $cnt = 1;
335 while ($rec = $ilDB->fetchAssoc($set)) {
336 $ilDB->manipulate(
337 "UPDATE skl_level SET " .
338 " nr = " . $ilDB->quote($cnt, "integer") .
339 " WHERE id = " . $ilDB->quote($rec["id"], "integer")
340 );
341 $cnt++;
342 }
343 }

References $db, and $ilDB.

◆ getAllHistoricLevelEntriesOfUser()

ilBasicSkill::getAllHistoricLevelEntriesOfUser (   $a_tref_id,
  $a_user_id = 0,
  $a_eval_by = 0 
)

Get all historic level entries.

Parameters

return

Definition at line 789 of file class.ilBasicSkill.php.

790 {
793
794 if ($a_user_id == 0) {
795 $a_user_id = $ilUser->getId();
796 }
797
798 $by = ($a_eval_by != self::EVAL_BY_ALL)
799 ? " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
800 : "";
801
802 $set = $ilDB->query(
803 $q = "SELECT * FROM skl_user_skill_level " .
804 " WHERE skill_id = " . $ilDB->quote($this->getId(), "integer") .
805 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
806 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
807 $by .
808 " ORDER BY status_date DESC"
809 );
810 $levels = array();
811 while ($rec = $ilDB->fetchAssoc($set)) {
812 $levels[] = $rec;
813 }
814 return $levels;
815 }
$ilUser
Definition: imgupload.php:18

References $db, $ilDB, $ilUser, $user, and EVAL_BY_ALL.

◆ getAllLevelEntriesOfUser()

ilBasicSkill::getAllLevelEntriesOfUser (   $a_tref_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get all level entries.

Parameters

return

Definition at line 758 of file class.ilBasicSkill.php.

759 {
762
763 if ($a_user_id == 0) {
764 $a_user_id = $ilUser->getId();
765 }
766
767 $set = $ilDB->query(
768 $q = "SELECT * FROM skl_user_has_level " .
769 " WHERE skill_id = " . $ilDB->quote($this->getId(), "integer") .
770 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
771 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
772 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer") .
773 " ORDER BY status_date DESC"
774 );
775
776 $levels = array();
777 while ($rec = $ilDB->fetchAssoc($set)) {
778 $levels[] = $rec;
779 }
780 return $levels;
781 }

References $db, $ilDB, $ilUser, and $user.

◆ getCommonSkillIdForImportId()

static ilBasicSkill::getCommonSkillIdForImportId (   $a_source_inst_id,
  $a_skill_import_id,
  $a_tref_import_id = 0 
)
static

Get common skill ids for import IDs (newest first)

Parameters
int$a_source_inst_idsource installation id, must be <>0
int$a_skill_import_idsource skill id (type basic skill ("skll") or basic skill template ("sktp"))
int$a_tref_import_idsource template reference id (if > 0 skill_import_id will be of type "sktp")
Returns
array array of common skill ids, keys are "skill_id", "tref_id", "creation_date"

Definition at line 1057 of file class.ilBasicSkill.php.

1058 {
1059 global $DIC;
1060
1061 $ilDB = $DIC->database();
1062
1063 include_once("./Services/Skill/classes/class.ilSkillTree.php");
1064 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
1065 $tree = new ilSkillTree();
1066
1067 if ($a_source_inst_id == 0) {
1068 return array();
1069 }
1070
1071 $template_ids = array();
1072 if ($a_tref_import_id > 0) {
1073 $skill_node_type = "sktp";
1074
1075 // get all matching tref nodes
1076 $set = $ilDB->query("SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
1077 " WHERE n.import_id = " . $ilDB->quote("il_" . ((int) $a_source_inst_id) . "_sktr_" . $a_tref_import_id, "text") .
1078 " ORDER BY n.creation_date DESC ");
1079 while ($rec = $ilDB->fetchAssoc($set)) {
1080 if (($t = ilSkillTemplateReference::_lookupTemplateId($rec["obj_id"])) > 0) {
1081 $template_ids[$t] = $rec["obj_id"];
1082 }
1083 }
1084 } else {
1085 $skill_node_type = "skll";
1086 }
1087 $set = $ilDB->query("SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
1088 " WHERE n.import_id = " . $ilDB->quote("il_" . ((int) $a_source_inst_id) . "_" . $skill_node_type . "_" . $a_skill_import_id, "text") .
1089 " ORDER BY n.creation_date DESC ");
1090 $results = array();
1091 while ($rec = $ilDB->fetchAssoc($set)) {
1092 $matching_trefs = array();
1093 if ($a_tref_import_id > 0) {
1094 $skill_template_id = $tree->getTopParentNodeId($rec["obj_id"]);
1095
1096 // check of skill is in template
1097 foreach ($template_ids as $templ => $tref) {
1098 if ($skill_template_id == $templ) {
1099 $matching_trefs[] = $tref;
1100 }
1101 }
1102 } else {
1103 $matching_trefs = array(0);
1104 }
1105
1106 foreach ($matching_trefs as $t) {
1107 $results[] = array("skill_id" => $rec["obj_id"], "tref_id" => $t, "creation_date" => $rec["creation_date"]);
1108 }
1109 }
1110 return $results;
1111 }
static _lookupTemplateId($a_obj_id)
Lookup template ID.
$results
Definition: svg-scanner.php:47

References $DIC, $ilDB, $results, $t, $tree, and ilSkillTemplateReference\_lookupTemplateId().

Referenced by getLevelIdForImportIdMatchSkill(), ilAssQuestionSkillAssignmentImporter\getSkillIdMapping(), ilSurveyDataSet\importRecord(), and ilSkillDataSet\importRecord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastLevelPerObject()

ilBasicSkill::getLastLevelPerObject (   $a_tref_id,
  $a_object_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get last level set per object.

Parameters

return

Definition at line 926 of file class.ilBasicSkill.php.

927 {
930
931 if ($a_user_id == 0) {
932 $a_user_id = $ilUser->getId();
933 }
934
935 $ilDB->setLimit(1);
936 $set = $ilDB->query(
937 $q = "SELECT level_id FROM skl_user_has_level " .
938 " WHERE trigger_obj_id = " . $ilDB->quote($a_object_id, "integer") .
939 " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
940 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
941 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
942 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer") .
943 " ORDER BY status_date DESC"
944 );
945
946 $rec = $ilDB->fetchAssoc($set);
947
948 return $rec["level_id"];
949 }

References $db, $ilDB, $ilUser, and $user.

◆ getLastUpdatePerObject()

ilBasicSkill::getLastUpdatePerObject (   $a_tref_id,
  $a_object_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get last update per object.

Parameters

return

Definition at line 957 of file class.ilBasicSkill.php.

958 {
961
962 if ($a_user_id == 0) {
963 $a_user_id = $ilUser->getId();
964 }
965
966 $ilDB->setLimit(1);
967 $set = $ilDB->query(
968 $q = "SELECT status_date FROM skl_user_has_level " .
969 " WHERE trigger_obj_id = " . $ilDB->quote($a_object_id, "integer") .
970 " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
971 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
972 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
973 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer") .
974 " ORDER BY status_date DESC"
975 );
976
977 $rec = $ilDB->fetchAssoc($set);
978
979 return $rec["status_date"];
980 }

References $db, $ilDB, $ilUser, and $user.

◆ getLevelData()

ilBasicSkill::getLevelData (   $a_id = 0)

Get level data.

Returns
array level data

Definition at line 162 of file class.ilBasicSkill.php.

163 {
165
166 if ($a_id > 0) {
167 $and = " AND id = " . $ilDB->quote($a_id, "integer");
168 }
169
170 $set = $ilDB->query(
171 "SELECT * FROM skl_level WHERE " .
172 " skill_id = " . $ilDB->quote($this->getId(), "integer") .
173 $and .
174 " ORDER BY nr"
175 );
176 $levels = array();
177 while ($rec = $ilDB->fetchAssoc($set)) {
178 if ($a_id > 0) {
179 return $rec;
180 }
181 $levels[] = $rec;
182 }
183 return $levels;
184 }

References $db, and $ilDB.

Referenced by copy(), ilBasicSkillTemplate\copy(), getMaxLevel(), getMaxLevelPerObject(), and getMaxLevelPerType().

+ Here is the caller graph for this function:

◆ getLevelIdForImportId()

static ilBasicSkill::getLevelIdForImportId (   $a_source_inst_id,
  $a_level_import_id 
)
static

Get level ids for import IDs (newest first)

Parameters
int$a_source_inst_idsource installation id, must be <>0
int$a_skill_import_idsource skill id (type basic skill ("skll") or basic skill template ("sktp"))
Returns
array array of common skill ids, keys are "level_id", "creation_date"

Definition at line 1120 of file class.ilBasicSkill.php.

1121 {
1122 global $DIC;
1123
1124 $ilDB = $DIC->database();
1125
1126 $set = $ilDB->query("SELECT * FROM skl_level l JOIN skl_tree t ON (l.skill_id = t.child) " .
1127 " WHERE l.import_id = " . $ilDB->quote("il_" . ((int) $a_source_inst_id) . "_sklv_" . $a_level_import_id, "text") .
1128 " ORDER BY l.creation_date DESC ");
1129 $results = array();
1130 while ($rec = $ilDB->fetchAssoc($set)) {
1131 $results[] = array("level_id" => $rec["id"], "creation_date" => $rec["creation_date"]);
1132 }
1133 return $results;
1134 }

References $DIC, $ilDB, and $results.

Referenced by getLevelIdForImportIdMatchSkill(), ilTestSkillLevelThresholdImporter\getLevelIdMapping(), and ilSkillDataSet\importRecord().

+ Here is the caller graph for this function:

◆ getLevelIdForImportIdMatchSkill()

static ilBasicSkill::getLevelIdForImportIdMatchSkill (   $a_source_inst_id,
  $a_level_import_id,
  $a_skill_import_id,
  $a_tref_import_id = 0 
)
static

Get level ids for import Ids matching common skills.

Parameters

return

Definition at line 1142 of file class.ilBasicSkill.php.

1143 {
1144 $level_id_data = self::getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
1145 $skill_data = self::getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id);
1146 $matches = array();
1147 foreach ($level_id_data as $l) {
1148 reset($skill_data);
1149 foreach ($skill_data as $s) {
1150 if (ilBasicSkill::lookupLevelSkillId($l["level_id"]) == $s["skill_id"]) {
1151 $matches[] = array(
1152 "level_id" => $l["level_id"],
1153 "creation_date" => $l["creation_date"],
1154 "skill_id" => $s["skill_id"],
1155 "tref_id" => $s["tref_id"]
1156 );
1157 }
1158 }
1159 }
1160 return $matches;
1161 }
global $l
Definition: afr.php:30
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)
$s
Definition: pwgen.php:45

References $l, $s, getCommonSkillIdForImportId(), getLevelIdForImportId(), and lookupLevelSkillId().

Referenced by ilSurveyDataSet\importRecord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaxLevel()

ilBasicSkill::getMaxLevel (   $a_tref_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get max levels per object.

Parameters

return

Definition at line 861 of file class.ilBasicSkill.php.

862 {
865
866 if ($a_user_id == 0) {
867 $a_user_id = $ilUser->getId();
868 }
869
870 $set = $ilDB->query(
871 $q = "SELECT level_id FROM skl_user_has_level " .
872 " WHERE skill_id = " . $ilDB->quote($this->getId(), "integer") .
873 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
874 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
875 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
876 );
877
878 $has_level = array();
879 while ($rec = $ilDB->fetchAssoc($set)) {
880 $has_level[$rec["level_id"]] = true;
881 }
882 $max_level = 0;
883 foreach ($this->getLevelData() as $l) {
884 if (isset($has_level[$l["id"]])) {
885 $max_level = $l["id"];
886 }
887 }
888 return $max_level;
889 }

References $db, $ilDB, $ilUser, $l, $user, and getLevelData().

+ Here is the call graph for this function:

◆ getMaxLevelNr()

ilBasicSkill::getMaxLevelNr ( )

Get maximum level nr.

Returns
int maximum level nr of skill

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

146 {
148
149 $set = $ilDB->query(
150 "SELECT MAX(nr) mnr FROM skl_level WHERE " .
151 " skill_id = " . $ilDB->quote($this->getId(), "integer")
152 );
153 $rec = $ilDB->fetchAssoc($set);
154 return (int) $rec["mnr"];
155 }

References $db, and $ilDB.

Referenced by addLevel().

+ Here is the caller graph for this function:

◆ getMaxLevelPerObject()

ilBasicSkill::getMaxLevelPerObject (   $a_tref_id,
  $a_object_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get max levels per object.

Parameters

return

Definition at line 824 of file class.ilBasicSkill.php.

825 {
828
829 if ($a_user_id == 0) {
830 $a_user_id = $ilUser->getId();
831 }
832
833 $set = $ilDB->query(
834 $q = "SELECT level_id FROM skl_user_has_level " .
835 " WHERE trigger_obj_id = " . $ilDB->quote($a_object_id, "integer") .
836 " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
837 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
838 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
839 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
840 );
841
842 $has_level = array();
843 while ($rec = $ilDB->fetchAssoc($set)) {
844 $has_level[$rec["level_id"]] = true;
845 }
846 $max_level = 0;
847 foreach ($this->getLevelData() as $l) {
848 if (isset($has_level[$l["id"]])) {
849 $max_level = $l["id"];
850 }
851 }
852 return $max_level;
853 }

References $db, $ilDB, $ilUser, $l, $user, and getLevelData().

+ Here is the call graph for this function:

◆ getMaxLevelPerType()

ilBasicSkill::getMaxLevelPerType (   $a_tref_id,
  $a_type,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get max levels per type.

Parameters

return

Definition at line 721 of file class.ilBasicSkill.php.

722 {
725
726 if ($a_user_id == 0) {
727 $a_user_id = $ilUser->getId();
728 }
729
730 $set = $ilDB->query(
731 $q = "SELECT level_id FROM skl_user_has_level " .
732 " WHERE trigger_obj_type = " . $ilDB->quote($a_type, "text") .
733 " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
734 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
735 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
736 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
737 );
738
739 $has_level = array();
740 while ($rec = $ilDB->fetchAssoc($set)) {
741 $has_level[$rec["level_id"]] = true;
742 }
743 $max_level = 0;
744 foreach ($this->getLevelData() as $l) {
745 if (isset($has_level[$l["id"]])) {
746 $max_level = $l["id"];
747 }
748 }
749 return $max_level;
750 }
$a_type
Definition: workflow.php:92

References $a_type, $db, $ilDB, $ilUser, $l, $user, and getLevelData().

+ Here is the call graph for this function:

◆ getNewAchievementsPerUser()

static ilBasicSkill::getNewAchievementsPerUser (   $a_timestamp,
  $a_timestamp_to = null,
  $a_user_id = 0,
  $a_self_eval = 0 
)
static

Get new achievements.

Parameters
string$a_timestamp
Returns
array

Definition at line 499 of file class.ilBasicSkill.php.

500 {
501 global $DIC;
502
503 $db = $DIC->database();
504
505 $to = (!is_null($a_timestamp_to))
506 ? " AND status_date <= " . $db->quote($a_timestamp_to, "timestamp")
507 : "";
508
509 $user = ($a_user_id > 0)
510 ? " AND user_id = " . $db->quote($a_user_id, "integer")
511 : "";
512
513 $set = $db->query("SELECT * FROM skl_user_skill_level " .
514 " WHERE status_date >= " . $db->quote($a_timestamp, "timestamp") .
515 " AND valid = " . $db->quote(1, "integer") .
516 " AND status = " . $db->quote(ilBasicSkill::ACHIEVED, "integer") .
517 " AND self_eval = " . $db->quote($a_self_eval, "integer") .
518 $to .
519 $user .
520 " ORDER BY user_id, status_date ASC ");
521 $achievments = array();
522 while ($rec = $db->fetchAssoc($set)) {
523 $achievments[$rec["user_id"]][] = $rec;
524 }
525
526 return $achievments;
527 }

References $db, $DIC, $user, and ACHIEVED.

Referenced by ilSkillLearningHistoryProvider\getEntries(), and ilSkillNotifications\run().

+ Here is the caller graph for this function:

◆ getShortTitleForCertificate()

ilBasicSkill::getShortTitleForCertificate ( )

Get short title for certificate.

Parameters

return

Definition at line 1005 of file class.ilBasicSkill.php.

1006 {
1007 return "Skill";
1008 }

◆ getSkillForLevelId()

ilBasicSkill::getSkillForLevelId (   $a_level_id)

Get skill for level id.

Parameters

return

Definition at line 351 of file class.ilBasicSkill.php.

352 {
354
355 $set = $ilDB->query(
356 "SELECT * FROM skl_level WHERE " .
357 " id = " . $ilDB->quote($a_level_id, "integer")
358 );
359 $skill = null;
360 if ($rec = $ilDB->fetchAssoc($set)) {
361 if (ilSkillTreeNode::isInTree($rec["skill_id"])) {
362 $skill = new ilBasicSkill($rec["skill_id"]);
363 }
364 }
365 return $skill;
366 }
static isInTree($a_id)
Is id in tree?

References $db, $ilDB, and ilSkillTreeNode\isInTree().

+ Here is the call graph for this function:

◆ getTitleForCertificate()

ilBasicSkill::getTitleForCertificate ( )

Get title for certificate.

Parameters

return

Definition at line 994 of file class.ilBasicSkill.php.

995 {
996 return $this->getTitle();
997 }

References ilSkillTreeNode\getTitle().

+ Here is the call graph for this function:

◆ getUsageInfo()

static ilBasicSkill::getUsageInfo (   $a_cskill_ids,
$a_usages 
)
static

Get usage info.

Parameters

return

Implements ilSkillUsageInfo.

Definition at line 1033 of file class.ilBasicSkill.php.

1034 {
1035 global $DIC;
1036
1037 $ilDB = $DIC->database();
1038
1039 include_once("./Services/Skill/classes/class.ilSkillUsage.php");
1041 $a_cskill_ids,
1042 $a_usages,
1044 "skl_user_skill_level",
1045 "user_id"
1046 );
1047 }
static getUsageInfoGeneric( $a_cskill_ids, &$a_usages, $a_usage_type, $a_table, $a_key_field, $a_skill_field="skill_id", $a_tref_field="tref_id")
Get standard usage query.

References $DIC, $ilDB, ilSkillUsage\getUsageInfoGeneric(), and ilSkillUsage\USER_ASSIGNED.

+ Here is the call graph for this function:

◆ hasRecentSelfEvaluation()

static ilBasicSkill::hasRecentSelfEvaluation (   $a_user_id,
  $a_skill_id,
  $a_tref_id = 0,
  $a_trigger_ref_id = 0 
)
staticprotected

Has recent self evaluation.

Check if self evaluation for user/object has been done on the same day already

Parameters

return

Definition at line 461 of file class.ilBasicSkill.php.

462 {
463 global $DIC;
464
465 $db = $DIC->database();
466
467 $trigger_obj_id = ($a_trigger_ref_id > 0)
468 ? ilObject::_lookupObjId($a_trigger_ref_id)
469 : 0;
470
471 $recent = "";
472
473 $db->setLimit(1);
474 $set = $db->query(
475 "SELECT * FROM skl_user_skill_level WHERE " .
476 "skill_id = " . $db->quote($a_skill_id, "integer") . " AND " .
477 "user_id = " . $db->quote($a_user_id, "integer") . " AND " .
478 "tref_id = " . $db->quote((int) $a_tref_id, "integer") . " AND " .
479 "trigger_obj_id = " . $db->quote($trigger_obj_id, "integer") . " AND " .
480 "self_eval = " . $db->quote(1, "integer") .
481 " ORDER BY status_date DESC"
482 );
483 $rec = $db->fetchAssoc($set);
484 $status_day = substr($rec["status_date"], 0, 10);
485 $today = substr(ilUtil::now(), 0, 10);
486 if ($rec["valid"] && $rec["status"] == ilBasicSkill::ACHIEVED && $status_day == $today) {
487 $recent = $rec["status_date"];
488 }
489
490 return $recent;
491 }
static _lookupObjId($a_id)

References $db, $DIC, ilObject\_lookupObjId(), ACHIEVED, and ilUtil\now().

Referenced by resetUserSkillLevelStatus(), and writeUserSkillLevelStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasSelfEvaluated()

static ilBasicSkill::hasSelfEvaluated (   $a_user_id,
  $a_skill_id,
  $a_tref_id 
)
static

Has use self evaluated a skill?

Parameters
int$a_user_id
int$a_skill_id
int$a_tref_id
Returns
bool

Definition at line 900 of file class.ilBasicSkill.php.

901 {
902 global $DIC;
903
904 $db = $DIC->database();
905
906 $set = $db->query(
907 $q = "SELECT level_id FROM skl_user_has_level " .
908 " WHERE skill_id = " . $db->quote((int) $a_skill_id, "integer") .
909 " AND tref_id = " . $db->quote((int) $a_tref_id, "integer") .
910 " AND user_id = " . $db->quote($a_user_id, "integer") .
911 " AND self_eval = " . $db->quote(1, "integer")
912 );
913
914 if ($rec = $db->fetchAssoc($set)) {
915 return true;
916 }
917 return false;
918 }

References $db, and $DIC.

Referenced by ilPersonalSkillsGUI\renderSkillHTML().

+ Here is the caller graph for this function:

◆ lookupLevelDescription()

static ilBasicSkill::lookupLevelDescription (   $a_id)
static

Lookup level description.

Parameters
intlevel id
Returns
string level description

Definition at line 223 of file class.ilBasicSkill.php.

224 {
225 return ilBasicSkill::lookupLevelProperty($a_id, "description");
226 }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.

References lookupLevelProperty().

+ Here is the call graph for this function:

◆ lookupLevelProperty()

static ilBasicSkill::lookupLevelProperty (   $a_id,
  $a_prop 
)
staticprotected

Lookup level property.

Parameters
idlevel id
Returns
mixed property value

Definition at line 192 of file class.ilBasicSkill.php.

193 {
194 global $DIC;
195
196 $ilDB = $DIC->database();
197
198 $set = $ilDB->query(
199 "SELECT $a_prop FROM skl_level WHERE " .
200 " id = " . $ilDB->quote($a_id, "integer")
201 );
202 $rec = $ilDB->fetchAssoc($set);
203 return $rec[$a_prop];
204 }

References $DIC, and $ilDB.

Referenced by lookupLevelDescription(), lookupLevelSkillId(), and lookupLevelTitle().

+ Here is the caller graph for this function:

◆ lookupLevelSkillId()

static ilBasicSkill::lookupLevelSkillId (   $a_id)
static

Lookup level skill id.

Parameters
intlevel id
Returns
string skill id

Definition at line 234 of file class.ilBasicSkill.php.

235 {
236 return ilBasicSkill::lookupLevelProperty($a_id, "skill_id");
237 }

References lookupLevelProperty().

Referenced by getLevelIdForImportIdMatchSkill(), ilSkillDataSet\importRecord(), and writeUserSkillLevelStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupLevelTitle()

static ilBasicSkill::lookupLevelTitle (   $a_id)
static

◆ read()

ilBasicSkill::read ( )

Read data from database.

Reimplemented from ilSkillTreeNode.

Definition at line 54 of file class.ilBasicSkill.php.

55 {
56 parent::read();
57 }

◆ removeAllUserData()

static ilBasicSkill::removeAllUserData (   $a_user_id)
static

Remove all data of a user.

Parameters
int$a_user_id

Definition at line 698 of file class.ilBasicSkill.php.

699 {
700 global $DIC;
701
702 $db = $DIC->database();
703
704 $db->manipulate(
705 "DELETE FROM skl_user_skill_level WHERE "
706 . " user_id = " . $db->quote($a_user_id, "integer")
707 );
708 $db->manipulate(
709 "DELETE FROM skl_user_has_level WHERE "
710 . " user_id = " . $db->quote($a_user_id, "integer")
711 );
712 }

References $db, and $DIC.

Referenced by ilSkillObjDeletionHandler\processDeletion().

+ Here is the caller graph for this function:

◆ removeAllUserSkillLevelStatusOfObject()

static ilBasicSkill::removeAllUserSkillLevelStatusOfObject (   $a_user_id,
  $a_trigger_obj_id,
  $a_self_eval = false,
  $a_unique_identifier = "" 
)
static

Remove a user skill completely.

Parameters
int$a_user_iduser id
int$a_trigger_obj_idtriggering repository object obj id
bool$a_self_evalcurrently needs to be set to true
string$a_unique_identifierunique identifier string
Returns
bool true, if entries have been deleted, otherwise false

Definition at line 658 of file class.ilBasicSkill.php.

659 {
660 global $DIC;
661
662 $db = $DIC->database();
663
664 if ($a_trigger_obj_id == 0) {
665 return false;
666 }
667
668 $changed = false;
669
670 $aff_rows = $db->manipulate(
671 "DELETE FROM skl_user_skill_level WHERE "
672 . " user_id = " . $db->quote($a_user_id, "integer")
673 . " AND trigger_obj_id = " . $db->quote($a_trigger_obj_id, "integer")
674 . " AND self_eval = " . $db->quote($a_self_eval, "integer")
675 . " AND unique_identifier = " . $db->quote($a_unique_identifier, "text")
676 );
677 if ($aff_rows > 0) {
678 $changed = true;
679 }
680
681 $aff_rows = $db->manipulate(
682 "DELETE FROM skl_user_has_level WHERE "
683 . " user_id = " . $db->quote($a_user_id, "integer")
684 . " AND trigger_obj_id = " . $db->quote($a_trigger_obj_id, "integer")
685 . " AND self_eval = " . $db->quote($a_self_eval, "integer")
686 );
687 if ($aff_rows > 0) {
688 $changed = true;
689 }
690 return $changed;
691 }

References $changed, $db, and $DIC.

Referenced by ilContainerMemberSkills\publish(), and ilContainerMemberSkills\removeAllSkillLevels().

+ Here is the caller graph for this function:

◆ resetUserSkillLevelStatus()

static ilBasicSkill::resetUserSkillLevelStatus (   $a_user_id,
  $a_skill_id,
  $a_tref_id = 0,
  $a_trigger_ref_id = 0,
  $a_self_eval = false 
)
static

Reset skill level status.

This is currently only used for self evaluations with a "no competence" level. It has to be discussed, how this should be provided for non-self-evaluations.

Parameters
int$a_user_iduser id
int$a_skill_idskill id
int$a_tref_idskill tref id
int$a_trigger_ref_idtriggering repository object ref id
bool$a_self_evalcurrently needs to be set to true
Exceptions
ilSkillException

Definition at line 387 of file class.ilBasicSkill.php.

388 {
389 global $DIC;
390
391 $db = $DIC->database();
392
393 if (!$a_self_eval) {
394 include_once("./Services/Skill/exceptions/class.ilSkillException.php");
395 throw new ilSkillException("resetUserSkillLevelStatus currently only provided for self evaluations.");
396 }
397
398 $trigger_obj_id = ($a_trigger_ref_id > 0)
399 ? ilObject::_lookupObjId($a_trigger_ref_id)
400 : 0;
401
402 $update = false;
403 $status_date = self::hasRecentSelfEvaluation($a_user_id, $a_skill_id, $a_tref_id, $a_trigger_ref_id);
404 if ($status_date != "") {
405 $update = true;
406 }
407
408 if ($update) {
409 // this will only be set in self eval case, means this will always have a $rec
410 $now = ilUtil::now();
411 $db->manipulate(
412 "UPDATE skl_user_skill_level SET " .
413 " level_id = " . $db->quote(0, "integer") . "," .
414 " status_date = " . $db->quote($now, "timestamp") .
415 " WHERE user_id = " . $db->quote($a_user_id, "integer") .
416 " AND status_date = " . $db->quote($status_date, "timestamp") .
417 " AND skill_id = " . $db->quote($a_skill_id, "integer") .
418 " AND status = " . $db->quote(self::ACHIEVED, "integer") .
419 " AND trigger_obj_id = " . $db->quote($trigger_obj_id, "integer") .
420 " AND tref_id = " . $db->quote((int) $a_tref_id, "integer") .
421 " AND self_eval = " . $db->quote($a_self_eval, "integer")
422 );
423 } else {
424 $now = ilUtil::now();
425 $db->manipulate("INSERT INTO skl_user_skill_level " .
426 "(level_id, user_id, tref_id, status_date, skill_id, status, valid, trigger_ref_id," .
427 "trigger_obj_id, trigger_obj_type, trigger_title, self_eval, unique_identifier) VALUES (" .
428 $db->quote(0, "integer") . "," .
429 $db->quote($a_user_id, "integer") . "," .
430 $db->quote((int) $a_tref_id, "integer") . "," .
431 $db->quote($now, "timestamp") . "," .
432 $db->quote($a_skill_id, "integer") . "," .
433 $db->quote(self::ACHIEVED, "integer") . "," .
434 $db->quote(1, "integer") . "," .
435 $db->quote($a_trigger_ref_id, "integer") . "," .
436 $db->quote($trigger_obj_id, "integer") . "," .
437 $db->quote("", "text") . "," .
438 $db->quote("", "text") . "," .
439 $db->quote($a_self_eval, "integer") . "," .
440 $db->quote("", "text") .
441 ")");
442 }
443
444 $db->manipulate(
445 "DELETE FROM skl_user_has_level WHERE "
446 . " user_id = " . $db->quote($a_user_id, "integer")
447 . " AND skill_id = " . $db->quote($a_skill_id, "integer")
448 . " AND tref_id = " . $db->quote((int) $a_tref_id, "integer")
449 . " AND trigger_obj_id = " . $db->quote($trigger_obj_id, "integer")
450 . " AND self_eval = " . $db->quote($a_self_eval, "integer")
451 );
452 }
static hasRecentSelfEvaluation($a_user_id, $a_skill_id, $a_tref_id=0, $a_trigger_ref_id=0)
Has recent self evaluation.
Skill exception class.

References $db, $DIC, ilObject\_lookupObjId(), hasRecentSelfEvaluation(), and ilUtil\now().

Referenced by ilPersonalSkill\saveSelfEvaluation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLevelOrder()

ilBasicSkill::updateLevelOrder (   $order)

Update level order.

Parameters

return

Definition at line 286 of file class.ilBasicSkill.php.

287 {
289
290 asort($order);
291
292 $cnt = 1;
293 foreach ($order as $id => $o) {
294 $ilDB->manipulate(
295 "UPDATE skl_level SET " .
296 " nr = " . $ilDB->quote($cnt, "integer") .
297 " WHERE id = " . $ilDB->quote($id, "integer")
298 );
299 $cnt++;
300 }
301 }

References $db, $id, and $ilDB.

◆ writeLevelDescription()

static ilBasicSkill::writeLevelDescription (   $a_id,
  $a_description 
)
static

Write level description.

Parameters
intlevel id
textlevel description

Definition at line 275 of file class.ilBasicSkill.php.

276 {
277 ilBasicSkill::writeLevelProperty($a_id, "description", $a_description, "clob");
278 }
static writeLevelProperty($a_id, $a_prop, $a_value, $a_type)
Write level property.

References writeLevelProperty().

+ Here is the call graph for this function:

◆ writeLevelProperty()

static ilBasicSkill::writeLevelProperty (   $a_id,
  $a_prop,
  $a_value,
  $a_type 
)
staticprotected

Write level property.

Parameters

return

Definition at line 245 of file class.ilBasicSkill.php.

246 {
247 global $DIC;
248
249 $ilDB = $DIC->database();
250
251 $ilDB->update("skl_level", array(
252 $a_prop => array($a_type, $a_value),
253 ), array(
254 "id" => array("integer", $a_id),
255 ));
256 }

References $a_type, $DIC, and $ilDB.

Referenced by writeLevelDescription(), and writeLevelTitle().

+ Here is the caller graph for this function:

◆ writeLevelTitle()

static ilBasicSkill::writeLevelTitle (   $a_id,
  $a_title 
)
static

Write level title.

Parameters
intlevel id
textlevel title

Definition at line 264 of file class.ilBasicSkill.php.

265 {
266 ilBasicSkill::writeLevelProperty($a_id, "title", $a_title, "text");
267 }

References writeLevelProperty().

+ Here is the call graph for this function:

◆ writeUserSkillLevelStatus()

static ilBasicSkill::writeUserSkillLevelStatus (   $a_level_id,
  $a_user_id,
  $a_trigger_ref_id,
  $a_tref_id = 0,
  $a_status = ilBasicSkill::ACHIEVED,
  $a_force = false,
  $a_self_eval = false,
  $a_unique_identifier = "" 
)
static

Write skill level status.

Parameters
int$a_level_idskill level id
int$a_user_iduser id
int$a_trigger_ref_idtrigger repository object ref id
int$a_tref_idskill tref id
int$a_statusDEPRECATED, always use ilBasicSkill::ACHIEVED
bool$a_forceDEPRECATED
bool$a_self_evalself evaluation
string$a_unique_identifiera unique identifier (should be used with trigger_ref_id > 0)

Definition at line 542 of file class.ilBasicSkill.php.

551 {
552 global $DIC;
553
554 $ilDB = $DIC->database();
555
556 $skill_id = ilBasicSkill::lookupLevelSkillId($a_level_id);
557 $trigger_ref_id = $a_trigger_ref_id;
558 $trigger_obj_id = ilObject::_lookupObjId($trigger_ref_id);
559 $trigger_title = ilObject::_lookupTitle($trigger_obj_id);
560 $trigger_type = ilObject::_lookupType($trigger_obj_id);
561
562 $update = false;
563
564 // self evaluations will update, if the last self evaluation is on the same day
565 if ($a_self_eval && self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id)) {
566 $status_date = self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id);
567 if ($status_date != "") {
568 $update = true;
569 }
570 }
571
572 if ($update) {
573 // this will only be set in self eval case, means this will always have a $rec
574 $now = ilUtil::now();
575 $ilDB->manipulate(
576 "UPDATE skl_user_skill_level SET " .
577 " level_id = " . $ilDB->quote($a_level_id, "integer") . "," .
578 " status_date = " . $ilDB->quote($now, "timestamp") .
579 " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
580 " AND status_date = " . $ilDB->quote($status_date, "timestamp") .
581 " AND skill_id = " . $ilDB->quote($skill_id, "integer") .
582 " AND status = " . $ilDB->quote($a_status, "integer") .
583 " AND trigger_obj_id = " . $ilDB->quote($trigger_obj_id, "integer") .
584 " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
585 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
586 );
587 } else {
588 if ($a_unique_identifier != "") {
589 $ilDB->manipulate(
590 "DELETE FROM skl_user_skill_level WHERE " .
591 " user_id = " . $ilDB->quote($a_user_id, "integer") .
592 " AND tref_id = " . $ilDB->quote($a_tref_id, "integer") .
593 " AND skill_id = " . $ilDB->quote($skill_id, "integer") .
594 " AND trigger_ref_id = " . $ilDB->quote($trigger_ref_id, "integer") .
595 " AND trigger_obj_id = " . $ilDB->quote($trigger_obj_id, "integer") .
596 " AND self_eval = " . $ilDB->quote($a_self_eval, "integer") .
597 " AND unique_identifier = " . $ilDB->quote($a_unique_identifier, "text")
598 );
599 }
600
601 $now = ilUtil::now();
602 $ilDB->manipulate("INSERT INTO skl_user_skill_level " .
603 "(level_id, user_id, tref_id, status_date, skill_id, status, valid, trigger_ref_id," .
604 "trigger_obj_id, trigger_obj_type, trigger_title, self_eval, unique_identifier) VALUES (" .
605 $ilDB->quote($a_level_id, "integer") . "," .
606 $ilDB->quote($a_user_id, "integer") . "," .
607 $ilDB->quote((int) $a_tref_id, "integer") . "," .
608 $ilDB->quote($now, "timestamp") . "," .
609 $ilDB->quote($skill_id, "integer") . "," .
610 $ilDB->quote($a_status, "integer") . "," .
611 $ilDB->quote(1, "integer") . "," .
612 $ilDB->quote($trigger_ref_id, "integer") . "," .
613 $ilDB->quote($trigger_obj_id, "integer") . "," .
614 $ilDB->quote($trigger_type, "text") . "," .
615 $ilDB->quote($trigger_title, "text") . "," .
616 $ilDB->quote($a_self_eval, "integer") . "," .
617 $ilDB->quote($a_unique_identifier, "text") .
618 ")");
619 }
620
621 // fix (removed level_id and added skill id, since table should hold only
622 // one entry per skill)
623 $ilDB->manipulate(
624 "DELETE FROM skl_user_has_level WHERE "
625 . " user_id = " . $ilDB->quote($a_user_id, "integer")
626 . " AND skill_id = " . $ilDB->quote($skill_id, "integer")
627 . " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer")
628 . " AND trigger_obj_id = " . $ilDB->quote($trigger_obj_id, "integer")
629 . " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
630 );
631
632 if ($a_status == ilBasicSkill::ACHIEVED) {
633 $ilDB->manipulate("INSERT INTO skl_user_has_level " .
634 "(level_id, user_id, tref_id, status_date, skill_id, trigger_ref_id, trigger_obj_id, trigger_obj_type, trigger_title, self_eval) VALUES (" .
635 $ilDB->quote($a_level_id, "integer") . "," .
636 $ilDB->quote($a_user_id, "integer") . "," .
637 $ilDB->quote($a_tref_id, "integer") . "," .
638 $ilDB->quote($now, "timestamp") . "," .
639 $ilDB->quote($skill_id, "integer") . "," .
640 $ilDB->quote($trigger_ref_id, "integer") . "," .
641 $ilDB->quote($trigger_obj_id, "integer") . "," .
642 $ilDB->quote($trigger_type, "text") . "," .
643 $ilDB->quote($trigger_title, "text") . "," .
644 $ilDB->quote($a_self_eval, "integer") .
645 ")");
646 }
647 }
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type

References $DIC, $ilDB, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ACHIEVED, hasRecentSelfEvaluation(), lookupLevelSkillId(), and ilUtil\now().

Referenced by ilSkillAppEventListener\handleEvent(), ilTestSkillEvaluation\invokeSkillLevelTrigger(), ilContainerMemberSkills\publish(), ilPersonalSkill\saveSelfEvaluation(), ilSurveySkill\writeAppraiseeSkills(), ilSurveySkill\writeSelfEvalSkills(), and ilSurveySkillDeterminationGUI\writeSkills().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

◆ $id

ilBasicSkill::$id

Definition at line 35 of file class.ilBasicSkill.php.

Referenced by updateLevelOrder().

◆ $user

◆ ACHIEVED

◆ EVAL_BY_ALL

const ilBasicSkill::EVAL_BY_ALL = 2

◆ EVAL_BY_OTHERS_

const ilBasicSkill::EVAL_BY_OTHERS_ = 0

Definition at line 31 of file class.ilBasicSkill.php.

◆ EVAL_BY_SELF

const ilBasicSkill::EVAL_BY_SELF = 1

Definition at line 32 of file class.ilBasicSkill.php.

◆ NOT_ACHIEVED

const ilBasicSkill::NOT_ACHIEVED = 0

Definition at line 29 of file class.ilBasicSkill.php.


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