ILIAS  release_7 Revision v7.30-3-g800a261c036
ilExerciseDataSet Class Reference

Exercise data set class. More...

+ Inheritance diagram for ilExerciseDataSet:
+ Collaboration diagram for ilExerciseDataSet:

Public Member Functions

 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record (export) More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 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 fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 getXmlRepresentation ( $a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text" > <ftype name="field_2" type="date" > <ftype name="field_3" type="integer" > </types> <types ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> More...
 
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
 
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 
 $ds_namespace = 'ds'
 

Detailed Description

Exercise data set class.

Entities:

  • exc: Exercise data
  • exc_assignment: Assignment data
  • exc_crit_cat: criteria category
  • exc_crit: criteria
  • exc_ass_file_order: Order of instruction files
  • exc_ass_reminders: Assingment reminder data
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 19 of file class.ilExerciseDataSet.php.

Member Function Documentation

◆ getDependencies()

ilExerciseDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

Definition at line 475 of file class.ilExerciseDataSet.php.

476 {
477 switch ($a_entity) {
478 case "exc":
479 switch ($a_version) {
480 case "4.1.0":
481 case "4.4.0":
482 case "5.0.0":
483 return array(
484 "exc_assignment" => array("ids" => $a_rec["Id"])
485 );
486
487 case "5.1.0":
488 case "5.2.0":
489 case "5.3.0":
490 return array(
491 "exc_crit_cat" => array("ids" => $a_rec["Id"]),
492 "exc_assignment" => array("ids" => $a_rec["Id"])
493 );
494 }
495 break;
496
497 case "exc_crit_cat":
498 return array(
499 "exc_crit" => array("ids" => $a_rec["Id"])
500 );
501
502 case "exc_assignment":
503 switch ($a_version) {
504 case "5.3.0":
505 return array(
506 "exc_ass_file_order" => array("ids" => $a_rec["Id"]),
507 "exc_ass_reminders" => array("ids" => $a_rec["Id"])
508 );
509
510 }
511 break;
512 }
513 return false;
514 }

◆ getSupportedVersions()

ilExerciseDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

return

Reimplemented from ilDataSet.

Definition at line 27 of file class.ilExerciseDataSet.php.

28 {
29 return array("4.1.0", "4.4.0", "5.0.0", "5.1.0", "5.2.0", "5.3.0");
30 }

◆ getTypes()

ilExerciseDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters

return

Reimplemented from ilDataSet.

Definition at line 49 of file class.ilExerciseDataSet.php.

50 {
51 if ($a_entity == "exc") {
52 switch ($a_version) {
53 case "4.1.0":
54 return array(
55 "Id" => "integer",
56 "Title" => "text",
57 "Description" => "text",
58 "PassMode" => "text",
59 "PassNr" => "integer",
60 "ShowSubmissions" => "integer"
61 );
62
63 case "4.4.0":
64 case "5.0.0":
65 case "5.1.0":
66 return array(
67 "Id" => "integer",
68 "Title" => "text",
69 "Description" => "text",
70 "PassMode" => "text",
71 "PassNr" => "integer",
72 "ShowSubmissions" => "integer",
73 "ComplBySubmission" => "integer"
74 );
75
76 case "5.2.0":
77 case "5.3.0":
78 return array(
79 "Id" => "integer",
80 "Title" => "text",
81 "Description" => "text",
82 "PassMode" => "text",
83 "PassNr" => "integer",
84 "NrMandatoryRandom" => "integer",
85 "ShowSubmissions" => "integer",
86 "ComplBySubmission" => "integer",
87 "Tfeedback" => "integer"
88 );
89 }
90 }
91
92 if ($a_entity == "exc_assignment") {
93 switch ($a_version) {
94 case "4.1.0":
95 return array(
96 "Id" => "integer",
97 "ExerciseId" => "integer",
98 "Deadline" => "text",
99 "Instruction" => "text",
100 "Title" => "text",
101 "Mandatory" => "integer",
102 "OrderNr" => "integer",
103 "Dir" => "directory");
104
105 case "4.4.0":
106 return array(
107 "Id" => "integer",
108 "ExerciseId" => "integer",
109 "Type" => "integer",
110 "Deadline" => "integer",
111 "Instruction" => "text",
112 "Title" => "text",
113 "Mandatory" => "integer",
114 "OrderNr" => "integer",
115 "Dir" => "directory"
116 // peer
117 ,"Peer" => "integer"
118 ,"PeerMin" => "integer"
119 ,"PeerDeadline" => "integer"
120 // global feedback
121 ,"FeedbackFile" => "integer"
122 ,"FeedbackCron" => "integer"
123 ,"FeedbackDate" => "integer"
124 ,"FeedbackDir" => "directory"
125 );
126
127 case "5.0.0":
128 return array(
129 "Id" => "integer",
130 "ExerciseId" => "integer",
131 "Type" => "integer",
132 "Deadline" => "integer",
133 "Instruction" => "text",
134 "Title" => "text",
135 "Mandatory" => "integer",
136 "OrderNr" => "integer",
137 "Dir" => "directory"
138 // peer
139 ,"Peer" => "integer"
140 ,"PeerMin" => "integer"
141 ,"PeerDeadline" => "integer"
142 ,"PeerFile" => "integer"
143 ,"PeerPersonal" => "integer"
144 // global feedback
145 ,"FeedbackFile" => "integer"
146 ,"FeedbackCron" => "integer"
147 ,"FeedbackDate" => "integer"
148 ,"FeedbackDir" => "directory"
149 );
150
151 case "5.1.0":
152 case "5.2.0":
153 return array(
154 "Id" => "integer",
155 "ExerciseId" => "integer",
156 "Type" => "integer",
157 "Deadline" => "integer",
158 "Deadline2" => "integer",
159 "Instruction" => "text",
160 "Title" => "text",
161 "Mandatory" => "integer",
162 "OrderNr" => "integer",
163 "TeamTutor" => "integer",
164 "MaxFile" => "integer",
165 "Dir" => "directory"
166 // peer
167 ,"Peer" => "integer"
168 ,"PeerMin" => "integer"
169 ,"PeerDeadline" => "integer"
170 ,"PeerFile" => "integer"
171 ,"PeerPersonal" => "integer"
172 ,"PeerChar" => "integer"
173 ,"PeerUnlock" => "integer"
174 ,"PeerValid" => "integer"
175 ,"PeerText" => "integer"
176 ,"PeerRating" => "integer"
177 ,"PeerCritCat" => "integer"
178 // global feedback
179 ,"FeedbackFile" => "integer"
180 ,"FeedbackCron" => "integer"
181 ,"FeedbackDate" => "integer"
182 ,"FeedbackDir" => "directory"
183 );
184 case "5.3.0":
185 return array(
186 "Id" => "integer",
187 "ExerciseId" => "integer",
188 "Type" => "integer",
189 "Deadline" => "integer",
190 "Deadline2" => "integer",
191 "Instruction" => "text",
192 "Title" => "text",
193 "Mandatory" => "integer",
194 "OrderNr" => "integer",
195 "TeamTutor" => "integer",
196 "MaxFile" => "integer",
197 "Dir" => "directory",
198 //web data directory
199 "WebDataDir" => "directory"
200 // peer
201 ,"Peer" => "integer"
202 ,"PeerMin" => "integer"
203 ,"PeerDeadline" => "integer"
204 ,"PeerFile" => "integer"
205 ,"PeerPersonal" => "integer"
206 ,"PeerChar" => "integer"
207 ,"PeerUnlock" => "integer"
208 ,"PeerValid" => "integer"
209 ,"PeerText" => "integer"
210 ,"PeerRating" => "integer"
211 ,"PeerCritCat" => "integer"
212 // global feedback
213 ,"FeedbackFile" => "integer"
214 ,"FeedbackCron" => "integer"
215 ,"FeedbackDate" => "integer"
216 ,"FeedbackDir" => "directory"
217 ,"FbDateCustom" => "integer"
218 ,"DeadlineMode" => "integer"
219 ,"RelativeDeadline" => "integer"
220 ,"RelDeadlineLastSubm" => "integer"
221 );
222 }
223 }
224
225 if ($a_entity == "exc_cit_cat") {
226 switch ($a_version) {
227 case "5.1.0":
228 case "5.2.0":
229 case "5.3.0":
230 return array(
231 "Id" => "integer"
232 ,"Parent" => "integer"
233 ,"Title" => "text"
234 ,"Pos" => "integer"
235 );
236 }
237 }
238
239 if ($a_entity == "exc_cit") {
240 switch ($a_version) {
241 case "5.1.0":
242 case "5.2.0":
243 case "5.3.0":
244 return array(
245 "Id" => "integer"
246 ,"Parent" => "integer"
247 ,"Type" => "text"
248 ,"Title" => "text"
249 ,"Descr" => "text"
250 ,"Pos" => "integer"
251 ,"Required" => "integer"
252 ,"Def" => "text"
253 ,"DefJson" => "text"
254 );
255 }
256 }
257
258 if ($a_entity == "exc_ass_file_order") {
259 switch ($a_version) {
260 case "5.3.0":
261 return array(
262 "Id" => "integer"
263 , "AssignmentId" => "integer"
264 , "Filename" => "text"
265 , "OrderNr" => "integer"
266 );
267 }
268 }
269
270 if ($a_entity == "exc_ass_reminders") {
271 switch ($a_version) {
272 case "5.3.0":
273 return array(
274 "Type" => "text",
275 "AssignmentId" => "integer",
276 "ExerciseId" => "integer",
277 "Status" => "integer",
278 "Start" => "integer",
279 "End" => "integer",
280 "Frequency" => "integer",
281 "LastSend" => "integer",
282 "TemplateId" => "integer"
283 );
284 }
285 }
286 return false;
287 }

◆ getXmlNamespace()

ilExerciseDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

return

Reimplemented from ilDataSet.

Definition at line 38 of file class.ilExerciseDataSet.php.

39 {
40 return "http://www.ilias.de/xml/Modules/Exercise/" . $a_entity;
41 }

◆ getXmlRecord()

ilExerciseDataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record (export)

Parameters
arrayabstract data record
Returns
array xml record

Reimplemented from ilDataSet.

Definition at line 428 of file class.ilExerciseDataSet.php.

429 {
430 if ($a_entity == "exc_assignment") {
431 // convert server dates to utc
432 if ($a_set["StartTime"] != "") {
433 $start = new ilDateTime($a_set["StartTime"], IL_CAL_UNIX);
434 $a_set["StartTime"] = $start->get(IL_CAL_DATETIME, '', 'UTC');
435 }
436 if ($a_set["Deadline"] != "") {
437 $deadline = new ilDateTime($a_set["Deadline"], IL_CAL_UNIX);
438 $a_set["Deadline"] = $deadline->get(IL_CAL_DATETIME, '', 'UTC');
439 }
440 if ($a_set["Deadline2"] != "") {
441 $deadline = new ilDateTime($a_set["Deadline2"], IL_CAL_UNIX);
442 $a_set["Deadline2"] = $deadline->get(IL_CAL_DATETIME, '', 'UTC');
443 }
444
445 $fstorage = new ilFSStorageExercise($a_set["ExerciseId"], $a_set["Id"]);
446 $a_set["Dir"] = $fstorage->getPath();
447
448 $fstorage = new ilFSStorageExercise($a_set["ExerciseId"], $a_set["Id"]);
449 $a_set["FeedbackDir"] = $fstorage->getGlobalFeedbackPath();
450
451 //now the instruction files inside the root directory
452 $fswebstorage = new ilFSWebStorageExercise($a_set['ExerciseId'], $a_set['Id']);
453 $a_set['WebDataDir'] = $fswebstorage->getPath();
454 }
455
456 //Discuss if necessary when working with timestamps.
457 if ($a_entity == "exc_ass_reminders") {
458 if ($a_set["End"] != "") {
459 $end = new ilDateTime($a_set["End"], IL_CAL_UNIX);
460 $a_set["End"] = $end->get(IL_CAL_DATETIME, '', 'UTC');
461 }
462 if ($a_set["LastSend"] != "") {
463 $last = new ilDateTime($a_set["LastSend"], IL_CAL_UNIX);
464 $a_set["LastSend"] = $last->get(IL_CAL_DATETIME, '', 'UTC');
465 }
466 }
467
468 return $a_set;
469 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling

References IL_CAL_DATETIME, and IL_CAL_UNIX.

◆ importRecord()

ilExerciseDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters

return

Definition at line 523 of file class.ilExerciseDataSet.php.

524 {
525 $a_rec = $this->stripTags($a_rec, ["Instruction"]);
526 $purifier = new ilExcInstructionPurifier();
527 $a_rec["Instruction"] = $purifier->purify((string) ($a_rec["Instruction"] ?? ""));
528
529 switch ($a_entity) {
530 case "exc":
531 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
532 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
533 } else {
534 $newObj = new ilObjExercise();
535 $newObj->setType("exc");
536 $newObj->create(true);
537 }
538
539 $newObj->setTitle($a_rec["Title"]);
540 $newObj->setDescription($a_rec["Description"]);
541 $newObj->setPassMode($a_rec["PassMode"]);
542 $newObj->setPassNr($a_rec["PassNr"]);
543 $newObj->setNrMandatoryRandom((int) $a_rec["NrMandatoryRandom"]);
544 $newObj->setShowSubmissions($a_rec["ShowSubmissions"]);
545 $newObj->setCompletionBySubmission($a_rec["ComplBySubmission"]);
546 $newObj->setTutorFeedback($a_rec["Tfeedback"]);
547 $newObj->update();
548 $newObj->saveData();
549 $this->current_exc = $newObj;
550
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());
554 $a_mapping->addMapping(
555 "Services/MetaData",
556 "md",
557 $a_rec["Id"] . ":0:exc",
558 $newObj->getId() . ":0:exc"
559 );
560 break;
561
562 case "exc_assignment":
563 $exc_id = $a_mapping->getMapping("Modules/Exercise", "exc", $a_rec["ExerciseId"]);
564 if ($exc_id > 0) {
565 if (is_object($this->current_exc) && $this->current_exc->getId() == $exc_id) {
566 $exc = $this->current_exc;
567 } else {
568 $exc = new ilObjExercise($exc_id, false);
569 }
570
571 $ass = new ilExAssignment();
572 $ass->setExerciseId($exc_id);
573
574 if ($a_rec["StartTime"] != "") {
575 $start = new ilDateTime($a_rec["StartTime"], IL_CAL_DATETIME, "UTC");
576 $ass->setStartTime($start->get(IL_CAL_UNIX));
577 }
578
579 if ($a_rec["Deadline"] != "") {
580 $deadline = new ilDateTime($a_rec["Deadline"], IL_CAL_DATETIME, "UTC");
581 $ass->setDeadline($deadline->get(IL_CAL_UNIX));
582 }
583
584 $ass->setInstruction($a_rec["Instruction"]);
585 $ass->setTitle($a_rec["Title"]);
586 $ass->setMandatory($a_rec["Mandatory"]);
587 $ass->setOrderNr($a_rec["OrderNr"]);
588
589 // 4.2
590 $ass->setType($a_rec["Type"]);
591
592 // 4.4
593 $ass->setPeerReview($a_rec["Peer"]);
594 $ass->setPeerReviewMin($a_rec["PeerMin"]);
595 $ass->setPeerReviewDeadline($a_rec["PeerDeadline"]);
596 $ass->setFeedbackFile($a_rec["FeedbackFile"]);
597 $ass->setFeedbackCron($a_rec["FeedbackCron"]);
598 $ass->setFeedbackDate($a_rec["FeedbackDate"]);
599
600 // 5.0
601 $ass->setPeerReviewFileUpload($a_rec["PeerFile"]);
602 $ass->setPeerReviewPersonalized($a_rec["PeerPersonal"]);
603
604 // 5.1
605 if ($a_rec["Deadline2"] != "") {
606 $deadline = new ilDateTime($a_rec["Deadline2"], IL_CAL_DATETIME, "UTC");
607 $ass->setExtendedDeadline($deadline->get(IL_CAL_UNIX));
608 }
609 $ass->setMaxFile($a_rec["MaxFile"]);
610 $ass->setTeamTutor($a_rec["TeamTutor"]);
611 $ass->setPeerReviewChars($a_rec["PeerChar"]);
612 $ass->setPeerReviewSimpleUnlock($a_rec["PeerUnlock"]);
613 $ass->setPeerReviewValid($a_rec["PeerValid"]);
614 $ass->setPeerReviewText($a_rec["PeerText"]);
615 $ass->setPeerReviewRating($a_rec["PeerRating"]);
616
617 // 5.3
618 $ass->setFeedbackDateCustom($a_rec["FbDateCustom"]);
619 $ass->setRelDeadlineLastSubmission($a_rec["RelDeadlineLastSubm"]);
620 $ass->setDeadlineMode($a_rec["DeadlineMode"]);
621 $ass->setRelativeDeadline($a_rec["RelativeDeadline"]);
622
623 // criteria catalogue
624 if ($a_rec["PeerCritCat"]) {
625 $ass->setPeerReviewCriteriaCatalogue($a_mapping->getMapping("Modules/Exercise", "exc_crit_cat", $a_rec["PeerCritCat"]));
626 }
627
628 $ass->save();
629
630 $fstorage = new ilFSStorageExercise($exc_id, $ass->getId());
631 $fstorage->create();
632
633 // assignment files
634 $dir = str_replace("..", "", $a_rec["Dir"]);
635 if ($dir != "" && $this->getImportDirectory() != "") {
636 $source_dir = $this->getImportDirectory() . "/" . $dir;
637 $target_dir = $fstorage->getPath();
638 ilUtil::rCopy($source_dir, $target_dir);
639 }
640
641 // (4.4) global feedback file
642 $dir = str_replace("..", "", $a_rec["FeedbackDir"]);
643 if ($dir != "" && $this->getImportDirectory() != "") {
644 $source_dir = $this->getImportDirectory() . "/" . $dir;
645 $target_dir = $fstorage->getGlobalFeedbackPath();
646 ilUtil::rCopy($source_dir, $target_dir);
647 }
648
649 // (5.3) assignment files inside ILIAS
650 $fwebstorage = new ilFSWebStorageExercise($exc_id, $ass->getId());
651 $fwebstorage->create();
652 $dir = str_replace("..", "", $a_rec["WebDataDir"]);
653 if ($dir != "" && $this->getImportDirectory() != "") {
654 $source_dir = $this->getImportDirectory() . "/" . $dir;
655 $target_dir = $fwebstorage->getPath();
656 ilUtil::rCopy($source_dir, $target_dir);
657 }
658
659 // 5.4 Team wiki assignment AR
660 if ($a_rec["Type"] == ilExAssignment::TYPE_WIKI_TEAM) {
661 $ar = new ilExAssWikiTeamAR();
662 $ar->setId($ass->getId());
663 $ar->setTemplateRefId(0);
664 $ar->setContainerRefId(0);
665 $ar->save();
666 }
667
668 $a_mapping->addMapping("Modules/Exercise", "exc_assignment", $a_rec["Id"], $ass->getId());
669 }
670
671 break;
672
673 case "exc_crit_cat":
674 $exc_id = $a_mapping->getMapping("Modules/Exercise", "exc", $a_rec["Parent"]);
675 if ($exc_id > 0) {
676 $crit_cat = new ilExcCriteriaCatalogue();
677 $crit_cat->setParent($exc_id);
678 $crit_cat->setTitle($a_rec["Title"]);
679 $crit_cat->setPosition($a_rec["Pos"]);
680 $crit_cat->save();
681
682 $a_mapping->addMapping("Modules/Exercise", "exc_crit_cat", $a_rec["Id"], $crit_cat->getId());
683 }
684 break;
685
686 case "exc_crit":
687 $crit_cat_id = $a_mapping->getMapping("Modules/Exercise", "exc_crit_cat", $a_rec["Parent"]);
688 if ($crit_cat_id > 0) {
689 $crit = ilExcCriteria::getInstanceByType($a_rec["Type"]);
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"]);
696 $crit->save();
697 }
698 break;
699
700 case "exc_ass_file_order":
701
702 $ass_id = $a_mapping->getMapping("Modules/Exercise", "exc_assignment", $a_rec["AssignmentId"]);
703 if ($ass_id > 0) {
704 ilExAssignment::instructionFileInsertOrder($a_rec["Filename"], $ass_id, $a_rec["OrderNr"]);
705 }
706 break;
707
708 case "exc_ass_reminders":
709 // (5.3) 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']);
712 //always UTC timestamp in db.
713 $end = new ilDateTime($a_rec["End"], IL_CAL_DATETIME, "UTC");
714 $rmd = new ilExAssignmentReminder($new_exc_id, $new_ass_id, $a_rec["Type"]);
715 $rmd->setReminderStatus($a_rec["Status"]);
716 $rmd->setReminderStart($a_rec["Start"]);
717 $rmd->setReminderEnd($end->get(IL_CAL_UNIX));
718 $rmd->setReminderFrequency($a_rec["Freq"]);
719 $rmd->setReminderLastSend($a_rec["LastSend"]);
720 $rmd->setReminderMailTemplate($a_rec["TemplateId"]);
721 $rmd->save();
722 }
723 }
stripTags(array $rec, array $omit_keys=[])
getImportDirectory()
Get import directory.
Item group active record class.
TODO: import/export reminder data with the exercise/assignment.
Exercise assignment.
static instructionFileInsertOrder($a_filename, $a_ass_id, $a_order_nr=0)
Store the file order in the database.
Class ilExcCriteriaCatalogue.
static getInstanceByType($a_type)
Class ilObjExercise.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.

References ilDataSet\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), ilExcCriteria\getInstanceByType(), IL_CAL_DATETIME, IL_CAL_UNIX, ilExAssignment\instructionFileInsertOrder(), ilUtil\rCopy(), ilDataSet\stripTags(), and ilExAssignment\TYPE_WIKI_TEAM.

+ Here is the call graph for this function:

◆ readData()

ilExerciseDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters

return

Definition at line 295 of file class.ilExerciseDataSet.php.

296 {
298
299 if (!is_array($a_ids)) {
300 $a_ids = array($a_ids);
301 }
302
303 if ($a_entity == "exc") {
304 switch ($a_version) {
305 case "4.1.0":
306 $this->getDirectDataFromQuery("SELECT exc_data.obj_id id, title, description," .
307 " pass_mode, pass_nr, show_submissions" .
308 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
309 " WHERE " . $ilDB->in("exc_data.obj_id", $a_ids, false, "integer"));
310 break;
311
312 case "4.4.0":
313 case "5.0.0":
314 case "5.1.0":
315 $this->getDirectDataFromQuery("SELECT exc_data.obj_id id, title, description," .
316 " pass_mode, pass_nr, show_submissions, compl_by_submission" .
317 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
318 " WHERE " . $ilDB->in("exc_data.obj_id", $a_ids, false, "integer"));
319 break;
320
321 case "5.2.0":
322 case "5.3.0":
323 $this->getDirectDataFromQuery("SELECT exc_data.obj_id id, title, description," .
324 " pass_mode, pass_nr, show_submissions, compl_by_submission, tfeedback,nr_mandatory_random" .
325 " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
326 " WHERE " . $ilDB->in("exc_data.obj_id", $a_ids, false, "integer"));
327 break;
328 }
329 }
330
331 if ($a_entity == "exc_assignment") {
332 switch ($a_version) {
333 case "4.1.0":
334 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, time_stamp deadline, " .
335 " instruction, title, start_time, mandatory, order_nr" .
336 " FROM exc_assignment" .
337 " WHERE " . $ilDB->in("exc_id", $a_ids, false, "integer"));
338 break;
339
340 case "4.4.0":
341 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, type, time_stamp deadline," .
342 " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
343 " fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
344 " FROM exc_assignment" .
345 " WHERE " . $ilDB->in("exc_id", $a_ids, false, "integer"));
346 break;
347
348 case "5.0.0":
349 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, type, time_stamp deadline," .
350 " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
351 " peer_file, peer_prsl peer_personal, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
352 " FROM exc_assignment" .
353 " WHERE " . $ilDB->in("exc_id", $a_ids, false, "integer"));
354 break;
355
356 case "5.1.0":
357 case "5.2.0":
358 case "5.3.0":
359 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, type, time_stamp deadline, deadline2," .
360 " instruction, title, start_time, mandatory, order_nr, team_tutor, max_file, peer, peer_min," .
361 " peer_dl peer_deadline, peer_file, peer_prsl peer_personal, peer_char, peer_unlock, peer_valid," .
362 " peer_text, peer_rating, peer_crit_cat, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date," .
363 " fb_date_custom, rel_deadline_last_subm, deadline_mode, relative_deadline" .
364 " FROM exc_assignment" .
365 " WHERE " . $ilDB->in("exc_id", $a_ids, false, "integer"));
366 break;
367 }
368 }
369
370 if ($a_entity == "exc_crit_cat") {
371 switch ($a_version) {
372 case "5.1.0":
373 case "5.2.0":
374 case "5.3.0":
375 $this->getDirectDataFromQuery("SELECT id, parent, title, pos" .
376 " FROM exc_crit_cat" .
377 " WHERE " . $ilDB->in("parent", $a_ids, false, "integer"));
378 break;
379 }
380 }
381
382 if ($a_entity == "exc_crit") {
383 switch ($a_version) {
384 case "5.1.0":
385 case "5.2.0":
386 case "5.3.0":
387 $this->getDirectDataFromQuery("SELECT id, parent, type, title" .
388 ", descr, pos, required, def" .
389 " FROM exc_crit" .
390 " WHERE " . $ilDB->in("parent", $a_ids, false, "integer"));
391 foreach ($this->data as $k => $v) {
392 $this->data[$k]["DefJson"] = "";
393 if ($v["Def"] != "") {
394 $this->data[$k]["DefJson"] = json_encode(unserialize($v["Def"]));
395 }
396 }
397 break;
398 }
399 }
400
401 if ($a_entity == "exc_ass_file_order") {
402 switch ($a_version) {
403 case "5.3.0":
404 $this->getDirectDataFromQuery("SELECT id, assignment_id, filename, order_nr" .
405 " FROM exc_ass_file_order" .
406 " WHERE " . $ilDB->in("assignment_id", $a_ids, false, "integer"));
407 break;
408 }
409 }
410
411 if ($a_entity == "exc_ass_reminders") {
412 switch ($a_version) {
413 case "5.3.0":
414 $this->getDirectDataFromQuery("SELECT type, ass_id, exc_id, status, start, end, freq, last_send, template_id" .
415 " FROM exc_ass_reminders" .
416 " WHERE " . $ilDB->in("ass_id", $a_ids, false, "integer"));
417 break;
418 }
419 }
420 }
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 ...
global $ilDB

References ilDataSet\$db, $ilDB, and ilDataSet\getDirectDataFromQuery().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: