ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSkillSelfEvaluation Class Reference

Self evaluation application class. More...

+ Collaboration diagram for ilSkillSelfEvaluation:

Public Member Functions

 __construct ($a_id=0)
 Constructor.
 setId ($a_val)
 Set id.
 getId ()
 Get id.
 setUserId ($a_val)
 Set user id.
 getUserId ()
 Get user id.
 setTopSkillId ($a_val)
 Set top skill id.
 getTopSkillId ()
 Get top skill id.
 setCreated ($a_val)
 Set created at.
 getCreated ()
 Get created at.
 setLastUpdate ($a_val)
 Set last update.
 getLastUpdate ()
 Get last update.
 setLevels ($a_val, $a_keep_existing=false)
 Set level.
 getLevels ()
 Get level.
 read ()
 Read.
 create ()
 Create self evaluation.
 update ()
 Update self evaluation.
 delete ()
 Delete self evaluation.

Static Public Member Functions

static getAllSelfEvaluationsOfUser ($a_user, $a_one_per_top_skill=false)
 Get all self evaluations.
static getAverageLevel ($a_se_id, $a_user_id, $a_top_skill_id)
 Get average level of user self evaluation.
static determineSteps ($a_sn_id)
 Determine steps.

Static Protected Member Functions

static lookupProperty ($a_id, $a_prop)
 Lookup property.

Detailed Description

Self evaluation application class.

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

Definition at line 12 of file class.ilSkillSelfEvaluation.php.

Constructor & Destructor Documentation

ilSkillSelfEvaluation::__construct (   $a_id = 0)

Constructor.

Parameters

Definition at line 19 of file class.ilSkillSelfEvaluation.php.

References read(), and setId().

{
if ($a_id > 0)
{
$this->setId($a_id);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilSkillSelfEvaluation::create ( )

Create self evaluation.

Definition at line 198 of file class.ilSkillSelfEvaluation.php.

References getLevels(), and setId().

{
global $ilDB;
$this->setId($ilDB->nextId("skl_self_eval"));
$ilDB->manipulate("INSERT INTO skl_self_eval ".
"(id, user_id, top_skill_id, created, last_update) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($this->getUserId(), "integer").",".
$ilDB->quote($this->getTopSkillId(), "integer").",".
$ilDB->now().",".
$ilDB->now().
")");
$levels = $this->getLevels();
if (is_array($levels))
{
foreach ($levels as $skill_id => $level_id)
{
$ilDB->manipulate("INSERT INTO skl_self_eval_level ".
"(self_eval_id, skill_id, level_id) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($skill_id, "integer").",".
$ilDB->quote($level_id, "integer").
")");
}
}
}

+ Here is the call graph for this function:

ilSkillSelfEvaluation::delete ( )

Delete self evaluation.

Definition at line 264 of file class.ilSkillSelfEvaluation.php.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM skl_self_eval WHERE "
." id = ".$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate("DELETE FROM skl_self_eval_level WHERE "
." self_eval_id = ".$ilDB->quote($this->getId(), "integer")
);
}
static ilSkillSelfEvaluation::determineSteps (   $a_sn_id)
static

Determine steps.

Parameters
@return

Definition at line 392 of file class.ilSkillSelfEvaluation.php.

References $steps.

Referenced by ilSkillSelfEvaluationGUI\saveSelfEvaluation(), ilSkillSelfEvaluationGUI\startSelfEvaluation(), and ilSkillSelfEvaluationGUI\updateSelfEvaluation().

{
$steps = array();
if ($a_sn_id > 0 )
{
include_once("./Services/Skill/classes/class.ilSkillTree.php");
include_once("./Services/Skill/classes/class.ilSkillSelfEvalSkillTableGUI.php");
$stree = new ilSkillTree();
if ($stree->isInTree($a_sn_id))
{
$cnode = $stree->getNodeData($a_sn_id);
$childs = $stree->getSubTree($cnode);
foreach ($childs as $child)
{
if ($child["type"] == "skll")
{
$steps[] = $child["child"];
}
}
}
}
return $steps;
}

+ Here is the caller graph for this function:

static ilSkillSelfEvaluation::getAllSelfEvaluationsOfUser (   $a_user,
  $a_one_per_top_skill = false 
)
static

Get all self evaluations.

Definition at line 280 of file class.ilSkillSelfEvaluation.php.

Referenced by ilSelfEvaluationTableGUI\__construct(), and ilSkillSelfEvaluationGUI\getPresentationView().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_self_eval WHERE user_id = ".
$ilDB->quote($a_user, "integer")." ".
"ORDER BY last_update DESC"
);
$self_evaluation = array();
$top_skills = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if (!$a_one_per_top_skill || !in_array($rec["top_skill_id"], $top_skills))
{
$self_evaluation[] = $rec;
$top_skills[] = $rec["top_skill_id"];
}
}
return $self_evaluation;
}

+ Here is the caller graph for this function:

static ilSkillSelfEvaluation::getAverageLevel (   $a_se_id,
  $a_user_id,
  $a_top_skill_id 
)
static

Get average level of user self evaluation.

Note: this method does not make much sense in general, since it assumes that all basic skills have the same level

Definition at line 327 of file class.ilSkillSelfEvaluation.php.

References $lng.

{
global $lng;
$lng->loadLanguageModule("skmg");
include_once("./Services/Skill/classes/class.ilSkillTree.php");
include_once("./Services/Skill/classes/class.ilBasicSkill.php");
$stree = new ilSkillTree();
$cnt = 0;
$sum = 0;
if ($stree->isInTree($a_top_skill_id))
{
$se = new ilSkillSelfEvaluation($a_se_id);
$levels = $se->getLevels();
$cnode = $stree->getNodeData($a_top_skill_id);
$childs = $stree->getSubTree($cnode);
foreach ($childs as $child)
{
if ($child["type"] == "skll")
{
$sk = new ilBasicSkill($child["child"]);
$ls = $sk->getLevelData();
$ord = array();
foreach ($ls as $k => $l)
{
$ord[$l["id"]] = $k + 1;
}
reset($ls);
foreach ($ls as $ld)
{
if ($ld["id"] == $levels[$child["child"]])
{
$sum+= $ord[$ld["id"]];
}
}
$cnt+= 1;
}
}
}
if ($cnt > 0)
{
$avg = round($sum/$cnt);
if ($avg > 0)
{
return (array("skill_title" => $cnode["title"],
"ord" => $avg, "avg_title" => $ls[$avg - 1]["title"]));
}
else
{
return (array("skill_title" => $cnode["title"],
"ord" => $avg, "avg_title" => $lng->txt("skmg_no_skills")));
}
}
return null;
}
ilSkillSelfEvaluation::getCreated ( )

Get created at.

Returns
timestamp created at

Definition at line 103 of file class.ilSkillSelfEvaluation.php.

{
return $this->created;
}
ilSkillSelfEvaluation::getId ( )

Get id.

Returns
integer id

Definition at line 43 of file class.ilSkillSelfEvaluation.php.

Referenced by update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::getLastUpdate ( )

Get last update.

Returns
timestamp last update

Definition at line 123 of file class.ilSkillSelfEvaluation.php.

{
return $this->last_update;
}
ilSkillSelfEvaluation::getLevels ( )

Get level.

Returns
array level

Definition at line 156 of file class.ilSkillSelfEvaluation.php.

Referenced by create(), and update().

{
return $this->levels;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::getTopSkillId ( )

Get top skill id.

Returns
integer top skill id

Definition at line 83 of file class.ilSkillSelfEvaluation.php.

{
return $this->top_skill_id;
}
ilSkillSelfEvaluation::getUserId ( )

Get user id.

Returns
integer user id

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

{
return $this->user_id;
}
static ilSkillSelfEvaluation::lookupProperty (   $a_id,
  $a_prop 
)
staticprotected

Lookup property.

Parameters
idlevel id
Returns
mixed property value

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

{
global $ilDB;
$set = $ilDB->query("SELECT $a_prop FROM skl_self_eval WHERE ".
" id = ".$ilDB->quote($a_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec[$a_prop];
}
ilSkillSelfEvaluation::read ( )

Read.

Parameters
@return

Definition at line 167 of file class.ilSkillSelfEvaluation.php.

References setCreated(), setLastUpdate(), setLevels(), setTopSkillId(), and setUserId().

Referenced by __construct().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_self_eval WHERE ".
" id = ".$ilDB->quote($this->getId(), "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
$this->setUserId($rec["user_id"]);
$this->setTopSkillId($rec["top_skill_id"]);
$this->setCreated($rec["created"]);
$this->setLastUpdate($rec["last_update"]);
}
// levels
$set = $ilDB->query("SELECT * FROM skl_self_eval_level WHERE ".
" self_eval_id = ".$ilDB->quote($this->getId(), "integer")
);
$levels = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$levels[$rec["skill_id"]] = $rec["level_id"];
}
$this->setLevels($levels);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::setCreated (   $a_val)

Set created at.

Parameters
timestampcreated at

Definition at line 93 of file class.ilSkillSelfEvaluation.php.

Referenced by read().

{
$this->created = $a_val;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::setId (   $a_val)

Set id.

Parameters
integerid

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

Referenced by __construct(), and create().

{
$this->id = $a_val;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::setLastUpdate (   $a_val)

Set last update.

Parameters
timestamplast update

Definition at line 113 of file class.ilSkillSelfEvaluation.php.

Referenced by read().

{
$this->last_update = $a_val;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::setLevels (   $a_val,
  $a_keep_existing = false 
)

Set level.

Parameters
arraylevel; index: skill id, value: level id (or 0 for no skills)

Definition at line 133 of file class.ilSkillSelfEvaluation.php.

Referenced by read().

{
if (!$a_keep_existing)
{
$this->levels = $a_val;
}
else
{
if (is_array($a_val))
{
foreach ($a_val as $k => $v)
{
$this->levels[$k] = $v;
}
}
}
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::setTopSkillId (   $a_val)

Set top skill id.

Parameters
integertop skill id

Definition at line 73 of file class.ilSkillSelfEvaluation.php.

Referenced by read().

{
$this->top_skill_id = $a_val;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::setUserId (   $a_val)

Set user id.

Parameters
integeruser id

Definition at line 53 of file class.ilSkillSelfEvaluation.php.

Referenced by read().

{
$this->user_id = $a_val;
}

+ Here is the caller graph for this function:

ilSkillSelfEvaluation::update ( )

Update self evaluation.

Definition at line 231 of file class.ilSkillSelfEvaluation.php.

References getId(), and getLevels().

{
global $ilDB;
$ilDB->manipulate("UPDATE skl_self_eval SET ".
" user_id = ".$ilDB->quote($this->getUserId(), "integer").
", top_skill_id = ".$ilDB->quote($this->getTopSkillId(), "integer").
", last_update = ".$ilDB->now().
" WHERE id = ".$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate("DELETE FROM skl_self_eval_level WHERE "
." self_eval_id = ".$ilDB->quote($this->getId(), "integer")
);
$levels = $this->getLevels();
if (is_array($levels))
{
foreach ($levels as $skill_id => $level_id)
{
$ilDB->manipulate("INSERT INTO skl_self_eval_level ".
"(self_eval_id, skill_id, level_id) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($skill_id, "integer").",".
$ilDB->quote($level_id, "integer").
")");
}
}
}

+ Here is the call graph for this function:


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