ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBasicSkill Class Reference

Basic Skill. More...

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

Public Member Functions

 __construct ($a_id=0)
 Constructor 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...
 
 setDescription ($a_description)
 Set description. More...
 
 getDescription ()
 Get description. 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 _lookupDescription ($a_obj_id)
 Lookup Description. 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 _writeDescription ($a_obj_id, $a_description)
 Write Description. 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...
 

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
 
 $description
 

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 public.

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

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

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  }
setType($a_type)
Set type.
user()
Definition: user.php:4
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ 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 1017 of file class.ilBasicSkill.php.

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

◆ addLevel()

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

Add new level.

Parameters
stringtitle
stringdescription

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

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

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

◆ copy()

ilBasicSkill::copy ( )

Copy basic skill.

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

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

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

◆ create()

ilBasicSkill::create ( )

Create skill.

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

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

◆ delete()

ilBasicSkill::delete ( )

Delete skill.

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

References $db, and $ilDB.

72  {
73  $ilDB = $this->db;
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  }
global $ilDB

◆ deleteLevel()

ilBasicSkill::deleteLevel (   $a_id)

Delete level.

Parameters

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

References $db, and $ilDB.

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

◆ fixLevelNumbering()

ilBasicSkill::fixLevelNumbering ( )

Fix level numbering.

Parameters

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

References $db, and $ilDB.

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

◆ getAllHistoricLevelEntriesOfUser()

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

Get all historic level entries.

Parameters

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

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

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

◆ getAllLevelEntriesOfUser()

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

Get all level entries.

Parameters

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

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

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

◆ 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 1058 of file class.ilBasicSkill.php.

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

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

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

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

References $db, $ilDB, $ilUser, $user, and ilSkillTreeNode\getId().

928  {
929  $ilDB = $this->db;
931 
932  if ($a_user_id == 0) {
933  $a_user_id = $ilUser->getId();
934  }
935 
936  $ilDB->setLimit(1);
937  $set = $ilDB->query(
938  $q = "SELECT level_id FROM skl_user_has_level " .
939  " WHERE trigger_obj_id = " . $ilDB->quote($a_object_id, "integer") .
940  " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
941  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
942  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
943  " AND self_eval = " . $ilDB->quote($a_self_eval, "integer") .
944  " ORDER BY status_date DESC"
945  );
946 
947  $rec = $ilDB->fetchAssoc($set);
948 
949  return $rec["level_id"];
950  }
$ilUser
Definition: imgupload.php:18
global $ilDB
+ Here is the call graph for this function:

◆ getLastUpdatePerObject()

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

Get last update per object.

Parameters

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

References $db, $ilDB, $ilUser, $user, and ilSkillTreeNode\getId().

959  {
960  $ilDB = $this->db;
962 
963  if ($a_user_id == 0) {
964  $a_user_id = $ilUser->getId();
965  }
966 
967  $ilDB->setLimit(1);
968  $set = $ilDB->query(
969  $q = "SELECT status_date FROM skl_user_has_level " .
970  " WHERE trigger_obj_id = " . $ilDB->quote($a_object_id, "integer") .
971  " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
972  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
973  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
974  " AND self_eval = " . $ilDB->quote($a_self_eval, "integer") .
975  " ORDER BY status_date DESC"
976  );
977 
978  $rec = $ilDB->fetchAssoc($set);
979 
980  return $rec["status_date"];
981  }
$ilUser
Definition: imgupload.php:18
global $ilDB
+ Here is the call graph for this function:

◆ getLevelData()

ilBasicSkill::getLevelData (   $a_id = 0)

Get level data.

Returns
array level data

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

References $db, and $ilDB.

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

164  {
165  $ilDB = $this->db;
166 
167  if ($a_id > 0) {
168  $and = " AND id = " . $ilDB->quote($a_id, "integer");
169  }
170 
171  $set = $ilDB->query(
172  "SELECT * FROM skl_level WHERE " .
173  " skill_id = " . $ilDB->quote($this->getId(), "integer") .
174  $and .
175  " ORDER BY nr"
176  );
177  $levels = array();
178  while ($rec = $ilDB->fetchAssoc($set)) {
179  if ($a_id > 0) {
180  return $rec;
181  }
182  $levels[] = $rec;
183  }
184  return $levels;
185  }
global $ilDB
+ 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 1121 of file class.ilBasicSkill.php.

References $DIC, $ilDB, and $results.

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

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

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

References lookupLevelSkillId().

Referenced by ilSurveyDataSet\importRecord().

1144  {
1145  $level_id_data = self::getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
1146  $skill_data = self::getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id);
1147  $matches = array();
1148  foreach ($level_id_data as $l) {
1149  reset($skill_data);
1150  foreach ($skill_data as $s) {
1151  if (ilBasicSkill::lookupLevelSkillId($l["level_id"]) == $s["skill_id"]) {
1152  $matches[] = array(
1153  "level_id" => $l["level_id"],
1154  "creation_date" => $l["creation_date"],
1155  "skill_id" => $s["skill_id"],
1156  "tref_id" => $s["tref_id"]
1157  );
1158  }
1159  }
1160  }
1161  return $matches;
1162  }
static lookupLevelSkillId($a_id)
Lookup level skill id.
+ 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

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

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

863  {
864  $ilDB = $this->db;
866 
867  if ($a_user_id == 0) {
868  $a_user_id = $ilUser->getId();
869  }
870 
871  $set = $ilDB->query(
872  $q = "SELECT level_id FROM skl_user_has_level " .
873  " WHERE skill_id = " . $ilDB->quote($this->getId(), "integer") .
874  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
875  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
876  " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
877  );
878 
879  $has_level = array();
880  while ($rec = $ilDB->fetchAssoc($set)) {
881  $has_level[$rec["level_id"]] = true;
882  }
883  $max_level = 0;
884  foreach ($this->getLevelData() as $l) {
885  if (isset($has_level[$l["id"]])) {
886  $max_level = $l["id"];
887  }
888  }
889  return $max_level;
890  }
getLevelData($a_id=0)
Get level data.
$ilUser
Definition: imgupload.php:18
global $ilDB
+ 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 146 of file class.ilBasicSkill.php.

References $db, and $ilDB.

Referenced by addLevel().

147  {
148  $ilDB = $this->db;
149 
150  $set = $ilDB->query(
151  "SELECT MAX(nr) mnr FROM skl_level WHERE " .
152  " skill_id = " . $ilDB->quote($this->getId(), "integer")
153  );
154  $rec = $ilDB->fetchAssoc($set);
155  return (int) $rec["mnr"];
156  }
global $ilDB
+ 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

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

References $db, $ilDB, $ilUser, $user, ilSkillTreeNode\getId(), and getLevelData().

826  {
827  $ilDB = $this->db;
829 
830  if ($a_user_id == 0) {
831  $a_user_id = $ilUser->getId();
832  }
833 
834  $set = $ilDB->query(
835  $q = "SELECT level_id FROM skl_user_has_level " .
836  " WHERE trigger_obj_id = " . $ilDB->quote($a_object_id, "integer") .
837  " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
838  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
839  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
840  " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
841  );
842 
843  $has_level = array();
844  while ($rec = $ilDB->fetchAssoc($set)) {
845  $has_level[$rec["level_id"]] = true;
846  }
847  $max_level = 0;
848  foreach ($this->getLevelData() as $l) {
849  if (isset($has_level[$l["id"]])) {
850  $max_level = $l["id"];
851  }
852  }
853  return $max_level;
854  }
getLevelData($a_id=0)
Get level data.
$ilUser
Definition: imgupload.php:18
global $ilDB
+ 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

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

References $a_type, $db, $ilDB, $ilUser, $user, ilSkillTreeNode\getId(), and getLevelData().

723  {
724  $ilDB = $this->db;
726 
727  if ($a_user_id == 0) {
728  $a_user_id = $ilUser->getId();
729  }
730 
731  $set = $ilDB->query(
732  $q = "SELECT level_id FROM skl_user_has_level " .
733  " WHERE trigger_obj_type = " . $ilDB->quote($a_type, "text") .
734  " AND skill_id = " . $ilDB->quote($this->getId(), "integer") .
735  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
736  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
737  " AND self_eval = " . $ilDB->quote($a_self_eval, "integer")
738  );
739 
740  $has_level = array();
741  while ($rec = $ilDB->fetchAssoc($set)) {
742  $has_level[$rec["level_id"]] = true;
743  }
744  $max_level = 0;
745  foreach ($this->getLevelData() as $l) {
746  if (isset($has_level[$l["id"]])) {
747  $max_level = $l["id"];
748  }
749  }
750  return $max_level;
751  }
getLevelData($a_id=0)
Get level data.
$a_type
Definition: workflow.php:92
$ilUser
Definition: imgupload.php:18
global $ilDB
+ 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 500 of file class.ilBasicSkill.php.

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

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

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

◆ getShortTitleForCertificate()

ilBasicSkill::getShortTitleForCertificate ( )

Get short title for certificate.

Parameters

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

1007  {
1008  return "Skill";
1009  }

◆ getSkillForLevelId()

ilBasicSkill::getSkillForLevelId (   $a_level_id)

Get skill for level id.

Parameters

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

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

353  {
354  $ilDB = $this->db;
355 
356  $set = $ilDB->query(
357  "SELECT * FROM skl_level WHERE " .
358  " id = " . $ilDB->quote($a_level_id, "integer")
359  );
360  $skill = null;
361  if ($rec = $ilDB->fetchAssoc($set)) {
362  if (ilSkillTreeNode::isInTree($rec["skill_id"])) {
363  $skill = new ilBasicSkill($rec["skill_id"]);
364  }
365  }
366  return $skill;
367  }
static isInTree($a_id)
Is id in tree?
global $ilDB
Basic Skill.
+ Here is the call graph for this function:

◆ getTitleForCertificate()

ilBasicSkill::getTitleForCertificate ( )

Get title for certificate.

Parameters

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

References ilSkillTreeNode\getTitle().

996  {
997  return $this->getTitle();
998  }
+ Here is the call graph for this function:

◆ getUsageInfo()

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

Get usage info.

Parameters

Implements ilSkillUsageInfo.

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

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

1035  {
1036  global $DIC;
1037 
1038  $ilDB = $DIC->database();
1039 
1040  include_once("./Services/Skill/classes/class.ilSkillUsage.php");
1042  $a_cskill_ids,
1043  $a_usages,
1045  "skl_user_skill_level",
1046  "user_id"
1047  );
1048  }
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.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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

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

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

463  {
464  global $DIC;
465 
466  $db = $DIC->database();
467 
468  $trigger_obj_id = ($a_trigger_ref_id > 0)
469  ? ilObject::_lookupObjId($a_trigger_ref_id)
470  : 0;
471 
472  $recent = "";
473 
474  $db->setLimit(1);
475  $set = $db->query(
476  "SELECT * FROM skl_user_skill_level WHERE " .
477  "skill_id = " . $db->quote($a_skill_id, "integer") . " AND " .
478  "user_id = " . $db->quote($a_user_id, "integer") . " AND " .
479  "tref_id = " . $db->quote((int) $a_tref_id, "integer") . " AND " .
480  "trigger_obj_id = " . $db->quote($trigger_obj_id, "integer") . " AND " .
481  "self_eval = " . $db->quote(1, "integer") .
482  " ORDER BY status_date DESC"
483  );
484  $rec = $db->fetchAssoc($set);
485  $status_day = substr($rec["status_date"], 0, 10);
486  $today = substr(ilUtil::now(), 0, 10);
487  if ($rec["valid"] && $rec["status"] == ilBasicSkill::ACHIEVED && $status_day == $today) {
488  $recent = $rec["status_date"];
489  }
490 
491  return $recent;
492  }
static now()
Return current timestamp in Y-m-d H:i:s format.
static _lookupObjId($a_id)
$DIC
Definition: xapitoken.php:46
+ Here is the call 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 901 of file class.ilBasicSkill.php.

References $db, and $DIC.

Referenced by ilPersonalSkillsGUI\renderSkillHTML().

902  {
903  global $DIC;
904 
905  $db = $DIC->database();
906 
907  $set = $db->query(
908  $q = "SELECT level_id FROM skl_user_has_level " .
909  " WHERE skill_id = " . $db->quote((int) $a_skill_id, "integer") .
910  " AND tref_id = " . $db->quote((int) $a_tref_id, "integer") .
911  " AND user_id = " . $db->quote($a_user_id, "integer") .
912  " AND self_eval = " . $db->quote(1, "integer")
913  );
914 
915  if ($rec = $db->fetchAssoc($set)) {
916  return true;
917  }
918  return false;
919  }
$DIC
Definition: xapitoken.php:46
+ 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 224 of file class.ilBasicSkill.php.

References lookupLevelProperty().

225  {
226  return ilBasicSkill::lookupLevelProperty($a_id, "description");
227  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
+ 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 193 of file class.ilBasicSkill.php.

References $DIC, and $ilDB.

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

194  {
195  global $DIC;
196 
197  $ilDB = $DIC->database();
198 
199  $set = $ilDB->query(
200  "SELECT $a_prop FROM skl_level WHERE " .
201  " id = " . $ilDB->quote($a_id, "integer")
202  );
203  $rec = $ilDB->fetchAssoc($set);
204  return $rec[$a_prop];
205  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 235 of file class.ilBasicSkill.php.

References lookupLevelProperty().

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

236  {
237  return ilBasicSkill::lookupLevelProperty($a_id, "skill_id");
238  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupLevelTitle()

static ilBasicSkill::lookupLevelTitle (   $a_id)
static

Lookup level title.

Parameters
intlevel id
Returns
string level title

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

References lookupLevelProperty().

Referenced by ilSkillProfileGUI\confirmLevelAssignmentRemoval(), ilBasicSkillGUI\confirmLevelDeletion(), ilSkillProfileLevelsTableGUI\fillRow(), ilContSkillMemberTableGUI\fillRow(), ilSkillLearningHistoryProvider\getEntries(), ilPersonalSkillsGUI\getSuggestedResources(), ilSkillNotifications\sendMail(), ilBasicSkillTemplateGUI\setLevelHead(), and ilBasicSkillGUI\setLevelHead().

214  {
215  return ilBasicSkill::lookupLevelProperty($a_id, "title");
216  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilBasicSkill::read ( )

Read data from database.

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 699 of file class.ilBasicSkill.php.

References $db, and $DIC.

Referenced by ilSkillObjDeletionHandler\processDeletion().

700  {
701  global $DIC;
702 
703  $db = $DIC->database();
704 
705  $db->manipulate(
706  "DELETE FROM skl_user_skill_level WHERE "
707  . " user_id = " . $db->quote($a_user_id, "integer")
708  );
709  $db->manipulate(
710  "DELETE FROM skl_user_has_level WHERE "
711  . " user_id = " . $db->quote($a_user_id, "integer")
712  );
713  }
$DIC
Definition: xapitoken.php:46
+ 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 659 of file class.ilBasicSkill.php.

References $changed, $db, and $DIC.

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

660  {
661  global $DIC;
662 
663  $db = $DIC->database();
664 
665  if ($a_trigger_obj_id == 0) {
666  return false;
667  }
668 
669  $changed = false;
670 
671  $aff_rows = $db->manipulate(
672  "DELETE FROM skl_user_skill_level WHERE "
673  . " user_id = " . $db->quote($a_user_id, "integer")
674  . " AND trigger_obj_id = " . $db->quote($a_trigger_obj_id, "integer")
675  . " AND self_eval = " . $db->quote($a_self_eval, "integer")
676  . " AND unique_identifier = " . $db->quote($a_unique_identifier, "text")
677  );
678  if ($aff_rows > 0) {
679  $changed = true;
680  }
681 
682  $aff_rows = $db->manipulate(
683  "DELETE FROM skl_user_has_level WHERE "
684  . " user_id = " . $db->quote($a_user_id, "integer")
685  . " AND trigger_obj_id = " . $db->quote($a_trigger_obj_id, "integer")
686  . " AND self_eval = " . $db->quote($a_self_eval, "integer")
687  );
688  if ($aff_rows > 0) {
689  $changed = true;
690  }
691  return $changed;
692  }
$DIC
Definition: xapitoken.php:46
+ 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 388 of file class.ilBasicSkill.php.

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

Referenced by ilPersonalSkill\saveSelfEvaluation().

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

◆ updateLevelOrder()

ilBasicSkill::updateLevelOrder (   $order)

Update level order.

Parameters

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

References $db, $id, and $ilDB.

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

◆ writeLevelDescription()

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

Write level description.

Parameters
intlevel id
textlevel description

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

References writeLevelProperty().

277  {
278  ilBasicSkill::writeLevelProperty($a_id, "description", $a_description, "clob");
279  }
static writeLevelProperty($a_id, $a_prop, $a_value, $a_type)
Write level property.
+ 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

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

References $a_type, $DIC, and $ilDB.

Referenced by writeLevelDescription(), and writeLevelTitle().

247  {
248  global $DIC;
249 
250  $ilDB = $DIC->database();
251 
252  $ilDB->update("skl_level", array(
253  $a_prop => array($a_type, $a_value),
254  ), array(
255  "id" => array("integer", $a_id),
256  ));
257  }
$a_type
Definition: workflow.php:92
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 265 of file class.ilBasicSkill.php.

References writeLevelProperty().

266  {
267  ilBasicSkill::writeLevelProperty($a_id, "title", $a_title, "text");
268  }
static writeLevelProperty($a_id, $a_prop, $a_value, $a_type)
Write level property.
+ 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 543 of file class.ilBasicSkill.php.

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

Referenced by ilSkillAppEventListener\handleEvent(), ilTestSkillEvaluation\invokeSkillLevelTrigger(), ilContainerMemberSkills\publish(), ilPersonalSkill\saveSelfEvaluation(), ilSurveySkill\writeAndAddAppraiseeSkills(), ilSurveySkill\writeAndAddSelfEvalSkills(), and ilSurveySkillDeterminationGUI\writeAndAddSkills().

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

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

Referenced by ilPersonalSkillsGUI\renderSkillHTML().

◆ 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: