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

Skill profile. More...

+ Inheritance diagram for ilSkillProfile:
+ Collaboration diagram for ilSkillProfile:

Public Member Functions

 __construct ($a_id=0)
 Constructor. More...
 
 setId ($a_val)
 Set id. More...
 
 getId ()
 Get id. More...
 
 setTitle ($a_val)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 addSkillLevel ($a_base_skill_id, $a_tref_id, $a_level_id)
 Add skill level. More...
 
 removeSkillLevel ($a_base_skill_id, $a_tref_id, $a_level_id)
 Remove skill level. More...
 
 getSkillLevels ()
 Get skill levels. More...
 
 read ()
 Read skill profile from db. More...
 
 create ()
 Create skill profile. More...
 
 update ()
 Update skill profile. More...
 
 delete ()
 Delete skill profile. More...
 
 getAssignedUsers ()
 Get assigned users. More...
 
 addUserToProfile ($a_user_id)
 Add user to profile. More...
 
 removeUserFromProfile ($a_user_id)
 Remove user from profile. More...
 

Static Public Member Functions

static getProfiles ()
 Get profiles. More...
 
static lookupTitle ($a_id)
 Lookup title. More...
 
static removeUserFromAllProfiles ($a_user_id)
 Remove user from all profiles. More...
 
static getProfilesOfUser ($a_user_id)
 Get profiles of a user. More...
 
static countUsers ($a_profile_id)
 Get assigned users. More...
 
static getUsageInfo ($a_cskill_ids, &$a_usages)
 Get usage info. More...
 

Static Protected Member Functions

static lookup ($a_id, $a_field)
 Lookup. More...
 

Protected Attributes

 $db
 
 $id
 
 $title
 
 $description
 
 $skill_level = array()
 

Detailed Description

Skill profile.

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

Definition at line 14 of file class.ilSkillProfile.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillProfile::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_idprofile id

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

References $DIC, read(), and setId().

32  {
33  global $DIC;
34 
35  $this->db = $DIC->database();
36  if ($a_id > 0) {
37  $this->setId($a_id);
38  $this->read();
39  }
40  }
global $DIC
Definition: saml.php:7
setId($a_val)
Set id.
read()
Read skill profile from db.
+ Here is the call graph for this function:

Member Function Documentation

◆ addSkillLevel()

ilSkillProfile::addSkillLevel (   $a_base_skill_id,
  $a_tref_id,
  $a_level_id 
)

Add skill level.

Parameters

Definition at line 108 of file class.ilSkillProfile.php.

References array.

Referenced by read().

109  {
110  //echo "-".$a_base_skill_id."-";
111  $this->skill_level[] = array(
112  "base_skill_id" => $a_base_skill_id,
113  "tref_id" => $a_tref_id,
114  "level_id" => $a_level_id
115  );
116  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ addUserToProfile()

ilSkillProfile::addUserToProfile (   $a_user_id)

Add user to profile.

Parameters
int$a_user_iduser id

Definition at line 354 of file class.ilSkillProfile.php.

References $db, $ilDB, array, and getId().

355  {
356  $ilDB = $this->db;
357 
358  $ilDB->replace(
359  "skl_profile_user",
360  array("profile_id" => array("integer", $this->getId()),
361  "user_id" => array("integer", (int) $a_user_id),
362  ),
363  array()
364  );
365  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ countUsers()

static ilSkillProfile::countUsers (   $a_profile_id)
static

Get assigned users.

Definition at line 427 of file class.ilSkillProfile.php.

References $DIC, and $ilDB.

Referenced by ilSkillProfileTableGUI\fillRow().

428  {
429  global $DIC;
430 
431  $ilDB = $DIC->database();
432 
433  $set = $ilDB->query(
434  "SELECT count(*) ucnt FROM skl_profile_user " .
435  " WHERE profile_id = " . $ilDB->quote($a_profile_id, "integer")
436  );
437  $rec = $ilDB->fetchAssoc($set);
438  return (int) $rec["ucnt"];
439  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ create()

ilSkillProfile::create ( )

Create skill profile.

Definition at line 180 of file class.ilSkillProfile.php.

References $db, $ilDB, array, getId(), and setId().

181  {
182  $ilDB = $this->db;
183 
184  // profile
185  $this->setId($ilDB->nextId("skl_profile"));
186  $ilDB->manipulate("INSERT INTO skl_profile " .
187  "(id, title, description) VALUES (" .
188  $ilDB->quote($this->getId(), "integer") . "," .
189  $ilDB->quote($this->getTitle(), "text") . "," .
190  $ilDB->quote($this->getDescription(), "text") .
191  ")");
192 
193  // profile levels
194  foreach ($this->skill_level as $level) {
195  $ilDB->replace(
196  "skl_profile_level",
197  array("profile_id" => array("integer", $this->getId()),
198  "tref_id" => array("integer", (int) $level["tref_id"]),
199  "base_skill_id" => array("integer", (int) $level["base_skill_id"])
200  ),
201  array("level_id" => array("integer", (int) $level["level_id"]))
202  );
203  }
204  }
setId($a_val)
Set id.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilSkillProfile::delete ( )

Delete skill profile.

Definition at line 249 of file class.ilSkillProfile.php.

References $db, and $ilDB.

250  {
251  $ilDB = $this->db;
252 
253  // profile levels
254  $ilDB->manipulate(
255  "DELETE FROM skl_profile_level WHERE " .
256  " profile_id = " . $ilDB->quote($this->getId(), "integer")
257  );
258 
259  // profile
260  $ilDB->manipulate(
261  "DELETE FROM skl_profile WHERE " .
262  " id = " . $ilDB->quote($this->getId(), "integer")
263  );
264  }
global $ilDB

◆ getAssignedUsers()

ilSkillProfile::getAssignedUsers ( )

Get assigned users.

Definition at line 328 of file class.ilSkillProfile.php.

References $db, $ilDB, $name, $users, ilObjUser\_lookupName(), and array.

329  {
330  $ilDB = $this->db;
331 
332  $set = $ilDB->query(
333  "SELECT * FROM skl_profile_user " .
334  " WHERE profile_id = " . $ilDB->quote($this->getId(), "integer")
335  );
336  $users = array();
337  while ($rec = $ilDB->fetchAssoc($set)) {
338  $name = ilObjUser::_lookupName($rec["user_id"]);
339  $users[$rec["user_id"]] = array(
340  "lastname" => $name["lastname"],
341  "firstname" => $name["firstname"],
342  "login" => $name["login"],
343  "id" => $name["user_id"]
344  );
345  }
346  return $users;
347  }
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
$users
Definition: authpage.php:44
global $ilDB
+ Here is the call graph for this function:

◆ getDescription()

ilSkillProfile::getDescription ( )

Get description.

Returns
string description

Definition at line 97 of file class.ilSkillProfile.php.

References $description.

98  {
99  return $this->description;
100  }

◆ getId()

ilSkillProfile::getId ( )

Get id.

Returns
int id

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

References $id.

Referenced by addUserToProfile(), create(), and update().

58  {
59  return $this->id;
60  }
+ Here is the caller graph for this function:

◆ getProfiles()

static ilSkillProfile::getProfiles ( )
static

Get profiles.

Parameters

Definition at line 272 of file class.ilSkillProfile.php.

References $DIC, $ilDB, and array.

Referenced by ilSkillProfileTableGUI\getProfiles().

273  {
274  global $DIC;
275 
276  $ilDB = $DIC->database();
277 
278  $set = $ilDB->query(
279  "SELECT * FROM skl_profile " .
280  " ORDER BY title "
281  );
282  $profiles = array();
283  while ($rec = $ilDB->fetchAssoc($set)) {
284  $profiles[$rec["id"]] = $rec;
285  }
286 
287  return $profiles;
288  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getProfilesOfUser()

static ilSkillProfile::getProfilesOfUser (   $a_user_id)
static

Get profiles of a user.

Parameters
int$a_user_iduser id

Definition at line 405 of file class.ilSkillProfile.php.

References $DIC, $ilDB, and array.

Referenced by ilPersonalSkillsGUI\__construct(), ilSurveyEvaluationGUI\competenceEval(), and ilTestSkillEvaluation\getAssignedSkillMatchingSkillProfiles().

406  {
407  global $DIC;
408 
409  $ilDB = $DIC->database();
410 
411  $profiles = array();
412  $set = $ilDB->query(
413  "SELECT p.id, p.title FROM skl_profile_user u JOIN skl_profile p " .
414  " ON (u.profile_id = p.id) " .
415  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
416  " ORDER BY p.title ASC"
417  );
418  while ($rec = $ilDB->fetchAssoc($set)) {
419  $profiles[] = $rec;
420  }
421  return $profiles;
422  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getSkillLevels()

ilSkillProfile::getSkillLevels ( )

Get skill levels.

Parameters

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

References $skill_level.

142  {
143  return $this->skill_level;
144  }

◆ getTitle()

ilSkillProfile::getTitle ( )

Get title.

Returns
string title

Definition at line 77 of file class.ilSkillProfile.php.

References $title.

78  {
79  return $this->title;
80  }

◆ getUsageInfo()

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

Get usage info.

Parameters

Implements ilSkillUsageInfo.

Definition at line 447 of file class.ilSkillProfile.php.

References $DIC, $ilDB, ilSkillUsage\getUsageInfoGeneric(), and ilSkillUsage\PROFILE.

448  {
449  global $DIC;
450 
451  $ilDB = $DIC->database();
452 
453  include_once("./Services/Skill/classes/class.ilSkillUsage.php");
455  $a_cskill_ids,
456  $a_usages,
458  "skl_profile_level",
459  "profile_id",
460  "base_skill_id"
461  );
462  }
global $DIC
Definition: saml.php:7
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:

◆ lookup()

static ilSkillProfile::lookup (   $a_id,
  $a_field 
)
staticprotected

Lookup.

Parameters

Definition at line 296 of file class.ilSkillProfile.php.

References $DIC, and $ilDB.

297  {
298  global $DIC;
299 
300  $ilDB = $DIC->database();
301 
302  $set = $ilDB->query(
303  "SELECT " . $a_field . " FROM skl_profile " .
304  " WHERE id = " . $ilDB->quote($a_id, "integer")
305  );
306  $rec = $ilDB->fetchAssoc($set);
307  return $rec[$a_field];
308  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ lookupTitle()

static ilSkillProfile::lookupTitle (   $a_id)
static

Lookup title.

Parameters

Definition at line 316 of file class.ilSkillProfile.php.

Referenced by ilSkillProfileGUI\confirmDeleteProfiles().

317  {
318  return self::lookup($a_id, "title");
319  }
+ Here is the caller graph for this function:

◆ read()

ilSkillProfile::read ( )

Read skill profile from db.

Parameters

Definition at line 152 of file class.ilSkillProfile.php.

References $db, $ilDB, addSkillLevel(), setDescription(), and setTitle().

Referenced by __construct().

153  {
154  $ilDB = $this->db;
155 
156  $set = $ilDB->query(
157  "SELECT * FROM skl_profile " .
158  " WHERE id = " . $ilDB->quote($this->getId(), "integer")
159  );
160  $rec = $ilDB->fetchAssoc($set);
161  $this->setTitle($rec["title"]);
162  $this->setDescription($rec["description"]);
163 
164  $set = $ilDB->query(
165  "SELECT * FROM skl_profile_level " .
166  " WHERE profile_id = " . $ilDB->quote($this->getId(), "integer")
167  );
168  while ($rec = $ilDB->fetchAssoc($set)) {
169  $this->addSkillLevel(
170  (int) $rec["base_skill_id"],
171  (int) $rec["tref_id"],
172  (int) $rec["level_id"]
173  );
174  }
175  }
setTitle($a_val)
Set title.
setDescription($a_val)
Set description.
global $ilDB
addSkillLevel($a_base_skill_id, $a_tref_id, $a_level_id)
Add skill level.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSkillLevel()

ilSkillProfile::removeSkillLevel (   $a_base_skill_id,
  $a_tref_id,
  $a_level_id 
)

Remove skill level.

Parameters

Definition at line 124 of file class.ilSkillProfile.php.

125  {
126  foreach ($this->skill_level as $k => $sl) {
127  if ((int) $sl["base_skill_id"] == (int) $a_base_skill_id &&
128  (int) $sl["tref_id"] == (int) $a_tref_id &&
129  (int) $sl["level_id"] == (int) $a_level_id) {
130  unset($this->skill_level[$k]);
131  }
132  }
133  }

◆ removeUserFromAllProfiles()

static ilSkillProfile::removeUserFromAllProfiles (   $a_user_id)
static

Remove user from all profiles.

Parameters
int$a_user_id

Definition at line 388 of file class.ilSkillProfile.php.

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

389  {
390  global $DIC;
391  $ilDB = $DIC->database();
392 
393  $ilDB->manipulate(
394  "DELETE FROM skl_profile_user WHERE " .
395  " user_id = " . $ilDB->quote($a_user_id, "integer")
396  );
397  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ removeUserFromProfile()

ilSkillProfile::removeUserFromProfile (   $a_user_id)

Remove user from profile.

Parameters
int$a_user_iduser id

Definition at line 372 of file class.ilSkillProfile.php.

References $db, and $ilDB.

373  {
374  $ilDB = $this->db;
375 
376  $ilDB->manipulate(
377  "DELETE FROM skl_profile_user WHERE " .
378  " profile_id = " . $ilDB->quote($this->getId(), "integer") .
379  " AND user_id = " . $ilDB->quote($a_user_id, "integer")
380  );
381  }
global $ilDB

◆ setDescription()

ilSkillProfile::setDescription (   $a_val)

Set description.

Parameters
string$a_valdescription

Definition at line 87 of file class.ilSkillProfile.php.

Referenced by read().

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

◆ setId()

ilSkillProfile::setId (   $a_val)

Set id.

Parameters
int$a_valid

Definition at line 47 of file class.ilSkillProfile.php.

Referenced by __construct(), and create().

48  {
49  $this->id = $a_val;
50  }
+ Here is the caller graph for this function:

◆ setTitle()

ilSkillProfile::setTitle (   $a_val)

Set title.

Parameters
string$a_valtitle

Definition at line 67 of file class.ilSkillProfile.php.

Referenced by read().

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

◆ update()

ilSkillProfile::update ( )

Update skill profile.

Definition at line 209 of file class.ilSkillProfile.php.

References $db, $ilDB, array, and getId().

210  {
211  $ilDB = $this->db;
212 
213  // profile
214  $ilDB->manipulate(
215  "UPDATE skl_profile SET " .
216  " title = " . $ilDB->quote($this->getTitle(), "text") . "," .
217  " description = " . $ilDB->quote($this->getDescription(), "text") .
218  " WHERE id = " . $ilDB->quote($this->getId(), "integer")
219  );
220 
221  // profile levels
222  $ilDB->manipulate(
223  "DELETE FROM skl_profile_level WHERE " .
224  " profile_id = " . $ilDB->quote($this->getId(), "integer")
225  );
226  foreach ($this->skill_level as $level) {
227  $ilDB->replace(
228  "skl_profile_level",
229  array("profile_id" => array("integer", $this->getId()),
230  "tref_id" => array("integer", (int) $level["tref_id"]),
231  "base_skill_id" => array("integer", (int) $level["base_skill_id"])
232  ),
233  array("level_id" => array("integer", (int) $level["level_id"]))
234  );
235 
236  /*$ilDB->manipulate("INSERT INTO skl_profile_level ".
237  "(profile_id, base_skill_id, tref_id, level_id) VALUES (".
238  $ilDB->quote($this->getId(), "integer").",".
239  $ilDB->quote((int) $level["base_skill_id"], "integer").",".
240  $ilDB->quote((int) $level["tref_id"], "integer").",".
241  $ilDB->quote((int) $level["level_id"], "integer").
242  ")");*/
243  }
244  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilSkillProfile::$db
protected

◆ $description

ilSkillProfile::$description
protected

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

Referenced by getDescription().

◆ $id

ilSkillProfile::$id
protected

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

Referenced by getId().

◆ $skill_level

ilSkillProfile::$skill_level = array()
protected

Definition at line 24 of file class.ilSkillProfile.php.

Referenced by getSkillLevels().

◆ $title

ilSkillProfile::$title
protected

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

Referenced by getTitle().


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