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

Basic Skill. More...

+ Inheritance diagram for ilBasicSkill:
+ Collaboration diagram for ilBasicSkill:

Public Member Functions

 __construct ($a_id=0)
 Constructor public.
 read ()
 Read data from database.
 create ()
 Create skill.
 delete ()
 Delete skill.
 copy ()
 Copy basic skill.
 addLevel ($a_title, $a_description)
 Add new level.
 getMaxLevelNr ()
 Get maximum level nr.
 getLevelData ($a_id=0)
 Get level data.
 updateLevelOrder ($order)
 Update level order.
 deleteLevel ($a_id)
 Delete level.
 fixLevelNumbering ()
 Fix level numbering.
 lookupLevelsForTriggerRefId ($a_ref_id)
 Lookup levels for trigger.
 getSkillForLevelId ($a_level_id)
 Get skill for level id.
 lookupLevelAchievementDate ($a_user_id, $a_level_id)
 Lookup level achievement date.
 getTitleForCertificate ()
 Get title for certificate.
 getLevelTitleForCertificate ($a_level_id)
 Get title for certificate.
 getTriggerTitleForCertificate ($a_level_id)
 Get trigger title for certificate.
 getShortTitleForCertificate ()
 Get short title for certificate.
- Public Member Functions inherited from ilSkillTreeNode
 ilSkillTreeNode ($a_id=0)
 setTitle ($a_title)
 Set title.
 getTitle ()
 Get title.
 setType ($a_type)
 Set type.
 getType ()
 Get type.
 setId ($a_id)
 Set Node ID.
 getId ()
 Get Node ID.
 setSelfEvaluation ($a_val)
 Set self evaluation.
 getSelfEvaluation ()
 Get self evaluation.
 setOrderNr ($a_val)
 Set order nr.
 getOrderNr ()
 Get order nr.
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory
 setDraft ($a_val)
 Set draft.
 getDraft ()
 Get draft.
 update ()
 Update Node.
 clipboardCut ($a_tree_id, $a_ids)
 Cut and copy a set of skills/skill categories into the clipboard.
 getIconPath ($a_obj_id, $a_type, $a_size="", $a_draft=false)
 Get icon path.

Static Public Member Functions

static lookupLevelTitle ($a_id)
 Lookup level title.
static lookupLevelDescription ($a_id)
 Lookup level description.
static lookupLevelTrigger ($a_id)
 Lookup level trigger.
static lookupLevelSkillId ($a_id)
 Lookup level skill id.
static writeLevelTitle ($a_id, $a_title)
 Write level title.
static writeLevelDescription ($a_id, $a_description)
 Write level description.
static writeLevelTrigger ($a_id, $a_trigger_ref_id)
 Write trigger.
static updateAllUserSkillLevels ()
 Look for all skill level that have a trigger and update the user skill level information, if it has changed.
static updateSkillLevelsByTriggerRef ($a_user_id, $a_ref_id)
 Look for all skill level that have a trigger and update the user skill level information, if it has changed.
static writeUserSkillLevelStatus ($a_level_id, $a_user_id, $a_status=ilBasicSkill::ACHIEVED, $a_force=false)
 Write skill level status.
static getCompletionDateForTriggerRefId ($a_user_id, $a_ref_id=null)
 Get trigger completion.
static checkUserCertificateForTriggerRefId ($a_user_id, $a_ref_id)
 Get trigger completion.
static getTriggerOfAllCertificates ($a_user_id)
 Get trigger completion.
static getSkillLevelsForTrigger ($a_ref_id)
 Get assigned skill levels for trigger.
static _lookupCertificate ($a_skill_id, $a_skill_level_id)
 Checks whether a skill level has a certificate or not.
- Static Public Member Functions inherited from ilSkillTreeNode
static _lookupTitle ($a_obj_id)
 Lookup Title.
static _lookupSelfEvaluation ($a_obj_id)
 Lookup self evaluation.
static _lookupDraft ($a_obj_id)
 Lookup Draft.
static _lookupType ($a_obj_id)
 Lookup Type.
static _writeTitle ($a_obj_id, $a_title)
 Write Title.
static _writeOrderNr ($a_obj_id, $a_nr)
 Write Order Nr.
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 Put this object into the skill tree.
static getTree ($a_slm_obj_id)
 Get scorm module editing tree.
static uniqueTypesCheck ($a_items)
 Check for unique types.
static clipboardCopy ($a_tree_id, $a_ids)
 Copy a set of skills/skill categories into the clipboard.
static insertItemsFromClip ($a_type, $a_obj_id)
 Insert basic skills from clipboard.
static clearClipboard ()
 Remove all skill items from clipboard.
static pasteTree ($a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_add_suffix=false)
 Paste item (tree) from clipboard to skill tree.
static isInTree ($a_id)
 Is id in tree?
static getAllSelfEvaluationNodes ()
 Get all self evaluation nodes.
static getTopTemplates ()
 Get top skill templates and template categories.
static getSelectableSkills ()
 Get selectable skills.
static getSkillTreeNodes ($a_node_id, $a_only_basic=false)
 Get basic skills under node.
static saveChildsOrder ($a_par_id, $a_childs_order, $a_templates=false)
 Save childs order.

Data Fields

const ACHIEVED = 1
const NOT_ACHIEVED = 0
 $id
- Data Fields inherited from ilSkillTreeNode
 $type
 $id
 $title

Static Protected Member Functions

static lookupLevelProperty ($a_id, $a_prop)
 Lookup level property.
static writeLevelProperty ($a_id, $a_prop, $a_value, $a_type)
 Write level property.
- Static Protected Member Functions inherited from ilSkillTreeNode
static _lookup ($a_obj_id, $a_field)
 Lookup Title.

Detailed Description

Basic Skill.

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

Definition at line 15 of file class.ilBasicSkill.php.

Constructor & Destructor Documentation

ilBasicSkill::__construct (   $a_id = 0)

Constructor public.

Reimplemented in ilBasicSkillTemplate.

Definition at line 26 of file class.ilBasicSkill.php.

References ilSkillTreeNode\ilSkillTreeNode(), and ilSkillTreeNode\setType().

{
$this->setType("skll");
}

+ Here is the call graph for this function:

Member Function Documentation

static ilBasicSkill::_lookupCertificate (   $a_skill_id,
  $a_skill_level_id 
)
static

Checks whether a skill level has a certificate or not.

Parameters
intskill id
intskill level id
Returns
true/false

Definition at line 832 of file class.ilBasicSkill.php.

Referenced by checkUserCertificateForTriggerRefId(), and getTriggerOfAllCertificates().

{
$certificatefile = CLIENT_WEB_DIR."/certificates/skill/".
((int)$a_skill_id)."/".((int) $a_skill_level_id)."/certificate.xml";
if (@file_exists($certificatefile))
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

ilBasicSkill::addLevel (   $a_title,
  $a_description 
)

Add new level.

Parameters
stringtitle
stringdescription

Definition at line 104 of file class.ilBasicSkill.php.

References ilSkillTreeNode\getId(), and getMaxLevelNr().

{
global $ilDB;
$nr = $this->getMaxLevelNr();
$nid = $ilDB->nextId("skl_level");
$ilDB->insert("skl_level", array(
"id" => array("integer", $nid),
"skill_id" => array("integer", $this->getId()),
"nr" => array("integer", $nr+1),
"title" => array("text", $a_title),
"description" => array("clob", $a_description)
));
}

+ Here is the call graph for this function:

static ilBasicSkill::checkUserCertificateForTriggerRefId (   $a_user_id,
  $a_ref_id 
)
static

Get trigger completion.

Parameters
@return

Definition at line 644 of file class.ilBasicSkill.php.

References $ref_id, and _lookupCertificate().

Referenced by ilObjSkillManagementGUI\testCert().

{
global $ilDB;
if (!is_array($a_ref_id))
{
$a_ref_id = array($a_ref_id);
}
if (!is_array($a_user_id))
{
$a_user_id = array($a_user_id);
}
$set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id, level_id, skill_id FROM skl_user_has_level WHERE ".
$ilDB->in("user_id", $a_user_id, false, "integer")." AND ".
$ilDB->in("trigger_ref_id", $a_ref_id, false, "integer")
);
$completion = array();
$completion = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if (!isset($completion[$rec["user_id"]][$rec["trigger_ref_id"]])
&& ilBasicSkill::_lookupCertificate($rec["skill_id"], $rec["level_id"]))
{
$completion[$rec["user_id"]][$rec["trigger_ref_id"]] = true;
}
}
foreach ($a_ref_id as $ref_id)
{
foreach ($a_user_id as $user_id)
{
if (!isset($completion[$user_id][$ref_id]))
{
$completion[$user_id][$ref_id] = false;
}
}
}
return $completion;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBasicSkill::copy ( )

Copy basic skill.

Reimplemented in ilBasicSkillTemplate.

Definition at line 70 of file class.ilBasicSkill.php.

References getLevelData(), ilSkillTreeNode\getOrderNr(), ilSkillTreeNode\getSelfEvaluation(), ilSkillTreeNode\getTitle(), and ilSkillTreeNode\getType().

{
$skill = new ilBasicSkill();
$skill->setTitle($this->getTitle());
$skill->setType($this->getType());
$skill->setSelfEvaluation($this->getSelfEvaluation());
$skill->setOrderNr($this->getOrderNr());
$skill->create();
$levels = $this->getLevelData();
if (sizeof($levels))
{
foreach($levels as $item)
{
$skill->addLevel($item["title"], $item["description"]);
}
}
$skill->update();
return $skill;
}

+ Here is the call graph for this function:

ilBasicSkill::create ( )

Create skill.

Reimplemented from ilSkillTreeNode.

Definition at line 44 of file class.ilBasicSkill.php.

ilBasicSkill::delete ( )

Delete skill.

Reimplemented from ilSkillTreeNode.

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

{
global $ilDB;
$ilDB->manipulate("DELETE FROM skl_level WHERE "
." skill_id = ".$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate("DELETE FROM skl_user_has_level WHERE "
." skill_id = ".$ilDB->quote($this->getId(), "integer")
);
}
ilBasicSkill::deleteLevel (   $a_id)

Delete level.

Parameters
@return

Definition at line 315 of file class.ilBasicSkill.php.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM skl_level WHERE "
." id = ".$ilDB->quote($a_id, "integer")
);
}
ilBasicSkill::fixLevelNumbering ( )

Fix level numbering.

Parameters
@return

Definition at line 331 of file class.ilBasicSkill.php.

{
global $ilDB;
$set = $ilDB->query("SELECT id, nr FROM skl_level WHERE ".
" skill_id = ".$ilDB->quote($this->getId(), "integer").
" ORDER BY nr ASC"
);
$cnt = 1;
while ($rec = $ilDB->fetchAssoc($set))
{
$ilDB->manipulate("UPDATE skl_level SET ".
" nr = ".$ilDB->quote($cnt, "integer").
" WHERE id = ".$ilDB->quote($rec["id"], "integer")
);
$cnt++;
}
}
static ilBasicSkill::getCompletionDateForTriggerRefId (   $a_user_id,
  $a_ref_id = null 
)
static

Get trigger completion.

Parameters
@return

Definition at line 548 of file class.ilBasicSkill.php.

References $ref_id, and ilParticipants\_getMembershipByType().

Referenced by ilObjSkillManagementGUI\test().

{
global $ilDB;
if ($a_ref_id == "")
{
$a_ref_id = null;
}
else if (!is_array($a_ref_id))
{
$a_ref_id = array($a_ref_id);
}
if (!is_array($a_user_id))
{
$a_user_id = array($a_user_id);
}
if ($a_ref_id != null)
{
if (!is_array($a_ref_id))
{
$a_ref_id = array($a_ref_id);
}
$set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id FROM skl_user_has_level WHERE ".
$ilDB->in("user_id", $a_user_id, false, "integer")." AND ".
$ilDB->in("trigger_ref_id", $a_ref_id, false, "integer")
);
$completion = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if (!isset($completion[$rec["user_id"]][$rec["trigger_ref_id"]]))
{
$completion[$rec["user_id"]][$rec["trigger_ref_id"]] = $rec["status_date"];
}
else if ($rec["status_date"] < $completion[$rec["user_id"]][$rec["trigger_ref_id"]])
{
$completion[$rec["user_id"]][$rec["trigger_ref_id"]] = $rec["status_date"];
}
}
foreach ($a_ref_id as $ref_id)
{
foreach ($a_user_id as $user_id)
{
if (!isset($completion[$user_id][$ref_id]))
{
$completion[$user_id][$ref_id] = false;
}
}
}
}
else
{
$completion = array();
foreach ($a_user_id as $user_id)
{
include_once 'Services/Membership/classes/class.ilParticipants.php';
$a_ref_id = ilParticipants::_getMembershipByType($user_id, 'crs', true);
$set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id FROM skl_user_has_level WHERE ".
"user_id = ".$ilDB->quote($user_id, "integer")." AND ".
$ilDB->in("trigger_ref_id", $a_ref_id, false, "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
if (!isset($completion[$user_id][$rec["trigger_ref_id"]]))
{
$completion[$user_id][$rec["trigger_ref_id"]] = $rec["status_date"];
}
else if ($rec["status_date"] < $completion[$user_id][$rec["trigger_ref_id"]])
{
$completion[$user_id][$rec["trigger_ref_id"]] = $rec["status_date"];
}
}
foreach ($a_ref_id as $ref_id)
{
if (!isset($completion[$user_id][$ref_id]))
{
$completion[$user_id][$ref_id] = false;
}
}
}
}
return $completion;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBasicSkill::getLevelData (   $a_id = 0)

Get level data.

Returns
array level data

Definition at line 141 of file class.ilBasicSkill.php.

Referenced by ilBasicSkillTemplate\copy(), and copy().

{
global $ilDB;
if ($a_id > 0)
{
$and = " AND id = ".$ilDB->quote($a_id, "integer");
}
$set = $ilDB->query("SELECT * FROM skl_level WHERE ".
" skill_id = ".$ilDB->quote($this->getId(), "integer").
$and.
" ORDER BY nr"
);
$levels = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if ($a_id > 0)
{
return $rec;
}
$levels[] = $rec;
}
return $levels;
}

+ Here is the caller graph for this function:

ilBasicSkill::getLevelTitleForCertificate (   $a_level_id)

Get title for certificate.

Parameters
@return

Definition at line 798 of file class.ilBasicSkill.php.

References lookupLevelTitle().

{
return ilBasicSkill::lookupLevelTitle($a_level_id);
}

+ Here is the call graph for this function:

ilBasicSkill::getMaxLevelNr ( )

Get maximum level nr.

Returns
int maximum level nr of skill

Definition at line 125 of file class.ilBasicSkill.php.

Referenced by addLevel().

{
global $ilDB;
$set = $ilDB->query("SELECT MAX(nr) mnr FROM skl_level WHERE ".
" skill_id = ".$ilDB->quote($this->getId(), "integer")
);
$rec = $ilDB->fetchAssoc($set);
return (int) $rec["mnr"];
}

+ Here is the caller graph for this function:

ilBasicSkill::getShortTitleForCertificate ( )

Get short title for certificate.

Parameters
@return

Definition at line 821 of file class.ilBasicSkill.php.

{
return "Skill";
}
ilBasicSkill::getSkillForLevelId (   $a_level_id)

Get skill for level id.

Parameters
@return

Definition at line 377 of file class.ilBasicSkill.php.

References ilSkillTreeNode\isInTree().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_level WHERE ".
" id = ".$ilDB->quote($a_level_id, "integer")
);
$skill = null;
if ($rec = $ilDB->fetchAssoc($set))
{
if (ilSkillTreeNode::isInTree($rec["skill_id"]))
{
$skill = new ilBasicSkill($rec["skill_id"]);
}
}
return $skill;
}

+ Here is the call graph for this function:

static ilBasicSkill::getSkillLevelsForTrigger (   $a_ref_id)
static

Get assigned skill levels for trigger.

Parameters
@return

Definition at line 758 of file class.ilBasicSkill.php.

Referenced by ilObjSkillManagementGUI\testLevels().

{
global $ilDB;
$set = $ilDB->query($q = "SELECT id FROM skl_level".
" WHERE trigger_ref_id = ".$ilDB->quote($a_ref_id, "integer"));
$skill_levels = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$skill_levels[] = $rec["id"];
}
return $skill_levels;
}

+ Here is the caller graph for this function:

ilBasicSkill::getTitleForCertificate ( )

Get title for certificate.

Parameters
@return

Definition at line 787 of file class.ilBasicSkill.php.

References ilSkillTreeNode\getTitle().

{
return $this->getTitle();
}

+ Here is the call graph for this function:

static ilBasicSkill::getTriggerOfAllCertificates (   $a_user_id)
static

Get trigger completion.

Parameters
@return

Definition at line 715 of file class.ilBasicSkill.php.

References _lookupCertificate().

Referenced by ilObjSkillManagementGUI\testAllCert().

{
global $ilDB, $tree;
if (!is_array($a_user_id))
{
$a_user_id = array($a_user_id);
}
$set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id, level_id, skill_id FROM skl_user_has_level WHERE ".
$ilDB->in("user_id", $a_user_id, false, "integer")
);
$completion = array();
while ($rec = $ilDB->fetchAssoc($set))
{
if ((!is_array($completion[$rec["user_id"]]) || !in_array($rec["trigger_ref_id"], $completion[$rec["user_id"]]))
&& ilBasicSkill::_lookupCertificate($rec["skill_id"], $rec["level_id"]))
{
if ($tree->isInTree($rec["trigger_ref_id"]))
{
$completion[$rec["user_id"]][] = $rec["trigger_ref_id"];
}
}
}
foreach ($a_user_id as $user_id)
{
if (!is_array($completion[$user_id]))
{
$completion[$user_id] = array();
}
}
return $completion;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBasicSkill::getTriggerTitleForCertificate (   $a_level_id)

Get trigger title for certificate.

Parameters
@return

Definition at line 809 of file class.ilBasicSkill.php.

References ilSkillTreeNode\_lookupTitle(), and lookupLevelTrigger().

{
return ilObject::_lookupTitle($tr["obj_id"]);
}

+ Here is the call graph for this function:

ilBasicSkill::lookupLevelAchievementDate (   $a_user_id,
  $a_level_id 
)

Lookup level achievement date.

Parameters
@return

Definition at line 693 of file class.ilBasicSkill.php.

Referenced by ilSkillCertificateAdapter\getCertificateVariablesForPresentation().

{
global $ilDB;
$set = $ilDB->query("SELECT user_id, status_date, trigger_ref_id, level_id, skill_id FROM skl_user_has_level WHERE ".
" user_id = ".$ilDB->quote($a_user_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["status_date"];
}
return false;
}

+ Here is the caller graph for this function:

static ilBasicSkill::lookupLevelDescription (   $a_id)
static

Lookup level description.

Parameters
intlevel id
Returns
string level description

Definition at line 201 of file class.ilBasicSkill.php.

References lookupLevelProperty().

{
return ilBasicSkill::lookupLevelProperty($a_id, "description");
}

+ Here is the call graph for this function:

static ilBasicSkill::lookupLevelProperty (   $a_id,
  $a_prop 
)
staticprotected

Lookup level property.

Parameters
idlevel id
Returns
mixed property value

Definition at line 173 of file class.ilBasicSkill.php.

Referenced by lookupLevelDescription(), lookupLevelSkillId(), lookupLevelTitle(), and lookupLevelTrigger().

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

+ Here is the caller graph for this function:

ilBasicSkill::lookupLevelsForTriggerRefId (   $a_ref_id)

Lookup levels for trigger.

Parameters
@return

Definition at line 356 of file class.ilBasicSkill.php.

{
global $ilDB;
$set = $ilDB->query("SELECT id FROM skl_level WHERE ".
" trigger_ref_id = ".$ilDB->quote($a_ref_id, "integer")
);
$levels = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$levels[] = $rec["id"];
}
return $levels;
}
static ilBasicSkill::lookupLevelSkillId (   $a_id)
static

Lookup level skill id.

Parameters
intlevel id
Returns
string skill id

Definition at line 225 of file class.ilBasicSkill.php.

References lookupLevelProperty().

Referenced by writeUserSkillLevelStatus().

{
return ilBasicSkill::lookupLevelProperty($a_id, "skill_id");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilBasicSkill::lookupLevelTitle (   $a_id)
static

Lookup level title.

Parameters
intlevel id
Returns
string level title

Definition at line 190 of file class.ilBasicSkill.php.

References lookupLevelProperty().

Referenced by ilBasicSkillGUI\confirmLevelDeletion(), getLevelTitleForCertificate(), ilBasicSkillTemplateGUI\setLevelHead(), and ilBasicSkillGUI\setLevelHead().

{
return ilBasicSkill::lookupLevelProperty($a_id, "title");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilBasicSkill::lookupLevelTrigger (   $a_id)
static

Lookup level trigger.

Parameters
intlevel id
Returns
array trigger ref id and obj id

Definition at line 212 of file class.ilBasicSkill.php.

References $ref_id, and lookupLevelProperty().

Referenced by ilBasicSkillGUI\editLevelTrigger(), getTriggerTitleForCertificate(), and writeUserSkillLevelStatus().

{
$ref_id = ilBasicSkill::lookupLevelProperty($a_id, "trigger_ref_id");
$obj_id = ilBasicSkill::lookupLevelProperty($a_id, "trigger_obj_id");
return array("ref_id" => $ref_id, "obj_id" => $obj_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBasicSkill::read ( )

Read data from database.

Reimplemented from ilSkillTreeNode.

Definition at line 35 of file class.ilBasicSkill.php.

{
}
static ilBasicSkill::updateAllUserSkillLevels ( )
static

Look for all skill level that have a trigger and update the user skill level information, if it has changed.

Definition at line 406 of file class.ilBasicSkill.php.

References ilObject\_hasUntrashedReference(), ilLPStatusWrapper\_lookupCompletedForObject(), ACHIEVED, and writeUserSkillLevelStatus().

{
global $ilDB;
$set = $ilDB->query("SELECT id, trigger_obj_id FROM skl_level WHERE ".
" trigger_obj_id > ".$ilDB->quote(0, "integer")
);
while ($rec = $ilDB->fetchAssoc($set)) // all trigger objects
{
$skill_level_id = $rec["id"];
$tr_obj_id = $rec["trigger_obj_id"];
{
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
foreach ($completed as $user_id)
{
}
}
}
}

+ Here is the call graph for this function:

ilBasicSkill::updateLevelOrder (   $order)

Update level order.

Parameters
@return

Definition at line 292 of file class.ilBasicSkill.php.

References $id.

{
global $ilDB;
asort($order);
$cnt = 1;
foreach ($order as $id => $o)
{
$ilDB->manipulate("UPDATE skl_level SET ".
" nr = ".$ilDB->quote($cnt, "integer").
" WHERE id = ".$ilDB->quote($id, "integer")
);
$cnt++;
}
}
static ilBasicSkill::updateSkillLevelsByTriggerRef (   $a_user_id,
  $a_ref_id 
)
static

Look for all skill level that have a trigger and update the user skill level information, if it has changed.

Definition at line 435 of file class.ilBasicSkill.php.

References ilObject\_hasUntrashedReference(), ilLPStatusWrapper\_lookupCompletedForObject(), ACHIEVED, and writeUserSkillLevelStatus().

{
global $ilDB;
$set = $ilDB->query("SELECT id, trigger_obj_id FROM skl_level WHERE ".
" trigger_ref_id = ".$ilDB->quote($a_ref_id, "integer")
);
while ($rec = $ilDB->fetchAssoc($set)) // all trigger objects
{
$skill_level_id = $rec["id"];
$tr_obj_id = $rec["trigger_obj_id"];
{
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
foreach ($completed as $user_id)
{
if ($a_user_id == $user_id)
{
}
}
}
}
}

+ Here is the call graph for this function:

static ilBasicSkill::writeLevelDescription (   $a_id,
  $a_description 
)
static

Write level description.

Parameters
intlevel id
textlevel description

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

References writeLevelProperty().

{
ilBasicSkill::writeLevelProperty($a_id, "description", $a_description, "clob");
}

+ Here is the call graph for this function:

static ilBasicSkill::writeLevelProperty (   $a_id,
  $a_prop,
  $a_value,
  $a_type 
)
staticprotected

Write level property.

Parameters
@return

Definition at line 236 of file class.ilBasicSkill.php.

Referenced by writeLevelDescription(), writeLevelTitle(), and writeLevelTrigger().

{
global $ilDB;
$ilDB->update("skl_level", array(
$a_prop => array($a_type, $a_value),
), array(
"id" => array("integer", $a_id),
));
}

+ Here is the caller graph for this function:

static ilBasicSkill::writeLevelTitle (   $a_id,
  $a_title 
)
static

Write level title.

Parameters
intlevel id
textlevel title

Definition at line 253 of file class.ilBasicSkill.php.

References writeLevelProperty().

{
ilBasicSkill::writeLevelProperty($a_id, "title", $a_title, "text");
}

+ Here is the call graph for this function:

static ilBasicSkill::writeLevelTrigger (   $a_id,
  $a_trigger_ref_id 
)
static

Write trigger.

Parameters
intlevel id
textlevel description

Definition at line 275 of file class.ilBasicSkill.php.

References ilObject\_lookupObjId(), and writeLevelProperty().

Referenced by ilBasicSkillGUI\removeLevelTrigger(), and ilBasicSkillGUI\saveLevelTrigger().

{
$a_trigger_obj_id = 0;
if ($a_trigger_ref_id > 0)
{
$a_trigger_obj_id = ilObject::_lookupObjId($a_trigger_ref_id);
}
ilBasicSkill::writeLevelProperty($a_id, "trigger_ref_id", $a_trigger_ref_id, "integer");
ilBasicSkill::writeLevelProperty($a_id, "trigger_obj_id", $a_trigger_obj_id, "integer");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilBasicSkill::writeUserSkillLevelStatus (   $a_level_id,
  $a_user_id,
  $a_status = ilBasicSkill::ACHIEVED,
  $a_force = false 
)
static

Write skill level status.

Parameters
intskill level id
intuser id
intstatus

Definition at line 470 of file class.ilBasicSkill.php.

References ilSkillTreeNode\_lookupTitle(), ACHIEVED, lookupLevelSkillId(), lookupLevelTrigger(), and ilUtil\now().

Referenced by updateAllUserSkillLevels(), and updateSkillLevelsByTriggerRef().

{
global $ilDB;
$skill_id = ilBasicSkill::lookupLevelSkillId($a_level_id);
$trigger = ilBasicSkill::lookupLevelTrigger($a_level_id);
$trigger_ref_id = $trigger["ref_id"];
$trigger_obj_id = $trigger["obj_id"];
$trigger_title = ilObject::_lookupTitle($trigger["obj_id"]);
$save = false;
if ($a_force)
{
$save = true;
}
else
{
// check whether current skill user level is identical
// to the one that should be set (-> no change required)
$ilDB->setLimit(1);
$set = $ilDB->query("SELECT status, valid FROM skl_user_skill_level WHERE ".
"level_id = ".$ilDB->quote($a_level_id, "integer")." AND ".
"user_id = ".$ilDB->quote($a_user_id, "integer").
" ORDER BY status_date DESC"
);
$rec = $ilDB->fetchAssoc($set);
if (!$rec["valid"] || $rec["status"] != $a_status)
{
$save = true;
}
}
if ($save)
{
$now = ilUtil::now();
$ilDB->manipulate("INSERT INTO skl_user_skill_level ".
"(level_id, user_id, status_date, skill_id, status, valid, trigger_ref_id,".
"trigger_obj_id, trigger_title) VALUES (".
$ilDB->quote($a_level_id, "integer").",".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($now, "timestamp").",".
$ilDB->quote($skill_id, "integer").",".
$ilDB->quote($a_status, "integer").",".
$ilDB->quote(1, "integer").",".
$ilDB->quote($trigger_ref_id, "integer").",".
$ilDB->quote($trigger_obj_id, "integer").",".
$ilDB->quote($trigger_title, "text").
")");
$ilDB->manipulate("DELETE FROM skl_user_has_level WHERE "
." user_id = ".$ilDB->quote($a_user_id, "integer")
." AND level_id = ".$ilDB->quote($a_level_id, "integer")
);
if ($a_status == ilBasicSkill::ACHIEVED)
{
$ilDB->manipulate("INSERT INTO skl_user_has_level ".
"(level_id, user_id, status_date, skill_id, trigger_ref_id, trigger_obj_id, trigger_title) VALUES (".
$ilDB->quote($a_level_id, "integer").",".
$ilDB->quote($a_user_id, "integer").",".
$ilDB->quote($now, "timestamp").",".
$ilDB->quote($skill_id, "integer").",".
$ilDB->quote($trigger_ref_id, "integer").",".
$ilDB->quote($trigger_obj_id, "integer").",".
$ilDB->quote($trigger_title, "text").
")");
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilBasicSkill::$id

Definition at line 20 of file class.ilBasicSkill.php.

Referenced by updateLevelOrder().

const ilBasicSkill::ACHIEVED = 1
const ilBasicSkill::NOT_ACHIEVED = 0

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


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