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) {
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) {
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()
255 "DELETE FROM skl_profile_level WHERE " .
256 " profile_id = " .
$ilDB->quote($this->getId(),
"integer")
261 "DELETE FROM skl_profile WHERE " .
262 " id = " .
$ilDB->quote($this->getId(),
"integer")
276 $ilDB = $DIC->database();
279 "SELECT * FROM skl_profile " .
283 while ($rec =
$ilDB->fetchAssoc($set)) {
284 $profiles[$rec[
"id"]] = $rec;
296 protected static function lookup($a_id, $a_field)
300 $ilDB = $DIC->database();
303 "SELECT " . $a_field .
" FROM skl_profile " .
304 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
306 $rec =
$ilDB->fetchAssoc($set);
307 return $rec[$a_field];
318 return self::lookup($a_id,
"title");
333 "SELECT * FROM skl_profile_user " .
334 " WHERE profile_id = " .
$ilDB->quote($this->getId(),
"integer")
337 while ($rec =
$ilDB->fetchAssoc($set)) {
340 "lastname" =>
$name[
"lastname"],
341 "firstname" =>
$name[
"firstname"],
342 "login" =>
$name[
"login"],
343 "id" =>
$name[
"user_id"]
361 "user_id" =>
array(
"integer", (
int) $a_user_id),
377 "DELETE FROM skl_profile_user WHERE " .
378 " profile_id = " .
$ilDB->quote($this->getId(),
"integer") .
379 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer")
391 $ilDB = $DIC->database();
394 "DELETE FROM skl_profile_user WHERE " .
395 " user_id = " .
$ilDB->quote($a_user_id,
"integer")
409 $ilDB = $DIC->database();
413 "SELECT p.id, p.title FROM skl_profile_user u JOIN skl_profile p " .
414 " ON (u.profile_id = p.id) " .
415 " WHERE user_id = " .
$ilDB->quote($a_user_id,
"integer") .
416 " ORDER BY p.title ASC" 418 while ($rec =
$ilDB->fetchAssoc($set)) {
431 $ilDB = $DIC->database();
434 "SELECT count(*) ucnt FROM skl_profile_user " .
435 " WHERE profile_id = " .
$ilDB->quote($a_profile_id,
"integer")
437 $rec =
$ilDB->fetchAssoc($set);
438 return (
int) $rec[
"ucnt"];
451 $ilDB = $DIC->database();
453 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.
Create styles array
The data for the language used.
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.