43 return array(
"4.1.0",
"4.4.0",
"5.0.0",
"5.1.0",
"5.2.0",
"5.3.0");
46 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
48 return "https://www.ilias.de/xml/Modules/Exercise/" . $a_entity;
51 protected function getTypes(
string $a_entity,
string $a_version): array
53 if ($a_entity ==
"exc") {
59 "Description" =>
"text",
61 "PassNr" =>
"integer",
62 "ShowSubmissions" =>
"integer" 71 "Description" =>
"text",
73 "PassNr" =>
"integer",
74 "ShowSubmissions" =>
"integer",
75 "ComplBySubmission" =>
"integer" 83 "Description" =>
"text",
85 "PassNr" =>
"integer",
86 "NrMandatoryRandom" =>
"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" 220 ,
"DeadlineMode" =>
"integer" 221 ,
"RelativeDeadline" =>
"integer" 222 ,
"RelDeadlineLastSubm" =>
"integer" 227 if ($a_entity ==
"exc_cit_cat") {
228 switch ($a_version) {
234 ,
"Parent" =>
"integer" 241 if ($a_entity ==
"exc_cit") {
242 switch ($a_version) {
248 ,
"Parent" =>
"integer" 253 ,
"Required" =>
"integer" 260 if ($a_entity ==
"exc_ass_file_order") {
261 switch ($a_version) {
265 ,
"AssignmentId" =>
"integer" 266 ,
"Filename" =>
"text" 267 ,
"OrderNr" =>
"integer" 272 if ($a_entity ==
"exc_ass_reminders") {
273 switch ($a_version) {
277 "AssignmentId" =>
"integer",
278 "ExerciseId" =>
"integer",
279 "Status" =>
"integer",
280 "Start" =>
"integer",
282 "Frequency" =>
"integer",
283 "LastSend" =>
"integer",
284 "TemplateId" =>
"integer" 291 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
295 if (!is_array($a_ids)) {
296 $a_ids = array($a_ids);
299 if ($a_entity ==
"exc") {
300 switch ($a_version) {
303 " pass_mode, pass_nr, show_submissions" .
304 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
305 " WHERE " .
$ilDB->in(
"exc_data.obj_id", $a_ids,
false,
"integer"));
312 " pass_mode, pass_nr, show_submissions, compl_by_submission" .
313 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
314 " WHERE " .
$ilDB->in(
"exc_data.obj_id", $a_ids,
false,
"integer"));
320 " pass_mode, pass_nr, show_submissions, compl_by_submission, tfeedback,nr_mandatory_random" .
321 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
322 " WHERE " .
$ilDB->in(
"exc_data.obj_id", $a_ids,
false,
"integer"));
327 if ($a_entity ==
"exc_assignment") {
328 switch ($a_version) {
331 " instruction, title, start_time, mandatory, order_nr" .
332 " FROM exc_assignment" .
333 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
338 " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
339 " fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
340 " FROM exc_assignment" .
341 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
346 " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
347 " peer_file, peer_prsl peer_personal, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
348 " FROM exc_assignment" .
349 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
356 " instruction, title, start_time, mandatory, order_nr, team_tutor, max_file, peer, peer_min," .
357 " peer_dl peer_deadline, peer_file, peer_prsl peer_personal, peer_char, peer_unlock, peer_valid," .
358 " peer_text, peer_rating, peer_crit_cat, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date," .
359 " fb_date_custom, rel_deadline_last_subm, deadline_mode, relative_deadline" .
360 " FROM exc_assignment" .
361 " WHERE " .
$ilDB->in(
"exc_id", $a_ids,
false,
"integer"));
366 if ($a_entity ==
"exc_crit_cat") {
367 switch ($a_version) {
372 " FROM exc_crit_cat" .
373 " WHERE " .
$ilDB->in(
"parent", $a_ids,
false,
"integer"));
378 if ($a_entity ==
"exc_crit") {
379 switch ($a_version) {
384 ", descr, pos, required, def" .
386 " WHERE " .
$ilDB->in(
"parent", $a_ids,
false,
"integer"));
387 foreach ($this->data as $k => $v) {
388 $this->data[$k][
"DefJson"] =
"";
389 if ($v[
"Def"] !=
"") {
390 $this->data[$k][
"DefJson"] = json_encode(unserialize($v[
"Def"], [
'allowed_classes' =>
false]));
397 if ($a_entity ==
"exc_ass_file_order") {
398 switch ($a_version) {
401 " FROM exc_ass_file_order" .
402 " WHERE " .
$ilDB->in(
"assignment_id", $a_ids,
false,
"integer"));
407 if ($a_entity ==
"exc_ass_reminders") {
408 switch ($a_version) {
410 $this->
getDirectDataFromQuery(
"SELECT type, ass_id, exc_id, status, start, end, freq, last_send, template_id" .
411 " FROM exc_ass_reminders" .
412 " WHERE " .
$ilDB->in(
"ass_id", $a_ids,
false,
"integer"));
421 public function getXmlRecord(
string $a_entity,
string $a_version, array $a_set): array
423 if ($a_entity ==
"exc_assignment") {
425 if ($a_set[
"StartTime"] !=
"") {
429 if ($a_set[
"Deadline"] !=
"") {
433 if ($a_set[
"Deadline2"] !=
"") {
439 $a_set[
"Dir"] = $fstorage->getAbsolutePath();
442 $a_set[
"FeedbackDir"] = $fstorage->getGlobalFeedbackPath();
446 $a_set[
'WebDataDir'] = $fswebstorage->getAbsolutePath();
450 if ($a_entity ==
"exc_ass_reminders") {
451 if ($a_set[
"End"] !=
"") {
455 if ($a_set[
"LastSend"] !=
"") {
467 ?array $a_rec = null,
472 switch ($a_version) {
477 "exc_assignment" => array(
"ids" => $a_rec[
"Id"] ?? null)
484 "exc_crit_cat" => array(
"ids" => $a_rec[
"Id"] ?? null),
485 "exc_assignment" => array(
"ids" => $a_rec[
"Id"] ?? null)
492 "exc_crit" => array(
"ids" => $a_rec[
"Id"] ?? null)
495 case "exc_assignment":
496 switch ($a_version) {
499 "exc_ass_file_order" => array(
"ids" => $a_rec[
"Id"] ?? null),
500 "exc_ass_reminders" => array(
"ids" => $a_rec[
"Id"] ?? null)
523 string $a_schema_version
525 $a_rec = $this->
stripTags($a_rec, [
"Instruction"]);
527 $a_rec[
"Instruction"] = $purifier->purify((
string) ($a_rec[
"Instruction"] ??
""));
531 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
535 $newObj->setType(
"exc");
539 $newObj->setTitle($a_rec[
"Title"]);
540 $newObj->setDescription($a_rec[
"Description"]);
541 $newObj->setPassMode($a_rec[
"PassMode"]);
542 $newObj->setPassNr((
int) $a_rec[
"PassNr"]);
543 $newObj->setNrMandatoryRandom((
int) $a_rec[
"NrMandatoryRandom"]);
544 $newObj->setShowSubmissions((
bool) (
int) $a_rec[
"ShowSubmissions"]);
545 $newObj->setCompletionBySubmission((
bool) (
int) $a_rec[
"ComplBySubmission"]);
546 $newObj->setTutorFeedback((
int) $a_rec[
"Tfeedback"]);
549 $this->current_exc = $newObj;
551 $a_mapping->
addMapping(
"Modules/Exercise",
"exc", $a_rec[
"Id"], $newObj->getId());
552 $a_mapping->
addMapping(
'Services/Object',
'objs', $a_rec[
'Id'], $newObj->getId());
553 $a_mapping->
addMapping(
'Services/AdvancedMetaData',
'parent', $a_rec[
'Id'], $newObj->getId());
557 $a_rec[
"Id"] .
":0:exc",
558 $newObj->getId() .
":0:exc" 562 case "exc_assignment":
563 $exc_id = $a_mapping->
getMapping(
"Modules/Exercise",
"exc", $a_rec[
"ExerciseId"]);
565 if (is_object($this->current_exc) && $this->current_exc->getId() == $exc_id) {
572 $ass->setExerciseId($exc_id);
574 if ($a_rec[
"StartTime"] !=
"") {
579 if ($a_rec[
"Deadline"] !=
"") {
584 $ass->setInstruction($a_rec[
"Instruction"] ??
"");
585 $ass->setTitle($a_rec[
"Title"] ??
"");
586 $ass->setMandatory((
bool) ($a_rec[
"Mandatory"] ??
false));
587 $ass->setOrderNr((
int) ($a_rec[
"OrderNr"] ?? 0));
590 $ass->setType((
int) ($a_rec[
"Type"] ?? 0));
593 $ass->setPeerReview((
bool) ($a_rec[
"Peer"] ??
false));
594 $ass->setPeerReviewMin((
int) ($a_rec[
"PeerMin"] ?? 0));
595 $ass->setPeerReviewDeadline((
int) $a_rec[
"PeerDeadline"]);
596 $ass->setFeedbackFile($a_rec[
"FeedbackFile"] ??
"");
597 $ass->setFeedbackCron((
bool) ($a_rec[
"FeedbackCron"] ??
false));
598 $ass->setFeedbackDate((
int) ($a_rec[
"FeedbackDate"] ?? 0));
601 $ass->setPeerReviewFileUpload((
bool) ($a_rec[
"PeerFile"] ??
false));
602 $ass->setPeerReviewPersonalized((
bool) ($a_rec[
"PeerPersonal"] ??
false));
605 if (($a_rec[
"Deadline2"] ??
"") !==
"") {
607 $ass->setExtendedDeadline($deadline->get(
IL_CAL_UNIX));
609 $ass->setMaxFile((
int) ($a_rec[
"MaxFile"] ?? 0));
610 $ass->setTeamTutor((
bool) ($a_rec[
"TeamTutor"] ??
false));
611 $ass->setPeerReviewChars((
int) ($a_rec[
"PeerChar"] ?? null));
612 $ass->setPeerReviewSimpleUnlock((
bool) ($a_rec[
"PeerUnlock"] ??
false));
613 $ass->setPeerReviewValid((
int) ($a_rec[
"PeerValid"] ?? 0));
614 $ass->setPeerReviewText((
bool) ($a_rec[
"PeerText"] ??
false));
615 $ass->setPeerReviewRating((
bool) ($a_rec[
"PeerRating"] ??
false));
618 $ass->setFeedbackDateCustom((
int) ($a_rec[
"FbDateCustom"] ?? 0));
619 $ass->setRelDeadlineLastSubmission((
int) ($a_rec[
"RelDeadlineLastSubm"] ?? 0));
620 $ass->setDeadlineMode((
int) ($a_rec[
"DeadlineMode"] ?? 0));
621 $ass->setRelativeDeadline((
int) ($a_rec[
"RelativeDeadline"] ?? 0));
624 if ($a_rec[
"PeerCritCat"]) {
625 $ass->setPeerReviewCriteriaCatalogue((
int) $a_mapping->
getMapping(
"Modules/Exercise",
"exc_crit_cat", $a_rec[
"PeerCritCat"]));
634 $dir = str_replace(
"..",
"", $a_rec[
"Dir"]);
637 $target_dir = $fstorage->getAbsolutePath();
642 $dir = str_replace(
"..",
"", $a_rec[
"FeedbackDir"]);
645 $target_dir = $fstorage->getGlobalFeedbackPath();
652 $dir = str_replace(
"..",
"", $a_rec[
"WebDataDir"]);
655 $target_dir = $fwebstorage->getAbsolutePath();
662 $ar->setId($ass->getId());
663 $ar->setTemplateRefId(0);
664 $ar->setContainerRefId(0);
668 $a_mapping->
addMapping(
"Modules/Exercise",
"exc_assignment", $a_rec[
"Id"], $ass->getId());
674 $exc_id = $a_mapping->
getMapping(
"Modules/Exercise",
"exc", $a_rec[
"Parent"]);
677 $crit_cat->setParent($exc_id);
678 $crit_cat->setTitle($a_rec[
"Title"]);
679 $crit_cat->setPosition($a_rec[
"Pos"]);
682 $a_mapping->
addMapping(
"Modules/Exercise",
"exc_crit_cat", $a_rec[
"Id"], $crit_cat->getId());
687 $crit_cat_id = $a_mapping->
getMapping(
"Modules/Exercise",
"exc_crit_cat", $a_rec[
"Parent"]);
688 if ($crit_cat_id > 0) {
690 $crit->setParent($crit_cat_id);
691 $crit->setTitle($a_rec[
"Title"]);
692 $crit->setDescription($a_rec[
"Descr"]);
693 $crit->setPosition($a_rec[
"Pos"]);
694 $crit->setRequired($a_rec[
"Required"]);
695 $crit->importDefinition($a_rec[
"Def"], $a_rec[
"DefJson"]);
700 case "exc_ass_file_order":
702 $ass_id = $a_mapping->
getMapping(
"Modules/Exercise",
"exc_assignment", $a_rec[
"AssignmentId"]);
708 case "exc_ass_reminders":
710 $new_ass_id = $a_mapping->
getMapping(
"Modules/Exercise",
"exc_assignment", $a_rec[
"AssId"]);
711 $new_exc_id = $a_mapping->
getMapping(
'Modules/Exercise',
'exc', $a_rec[
'ExcId']);
715 $rmd->setReminderStatus($a_rec[
"Status"]);
716 $rmd->setReminderStart((
int) ($a_rec[
"Start"] ?? 0));
717 $rmd->setReminderEnd((
int) $end->get(
IL_CAL_UNIX));
718 $rmd->setReminderFrequency((
int) ($a_rec[
"Freq"] ?? 0));
719 $rmd->setReminderLastSend((
int) ($a_rec[
"LastSend"] ?? 0));
720 $rmd->setReminderMailTemplate((
int) ($a_rec[
"TemplateId"] ?? 0));
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlRecord(string $a_entity, string $a_version, array $a_set)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static getInstanceByType(string $a_type)
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
ilObjExercise $current_exc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTypes(string $a_entity, string $a_version)
getXmlNamespace(string $a_entity, string $a_schema_version)
static instructionFileInsertOrder(string $a_filename, int $a_ass_id, int $a_order_nr=0)
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
create()
Create directory.
readData(string $a_entity, string $a_version, array $a_ids)
stripTags(array $rec, array $omit_keys=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)