ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilContainerMemberSkills Class Reference

Skills of a container. More...

+ Collaboration diagram for ilContainerMemberSkills:

Public Member Functions

 __construct ($a_obj_id, $a_user_id)
 Constrictor. More...
 
 setObjId ($a_val)
 Set object id. More...
 
 getObjId ()
 Get object id. More...
 
 setUserId ($a_val)
 Set user id. More...
 
 getUserId ()
 Get user id. More...
 
 read ()
 Read. More...
 
 getSkillLevels ()
 Get Skill levels. More...
 
 getOrderedSkillLevels ()
 Get ordered skill levels. More...
 
 getPublished ()
 Get published. More...
 
 saveLevelForSkills ($a_level_data)
 Save levels for skills. More...
 
 delete ()
 Delete all level data for current user. More...
 
 publish ($a_ref_id)
 Publish. More...
 
 removeAllSkillLevels ()
 Remove all skill levels. More...
 

Protected Attributes

 $db
 
 $skills = array()
 
 $obj_id
 
 $user_id
 
 $skill_levels = array()
 
 $published = false
 

Detailed Description

Skills of a container.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 10 of file class.ilContainerMemberSkills.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerMemberSkills::__construct (   $a_obj_id,
  $a_user_id 
)

Constrictor.

Parameters
int$a_obj_id

Definition at line 48 of file class.ilContainerMemberSkills.php.

References $DIC, read(), setObjId(), and setUserId().

49  {
50  global $DIC;
51 
52  $this->db = $DIC->database();
53 
54  $this->setObjId($a_obj_id);
55  $this->setUserId($a_user_id);
56  if ($a_obj_id > 0 && $a_user_id > 0) {
57  $this->read();
58  }
59  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilContainerMemberSkills::delete ( )

Delete all level data for current user.

Parameters

Definition at line 189 of file class.ilContainerMemberSkills.php.

References $db.

190  {
191  $db = $this->db;
192 
193  $db->manipulate("DELETE FROM cont_member_skills WHERE " .
194  " obj_id = " . $db->quote($this->getObjId(), "integer") .
195  " AND user_id = " . $db->quote($this->getUserId(), "integer"));
196  }

◆ getObjId()

ilContainerMemberSkills::getObjId ( )

Get object id.

Returns
int

Definition at line 76 of file class.ilContainerMemberSkills.php.

References $obj_id.

Referenced by publish(), and removeAllSkillLevels().

+ Here is the caller graph for this function:

◆ getOrderedSkillLevels()

ilContainerMemberSkills::getOrderedSkillLevels ( )

Get ordered skill levels.

Returns
array[] each item comes with keys "level_id", "skill_id", "tref_id"

Definition at line 135 of file class.ilContainerMemberSkills.php.

References $s, $skill_levels, array, and getSkillLevels().

136  {
137  $skill_levels = array_map(function ($a, $k) {
138  $s = explode(":", $k);
139  return array("level_id" => $a, "skill_id" => $s[0], "tref_id" => $s[1]);
140  }, $this->getSkillLevels(), array_keys($this->getSkillLevels()));
141 
142  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
143  $vtree = new ilVirtualSkillTree();
144  return $vtree->getOrderedNodeset($skill_levels, "skill_id", "tref_id");
145  }
$s
Definition: pwgen.php:45
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getPublished()

ilContainerMemberSkills::getPublished ( )

Get published.

Returns
bool

Definition at line 153 of file class.ilContainerMemberSkills.php.

References $published.

◆ getSkillLevels()

ilContainerMemberSkills::getSkillLevels ( )

Get Skill levels.

Returns
array (key is skill_id:tref_id, value is level id)

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

References $skill_levels.

Referenced by getOrderedSkillLevels(), and ilContSkillAdminGUI\initCompetenceAssignmentForm().

+ Here is the caller graph for this function:

◆ getUserId()

ilContainerMemberSkills::getUserId ( )

Get user id.

Returns
int

Definition at line 96 of file class.ilContainerMemberSkills.php.

References $user_id.

Referenced by publish(), and removeAllSkillLevels().

+ Here is the caller graph for this function:

◆ publish()

ilContainerMemberSkills::publish (   $a_ref_id)

Publish.

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

References $changed, $db, $l, ilBasicSkill\ACHIEVED, getObjId(), getUserId(), ilBasicSkill\removeAllUserSkillLevelStatusOfObject(), and ilBasicSkill\writeUserSkillLevelStatus().

202  {
203  $db = $this->db;
204 
206  $this->getUserId(),
207  $this->getObjId(),
208  false,
209  $this->getObjId()
210  );
211 
212  foreach ($this->skill_levels as $sk => $l) {
213  $changed = true;
214  $sk = explode(":", $sk);
216  $l,
217  $this->user_id,
218  $a_ref_id,
219  $sk[1],
221  false,
222  false,
223  $this->obj_id
224  );
225  }
226 
227  $db->manipulate("UPDATE cont_member_skills SET " .
228  " published = " . $db->quote(1, "integer") .
229  " WHERE obj_id = " . $db->quote($this->getObjId(), "integer") .
230  " AND user_id = " . $db->quote($this->getUserId(), "integer"));
231 
232  return $changed;
233  }
static removeAllUserSkillLevelStatusOfObject($a_user_id, $a_trigger_obj_id, $a_self_eval=false, $a_unique_identifier="")
Remove a user skill completely.
global $l
Definition: afr.php:30
static writeUserSkillLevelStatus( $a_level_id, $a_user_id, $a_trigger_ref_id, $a_tref_id=0, $a_status=ilBasicSkill::ACHIEVED, $a_force=false, $a_self_eval=false, $a_unique_identifier="")
Write skill level status.
+ Here is the call graph for this function:

◆ read()

ilContainerMemberSkills::read ( )

Read.

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

References $db, and array.

Referenced by __construct().

105  {
106  $db = $this->db;
107 
108  $set = $db->query(
109  "SELECT * FROM cont_member_skills " .
110  " WHERE obj_id = " . $db->quote($this->getObjId(), "integer") .
111  " AND user_id = " . $db->quote($this->getUserId(), "integer")
112  );
113  $this->skill_levels = array();
114  while ($rec = $this->db->fetchAssoc($set)) {
115  $this->skill_levels[$rec["skill_id"] . ":" . $rec["tref_id"]] = $rec["level_id"];
116  $this->published = $rec["published"]; // this is a little weak, but the value should be the same for all save skills
117  }
118  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ removeAllSkillLevels()

ilContainerMemberSkills::removeAllSkillLevels ( )

Remove all skill levels.

Definition at line 239 of file class.ilContainerMemberSkills.php.

References getObjId(), getUserId(), and ilBasicSkill\removeAllUserSkillLevelStatusOfObject().

Referenced by ilContSkillAdminGUI\deassignCompetences().

240  {
242  $this->getUserId(),
243  $this->getObjId(),
244  false,
245  $this->getObjId()
246  );
247 
248  $this->delete();
249  }
static removeAllUserSkillLevelStatusOfObject($a_user_id, $a_trigger_obj_id, $a_self_eval=false, $a_unique_identifier="")
Remove a user skill completely.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveLevelForSkills()

ilContainerMemberSkills::saveLevelForSkills (   $a_level_data)

Save levels for skills.

Parameters
array$a_level_data(key is skill_id:tref_id, value is level id)

Definition at line 163 of file class.ilContainerMemberSkills.php.

References $db.

Referenced by ilContSkillAdminGUI\saveCompetenceAssignment().

164  {
165  $db = $this->db;
166 
167  $this->delete();
168  foreach ($a_level_data as $k => $v) {
169  $sk = explode(":", $k);
170  $db->manipulate("INSERT INTO cont_member_skills " .
171  "(obj_id, user_id, skill_id, tref_id, level_id, published) VALUES (" .
172  $db->quote($this->getObjId(), "integer") . "," .
173  $db->quote($this->getUserId(), "integer") . "," .
174  $db->quote($sk[0], "integer") . "," .
175  $db->quote($sk[1], "integer") . "," .
176  $db->quote($v, "integer") . "," .
177  $db->quote(0, "integer") .
178  ")");
179  }
180 
181  $this->skill_levels = $a_level_data;
182  }
+ Here is the caller graph for this function:

◆ setObjId()

ilContainerMemberSkills::setObjId (   $a_val)

Set object id.

Parameters
int$a_valobject id

Definition at line 66 of file class.ilContainerMemberSkills.php.

Referenced by __construct().

67  {
68  $this->obj_id = $a_val;
69  }
+ Here is the caller graph for this function:

◆ setUserId()

ilContainerMemberSkills::setUserId (   $a_val)

Set user id.

Parameters
int$a_valuser id

Definition at line 86 of file class.ilContainerMemberSkills.php.

Referenced by __construct().

87  {
88  $this->user_id = $a_val;
89  }
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilContainerMemberSkills::$db
protected

Definition at line 16 of file class.ilContainerMemberSkills.php.

Referenced by delete(), publish(), read(), and saveLevelForSkills().

◆ $obj_id

ilContainerMemberSkills::$obj_id
protected

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

Referenced by getObjId().

◆ $published

ilContainerMemberSkills::$published = false
protected

Definition at line 41 of file class.ilContainerMemberSkills.php.

Referenced by getPublished().

◆ $skill_levels

ilContainerMemberSkills::$skill_levels = array()
protected

Definition at line 36 of file class.ilContainerMemberSkills.php.

Referenced by getOrderedSkillLevels(), and getSkillLevels().

◆ $skills

ilContainerMemberSkills::$skills = array()
protected

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

◆ $user_id

ilContainerMemberSkills::$user_id
protected

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

Referenced by getUserId().


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