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",
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"])
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",
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"])
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];
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",
342 array(
"profile_id" => array(
"integer", $this->
getId()),
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");