ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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

 $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 26 of file class.ilSkillProfile.php.

27 {
28 if ($a_id > 0)
29 {
30 $this->setId($a_id);
31 $this->read();
32 }
33 }
setId($a_val)
Set id.
read()
Read skill profile from db.

References 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 101 of file class.ilSkillProfile.php.

102 {
103//echo "-".$a_base_skill_id."-";
104 $this->skill_level[] = array(
105 "base_skill_id" => $a_base_skill_id,
106 "tref_id" => $a_tref_id,
107 "level_id" => $a_level_id
108 );
109 }

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 337 of file class.ilSkillProfile.php.

338 {
339 global $ilDB;
340
341 $ilDB->replace("skl_profile_user",
342 array("profile_id" => array("integer", $this->getId()),
343 "user_id" => array("integer", (int) $a_user_id),
344 ),
345 array()
346 );
347 }
global $ilDB

References $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 389 of file class.ilSkillProfile.php.

390 {
391 global $ilDB;
392
393 $set = $ilDB->query("SELECT count(*) ucnt FROM skl_profile_user ".
394 " WHERE profile_id = ".$ilDB->quote($a_profile_id, "integer")
395 );
396 $rec = $ilDB->fetchAssoc($set);
397 return (int) $rec["ucnt"];
398 }

References $ilDB.

Referenced by ilSkillProfileTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ create()

ilSkillProfile::create ( )

Create skill profile.

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

172 {
173 global $ilDB;
174
175 // profile
176 $this->setId($ilDB->nextId("skl_profile"));
177 $ilDB->manipulate("INSERT INTO skl_profile ".
178 "(id, title, description) VALUES (".
179 $ilDB->quote($this->getId(), "integer").",".
180 $ilDB->quote($this->getTitle(), "text").",".
181 $ilDB->quote($this->getDescription(), "text").
182 ")");
183
184 // profile levels
185 foreach ($this->skill_level as $level)
186 {
187 $ilDB->replace("skl_profile_level",
188 array("profile_id" => array("integer", $this->getId()),
189 "tref_id" => array("integer", (int) $level["tref_id"]),
190 "base_skill_id" => array("integer", (int) $level["base_skill_id"])
191 ),
192 array("level_id" => array("integer", (int) $level["level_id"]))
193 );
194 }
195 }

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

+ Here is the call graph for this function:

◆ delete()

ilSkillProfile::delete ( )

Delete skill profile.

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

239 {
240 global $ilDB;
241
242 // profile levels
243 $ilDB->manipulate("DELETE FROM skl_profile_level WHERE ".
244 " profile_id = ".$ilDB->quote($this->getId(), "integer")
245 );
246
247 // profile
248 $ilDB->manipulate("DELETE FROM skl_profile WHERE ".
249 " id = ".$ilDB->quote($this->getId(), "integer")
250 );
251
252 }

References $ilDB.

◆ getAssignedUsers()

ilSkillProfile::getAssignedUsers ( )

Get assigned users.

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

312 {
313 global $ilDB;
314
315 $set = $ilDB->query("SELECT * FROM skl_profile_user ".
316 " WHERE profile_id = ".$ilDB->quote($this->getId(), "integer")
317 );
318 $users = array();
319 while ($rec = $ilDB->fetchAssoc($set))
320 {
321 $name = ilObjUser::_lookupName($rec["user_id"]);
322 $users[$rec["user_id"]] = array(
323 "lastname" => $name["lastname"],
324 "firstname" => $name["firstname"],
325 "login" => $name["login"],
326 "id" => $name["user_id"]
327 );
328 }
329 return $users;
330 }
static _lookupName($a_user_id)
lookup user name

References $ilDB, and ilObjUser\_lookupName().

+ Here is the call graph for this function:

◆ getDescription()

ilSkillProfile::getDescription ( )

Get description.

Returns
string description

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

91 {
92 return $this->description;
93 }

References $description.

◆ getId()

ilSkillProfile::getId ( )

Get id.

Returns
int id

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

51 {
52 return $this->id;
53 }

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 260 of file class.ilSkillProfile.php.

261 {
262 global $ilDB;
263
264 $set = $ilDB->query("SELECT * FROM skl_profile ".
265 " ORDER BY title "
266 );
267 $profiles = array();
268 while ($rec = $ilDB->fetchAssoc($set))
269 {
270 $profiles[$rec["id"]] = $rec;
271 }
272
273 return $profiles;
274 }

References $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 369 of file class.ilSkillProfile.php.

370 {
371 global $ilDB;
372
373 $profiles = array();
374 $set = $ilDB->query("SELECT p.id, p.title FROM skl_profile_user u JOIN skl_profile p ".
375 " ON (u.profile_id = p.id) ".
376 " WHERE user_id = ".$ilDB->quote($a_user_id, "integer").
377 " ORDER BY p.title ASC"
378 );
379 while ($rec = $ilDB->fetchAssoc($set))
380 {
381 $profiles[] = $rec;
382 }
383 return $profiles;
384 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ getSkillLevels()

ilSkillProfile::getSkillLevels ( )

Get skill levels.

Parameters

return

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

137 {
138 return $this->skill_level;
139 }

References $skill_level.

◆ getTitle()

ilSkillProfile::getTitle ( )

Get title.

Returns
string title

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

71 {
72 return $this->title;
73 }

References $title.

◆ getUsageInfo()

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

Get usage info.

Parameters

return

Implements ilSkillUsageInfo.

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

407 {
408 global $ilDB;
409
410 include_once("./Services/Skill/classes/class.ilSkillUsage.php");
412 "skl_profile_level", "profile_id", "base_skill_id");
413 }
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 $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 282 of file class.ilSkillProfile.php.

283 {
284 global $ilDB;
285
286 $set = $ilDB->query("SELECT ".$a_field." FROM skl_profile ".
287 " WHERE id = ".$ilDB->quote($a_id, "integer")
288 );
289 $rec = $ilDB->fetchAssoc($set);
290 return $rec[$a_field];
291 }

References $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 299 of file class.ilSkillProfile.php.

300 {
301 return self::lookup($a_id, "title");
302 }
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 147 of file class.ilSkillProfile.php.

148 {
149 global $ilDB;
150
151 $set = $ilDB->query("SELECT * FROM skl_profile ".
152 " WHERE id = ".$ilDB->quote($this->getId(), "integer")
153 );
154 $rec = $ilDB->fetchAssoc($set);
155 $this->setTitle($rec["title"]);
156 $this->setDescription($rec["description"]);
157
158 $set = $ilDB->query("SELECT * FROM skl_profile_level ".
159 " WHERE profile_id = ".$ilDB->quote($this->getId(), "integer")
160 );
161 while ($rec = $ilDB->fetchAssoc($set))
162 {
163 $this->addSkillLevel((int) $rec["base_skill_id"], (int) $rec["tref_id"],
164 (int) $rec["level_id"]);
165 }
166 }
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 $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 117 of file class.ilSkillProfile.php.

118 {
119 foreach ($this->skill_level as $k => $sl)
120 {
121 if ((int) $sl["base_skill_id"] == (int) $a_base_skill_id &&
122 (int) $sl["tref_id"] == (int) $a_tref_id &&
123 (int) $sl["level_id"] == (int) $a_level_id)
124 {
125 unset($this->skill_level[$k]);
126 }
127 }
128 }

◆ removeUserFromProfile()

ilSkillProfile::removeUserFromProfile (   $a_user_id)

Remove user from profile.

Parameters
int$a_user_iduser id

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

355 {
356 global $ilDB;
357
358 $ilDB->manipulate("DELETE FROM skl_profile_user WHERE ".
359 " profile_id = ".$ilDB->quote($this->getId(), "integer").
360 " AND user_id = ".$ilDB->quote($a_user_id, "integer")
361 );
362 }

References $ilDB.

◆ setDescription()

ilSkillProfile::setDescription (   $a_val)

Set description.

Parameters
string$a_valdescription

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

81 {
82 $this->description = $a_val;
83 }

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 40 of file class.ilSkillProfile.php.

41 {
42 $this->id = $a_val;
43 }

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 60 of file class.ilSkillProfile.php.

61 {
62 $this->title = $a_val;
63 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilSkillProfile::update ( )

Update skill profile.

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

201 {
202 global $ilDB;
203
204 // profile
205 $ilDB->manipulate("UPDATE skl_profile SET ".
206 " title = ".$ilDB->quote($this->getTitle(), "text").",".
207 " description = ".$ilDB->quote($this->getDescription(), "text").
208 " WHERE id = ".$ilDB->quote($this->getId(), "integer")
209 );
210
211 // profile levels
212 $ilDB->manipulate("DELETE FROM skl_profile_level WHERE ".
213 " profile_id = ".$ilDB->quote($this->getId(), "integer")
214 );
215 foreach ($this->skill_level as $level)
216 {
217 $ilDB->replace("skl_profile_level",
218 array("profile_id" => array("integer", $this->getId()),
219 "tref_id" => array("integer", (int) $level["tref_id"]),
220 "base_skill_id" => array("integer", (int) $level["base_skill_id"])
221 ),
222 array("level_id" => array("integer", (int) $level["level_id"]))
223 );
224
225 /*$ilDB->manipulate("INSERT INTO skl_profile_level ".
226 "(profile_id, base_skill_id, tref_id, level_id) VALUES (".
227 $ilDB->quote($this->getId(), "integer").",".
228 $ilDB->quote((int) $level["base_skill_id"], "integer").",".
229 $ilDB->quote((int) $level["tref_id"], "integer").",".
230 $ilDB->quote((int) $level["level_id"], "integer").
231 ")");*/
232 }
233 }

References $ilDB, and getId().

+ Here is the call graph for this function:

Field Documentation

◆ $description

ilSkillProfile::$description
protected

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

Referenced by getDescription().

◆ $id

ilSkillProfile::$id
protected

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

Referenced by getId().

◆ $skill_level

ilSkillProfile::$skill_level = array()
protected

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

Referenced by getSkillLevels().

◆ $title

ilSkillProfile::$title
protected

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

Referenced by getTitle().


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