ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPersonalSkill Class Reference

Personal skill. More...

+ Inheritance diagram for ilPersonalSkill:
+ Collaboration diagram for ilPersonalSkill:

Static Public Member Functions

static getSelectedUserSkills ($a_user_id)
 Get personal selected user skills. More...
 
static addPersonalSkill ($a_user_id, $a_skill_node_id)
 Add personal skill. More...
 
static removeSkill ($a_user_id, $a_skill_node_id)
 Remove personal skill. More...
 
static removeSkills ($a_user_id)
 Remove personal skills of user. More...
 
static assignMaterial ($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level, $a_wsp_id)
 Assign material to skill level. More...
 
static getAssignedMaterial ($a_user_id, $a_tref_id, $a_level)
 Get assigned material (for a skill level and user) More...
 
static countAssignedMaterial ($a_user_id, $a_tref_id, $a_level)
 Get assigned material (for a skill level and user) More...
 
static removeMaterial ($a_user_id, $a_tref_id, $a_level_id, $a_wsp_id)
 Remove material. More...
 
static removeMaterials ($a_user_id)
 Remove materials of user. More...
 
static saveSelfEvaluation ($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level)
 Save self evaluation. More...
 
static getSelfEvaluation ($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill)
 Get self evaluation. More...
 
static getSelfEvaluationDate ($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill)
 Get self evaluation. More...
 
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info. More...
 

Detailed Description

Personal skill.

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

Definition at line 10 of file class.ilPersonalSkill.php.

Member Function Documentation

◆ addPersonalSkill()

static ilPersonalSkill::addPersonalSkill (   $a_user_id,
  $a_skill_node_id 
)
static

Add personal skill.

Parameters
int$a_user_id
int$a_skill_node_id

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

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\addSkill(), ilObjPortfolioBase\clonePagesAndSettings(), ilSkillAppEventListener\handleEvent(), ilTestSkillEvaluation\handleSkillTriggering(), ilContainerMemberSkills\publish(), ilSurveySkill\writeAndAddAppraiseeSkills(), ilSurveySkill\writeAndAddSelfEvalSkills(), and ilSurveySkillDeterminationGUI\writeAndAddSkills().

47  {
48  global $DIC;
49 
50  $ilDB = $DIC->database();
51 
52  $set = $ilDB->query(
53  "SELECT * FROM skl_personal_skill " .
54  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
55  " AND skill_node_id = " . $ilDB->quote($a_skill_node_id, "integer")
56  );
57  if (!$ilDB->fetchAssoc($set)) {
58  $ilDB->manipulate("INSERT INTO skl_personal_skill " .
59  "(user_id, skill_node_id) VALUES (" .
60  $ilDB->quote($a_user_id, "integer") . "," .
61  $ilDB->quote($a_skill_node_id, "integer") .
62  ")");
63  }
64  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ assignMaterial()

static ilPersonalSkill::assignMaterial (   $a_user_id,
  $a_top_skill,
  $a_tref_id,
  $a_basic_skill,
  $a_level,
  $a_wsp_id 
)
static

Assign material to skill level.

Parameters
int$a_user_iduser id
int$a_top_skillthe "selectable" top skill
int$a_tref_idtemplate reference id
int$a_basic_skillthe basic skill the level belongs to
int$a_levellevel id
int$a_wsp_idworkspace object

Definition at line 117 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\selectMaterial().

118  {
119  global $DIC;
120 
121  $ilDB = $DIC->database();
122 
123  $set = $ilDB->query(
124  "SELECT * FROM skl_assigned_material " .
125  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
126  " AND top_skill_id = " . $ilDB->quote($a_top_skill, "integer") .
127  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
128  " AND skill_id = " . $ilDB->quote($a_basic_skill, "integer") .
129  " AND level_id = " . $ilDB->quote($a_level, "integer") .
130  " AND wsp_id = " . $ilDB->quote($a_wsp_id, "integer")
131  );
132  if (!$ilDB->fetchAssoc($set)) {
133  $ilDB->manipulate("INSERT INTO skl_assigned_material " .
134  "(user_id, top_skill_id, tref_id, skill_id, level_id, wsp_id) VALUES (" .
135  $ilDB->quote($a_user_id, "integer") . "," .
136  $ilDB->quote($a_top_skill, "integer") . "," .
137  $ilDB->quote((int) $a_tref_id, "integer") . "," .
138  $ilDB->quote($a_basic_skill, "integer") . "," .
139  $ilDB->quote($a_level, "integer") . "," .
140  $ilDB->quote($a_wsp_id, "integer") .
141  ")");
142  }
143  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ countAssignedMaterial()

static ilPersonalSkill::countAssignedMaterial (   $a_user_id,
  $a_tref_id,
  $a_level 
)
static

Get assigned material (for a skill level and user)

Parameters
int$a_user_iduser id
int$a_tref_idtemplate reference id
int$a_levellevel id

Definition at line 178 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\getMaterials().

179  {
180  global $DIC;
181 
182  $ilDB = $DIC->database();
183 
184  $set = $ilDB->query(
185  "SELECT count(*) as cnt FROM skl_assigned_material " .
186  " WHERE level_id = " . $ilDB->quote($a_level, "integer") .
187  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
188  " AND user_id = " . $ilDB->quote($a_user_id, "integer")
189  );
190  $rec = $ilDB->fetchAssoc($set);
191  return $rec["cnt"];
192  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getAssignedMaterial()

static ilPersonalSkill::getAssignedMaterial (   $a_user_id,
  $a_tref_id,
  $a_level 
)
static

Get assigned material (for a skill level and user)

Parameters
int$a_user_iduser id
int$a_tref_idtemplate reference id
int$a_levellevel id

Definition at line 152 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilCOPageHTMLExport\collectPageElements(), ilSkillAssignMaterialsTableGUI\fillRow(), and ilPersonalSkillsGUI\getMaterials().

153  {
154  global $DIC;
155 
156  $ilDB = $DIC->database();
157 
158  $set = $ilDB->query(
159  "SELECT * FROM skl_assigned_material " .
160  " WHERE level_id = " . $ilDB->quote($a_level, "integer") .
161  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
162  " AND user_id = " . $ilDB->quote($a_user_id, "integer")
163  );
164  $mat = array();
165  while ($rec = $ilDB->fetchAssoc($set)) {
166  $mat[] = $rec;
167  }
168  return $mat;
169  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getSelectedUserSkills()

static ilPersonalSkill::getSelectedUserSkills (   $a_user_id)
static

Get personal selected user skills.

Parameters
int$a_user_iduser id
Returns
array

Definition at line 18 of file class.ilPersonalSkill.php.

References $DIC, $ilDB, and ilSkillTreeNode\_lookupTitle().

Referenced by ilPersonalSkillTableGUI\__construct(), ilObjPortfolioBase\clonePagesAndSettings(), ilObjPortfolioGUI\createPortfolioFromAssignment(), ilObjPortfolioGUI\initCreatePortfolioFromTemplateForm(), ilPCSkillsGUI\initForm(), ilPersonalSkillsGUI\listSkills(), and ilMStShowUserCompetencesGUI\showSkills().

19  {
20  global $DIC;
21 
22  $ilDB = $DIC->database();
23 
24  $stree = new ilSkillTree();
25 
26  $set = $ilDB->query(
27  "SELECT * FROM skl_personal_skill " .
28  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer")
29  );
30  $pskills = array();
31  while ($rec = $ilDB->fetchAssoc($set)) {
32  if ($stree->isInTree($rec["skill_node_id"])) {
33  $pskills[$rec["skill_node_id"]] = array("skill_node_id" => $rec["skill_node_id"],
34  "title" => ilSkillTreeNode::_lookupTitle($rec["skill_node_id"]));
35  }
36  }
37  return $pskills;
38  }
Skill tree.
global $DIC
Definition: goto.php:24
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelfEvaluation()

static ilPersonalSkill::getSelfEvaluation (   $a_user_id,
  $a_top_skill,
  $a_tref_id,
  $a_basic_skill 
)
static

Get self evaluation.

Parameters
int$a_user_iduser id
int$a_top_skillthe "selectable" top skill
int$a_tref_idtemplate reference id
int$a_basic_skillthe basic skill the level belongs to
Returns
int level id

Definition at line 270 of file class.ilPersonalSkill.php.

Referenced by ilSelfEvaluationSimpleTableGUI\__construct().

271  {
272  $bs = new ilBasicSkill($a_basic_skill);
273  return $bs->getLastLevelPerObject($a_tref_id, 0, $a_user_id, 1);
274  }
Basic Skill.
+ Here is the caller graph for this function:

◆ getSelfEvaluationDate()

static ilPersonalSkill::getSelfEvaluationDate (   $a_user_id,
  $a_top_skill,
  $a_tref_id,
  $a_basic_skill 
)
static

Get self evaluation.

Parameters
int$a_user_iduser id
int$a_top_skillthe "selectable" top skill
int$a_tref_idtemplate reference id
int$a_basic_skillthe basic skill the level belongs to
Returns
int level id

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

Referenced by ilPersonalSkillsGUI\renderSkillHTML().

286  {
287  $bs = new ilBasicSkill($a_basic_skill);
288  return $bs->getLastUpdatePerObject($a_tref_id, 0, $a_user_id, 1);
289  }
Basic Skill.
+ Here is the caller graph for this function:

◆ getUsageInfo()

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

Get usage info.

Parameters
array$a_cskill_idsskill ids
array$a_usagesusages array

Implements ilSkillUsageInfo.

Definition at line 297 of file class.ilPersonalSkill.php.

References $DIC, $ilDB, ilSkillTemplateReference\_lookupTemplateId(), ilSkillUsage\getUsageInfoGeneric(), ilSkillUsage\PERSONAL_SKILL, ilSkillUsage\SELF_EVAL, and ilSkillUsage\USER_MATERIAL.

298  {
299  global $DIC;
300 
301  $ilDB = $DIC->database();
302 
303  // material
305  $a_cskill_ids,
306  $a_usages,
308  "skl_assigned_material",
309  "user_id"
310  );
311 
312  // self evaluations
314  $a_cskill_ids,
315  $a_usages,
317  "skl_self_eval_level",
318  "user_id"
319  );
320 
321  // users that use the skills as personal skills
322  $pskill_ids = array();
323  $tref_ids = array();
324  foreach ($a_cskill_ids as $cs) {
325  if ($cs["tref_id"] > 0) {
326  if (ilSkillTemplateReference::_lookupTemplateId($cs["tref_id"]) == $cs["skill_id"]) {
327  $pskill_ids[$cs["tref_id"]] = $cs["tref_id"];
328  $tref_ids[(int) $cs["tref_id"]] = $cs["skill_id"];
329  }
330  } else {
331  $pskill_ids[$cs["skill_id"]] = $cs["skill_id"];
332  }
333  }
334  $set = $ilDB->query(
335  "SELECT skill_node_id, user_id FROM skl_personal_skill " .
336  " WHERE " . $ilDB->in("skill_node_id", $pskill_ids, false, "integer") .
337  " GROUP BY skill_node_id, user_id"
338  );
339  while ($rec = $ilDB->fetchAssoc($set)) {
340  if (isset($tref_ids[(int) $rec["skill_node_id"]])) {
341  $a_usages[$tref_ids[$rec["skill_node_id"]] . ":" . $rec["skill_node_id"]][ilSkillUsage::PERSONAL_SKILL][] =
342  array("key" => $rec["user_id"]);
343  } else {
344  $a_usages[$rec["skill_node_id"] . ":0"][ilSkillUsage::PERSONAL_SKILL][] =
345  array("key" => $rec["user_id"]);
346  }
347  }
348  }
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 $DIC
Definition: goto.php:24
static _lookupTemplateId($a_obj_id)
Lookup template ID.
global $ilDB
+ Here is the call graph for this function:

◆ removeMaterial()

static ilPersonalSkill::removeMaterial (   $a_user_id,
  $a_tref_id,
  $a_level_id,
  $a_wsp_id 
)
static

Remove material.

Parameters

Definition at line 200 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\removeMaterial().

201  {
202  global $DIC;
203 
204  $ilDB = $DIC->database();
205 
206  $t = "DELETE FROM skl_assigned_material WHERE " .
207  " user_id = " . $ilDB->quote($a_user_id, "integer") .
208  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
209  " AND level_id = " . $ilDB->quote($a_level_id, "integer") .
210  " AND wsp_id = " . $ilDB->quote($a_wsp_id, "integer");
211 
212  $ilDB->manipulate($t);
213  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ removeMaterials()

static ilPersonalSkill::removeMaterials (   $a_user_id)
static

Remove materials of user.

Parameters
int$a_user_id

Definition at line 220 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

221  {
222  global $DIC;
223 
224  $ilDB = $DIC->database();
225 
226  $t = "DELETE FROM skl_assigned_material WHERE " .
227  " user_id = " . $ilDB->quote($a_user_id, "integer");
228  $ilDB->manipulate($t);
229  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ removeSkill()

static ilPersonalSkill::removeSkill (   $a_user_id,
  $a_skill_node_id 
)
static

Remove personal skill.

Parameters
int$a_user_iduser id
int$a_skill_node_idthe "selectable" top skill

Definition at line 72 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\removeSkills().

73  {
74  global $DIC;
75 
76  $ilDB = $DIC->database();
77 
78  $ilDB->manipulate(
79  "DELETE FROM skl_personal_skill WHERE " .
80  " user_id = " . $ilDB->quote($a_user_id, "integer") .
81  " AND skill_node_id = " . $ilDB->quote($a_skill_node_id, "integer")
82  );
83  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ removeSkills()

static ilPersonalSkill::removeSkills (   $a_user_id)
static

Remove personal skills of user.

Parameters
int$a_user_iduser id

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

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

91  {
92  global $DIC;
93 
94  $ilDB = $DIC->database();
95 
96  $ilDB->manipulate(
97  "DELETE FROM skl_personal_skill WHERE " .
98  " user_id = " . $ilDB->quote($a_user_id, "integer")
99  );
100  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ saveSelfEvaluation()

static ilPersonalSkill::saveSelfEvaluation (   $a_user_id,
  $a_top_skill,
  $a_tref_id,
  $a_basic_skill,
  $a_level 
)
static

Save self evaluation.

Parameters
int$a_user_iduser id
int$a_top_skillthe "selectable" top skill
int$a_tref_idtemplate reference id
int$a_basic_skillthe basic skill the level belongs to
int$a_levellevel id

Definition at line 244 of file class.ilPersonalSkill.php.

References ilBasicSkill\ACHIEVED, ilBasicSkill\resetUserSkillLevelStatus(), and ilBasicSkill\writeUserSkillLevelStatus().

Referenced by ilPersonalSkillsGUI\saveSelfEvaluation().

245  {
246  if ($a_level > 0) {
248  $a_level,
249  $a_user_id,
250  0,
251  $a_tref_id,
253  false,
254  1
255  );
256  } else {
257  ilBasicSkill::resetUserSkillLevelStatus($a_user_id, $a_basic_skill, $a_tref_id, 0, true);
258  }
259  }
static writeUserSkillLevelStatus(int $a_level_id, int $a_user_id, int $a_trigger_ref_id, int $a_tref_id=0, int $a_status=ilBasicSkill::ACHIEVED, bool $a_force=false, bool $a_self_eval=false, string $a_unique_identifier="", float $a_next_level_fulfilment=0.0)
static resetUserSkillLevelStatus(int $a_user_id, int $a_skill_id, int $a_tref_id=0, int $a_trigger_ref_id=0, bool $a_self_eval=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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