24 include_once
"Services/Skill/classes/class.ilSkillTreeNode.php";
26 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
29 $set = $ilDB->query(
"SELECT * FROM skl_personal_skill ".
30 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer")
33 while ($rec = $ilDB->fetchAssoc($set))
35 if ($stree->isInTree($rec[
"skill_node_id"]))
37 $pskills[$rec[
"skill_node_id"]] = array(
"skill_node_id" => $rec[
"skill_node_id"],
54 $set = $ilDB->query(
"SELECT * FROM skl_personal_skill ".
55 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
56 " AND skill_node_id = ".$ilDB->quote($a_skill_node_id,
"integer")
58 if (!$ilDB->fetchAssoc($set))
60 $ilDB->manipulate(
"INSERT INTO skl_personal_skill ".
61 "(user_id, skill_node_id) VALUES (".
62 $ilDB->quote($a_user_id,
"integer").
",".
63 $ilDB->quote($a_skill_node_id,
"integer").
78 $ilDB->manipulate(
"DELETE FROM skl_personal_skill WHERE ".
79 " user_id = ".$ilDB->quote($a_user_id,
"integer").
80 " AND skill_node_id = ".$ilDB->quote($a_skill_node_id,
"integer")
100 static function assignMaterial($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill, $a_level, $a_wsp_id)
104 $set = $ilDB->query(
"SELECT * FROM skl_assigned_material ".
105 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
106 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
107 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
108 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer").
109 " AND level_id = ".$ilDB->quote($a_level,
"integer").
110 " AND wsp_id = ".$ilDB->quote($a_wsp_id,
"integer")
112 if (!$ilDB->fetchAssoc($set))
114 $ilDB->manipulate(
"INSERT INTO skl_assigned_material ".
115 "(user_id, top_skill_id, tref_id, skill_id, level_id, wsp_id) VALUES (".
116 $ilDB->quote($a_user_id,
"integer").
",".
117 $ilDB->quote($a_top_skill,
"integer").
",".
118 $ilDB->quote((
int) $a_tref_id,
"integer").
",".
119 $ilDB->quote($a_basic_skill,
"integer").
",".
120 $ilDB->quote($a_level,
"integer").
",".
121 $ilDB->quote($a_wsp_id,
"integer").
137 $set = $ilDB->query(
"SELECT * FROM skl_assigned_material ".
138 " WHERE level_id = ".$ilDB->quote($a_level,
"integer").
139 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
140 " AND user_id = ".$ilDB->quote($a_user_id,
"integer")
143 while ($rec = $ilDB->fetchAssoc($set))
161 $set = $ilDB->query(
"SELECT count(*) as cnt FROM skl_assigned_material ".
162 " WHERE level_id = ".$ilDB->quote($a_level,
"integer").
163 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
164 " AND user_id = ".$ilDB->quote($a_user_id,
"integer")
166 $rec = $ilDB->fetchAssoc($set);
180 $t =
"DELETE FROM skl_assigned_material WHERE ".
181 " user_id = ".$ilDB->quote($a_user_id,
"integer").
182 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
183 " AND level_id = ".$ilDB->quote($a_level_id,
"integer").
184 " AND wsp_id = ".$ilDB->quote($a_wsp_id,
"integer");
186 $ilDB->manipulate(
$t);
206 $set = $ilDB->query(
"SELECT * FROM skl_self_eval_level ".
207 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
208 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
209 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
210 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer"));
211 if (!$ilDB->fetchAssoc($set))
213 $ilDB->manipulate(
"INSERT INTO skl_self_eval_level ".
214 "(user_id, top_skill_id, tref_id, skill_id, level_id, last_update) VALUES (".
215 $ilDB->quote($a_user_id,
"integer").
",".
216 $ilDB->quote($a_top_skill,
"integer").
",".
217 $ilDB->quote((
int) $a_tref_id,
"integer").
",".
218 $ilDB->quote($a_basic_skill,
"integer").
",".
219 $ilDB->quote($a_level,
"integer").
",".
225 $ilDB->manipulate(
"UPDATE skl_self_eval_level SET ".
226 " level_id = ".$ilDB->quote($a_level,
"integer").
", ".
227 " last_update = ".$ilDB->quote(
ilUtil::now(),
"timestamp").
228 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
229 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
230 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
231 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer"));
248 $set = $ilDB->query(
"SELECT level_id FROM skl_self_eval_level ".
249 " WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
250 " AND top_skill_id = ".$ilDB->quote($a_top_skill,
"integer").
251 " AND tref_id = ".$ilDB->quote((
int) $a_tref_id,
"integer").
252 " AND skill_id = ".$ilDB->quote($a_basic_skill,
"integer")
254 $rec = $ilDB->fetchAssoc($set);
256 return (
int) $rec[
"level_id"];