4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
32 return array(
"4.1.0",
"4.4.0",
"5.0.0",
"5.1.0",
"5.2.0",
"5.3.0");
43 return "http://www.ilias.de/xml/Modules/Exercise/" . $a_entity;
52 protected function getTypes($a_entity, $a_version)
54 if ($a_entity ==
"exc") {
60 "Description" =>
"text",
62 "PassNr" =>
"integer",
63 "ShowSubmissions" =>
"integer" 72 "Description" =>
"text",
74 "PassNr" =>
"integer",
75 "ShowSubmissions" =>
"integer",
76 "ComplBySubmission" =>
"integer" 84 "Description" =>
"text",
86 "PassNr" =>
"integer",
87 "ShowSubmissions" =>
"integer",
88 "ComplBySubmission" =>
"integer",
89 "Tfeedback" =>
"integer" 94 if ($a_entity ==
"exc_assignment") {
99 "ExerciseId" =>
"integer",
100 "Deadline" =>
"text",
101 "Instruction" =>
"text",
103 "Mandatory" =>
"integer",
104 "OrderNr" =>
"integer",
105 "Dir" =>
"directory");
110 "ExerciseId" =>
"integer",
112 "Deadline" =>
"integer",
113 "Instruction" =>
"text",
115 "Mandatory" =>
"integer",
116 "OrderNr" =>
"integer",
120 ,
"PeerMin" =>
"integer" 121 ,
"PeerDeadline" =>
"integer" 123 ,
"FeedbackFile" =>
"integer" 124 ,
"FeedbackCron" =>
"integer" 125 ,
"FeedbackDate" =>
"integer" 126 ,
"FeedbackDir" =>
"directory" 132 "ExerciseId" =>
"integer",
134 "Deadline" =>
"integer",
135 "Instruction" =>
"text",
137 "Mandatory" =>
"integer",
138 "OrderNr" =>
"integer",
142 ,
"PeerMin" =>
"integer" 143 ,
"PeerDeadline" =>
"integer" 144 ,
"PeerFile" =>
"integer" 145 ,
"PeerPersonal" =>
"integer" 147 ,
"FeedbackFile" =>
"integer" 148 ,
"FeedbackCron" =>
"integer" 149 ,
"FeedbackDate" =>
"integer" 150 ,
"FeedbackDir" =>
"directory" 157 "ExerciseId" =>
"integer",
159 "Deadline" =>
"integer",
160 "Deadline2" =>
"integer",
161 "Instruction" =>
"text",
163 "Mandatory" =>
"integer",
164 "OrderNr" =>
"integer",
165 "TeamTutor" =>
"integer",
166 "MaxFile" =>
"integer",
170 ,
"PeerMin" =>
"integer" 171 ,
"PeerDeadline" =>
"integer" 172 ,
"PeerFile" =>
"integer" 173 ,
"PeerPersonal" =>
"integer" 174 ,
"PeerChar" =>
"integer" 175 ,
"PeerUnlock" =>
"integer" 176 ,
"PeerValid" =>
"integer" 177 ,
"PeerText" =>
"integer" 178 ,
"PeerRating" =>
"integer" 179 ,
"PeerCritCat" =>
"integer" 181 ,
"FeedbackFile" =>
"integer" 182 ,
"FeedbackCron" =>
"integer" 183 ,
"FeedbackDate" =>
"integer" 184 ,
"FeedbackDir" =>
"directory" 189 "ExerciseId" =>
"integer",
191 "Deadline" =>
"integer",
192 "Deadline2" =>
"integer",
193 "Instruction" =>
"text",
195 "Mandatory" =>
"integer",
196 "OrderNr" =>
"integer",
197 "TeamTutor" =>
"integer",
198 "MaxFile" =>
"integer",
199 "Dir" =>
"directory",
201 "WebDataDir" =>
"directory" 204 ,
"PeerMin" =>
"integer" 205 ,
"PeerDeadline" =>
"integer" 206 ,
"PeerFile" =>
"integer" 207 ,
"PeerPersonal" =>
"integer" 208 ,
"PeerChar" =>
"integer" 209 ,
"PeerUnlock" =>
"integer" 210 ,
"PeerValid" =>
"integer" 211 ,
"PeerText" =>
"integer" 212 ,
"PeerRating" =>
"integer" 213 ,
"PeerCritCat" =>
"integer" 215 ,
"FeedbackFile" =>
"integer" 216 ,
"FeedbackCron" =>
"integer" 217 ,
"FeedbackDate" =>
"integer" 218 ,
"FeedbackDir" =>
"directory" 219 ,
"FbDateCustom" =>
"integer" 224 if ($a_entity ==
"exc_cit_cat") {
225 switch ($a_version) {
231 ,
"Parent" =>
"integer" 238 if ($a_entity ==
"exc_cit") {
239 switch ($a_version) {
245 ,
"Parent" =>
"integer" 250 ,
"Required" =>
"integer" 257 if ($a_entity ==
"exc_ass_file_order") {
258 switch ($a_version) {
262 ,
"AssignmentId" =>
"integer" 263 ,
"Filename" =>
"text" 264 ,
"OrderNr" =>
"integer" 269 if ($a_entity ==
"exc_ass_reminders") {
270 switch ($a_version) {
274 "AssignmentId" =>
"integer",
275 "ExerciseId" =>
"integer",
276 "Status" =>
"integer",
277 "Start" =>
"integer",
279 "Frequency" =>
"integer",
280 "LastSend" =>
"integer",
281 "TemplateId" =>
"integer" 294 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
298 if (!is_array($a_ids)) {
299 $a_ids = array($a_ids);
302 if ($a_entity ==
"exc") {
303 switch ($a_version) {
306 " pass_mode, pass_nr, show_submissions" .
307 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
308 " WHERE " .
$ilDB->in(
"exc_data.obj_id", $a_ids,
false,
"integer"));
315 " pass_mode, pass_nr, show_submissions, compl_by_submission" .
316 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
317 " WHERE " .
$ilDB->in(
"exc_data.obj_id", $a_ids,
false,
"integer"));
323 " pass_mode, pass_nr, show_submissions, compl_by_submission, tfeedback" .
324 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
325 " WHERE " .
$ilDB->in(
"exc_data.obj_id", $a_ids,
false,
"integer"));
330 if ($a_entity ==
"exc_assignment") {
331 switch ($a_version) {
334 " instruction, title, start_time, mandatory, order_nr" .
335 " FROM exc_assignment" .
336 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
341 " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
342 " fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
343 " FROM exc_assignment" .
344 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
349 " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
350 " peer_file, peer_prsl peer_personal, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
351 " FROM exc_assignment" .
352 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
359 " instruction, title, start_time, mandatory, order_nr, team_tutor, max_file, peer, peer_min," .
360 " peer_dl peer_deadline, peer_file, peer_prsl peer_personal, peer_char, peer_unlock, peer_valid," .
361 " peer_text, peer_rating, peer_crit_cat, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date," .
363 " FROM exc_assignment" .
364 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
369 if ($a_entity ==
"exc_crit_cat") {
370 switch ($a_version) {
375 " FROM exc_crit_cat" .
376 " WHERE " .
$ilDB->in(
"parent", $a_ids,
false,
"integer"));
381 if ($a_entity ==
"exc_crit") {
382 switch ($a_version) {
387 ", descr, pos, required, def" .
389 " WHERE " .
$ilDB->in(
"parent", $a_ids,
false,
"integer"));
390 foreach ($this->
data as $k => $v) {
391 $this->
data[$k][
"DefJson"] =
"";
392 if ($v[
"Def"] !=
"") {
393 $this->
data[$k][
"DefJson"] = json_encode(unserialize($v[
"Def"]));
400 if ($a_entity ==
"exc_ass_file_order") {
401 switch ($a_version) {
404 " FROM exc_ass_file_order" .
405 " WHERE " .
$ilDB->in(
"assignment_id", $a_ids,
false,
"integer"));
410 if ($a_entity ==
"exc_ass_reminders") {
411 switch ($a_version) {
413 $this->
getDirectDataFromQuery(
"SELECT type, ass_id, exc_id, status, start, end, freq, last_send, template_id" .
414 " FROM exc_ass_reminders" .
415 " WHERE " .
$ilDB->in(
"ass_id", $a_ids,
false,
"integer"));
429 if ($a_entity ==
"exc_assignment") {
431 if ($a_set[
"StartTime"] !=
"") {
435 if ($a_set[
"Deadline"] !=
"") {
439 if ($a_set[
"Deadline2"] !=
"") {
444 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
446 $a_set[
"Dir"] = $fstorage->getPath();
448 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
450 $a_set[
"FeedbackDir"] = $fstorage->getGlobalFeedbackPath();
453 include_once(
"./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
455 $a_set[
'WebDataDir'] = $fswebstorage->getPath();
459 if ($a_entity ==
"exc_ass_reminders") {
460 if ($a_set[
"End"] !=
"") {
464 if ($a_set[
"LastSend"] !=
"") {
481 switch ($a_version) {
486 "exc_assignment" => array(
"ids" => $a_rec[
"Id"])
493 "exc_crit_cat" => array(
"ids" => $a_rec[
"Id"]),
494 "exc_assignment" => array(
"ids" => $a_rec[
"Id"])
501 "exc_crit" => array(
"ids" => $a_rec[
"Id"])
504 case "exc_assignment":
505 switch ($a_version) {
508 "exc_ass_file_order" => array(
"ids" => $a_rec[
"Id"]),
509 "exc_ass_reminders" => array(
"ids" => $a_rec[
"Id"])
525 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
532 include_once(
"./Modules/Exercise/classes/class.ilObjExercise.php");
534 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
538 $newObj->setType(
"exc");
539 $newObj->create(
true);
542 $newObj->setTitle($a_rec[
"Title"]);
543 $newObj->setDescription($a_rec[
"Description"]);
544 $newObj->setPassMode($a_rec[
"PassMode"]);
545 $newObj->setPassNr($a_rec[
"PassNr"]);
546 $newObj->setShowSubmissions($a_rec[
"ShowSubmissions"]);
547 $newObj->setCompletionBySubmission($a_rec[
"ComplBySubmission"]);
548 $newObj->setTutorFeedback($a_rec[
"Tfeedback"]);
551 $this->current_exc = $newObj;
553 $a_mapping->addMapping(
"Modules/Exercise",
"exc", $a_rec[
"Id"], $newObj->getId());
556 case "exc_assignment":
557 $exc_id = $a_mapping->getMapping(
"Modules/Exercise",
"exc", $a_rec[
"ExerciseId"]);
559 if (is_object($this->current_exc) && $this->current_exc->getId() == $exc_id) {
560 $exc = $this->current_exc;
562 include_once(
"./Modules/Exercise/classes/class.ilObjExercise.php");
566 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
569 $ass->setExerciseId($exc_id);
571 if ($a_rec[
"StartTime"] !=
"") {
576 if ($a_rec[
"Deadline"] !=
"") {
581 $ass->setInstruction($a_rec[
"Instruction"]);
582 $ass->setTitle($a_rec[
"Title"]);
583 $ass->setMandatory($a_rec[
"Mandatory"]);
584 $ass->setOrderNr($a_rec[
"OrderNr"]);
587 $ass->setType($a_rec[
"Type"]);
590 $ass->setPeerReview($a_rec[
"Peer"]);
591 $ass->setPeerReviewMin($a_rec[
"PeerMin"]);
592 $ass->setPeerReviewDeadline($a_rec[
"PeerDeadline"]);
593 $ass->setFeedbackFile($a_rec[
"FeedbackFile"]);
594 $ass->setFeedbackCron($a_rec[
"FeedbackCron"]);
595 $ass->setFeedbackDate($a_rec[
"FeedbackDate"]);
598 $ass->setPeerReviewFileUpload($a_rec[
"PeerFile"]);
599 $ass->setPeerReviewPersonalized($a_rec[
"PeerPersonal"]);
602 if ($a_rec[
"Deadline2"] !=
"") {
604 $ass->setExtendedDeadline($deadline->get(
IL_CAL_UNIX));
606 $ass->setMaxFile($a_rec[
"MaxFile"]);
607 $ass->setTeamTutor($a_rec[
"TeamTutor"]);
608 $ass->setPeerReviewChars($a_rec[
"PeerChar"]);
609 $ass->setPeerReviewSimpleUnlock($a_rec[
"PeerUnlock"]);
610 $ass->setPeerReviewValid($a_rec[
"PeerValid"]);
611 $ass->setPeerReviewText($a_rec[
"PeerText"]);
612 $ass->setPeerReviewRating($a_rec[
"PeerRating"]);
615 $ass->setFeedbackDateCustom($a_rec[
"FbDateCustom"]);
618 if ($a_rec[
"PeerCritCat"]) {
619 $ass->setPeerReviewCriteriaCatalogue($a_mapping->getMapping(
"Modules/Exercise",
"exc_crit_cat", $a_rec[
"PeerCritCat"]));
624 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
629 $dir = str_replace(
"..",
"", $a_rec[
"Dir"]);
632 $target_dir = $fstorage->getPath();
637 $dir = str_replace(
"..",
"", $a_rec[
"FeedbackDir"]);
640 $target_dir = $fstorage->getGlobalFeedbackPath();
645 include_once(
"./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
648 $dir = str_replace(
"..",
"", $a_rec[
"WebDataDir"]);
651 $target_dir = $fwebstorage->getPath();
658 $ar->setId($ass->getId());
659 $ar->setTemplateRefId(0);
660 $ar->setContainerRefId(0);
664 $a_mapping->addMapping(
"Modules/Exercise",
"exc_assignment", $a_rec[
"Id"], $ass->getId());
670 $exc_id = $a_mapping->getMapping(
"Modules/Exercise",
"exc", $a_rec[
"Parent"]);
672 include_once(
"./Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php");
674 $crit_cat->setParent($exc_id);
675 $crit_cat->setTitle($a_rec[
"Title"]);
676 $crit_cat->setPosition($a_rec[
"Pos"]);
679 $a_mapping->addMapping(
"Modules/Exercise",
"exc_crit_cat", $a_rec[
"Id"], $crit_cat->getId());
684 $crit_cat_id = $a_mapping->getMapping(
"Modules/Exercise",
"exc_crit_cat", $a_rec[
"Parent"]);
685 if ($crit_cat_id > 0) {
686 include_once(
"./Modules/Exercise/classes/class.ilExcCriteria.php");
688 $crit->setParent($crit_cat_id);
689 $crit->setTitle($a_rec[
"Title"]);
690 $crit->setDescription($a_rec[
"Descr"]);
691 $crit->setPosition($a_rec[
"Pos"]);
692 $crit->setRequired($a_rec[
"Required"]);
693 $crit->importDefinition($a_rec[
"Def"], $a_rec[
"DefJson"]);
698 case "exc_ass_file_order":
700 $ass_id = $a_mapping->getMapping(
"Modules/Exercise",
"exc_assignment", $a_rec[
"AssignmentId"]);
706 case "exc_ass_reminders":
708 include_once(
"./Modules/Exercise/classes/class.ilExAssignmentReminder.php");
709 $new_ass_id = $a_mapping->getMapping(
"Modules/Exercise",
"exc_assignment", $a_rec[
"AssId"]);
710 $new_exc_id = $a_mapping->getMapping(
'Modules/Exercise',
'exc', $a_rec[
'ExcId']);
714 $rmd->setReminderStatus($a_rec[
"Status"]);
715 $rmd->setReminderStart($a_rec[
"Start"]);
717 $rmd->setReminderFrequency($a_rec[
"Freq"]);
718 $rmd->setReminderLastSend($a_rec[
"LastSend"]);
719 $rmd->setReminderMailTemplate($a_rec[
"TemplateId"]);
static getInstanceByType($a_type)
Class ilExcCriteriaCatalogue.
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static instructionFileInsertOrder($a_filename, $a_ass_id, $a_order_nr=0)
Store the file order in the database.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getTypes($a_entity, $a_version)
Get field types for entity.
getImportDirectory()
Get import directory.
Item group active record class.
getXmlRecord($a_entity, $a_version, $a_set)
Get xml record (export)
create()
Create directory.
TODO: import/export reminder data with the exercise/assignment.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
create()
Create directory.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getSupportedVersions()
Get supported versions.