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 getUsageInfo ($a_cskill_ids, &$a_usages)
 Get title of an assigned item. 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.

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 }
setId($a_val)
Set id.
read()
Read skill profile from db.
global $DIC
Definition: saml.php:7

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

+ 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

return

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

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 }

Referenced by read().

+ 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.

355 {
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 }
global $ilDB

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

+ 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.

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 }

References $DIC, and $ilDB.

Referenced by ilSkillProfileTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ create()

ilSkillProfile::create ( )

Create skill profile.

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

181 {
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 }

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

+ Here is the call graph for this function:

◆ delete()

ilSkillProfile::delete ( )

Delete skill profile.

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

250 {
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 }

References $db, and $ilDB.

◆ getAssignedUsers()

ilSkillProfile::getAssignedUsers ( )

Get assigned users.

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

329 {
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 }
$users
Definition: authpage.php:44
static _lookupName($a_user_id)
lookup user name
if($format !==null) $name
Definition: metadata.php:146

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

+ 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.

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

References $description.

◆ getId()

ilSkillProfile::getId ( )

Get id.

Returns
int id

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

58 {
59 return $this->id;
60 }

References $id.

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

+ Here is the caller graph for this function:

◆ getProfiles()

static ilSkillProfile::getProfiles ( )
static

Get profiles.

Parameters

return

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

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 }

References $DIC, and $ilDB.

Referenced by ilSkillProfileTableGUI\getProfiles().

+ 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.

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 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ getSkillLevels()

ilSkillProfile::getSkillLevels ( )

Get skill levels.

Parameters

return

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

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

References $skill_level.

◆ getTitle()

ilSkillProfile::getTitle ( )

Get title.

Returns
string title

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

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

References $title.

◆ getUsageInfo()

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

Get usage info.

Parameters

return

Implements ilSkillUsageInfo.

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

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 }
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.

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

+ Here is the call graph for this function:

◆ lookup()

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

Lookup.

Parameters

return

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

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 }

References $DIC, and $ilDB.

Referenced by lookupTitle().

+ Here is the caller graph for this function:

◆ lookupTitle()

static ilSkillProfile::lookupTitle (   $a_id)
static

Lookup title.

Parameters

return

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

317 {
318 return self::lookup($a_id, "title");
319 }
static lookup($a_id, $a_field)
Lookup.

References lookup().

Referenced by ilSkillProfileGUI\confirmDeleteProfiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilSkillProfile::read ( )

Read skill profile from db.

Parameters

return

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

153 {
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.
addSkillLevel($a_base_skill_id, $a_tref_id, $a_level_id)
Add skill level.
setDescription($a_val)
Set description.

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

Referenced by __construct().

+ 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

return

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.

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 }

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

+ 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.

373 {
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 }

References $db, and $ilDB.

◆ setDescription()

ilSkillProfile::setDescription (   $a_val)

Set description.

Parameters
string$a_valdescription

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

88 {
89 $this->description = $a_val;
90 }

Referenced by read().

+ 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.

48 {
49 $this->id = $a_val;
50 }

Referenced by __construct(), and create().

+ 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.

68 {
69 $this->title = $a_val;
70 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilSkillProfile::update ( )

Update skill profile.

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

210 {
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 }

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

+ 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: