16 $db = $ilSetting->get(
"patch_stex_db");
21 $ilDB->createTable(
"exc_assignment",
24 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
27 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
29 "time_stamp" => array(
30 "type" =>
"integer",
"length" => 4,
"notnull" =>
false
32 "instruction" => array(
38 $ilDB->addPrimaryKey(
"exc_assignment", array(
"id"));
40 $ilDB->createSequence(
"exc_assignment");
42 $ilSetting->set(
"patch_stex_db", 1);
48 $ilDB->createTable(
"exc_mem_ass_status",
51 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
54 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
57 "type" =>
"text",
"length" => 4000,
"notnull" =>
false
60 "type" =>
"integer",
"length" => 1,
"notnull" =>
true,
"default" => 0
63 "type" =>
"integer",
"length" => 1,
"notnull" =>
false
65 "status_time" => array(
66 "type" =>
"timestamp",
"notnull" =>
false
69 "type" =>
"integer",
"length" => 1,
"notnull" =>
false
72 "type" =>
"timestamp",
"notnull" =>
false
74 "feedback_time" => array(
75 "type" =>
"timestamp",
"notnull" =>
false
78 "type" =>
"integer",
"length" => 1,
"notnull" =>
true,
"default" => 0
81 "type" =>
"text",
"length" => 9,
"fixed" =>
true,
"default" =>
"notgraded",
"notnull" =>
false
86 $ilDB->addPrimaryKey(
"exc_mem_ass_status", array(
"ass_id",
"usr_id"));
88 $ilSetting->set(
"patch_stex_db", 2);
96 $ilDB->addTableColumn(
"exc_returned",
98 array(
"type" =>
"integer",
"length" => 4,
"notnull" =>
false));
100 $ilSetting->set(
"patch_stex_db", 3);
106 $ilDB->createTable(
"exc_mem_tut_status",
109 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
112 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
115 "type" =>
"integer",
"length" => 4,
"notnull" =>
true
117 "download_time" => array(
118 "type" =>
"timestamp"
123 $ilSetting->set(
"patch_stex_db", 4);
129 $ilDB->addPrimaryKey(
"exc_mem_tut_status", array(
"ass_id",
"mem_id",
"tut_id"));
131 $ilSetting->set(
"patch_stex_db", 5);
137 $set = $ilDB->query(
"SELECT * FROM exc_data");
138 while ($rec = $ilDB->fetchAssoc($set))
142 $next_id = $ilDB->nextId(
"exc_assignment");
143 $ilDB->insert(
"exc_assignment", array(
144 "id" => array(
"integer", $next_id),
145 "exc_id" => array(
"integer", $rec[
"obj_id"]),
146 "time_stamp" => array(
"integer", $rec[
"time_stamp"]),
147 "instruction" => array(
"clob", $rec[
"instruction"])
151 $ilSetting->set(
"patch_stex_db", 6);
157 $ilDB->addIndex(
"exc_members", array(
"obj_id"),
"ob");
158 $ilSetting->set(
"patch_stex_db", 7);
164 $set = $ilDB->query(
"SELECT id, exc_id FROM exc_assignment");
165 while ($rec = $ilDB->fetchAssoc($set))
167 $set2 = $ilDB->query(
"SELECT * FROM exc_members ".
168 " WHERE obj_id = ".$ilDB->quote($rec[
"exc_id"],
"integer")
170 while ($rec2 = $ilDB->fetchAssoc($set2))
172 $ilDB->manipulate(
"INSERT INTO exc_mem_ass_status ".
173 "(ass_id, usr_id, notice, returned, solved, status_time, sent, sent_time,".
174 "feedback_time, feedback, status) VALUES (".
175 $ilDB->quote($rec[
"id"],
"integer").
",".
176 $ilDB->quote($rec2[
"usr_id"],
"integer").
",".
177 $ilDB->quote($rec2[
"notice"],
"text").
",".
178 $ilDB->quote($rec2[
"returned"],
"integer").
",".
179 $ilDB->quote($rec2[
"solved"],
"integer").
",".
180 $ilDB->quote($rec2[
"status_time"],
"timestamp").
",".
181 $ilDB->quote($rec2[
"sent"],
"integer").
",".
182 $ilDB->quote($rec2[
"sent_time"],
"timestamp").
",".
183 $ilDB->quote($rec2[
"feedback_time"],
"timestamp").
",".
184 $ilDB->quote($rec2[
"feedback"],
"integer").
",".
185 $ilDB->quote($rec2[
"status"],
"text").
189 $ilSetting->set(
"patch_stex_db", 8);
195 $ilDB->addIndex(
"exc_usr_tutor", array(
"obj_id"),
"ob");
196 $ilSetting->set(
"patch_stex_db", 9);
202 $set = $ilDB->query(
"SELECT id, exc_id FROM exc_assignment");
203 while ($rec = $ilDB->fetchAssoc($set))
205 $set2 = $ilDB->query(
"SELECT * FROM exc_usr_tutor ".
206 " WHERE obj_id = ".$ilDB->quote($rec[
"exc_id"],
"integer")
208 while ($rec2 = $ilDB->fetchAssoc($set2))
210 $ilDB->manipulate(
"INSERT INTO exc_mem_tut_status ".
211 "(ass_id, mem_id, tut_id, download_time) VALUES (".
212 $ilDB->quote($rec[
"id"],
"integer").
",".
213 $ilDB->quote($rec2[
"usr_id"],
"integer").
",".
214 $ilDB->quote($rec2[
"tutor_id"],
"integer").
",".
215 $ilDB->quote($rec2[
"download_time"],
"timestamp").
219 $ilSetting->set(
"patch_stex_db", 10);
225 $set = $ilDB->query(
"SELECT id, exc_id FROM exc_assignment");
226 while ($rec = $ilDB->fetchAssoc($set))
228 $ilDB->manipulate(
"UPDATE exc_returned SET ".
229 " ass_id = ".$ilDB->quote($rec[
"id"],
"integer").
230 " WHERE obj_id = ".$ilDB->quote($rec[
"exc_id"],
"integer")
233 $ilSetting->set(
"patch_stex_db", 11);
239 $ilDB->addTableColumn(
"exc_assignment",
241 array(
"type" =>
"text",
"length" => 200,
"notnull" =>
false));
243 $ilDB->addTableColumn(
"exc_assignment",
245 array(
"type" =>
"integer",
"length" => 4,
"notnull" =>
false));
247 $ilDB->addTableColumn(
"exc_assignment",
249 array(
"type" =>
"integer",
"length" => 1,
"notnull" =>
false,
"default" => 0));
251 $ilSetting->set(
"patch_stex_db", 12);
257 $ilDB->addTableColumn(
"exc_data",
259 array(
"type" =>
"text",
"length" => 8,
"fixed" =>
false,
260 "notnull" =>
true,
"default" =>
"all"));
262 $ilDB->addTableColumn(
"exc_data",
264 array(
"type" =>
"integer",
"length" => 4,
"notnull" =>
false));
266 $ilSetting->set(
"patch_stex_db", 13);
272 $ilDB->addTableColumn(
"exc_assignment",
274 array(
"type" =>
"integer",
"length" => 4,
"notnull" =>
true,
"default" => 0));
276 $ilSetting->set(
"patch_stex_db", 14);
282 $ilDB->addTableColumn(
"exc_data",
284 array(
"type" =>
"integer",
"length" => 1,
"notnull" =>
true,
"default" => 0));
286 $ilSetting->set(
"patch_stex_db", 15);
292 $new_ex_path = CLIENT_DATA_DIR.
"/ilExercise";
294 $old_ex_path = CLIENT_DATA_DIR.
"/exercise";
296 $old_ex_files = array();
298 if (is_dir($old_ex_path))
300 $dh_old_ex_path = opendir($old_ex_path);
305 while(
$file = readdir($dh_old_ex_path))
307 if(is_dir($old_ex_path.
"/".
$file))
312 $old_ex_files[$obj_id][] = array(
"full" =>
$file,
318 $set = $ilDB->query(
"SELECT id, exc_id FROM exc_assignment");
319 while ($rec = $ilDB->fetchAssoc($set))
322 if (is_array($old_ex_files[$rec[
"exc_id"]]))
324 foreach ($old_ex_files[$rec[
"exc_id"]] as
$file)
326 $old = $old_ex_path.
"/".$file[
"full"];
328 "/ass_".$rec[
"id"].
"/".$file[
"rest"];
341 if (is_dir($old_ex_path.
"/".$rec[
"exc_id"]))
343 $old = $old_ex_path.
"/".$rec[
"exc_id"];
354 $ilSetting->set(
"patch_stex_db", 16);
361 $ilDB->addTableColumn(
"exc_usr_tutor",
363 array(
"type" =>
"integer",
"length" => 4,
"notnull" =>
false));
365 $ilSetting->set(
"patch_stex_db", 17);
371 $set = $ilDB->query(
"SELECT id, exc_id FROM exc_assignment");
372 while ($rec = $ilDB->fetchAssoc($set))
374 $ilDB->manipulate(
"UPDATE exc_usr_tutor SET ".
375 " ass_id = ".$ilDB->quote($rec[
"id"],
"integer").
376 " WHERE obj_id = ".$ilDB->quote($rec[
"exc_id"],
"integer")
379 $ilSetting->set(
"patch_stex_db", 18);
386 $ilSetting->set(
"patch_stex_db", 19);
392 $ilDB->addTableColumn(
"exc_mem_ass_status",
394 array(
"type" =>
"text",
"length" => 32,
"notnull" =>
false));
395 $ilDB->addTableColumn(
"exc_mem_ass_status",
397 array(
"type" =>
"text",
"length" => 1000,
"notnull" =>
false));
399 $set = $ilDB->query(
"SELECT id, exc_id FROM exc_assignment");
400 while ($rec = $ilDB->fetchAssoc($set))
402 $set2 = $ilDB->query(
"SELECT * FROM ut_lp_marks WHERE obj_id = ".$ilDB->quote($rec[
"exc_id"],
"integer"));
403 while ($rec2 = $ilDB->fetchAssoc($set2))
405 $set3 = $ilDB->query(
"SELECT ass_id FROM exc_mem_ass_status WHERE ".
406 "ass_id = ".$ilDB->quote($rec[
"id"],
"integer").
407 " AND usr_id = ".$ilDB->quote($rec2[
"usr_id"],
"integer"));
408 if ($rec3 = $ilDB->fetchAssoc($set3))
410 $ilDB->manipulate(
"UPDATE exc_mem_ass_status SET ".
411 " mark = ".$ilDB->quote($rec2[
"mark"],
"text").
",".
412 " u_comment = ".$ilDB->quote($rec2[
"u_comment"],
"text").
413 " WHERE ass_id = ".$ilDB->quote($rec[
"id"],
"integer").
414 " AND usr_id = ".$ilDB->quote($rec2[
"usr_id"],
"integer")
419 $ilDB->manipulate(
"INSERT INTO exc_mem_ass_status (ass_id, usr_id, mark, u_comment) VALUES (".
420 $ilDB->quote($rec[
"id"],
"integer").
", ".
421 $ilDB->quote($rec2[
"usr_id"],
"integer").
", ".
422 $ilDB->quote($rec2[
"mark"],
"text").
", ".
423 $ilDB->quote($rec2[
"u_comment"],
"text").
")"
429 $ilSetting->set(
"patch_stex_db", 20);
435 $ilDB->dropPrimaryKey(
"exc_usr_tutor");
436 $ilDB->addPrimaryKey(
"exc_usr_tutor",
437 array(
"ass_id",
"usr_id",
"tutor_id"));
438 $ilSetting->set(
"patch_stex_db", 21);
444 $ilDB->dropTable(
"exc_mem_tut_status");
445 $ilSetting->set(
"patch_stex_db", 22);
452 $ilSetting->set(
"patch_stex_db", 23);
466 $num = $a_container_id;
467 for($i = $max_exponent; $i > 0;$i--)
469 $factor = pow($st_factor, $i);
470 if(($tmp = (
int) ($num / $factor)) or $found)
473 $num = $num % $factor;
480 $path_string = (implode(
'/',
$path).
'/');
482 return $path_string.$a_name.
'_'.$a_container_id;
489 $this->reload_control_structure =
true;
494 global
$ilDB, $ilClientIniFile;
496 if ($this->reload_control_structure)
498 include_once(
"./Services/Database/classes/class.ilDBUpdate.php");
500 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
502 $GLOBALS[
"ilCtrlStructureReader"]->setIniFile($ilClientIniFile);
503 $GLOBALS[
"ilCtrlStructureReader"]->getStructure();
505 $update->loadXMLInfo();