ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 removeSkill ($a_user_id, $a_skill_node_id)
 Remove personal skill.

Static Public Member Functions

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

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

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.

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

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_personal_skill ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" AND skill_node_id = ".$ilDB->quote($a_skill_node_id, "integer")
);
if (!$ilDB->fetchAssoc($set))
{
$ilDB->manipulate("INSERT INTO skl_personal_skill ".
"(user_id, skill_node_id) VALUES (".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($a_skill_node_id, "integer").
")");
}
}

+ Here is the caller graph for this function:

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.

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_assigned_material ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND skill_id = ".$ilDB->quote($a_basic_skill, "integer").
" AND level_id = ".$ilDB->quote($a_level, "integer").
" AND wsp_id = ".$ilDB->quote($a_wsp_id, "integer")
);
if (!$ilDB->fetchAssoc($set))
{
$ilDB->manipulate("INSERT INTO skl_assigned_material ".
"(user_id, top_skill_id, tref_id, skill_id, level_id, wsp_id) VALUES (".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($a_top_skill, "integer").",".
$ilDB->quote((int) $a_tref_id, "integer").",".
$ilDB->quote($a_basic_skill, "integer").",".
$ilDB->quote($a_level, "integer").",".
$ilDB->quote($a_wsp_id, "integer").
")");
}
}
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.

Referenced by ilPersonalSkillsGUI\renderMaterialsRow().

{
global $ilDB;
$set = $ilDB->query("SELECT count(*) as cnt FROM skl_assigned_material ".
" WHERE level_id = ".$ilDB->quote($a_level, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec["cnt"];
}

+ Here is the caller graph for this function:

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.

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

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_assigned_material ".
" WHERE level_id = ".$ilDB->quote($a_level, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer")
);
$mat = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$mat[] = $rec;
}
return $mat;
}

+ Here is the caller graph for this function:

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 ilSkillTreeNode\_lookupTitle().

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

{
global $ilDB;
include_once "Services/Skill/classes/class.ilSkillTreeNode.php";
include_once("./Services/Skill/classes/class.ilSkillTree.php");
$stree = new ilSkillTree();
$set = $ilDB->query("SELECT * FROM skl_personal_skill ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer")
);
$pskills = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if ($stree->isInTree($rec["skill_node_id"]))
{
$pskills[$rec["skill_node_id"]] = array("skill_node_id" => $rec["skill_node_id"],
"title" => ilSkillTreeNode::_lookupTitle($rec["skill_node_id"]));
}
}
return $pskills;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
global $ilDB;
$set = $ilDB->query("SELECT level_id FROM skl_self_eval_level ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND skill_id = ".$ilDB->quote($a_basic_skill, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return (int) $rec["level_id"];
}

+ Here is the caller graph for this function:

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

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

{
global $ilDB;
$set = $ilDB->query("SELECT last_update FROM skl_self_eval_level ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND skill_id = ".$ilDB->quote($a_basic_skill, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec["last_update"];
}

+ Here is the caller graph for this function:

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

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

{
global $ilDB;
// material
include_once("./Services/Skill/classes/class.ilSkillUsage.php");
"skl_assigned_material", "user_id");
// self evaluations
"skl_self_eval_level", "user_id");
// users that use the skills as personal skills
$pskill_ids = array();
$tref_ids = array();
foreach ($a_cskill_ids as $cs)
{
if ($cs["tref_id"] > 0)
{
include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
if (ilSkillTemplateReference::_lookupTemplateId($cs["tref_id"]) == $cs["skill_id"])
{
$pskill_ids[$cs["tref_id"]] = $cs["tref_id"];
$tref_ids[(int) $cs["tref_id"]] = $cs["skill_id"];
}
}
else
{
$pskill_ids[$cs["skill_id"]] = $cs["skill_id"];
}
}
$set = $ilDB->query("SELECT skill_node_id, user_id FROM skl_personal_skill ".
" WHERE ".$ilDB->in("skill_node_id", $pskill_ids, false, "integer").
" GROUP BY skill_node_id, user_id"
);
while ($rec = $ilDB->fetchAssoc($set))
{
if (isset($tref_ids[(int) $rec["skill_node_id"]]))
{
$a_usages[$tref_ids[$rec["skill_node_id"]].":".$rec["skill_node_id"]][ilSkillUsage::PERSONAL_SKILL][] =
array("key" => $rec["user_id"]);
}
else
{
$a_usages[$rec["skill_node_id"].":0"][ilSkillUsage::PERSONAL_SKILL][] =
array("key" => $rec["user_id"]);
}
}
}

+ Here is the call graph for this function:

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.

References $t.

{
global $ilDB;
$t = "DELETE FROM skl_assigned_material WHERE ".
" user_id = ".$ilDB->quote($a_user_id, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND level_id = ".$ilDB->quote($a_level_id, "integer").
" AND wsp_id = ".$ilDB->quote($a_wsp_id, "integer");
$ilDB->manipulate($t);
}
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.

Referenced by ilPersonalSkillsGUI\removeSkills().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM skl_personal_skill WHERE ".
" user_id = ".$ilDB->quote($a_user_id, "integer").
" AND skill_node_id = ".$ilDB->quote($a_skill_node_id, "integer")
);
}

+ Here is the caller graph for this function:

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.

References ilUtil\now().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_self_eval_level ".
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND skill_id = ".$ilDB->quote($a_basic_skill, "integer"));
if (!$ilDB->fetchAssoc($set))
{
$ilDB->manipulate("INSERT INTO skl_self_eval_level ".
"(user_id, top_skill_id, tref_id, skill_id, level_id, last_update) VALUES (".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($a_top_skill, "integer").",".
$ilDB->quote((int) $a_tref_id, "integer").",".
$ilDB->quote($a_basic_skill, "integer").",".
$ilDB->quote($a_level, "integer").",".
$ilDB->quote(ilUtil::now(), "timestamp").
")");
}
else
{
$ilDB->manipulate("UPDATE skl_self_eval_level SET ".
" level_id = ".$ilDB->quote($a_level, "integer").", ".
" last_update = ".$ilDB->quote(ilUtil::now(), "timestamp").
" WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
" AND top_skill_id = ".$ilDB->quote($a_top_skill, "integer").
" AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
" AND skill_id = ".$ilDB->quote($a_basic_skill, "integer"));
}
}

+ Here is the call graph for this function:


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