ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 

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
 

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
Version
$Id$

Definition at line 22 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 477 of file class.ilExerciseDataSet.php.

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

◆ getSupportedVersions()

ilExerciseDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

return

Reimplemented from ilDataSet.

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

31 {
32 return array("4.1.0", "4.4.0", "5.0.0", "5.1.0", "5.2.0", "5.3.0");
33 }

◆ getTypes()

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

Get field types for entity.

Parameters

return

Reimplemented from ilDataSet.

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

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

◆ getXmlNamespace()

ilExerciseDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

return

Reimplemented from ilDataSet.

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

42 {
43 return "http://www.ilias.de/xml/Modules/Exercise/" . $a_entity;
44 }

◆ 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 427 of file class.ilExerciseDataSet.php.

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

References $end, $start, 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 525 of file class.ilExerciseDataSet.php.

526 {
527 //echo $a_entity;
528 //var_dump($a_rec);
529
530 switch ($a_entity) {
531 case "exc":
532 include_once("./Modules/Exercise/classes/class.ilObjExercise.php");
533
534 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
535 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
536 } else {
537 $newObj = new ilObjExercise();
538 $newObj->setType("exc");
539 $newObj->create(true);
540 }
541
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"]);
549 $newObj->update();
550 $newObj->saveData();
551 $this->current_exc = $newObj;
552
553 $a_mapping->addMapping("Modules/Exercise", "exc", $a_rec["Id"], $newObj->getId());
554 break;
555
556 case "exc_assignment":
557 $exc_id = $a_mapping->getMapping("Modules/Exercise", "exc", $a_rec["ExerciseId"]);
558 if ($exc_id > 0) {
559 if (is_object($this->current_exc) && $this->current_exc->getId() == $exc_id) {
560 $exc = $this->current_exc;
561 } else {
562 include_once("./Modules/Exercise/classes/class.ilObjExercise.php");
563 $exc = new ilObjExercise($exc_id, false);
564 }
565
566 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
567
568 $ass = new ilExAssignment();
569 $ass->setExerciseId($exc_id);
570
571 if ($a_rec["StartTime"] != "") {
572 $start = new ilDateTime($a_rec["StartTime"], IL_CAL_DATETIME, "UTC");
573 $ass->setStartTime($start->get(IL_CAL_UNIX));
574 }
575
576 if ($a_rec["Deadline"] != "") {
577 $deadline = new ilDateTime($a_rec["Deadline"], IL_CAL_DATETIME, "UTC");
578 $ass->setDeadline($deadline->get(IL_CAL_UNIX));
579 }
580
581 $ass->setInstruction($a_rec["Instruction"]);
582 $ass->setTitle($a_rec["Title"]);
583 $ass->setMandatory($a_rec["Mandatory"]);
584 $ass->setOrderNr($a_rec["OrderNr"]);
585
586 // 4.2
587 $ass->setType($a_rec["Type"]);
588
589 // 4.4
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"]);
596
597 // 5.0
598 $ass->setPeerReviewFileUpload($a_rec["PeerFile"]);
599 $ass->setPeerReviewPersonalized($a_rec["PeerPersonal"]);
600
601 // 5.1
602 if ($a_rec["Deadline2"] != "") {
603 $deadline = new ilDateTime($a_rec["Deadline2"], IL_CAL_DATETIME, "UTC");
604 $ass->setExtendedDeadline($deadline->get(IL_CAL_UNIX));
605 }
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"]);
613
614 // 5.3
615 $ass->setFeedbackDateCustom($a_rec["FbDateCustom"]);
616
617 // criteria catalogue
618 if ($a_rec["PeerCritCat"]) {
619 $ass->setPeerReviewCriteriaCatalogue($a_mapping->getMapping("Modules/Exercise", "exc_crit_cat", $a_rec["PeerCritCat"]));
620 }
621
622 $ass->save();
623
624 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
625 $fstorage = new ilFSStorageExercise($exc_id, $ass->getId());
626 $fstorage->create();
627
628 // assignment files
629 $dir = str_replace("..", "", $a_rec["Dir"]);
630 if ($dir != "" && $this->getImportDirectory() != "") {
631 $source_dir = $this->getImportDirectory() . "/" . $dir;
632 $target_dir = $fstorage->getPath();
633 ilUtil::rCopy($source_dir, $target_dir);
634 }
635
636 // (4.4) global feedback file
637 $dir = str_replace("..", "", $a_rec["FeedbackDir"]);
638 if ($dir != "" && $this->getImportDirectory() != "") {
639 $source_dir = $this->getImportDirectory() . "/" . $dir;
640 $target_dir = $fstorage->getGlobalFeedbackPath();
641 ilUtil::rCopy($source_dir, $target_dir);
642 }
643
644 // (5.3) assignment files inside ILIAS
645 include_once("./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
646 $fwebstorage = new ilFSWebStorageExercise($exc_id, $ass->getId());
647 $fwebstorage->create();
648 $dir = str_replace("..", "", $a_rec["WebDataDir"]);
649 if ($dir != "" && $this->getImportDirectory() != "") {
650 $source_dir = $this->getImportDirectory() . "/" . $dir;
651 $target_dir = $fwebstorage->getPath();
652 ilUtil::rCopy($source_dir, $target_dir);
653 }
654
655 // 5.4 Team wiki assignment AR
656 if ($a_rec["Type"] == ilExAssignment::TYPE_WIKI_TEAM) {
657 $ar = new ilExAssWikiTeamAR();
658 $ar->setId($ass->getId());
659 $ar->setTemplateRefId(0);
660 $ar->setContainerRefId(0);
661 $ar->save();
662 }
663
664 $a_mapping->addMapping("Modules/Exercise", "exc_assignment", $a_rec["Id"], $ass->getId());
665 }
666
667 break;
668
669 case "exc_crit_cat":
670 $exc_id = $a_mapping->getMapping("Modules/Exercise", "exc", $a_rec["Parent"]);
671 if ($exc_id > 0) {
672 include_once("./Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php");
673 $crit_cat = new ilExcCriteriaCatalogue();
674 $crit_cat->setParent($exc_id);
675 $crit_cat->setTitle($a_rec["Title"]);
676 $crit_cat->setPosition($a_rec["Pos"]);
677 $crit_cat->save();
678
679 $a_mapping->addMapping("Modules/Exercise", "exc_crit_cat", $a_rec["Id"], $crit_cat->getId());
680 }
681 break;
682
683 case "exc_crit":
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");
687 $crit = ilExcCriteria::getInstanceByType($a_rec["Type"]);
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"]);
694 $crit->save();
695 }
696 break;
697
698 case "exc_ass_file_order":
699
700 $ass_id = $a_mapping->getMapping("Modules/Exercise", "exc_assignment", $a_rec["AssignmentId"]);
701 if ($ass_id > 0) {
702 ilExAssignment::instructionFileInsertOrder($a_rec["Filename"], $ass_id, $a_rec["OrderNr"]);
703 }
704 break;
705
706 case "exc_ass_reminders":
707 // (5.3) 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']);
711 //always UTC timestamp in db.
712 $end = new ilDateTime($a_rec["End"], IL_CAL_DATETIME, "UTC");
713 $rmd = new ilExAssignmentReminder($new_exc_id, $new_ass_id, $a_rec["Type"]);
714 $rmd->setReminderStatus($a_rec["Status"]);
715 $rmd->setReminderStart($a_rec["Start"]);
716 $rmd->setReminderEnd($end->get(IL_CAL_UNIX));
717 $rmd->setReminderFrequency($a_rec["Freq"]);
718 $rmd->setReminderLastSend($a_rec["LastSend"]);
719 $rmd->setReminderMailTemplate($a_rec["TemplateId"]);
720 $rmd->save();
721 }
722 }
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 $end, $start, ilDataSet\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), ilExcCriteria\getInstanceByType(), IL_CAL_DATETIME, IL_CAL_UNIX, ilExAssignment\instructionFileInsertOrder(), ilUtil\rCopy(), 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 294 of file class.ilExerciseDataSet.php.

295 {
297
298 if (!is_array($a_ids)) {
299 $a_ids = array($a_ids);
300 }
301
302 if ($a_entity == "exc") {
303 switch ($a_version) {
304 case "4.1.0":
305 $this->getDirectDataFromQuery("SELECT exc_data.obj_id id, title, description," .
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"));
309 break;
310
311 case "4.4.0":
312 case "5.0.0":
313 case "5.1.0":
314 $this->getDirectDataFromQuery("SELECT exc_data.obj_id id, title, description," .
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"));
318 break;
319
320 case "5.2.0":
321 case "5.3.0":
322 $this->getDirectDataFromQuery("SELECT exc_data.obj_id id, title, description," .
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"));
326 break;
327 }
328 }
329
330 if ($a_entity == "exc_assignment") {
331 switch ($a_version) {
332 case "4.1.0":
333 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, time_stamp deadline, " .
334 " instruction, title, start_time, mandatory, order_nr" .
335 " FROM exc_assignment" .
336 " WHERE " . $ilDB->in("exc_id", $a_ids, false, "integer"));
337 break;
338
339 case "4.4.0":
340 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, type, time_stamp deadline," .
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"));
345 break;
346
347 case "5.0.0":
348 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, type, time_stamp deadline," .
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"));
353 break;
354
355 case "5.1.0":
356 case "5.2.0":
357 case "5.3.0":
358 $this->getDirectDataFromQuery("SELECT id, exc_id exercise_id, type, time_stamp deadline, deadline2," .
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," .
362 " fb_date_custom" .
363 " FROM exc_assignment" .
364 " WHERE " . $ilDB->in("exc_id", $a_ids, false, "integer"));
365 break;
366 }
367 }
368
369 if ($a_entity == "exc_crit_cat") {
370 switch ($a_version) {
371 case "5.1.0":
372 case "5.2.0":
373 case "5.3.0":
374 $this->getDirectDataFromQuery("SELECT id, parent, title, pos" .
375 " FROM exc_crit_cat" .
376 " WHERE " . $ilDB->in("parent", $a_ids, false, "integer"));
377 break;
378 }
379 }
380
381 if ($a_entity == "exc_crit") {
382 switch ($a_version) {
383 case "5.1.0":
384 case "5.2.0":
385 case "5.3.0":
386 $this->getDirectDataFromQuery("SELECT id, parent, type, title" .
387 ", descr, pos, required, def" .
388 " FROM exc_crit" .
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"]));
394 }
395 }
396 break;
397 }
398 }
399
400 if ($a_entity == "exc_ass_file_order") {
401 switch ($a_version) {
402 case "5.3.0":
403 $this->getDirectDataFromQuery("SELECT id, assignment_id, filename, order_nr" .
404 " FROM exc_ass_file_order" .
405 " WHERE " . $ilDB->in("assignment_id", $a_ids, false, "integer"));
406 break;
407 }
408 }
409
410 if ($a_entity == "exc_ass_reminders") {
411 switch ($a_version) {
412 case "5.3.0":
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"));
416 break;
417 }
418 }
419 }
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
$this data['403_header']

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

+ Here is the call graph for this function:

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