ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 setRefId ($a_val)
 
 getRefId ()
 
 addSkillLevel ($a_base_skill_id, $a_tref_id, $a_level_id, $a_order_nr)
 Add skill level. More...
 
 removeSkillLevel ($a_base_skill_id, $a_tref_id, $a_level_id, $a_order_nr)
 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...
 
 updateSkillOrder (array $order)
 Update skill order. More...
 
 fixSkillOrderNumbering ()
 Fix skill order numbering. More...
 
 getMaxLevelOrderNr ()
 Get maximum order number of levels. More...
 
 updateRefIdAfterImport (int $a_new_ref_id)
 Update the old ref id with the new ref id after import. More...
 
 getAssignments ()
 Get all assignments (users and roles) More...
 
 getAssignedUsers ()
 Get assigned users. More...
 
 addUserToProfile ($a_user_id)
 Add user to profile. More...
 
 removeUserFromProfile ($a_user_id)
 Remove user from profile. More...
 
 getAssignedRoles ()
 Get assigned roles. More...
 
 addRoleToProfile (int $a_role_id)
 Add role to profile. More...
 
 removeRoleFromProfile (int $a_role_id)
 Remove role from profile. More...
 

Static Public Member Functions

static deleteProfilesFromObject (int $a_ref_id)
 
static getProfiles ()
 Get profiles. More...
 
static getGlobalProfiles ()
 Get global profiles. More...
 
static getLocalProfiles (int $a_ref_id)
 Get local profiles of object. More...
 
static lookupTitle ($a_id)
 Lookup title. More...
 
static lookupRefId ($a_id)
 
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 removeRoleFromAllProfiles (int $a_role_id)
 Remove role from all profiles. More...
 
static getAllProfilesOfRole (int $a_role_id)
 Get global and local profiles of a role. More...
 
static getGlobalProfilesOfRole (int $a_role_id)
 Get global profiles of a role. More...
 
static getLocalProfilesOfRole (int $a_role_id, int $a_ref_id)
 Get local profiles of a role. More...
 
static countRoles (int $a_profile_id)
 Count assigned roles of a profile. 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
 
 $lng
 
 $review
 
 $id
 
 $title
 
 $description
 
 $ref_id = 0
 
 $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

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

Constructor & Destructor Documentation

◆ __construct()

ilSkillProfile::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_idprofile id

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

39 {
40 global $DIC;
41
42 $this->db = $DIC->database();
43 $this->lng = $DIC->language();
44 $this->review = $DIC->rbac()->review();
45 if ($a_id > 0) {
46 $this->setId($a_id);
47 $this->read();
48 }
49 }
setId($a_val)
Set id.
read()
Read skill profile from db.
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addRoleToProfile()

ilSkillProfile::addRoleToProfile ( int  $a_role_id)

Add role to profile.

Parameters
int$a_role_idrole id

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

733 {
735
736 $ilDB->replace(
737 "skl_profile_role",
738 array("profile_id" => array("integer", $this->getId()),
739 "role_id" => array("integer", (int) $a_role_id),
740 ),
741 array()
742 );
743 }
global $ilDB

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

+ Here is the call graph for this function:

◆ addSkillLevel()

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

Add skill level.

Parameters

return

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

134 {
135 //echo "-".$a_base_skill_id."-";
136 $this->skill_level[] = array(
137 "base_skill_id" => $a_base_skill_id,
138 "tref_id" => $a_tref_id,
139 "level_id" => $a_level_id,
140 "order_nr" => $a_order_nr
141 );
142 }

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

575 {
577
578 $ilDB->replace(
579 "skl_profile_user",
580 array("profile_id" => array("integer", $this->getId()),
581 "user_id" => array("integer", (int) $a_user_id),
582 ),
583 array()
584 );
585 }

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

+ Here is the call graph for this function:

◆ countRoles()

static ilSkillProfile::countRoles ( int  $a_profile_id)
static

Count assigned roles of a profile.

Parameters
int$a_profile_id
Returns
int

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

862 {
863 global $DIC;
864
865 $ilDB = $DIC->database();
866
867 $set = $ilDB->query(
868 "SELECT count(*) rcnt FROM skl_profile_role " .
869 " WHERE profile_id = " . $ilDB->quote($a_profile_id, "integer")
870 );
871 $rec = $ilDB->fetchAssoc($set);
872 return (int) $rec["rcnt"];
873 }

References $DIC, and $ilDB.

Referenced by ilSkillProfileTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ countUsers()

static ilSkillProfile::countUsers (   $a_profile_id)
static

Get assigned users.

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

672 {
673 global $DIC;
674
675 $ilDB = $DIC->database();
676
677 $set = $ilDB->query(
678 "SELECT count(*) ucnt FROM skl_profile_user " .
679 " WHERE profile_id = " . $ilDB->quote($a_profile_id, "integer")
680 );
681 $rec = $ilDB->fetchAssoc($set);
682 return (int) $rec["ucnt"];
683 }

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

214 {
216
217 // profile
218 $this->setId($ilDB->nextId("skl_profile"));
219 $ilDB->manipulate("INSERT INTO skl_profile " .
220 "(id, title, description, ref_id) VALUES (" .
221 $ilDB->quote($this->getId(), "integer") . "," .
222 $ilDB->quote($this->getTitle(), "text") . "," .
223 $ilDB->quote($this->getDescription(), "text") . "," .
224 $ilDB->quote($this->getRefId(), "integer") .
225 ")");
226
227 // profile levels
228 foreach ($this->skill_level as $level) {
229 $ilDB->replace(
230 "skl_profile_level",
231 array("profile_id" => array("integer", $this->getId()),
232 "tref_id" => array("integer", (int) $level["tref_id"]),
233 "base_skill_id" => array("integer", (int) $level["base_skill_id"])
234 ),
235 array("order_nr" => array("integer", (int) $level["order_nr"]),
236 "level_id" => array("integer", (int) $level["level_id"])
237 )
238 );
239 }
240 }

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

+ Here is the call graph for this function:

◆ delete()

ilSkillProfile::delete ( )

Delete skill profile.

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

289 {
291
292 // TODO: Split the deletions when refactoring to repository pattern
293
294 // profile levels
295 $ilDB->manipulate(
296 "DELETE FROM skl_profile_level WHERE " .
297 " profile_id = " . $ilDB->quote($this->getId(), "integer")
298 );
299
300 // profile users
301 $ilDB->manipulate(
302 "DELETE FROM skl_profile_user WHERE " .
303 " profile_id = " . $ilDB->quote($this->getId(), "integer")
304 );
305
306 // profile roles
307 $ilDB->manipulate(
308 "DELETE FROM skl_profile_role WHERE " .
309 " profile_id = " . $ilDB->quote($this->getId(), "integer")
310 );
311
312 // profile
313 $ilDB->manipulate(
314 "DELETE FROM skl_profile WHERE " .
315 " id = " . $ilDB->quote($this->getId(), "integer")
316 );
317 }

References $db, and $ilDB.

◆ deleteProfilesFromObject()

static ilSkillProfile::deleteProfilesFromObject ( int  $a_ref_id)
static

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

320 {
321 global $DIC;
322
323 $ilDB = $DIC->database();
324
325 $ilDB->manipulate(
326 "DELETE FROM skl_profile WHERE " .
327 " ref_id = " . $ilDB->quote($a_ref_id, "integer")
328 );
329 }

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

+ Here is the caller graph for this function:

◆ fixSkillOrderNumbering()

ilSkillProfile::fixSkillOrderNumbering ( )

Fix skill order numbering.

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

360 {
362
363 $set = $ilDB->query(
364 "SELECT profile_id, base_skill_id, tref_id, order_nr FROM skl_profile_level WHERE " .
365 " profile_id = " . $ilDB->quote($this->getId(), "integer") .
366 " ORDER BY order_nr ASC"
367 );
368 $cnt = 1;
369 while ($rec = $ilDB->fetchAssoc($set)) {
370 $ilDB->manipulate(
371 "UPDATE skl_profile_level SET " .
372 " order_nr = " . $ilDB->quote(($cnt * 10), "integer") .
373 " WHERE profile_id = " . $ilDB->quote($rec["profile_id"], "integer") .
374 " AND base_skill_id = " . $ilDB->quote($rec["base_skill_id"], "integer") .
375 " AND tref_id = " . $ilDB->quote($rec["tref_id"], "integer")
376 );
377 $cnt++;
378 }
379 }

References $db, and $ilDB.

◆ getAllProfilesOfRole()

static ilSkillProfile::getAllProfilesOfRole ( int  $a_role_id)
static

Get global and local profiles of a role.

Parameters
int$a_role_idrole id
Returns
array

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

784 {
785 global $DIC;
786
787 $ilDB = $DIC->database();
788
789 $profiles = array();
790 $set = $ilDB->query(
791 "SELECT p.id, p.title FROM skl_profile_role r JOIN skl_profile p " .
792 " ON (r.profile_id = p.id) " .
793 " WHERE r.role_id = " . $ilDB->quote($a_role_id, "integer") .
794 " ORDER BY p.title ASC"
795 );
796 while ($rec = $ilDB->fetchAssoc($set)) {
797 $profiles[] = $rec;
798 }
799 return $profiles;
800 }

References $DIC, and $ilDB.

◆ getAssignedRoles()

ilSkillProfile::getAssignedRoles ( )

Get assigned roles.

Returns
array

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

691 {
695
696 $set = $ilDB->query(
697 "SELECT * FROM skl_profile_role " .
698 " WHERE profile_id = " . $ilDB->quote($this->getId(), "integer")
699 );
700 $roles = array();
701 while ($rec = $ilDB->fetchAssoc($set)) {
703 $type = $lng->txt("role");
704 // get object of role
705 $obj_id = ilObject::_lookupObjectId($review->getObjectReferenceOfRole($rec["role_id"]));
706 // get title of object if course or group
707 $obj_title = "";
708 $obj_type = "";
709 if (ilObject::_lookupType($obj_id) == "crs" || ilObject::_lookupType($obj_id) == "grp") {
710 $obj_title = ilObject::_lookupTitle($obj_id);
711 $obj_type = ilObject::_lookupType($obj_id);
712 }
713
714 $roles[$rec["role_id"]] = array(
715 "type" => $type,
716 "name" => $name,
717 "id" => $rec["role_id"],
718 "object_title" => $obj_title,
719 "object_type" => $obj_type,
720 "object_id" => $obj_id
721 );
722 }
723
724 return $roles;
725 }
static _getTranslation($a_role_title)
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
if($format !==null) $name
Definition: metadata.php:230
$type

References $db, $ilDB, $lng, $name, $review, $type, ilObjRole\_getTranslation(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by getAssignments().

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

◆ getAssignedUsers()

ilSkillProfile::getAssignedUsers ( )

Get assigned users.

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

548 {
551
552 $set = $ilDB->query(
553 "SELECT * FROM skl_profile_user " .
554 " WHERE profile_id = " . $ilDB->quote($this->getId(), "integer")
555 );
556 $users = array();
557 while ($rec = $ilDB->fetchAssoc($set)) {
558 $name = ilUserUtil::getNamePresentation($rec["user_id"]);
559 $type = $lng->txt("user");
560 $users[$rec["user_id"]] = array(
561 "type" => $type,
562 "name" => $name,
563 "id" => $rec["user_id"]
564 );
565 }
566 return $users;
567 }
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:

References $db, $ilDB, $lng, $name, $type, and ilUserUtil\getNamePresentation().

Referenced by getAssignments().

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

◆ getAssignments()

ilSkillProfile::getAssignments ( )

Get all assignments (users and roles)

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

533 {
534 $assignments = array();
535
536 $users = $this->getAssignedUsers();
537 $roles = $this->getAssignedRoles();
538 $assignments = $users + $roles;
539 ksort($assignments);
540
541 return $assignments;
542 }
getAssignedRoles()
Get assigned roles.
getAssignedUsers()
Get assigned users.

References getAssignedRoles(), and getAssignedUsers().

+ Here is the call graph for this function:

◆ getDescription()

ilSkillProfile::getDescription ( )

Get description.

Returns
string description

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

107 {
108 return $this->description;
109 }

References $description.

◆ getGlobalProfiles()

static ilSkillProfile::getGlobalProfiles ( )
static

Get global profiles.

Returns
array

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 * FROM skl_profile " .
435 " WHERE ref_id = 0 " .
436 " ORDER BY title "
437 );
438 $profiles = array();
439 while ($rec = $ilDB->fetchAssoc($set)) {
440 $profiles[$rec["id"]] = $rec;
441 }
442
443 return $profiles;
444 }

References $DIC, and $ilDB.

Referenced by ilContSkillAdminGUI\listProfiles().

+ Here is the caller graph for this function:

◆ getGlobalProfilesOfRole()

static ilSkillProfile::getGlobalProfilesOfRole ( int  $a_role_id)
static

Get global profiles of a role.

Parameters
int$a_role_idrole id
Returns
array

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

809 {
810 global $DIC;
811
812 $ilDB = $DIC->database();
813
814 $profiles = array();
815 $set = $ilDB->query(
816 "SELECT p.id, p.title FROM skl_profile_role r JOIN skl_profile p " .
817 " ON (r.profile_id = p.id) " .
818 " WHERE r.role_id = " . $ilDB->quote($a_role_id, "integer") .
819 " AND p.ref_id = 0" .
820 " ORDER BY p.title ASC"
821 );
822 while ($rec = $ilDB->fetchAssoc($set)) {
823 $profiles[] = $rec;
824 }
825 return $profiles;
826 }

References $DIC, and $ilDB.

Referenced by getProfilesOfUser().

+ Here is the caller graph for this function:

◆ getId()

ilSkillProfile::getId ( )

Get id.

Returns
int id

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

67 {
68 return $this->id;
69 }

References $id.

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

+ Here is the caller graph for this function:

◆ getLocalProfiles()

static ilSkillProfile::getLocalProfiles ( int  $a_ref_id)
static

Get local profiles of object.

Parameters
int$a_ref_id
Returns
array

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

453 {
454 global $DIC;
455
456 $ilDB = $DIC->database();
457
458 $set = $ilDB->query(
459 "SELECT * FROM skl_profile " .
460 " WHERE ref_id = " . $a_ref_id .
461 " ORDER BY title "
462 );
463 $profiles = array();
464 while ($rec = $ilDB->fetchAssoc($set)) {
465 $profiles[$rec["id"]] = $rec;
466 }
467
468 return $profiles;
469 }

References $DIC, and $ilDB.

Referenced by ilSkillDataSet\readData().

+ Here is the caller graph for this function:

◆ getLocalProfilesOfRole()

static ilSkillProfile::getLocalProfilesOfRole ( int  $a_role_id,
int  $a_ref_id 
)
static

Get local profiles of a role.

Parameters
int$a_role_idrole id
int$a_ref_idref id
Returns
array

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

836 {
837 global $DIC;
838
839 $ilDB = $DIC->database();
840
841 $profiles = array();
842 $set = $ilDB->query(
843 "SELECT p.id, p.title FROM skl_profile_role r JOIN skl_profile p " .
844 " ON (r.profile_id = p.id) " .
845 " WHERE r.role_id = " . $ilDB->quote($a_role_id, "integer") .
846 " AND p.ref_id = " . $ilDB->quote($a_ref_id, "integer") .
847 " ORDER BY p.title ASC"
848 );
849 while ($rec = $ilDB->fetchAssoc($set)) {
850 $profiles[] = $rec;
851 }
852 return $profiles;
853 }

References $DIC, and $ilDB.

◆ getMaxLevelOrderNr()

ilSkillProfile::getMaxLevelOrderNr ( )

Get maximum order number of levels.

Returns
int

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

387 {
389
390 $set = $ilDB->query(
391 "SELECT MAX(order_nr) mnr FROM skl_profile_level WHERE " .
392 " profile_id = " . $ilDB->quote($this->getId(), "integer")
393 );
394 $rec = $ilDB->fetchAssoc($set);
395 return (int) $rec["mnr"];
396 }

References $db, and $ilDB.

◆ getProfiles()

static ilSkillProfile::getProfiles ( )
static

Get profiles.

Parameters

return

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

405 {
406 global $DIC;
407
408 $ilDB = $DIC->database();
409
410 $set = $ilDB->query(
411 "SELECT * FROM skl_profile " .
412 " ORDER BY title "
413 );
414 $profiles = array();
415 while ($rec = $ilDB->fetchAssoc($set)) {
416 $profiles[$rec["id"]] = $rec;
417 }
418
419 return $profiles;
420 }

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

626 {
627 global $DIC;
628
629 $ilDB = $DIC->database();
630 $rbacreview = $DIC->rbac()->review();
631
632 $all_profiles = array();
633
634 // competence profiles coming from user assignments
635 $user_profiles = array();
636 $set = $ilDB->query(
637 "SELECT p.id, p.title FROM skl_profile_user u JOIN skl_profile p " .
638 " ON (u.profile_id = p.id) " .
639 " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
640 " ORDER BY p.title ASC"
641 );
642 while ($rec = $ilDB->fetchAssoc($set)) {
643 $user_profiles[] = $rec;
644 }
645
646 // competence profiles coming from role assignments
647 $role_profiles = array();
648 $user_roles = $rbacreview->assignedRoles($a_user_id);
649 foreach ($user_roles as $role) {
650 $profiles = self::getGlobalProfilesOfRole($role);
651 foreach ($profiles as $profile) {
652 $role_profiles[] = $profile;
653 }
654 }
655
656 // merge competence profiles and remove multiple occurrences
657 $all_profiles = array_merge($user_profiles, $role_profiles);
658 $temp_profiles = array();
659 foreach ($all_profiles as &$v) {
660 if (!isset($temp_profiles[$v["id"]])) {
661 $temp_profiles[$v["id"]] = &$v;
662 }
663 }
664 $all_profiles = array_values($temp_profiles);
665 return $all_profiles;
666 }
static getGlobalProfilesOfRole(int $a_role_id)
Get global profiles of a role.

References $DIC, $ilDB, and getGlobalProfilesOfRole().

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

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

◆ getRefId()

ilSkillProfile::getRefId ( )
Returns
int ref id

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

123 {
124 return $this->ref_id;
125 }

References $ref_id.

◆ getSkillLevels()

ilSkillProfile::getSkillLevels ( )

Get skill levels.

Parameters

return

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

169 {
170 usort($this->skill_level, function($level_a, $level_b) {
171 return $level_a['order_nr'] <=> $level_b['order_nr'];
172 });
173
174 return $this->skill_level;
175 }

References $skill_level.

◆ getTitle()

ilSkillProfile::getTitle ( )

Get title.

Returns
string title

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

87 {
88 return $this->title;
89 }

References $title.

◆ getUsageInfo()

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

Get usage info.

Parameters

return

Implements ilSkillUsageInfo.

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

882 {
883 global $DIC;
884
886 $a_cskill_ids,
887 $a_usages,
889 "skl_profile_level",
890 "profile_id",
891 "base_skill_id"
892 );
893 }
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, 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 477 of file class.ilSkillProfile.php.

478 {
479 global $DIC;
480
481 $ilDB = $DIC->database();
482
483 $set = $ilDB->query(
484 "SELECT " . $a_field . " FROM skl_profile " .
485 " WHERE id = " . $ilDB->quote($a_id, "integer")
486 );
487 $rec = $ilDB->fetchAssoc($set);
488 return $rec[$a_field];
489 }

References $DIC, and $ilDB.

Referenced by lookupRefId(), and lookupTitle().

+ Here is the caller graph for this function:

◆ lookupRefId()

static ilSkillProfile::lookupRefId (   $a_id)
static

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

503 {
504 return self::lookup($a_id, "ref_id");
505 }
static lookup($a_id, $a_field)
Lookup.

References lookup().

Referenced by ilContSkillAdminGUI\confirmDeleteSelectedLocalProfiles(), ilContSkillAdminGUI\confirmRemoveSelectedGlobalProfiles(), ilContSkillAdminGUI\deleteSelectedLocalProfiles(), ilContProfileTableGUI\fillRow(), and ilSkillProfileTableGUI\fillRow().

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

◆ lookupTitle()

static ilSkillProfile::lookupTitle (   $a_id)
static

Lookup title.

Parameters

return

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

498 {
499 return self::lookup($a_id, "title");
500 }

References lookup().

Referenced by ilSkillProfileGUI\confirmDeleteProfiles(), ilContSkillAdminGUI\confirmDeleteSelectedLocalProfiles(), ilContSkillAdminGUI\confirmDeleteSingleLocalProfile(), ilContSkillAdminGUI\confirmRemoveSelectedGlobalProfiles(), ilContSkillAdminGUI\confirmRemoveSingleGlobalProfile(), and ilContProfileTableGUI\getProfiles().

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

184 {
186
187 $set = $ilDB->query(
188 "SELECT * FROM skl_profile " .
189 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
190 );
191 $rec = $ilDB->fetchAssoc($set);
192 $this->setTitle($rec["title"]);
193 $this->setDescription($rec["description"]);
194 $this->setRefId($rec["ref_id"]);
195
196 $set = $ilDB->query(
197 "SELECT * FROM skl_profile_level " .
198 " WHERE profile_id = " . $ilDB->quote($this->getId(), "integer")
199 );
200 while ($rec = $ilDB->fetchAssoc($set)) {
201 $this->addSkillLevel(
202 (int) $rec["base_skill_id"],
203 (int) $rec["tref_id"],
204 (int) $rec["level_id"],
205 (int) $rec["order_nr"]
206 );
207 }
208 }
setTitle($a_val)
Set title.
addSkillLevel($a_base_skill_id, $a_tref_id, $a_level_id, $a_order_nr)
Add skill level.
setDescription($a_val)
Set description.

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

Referenced by __construct().

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

◆ removeRoleFromAllProfiles()

static ilSkillProfile::removeRoleFromAllProfiles ( int  $a_role_id)
static

Remove role from all profiles.

Parameters
int$a_role_id

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

767 {
768 global $DIC;
769 $ilDB = $DIC->database();
770
771 $ilDB->manipulate(
772 "DELETE FROM skl_profile_role WHERE " .
773 " role_id = " . $ilDB->quote($a_role_id, "integer")
774 );
775 }

References $DIC, and $ilDB.

Referenced by ilSkillObjDeletionHandler\processDeletion().

+ Here is the caller graph for this function:

◆ removeRoleFromProfile()

ilSkillProfile::removeRoleFromProfile ( int  $a_role_id)

Remove role from profile.

Parameters
int$a_role_idrole id

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

751 {
753
754 $ilDB->manipulate(
755 "DELETE FROM skl_profile_role WHERE " .
756 " profile_id = " . $ilDB->quote($this->getId(), "integer") .
757 " AND role_id = " . $ilDB->quote($a_role_id, "integer")
758 );
759 }

References $db, and $ilDB.

◆ removeSkillLevel()

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

Remove skill level.

Parameters

return

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

151 {
152 foreach ($this->skill_level as $k => $sl) {
153 if ((int) $sl["base_skill_id"] == (int) $a_base_skill_id &&
154 (int) $sl["tref_id"] == (int) $a_tref_id &&
155 (int) $sl["level_id"] == (int) $a_level_id &&
156 (int) $sl["order_nr"] == (int) $a_order_nr) {
157 unset($this->skill_level[$k]);
158 }
159 }
160 }

◆ removeUserFromAllProfiles()

static ilSkillProfile::removeUserFromAllProfiles (   $a_user_id)
static

Remove user from all profiles.

Parameters
int$a_user_id

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

609 {
610 global $DIC;
611 $ilDB = $DIC->database();
612
613 $ilDB->manipulate(
614 "DELETE FROM skl_profile_user WHERE " .
615 " user_id = " . $ilDB->quote($a_user_id, "integer")
616 );
617 }

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

593 {
595
596 $ilDB->manipulate(
597 "DELETE FROM skl_profile_user WHERE " .
598 " profile_id = " . $ilDB->quote($this->getId(), "integer") .
599 " AND user_id = " . $ilDB->quote($a_user_id, "integer")
600 );
601 }

References $db, and $ilDB.

◆ setDescription()

ilSkillProfile::setDescription (   $a_val)

Set description.

Parameters
string$a_valdescription

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

97 {
98 $this->description = $a_val;
99 }

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

57 {
58 $this->id = $a_val;
59 }

Referenced by __construct(), and create().

+ Here is the caller graph for this function:

◆ setRefId()

ilSkillProfile::setRefId (   $a_val)
Parameters
int$a_valref id

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

115 {
116 $this->ref_id = $a_val;
117 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilSkillProfile::setTitle (   $a_val)

Set title.

Parameters
string$a_valtitle

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

77 {
78 $this->title = $a_val;
79 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilSkillProfile::update ( )

Update skill profile.

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

246 {
248
249 // profile
250 $ilDB->manipulate(
251 "UPDATE skl_profile SET " .
252 " title = " . $ilDB->quote($this->getTitle(), "text") . "," .
253 " description = " . $ilDB->quote($this->getDescription(), "text") .
254 " WHERE id = " . $ilDB->quote($this->getId(), "integer") .
255 " AND ref_id = " . $ilDB->quote($this->getRefId(), "integer")
256 );
257
258 // profile levels
259 $ilDB->manipulate(
260 "DELETE FROM skl_profile_level WHERE " .
261 " profile_id = " . $ilDB->quote($this->getId(), "integer")
262 );
263 foreach ($this->skill_level as $level) {
264 $ilDB->replace(
265 "skl_profile_level",
266 array("profile_id" => array("integer", $this->getId()),
267 "tref_id" => array("integer", (int) $level["tref_id"]),
268 "base_skill_id" => array("integer", (int) $level["base_skill_id"])
269 ),
270 array("order_nr" => array("integer", (int) $level["order_nr"]),
271 "level_id" => array("integer", (int) $level["level_id"])
272 )
273 );
274
275 /*$ilDB->manipulate("INSERT INTO skl_profile_level ".
276 "(profile_id, base_skill_id, tref_id, level_id) VALUES (".
277 $ilDB->quote($this->getId(), "integer").",".
278 $ilDB->quote((int) $level["base_skill_id"], "integer").",".
279 $ilDB->quote((int) $level["tref_id"], "integer").",".
280 $ilDB->quote((int) $level["level_id"], "integer").
281 ")");*/
282 }
283 }

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

+ Here is the call graph for this function:

◆ updateRefIdAfterImport()

ilSkillProfile::updateRefIdAfterImport ( int  $a_new_ref_id)

Update the old ref id with the new ref id after import.

Parameters
int$a_new_ref_id

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

513 {
515
516 $ilDB->update(
517 "skl_profile",
518 array(
519 "ref_id" => array("integer", $a_new_ref_id)),
520 array(
521 "id" => array("integer", $this->getId()))
522 );
523 }

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

+ Here is the call graph for this function:

◆ updateSkillOrder()

ilSkillProfile::updateSkillOrder ( array  $order)

Update skill order.

Parameters
array$order

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

337 {
339
340 asort($order);
341
342 $cnt = 1;
343 foreach ($order as $id => $o) {
344 $id_arr = explode("_", $id);
345 $ilDB->manipulate(
346 "UPDATE skl_profile_level SET " .
347 " order_nr = " . $ilDB->quote(($cnt * 10), "integer") .
348 " WHERE base_skill_id = " . $ilDB->quote($id_arr[0], "integer") .
349 " AND tref_id = " . $ilDB->quote($id_arr[1], "integer") .
350 " AND profile_id = " . $ilDB->quote($this->getId(), "integer")
351 );
352 $cnt++;
353 }
354 }

References $db, $id, and $ilDB.

Field Documentation

◆ $db

◆ $description

ilSkillProfile::$description
protected

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

Referenced by getDescription().

◆ $id

ilSkillProfile::$id
protected

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

Referenced by getId(), and updateSkillOrder().

◆ $lng

ilSkillProfile::$lng
protected

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

Referenced by getAssignedRoles(), and getAssignedUsers().

◆ $ref_id

ilSkillProfile::$ref_id = 0
protected

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

Referenced by getRefId().

◆ $review

ilSkillProfile::$review
protected

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

Referenced by getAssignedRoles().

◆ $skill_level

ilSkillProfile::$skill_level = array()
protected

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

Referenced by getSkillLevels().

◆ $title

ilSkillProfile::$title
protected

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

Referenced by getTitle().


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