5 include_once(
"./Services/Skill/interfaces/interface.ilSkillUsageInfo.php");
26 include_once
"Services/Skill/classes/class.ilSkillTreeNode.php";
28 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
31 $set = $ilDB->query(
"SELECT * FROM skl_personal_skill ".
32 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer")
35 while ($rec = $ilDB->fetchAssoc($set))
37 if ($stree->isInTree($rec[
"skill_node_id"]))
39 $pskills[$rec[
"skill_node_id"]] = array(
"skill_node_id" => $rec[
"skill_node_id"],
56 $set = $ilDB->query(
"SELECT * FROM skl_personal_skill ".
57 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
58 " AND skill_node_id = ".$ilDB->quote($a_skill_node_id,
"integer")
60 if (!$ilDB->fetchAssoc($set))
62 $ilDB->manipulate(
"INSERT INTO skl_personal_skill ".
63 "(user_id, skill_node_id) VALUES (".
64 $ilDB->quote($a_user_id,
"integer").
",".
65 $ilDB->quote($a_skill_node_id,
"integer").
80 $ilDB->manipulate(
"DELETE FROM skl_personal_skill WHERE ".
81 " user_id = ".$ilDB->quote($a_user_id,
"integer").
82 " AND skill_node_id = ".$ilDB->quote($a_skill_node_id,
"integer")
102 static function assignMaterial($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level, $a_wsp_id)
106 $set = $ilDB->query(
"SELECT * FROM skl_assigned_material ".
107 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
108 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
109 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
110 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer").
111 " AND level_id = ".$ilDB->quote($a_level,
"integer").
112 " AND wsp_id = ".$ilDB->quote($a_wsp_id,
"integer")
114 if (!$ilDB->fetchAssoc($set))
116 $ilDB->manipulate(
"INSERT INTO skl_assigned_material ".
117 "(user_id, top_skill_id, tref_id, skill_id, level_id, wsp_id) VALUES (".
118 $ilDB->quote($a_user_id,
"integer").
",".
119 $ilDB->quote($a_top_skill,
"integer").
",".
120 $ilDB->quote((
int) $a_tref_id,
"integer").
",".
121 $ilDB->quote($a_basic_skill,
"integer").
",".
122 $ilDB->quote($a_level,
"integer").
",".
123 $ilDB->quote($a_wsp_id,
"integer").
139 $set = $ilDB->query(
"SELECT * FROM skl_assigned_material ".
140 " WHERE level_id = ".$ilDB->quote($a_level,
"integer").
141 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
142 " AND user_id = ".$ilDB->quote($a_user_id,
"integer")
145 while ($rec = $ilDB->fetchAssoc($set))
163 $set = $ilDB->query(
"SELECT count(*) as cnt FROM skl_assigned_material ".
164 " WHERE level_id = ".$ilDB->quote($a_level,
"integer").
165 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
166 " AND user_id = ".$ilDB->quote($a_user_id,
"integer")
168 $rec = $ilDB->fetchAssoc($set);
182 $t =
"DELETE FROM skl_assigned_material WHERE ".
183 " user_id = ".$ilDB->quote($a_user_id,
"integer").
184 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
185 " AND level_id = ".$ilDB->quote($a_level_id,
"integer").
186 " AND wsp_id = ".$ilDB->quote($a_wsp_id,
"integer");
188 $ilDB->manipulate(
$t);
208 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
215 $set = $ilDB->query(
"SELECT * FROM skl_self_eval_level ".
216 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
217 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
218 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
219 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer"));
220 if (!$ilDB->fetchAssoc($set))
222 $ilDB->manipulate(
"INSERT INTO skl_self_eval_level ".
223 "(user_id, top_skill_id, tref_id, skill_id, level_id, last_update) VALUES (".
224 $ilDB->quote($a_user_id,
"integer").
",".
225 $ilDB->quote($a_top_skill,
"integer").
",".
226 $ilDB->quote((
int) $a_tref_id,
"integer").
",".
227 $ilDB->quote($a_basic_skill,
"integer").
",".
228 $ilDB->quote($a_level,
"integer").
",".
234 $ilDB->manipulate(
"UPDATE skl_self_eval_level SET ".
235 " level_id = ".$ilDB->quote($a_level,
"integer").
", ".
236 " last_update = ".$ilDB->quote(
ilUtil::now(),
"timestamp").
237 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
238 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
239 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
240 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer"));
257 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
259 return $bs->getLastLevelPerObject($a_tref_id, 0, $a_user_id, 1);
261 $set = $ilDB->query(
"SELECT level_id FROM skl_self_eval_level ".
262 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
263 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
264 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
265 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer")
267 $rec = $ilDB->fetchAssoc($set);
269 return (
int) $rec[
"level_id"];
285 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
287 return $bs->getLastUpdatePerObject($a_tref_id, 0, $a_user_id, 1);
289 $set = $ilDB->query(
"SELECT last_update FROM skl_self_eval_level ".
290 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
291 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
292 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
293 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer")
295 $rec = $ilDB->fetchAssoc($set);
297 return $rec[
"last_update"];
311 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
313 "skl_assigned_material",
"user_id");
317 "skl_self_eval_level",
"user_id");
320 $pskill_ids = array();
322 foreach ($a_cskill_ids as $cs)
324 if ($cs[
"tref_id"] > 0)
326 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
329 $pskill_ids[$cs[
"tref_id"]] = $cs[
"tref_id"];
330 $tref_ids[(int) $cs[
"tref_id"]] = $cs[
"skill_id"];
335 $pskill_ids[$cs[
"skill_id"]] = $cs[
"skill_id"];
338 $set = $ilDB->query(
"SELECT skill_node_id, user_id FROM skl_personal_skill ".
339 " WHERE ".$ilDB->in(
"skill_node_id", $pskill_ids,
false,
"integer").
340 " GROUP BY skill_node_id, user_id"
342 while ($rec = $ilDB->fetchAssoc($set))
344 if (isset($tref_ids[(
int) $rec[
"skill_node_id"]]))
347 array(
"key" => $rec[
"user_id"]);
352 array(
"key" => $rec[
"user_id"]);