ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPersonalSkill Class Reference

Personal skill. More...

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

Public Member Functions

 addPersonalSkill ($a_user_id, $a_skill_node_id)
 Add personal skill. More...
 
 removeSkill ($a_user_id, $a_skill_node_id)
 Remove personal skill. More...
 

Static Public Member Functions

static getSelectedUserSkills ($a_user_id)
 Get personal selected user skills. 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 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...
 
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get title of an assigned item. More...
 

Detailed Description

Personal skill.

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

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

Member Function Documentation

◆ addPersonalSkill()

ilPersonalSkill::addPersonalSkill (   $a_user_id,
  $a_skill_node_id 
)

Add personal skill.

Parameters
int$a_user_id
int$a_skill_node_id

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

53 {
54 global $ilDB;
55
56 $set = $ilDB->query("SELECT * FROM skl_personal_skill ".
57 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
58 " AND skill_node_id = ".$ilDB->quote($a_skill_node_id, "integer")
59 );
60 if (!$ilDB->fetchAssoc($set))
61 {
62 $ilDB->manipulate("INSERT INTO skl_personal_skill ".
63 "(user_id, skill_node_id) VALUES (".
64 $ilDB->quote($a_user_id, "integer").",".
65 $ilDB->quote($a_skill_node_id, "integer").
66 ")");
67 }
68 }
global $ilDB

References $ilDB.

Referenced by ilPersonalSkillsGUI\addSkill(), and ilObjPortfolioBase\clonePagesAndSettings().

+ 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 102 of file class.ilPersonalSkill.php.

103 {
104 global $ilDB;
105
106 $set = $ilDB->query("SELECT * FROM skl_assigned_material ".
107 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
108 " AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
109 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
110 " AND skill_id = ".$ilDB->quote($a_basic_skill, "integer").
111 " AND level_id = ".$ilDB->quote($a_level, "integer").
112 " AND wsp_id = ".$ilDB->quote($a_wsp_id, "integer")
113 );
114 if (!$ilDB->fetchAssoc($set))
115 {
116 $ilDB->manipulate("INSERT INTO skl_assigned_material ".
117 "(user_id, top_skill_id, tref_id, skill_id, level_id, wsp_id) VALUES (".
118 $ilDB->quote($a_user_id, "integer").",".
119 $ilDB->quote($a_top_skill, "integer").",".
120 $ilDB->quote((int) $a_tref_id, "integer").",".
121 $ilDB->quote($a_basic_skill, "integer").",".
122 $ilDB->quote($a_level, "integer").",".
123 $ilDB->quote($a_wsp_id, "integer").
124 ")");
125 }
126 }

References $ilDB.

Referenced by ilPersonalSkillsGUI\selectMaterial().

+ 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 159 of file class.ilPersonalSkill.php.

160 {
161 global $ilDB;
162
163 $set = $ilDB->query("SELECT count(*) as cnt FROM skl_assigned_material ".
164 " WHERE level_id = ".$ilDB->quote($a_level, "integer").
165 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
166 " AND user_id = ".$ilDB->quote($a_user_id, "integer")
167 );
168 $rec = $ilDB->fetchAssoc($set);
169 return $rec["cnt"];
170 }

References $ilDB.

Referenced by ilPersonalSkillsGUI\renderMaterialsRow().

+ 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 135 of file class.ilPersonalSkill.php.

136 {
137 global $ilDB;
138
139 $set = $ilDB->query("SELECT * FROM skl_assigned_material ".
140 " WHERE level_id = ".$ilDB->quote($a_level, "integer").
141 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
142 " AND user_id = ".$ilDB->quote($a_user_id, "integer")
143 );
144 $mat = array();
145 while ($rec = $ilDB->fetchAssoc($set))
146 {
147 $mat[] = $rec;
148 }
149 return $mat;
150 }

References $ilDB.

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

+ 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 22 of file class.ilPersonalSkill.php.

23 {
24 global $ilDB;
25
26 include_once "Services/Skill/classes/class.ilSkillTreeNode.php";
27
28 include_once("./Services/Skill/classes/class.ilSkillTree.php");
29 $stree = new ilSkillTree();
30
31 $set = $ilDB->query("SELECT * FROM skl_personal_skill ".
32 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer")
33 );
34 $pskills = array();
35 while ($rec = $ilDB->fetchAssoc($set))
36 {
37 if ($stree->isInTree($rec["skill_node_id"]))
38 {
39 $pskills[$rec["skill_node_id"]] = array("skill_node_id" => $rec["skill_node_id"],
40 "title" => ilSkillTreeNode::_lookupTitle($rec["skill_node_id"]));
41 }
42 }
43 return $pskills;
44 }
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.

References $ilDB, and ilSkillTreeNode\_lookupTitle().

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

+ 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 253 of file class.ilPersonalSkill.php.

254 {
255 global $ilDB;
256
257 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
258 $bs = new ilBasicSkill($a_basic_skill);
259 return $bs->getLastLevelPerObject($a_tref_id, 0, $a_user_id, 1);
260
261 $set = $ilDB->query("SELECT level_id FROM skl_self_eval_level ".
262 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
263 " AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
264 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
265 " AND skill_id = ".$ilDB->quote($a_basic_skill, "integer")
266 );
267 $rec = $ilDB->fetchAssoc($set);
268
269 return (int) $rec["level_id"];
270 }

References $ilDB.

Referenced by ilSelfEvaluationSimpleTableGUI\__construct(), and ilPersonalSkillsGUI\renderSelfEvaluationRow().

+ 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 281 of file class.ilPersonalSkill.php.

282 {
283 global $ilDB;
284
285 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
286 $bs = new ilBasicSkill($a_basic_skill);
287 return $bs->getLastUpdatePerObject($a_tref_id, 0, $a_user_id, 1);
288
289 $set = $ilDB->query("SELECT last_update FROM skl_self_eval_level ".
290 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
291 " AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
292 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
293 " AND skill_id = ".$ilDB->quote($a_basic_skill, "integer")
294 );
295 $rec = $ilDB->fetchAssoc($set);
296
297 return $rec["last_update"];
298 }

References $ilDB.

Referenced by ilPersonalSkillsGUI\getSkillHTML(), and ilPersonalSkillsGUI\renderSelfEvaluationRow().

+ 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 306 of file class.ilPersonalSkill.php.

307 {
308 global $ilDB;
309
310 // material
311 include_once("./Services/Skill/classes/class.ilSkillUsage.php");
313 "skl_assigned_material", "user_id");
314
315 // self evaluations
317 "skl_self_eval_level", "user_id");
318
319 // users that use the skills as personal skills
320 $pskill_ids = array();
321 $tref_ids = array();
322 foreach ($a_cskill_ids as $cs)
323 {
324 if ($cs["tref_id"] > 0)
325 {
326 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
327 if (ilSkillTemplateReference::_lookupTemplateId($cs["tref_id"]) == $cs["skill_id"])
328 {
329 $pskill_ids[$cs["tref_id"]] = $cs["tref_id"];
330 $tref_ids[(int) $cs["tref_id"]] = $cs["skill_id"];
331 }
332 }
333 else
334 {
335 $pskill_ids[$cs["skill_id"]] = $cs["skill_id"];
336 }
337 }
338 $set = $ilDB->query("SELECT skill_node_id, user_id FROM skl_personal_skill ".
339 " WHERE ".$ilDB->in("skill_node_id", $pskill_ids, false, "integer").
340 " GROUP BY skill_node_id, user_id"
341 );
342 while ($rec = $ilDB->fetchAssoc($set))
343 {
344 if (isset($tref_ids[(int) $rec["skill_node_id"]]))
345 {
346 $a_usages[$tref_ids[$rec["skill_node_id"]].":".$rec["skill_node_id"]][ilSkillUsage::PERSONAL_SKILL][] =
347 array("key" => $rec["user_id"]);
348 }
349 else
350 {
351 $a_usages[$rec["skill_node_id"].":0"][ilSkillUsage::PERSONAL_SKILL][] =
352 array("key" => $rec["user_id"]);
353 }
354 }
355 }
static _lookupTemplateId($a_obj_id)
Lookup template ID.
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 $ilDB, ilSkillTemplateReference\_lookupTemplateId(), ilSkillUsage\getUsageInfoGeneric(), ilSkillUsage\PERSONAL_SKILL, ilSkillUsage\SELF_EVAL, and ilSkillUsage\USER_MATERIAL.

+ 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

return

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

179 {
180 global $ilDB;
181
182 $t = "DELETE FROM skl_assigned_material WHERE ".
183 " user_id = ".$ilDB->quote($a_user_id, "integer").
184 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
185 " AND level_id = ".$ilDB->quote($a_level_id, "integer").
186 " AND wsp_id = ".$ilDB->quote($a_wsp_id, "integer");
187
188 $ilDB->manipulate($t);
189 }

References $ilDB, and $t.

Referenced by ilPersonalSkillsGUI\removeMaterial().

+ Here is the caller graph for this function:

◆ removeSkill()

ilPersonalSkill::removeSkill (   $a_user_id,
  $a_skill_node_id 
)

Remove personal skill.

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

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

77 {
78 global $ilDB;
79
80 $ilDB->manipulate("DELETE FROM skl_personal_skill WHERE ".
81 " user_id = ".$ilDB->quote($a_user_id, "integer").
82 " AND skill_node_id = ".$ilDB->quote($a_skill_node_id, "integer")
83 );
84
85 }

References $ilDB.

Referenced by ilPersonalSkillsGUI\removeSkills().

+ 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 204 of file class.ilPersonalSkill.php.

205 {
206 global $ilDB;
207
208 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
209 ilBasicSkill::writeUserSkillLevelStatus($a_level, $a_user_id,
210 0, $a_tref_id, ilBasicSkill::ACHIEVED, false,
211 1);
212
213 return;
214
215 $set = $ilDB->query("SELECT * FROM skl_self_eval_level ".
216 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
217 " AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
218 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
219 " AND skill_id = ".$ilDB->quote($a_basic_skill, "integer"));
220 if (!$ilDB->fetchAssoc($set))
221 {
222 $ilDB->manipulate("INSERT INTO skl_self_eval_level ".
223 "(user_id, top_skill_id, tref_id, skill_id, level_id, last_update) VALUES (".
224 $ilDB->quote($a_user_id, "integer").",".
225 $ilDB->quote($a_top_skill, "integer").",".
226 $ilDB->quote((int) $a_tref_id, "integer").",".
227 $ilDB->quote($a_basic_skill, "integer").",".
228 $ilDB->quote($a_level, "integer").",".
229 $ilDB->quote(ilUtil::now(), "timestamp").
230 ")");
231 }
232 else
233 {
234 $ilDB->manipulate("UPDATE skl_self_eval_level SET ".
235 " level_id = ".$ilDB->quote($a_level, "integer").", ".
236 " last_update = ".$ilDB->quote(ilUtil::now(), "timestamp").
237 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
238 " AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
239 " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
240 " AND skill_id = ".$ilDB->quote($a_basic_skill, "integer"));
241 }
242 }
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=0, $a_unique_identifier="")
Write skill level status.
static now()
Return current timestamp in Y-m-d H:i:s format.

References $ilDB, ilBasicSkill\ACHIEVED, ilUtil\now(), and ilBasicSkill\writeUserSkillLevelStatus().

Referenced by ilPersonalSkillsGUI\saveSelfEvaluation().

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