5 include_once(
"./Services/Skill/interfaces/interface.ilSkillUsageInfo.php");
62 $this->title = $a_val;
82 $this->description = $a_val;
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
119 foreach ($this->skill_level as $k => $sl)
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)
125 unset($this->skill_level[$k]);
151 $set = $ilDB->query(
"SELECT * FROM skl_profile ".
152 " WHERE id = ".$ilDB->quote($this->getId(),
"integer")
154 $rec = $ilDB->fetchAssoc($set);
158 $set = $ilDB->query(
"SELECT * FROM skl_profile_level ".
159 " WHERE profile_id = ".$ilDB->quote($this->getId(),
"integer")
161 while ($rec = $ilDB->fetchAssoc($set))
163 $this->
addSkillLevel((
int) $rec[
"base_skill_id"], (
int) $rec[
"tref_id"],
164 (
int) $rec[
"level_id"]);
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").
185 foreach ($this->skill_level as $level)
187 $ilDB->replace(
"skl_profile_level",
189 "tref_id" =>
array(
"integer", (
int) $level[
"tref_id"]),
190 "base_skill_id" =>
array(
"integer", (
int) $level[
"base_skill_id"])
192 array(
"level_id" =>
array(
"integer", (
int) $level[
"level_id"]))
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")
212 $ilDB->manipulate(
"DELETE FROM skl_profile_level WHERE ".
213 " profile_id = ".$ilDB->quote($this->getId(),
"integer")
215 foreach ($this->skill_level as $level)
217 $ilDB->replace(
"skl_profile_level",
219 "tref_id" =>
array(
"integer", (
int) $level[
"tref_id"]),
220 "base_skill_id" =>
array(
"integer", (
int) $level[
"base_skill_id"])
222 array(
"level_id" =>
array(
"integer", (
int) $level[
"level_id"]))
243 $ilDB->manipulate(
"DELETE FROM skl_profile_level WHERE ".
244 " profile_id = ".$ilDB->quote($this->getId(),
"integer")
248 $ilDB->manipulate(
"DELETE FROM skl_profile WHERE ".
249 " id = ".$ilDB->quote($this->getId(),
"integer")
264 $set = $ilDB->query(
"SELECT * FROM skl_profile ".
268 while ($rec = $ilDB->fetchAssoc($set))
270 $profiles[$rec[
"id"]] = $rec;
282 static protected function lookup($a_id, $a_field)
286 $set = $ilDB->query(
"SELECT ".$a_field.
" FROM skl_profile ".
287 " WHERE id = ".$ilDB->quote($a_id,
"integer")
289 $rec = $ilDB->fetchAssoc($set);
290 return $rec[$a_field];
301 return self::lookup($a_id,
"title");
315 $set = $ilDB->query(
"SELECT * FROM skl_profile_user ".
316 " WHERE profile_id = ".$ilDB->quote($this->getId(),
"integer")
319 while ($rec = $ilDB->fetchAssoc($set))
322 $users[$rec[
"user_id"]] =
array(
323 "lastname" => $name[
"lastname"],
324 "firstname" => $name[
"firstname"],
325 "login" => $name[
"login"],
326 "id" => $name[
"user_id"]
341 $ilDB->replace(
"skl_profile_user",
343 "user_id" =>
array(
"integer", (
int) $a_user_id),
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")
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" 379 while ($rec = $ilDB->fetchAssoc($set))
393 $set = $ilDB->query(
"SELECT count(*) ucnt FROM skl_profile_user ".
394 " WHERE profile_id = ".$ilDB->quote($a_profile_id,
"integer")
396 $rec = $ilDB->fetchAssoc($set);
397 return (
int) $rec[
"ucnt"];
410 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
412 "skl_profile_level",
"profile_id",
"base_skill_id");
Get info on usages of skills.
static _lookupName($a_user_id)
lookup user name
static getProfiles()
Get profiles.
setTitle($a_val)
Set title.
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.
Create styles array
The data for the language used.
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.
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.