ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilExAssignment.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
16 protected $db;
17
21 protected $lng;
22
26 protected $user;
27
32
36 const TYPE_UPLOAD = 1;
40 const TYPE_BLOG = 2;
44 const TYPE_PORTFOLIO = 3;
52 const TYPE_TEXT = 5;
56 const TYPE_WIKI_TEAM = 6;
57
61
65
70
73
74
75 protected $id;
76 protected $exc_id;
77 protected $type;
78 protected $start_time;
79 protected $deadline;
80 protected $deadline2;
81 protected $instruction;
82 protected $title;
83 protected $mandatory;
84 protected $order_nr;
85 protected $peer;
86 protected $peer_min;
87 protected $peer_unlock;
88 protected $peer_dl;
89 protected $peer_valid;
90 protected $peer_file;
91 protected $peer_personal;
92 protected $peer_char;
93 protected $peer_text;
94 protected $peer_rating;
95 protected $peer_crit_cat;
96 protected $feedback_file;
97 protected $feedback_cron;
98 protected $feedback_date;
100 protected $team_tutor = false;
101 protected $max_file;
102
106
107 protected $types = null;
108
112 protected $ass_type;
113
114 protected $deadline_mode = 0;
115 protected $relative_deadline = 0;
116 protected $starting_timestamp = null;
117
118
119 protected $member_status = array(); // [array]
120
121 protected $log;
122
126 public function __construct($a_id = 0)
127 {
128 global $DIC;
129
130 $this->db = $DIC->database();
131 $this->lng = $DIC->language();
132 $this->user = $DIC->user();
133 $this->app_event_handler = $DIC["ilAppEventHandler"];
134 include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssignmentTypes.php");
135 $this->types = ilExAssignmentTypes::getInstance();
136
137 $this->setType(self::TYPE_UPLOAD);
138 $this->setFeedbackDate(self::FEEDBACK_DATE_DEADLINE);
139
140 $this->log = ilLoggerFactory::getLogger("exc");
141
142 if ($a_id > 0) {
143 $this->setId($a_id);
144 $this->read();
145 }
146 }
147
148 public static function getInstancesByExercise($a_exc_id)
149 {
150 global $DIC;
151
152 $ilDB = $DIC->database();
153
154 $set = $ilDB->query("SELECT * FROM exc_assignment " .
155 " WHERE exc_id = " . $ilDB->quote($a_exc_id, "integer") .
156 " ORDER BY order_nr ASC");
157 $data = array();
158
159 $order_val = 10;
160 while ($rec = $ilDB->fetchAssoc($set)) {
161 // ???
162 $rec["order_val"] = $order_val;
163
164 $ass = new self();
165 $ass->initFromDB($rec);
166 $data[] = $ass;
167
168 $order_val += 10;
169 }
170
171 return $data;
172 }
173
179 public static function instructionFileGetFileOrderData($a_file_data, $a_ass_id)
180 {
181 global $DIC;
182
183 $db = $DIC->database();
184 $db->setLimit(1, 0);
185
186 $result_order_val = $db->query("
187 SELECT id, order_nr
188 FROM exc_ass_file_order
189 WHERE assignment_id = {$db->quote($a_ass_id, 'integer')}
190 AND filename = {$db->quote($a_file_data['entry'], 'string')}
191 ");
192
193 $order_val = 0;
194 $order_id = 0;
195 while ($row = $db->fetchAssoc($result_order_val)) {
196 $order_val = (int) $row['order_nr'];
197 $order_id = (int) $row['id'];
198 }
199 return array($order_val, $order_id);
200 }
201
202 public function hasTeam()
203 {
204 return $this->ass_type->usesTeams();
205 }
206
212 public function setId($a_val)
213 {
214 $this->id = $a_val;
215 }
216
222 public function getId()
223 {
224 return $this->id;
225 }
226
232 public function setExerciseId($a_val)
233 {
234 $this->exc_id = $a_val;
235 }
236
242 public function getExerciseId()
243 {
244 return $this->exc_id;
245 }
246
252 public function setStartTime($a_val)
253 {
254 $this->start_time = $a_val;
255 }
256
262 public function getStartTime()
263 {
264 return $this->start_time;
265 }
266
272 public function setDeadline($a_val)
273 {
274 $this->deadline = $a_val;
275 }
276
282 public function getDeadline()
283 {
284 return $this->deadline;
285 }
286
292 public function setDeadlineMode($a_val)
293 {
294 $this->deadline_mode = $a_val;
295 }
296
302 public function getDeadlineMode()
303 {
305 }
306
312 public function setRelativeDeadline($a_val)
313 {
314 $this->relative_deadline = $a_val;
315 }
316
322 public function getRelativeDeadline()
323 {
325 }
326
332 public function getPersonalDeadline($a_user_id)
333 {
335
336 $is_team = false;
337 if ($this->ass_type->usesTeams()) {
338 include_once("./Modules/Exercise/classes/class.ilExAssignmentTeam.php");
339 $team_id = ilExAssignmentTeam::getTeamId($this->getId(), $a_user_id);
340 if (!$team_id) {
341 // #0021043
342 return $this->getDeadline();
343 }
344 $a_user_id = $team_id;
345 $is_team = true;
346 }
347
348 $set = $ilDB->query("SELECT tstamp FROM exc_idl" .
349 " WHERE ass_id = " . $ilDB->quote($this->getId(), "integer") .
350 " AND member_id = " . $ilDB->quote($a_user_id, "integer") .
351 " AND is_team = " . $ilDB->quote($is_team, "integer"));
352 $row = $ilDB->fetchAssoc($set);
353
354 // use assignment deadline if no direct personal
355 return max($row["tstamp"], $this->getDeadline());
356 }
357
363 public function getLastPersonalDeadline()
364 {
366
367 $set = $ilDB->query("SELECT MAX(tstamp) FROM exc_idl" .
368 " WHERE ass_id = " . $ilDB->quote($this->getId(), "integer"));
369 $row = $ilDB->fetchAssoc($set);
370 return $row["tstamp"];
371 }
372
378 public function setExtendedDeadline($a_val)
379 {
380 if ($a_val !== null) {
381 $a_val = (int) $a_val;
382 }
383 $this->deadline2 = $a_val;
384 }
385
391 public function getExtendedDeadline()
392 {
393 return $this->deadline2;
394 }
395
401 public function setInstruction($a_val)
402 {
403 $this->instruction = $a_val;
404 }
405
411 public function getInstruction()
412 {
413 return $this->instruction;
414 }
415
421 public function setTitle($a_val)
422 {
423 $this->title = $a_val;
424 }
425
431 public function getTitle()
432 {
433 return $this->title;
434 }
435
441 public function setMandatory($a_val)
442 {
443 $this->mandatory = $a_val;
444 }
445
451 public function getMandatory()
452 {
453 return $this->mandatory;
454 }
455
461 public function setOrderNr($a_val)
462 {
463 $this->order_nr = $a_val;
464 }
465
471 public function getOrderNr()
472 {
473 return $this->order_nr;
474 }
475
482 public function setType($a_value)
483 {
484 if ($this->isValidType($a_value)) {
485 $this->type = (int) $a_value;
486
487 $this->ass_type = $this->types->getById($a_value);
488
489 if ($this->ass_type->usesTeams()) {
490 $this->setPeerReview(false);
491 }
492 }
493 }
494
501 public function getAssignmentType()
502 {
503 return $this->ass_type;
504 }
505
506
513 public function getType()
514 {
515 return $this->type;
516 }
517
524 public function isValidType($a_value)
525 {
526 return $this->types->isValidId($a_value);
527 }
528
534 public function setPeerReview($a_value)
535 {
536 $this->peer = (bool) $a_value;
537 }
538
544 public function getPeerReview()
545 {
546 return (bool) $this->peer;
547 }
548
554 public function setPeerReviewMin($a_value)
555 {
556 $this->peer_min = (int) $a_value;
557 }
558
564 public function getPeerReviewMin()
565 {
566 return (int) $this->peer_min;
567 }
568
574 public function setPeerReviewSimpleUnlock($a_value)
575 {
576 $this->peer_unlock = (bool) $a_value;
577 }
578
585 {
586 return (bool) $this->peer_unlock;
587 }
588
594 public function setPeerReviewDeadline($a_val)
595 {
596 $this->peer_dl = $a_val;
597 }
598
604 public function getPeerReviewDeadline()
605 {
606 return $this->peer_dl;
607 }
608
614 public function setPeerReviewValid($a_value)
615 {
616 $this->peer_valid = (int) $a_value;
617 }
618
624 public function getPeerReviewValid()
625 {
626 return (int) $this->peer_valid;
627 }
628
634 public function setPeerReviewRating($a_val)
635 {
636 $this->peer_rating = (bool) $a_val;
637 }
638
644 public function hasPeerReviewRating()
645 {
646 return $this->peer_rating;
647 }
648
654 public function setPeerReviewText($a_val)
655 {
656 $this->peer_text = (bool) $a_val;
657 }
658
664 public function hasPeerReviewText()
665 {
666 return $this->peer_text;
667 }
668
674 public function setPeerReviewFileUpload($a_val)
675 {
676 $this->peer_file = (bool) $a_val;
677 }
678
684 public function hasPeerReviewFileUpload()
685 {
686 return $this->peer_file;
687 }
688
694 public function setPeerReviewPersonalized($a_val)
695 {
696 $this->peer_personal = (bool) $a_val;
697 }
698
705 {
707 }
708
714 public function setPeerReviewChars($a_value)
715 {
716 $a_value = (is_numeric($a_value) && (int) $a_value > 0)
717 ? (int) $a_value
718 : null;
719 $this->peer_char = $a_value;
720 }
721
727 public function getPeerReviewChars()
728 {
729 return $this->peer_char;
730 }
731
737 public function setPeerReviewCriteriaCatalogue($a_value)
738 {
739 $a_value = is_numeric($a_value)
740 ? (int) $a_value
741 : null;
742 $this->crit_cat = $a_value;
743 }
744
751 {
752 return $this->crit_cat;
753 }
754
756 {
757 include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
758
759 if ($this->crit_cat) {
760 return ilExcCriteria::getInstancesByParentId($this->crit_cat);
761 } else {
762 $res = array();
763
764 if ($this->peer_rating) {
766 }
767
768 if ($this->peer_text) {
769 $crit = ilExcCriteria::getInstanceByType("text");
770 if ($this->peer_char) {
771 $crit->setMinChars($this->peer_char);
772 }
773 $res[] = $crit;
774 }
775
776 if ($this->peer_file) {
778 }
779
780 return $res;
781 }
782 }
783
789 public function setFeedbackFile($a_value)
790 {
791 $this->feedback_file = (string) $a_value;
792 }
793
799 public function getFeedbackFile()
800 {
801 return (string) $this->feedback_file;
802 }
803
809 public function setFeedbackCron($a_value)
810 {
811 $this->feedback_cron = (string) $a_value;
812 }
813
819 public function hasFeedbackCron()
820 {
821 return (bool) $this->feedback_cron;
822 }
823
829 public function setFeedbackDate($a_value)
830 {
831 $this->feedback_date = (int) $a_value;
832 }
833
839 public function getFeedbackDate()
840 {
841 return (int) $this->feedback_date;
842 }
843
848 public function setFeedbackDateCustom($a_value)
849 {
850 $this->feedback_date_custom = $a_value;
851 }
852
857 public function getFeedbackDateCustom()
858 {
860 }
861
867 public function setTeamTutor($a_value)
868 {
869 $this->team_tutor = (bool) $a_value;
870 }
871
877 public function getTeamTutor()
878 {
879 return $this->team_tutor;
880 }
881
887 public function setMaxFile($a_value)
888 {
889 if ($a_value !== null) {
890 $a_value = (int) $a_value;
891 }
892 $this->max_file = $a_value;
893 }
894
900 public function getMaxFile()
901 {
902 return $this->max_file;
903 }
904
910 public function setPortfolioTemplateId($a_val)
911 {
912 $this->portfolio_template = $a_val;
913 }
914
920 public function getPortfolioTemplateId()
921 {
923 }
924
925
929 public function read()
930 {
932
933 $set = $ilDB->query(
934 "SELECT * FROM exc_assignment " .
935 " WHERE id = " . $ilDB->quote($this->getId(), "integer")
936 );
937 $rec = $ilDB->fetchAssoc($set);
938
939 // #16172 - might be deleted
940 if (is_array($rec)) {
941 $this->initFromDB($rec);
942 }
943 }
944
951 protected function initFromDB(array $a_set)
952 {
953 $this->setId($a_set["id"]);
954 $this->setExerciseId($a_set["exc_id"]);
955 $this->setDeadline($a_set["time_stamp"]);
956 $this->setExtendedDeadline($a_set["deadline2"]);
957 $this->setInstruction($a_set["instruction"]);
958 $this->setTitle($a_set["title"]);
959 $this->setStartTime($a_set["start_time"]);
960 $this->setOrderNr($a_set["order_nr"]);
961 $this->setMandatory($a_set["mandatory"]);
962 $this->setType($a_set["type"]);
963 $this->setPeerReview($a_set["peer"]);
964 $this->setPeerReviewMin($a_set["peer_min"]);
965 $this->setPeerReviewSimpleUnlock($a_set["peer_unlock"]);
966 $this->setPeerReviewDeadline($a_set["peer_dl"]);
967 $this->setPeerReviewValid($a_set["peer_valid"]);
968 $this->setPeerReviewFileUpload($a_set["peer_file"]);
969 $this->setPeerReviewPersonalized($a_set["peer_prsl"]);
970 $this->setPeerReviewChars($a_set["peer_char"]);
971 $this->setPeerReviewText($a_set["peer_text"]);
972 $this->setPeerReviewRating($a_set["peer_rating"]);
973 $this->setPeerReviewCriteriaCatalogue($a_set["peer_crit_cat"]);
974 $this->setFeedbackFile($a_set["fb_file"]);
975 $this->setFeedbackDate($a_set["fb_date"]);
976 $this->setFeedbackDateCustom($a_set["fb_date_custom"]);
977 $this->setFeedbackCron($a_set["fb_cron"]);
978 $this->setTeamTutor($a_set["team_tutor"]);
979 $this->setMaxFile($a_set["max_file"]);
980 $this->setPortfolioTemplateId($a_set["portfolio_template"]);
981 $this->setMinCharLimit($a_set["min_char_limit"]);
982 $this->setMaxCharLimit($a_set["max_char_limit"]);
983 $this->setDeadlineMode($a_set["deadline_mode"]);
984 $this->setRelativeDeadline($a_set["relative_deadline"]);
985 }
986
990 public function save()
991 {
993
994 if ($this->getOrderNr() == 0) {
995 $this->setOrderNr(
996 self::lookupMaxOrderNrForEx($this->getExerciseId())
997 + 10
998 );
999 }
1000
1001 $next_id = $ilDB->nextId("exc_assignment");
1002 $ilDB->insert("exc_assignment", array(
1003 "id" => array("integer", $next_id),
1004 "exc_id" => array("integer", $this->getExerciseId()),
1005 "time_stamp" => array("integer", $this->getDeadline()),
1006 "deadline2" => array("integer", $this->getExtendedDeadline()),
1007 "instruction" => array("clob", $this->getInstruction()),
1008 "title" => array("text", $this->getTitle()),
1009 "start_time" => array("integer", $this->getStartTime()),
1010 "order_nr" => array("integer", $this->getOrderNr()),
1011 "mandatory" => array("integer", $this->getMandatory()),
1012 "type" => array("integer", $this->getType()),
1013 "peer" => array("integer", $this->getPeerReview()),
1014 "peer_min" => array("integer", $this->getPeerReviewMin()),
1015 "peer_unlock" => array("integer", $this->getPeerReviewSimpleUnlock()),
1016 "peer_dl" => array("integer", $this->getPeerReviewDeadline()),
1017 "peer_valid" => array("integer", $this->getPeerReviewValid()),
1018 "peer_file" => array("integer", $this->hasPeerReviewFileUpload()),
1019 "peer_prsl" => array("integer", $this->hasPeerReviewPersonalized()),
1020 "peer_char" => array("integer", $this->getPeerReviewChars()),
1021 "peer_text" => array("integer", (int) $this->hasPeerReviewText()),
1022 "peer_rating" => array("integer", (int) $this->hasPeerReviewRating()),
1023 "peer_crit_cat" => array("integer", $this->getPeerReviewCriteriaCatalogue()),
1024 "fb_file" => array("text", $this->getFeedbackFile()),
1025 "fb_date" => array("integer", $this->getFeedbackDate()),
1026 "fb_date_custom" => array("integer", $this->getFeedbackDateCustom()),
1027 "fb_cron" => array("integer", $this->hasFeedbackCron()),
1028 "team_tutor" => array("integer", $this->getTeamTutor()),
1029 "max_file" => array("integer", $this->getMaxFile()),
1030 "portfolio_template" => array("integer", $this->getPortFolioTemplateId()),
1031 "min_char_limit" => array("integer", $this->getMinCharLimit()),
1032 "max_char_limit" => array("integer", $this->getMaxCharLimit()),
1033 "relative_deadline" => array("integer", $this->getRelativeDeadline()),
1034 "deadline_mode" => array("integer", $this->getDeadlineMode())
1035 ));
1036 $this->setId($next_id);
1037 $exc = new ilObjExercise($this->getExerciseId(), false);
1038 $exc->updateAllUsersStatus();
1039 self::createNewAssignmentRecords($next_id, $exc);
1040
1041 $this->handleCalendarEntries("create");
1042 }
1043
1047 public function update()
1048 {
1049 $ilDB = $this->db;
1050
1051 $ilDB->update(
1052 "exc_assignment",
1053 array(
1054 "exc_id" => array("integer", $this->getExerciseId()),
1055 "time_stamp" => array("integer", $this->getDeadline()),
1056 "deadline2" => array("integer", $this->getExtendedDeadline()),
1057 "instruction" => array("clob", $this->getInstruction()),
1058 "title" => array("text", $this->getTitle()),
1059 "start_time" => array("integer", $this->getStartTime()),
1060 "order_nr" => array("integer", $this->getOrderNr()),
1061 "mandatory" => array("integer", $this->getMandatory()),
1062 "type" => array("integer", $this->getType()),
1063 "peer" => array("integer", $this->getPeerReview()),
1064 "peer_min" => array("integer", $this->getPeerReviewMin()),
1065 "peer_unlock" => array("integer", $this->getPeerReviewSimpleUnlock()),
1066 "peer_dl" => array("integer", $this->getPeerReviewDeadline()),
1067 "peer_valid" => array("integer", $this->getPeerReviewValid()),
1068 "peer_file" => array("integer", $this->hasPeerReviewFileUpload()),
1069 "peer_prsl" => array("integer", $this->hasPeerReviewPersonalized()),
1070 "peer_char" => array("integer", $this->getPeerReviewChars()),
1071 "peer_text" => array("integer", (int) $this->hasPeerReviewText()),
1072 "peer_rating" => array("integer", (int) $this->hasPeerReviewRating()),
1073 "peer_crit_cat" => array("integer", $this->getPeerReviewCriteriaCatalogue()),
1074 "fb_file" => array("text", $this->getFeedbackFile()),
1075 "fb_date" => array("integer", $this->getFeedbackDate()),
1076 "fb_date_custom" => array("integer", $this->getFeedbackDateCustom()),
1077 "fb_cron" => array("integer", $this->hasFeedbackCron()),
1078 "team_tutor" => array("integer", $this->getTeamTutor()),
1079 "max_file" => array("integer", $this->getMaxFile()),
1080 "portfolio_template" => array("integer", $this->getPortFolioTemplateId()),
1081 "min_char_limit" => array("integer", $this->getMinCharLimit()),
1082 "max_char_limit" => array("integer", $this->getMaxCharLimit()),
1083 "deadline_mode" => array("integer", $this->getDeadlineMode()),
1084 "relative_deadline" => array("integer", $this->getRelativeDeadline())
1085 ),
1086 array(
1087 "id" => array("integer", $this->getId()),
1088 )
1089 );
1090 $exc = new ilObjExercise($this->getExerciseId(), false);
1091 $exc->updateAllUsersStatus();
1092
1093 $this->handleCalendarEntries("update");
1094 }
1095
1099 public function delete()
1100 {
1101 $ilDB = $this->db;
1102
1103 $this->deleteGlobalFeedbackFile();
1104
1105 $ilDB->manipulate(
1106 "DELETE FROM exc_assignment WHERE " .
1107 " id = " . $ilDB->quote($this->getId(), "integer")
1108 );
1109 $exc = new ilObjExercise($this->getExerciseId(), false);
1110 $exc->updateAllUsersStatus();
1111
1112 $this->handleCalendarEntries("delete");
1113
1114 $reminder = new ilExAssignmentReminder();
1115 $reminder->deleteReminders($this->getId());
1116 }
1117
1118
1122 public static function getAssignmentDataOfExercise($a_exc_id)
1123 {
1124 global $DIC;
1125
1126 $ilDB = $DIC->database();
1127
1128 // should be changed to self::getInstancesByExerciseId()
1129
1130 $set = $ilDB->query("SELECT * FROM exc_assignment " .
1131 " WHERE exc_id = " . $ilDB->quote($a_exc_id, "integer") .
1132 " ORDER BY order_nr ASC");
1133 $data = array();
1134
1135 $order_val = 10;
1136 while ($rec = $ilDB->fetchAssoc($set)) {
1137 $data[] = array(
1138 "id" => $rec["id"],
1139 "exc_id" => $rec["exc_id"],
1140 "deadline" => $rec["time_stamp"],
1141 "deadline2" => $rec["deadline2"],
1142 "instruction" => $rec["instruction"],
1143 "title" => $rec["title"],
1144 "start_time" => $rec["start_time"],
1145 "order_val" => $order_val,
1146 "mandatory" => $rec["mandatory"],
1147 "type" => $rec["type"],
1148 "peer" => $rec["peer"],
1149 "peer_min" => $rec["peer_min"],
1150 "peer_dl" => $rec["peer_dl"],
1151 "peer_file" => $rec["peer_file"],
1152 "peer_prsl" => $rec["peer_prsl"],
1153 "fb_file" => $rec["fb_file"],
1154 "fb_date" => $rec["fb_date"],
1155 "fb_cron" => $rec["fb_cron"],
1156 "deadline_mode" => $rec["deadline_mode"],
1157 "relative_deadline" => $rec["relative_deadline"]
1158 );
1159 $order_val += 10;
1160 }
1161 return $data;
1162 }
1163
1169 public static function cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
1170 {
1171 $ass_data = self::getInstancesByExercise($a_old_exc_id);
1172 foreach ($ass_data as $d) {
1173 // clone assignment
1174 $new_ass = new ilExAssignment();
1175 $new_ass->setExerciseId($a_new_exc_id);
1176 $new_ass->setTitle($d->getTitle());
1177 $new_ass->setDeadline($d->getDeadline());
1178 $new_ass->setExtendedDeadline($d->getExtendedDeadline());
1179 $new_ass->setInstruction($d->getInstruction());
1180 $new_ass->setMandatory($d->getMandatory());
1181 $new_ass->setOrderNr($d->getOrderNr());
1182 $new_ass->setStartTime($d->getStartTime());
1183 $new_ass->setType($d->getType());
1184 $new_ass->setPeerReview($d->getPeerReview());
1185 $new_ass->setPeerReviewMin($d->getPeerReviewMin());
1186 $new_ass->setPeerReviewDeadline($d->getPeerReviewDeadline());
1187 $new_ass->setPeerReviewFileUpload($d->hasPeerReviewFileUpload());
1188 $new_ass->setPeerReviewPersonalized($d->hasPeerReviewPersonalized());
1189 $new_ass->setPeerReviewValid($d->getPeerReviewValid());
1190 $new_ass->setPeerReviewChars($d->getPeerReviewChars());
1191 $new_ass->setPeerReviewText($d->hasPeerReviewText());
1192 $new_ass->setPeerReviewRating($d->hasPeerReviewRating());
1193 $new_ass->setPeerReviewCriteriaCatalogue($d->getPeerReviewCriteriaCatalogue());
1194 $new_ass->setPeerReviewSimpleUnlock($d->getPeerReviewSimpleUnlock());
1195 $new_ass->setFeedbackFile($d->getFeedbackFile());
1196 $new_ass->setFeedbackDate($d->getFeedbackDate());
1197 $new_ass->setFeedbackDateCustom($d->getFeedbackDateCustom());
1198 $new_ass->setFeedbackCron($d->hasFeedbackCron()); // #16295
1199 $new_ass->setTeamTutor($d->getTeamTutor());
1200 $new_ass->setMaxFile($d->getMaxFile());
1201 $new_ass->setMinCharLimit($d->getMinCharLimit());
1202 $new_ass->setMaxCharLimit($d->getMaxCharLimit());
1203 $new_ass->setPortfolioTemplateId($d->getPortfolioTemplateId());
1204 $new_ass->setDeadlineMode($d->getDeadlineMode());
1205 $new_ass->setRelativeDeadline($d->getRelativeDeadline());
1206
1207 // criteria catalogue(s)
1208 if ($d->getPeerReviewCriteriaCatalogue() &&
1209 array_key_exists($d->getPeerReviewCriteriaCatalogue(), $a_crit_cat_map)) {
1210 $new_ass->setPeerReviewCriteriaCatalogue($a_crit_cat_map[$d->getPeerReviewCriteriaCatalogue()]);
1211 }
1212
1213 $new_ass->save();
1214
1215
1216 // clone assignment files
1217 include_once("./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
1218 $old_web_storage = new ilFSWebStorageExercise($a_old_exc_id, (int) $d->getId());
1219 $new_web_storage = new ilFSWebStorageExercise($a_new_exc_id, (int) $new_ass->getId());
1220 $new_web_storage->create();
1221 if (is_dir($old_web_storage->getPath())) {
1222 ilUtil::rCopy($old_web_storage->getPath(), $new_web_storage->getPath());
1223 }
1224
1225 // clone global feedback file
1226 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1227 $old_storage = new ilFSStorageExercise($a_old_exc_id, (int) $d->getId());
1228 $new_storage = new ilFSStorageExercise($a_new_exc_id, (int) $new_ass->getId());
1229 $new_storage->create();
1230 if (is_dir($old_storage->getGlobalFeedbackPath())) {
1231 ilUtil::rCopy($old_storage->getGlobalFeedbackPath(), $new_storage->getGlobalFeedbackPath());
1232 }
1233
1234 // clone reminders
1238 $rmd_sub = new ilExAssignmentReminder($a_old_exc_id, $d->getId(), $rem_type);
1239 if ($rmd_sub->getReminderStatus()) {
1240 $new_rmd_sub = new ilExAssignmentReminder($a_new_exc_id, $new_ass->getId(), $rem_type);
1241 $new_rmd_sub->setReminderStatus($rmd_sub->getReminderStatus());
1242 $new_rmd_sub->setReminderStart($rmd_sub->getReminderStart());
1243 $new_rmd_sub->setReminderEnd($rmd_sub->getReminderEnd());
1244 $new_rmd_sub->setReminderFrequency($rmd_sub->getReminderFrequency());
1245 $new_rmd_sub->setReminderMailTemplate($rmd_sub->getReminderMailTemplate());
1246 $new_rmd_sub->save();
1247 }
1248 }
1249
1250
1251 // type specific properties
1252 $ass_type = $d->getAssignmentType();
1253 $ass_type->cloneSpecificProperties($d, $new_ass);
1254 }
1255 }
1256
1260 public function getFiles()
1261 {
1262 $this->log->debug("getting files from class.ilExAssignment using ilFSWebStorageExercise");
1263 include_once("./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
1264 $storage = new ilFSWebStorageExercise($this->getExerciseId(), $this->getId());
1265 return $storage->getFiles();
1266 }
1267
1273 {
1274 $ilDB = $this->db;
1275
1276 $set = $ilDB->query(
1277 "SELECT filename, order_nr, id FROM exc_ass_file_order " .
1278 " WHERE assignment_id = " . $ilDB->quote($this->getId(), "integer")
1279 );
1280
1281 $data = array();
1282 while ($rec = $ilDB->fetchAssoc($set)) {
1283 $data[$rec['filename']] = $rec;
1284 }
1285
1286 return $data;
1287 }
1288
1292 public static function lookupMaxOrderNrForEx($a_exc_id)
1293 {
1294 global $DIC;
1295
1296 $ilDB = $DIC->database();
1297
1298 $set = $ilDB->query(
1299 "SELECT MAX(order_nr) mnr FROM exc_assignment " .
1300 " WHERE exc_id = " . $ilDB->quote($a_exc_id, "integer")
1301 );
1302 while ($rec = $ilDB->fetchAssoc($set)) {
1303 return (int) $rec["mnr"];
1304 }
1305 return 0;
1306 }
1307
1313 public static function lookupAssignmentOnline($a_ass_id)
1314 {
1315 global $DIC;
1316
1317 $ilDB = $DIC->database();
1318
1319 $query = "SELECT id FROM exc_assignment " .
1320 "WHERE start_time <= " . $ilDB->quote(time(), 'integer') . ' ' .
1321 "AND time_stamp >= " . $ilDB->quote(time(), 'integer') . ' ' .
1322 "AND id = " . $ilDB->quote($a_ass_id, 'integer');
1323 $res = $ilDB->query($query);
1324
1325 return $res->numRows() ? true : false;
1326 }
1327
1334 public static function lookupExerciseId($a_ass_id)
1335 {
1336 global $DIC;
1337
1338 $ilDB = $DIC->database();
1339
1340 $query = "SELECT exc_id FROM exc_assignment " .
1341 "WHERE id = " . $ilDB->quote($a_ass_id, 'integer');
1342 $res = $ilDB->fetchAssoc($ilDB->query($query));
1343
1344 return (int) $res["exc_id"];
1345 }
1346
1350 private static function lookup($a_id, $a_field)
1351 {
1352 global $DIC;
1353
1354 $ilDB = $DIC->database();
1355
1356 $set = $ilDB->query(
1357 "SELECT " . $a_field . " FROM exc_assignment " .
1358 " WHERE id = " . $ilDB->quote($a_id, "integer")
1359 );
1360
1361 $rec = $ilDB->fetchAssoc($set);
1362
1363 return $rec[$a_field];
1364 }
1365
1369 public static function lookupTitle($a_id)
1370 {
1371 return self::lookup($a_id, "title");
1372 }
1373
1377 public static function lookupType($a_id)
1378 {
1379 return self::lookup($a_id, "type");
1380 }
1381
1385 public static function saveAssOrderOfExercise($a_ex_id, $a_order)
1386 {
1387 global $DIC;
1388
1389 $ilDB = $DIC->database();
1390
1391 $result_order = array();
1392 asort($a_order);
1393 $nr = 10;
1394 foreach ($a_order as $k => $v) {
1395 // the check for exc_id is for security reasons. ass ids are unique.
1396 $ilDB->manipulate(
1397 $t = "UPDATE exc_assignment SET " .
1398 " order_nr = " . $ilDB->quote($nr, "integer") .
1399 " WHERE id = " . $ilDB->quote((int) $k, "integer") .
1400 " AND exc_id = " . $ilDB->quote((int) $a_ex_id, "integer")
1401 );
1402 $nr += 10;
1403 }
1404 }
1405
1409 public static function orderAssByDeadline($a_ex_id)
1410 {
1411 global $DIC;
1412
1413 $ilDB = $DIC->database();
1414
1415 $set = $ilDB->query(
1416 "SELECT id FROM exc_assignment " .
1417 " WHERE exc_id = " . $ilDB->quote($a_ex_id, "integer") .
1418 " ORDER BY time_stamp ASC"
1419 );
1420 $nr = 10;
1421 while ($rec = $ilDB->fetchAssoc($set)) {
1422 $ilDB->manipulate(
1423 "UPDATE exc_assignment SET " .
1424 " order_nr = " . $ilDB->quote($nr, "integer") .
1425 " WHERE id = " . $ilDB->quote($rec["id"], "integer")
1426 );
1427 $nr += 10;
1428 }
1429 }
1430
1434 public static function countMandatory($a_ex_id)
1435 {
1436 global $DIC;
1437
1438 $ilDB = $DIC->database();
1439
1440 $set = $ilDB->query(
1441 "SELECT count(*) cntm FROM exc_assignment " .
1442 " WHERE exc_id = " . $ilDB->quote($a_ex_id, "integer") .
1443 " AND mandatory = " . $ilDB->quote(1, "integer")
1444 );
1445 $rec = $ilDB->fetchAssoc($set);
1446 return $rec["cntm"];
1447 }
1448
1450
1454 public static function lookupUpdatedSubmission($ass_id, $member_id)
1455 {
1456 global $DIC;
1457
1458 $ilDB = $DIC->database();
1459 $lng = $DIC->language();
1460
1461 // team upload?
1462 $user_ids = self::getTeamMembersByAssignmentId($ass_id, $member_id);
1463 if (!$user_ids) {
1464 $user_ids = array($member_id);
1465 }
1466
1467 $q = "SELECT exc_mem_ass_status.status_time, exc_returned.ts " .
1468 "FROM exc_mem_ass_status, exc_returned " .
1469 "WHERE exc_mem_ass_status.status_time < exc_returned.ts " .
1470 "AND NOT exc_mem_ass_status.status_time IS NULL " .
1471 "AND exc_returned.ass_id = exc_mem_ass_status.ass_id " .
1472 "AND exc_returned.user_id = exc_mem_ass_status.usr_id " .
1473 "AND exc_returned.ass_id=" . $ilDB->quote($ass_id, "integer") .
1474 " AND " . $ilDB->in("exc_returned.user_id", $user_ids, "", "integer");
1475
1476 $usr_set = $ilDB->query($q);
1477
1478 $array = $ilDB->fetchAssoc($usr_set);
1479
1480 if (count($array) == 0) {
1481 return 0;
1482 } else {
1483 return 1;
1484 }
1485 }
1486
1490 public function getMemberListData()
1491 {
1492 $ilDB = $this->db;
1493
1494 $mem = array();
1495
1496 // first get list of members from member table
1497 $set = $ilDB->query("SELECT ud.usr_id, ud.lastname, ud.firstname, ud.login" .
1498 " FROM exc_members excm" .
1499 " JOIN usr_data ud ON (ud.usr_id = excm.usr_id)" .
1500 " WHERE excm.obj_id = " . $ilDB->quote($this->getExerciseId(), "integer"));
1501 while ($rec = $ilDB->fetchAssoc($set)) {
1502 $mem[$rec["usr_id"]] =
1503 array(
1504 "name" => $rec["lastname"] . ", " . $rec["firstname"],
1505 "login" => $rec["login"],
1506 "usr_id" => $rec["usr_id"],
1507 "lastname" => $rec["lastname"],
1508 "firstname" => $rec["firstname"]
1509 );
1510 }
1511
1512 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
1513
1514 $q = "SELECT * FROM exc_mem_ass_status " .
1515 "WHERE ass_id = " . $ilDB->quote($this->getId(), "integer");
1516 $set = $ilDB->query($q);
1517 while ($rec = $ilDB->fetchAssoc($set)) {
1518 if (isset($mem[$rec["usr_id"]])) {
1519 $sub = new ilExSubmission($this, $rec["usr_id"]);
1520
1521 $mem[$rec["usr_id"]]["sent_time"] = $rec["sent_time"];
1522 $mem[$rec["usr_id"]]["submission"] = $sub->getLastSubmission();
1523 $mem[$rec["usr_id"]]["status_time"] = $rec["status_time"];
1524 $mem[$rec["usr_id"]]["feedback_time"] = $rec["feedback_time"];
1525 $mem[$rec["usr_id"]]["notice"] = $rec["notice"];
1526 $mem[$rec["usr_id"]]["status"] = $rec["status"];
1527 $mem[$rec["usr_id"]]["mark"] = $rec["mark"];
1528 $mem[$rec["usr_id"]]["comment"] = $rec["u_comment"];
1529 }
1530 }
1531 return $mem;
1532 }
1533
1541 public function getExerciseMemberAssignmentData($a_user_id, $a_grade = "")
1542 {
1543 global $DIC;
1544 $ilDB = $DIC->database();
1545
1546 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
1547
1548 if (in_array($a_grade, array("notgraded", "passed", "failed"))) {
1549 $and_grade = " AND status = " . $ilDB->quote($a_grade, "text");
1550 }
1551
1552 $q = "SELECT * FROM exc_mem_ass_status " .
1553 "WHERE ass_id = " . $ilDB->quote($this->getId(), "integer") .
1554 " AND usr_id = " . $ilDB->quote($a_user_id, "integer") .
1555 $and_grade;
1556
1557 $set = $ilDB->query($q);
1558
1559 while ($rec = $ilDB->fetchAssoc($set)) {
1560 $sub = new ilExSubmission($this, $a_user_id);
1561
1562 $data["sent_time"] = $rec["sent_time"];
1563 $data["submission"] = $sub->getLastSubmission();
1564 $data["status_time"] = $rec["status_time"];
1565 $data["feedback_time"] = $rec["feedback_time"];
1566 $data["notice"] = $rec["notice"];
1567 $data["status"] = $rec["status"];
1568 $data["mark"] = $rec["mark"];
1569 $data["comment"] = $rec["u_comment"];
1570 }
1571
1572 return $data;
1573 }
1574
1578 public static function createNewUserRecords($a_user_id, $a_exc_id)
1579 {
1580 global $DIC;
1581
1582 $ilDB = $DIC->database();
1583
1584 $ass_data = self::getAssignmentDataOfExercise($a_exc_id);
1585 foreach ($ass_data as $ass) {
1586 //echo "-".$ass["id"]."-".$a_user_id."-";
1587 $ilDB->replace("exc_mem_ass_status", array(
1588 "ass_id" => array("integer", $ass["id"]),
1589 "usr_id" => array("integer", $a_user_id)
1590 ), array(
1591 "status" => array("text", "notgraded")
1592 ));
1593 }
1594 }
1595
1599 public static function createNewAssignmentRecords($a_ass_id, $a_exc)
1600 {
1601 global $DIC;
1602
1603 $ilDB = $DIC->database();
1604
1605 include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
1606 $exmem = new ilExerciseMembers($a_exc);
1607 $mems = $exmem->getMembers();
1608
1609 foreach ($mems as $mem) {
1610 $ilDB->replace("exc_mem_ass_status", array(
1611 "ass_id" => array("integer", $a_ass_id),
1612 "usr_id" => array("integer", $mem)
1613 ), array(
1614 "status" => array("text", "notgraded")
1615 ));
1616 }
1617 }
1618
1623 public function uploadAssignmentFiles($a_files)
1624 {
1625 ilLoggerFactory::getLogger("exc")->debug("upload assignment files files = ", $a_files);
1626 include_once("./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
1627 $storage = new ilFSWebStorageExercise($this->getExerciseId(), $this->getId());
1628 $storage->create();
1629 $storage->uploadAssignmentFiles($a_files);
1630 }
1631
1632
1636
1641 {
1642 global $DIC;
1643
1644
1645 // send and delete the zip file
1646 $deliverFilename = trim(str_replace(" ", "_", $this->getTitle() . "_" . $this->getId()));
1647 $deliverFilename = ilUtil::getASCIIFilename($deliverFilename);
1648 $deliverFilename = "multi_feedback_" . $deliverFilename;
1649
1650 $exc = new ilObjExercise($this->getExerciseId(), false);
1651
1652 $cdir = getcwd();
1653
1654 // create temporary directoy
1655 $tmpdir = ilUtil::ilTempnam();
1656 ilUtil::makeDir($tmpdir);
1657 $mfdir = $tmpdir . "/" . $deliverFilename;
1658 ilUtil::makeDir($mfdir);
1659
1660 // create subfolders <lastname>_<firstname>_<id> for each participant
1661 include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
1662 $exmem = new ilExerciseMembers($exc);
1663 $mems = $exmem->getMembers();
1664
1665 $mems = $DIC->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
1666 'edit_submissions_grades',
1667 'edit_submissions_grades',
1668 $exercise->getRefId(),
1669 $mems
1670 );
1671 foreach ($mems as $mem) {
1673 $subdir = $name["lastname"] . "_" . $name["firstname"] . "_" . $name["login"] . "_" . $name["user_id"];
1674 $subdir = ilUtil::getASCIIFilename($subdir);
1675 ilUtil::makeDir($mfdir . "/" . $subdir);
1676 }
1677
1678 // create the zip file
1679 chdir($tmpdir);
1680 $tmpzipfile = $tmpdir . "/multi_feedback.zip";
1681 ilUtil::zip($tmpdir, $tmpzipfile, true);
1682 chdir($cdir);
1683
1684
1685 ilUtil::deliverFile($tmpzipfile, $deliverFilename . ".zip", "", false, true);
1686 }
1687
1694 public function uploadMultiFeedbackFile($a_file)
1695 {
1696 $lng = $this->lng;
1698
1699 include_once("./Modules/Exercise/exceptions/class.ilExerciseException.php");
1700 if (!is_file($a_file["tmp_name"])) {
1701 throw new ilExerciseException($lng->txt("exc_feedback_file_could_not_be_uploaded"));
1702 }
1703
1704 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1705 $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1706 $mfu = $storage->getMultiFeedbackUploadPath($ilUser->getId());
1707 ilUtil::delDir($mfu, true);
1708 ilUtil::moveUploadedFile($a_file["tmp_name"], "multi_feedback.zip", $mfu . "/" . "multi_feedback.zip");
1709 ilUtil::unzip($mfu . "/multi_feedback.zip", true);
1710 $subdirs = ilUtil::getDir($mfu);
1711 $subdir = "notfound";
1712 foreach ($subdirs as $s => $j) {
1713 if ($j["type"] == "dir" && substr($s, 0, 14) == "multi_feedback") {
1714 $subdir = $s;
1715 }
1716 }
1717
1718 if (!is_dir($mfu . "/" . $subdir)) {
1719 throw new ilExerciseException($lng->txt("exc_no_feedback_dir_found_in_zip"));
1720 }
1721
1722 return true;
1723 }
1724
1731 public function getMultiFeedbackFiles($a_user_id = 0)
1732 {
1734
1735 if ($a_user_id == 0) {
1736 $a_user_id = $ilUser->getId();
1737 }
1738
1739 $mf_files = array();
1740
1741 // get members
1742 $exc = new ilObjExercise($this->getExerciseId(), false);
1743 include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
1744 $exmem = new ilExerciseMembers($exc);
1745 $mems = $exmem->getMembers();
1746
1747 // read mf directory
1748 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1749 $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1750 $mfu = $storage->getMultiFeedbackUploadPath($ilUser->getId());
1751
1752 // get subdir that starts with multi_feedback
1753 $subdirs = ilUtil::getDir($mfu);
1754 $subdir = "notfound";
1755 foreach ($subdirs as $s => $j) {
1756 if ($j["type"] == "dir" && substr($s, 0, 14) == "multi_feedback") {
1757 $subdir = $s;
1758 }
1759 }
1760
1761 $items = ilUtil::getDir($mfu . "/" . $subdir);
1762 foreach ($items as $k => $i) {
1763 // check directory
1764 if ($i["type"] == "dir" && !in_array($k, array(".", ".."))) {
1765 // check if valid member id is given
1766 $parts = explode("_", $i["entry"]);
1767 $user_id = (int) $parts[count($parts) - 1];
1768 if (in_array($user_id, $mems)) {
1769 // read dir of user
1770 $name = ilObjUser::_lookupName($user_id);
1771 $files = ilUtil::getDir($mfu . "/" . $subdir . "/" . $k);
1772 foreach ($files as $k2 => $f) {
1773 // append files to array
1774 if ($f["type"] == "file" && substr($k2, 0, 1) != ".") {
1775 $mf_files[] = array(
1776 "lastname" => $name["lastname"],
1777 "firstname" => $name["firstname"],
1778 "login" => $name["login"],
1779 "user_id" => $name["user_id"],
1780 "full_path" => $mfu . "/" . $subdir . "/" . $k . "/" . $k2,
1781 "file" => $k2);
1782 }
1783 }
1784 }
1785 }
1786 }
1787 return $mf_files;
1788 }
1789
1797 {
1798 $lng = $this->lng;
1800
1801 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1802 $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1803 $mfu = $storage->getMultiFeedbackUploadPath($ilUser->getId());
1804 ilUtil::delDir($mfu);
1805 }
1806
1813 public function saveMultiFeedbackFiles($a_files, ilObjExercise $a_exc)
1814 {
1815 if ($this->getExerciseId() != $a_exc->getId()) {
1816 return;
1817 }
1818
1819 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1820 $fstorage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1821 $fstorage->create();
1822
1823 $team_map = array();
1824
1825 $mf_files = $this->getMultiFeedbackFiles();
1826 foreach ($mf_files as $f) {
1827 $user_id = $f["user_id"];
1828 $file_path = $f["full_path"];
1829 $file_name = $f["file"];
1830
1831 // if checked in confirmation gui
1832 if ($a_files[$user_id][md5($file_name)] != "") {
1833 $submission = new ilExSubmission($this, $user_id);
1834 $feedback_id = $submission->getFeedbackId();
1835 $noti_rec_ids = $submission->getUserIds();
1836
1837 if ($feedback_id) {
1838 $fb_path = $fstorage->getFeedbackPath($feedback_id);
1839 $target = $fb_path . "/" . $file_name;
1840 if (is_file($target)) {
1841 unlink($target);
1842 }
1843 // rename file
1844 rename($file_path, $target);
1845
1846 if ($noti_rec_ids) {
1847 foreach ($noti_rec_ids as $user_id) {
1848 $member_status = $this->getMemberStatus($user_id);
1849 $member_status->setFeedback(true);
1850 $member_status->update();
1851 }
1852
1854 $file_name,
1855 $noti_rec_ids,
1856 (int) $this->getId()
1857 );
1858 }
1859 }
1860 }
1861 }
1862
1864 }
1865
1866
1867
1868
1874 protected function handleCalendarEntries($a_event)
1875 {
1876 $ilAppEventHandler = $this->app_event_handler;
1877
1878 $dl_id = $this->getId() . "0";
1879 $fbdl_id = $this->getId() . "1";
1880
1881 $context_ids = array($dl_id, $fbdl_id);
1882 $apps = array();
1883
1884 if ($a_event != "delete") {
1885 include_once "Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php";
1886
1887 // deadline or relative deadline given
1889 $app = new ilCalendarAppointmentTemplate($dl_id);
1890 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1891 $app->setSubtitle("cal_exc_deadline");
1892 $app->setTitle($this->getTitle());
1893 $app->setFullday(false);
1894 // note: in the case of a relative deadline this will be set to 0 / 1970...)
1895 // see ilCalendarScheduleFilterExercise for appointment modification
1896 $app->setStart(new ilDateTime($this->getDeadline(), IL_CAL_UNIX));
1897
1898 $apps[] = $app;
1899 }
1900
1901 if ($this->getPeerReview() &&
1902 $this->getPeerReviewDeadline()) {
1903 $app = new ilCalendarAppointmentTemplate($fbdl_id);
1904 $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1905 $app->setSubtitle("cal_exc_peer_review_deadline");
1906 $app->setTitle($this->getTitle());
1907 $app->setFullday(false);
1908 $app->setStart(new ilDateTime($this->getPeerReviewDeadline(), IL_CAL_UNIX));
1909
1910 $apps[] = $app;
1911 }
1912 }
1913
1914 include_once "Modules/Exercise/classes/class.ilObjExercise.php";
1915 $exc = new ilObjExercise($this->getExerciseId(), false);
1916
1917 $ilAppEventHandler->raise(
1918 'Modules/Exercise',
1919 $a_event . 'Assignment',
1920 array(
1921 'object' => $exc,
1922 'obj_id' => $exc->getId(),
1923 'context_ids' => $context_ids,
1924 'appointments' => $apps)
1925 );
1926 }
1927
1928
1929 public static function getPendingFeedbackNotifications()
1930 {
1931 global $DIC;
1932
1933 $ilDB = $DIC->database();
1934
1935 $res = array();
1936
1937 $set = $ilDB->query("SELECT id,fb_file,time_stamp,deadline2,fb_date FROM exc_assignment" .
1938 " WHERE fb_cron = " . $ilDB->quote(1, "integer") .
1939 " AND (fb_date = " . $ilDB->quote(self::FEEDBACK_DATE_DEADLINE, "integer") .
1940 " AND time_stamp IS NOT NULL" .
1941 " AND time_stamp > " . $ilDB->quote(0, "integer") .
1942 " AND time_stamp < " . $ilDB->quote(time(), "integer") .
1943 " AND fb_cron_done = " . $ilDB->quote(0, "integer") .
1944 ") OR (fb_date = " . $ilDB->quote(self::FEEDBACK_DATE_CUSTOM, "integer") .
1945 " AND fb_date_custom IS NOT NULL" .
1946 " AND fb_date_custom > " . $ilDB->quote(0, "integer") .
1947 " AND fb_date_custom < " . $ilDB->quote(time(), "integer") .
1948 " AND fb_cron_done = " . $ilDB->quote(0, "integer") . ")");
1949
1950
1951
1952 while ($row = $ilDB->fetchAssoc($set)) {
1953 if ($row['fb_date'] == self::FEEDBACK_DATE_DEADLINE) {
1954 $max = max($row['time_stamp'], $row['deadline2']);
1955 if (trim($row["fb_file"]) && $max <= time()) {
1956 $res[] = $row["id"];
1957 }
1958 } elseif ($row['fb_date'] == self::FEEDBACK_DATE_CUSTOM) {
1959 if (trim($row["fb_file"]) && $row['fb_date_custom'] <= time()) {
1960 $res[] = $row["id"];
1961 }
1962 }
1963 }
1964
1965 return $res;
1966 }
1967
1968 public static function sendFeedbackNotifications($a_ass_id, $a_user_id = null)
1969 {
1970 global $DIC;
1971
1972 $ilDB = $DIC->database();
1973
1974 $ass = new self($a_ass_id);
1975
1976 // valid assignment?
1977 if (!$ass->hasFeedbackCron() || !$ass->getFeedbackFile()) {
1978 return false;
1979 }
1980
1981 if (!$a_user_id) {
1982 // already done?
1983 $set = $ilDB->query("SELECT fb_cron_done" .
1984 " FROM exc_assignment" .
1985 " WHERE id = " . $ilDB->quote($a_ass_id, "integer"));
1986 $row = $ilDB->fetchAssoc($set);
1987 if ($row["fb_cron_done"]) {
1988 return false;
1989 }
1990 }
1991
1992 include_once "./Services/Notification/classes/class.ilSystemNotification.php";
1993 $ntf = new ilSystemNotification();
1994 $ntf->setLangModules(array("exc"));
1995 $ntf->setObjId($ass->getExerciseId());
1996 $ntf->setSubjectLangId("exc_feedback_notification_subject");
1997 $ntf->setIntroductionLangId("exc_feedback_notification_body");
1998 $ntf->addAdditionalInfo("exc_assignment", $ass->getTitle());
1999 $ntf->setGotoLangId("exc_feedback_notification_link");
2000 $ntf->setReasonLangId("exc_feedback_notification_reason");
2001
2002 if (!$a_user_id) {
2003 include_once "./Modules/Exercise/classes/class.ilExerciseMembers.php";
2004 $ntf->sendMail(ilExerciseMembers::_getMembers($ass->getExerciseId()));
2005
2006 $ilDB->manipulate("UPDATE exc_assignment" .
2007 " SET fb_cron_done = " . $ilDB->quote(1, "integer") .
2008 " WHERE id = " . $ilDB->quote($a_ass_id, "integer"));
2009 } else {
2010 $ntf->sendMail(array($a_user_id));
2011 }
2012
2013 return true;
2014 }
2015
2016
2017 // status
2018
2019 public function afterDeadline() // like: after effective deadline (for single user), no deadline: true
2020 {
2022
2023 // :TODO: always current user?
2024 $idl = $this->getPersonalDeadline($ilUser->getId()); // official deadline
2025
2026 // no deadline === true
2027 $deadline = max($this->deadline, $this->deadline2, $idl); // includes grace period
2028 return ($deadline - time() <= 0);
2029 }
2030
2031 public function afterDeadlineStrict($a_include_personal = true)
2032 {
2033 // :TODO: this means that peer feedback, global feedback is available
2034 // after LAST personal deadline
2035 // team management is currently ignoring personal deadlines
2036 $idl = (bool) $a_include_personal
2037 ? $this->getLastPersonalDeadline()
2038 : null;
2039
2040 // no deadline === false
2041 $deadline = max($this->deadline, $this->deadline2, $idl);
2042
2043 // #18271 - afterDeadline() does not handle last personal deadline
2044 if ($idl && $deadline == $idl) { // after effective deadline of all users
2045 return ($deadline - time() <= 0);
2046 }
2047
2048 return ($deadline > 0 && // like: after effective deadline (for single user), except: no deadline false
2049 $this->afterDeadline());
2050 }
2051
2055 public function afterCustomDate()
2056 {
2057 $date_custom = $this->getFeedbackDateCustom();
2058 //if the solution will be displayed only after reach all the deadlines.
2059 //$final_deadline = $this->afterDeadlineStrict();
2060 //$dl = max($final_deadline, time());
2061 //return ($date_custom - $dl <= 0);
2062 return ($date_custom - time() <= 0);
2063 }
2064
2065 public function beforeDeadline() // like: before effective deadline (for all users), no deadline: true
2066 {
2067 // no deadline === true
2068 return !$this->afterDeadlineStrict();
2069 }
2070
2071 public function notStartedYet()
2072 {
2073 return (time() - $this->start_time <= 0);
2074 }
2075
2076
2077 //
2078 // FEEDBACK FILES
2079 //
2080
2082 {
2083 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
2084 $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
2085 return $storage->getGlobalFeedbackPath();
2086 }
2087
2089 {
2091 }
2092
2093 public function handleGlobalFeedbackFileUpload(array $a_file)
2094 {
2096 ilUtil::delDir($path, true);
2097 if (ilUtil::moveUploadedFile($a_file["tmp_name"], $a_file["name"], $path . "/" . $a_file["name"])) {
2098 $this->setFeedbackFile($a_file["name"]);
2099 return true;
2100 }
2101 return false;
2102 }
2103
2105 {
2106 $file = $this->getFeedbackFile();
2107 if ($file) {
2109 return $path . "/" . $file;
2110 }
2111 }
2112
2117 public function getMemberStatus($a_user_id = null)
2118 {
2120
2121 if (!$a_user_id) {
2122 $a_user_id = $ilUser->getId();
2123 }
2124 if (!array_key_exists($a_user_id, $this->member_status)) {
2125 include_once "Modules/Exercise/classes/class.ilExAssignmentMemberStatus.php";
2126 $this->member_status[$a_user_id] = new ilExAssignmentMemberStatus($this->getId(), $a_user_id);
2127 }
2128 return $this->member_status[$a_user_id];
2129 }
2130
2132 {
2133 $ilDB = $this->db;
2134
2135 // see JF, 2015-05-11
2136
2137 $ext_deadline = $this->getExtendedDeadline();
2138
2139 include_once "Modules/Exercise/classes/class.ilExSubmission.php";
2140 foreach (ilExSubmission::getAllAssignmentFiles($this->exc_id, $this->getId()) as $file) {
2141 $id = $file["returned_id"];
2142 $uploaded = new ilDateTime($file["ts"], IL_CAL_DATETIME);
2143 $uploaded = $uploaded->get(IL_CAL_UNIX);
2144
2145 $deadline = $this->getPersonalDeadline($file["user_id"]);
2146 $last_deadline = max($deadline, $this->getExtendedDeadline());
2147
2148 $late = null;
2149
2150 // upload is not late anymore
2151 if ($file["late"] &&
2152 (!$last_deadline ||
2153 !$ext_deadline ||
2154 $uploaded < $deadline)) {
2155 $late = false;
2156 }
2157 // upload is now late
2158 elseif (!$file["late"] &&
2159 $ext_deadline &&
2160 $deadline &&
2161 $uploaded > $deadline) {
2162 $late = true;
2163 } elseif ($last_deadline && $uploaded > $last_deadline) {
2164 // do nothing, we do not remove submissions?
2165 }
2166
2167 if ($late !== null) {
2168 $ilDB->manipulate("UPDATE exc_returned" .
2169 " SET late = " . $ilDB->quote($late, "integer") .
2170 " WHERE returned_id = " . $ilDB->quote($id, "integer"));
2171 }
2172 }
2173 }
2174
2175
2176 //
2177 // individual deadlines
2178 //
2179
2180 public function setIndividualDeadline($id, ilDateTime $date)
2181 {
2182 $ilDB = $this->db;
2183
2184 $is_team = false;
2185 if (!is_numeric($id)) {
2186 $id = substr($id, 1);
2187 $is_team = true;
2188 }
2189
2190 include_once("./Modules/Exercise/classes/class.ilExcIndividualDeadline.php");
2191 $idl = ilExcIndividualDeadline::getInstance($this->getId(), $id, $is_team);
2192 $idl->setIndividualDeadline($date->get(IL_CAL_UNIX));
2193 $idl->save();
2194
2195 /*
2196 $ilDB->replace("exc_idl",
2197 array(
2198 "ass_id" => array("integer", $this->getId()),
2199 "member_id" => array("integer", $id),
2200 "is_team" => array("integer", $is_team)
2201 ),
2202 array(
2203 "tstamp" => array("integer", $date->get(IL_CAL_UNIX))
2204 )
2205 );*/
2206 }
2207
2208 public function getIndividualDeadlines()
2209 {
2210 $ilDB = $this->db;
2211
2212 $res = array();
2213
2214 $set = $ilDB->query("SELECT * FROM exc_idl" .
2215 " WHERE ass_id = " . $ilDB->quote($this->getId(), "integer"));
2216 while ($row = $ilDB->fetchAssoc($set)) {
2217 if ($row["is_team"]) {
2218 $row["member_id"] = "t" . $row["member_id"];
2219 }
2220
2221 $res[$row["member_id"]] = $row["tstamp"];
2222 }
2223
2224 return $res;
2225 }
2226
2227 public function hasActiveIDl()
2228 {
2229 return (bool) $this->getDeadline();
2230 }
2231
2232 public function hasReadOnlyIDl()
2233 {
2234 if (!$this->ass_type->usesTeams() &&
2235 $this->getPeerReview()) {
2236 // all deadlines are read-only if we have peer feedback
2237 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
2238 $peer_review = new ilExPeerReview($this);
2239 if ($peer_review->hasPeerReviewGroups()) {
2240 return true;
2241 }
2242 }
2243
2244 return false;
2245 }
2246
2252 public static function saveInstructionFilesOrderOfAssignment($a_ass_id, $a_order)
2253 {
2254 global $DIC;
2255
2256 $db = $DIC->database();
2257
2258 asort($a_order, SORT_NUMERIC);
2259
2260 $nr = 10;
2261 foreach ($a_order as $k => $v) {
2262 // the check for exc_id is for security reasons. ass ids are unique.
2263 $db->manipulate(
2264 $t = "UPDATE exc_ass_file_order SET " .
2265 " order_nr = " . $db->quote($nr, "integer") .
2266 " WHERE id = " . $db->quote((int) $k, "integer") .
2267 " AND assignment_id = " . $db->quote((int) $a_ass_id, "integer")
2268 );
2269 $nr += 10;
2270 }
2271 }
2272
2278 public static function instructionFileInsertOrder($a_filename, $a_ass_id, $a_order_nr = 0)
2279 {
2280 global $DIC;
2281
2282 $db = $DIC->database();
2283
2284 $order = 0;
2285 $order_val = 0;
2286
2287 if ($a_ass_id) {
2288 //first of all check the suffix and change if necessary
2289 $filename = ilUtil::getSafeFilename($a_filename);
2290
2291 if (!self::instructionFileExistsInDb($filename, $a_ass_id)) {
2292 if ($a_order_nr == 0) {
2293 $order_val = self::instructionFileOrderGetMax($a_ass_id);
2294 $order = $order_val + 10;
2295 } else {
2296 $order = $a_order_nr;
2297 }
2298
2299 $id = $db->nextID('exc_ass_file_order');
2300 $db->manipulate("INSERT INTO exc_ass_file_order " .
2301 "(id, assignment_id, filename, order_nr) VALUES (" .
2302 $db->quote($id, "integer") . "," .
2303 $db->quote($a_ass_id, "integer") . "," .
2304 $db->quote($filename, "text") . "," .
2305 $db->quote($order, "integer") .
2306 ")");
2307 }
2308 }
2309 }
2310
2311 public static function instructionFileDeleteOrder($a_ass_id, $a_file)
2312 {
2313 global $DIC;
2314
2315 $db = $DIC->database();
2316
2317 //now its done by filename. We need to figure how to get the order id in the confirmdelete method
2318 foreach ($a_file as $k => $v) {
2319 $db->manipulate(
2320 "DELETE FROM exc_ass_file_order " .
2321 //"WHERE id = " . $ilDB->quote((int)$k, "integer") .
2322 "WHERE filename = " . $db->quote($v, "string") .
2323 " AND assignment_id = " . $db->quote($a_ass_id, 'integer')
2324 );
2325 }
2326 }
2327
2333 public static function renameInstructionFile($a_old_name, $a_new_name, $a_ass_id)
2334 {
2335 global $DIC;
2336
2337 $db = $DIC->database();
2338
2339 if ($a_ass_id) {
2340 $db->manipulate(
2341 "DELETE FROM exc_ass_file_order" .
2342 " WHERE assignment_id = " . $db->quote((int) $a_ass_id, 'integer') .
2343 " AND filename = " . $db->quote($a_new_name, 'string')
2344 );
2345
2346 $db->manipulate(
2347 "UPDATE exc_ass_file_order SET" .
2348 " filename = " . $db->quote($a_new_name, 'string') .
2349 " WHERE assignment_id = " . $db->quote((int) $a_ass_id, 'integer') .
2350 " AND filename = " . $db->quote($a_old_name, 'string')
2351 );
2352 }
2353 }
2354
2360 public static function instructionFileExistsInDb($a_filename, $a_ass_id)
2361 {
2362 global $DIC;
2363
2364 $db = $DIC->database();
2365
2366 if ($a_ass_id) {
2367 $result = $db->query(
2368 "SELECT id FROM exc_ass_file_order" .
2369 " WHERE assignment_id = " . $db->quote((int) $a_ass_id, 'integer') .
2370 " AND filename = " . $db->quote($a_filename, 'string')
2371 );
2372
2373 return $db->numRows($result);
2374 }
2375 }
2376
2378 {
2379 global $DIC;
2380
2381 $db = $DIC->database();
2382
2383 $files = array_map(function ($v) {
2384 return $v["name"];
2385 }, $this->getFiles());
2386
2387 $set = $db->query("SELECT * FROM exc_ass_file_order " .
2388 " WHERE assignment_id = " . $db->quote($this->getId(), "integer") .
2389 " ORDER BY order_nr");
2390 $order_nr = 10;
2391 $numbered_files = array();
2392 while ($rec = $db->fetchAssoc($set)) {
2393 // file exists, set correct order nr
2394 if (in_array($rec["filename"], $files)) {
2395 $db->manipulate(
2396 "UPDATE exc_ass_file_order SET " .
2397 " order_nr = " . $db->quote($order_nr, "integer") .
2398 " WHERE assignment_id = " . $db->quote($this->getId(), "integer") .
2399 " AND id = " . $db->quote($rec["id"], "integer")
2400 );
2401 $order_nr += 10;
2402 $numbered_files[] = $rec["filename"];
2403 } else { // file does not exist, delete entry
2404 $db->manipulate(
2405 "DELETE FROM exc_ass_file_order " .
2406 " WHERE assignment_id = " . $db->quote($this->getId(), "integer") .
2407 " AND id = " . $db->quote($rec["id"], "integer")
2408 );
2409 }
2410 }
2411 foreach ($files as $f) {
2412 if (!in_array($f, $numbered_files)) {
2414 }
2415 }
2416 }
2417
2423 public function fileAddOrder($a_entries = array())
2424 {
2426
2427 $order = $this->getInstructionFilesOrder();
2428 foreach ($a_entries as $k => $e) {
2429 $a_entries[$k]["order_val"] = $order[$e["file"]]["order_nr"];
2430 $a_entries[$k]["order_id"] = $order[$e["file"]]["id"];
2431 }
2432
2433 return $a_entries;
2434 }
2435
2440 public static function instructionFileOrderGetMax($a_ass_id)
2441 {
2442 global $DIC;
2443
2444 $db = $DIC->database();
2445
2446 //get max order number
2447 $result = $db->queryF(
2448 "SELECT max(order_nr) as max_order FROM exc_ass_file_order WHERE assignment_id = %s",
2449 array('integer'),
2450 array($db->quote($a_ass_id, 'integer'))
2451 );
2452
2453 while ($row = $db->fetchAssoc($result)) {
2454 $order_val = (int) $row['max_order'];
2455 }
2456 return $order_val;
2457 }
2458
2459
2465 public function setMinCharLimit($a_val)
2466 {
2467 $this->min_char_limit = $a_val;
2468 }
2469
2475 public function getMinCharLimit()
2476 {
2477 return $this->min_char_limit;
2478 }
2479
2484 public function setMaxCharLimit($a_val)
2485 {
2486 $this->max_char_limit = $a_val;
2487 }
2488
2493 public function getMaxCharLimit()
2494 {
2495 return $this->max_char_limit;
2496 }
2497
2505 public function getCalculatedDeadlines()
2506 {
2507 $calculated_deadlines = array(
2508 "user" => array(),
2509 "team" => array()
2510 );
2511
2512 if ($this->getRelativeDeadline() && $this->getDeadlineMode() == self::DEADLINE_RELATIVE) {
2513 include_once("./Modules/Exercise/classes/class.ilExcIndividualDeadline.php");
2514 foreach (ilExcIndividualDeadline::getStartingTimestamps($this->getId()) as $ts) {
2515 $type = $ts["is_team"]
2516 ? "team"
2517 : "user";
2518
2519 $calculated_deadlines[$type][$ts["member_id"]] = array(
2520 "calculated_deadline" => $ts["starting_ts"] + ($this->getRelativeDeadline() * 24 * 60 * 60)
2521 );
2522 }
2523 }
2524 return $calculated_deadlines;
2525 }
2526}
$result
user()
Definition: user.php:4
$path
Definition: aliased.php:25
$filename
Definition: buildRTE.php:89
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_TRANSLATION_SYSTEM
const IL_CAL_UNIX
const IL_CAL_DATETIME
Apointment templates are used for automatic generated apointments.
@classDescription Date and time handling
get($a_format, $a_format_str='', $a_tz='')
get formatted date
Exercise assignment member status.
TODO: import/export reminder data with the exercise/assignment.
static getTeamId($a_assignment_id, $a_user_id, $a_create_on_demand=false)
Get team id for member id.
static getInstance()
Get instance.
Exercise assignment.
getExerciseMemberAssignmentData($a_user_id, $a_grade="")
Get submission data for an specific user,exercise and assignment.
getRelativeDeadline()
Get relative deadline.
getMinCharLimit()
Get limit minimum characters.
static orderAssByDeadline($a_ex_id)
Order assignments by deadline date.
getPersonalDeadline($a_user_id)
Get individual deadline (max of common or idl (team) deadline = Official Deadline)
hasPeerReviewText()
Get peer review text status.
afterDeadlineStrict($a_include_personal=true)
getPeerReviewChars()
Get peer review minimum characters.
hasPeerReviewPersonalized()
Get peer review personalized status.
setDeadline($a_val)
Set deadline (timestamp)
static lookupMaxOrderNrForEx($a_exc_id)
Select the maximum order nr for an exercise.
static instructionFileInsertOrder($a_filename, $a_ass_id, $a_order_nr=0)
Store the file order in the database.
setOrderNr($a_val)
Set order nr.
clearMultiFeedbackDirectory()
Clear multi feedback directory.
getLastPersonalDeadline()
Get last/final personal deadline (of assignment)
setPeerReviewRating($a_val)
Set peer review rating.
setPeerReview($a_value)
Toggle peer review.
setPortfolioTemplateId($a_val)
Set portfolio template id.
getFeedbackDate()
Get (global) feedback file availability date.
getPeerReviewValid()
Get peer review validatiob.
getMemberListData()
get member list data
getMultiFeedbackFiles($a_user_id=0)
Get multi feedback files (of uploader)
getExerciseId()
Get exercise id.
getFeedbackDateCustom()
Get feedback file availability using custom date.
static saveInstructionFilesOrderOfAssignment($a_ass_id, $a_order)
Save ordering of instruction files for an assignment.
static lookup($a_id, $a_field)
Private lookup.
setTeamTutor($a_value)
Set team management by tutor.
setFeedbackCron($a_value)
Toggle (global) feedback file cron.
setTitle($a_val)
Set title.
fileAddOrder($a_entries=array())
uploadMultiFeedbackFile($a_file)
Upload multi feedback file.
handleCalendarEntries($a_event)
Handle calendar entries for deadline(s)
static renameInstructionFile($a_old_name, $a_new_name, $a_ass_id)
getId()
Get assignment id.
getInstruction()
Get instruction.
setFeedbackDateCustom($a_value)
Set (global) feedback file availability using a custom date.
static lookupUpdatedSubmission($ass_id, $member_id)
Check whether student has upload new files after tutor has set the exercise to another than notgraded...
static instructionFileGetFileOrderData($a_file_data, $a_ass_id)
static countMandatory($a_ex_id)
Order assignments by deadline date.
getTeamTutor()
Get team management by tutor.
getPeerReviewMin()
Get peer review minimum.
static getInstancesByExercise($a_exc_id)
setPeerReviewPersonalized($a_val)
Set peer review personalized.
setRelativeDeadline($a_val)
Set relative deadline.
isValidType($a_value)
Is given type valid?
setPeerReviewValid($a_value)
Set peer review validation.
getAssignmentType()
Get assignment type.
handleGlobalFeedbackFileUpload(array $a_file)
setPeerReviewText($a_val)
Set peer review text.
setPeerReviewSimpleUnlock($a_value)
Set peer review simple unlock.
getMaxFile()
Get max number of uploads.
static lookupExerciseId($a_ass_id)
Lookup excercise id for assignment id.
saveMultiFeedbackFiles($a_files, ilObjExercise $a_exc)
Save multi feedback files.
getCalculatedDeadlines()
Get calculated deadlines for user/team members.
setExtendedDeadline($a_val)
Set extended deadline (timestamp)
setIndividualDeadline($id, ilDateTime $date)
setPeerReviewMin($a_value)
Set peer review minimum.
setInstruction($a_val)
Set instruction.
static createNewAssignmentRecords($a_ass_id, $a_exc)
Create member status record for a new assignment for all participants.
static getPendingFeedbackNotifications()
initFromDB(array $a_set)
Import DB record.
uploadAssignmentFiles($a_files)
Upload assignment files (from creation form)
__construct($a_id=0)
Constructor.
getPeerReview()
Get peer review status.
hasPeerReviewFileUpload()
Get peer review file upload status.
static sendFeedbackNotifications($a_ass_id, $a_user_id=null)
setDeadlineMode($a_val)
Set deadline mode.
sendMultiFeedbackStructureFile(ilObjExercise $exercise)
Create member status record for a new assignment for all participants.
static cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
Clone assignments of exercise.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
setId($a_val)
Set assignment id.
setPeerReviewChars($a_value)
Set peer review minimum characters.
setMaxCharLimit($a_val)
Set limit maximum characters.
hasFeedbackCron()
Get (global) feedback file cron status.
getStartTime()
Get start time (timestamp)
setMaxFile($a_value)
Set max number of uploads.
getMemberStatus($a_user_id=null)
setStartTime($a_val)
Set start time (timestamp)
setMinCharLimit($a_val)
Set limit minimum characters.
setPeerReviewCriteriaCatalogue($a_value)
Set peer review criteria catalogue id.
getPeerReviewSimpleUnlock()
Get peer review simple unlock.
getDeadlineMode()
Get deadline mode.
static instructionFileExistsInDb($a_filename, $a_ass_id)
static instructionFileOrderGetMax($a_ass_id)
getPeerReviewDeadline()
Get peer review deadline (timestamp)
getMaxCharLimit()
get limit maximum characters return int max limit
getOrderNr()
Get order nr.
setPeerReviewDeadline($a_val)
Set peer review deadline (timestamp)
setFeedbackDate($a_value)
Set (global) feedback file availability date.
static lookupTitle($a_id)
Lookup title.
getFeedbackFile()
Get (global) feedback file.
getPeerReviewCriteriaCatalogue()
Get peer review criteria catalogue id.
setPeerReviewFileUpload($a_val)
Set peer review file upload.
getPortfolioTemplateId()
Get portfolio template id.
static createNewUserRecords($a_user_id, $a_exc_id)
Create member status record for a new participant for all assignments.
setType($a_value)
Set type.
static lookupAssignmentOnline($a_ass_id)
Check if assignment is online.
save()
Save assignment.
getDeadline()
Get deadline (timestamp)
static instructionFileDeleteOrder($a_ass_id, $a_file)
getExtendedDeadline()
Get extended deadline (timestamp)
setExerciseId($a_val)
Set exercise id.
static saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.
static lookupType($a_id)
Lookup type.
setFeedbackFile($a_value)
Set (global) feedback file.
setMandatory($a_val)
Set mandatory.
getMandatory()
Get mandatory.
hasPeerReviewRating()
Get peer review rating status.
Exercise peer review.
Exercise submission //TODO: This class has to much static methods related to delivered "files".
static getAllAssignmentFiles($a_exc_id, $a_ass_id)
static getInstancesByParentId($a_parent_id)
static getInstanceByType($a_type)
static getStartingTimestamps($a_ass_id)
Get starting timestamp data for an assignment.
static getInstance($a_ass_id, $a_participant_id, $a_is_team=false)
Get instance.
Exercise exceptions class.
Class ilExerciseMembers.
static _getMembers($a_obj_id)
static getLogger($a_component_id)
Get component logger.
Class ilObjExercise.
sendFeedbackFileNotification($a_feedback_file, $a_user_id, $a_ass_id, $a_is_text_feedback=false)
Send feedback file notification to user.
static _lookupName($a_user_id)
lookup user name
getId()
get object id @access public
Wrapper classes for system notifications.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static getSafeFilename($a_initial_filename)
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$i
Definition: disco.tpl.php:19
$target
Definition: test.php:19
$files
Definition: metarefresh.php:49
$row
$query
$s
Definition: pwgen.php:45
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
$ilUser
Definition: imgupload.php:18
$data
Definition: bench.php:6