ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBasicSkill Class Reference

Basic Skill. More...

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

Public Member Functions

 __construct ($a_id=0)
 Constructor public. More...
 
 read ()
 Read data from database. More...
 
 create ()
 Create skill. More...
 
 delete ()
 Delete skill. More...
 
 copy ()
 Copy basic skill. More...
 
 addLevel ($a_title, $a_description)
 Add new level. More...
 
 getMaxLevelNr ()
 Get maximum level nr. More...
 
 getLevelData ($a_id=0)
 Get level data. More...
 
 updateLevelOrder ($order)
 Update level order. More...
 
 deleteLevel ($a_id)
 Delete level. More...
 
 fixLevelNumbering ()
 Fix level numbering. More...
 
 lookupLevelsForTriggerRefId ($a_ref_id)
 Lookup levels for trigger. More...
 
 getSkillForLevelId ($a_level_id)
 Get skill for level id. More...
 
 getMaxLevelPerType ($a_tref_id, $a_type, $a_user_id=0, $a_self_eval=0)
 Get max levels per type. More...
 
 getAllLevelEntriesOfUser ($a_tref_id, $a_user_id=0, $a_self_eval=0)
 Get all level entries. More...
 
 getAllHistoricLevelEntriesOfUser ($a_tref_id, $a_user_id=0, $a_eval_by=0)
 Get all historic level entries. More...
 
 getMaxLevelPerObject ($a_tref_id, $a_object_id, $a_user_id=0, $a_self_eval=0)
 Get max levels per object. More...
 
 getLastLevelPerObject ($a_tref_id, $a_object_id, $a_user_id=0, $a_self_eval=0)
 Get last level set per object. More...
 
 getLastUpdatePerObject ($a_tref_id, $a_object_id, $a_user_id=0, $a_self_eval=0)
 Get last update per object. More...
 
 lookupLevelAchievementDate ($a_user_id, $a_level_id, $a_self_eval=0)
 Lookup level achievement date. More...
 
 getTitleForCertificate ()
 Get title for certificate. More...
 
 getLevelTitleForCertificate ($a_level_id)
 Get title for certificate. More...
 
 getTriggerTitleForCertificate ($a_level_id)
 Get trigger title for certificate. More...
 
 getShortTitleForCertificate ()
 Get short title for certificate. More...
 
- Public Member Functions inherited from ilSkillTreeNode
 ilSkillTreeNode ($a_id=0)
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setType ($a_type)
 Set type. More...
 
 getType ()
 Get type. More...
 
 setId ($a_id)
 Set Node ID. More...
 
 getId ()
 Get Node ID. More...
 
 setSelfEvaluation ($a_val)
 Set self evaluation. More...
 
 getSelfEvaluation ()
 Get self evaluation. More...
 
 setOrderNr ($a_val)
 Set order nr. More...
 
 getOrderNr ()
 Get order nr. More...
 
 read ()
 Read Data of Node. More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory More...
 
 setStatus ($a_val)
 Set status. More...
 
 getStatus ()
 Get status. More...
 
 create ()
 Create Node. More...
 
 update ()
 Update Node. More...
 
 delete ()
 Delete Node. More...
 
 clipboardCut ($a_tree_id, $a_ids)
 Cut and copy a set of skills/skill categories into the clipboard. More...
 

Static Public Member Functions

static lookupLevelTitle ($a_id)
 Lookup level title. More...
 
static lookupLevelDescription ($a_id)
 Lookup level description. More...
 
static lookupLevelTrigger ($a_id)
 Lookup level trigger. More...
 
static lookupLevelSkillId ($a_id)
 Lookup level skill id. More...
 
static writeLevelTitle ($a_id, $a_title)
 Write level title. More...
 
static writeLevelDescription ($a_id, $a_description)
 Write level description. More...
 
static writeLevelTrigger ($a_id, $a_trigger_ref_id)
 Write trigger. More...
 
static updateAllUserSkillLevels ()
 Look for all skill level that have a trigger and update the user skill level information, if it has changed. More...
 
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. More...
 
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)
 Write skill level status. More...
 
static getCompletionDateForTriggerRefId ($a_user_id, $a_ref_id=null, $a_self_eval=0)
 Get trigger completion. More...
 
static checkUserCertificateForTriggerRefId ($a_user_id, $a_ref_id, $a_self_eval=0)
 Get trigger completion. More...
 
static getTriggerOfAllCertificates ($a_user_id, $a_self_eval=0)
 Get trigger completion. More...
 
static getSkillLevelsForTrigger ($a_ref_id)
 Get assigned skill levels for trigger. More...
 
static _lookupCertificate ($a_skill_id, $a_skill_level_id)
 Checks whether a skill level has a certificate or not. More...
 
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info. More...
 
- Static Public Member Functions inherited from ilSkillTreeNode
static getAllStatus ()
 Get all status. More...
 
static getStatusInfo ($a_status)
 Get status info. More...
 
static _lookupTitle ($a_obj_id, $a_tref_id=0)
 Lookup Title. More...
 
static _lookupSelfEvaluation ($a_obj_id)
 Lookup self evaluation. More...
 
static _lookupStatus ($a_obj_id)
 Lookup Status. More...
 
static _lookupType ($a_obj_id)
 Lookup Type. More...
 
static _writeTitle ($a_obj_id, $a_title)
 Write Title. More...
 
static _writeOrderNr ($a_obj_id, $a_nr)
 Write Order Nr. More...
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 Put this object into the skill tree. More...
 
static getTree ($a_slm_obj_id)
 Get scorm module editing tree. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types. More...
 
static clipboardCopy ($a_tree_id, $a_ids)
 Copy a set of skills/skill categories into the clipboard. More...
 
static insertItemsFromClip ($a_type, $a_obj_id)
 Insert basic skills from clipboard. More...
 
static clearClipboard ()
 Remove all skill items from clipboard. More...
 
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. More...
 
static isInTree ($a_id)
 Is id in tree? More...
 
static getAllSelfEvaluationNodes ()
 Get all self evaluation nodes. More...
 
static getTopTemplates ()
 Get top skill templates and template categories. More...
 
static getSelectableSkills ()
 Get selectable skills. More...
 
static saveChildsOrder ($a_par_id, $a_childs_order, $a_templates=false)
 Save childs order. More...
 
static getIconPath ($a_obj_id, $a_type, $a_size="", $a_status=0)
 Get icon path. More...
 
static findSkills ($a_term)
 Find skills. More...
 

Data Fields

const ACHIEVED = 1
 
const NOT_ACHIEVED = 0
 
const EVAL_BY_OTHERS_ = 0
 
const EVAL_BY_SELF = 1
 
const EVAL_BY_ALL = 2
 
 $id
 
- Data Fields inherited from ilSkillTreeNode
const STATUS_PUBLISH = 0
 
const STATUS_DRAFT = 1
 
const STATUS_OUTDATED = 2
 
 $type
 
 $id
 
 $title
 

Static Protected Member Functions

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

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 16 of file class.ilBasicSkill.php.

Constructor & Destructor Documentation

◆ __construct()

ilBasicSkill::__construct (   $a_id = 0)

Constructor public.

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

References ilSkillTreeNode\setType().

32  {
33  parent::ilSkillTreeNode($a_id);
34  $this->setType("skll");
35  }
setType($a_type)
Set type.
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupCertificate()

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 1088 of file class.ilBasicSkill.php.

Referenced by checkUserCertificateForTriggerRefId(), and getTriggerOfAllCertificates().

1089  {
1090  $certificatefile = CLIENT_WEB_DIR."/certificates/skill/".
1091  ((int)$a_skill_id)."/".((int) $a_skill_level_id)."/certificate.xml";
1092  if (@file_exists($certificatefile))
1093  {
1094  return true;
1095  }
1096  else
1097  {
1098  return false;
1099  }
1100  }
+ Here is the caller graph for this function:

◆ addLevel()

ilBasicSkill::addLevel (   $a_title,
  $a_description 
)

Add new level.

Parameters
stringtitle
stringdescription

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

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

110  {
111  global $ilDB;
112 
113  $nr = $this->getMaxLevelNr();
114  $nid = $ilDB->nextId("skl_level");
115  $ilDB->insert("skl_level", array(
116  "id" => array("integer", $nid),
117  "skill_id" => array("integer", $this->getId()),
118  "nr" => array("integer", $nr+1),
119  "title" => array("text", $a_title),
120  "description" => array("clob", $a_description)
121  ));
122 
123  }
getMaxLevelNr()
Get maximum level nr.
global $ilDB
+ Here is the call graph for this function:

◆ checkUserCertificateForTriggerRefId()

static ilBasicSkill::checkUserCertificateForTriggerRefId (   $a_user_id,
  $a_ref_id,
  $a_self_eval = 0 
)
static

Get trigger completion.

Parameters

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

References $ilDB, $ref_id, and _lookupCertificate().

Referenced by ilObjSkillManagementGUI\testCert().

899  {
900  global $ilDB;
901 die("ilBasicSkill::checkUserCertificateForTriggerRefId is deprecated.");
902  if (!is_array($a_ref_id))
903  {
904  $a_ref_id = array($a_ref_id);
905  }
906  if (!is_array($a_user_id))
907  {
908  $a_user_id = array($a_user_id);
909  }
910  $set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id, level_id, skill_id FROM skl_user_has_level WHERE ".
911  $ilDB->in("user_id", $a_user_id, false, "integer")." AND ".
912  $ilDB->in("trigger_ref_id", $a_ref_id, false, "integer")
913  );
914 
915  $completion = array();
916 
917  $completion = array();
918  while ($rec = $ilDB->fetchAssoc($set))
919  {
920  if (!isset($completion[$rec["user_id"]][$rec["trigger_ref_id"]])
921  && ilBasicSkill::_lookupCertificate($rec["skill_id"], $rec["level_id"]))
922  {
923  $completion[$rec["user_id"]][$rec["trigger_ref_id"]] = true;
924  }
925  }
926 
927  foreach ($a_ref_id as $ref_id)
928  {
929  foreach ($a_user_id as $user_id)
930  {
931  if (!isset($completion[$user_id][$ref_id]))
932  {
933  $completion[$user_id][$ref_id] = false;
934  }
935  }
936  }
937  return $completion;
938 
939  }
static _lookupCertificate($a_skill_id, $a_skill_level_id)
Checks whether a skill level has a certificate or not.
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy()

ilBasicSkill::copy ( )

Copy basic skill.

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

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

76  {
77  $skill = new ilBasicSkill();
78  $skill->setTitle($this->getTitle());
79  $skill->setType($this->getType());
80  $skill->setSelfEvaluation($this->getSelfEvaluation());
81  $skill->setOrderNr($this->getOrderNr());
82  $skill->create();
83 
84  $levels = $this->getLevelData();
85  if (sizeof($levels))
86  {
87  foreach($levels as $item)
88  {
89  $skill->addLevel($item["title"], $item["description"]);
90  }
91  }
92  $skill->update();
93 
94  return $skill;
95  }
getLevelData($a_id=0)
Get level data.
getSelfEvaluation()
Get self evaluation.
getOrderNr()
Get order nr.
Basic Skill.
+ Here is the call graph for this function:

◆ create()

ilBasicSkill::create ( )

Create skill.

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

50  {
51  parent::create();
52  }

◆ delete()

ilBasicSkill::delete ( )

Delete skill.

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

References $ilDB.

58  {
59  global $ilDB;
60 
61  $ilDB->manipulate("DELETE FROM skl_level WHERE "
62  ." skill_id = ".$ilDB->quote($this->getId(), "integer")
63  );
64 
65  $ilDB->manipulate("DELETE FROM skl_user_has_level WHERE "
66  ." skill_id = ".$ilDB->quote($this->getId(), "integer")
67  );
68 
69  parent::delete();
70  }
global $ilDB

◆ deleteLevel()

ilBasicSkill::deleteLevel (   $a_id)

Delete level.

Parameters

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

References $ilDB.

323  {
324  global $ilDB;
325 
326  $ilDB->manipulate("DELETE FROM skl_level WHERE "
327  ." id = ".$ilDB->quote($a_id, "integer")
328  );
329 
330  }
global $ilDB

◆ fixLevelNumbering()

ilBasicSkill::fixLevelNumbering ( )

Fix level numbering.

Parameters

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

References $ilDB.

339  {
340  global $ilDB;
341 
342  $set = $ilDB->query("SELECT id, nr FROM skl_level WHERE ".
343  " skill_id = ".$ilDB->quote($this->getId(), "integer").
344  " ORDER BY nr ASC"
345  );
346  $cnt = 1;
347  while ($rec = $ilDB->fetchAssoc($set))
348  {
349  $ilDB->manipulate("UPDATE skl_level SET ".
350  " nr = ".$ilDB->quote($cnt, "integer").
351  " WHERE id = ".$ilDB->quote($rec["id"], "integer")
352  );
353  $cnt++;
354  }
355  }
global $ilDB

◆ getAllHistoricLevelEntriesOfUser()

ilBasicSkill::getAllHistoricLevelEntriesOfUser (   $a_tref_id,
  $a_user_id = 0,
  $a_eval_by = 0 
)

Get all historic level entries.

Parameters

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

References $ilDB, and $ilUser.

669  {
670  global $ilDB, $ilUser;
671 
672  if ($a_user_id == 0)
673  {
674  $a_user_id = $ilUser->getId();
675  }
676 
677  $by = ($a_eval_by != self::EVAL_BY_ALL)
678  ? " AND self_eval = ".$ilDB->quote($a_self_eval, "integer")
679  : "";
680 
681  $set = $ilDB->query($q = "SELECT * FROM skl_user_skill_level ".
682  " WHERE skill_id = ".$ilDB->quote($this->getId(), "integer").
683  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
684  " AND user_id = ".$ilDB->quote($a_user_id, "integer").
685  $by.
686  " ORDER BY status_date DESC"
687  );
688  $levels = array();
689  while ($rec = $ilDB->fetchAssoc($set))
690  {
691  $levels[] = $rec;
692  }
693  return $levels;
694  }
global $ilUser
Definition: imgupload.php:15
global $ilDB

◆ getAllLevelEntriesOfUser()

ilBasicSkill::getAllLevelEntriesOfUser (   $a_tref_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get all level entries.

Parameters

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

References $ilDB, and $ilUser.

638  {
639  global $ilDB, $ilUser;
640 
641  if ($a_user_id == 0)
642  {
643  $a_user_id = $ilUser->getId();
644  }
645 
646  $set = $ilDB->query($q = "SELECT * FROM skl_user_has_level ".
647  " WHERE skill_id = ".$ilDB->quote($this->getId(), "integer").
648  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
649  " AND user_id = ".$ilDB->quote($a_user_id, "integer").
650  " AND self_eval = ".$ilDB->quote($a_self_eval, "integer").
651  " ORDER BY status_date DESC"
652  );
653 
654  $levels = array();
655  while ($rec = $ilDB->fetchAssoc($set))
656  {
657  $levels[] = $rec;
658  }
659  return $levels;
660  }
global $ilUser
Definition: imgupload.php:15
global $ilDB

◆ getCompletionDateForTriggerRefId()

static ilBasicSkill::getCompletionDateForTriggerRefId (   $a_user_id,
  $a_ref_id = null,
  $a_self_eval = 0 
)
static

Get trigger completion.

Parameters

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

References $ilDB, $ref_id, and ilParticipants\_getMembershipByType().

Referenced by ilObjSkillManagementGUI\test().

803  {
804  global $ilDB;
805 die("ilBasicSkill::getCompletionDateForTriggerRefId is deprecated.");
806  if ($a_ref_id == "")
807  {
808  $a_ref_id = null;
809  }
810  else if (!is_array($a_ref_id))
811  {
812  $a_ref_id = array($a_ref_id);
813  }
814  if (!is_array($a_user_id))
815  {
816  $a_user_id = array($a_user_id);
817  }
818 
819  if ($a_ref_id != null)
820  {
821  if (!is_array($a_ref_id))
822  {
823  $a_ref_id = array($a_ref_id);
824  }
825 
826  $set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id FROM skl_user_has_level WHERE ".
827  $ilDB->in("user_id", $a_user_id, false, "integer")." AND ".
828  $ilDB->in("trigger_ref_id", $a_ref_id, false, "integer")
829  );
830 
831  $completion = array();
832  while ($rec = $ilDB->fetchAssoc($set))
833  {
834  if (!isset($completion[$rec["user_id"]][$rec["trigger_ref_id"]]))
835  {
836  $completion[$rec["user_id"]][$rec["trigger_ref_id"]] = $rec["status_date"];
837  }
838  else if ($rec["status_date"] < $completion[$rec["user_id"]][$rec["trigger_ref_id"]])
839  {
840  $completion[$rec["user_id"]][$rec["trigger_ref_id"]] = $rec["status_date"];
841  }
842  }
843 
844  foreach ($a_ref_id as $ref_id)
845  {
846  foreach ($a_user_id as $user_id)
847  {
848  if (!isset($completion[$user_id][$ref_id]))
849  {
850  $completion[$user_id][$ref_id] = false;
851  }
852  }
853  }
854  }
855  else
856  {
857  $completion = array();
858  foreach ($a_user_id as $user_id)
859  {
860  include_once 'Services/Membership/classes/class.ilParticipants.php';
861  $a_ref_id = ilParticipants::_getMembershipByType($user_id, 'crs', true);
862 
863  $set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id FROM skl_user_has_level WHERE ".
864  "user_id = ".$ilDB->quote($user_id, "integer")." AND ".
865  $ilDB->in("trigger_ref_id", $a_ref_id, false, "integer")
866  );
867 
868  while ($rec = $ilDB->fetchAssoc($set))
869  {
870  if (!isset($completion[$user_id][$rec["trigger_ref_id"]]))
871  {
872  $completion[$user_id][$rec["trigger_ref_id"]] = $rec["status_date"];
873  }
874  else if ($rec["status_date"] < $completion[$user_id][$rec["trigger_ref_id"]])
875  {
876  $completion[$user_id][$rec["trigger_ref_id"]] = $rec["status_date"];
877  }
878  }
879  foreach ($a_ref_id as $ref_id)
880  {
881  if (!isset($completion[$user_id][$ref_id]))
882  {
883  $completion[$user_id][$ref_id] = false;
884  }
885  }
886  }
887 
888  }
889  return $completion;
890  }
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastLevelPerObject()

ilBasicSkill::getLastLevelPerObject (   $a_tref_id,
  $a_object_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get last level set per object.

Parameters

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

References $ilDB, $ilUser, and ilSkillTreeNode\getId().

743  {
744  global $ilDB, $ilUser;
745 
746  if ($a_user_id == 0)
747  {
748  $a_user_id = $ilUser->getId();
749  }
750 
751  $ilDB->setLimit(1);
752  $set = $ilDB->query($q = "SELECT level_id FROM skl_user_has_level ".
753  " WHERE trigger_obj_id = ".$ilDB->quote($a_object_id, "integer").
754  " AND skill_id = ".$ilDB->quote($this->getId(), "integer").
755  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
756  " AND user_id = ".$ilDB->quote($a_user_id, "integer").
757  " AND self_eval = ".$ilDB->quote($a_self_eval, "integer").
758  " ORDER BY status_date DESC"
759  );
760 
761  $rec = $ilDB->fetchAssoc($set);
762 
763  return $rec["level_id"];
764  }
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ getLastUpdatePerObject()

ilBasicSkill::getLastUpdatePerObject (   $a_tref_id,
  $a_object_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get last update per object.

Parameters

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

References $ilDB, $ilUser, and ilSkillTreeNode\getId().

773  {
774  global $ilDB, $ilUser;
775 
776  if ($a_user_id == 0)
777  {
778  $a_user_id = $ilUser->getId();
779  }
780 
781  $ilDB->setLimit(1);
782  $set = $ilDB->query($q = "SELECT status_date FROM skl_user_has_level ".
783  " WHERE trigger_obj_id = ".$ilDB->quote($a_object_id, "integer").
784  " AND skill_id = ".$ilDB->quote($this->getId(), "integer").
785  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
786  " AND user_id = ".$ilDB->quote($a_user_id, "integer").
787  " AND self_eval = ".$ilDB->quote($a_self_eval, "integer").
788  " ORDER BY status_date DESC"
789  );
790 
791  $rec = $ilDB->fetchAssoc($set);
792 
793  return $rec["status_date"];
794  }
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ getLevelData()

ilBasicSkill::getLevelData (   $a_id = 0)

Get level data.

Returns
array level data

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

References $ilDB.

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

147  {
148  global $ilDB;
149 
150  if ($a_id > 0)
151  {
152  $and = " AND id = ".$ilDB->quote($a_id, "integer");
153  }
154 
155  $set = $ilDB->query("SELECT * FROM skl_level WHERE ".
156  " skill_id = ".$ilDB->quote($this->getId(), "integer").
157  $and.
158  " ORDER BY nr"
159  );
160  $levels = array();
161  while ($rec = $ilDB->fetchAssoc($set))
162  {
163  if ($a_id > 0)
164  {
165  return $rec;
166  }
167  $levels[] = $rec;
168  }
169  return $levels;
170  }
global $ilDB
+ Here is the caller graph for this function:

◆ getLevelTitleForCertificate()

ilBasicSkill::getLevelTitleForCertificate (   $a_level_id)

Get title for certificate.

Parameters

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

References lookupLevelTitle().

1053  {
1054 die("ilBasicSkill::getLevelTitleForCertificate is deprecated.");
1055  return ilBasicSkill::lookupLevelTitle($a_level_id);
1056  }
static lookupLevelTitle($a_id)
Lookup level title.
+ Here is the call graph for this function:

◆ getMaxLevelNr()

ilBasicSkill::getMaxLevelNr ( )

Get maximum level nr.

Returns
int maximum level nr of skill

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

References $ilDB.

Referenced by addLevel().

131  {
132  global $ilDB;
133 
134  $set = $ilDB->query("SELECT MAX(nr) mnr FROM skl_level WHERE ".
135  " skill_id = ".$ilDB->quote($this->getId(), "integer")
136  );
137  $rec = $ilDB->fetchAssoc($set);
138  return (int) $rec["mnr"];
139  }
global $ilDB
+ Here is the caller graph for this function:

◆ getMaxLevelPerObject()

ilBasicSkill::getMaxLevelPerObject (   $a_tref_id,
  $a_object_id,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get max levels per object.

Parameters

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

References $ilDB, $ilUser, ilSkillTreeNode\getId(), and getLevelData().

704  {
705  global $ilDB, $ilUser;
706 
707  if ($a_user_id == 0)
708  {
709  $a_user_id = $ilUser->getId();
710  }
711 
712  $set = $ilDB->query($q = "SELECT level_id FROM skl_user_has_level ".
713  " WHERE trigger_obj_id = ".$ilDB->quote($a_object_id, "integer").
714  " AND skill_id = ".$ilDB->quote($this->getId(), "integer").
715  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
716  " AND user_id = ".$ilDB->quote($a_user_id, "integer").
717  " AND self_eval = ".$ilDB->quote($a_self_eval, "integer")
718  );
719 
720  $has_level = array();
721  while ($rec = $ilDB->fetchAssoc($set))
722  {
723  $has_level[$rec["level_id"]] = true;
724  }
725  $max_level = 0;
726  foreach ($this->getLevelData() as $l)
727  {
728  if (isset($has_level[$l["id"]]))
729  {
730  $max_level = $l["id"];
731  }
732  }
733  return $max_level;
734  }
getLevelData($a_id=0)
Get level data.
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ getMaxLevelPerType()

ilBasicSkill::getMaxLevelPerType (   $a_tref_id,
  $a_type,
  $a_user_id = 0,
  $a_self_eval = 0 
)

Get max levels per type.

Parameters

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

References $ilDB, $ilUser, ilSkillTreeNode\getId(), and getLevelData().

599  {
600  global $ilDB, $ilUser;
601 
602  if ($a_user_id == 0)
603  {
604  $a_user_id = $ilUser->getId();
605  }
606 
607  $set = $ilDB->query($q = "SELECT level_id FROM skl_user_has_level ".
608  " WHERE trigger_obj_type = ".$ilDB->quote($a_type, "text").
609  " AND skill_id = ".$ilDB->quote($this->getId(), "integer").
610  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
611  " AND user_id = ".$ilDB->quote($a_user_id, "integer").
612  " AND self_eval = ".$ilDB->quote($a_self_eval, "integer")
613  );
614 
615  $has_level = array();
616  while ($rec = $ilDB->fetchAssoc($set))
617  {
618  $has_level[$rec["level_id"]] = true;
619  }
620  $max_level = 0;
621  foreach ($this->getLevelData() as $l)
622  {
623  if (isset($has_level[$l["id"]]))
624  {
625  $max_level = $l["id"];
626  }
627  }
628  return $max_level;
629  }
getLevelData($a_id=0)
Get level data.
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ getShortTitleForCertificate()

ilBasicSkill::getShortTitleForCertificate ( )

Get short title for certificate.

Parameters

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

1078  {
1079  return "Skill";
1080  }

◆ getSkillForLevelId()

ilBasicSkill::getSkillForLevelId (   $a_level_id)

Get skill for level id.

Parameters

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

References $ilDB, and ilSkillTreeNode\isInTree().

385  {
386  global $ilDB;
387 
388  $set = $ilDB->query("SELECT * FROM skl_level WHERE ".
389  " id = ".$ilDB->quote($a_level_id, "integer")
390  );
391  $skill = null;
392  if ($rec = $ilDB->fetchAssoc($set))
393  {
394  if (ilSkillTreeNode::isInTree($rec["skill_id"]))
395  {
396  $skill = new ilBasicSkill($rec["skill_id"]);
397  }
398  }
399  return $skill;
400  }
static isInTree($a_id)
Is id in tree?
global $ilDB
Basic Skill.
+ Here is the call graph for this function:

◆ getSkillLevelsForTrigger()

static ilBasicSkill::getSkillLevelsForTrigger (   $a_ref_id)
static

Get assigned skill levels for trigger.

Parameters

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

References $ilDB.

Referenced by ilObjSkillManagementGUI\testLevels().

1013  {
1014  global $ilDB;
1015 die("ilBasicSkill::getSkillLevelsForTrigger is deprecated.");
1016  $set = $ilDB->query($q = "SELECT id FROM skl_level".
1017  " WHERE trigger_ref_id = ".$ilDB->quote($a_ref_id, "integer"));
1018 
1019  $skill_levels = array();
1020  while ($rec = $ilDB->fetchAssoc($set))
1021  {
1022  $skill_levels[] = $rec["id"];
1023  }
1024 
1025  return $skill_levels;
1026 
1027  }
global $ilDB
+ Here is the caller graph for this function:

◆ getTitleForCertificate()

ilBasicSkill::getTitleForCertificate ( )

Get title for certificate.

Parameters

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

References ilSkillTreeNode\getTitle().

1042  {
1043  return $this->getTitle();
1044  }
+ Here is the call graph for this function:

◆ getTriggerOfAllCertificates()

static ilBasicSkill::getTriggerOfAllCertificates (   $a_user_id,
  $a_self_eval = 0 
)
static

Get trigger completion.

Parameters

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

References $ilDB, and _lookupCertificate().

Referenced by ilObjSkillManagementGUI\testAllCert().

970  {
971  global $ilDB, $tree;
972 die("ilBasicSkill::getTriggerOfAllCertificates is deprecated.");
973  if (!is_array($a_user_id))
974  {
975  $a_user_id = array($a_user_id);
976  }
977 
978  $set = $ilDB->query($q = "SELECT user_id, status_date, trigger_ref_id, level_id, skill_id FROM skl_user_has_level WHERE ".
979  $ilDB->in("user_id", $a_user_id, false, "integer")
980  );
981 
982  $completion = array();
983 
984  while ($rec = $ilDB->fetchAssoc($set))
985  {
986  if ((!is_array($completion[$rec["user_id"]]) || !in_array($rec["trigger_ref_id"], $completion[$rec["user_id"]]))
987  && ilBasicSkill::_lookupCertificate($rec["skill_id"], $rec["level_id"]))
988  {
989  if ($tree->isInTree($rec["trigger_ref_id"]))
990  {
991  $completion[$rec["user_id"]][] = $rec["trigger_ref_id"];
992  }
993  }
994  }
995 
996  foreach ($a_user_id as $user_id)
997  {
998  if (!is_array($completion[$user_id]))
999  {
1000  $completion[$user_id] = array();
1001  }
1002  }
1003  return $completion;
1004  }
static _lookupCertificate($a_skill_id, $a_skill_level_id)
Checks whether a skill level has a certificate or not.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTriggerTitleForCertificate()

ilBasicSkill::getTriggerTitleForCertificate (   $a_level_id)

Get trigger title for certificate.

Parameters

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

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

1065  {
1066 die("ilBasicSkill::getTriggerTitleForCertificate is deprecated.");
1067  $tr = ilBasicSkill::lookupLevelTrigger($a_level_id);
1068  return ilObject::_lookupTitle($tr["obj_id"]);
1069  }
static lookupLevelTrigger($a_id)
Lookup level trigger.
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:

◆ getUsageInfo()

static ilBasicSkill::getUsageInfo (   $a_cskill_ids,
$a_usages 
)
static

Get usage info.

Parameters

Implements ilSkillUsageInfo.

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

References $ilDB, ilSkillUsage\getUsageInfoGeneric(), and ilSkillUsage\USER_ASSIGNED.

1109  {
1110  global $ilDB;
1111 
1112  include_once("./Services/Skill/classes/class.ilSkillUsage.php");
1114  "skl_user_skill_level", "user_id");
1115  }
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.
global $ilDB
+ Here is the call graph for this function:

◆ lookupLevelAchievementDate()

ilBasicSkill::lookupLevelAchievementDate (   $a_user_id,
  $a_level_id,
  $a_self_eval = 0 
)

Lookup level achievement date.

Parameters

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

References $ilDB.

Referenced by ilSkillCertificateAdapter\getCertificateVariablesForPresentation().

948  {
949  global $ilDB;
950 die("ilBasicSkill::lookupLevelAchievementDate is deprecated.");
951  $set = $ilDB->query("SELECT user_id, status_date, trigger_ref_id, level_id, skill_id FROM skl_user_has_level WHERE ".
952  " user_id = ".$ilDB->quote($a_user_id, "integer").
953  " AND user_id = ".$ilDB->quote($a_user_id, "integer")
954  );
955  if ($rec = $ilDB->fetchAssoc($set))
956  {
957  return $rec["status_date"];
958  }
959 
960  return false;
961  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupLevelDescription()

static ilBasicSkill::lookupLevelDescription (   $a_id)
static

Lookup level description.

Parameters
intlevel id
Returns
string level description

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

References lookupLevelProperty().

207  {
208  return ilBasicSkill::lookupLevelProperty($a_id, "description");
209  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
+ Here is the call graph for this function:

◆ lookupLevelProperty()

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

Lookup level property.

Parameters
idlevel id
Returns
mixed property value

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

References $ilDB.

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

179  {
180  global $ilDB;
181 
182  $set = $ilDB->query("SELECT $a_prop FROM skl_level WHERE ".
183  " id = ".$ilDB->quote($a_id, "integer")
184  );
185  $rec = $ilDB->fetchAssoc($set);
186  return $rec[$a_prop];
187  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupLevelsForTriggerRefId()

ilBasicSkill::lookupLevelsForTriggerRefId (   $a_ref_id)

Lookup levels for trigger.

Parameters

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

References $ilDB.

364  {
365  global $ilDB;
366 die("ilBasicSkill::lookupLevelsForTriggerRefId is deprecated.");
367  $set = $ilDB->query("SELECT id FROM skl_level WHERE ".
368  " trigger_ref_id = ".$ilDB->quote($a_ref_id, "integer")
369  );
370  $levels = array();
371  while ($rec = $ilDB->fetchAssoc($set))
372  {
373  $levels[] = $rec["id"];
374  }
375  return $levels;
376  }
global $ilDB

◆ lookupLevelSkillId()

static ilBasicSkill::lookupLevelSkillId (   $a_id)
static

Lookup level skill id.

Parameters
intlevel id
Returns
string skill id

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

References lookupLevelProperty().

Referenced by writeUserSkillLevelStatus().

232  {
233  return ilBasicSkill::lookupLevelProperty($a_id, "skill_id");
234  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupLevelTitle()

static ilBasicSkill::lookupLevelTitle (   $a_id)
static

Lookup level title.

Parameters
intlevel id
Returns
string level title

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

References lookupLevelProperty().

Referenced by ilSkillProfileGUI\confirmLevelAssignmentRemoval(), ilBasicSkillGUI\confirmLevelDeletion(), ilSkillProfileLevelsTableGUI\fillRow(), getLevelTitleForCertificate(), ilPersonalSkillsGUI\renderSuggestedResources(), ilBasicSkillTemplateGUI\setLevelHead(), and ilBasicSkillGUI\setLevelHead().

196  {
197  return ilBasicSkill::lookupLevelProperty($a_id, "title");
198  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupLevelTrigger()

static ilBasicSkill::lookupLevelTrigger (   $a_id)
static

Lookup level trigger.

Parameters
intlevel id
Returns
array trigger ref id and obj id

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

References $ref_id, and lookupLevelProperty().

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

218  {
219 die("ilBasicSkill::lookupLevelTrigger is deprecated.");
220  $ref_id = ilBasicSkill::lookupLevelProperty($a_id, "trigger_ref_id");
221  $obj_id = ilBasicSkill::lookupLevelProperty($a_id, "trigger_obj_id");
222  return array("ref_id" => $ref_id, "obj_id" => $obj_id);
223  }
static lookupLevelProperty($a_id, $a_prop)
Lookup level property.
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilBasicSkill::read ( )

Read data from database.

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

41  {
42  parent::read();
43  }

◆ updateAllUserSkillLevels()

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 413 of file class.ilBasicSkill.php.

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

414  {
415  global $ilDB;
416 die("ilBasicSkill::updateAllUserSkillLevels is deprecated.");
417  $set = $ilDB->query("SELECT id, trigger_obj_id FROM skl_level WHERE ".
418  " trigger_obj_id > ".$ilDB->quote(0, "integer")
419  );
420  while ($rec = $ilDB->fetchAssoc($set)) // all trigger objects
421  {
422  $skill_level_id = $rec["id"];
423  $tr_obj_id = $rec["trigger_obj_id"];
424 
425  if (ilObject::_hasUntrashedReference($tr_obj_id))
426  {
427  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
428  $completed = ilLPStatusWrapper::_lookupCompletedForObject($tr_obj_id);
429  foreach ($completed as $user_id)
430  {
432  $user_id, ilBasicSkill::ACHIEVED);
433  }
434  }
435  }
436  }
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)
Write skill level status.
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
global $ilDB
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
+ Here is the call graph for this function:

◆ updateLevelOrder()

ilBasicSkill::updateLevelOrder (   $order)

Update level order.

Parameters

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

References $ilDB.

300  {
301  global $ilDB;
302 
303  asort($order);
304 
305  $cnt = 1;
306  foreach ($order as $id => $o)
307  {
308  $ilDB->manipulate("UPDATE skl_level SET ".
309  " nr = ".$ilDB->quote($cnt, "integer").
310  " WHERE id = ".$ilDB->quote($id, "integer")
311  );
312  $cnt++;
313  }
314  }
global $ilDB

◆ updateSkillLevelsByTriggerRef()

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 442 of file class.ilBasicSkill.php.

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

443  {
444  global $ilDB;
445 die("ilBasicSkill::updateSkillLevelsByTriggerRef is deprecated.");
446  $set = $ilDB->query("SELECT id, trigger_obj_id FROM skl_level WHERE ".
447  " trigger_ref_id = ".$ilDB->quote($a_ref_id, "integer")
448  );
449  while ($rec = $ilDB->fetchAssoc($set)) // all trigger objects
450  {
451  $skill_level_id = $rec["id"];
452  $tr_obj_id = $rec["trigger_obj_id"];
453 
454  if (ilObject::_hasUntrashedReference($tr_obj_id))
455  {
456  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
457  $completed = ilLPStatusWrapper::_lookupCompletedForObject($tr_obj_id);
458  foreach ($completed as $user_id)
459  {
460  if ($a_user_id == $user_id)
461  {
463  $user_id, ilBasicSkill::ACHIEVED);
464  }
465  }
466  }
467  }
468  }
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)
Write skill level status.
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
global $ilDB
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
+ Here is the call graph for this function:

◆ writeLevelDescription()

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

Write level description.

Parameters
intlevel id
textlevel description

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

References writeLevelProperty().

271  {
272  ilBasicSkill::writeLevelProperty($a_id, "description", $a_description, "clob");
273  }
static writeLevelProperty($a_id, $a_prop, $a_value, $a_type)
Write level property.
+ Here is the call graph for this function:

◆ writeLevelProperty()

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

Write level property.

Parameters

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

References $ilDB.

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

243  {
244  global $ilDB;
245 
246  $ilDB->update("skl_level", array(
247  $a_prop => array($a_type, $a_value),
248  ), array(
249  "id" => array("integer", $a_id),
250  ));
251  }
global $ilDB
+ Here is the caller graph for this function:

◆ writeLevelTitle()

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

Write level title.

Parameters
intlevel id
textlevel title

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

References writeLevelProperty().

260  {
261  ilBasicSkill::writeLevelProperty($a_id, "title", $a_title, "text");
262  }
static writeLevelProperty($a_id, $a_prop, $a_value, $a_type)
Write level property.
+ Here is the call graph for this function:

◆ writeLevelTrigger()

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

Write trigger.

Parameters
intlevel id
textlevel description

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

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

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

282  {
283 die("ilBasicSkill::writeLevelTrigger is deprecated.");
284  $a_trigger_obj_id = 0;
285  if ($a_trigger_ref_id > 0)
286  {
287  $a_trigger_obj_id = ilObject::_lookupObjId($a_trigger_ref_id);
288  }
289  ilBasicSkill::writeLevelProperty($a_id, "trigger_ref_id", $a_trigger_ref_id, "integer");
290  ilBasicSkill::writeLevelProperty($a_id, "trigger_obj_id", $a_trigger_obj_id, "integer");
291  }
static writeLevelProperty($a_id, $a_prop, $a_value, $a_type)
Write level property.
static _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeUserSkillLevelStatus()

static ilBasicSkill::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 
)
static

Write skill level status.

Parameters
intskill level id
intuser id
intstatus

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

References $ilDB, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ACHIEVED, lookupLevelSkillId(), and ilUtil\now().

Referenced by ilTestSkillEvaluation\invokeSkillLevelTrigger(), ilPersonalSkill\saveSelfEvaluation(), updateAllUserSkillLevels(), updateSkillLevelsByTriggerRef(), ilSurveySkill\writeAppraiseeSkills(), and ilSurveySkillDeterminationGUI\writeSkills().

480  {
481  global $ilDB;
482 
483  $skill_id = ilBasicSkill::lookupLevelSkillId($a_level_id);
484  $trigger_ref_id = $a_trigger_ref_id;
485  $trigger_obj_id = ilObject::_lookupObjId($trigger_ref_id);
486  $trigger_title = ilObject::_lookupTitle($trigger_obj_id);
487  $trigger_type = ilObject::_lookupType($trigger_obj_id);
488 
489  $update = false;
490 
491  // check whether current skill user level is identical
492  // to the one that should be set (-> no change required)
493 /* $ilDB->setLimit(1);
494  $set = $ilDB->query("SELECT status, valid FROM skl_user_skill_level WHERE ".
495  "level_id = ".$ilDB->quote($a_level_id, "integer")." AND ".
496  "user_id = ".$ilDB->quote($a_user_id, "integer")." AND ".
497  "tref_id = ".$ilDB->quote((int) $a_tref_id, "integer")." AND ".
498  "trigger_obj_id = ".$ilDB->quote($trigger_obj_id, "integer")." AND ".
499  "self_eval = ".$ilDB->quote($a_self_eval, "integer").
500  " ORDER BY status_date DESC"
501  );
502  $rec = $ilDB->fetchAssoc($set);
503  if (!$rec["valid"] || $rec["status"] != $a_status)
504  {
505  $save = true;
506  }*/
507 
508  if ($a_self_eval)
509  {
510  $ilDB->setLimit(1);
511  $set = $ilDB->query("SELECT * FROM skl_user_skill_level WHERE ".
512  "skill_id = ".$ilDB->quote($skill_id, "integer")." AND ".
513  "user_id = ".$ilDB->quote($a_user_id, "integer")." AND ".
514  "tref_id = ".$ilDB->quote((int) $a_tref_id, "integer")." AND ".
515  "trigger_obj_id = ".$ilDB->quote($trigger_obj_id, "integer")." AND ".
516  "self_eval = ".$ilDB->quote($a_self_eval, "integer").
517  " ORDER BY status_date DESC"
518  );
519  $rec = $ilDB->fetchAssoc($set);
520  $status_day = substr($rec["status_date"], 0, 10);
521  $today = substr(ilUtil::now(), 0, 10);
522  if ($rec["valid"] && $rec["status"] == $a_status && $status_day == $today)
523  {
524  $update = true;
525  }
526  }
527 
528  if ($update)
529  {
530  $now = ilUtil::now();
531  $ilDB->manipulate("UPDATE skl_user_skill_level SET ".
532  " level_id = ".$ilDB->quote($a_level_id, "integer").",".
533  " status_date = ".$ilDB->quote($now, "timestamp").
534  " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
535  " AND status_date = ".$ilDB->quote($rec["status_date"], "timestamp").
536  " AND skill_id = ".$ilDB->quote($rec["skill_id"], "integer").
537  " AND status = ".$ilDB->quote($a_status, "integer").
538  " AND trigger_obj_id = ".$ilDB->quote($trigger_obj_id, "integer").
539  " AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer").
540  " AND self_eval = ".$ilDB->quote($a_self_eval, "integer")
541  );
542  }
543  else
544  {
545  $now = ilUtil::now();
546  $ilDB->manipulate("INSERT INTO skl_user_skill_level ".
547  "(level_id, user_id, tref_id, status_date, skill_id, status, valid, trigger_ref_id,".
548  "trigger_obj_id, trigger_obj_type, trigger_title, self_eval) VALUES (".
549  $ilDB->quote($a_level_id, "integer").",".
550  $ilDB->quote($a_user_id, "integer").",".
551  $ilDB->quote((int) $a_tref_id, "integer").",".
552  $ilDB->quote($now, "timestamp").",".
553  $ilDB->quote($skill_id, "integer").",".
554  $ilDB->quote($a_status, "integer").",".
555  $ilDB->quote(1, "integer").",".
556  $ilDB->quote($trigger_ref_id, "integer").",".
557  $ilDB->quote($trigger_obj_id, "integer").",".
558  $ilDB->quote($trigger_type, "text").",".
559  $ilDB->quote($trigger_title, "text").",".
560  $ilDB->quote($a_self_eval, "integer").
561  ")");
562  }
563 
564  // fix (removed level_id and added skill id, since table should hold only
565  // one entry per skill)
566  $ilDB->manipulate("DELETE FROM skl_user_has_level WHERE "
567  ." user_id = ".$ilDB->quote($a_user_id, "integer")
568  ." AND skill_id = ".$ilDB->quote($skill_id, "integer")
569  ." AND tref_id = ".$ilDB->quote((int) $a_tref_id, "integer")
570  ." AND trigger_obj_id = ".$ilDB->quote($trigger_obj_id, "integer")
571  ." AND self_eval = ".$ilDB->quote($a_self_eval, "integer")
572  );
573 
574  if ($a_status == ilBasicSkill::ACHIEVED)
575  {
576  $ilDB->manipulate("INSERT INTO skl_user_has_level ".
577  "(level_id, user_id, tref_id, status_date, skill_id, trigger_ref_id, trigger_obj_id, trigger_obj_type, trigger_title, self_eval) VALUES (".
578  $ilDB->quote($a_level_id, "integer").",".
579  $ilDB->quote($a_user_id, "integer").",".
580  $ilDB->quote($a_tref_id, "integer").",".
581  $ilDB->quote($now, "timestamp").",".
582  $ilDB->quote($skill_id, "integer").",".
583  $ilDB->quote($trigger_ref_id, "integer").",".
584  $ilDB->quote($trigger_obj_id, "integer").",".
585  $ilDB->quote($trigger_type, "text").",".
586  $ilDB->quote($trigger_title, "text").",".
587  $ilDB->quote($a_self_eval, "integer").
588  ")");
589  }
590  }
static _lookupTitle($a_id)
lookup object title
static now()
Return current timestamp in Y-m-d H:i:s format.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
static lookupLevelSkillId($a_id)
Lookup level skill id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $id

ilBasicSkill::$id

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

◆ ACHIEVED

◆ EVAL_BY_ALL

const ilBasicSkill::EVAL_BY_ALL = 2

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

Referenced by ilPersonalSkillsGUI\getSkillHTML().

◆ EVAL_BY_OTHERS_

const ilBasicSkill::EVAL_BY_OTHERS_ = 0

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

◆ EVAL_BY_SELF

const ilBasicSkill::EVAL_BY_SELF = 1

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

◆ NOT_ACHIEVED

const ilBasicSkill::NOT_ACHIEVED = 0

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


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