5 include_once(
"./Services/Skill/interfaces/interface.ilSkillUsageInfo.php");
35 $this->db = $DIC->database();
69 $this->title = $a_val;
89 $this->description = $a_val;
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
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]);
157 "SELECT * FROM skl_profile " .
158 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
160 $rec =
$ilDB->fetchAssoc($set);
165 "SELECT * FROM skl_profile_level " .
166 " WHERE profile_id = " .
$ilDB->quote($this->getId(),
"integer")
168 while ($rec =
$ilDB->fetchAssoc($set)) {
170 (
int) $rec[
"base_skill_id"],
171 (
int) $rec[
"tref_id"],
172 (
int) $rec[
"level_id"]
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") .
194 foreach ($this->skill_level as $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"])
201 array(
"level_id" => array(
"integer", (
int) $level[
"level_id"]))
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")
223 "DELETE FROM skl_profile_level WHERE " .
224 " profile_id = " .
$ilDB->quote($this->getId(),
"integer")
226 foreach ($this->skill_level as $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"])
233 array(
"level_id" => array(
"integer", (
int) $level[
"level_id"]))
249 public function delete()
257 "DELETE FROM skl_profile_level WHERE " .
258 " profile_id = " .
$ilDB->quote($this->getId(),
"integer")
263 "DELETE FROM skl_profile_user WHERE " .
264 " profile_id = " .
$ilDB->quote($this->getId(),
"integer")
269 "DELETE FROM skl_profile_role WHERE " .
270 " profile_id = " .
$ilDB->quote($this->getId(),
"integer")
275 "DELETE FROM skl_profile WHERE " .
276 " id = " .
$ilDB->quote($this->getId(),
"integer")
290 $ilDB = $DIC->database();
293 "SELECT * FROM skl_profile " .
297 while ($rec =
$ilDB->fetchAssoc($set)) {
298 $profiles[$rec[
"id"]] = $rec;
310 protected static function lookup($a_id, $a_field)
314 $ilDB = $DIC->database();
317 "SELECT " . $a_field .
" FROM skl_profile " .
318 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
320 $rec =
$ilDB->fetchAssoc($set);
321 return $rec[$a_field];
332 return self::lookup($a_id,
"title");
347 "SELECT * FROM skl_profile_user " .
348 " WHERE profile_id = " .
$ilDB->quote($this->getId(),
"integer")
351 while ($rec =
$ilDB->fetchAssoc($set)) {
353 $users[$rec[
"user_id"]] = array(
354 "lastname" =>
$name[
"lastname"],
355 "firstname" =>
$name[
"firstname"],
356 "login" =>
$name[
"login"],
357 "id" =>
$name[
"user_id"]
374 array(
"profile_id" => array(
"integer", $this->
getId()),
375 "user_id" => array(
"integer", (
int) $a_user_id),
391 "DELETE FROM skl_profile_user WHERE " .
392 " profile_id = " .
$ilDB->quote($this->getId(),
"integer") .
393 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer")
405 $ilDB = $DIC->database();
408 "DELETE FROM skl_profile_user WHERE " .
409 " user_id = " .
$ilDB->quote($a_user_id,
"integer")
423 $ilDB = $DIC->database();
427 "SELECT p.id, p.title FROM skl_profile_user u JOIN skl_profile p " .
428 " ON (u.profile_id = p.id) " .
429 " WHERE user_id = " .
$ilDB->quote($a_user_id,
"integer") .
430 " ORDER BY p.title ASC" 432 while ($rec =
$ilDB->fetchAssoc($set)) {
445 $ilDB = $DIC->database();
448 "SELECT count(*) ucnt FROM skl_profile_user " .
449 " WHERE profile_id = " .
$ilDB->quote($a_profile_id,
"integer")
451 $rec =
$ilDB->fetchAssoc($set);
452 return (
int) $rec[
"ucnt"];
465 $ilDB = $DIC->database();
467 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
Get info on usages of skills.
static _lookupName($a_user_id)
lookup user name
static getProfiles()
Get profiles.
static removeUserFromAllProfiles($a_user_id)
Remove user from all profiles.
setTitle($a_val)
Set title.
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.
addUserToProfile($a_user_id)
Add user to profile.
update()
Update skill profile.
getSkillLevels()
Get skill levels.
static getProfilesOfUser($a_user_id)
Get profiles of a user.
getDescription()
Get description.
__construct($a_id=0)
Constructor.
setDescription($a_val)
Set description.
static getUsageInfo($a_cskill_ids, &$a_usages)
Get usage info.
read()
Read skill profile from db.
removeSkillLevel($a_base_skill_id, $a_tref_id, $a_level_id)
Remove skill level.
static countUsers($a_profile_id)
Get assigned users.
addSkillLevel($a_base_skill_id, $a_tref_id, $a_level_id)
Add skill level.
create()
Create skill profile.
static lookup($a_id, $a_field)
Lookup.
static lookupTitle($a_id)
Lookup title.
getAssignedUsers()
Get assigned users.
removeUserFromProfile($a_user_id)
Remove user from profile.