ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
Version
$Id$

Definition at line 14 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 53 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

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

54  {
55  global $DIC;
56 
57  $ilDB = $DIC->database();
58 
59  $set = $ilDB->query(
60  "SELECT * FROM skl_personal_skill " .
61  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
62  " AND skill_node_id = " . $ilDB->quote($a_skill_node_id, "integer")
63  );
64  if (!$ilDB->fetchAssoc($set)) {
65  $ilDB->manipulate("INSERT INTO skl_personal_skill " .
66  "(user_id, skill_node_id) VALUES (" .
67  $ilDB->quote($a_user_id, "integer") . "," .
68  $ilDB->quote($a_skill_node_id, "integer") .
69  ")");
70  }
71  }
global $DIC
Definition: saml.php:7
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 124 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\selectMaterial().

125  {
126  global $DIC;
127 
128  $ilDB = $DIC->database();
129 
130  $set = $ilDB->query(
131  "SELECT * FROM skl_assigned_material " .
132  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
133  " AND top_skill_id = " . $ilDB->quote($a_top_skill, "integer") .
134  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
135  " AND skill_id = " . $ilDB->quote($a_basic_skill, "integer") .
136  " AND level_id = " . $ilDB->quote($a_level, "integer") .
137  " AND wsp_id = " . $ilDB->quote($a_wsp_id, "integer")
138  );
139  if (!$ilDB->fetchAssoc($set)) {
140  $ilDB->manipulate("INSERT INTO skl_assigned_material " .
141  "(user_id, top_skill_id, tref_id, skill_id, level_id, wsp_id) VALUES (" .
142  $ilDB->quote($a_user_id, "integer") . "," .
143  $ilDB->quote($a_top_skill, "integer") . "," .
144  $ilDB->quote((int) $a_tref_id, "integer") . "," .
145  $ilDB->quote($a_basic_skill, "integer") . "," .
146  $ilDB->quote($a_level, "integer") . "," .
147  $ilDB->quote($a_wsp_id, "integer") .
148  ")");
149  }
150  }
global $DIC
Definition: saml.php:7
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 185 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\getMaterials().

186  {
187  global $DIC;
188 
189  $ilDB = $DIC->database();
190 
191  $set = $ilDB->query(
192  "SELECT count(*) as cnt FROM skl_assigned_material " .
193  " WHERE level_id = " . $ilDB->quote($a_level, "integer") .
194  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
195  " AND user_id = " . $ilDB->quote($a_user_id, "integer")
196  );
197  $rec = $ilDB->fetchAssoc($set);
198  return $rec["cnt"];
199  }
global $DIC
Definition: saml.php:7
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 159 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

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

160  {
161  global $DIC;
162 
163  $ilDB = $DIC->database();
164 
165  $set = $ilDB->query(
166  "SELECT * FROM skl_assigned_material " .
167  " WHERE level_id = " . $ilDB->quote($a_level, "integer") .
168  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
169  " AND user_id = " . $ilDB->quote($a_user_id, "integer")
170  );
171  $mat = array();
172  while ($rec = $ilDB->fetchAssoc($set)) {
173  $mat[] = $rec;
174  }
175  return $mat;
176  }
global $DIC
Definition: saml.php:7
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 22 of file class.ilPersonalSkill.php.

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

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

23  {
24  global $DIC;
25 
26  $ilDB = $DIC->database();
27 
28  include_once "Services/Skill/classes/class.ilSkillTreeNode.php";
29 
30  include_once("./Services/Skill/classes/class.ilSkillTree.php");
31  $stree = new ilSkillTree();
32 
33  $set = $ilDB->query(
34  "SELECT * FROM skl_personal_skill " .
35  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer")
36  );
37  $pskills = array();
38  while ($rec = $ilDB->fetchAssoc($set)) {
39  if ($stree->isInTree($rec["skill_node_id"])) {
40  $pskills[$rec["skill_node_id"]] = array("skill_node_id" => $rec["skill_node_id"],
41  "title" => ilSkillTreeNode::_lookupTitle($rec["skill_node_id"]));
42  }
43  }
44  return $pskills;
45  }
global $DIC
Definition: saml.php:7
Skill tree.
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 278 of file class.ilPersonalSkill.php.

Referenced by ilSelfEvaluationSimpleTableGUI\__construct().

279  {
280  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
281  $bs = new ilBasicSkill($a_basic_skill);
282  return $bs->getLastLevelPerObject($a_tref_id, 0, $a_user_id, 1);
283  }
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 294 of file class.ilPersonalSkill.php.

Referenced by ilPersonalSkillsGUI\renderSkillHTML().

295  {
296  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
297  $bs = new ilBasicSkill($a_basic_skill);
298  return $bs->getLastUpdatePerObject($a_tref_id, 0, $a_user_id, 1);
299  }
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 307 of file class.ilPersonalSkill.php.

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

308  {
309  global $DIC;
310 
311  $ilDB = $DIC->database();
312 
313  // material
314  include_once("./Services/Skill/classes/class.ilSkillUsage.php");
316  $a_cskill_ids,
317  $a_usages,
319  "skl_assigned_material",
320  "user_id"
321  );
322 
323  // self evaluations
325  $a_cskill_ids,
326  $a_usages,
328  "skl_self_eval_level",
329  "user_id"
330  );
331 
332  // users that use the skills as personal skills
333  $pskill_ids = array();
334  $tref_ids = array();
335  foreach ($a_cskill_ids as $cs) {
336  if ($cs["tref_id"] > 0) {
337  include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
338  if (ilSkillTemplateReference::_lookupTemplateId($cs["tref_id"]) == $cs["skill_id"]) {
339  $pskill_ids[$cs["tref_id"]] = $cs["tref_id"];
340  $tref_ids[(int) $cs["tref_id"]] = $cs["skill_id"];
341  }
342  } else {
343  $pskill_ids[$cs["skill_id"]] = $cs["skill_id"];
344  }
345  }
346  $set = $ilDB->query(
347  "SELECT skill_node_id, user_id FROM skl_personal_skill " .
348  " WHERE " . $ilDB->in("skill_node_id", $pskill_ids, false, "integer") .
349  " GROUP BY skill_node_id, user_id"
350  );
351  while ($rec = $ilDB->fetchAssoc($set)) {
352  if (isset($tref_ids[(int) $rec["skill_node_id"]])) {
353  $a_usages[$tref_ids[$rec["skill_node_id"]] . ":" . $rec["skill_node_id"]][ilSkillUsage::PERSONAL_SKILL][] =
354  array("key" => $rec["user_id"]);
355  } else {
356  $a_usages[$rec["skill_node_id"] . ":0"][ilSkillUsage::PERSONAL_SKILL][] =
357  array("key" => $rec["user_id"]);
358  }
359  }
360  }
global $DIC
Definition: saml.php:7
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.
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 207 of file class.ilPersonalSkill.php.

References $DIC, $ilDB, and $t.

Referenced by ilPersonalSkillsGUI\removeMaterial().

208  {
209  global $DIC;
210 
211  $ilDB = $DIC->database();
212 
213  $t = "DELETE FROM skl_assigned_material WHERE " .
214  " user_id = " . $ilDB->quote($a_user_id, "integer") .
215  " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") .
216  " AND level_id = " . $ilDB->quote($a_level_id, "integer") .
217  " AND wsp_id = " . $ilDB->quote($a_wsp_id, "integer");
218 
219  $ilDB->manipulate($t);
220  }
global $DIC
Definition: saml.php:7
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 227 of file class.ilPersonalSkill.php.

References $DIC, $ilDB, and $t.

Referenced by ilSkillObjDeletionHandler\processDeletion().

228  {
229  global $DIC;
230 
231  $ilDB = $DIC->database();
232 
233  $t = "DELETE FROM skl_assigned_material WHERE " .
234  " user_id = " . $ilDB->quote($a_user_id, "integer");
235  $ilDB->manipulate($t);
236  }
global $DIC
Definition: saml.php:7
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 79 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilPersonalSkillsGUI\removeSkills().

80  {
81  global $DIC;
82 
83  $ilDB = $DIC->database();
84 
85  $ilDB->manipulate(
86  "DELETE FROM skl_personal_skill WHERE " .
87  " user_id = " . $ilDB->quote($a_user_id, "integer") .
88  " AND skill_node_id = " . $ilDB->quote($a_skill_node_id, "integer")
89  );
90  }
global $DIC
Definition: saml.php:7
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 97 of file class.ilPersonalSkill.php.

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

98  {
99  global $DIC;
100 
101  $ilDB = $DIC->database();
102 
103  $ilDB->manipulate(
104  "DELETE FROM skl_personal_skill WHERE " .
105  " user_id = " . $ilDB->quote($a_user_id, "integer")
106  );
107  }
global $DIC
Definition: saml.php:7
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 251 of file class.ilPersonalSkill.php.

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

Referenced by ilPersonalSkillsGUI\saveSelfEvaluation().

252  {
253  include_once("./Services/Skill/classes/class.ilBasicSkill.php");
254  if ($a_level > 0) {
256  $a_level,
257  $a_user_id,
258  0,
259  $a_tref_id,
261  false,
262  1
263  );
264  } else {
265  ilBasicSkill::resetUserSkillLevelStatus($a_user_id, $a_basic_skill, $a_tref_id, 0, true);
266  }
267  }
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.
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.
+ 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: