ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
13  const TYPE_UPLOAD = 1;
14  const TYPE_BLOG = 2;
15  const TYPE_PORTFOLIO = 3;
16  const TYPE_UPLOAD_TEAM = 4;
17  const TYPE_TEXT = 5;
18 
21 
25 
26  protected $id;
27  protected $exc_id;
28  protected $type;
29  protected $start_time;
30  protected $deadline;
31  protected $deadline2;
32  protected $instruction;
33  protected $title;
34  protected $mandatory;
35  protected $order_nr;
36  protected $peer;
37  protected $peer_min;
38  protected $peer_unlock;
39  protected $peer_dl;
40  protected $peer_valid;
41  protected $peer_file;
42  protected $peer_personal;
43  protected $peer_char;
44  protected $peer_text;
45  protected $peer_rating;
46  protected $peer_crit_cat;
47  protected $feedback_file;
48  protected $feedback_cron;
49  protected $feedback_date;
50  protected $team_tutor = false;
51  protected $max_file;
52 
53  protected $member_status = array(); // [array]
54 
58  function __construct($a_id = 0)
59  {
60  $this->setType(self::TYPE_UPLOAD);
61  $this->setFeedbackDate(self::FEEDBACK_DATE_DEADLINE);
62 
63  if ($a_id > 0)
64  {
65  $this->setId($a_id);
66  $this->read();
67  }
68  }
69 
70  public static function getInstancesByExercise($a_exc_id)
71  {
72  global $ilDB;
73 
74  $set = $ilDB->query("SELECT * FROM exc_assignment ".
75  " WHERE exc_id = ".$ilDB->quote($a_exc_id, "integer").
76  " ORDER BY order_nr ASC");
77  $data = array();
78 
79  $order_val = 10;
80  while ($rec = $ilDB->fetchAssoc($set))
81  {
82  // ???
83  $rec["order_val"] = $order_val;
84 
85  $ass = new self();
86  $ass->initFromDB($rec);
87  $data[] = $ass;
88 
89  $order_val += 10;
90  }
91 
92  return $data;
93  }
94 
95  public function hasTeam()
96  {
97  return $this->type == self::TYPE_UPLOAD_TEAM;
98  }
99 
105  function setId($a_val)
106  {
107  $this->id = $a_val;
108  }
109 
115  function getId()
116  {
117  return $this->id;
118  }
119 
125  function setExerciseId($a_val)
126  {
127  $this->exc_id = $a_val;
128  }
129 
135  function getExerciseId()
136  {
137  return $this->exc_id;
138  }
139 
145  function setStartTime($a_val)
146  {
147  $this->start_time = $a_val;
148  }
149 
155  function getStartTime()
156  {
157  return $this->start_time;
158  }
159 
165  function setDeadline($a_val)
166  {
167  $this->deadline = $a_val;
168  }
169 
175  function getDeadline()
176  {
177  return $this->deadline;
178  }
179 
185  function setExtendedDeadline($a_val)
186  {
187  if($a_val !== null)
188  {
189  $a_val = (int)$a_val;
190  }
191  $this->deadline2 = $a_val;
192  }
193 
200  {
201  return $this->deadline2;
202  }
203 
209  function setInstruction($a_val)
210  {
211  $this->instruction = $a_val;
212  }
213 
219  function getInstruction()
220  {
221  return $this->instruction;
222  }
223 
229  function setTitle($a_val)
230  {
231  $this->title = $a_val;
232  }
233 
239  function getTitle()
240  {
241  return $this->title;
242  }
243 
249  function setMandatory($a_val)
250  {
251  $this->mandatory = $a_val;
252  }
253 
259  function getMandatory()
260  {
261  return $this->mandatory;
262  }
263 
269  function setOrderNr($a_val)
270  {
271  $this->order_nr = $a_val;
272  }
273 
279  function getOrderNr()
280  {
281  return $this->order_nr;
282  }
283 
289  function setType($a_value)
290  {
291  if($this->isValidType($a_value))
292  {
293  $this->type = (int)$a_value;
294 
295  if($this->type == self::TYPE_UPLOAD_TEAM)
296  {
297  $this->setPeerReview(false);
298  }
299  }
300  }
301 
307  function getType()
308  {
309  return $this->type;
310  }
311 
318  function isValidType($a_value)
319  {
320  if(in_array((int)$a_value, array(self::TYPE_UPLOAD, self::TYPE_BLOG,
321  self::TYPE_PORTFOLIO, self::TYPE_UPLOAD_TEAM, self::TYPE_TEXT)))
322  {
323  return true;
324  }
325  return false;
326  }
327 
333  function setPeerReview($a_value)
334  {
335  $this->peer = (bool)$a_value;
336  }
337 
343  function getPeerReview()
344  {
345  return (bool)$this->peer;
346  }
347 
353  function setPeerReviewMin($a_value)
354  {
355  $this->peer_min = (int)$a_value;
356  }
357 
363  function getPeerReviewMin()
364  {
365  return (int)$this->peer_min;
366  }
367 
373  function setPeerReviewSimpleUnlock($a_value)
374  {
375  $this->peer_unlock = (bool)$a_value;
376  }
377 
384  {
385  return (bool)$this->peer_unlock;
386  }
387 
393  function setPeerReviewDeadline($a_val)
394  {
395  $this->peer_dl = $a_val;
396  }
397 
404  {
405  return $this->peer_dl;
406  }
407 
413  function setPeerReviewValid($a_value)
414  {
415  $this->peer_valid = (int)$a_value;
416  }
417 
424  {
425  return (int)$this->peer_valid;
426  }
427 
433  function setPeerReviewRating($a_val)
434  {
435  $this->peer_rating = (bool)$a_val;
436  }
437 
444  {
445  return $this->peer_rating;
446  }
447 
453  function setPeerReviewText($a_val)
454  {
455  $this->peer_text = (bool)$a_val;
456  }
457 
463  function hasPeerReviewText()
464  {
465  return $this->peer_text;
466  }
467 
473  function setPeerReviewFileUpload($a_val)
474  {
475  $this->peer_file = (bool)$a_val;
476  }
477 
484  {
485  return $this->peer_file;
486  }
487 
493  function setPeerReviewPersonalized($a_val)
494  {
495  $this->peer_personal = (bool)$a_val;
496  }
497 
504  {
505  return $this->peer_personal;
506  }
507 
513  function setPeerReviewChars($a_value)
514  {
515  $a_value = (is_numeric($a_value) && (int)$a_value > 0)
516  ? (int)$a_value
517  : null;
518  $this->peer_char = $a_value;
519  }
520 
527  {
528  return $this->peer_char;
529  }
530 
537  {
538  $a_value = is_numeric($a_value)
539  ? (int)$a_value
540  : null;
541  $this->crit_cat = $a_value;
542  }
543 
550  {
551  return $this->crit_cat;
552  }
553 
555  {
556  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
557 
558  if($this->crit_cat)
559  {
560  return ilExcCriteria::getInstancesByParentId($this->crit_cat);
561  }
562  else
563  {
564  $res = array();
565 
566  if($this->peer_rating)
567  {
569  }
570 
571  if($this->peer_text)
572  {
573  $crit = ilExcCriteria::getInstanceByType("text");
574  if($this->peer_char)
575  {
576  $crit->setMinChars($this->peer_char);
577  }
578  $res[] = $crit;
579  }
580 
581  if($this->peer_file)
582  {
584  }
585 
586  return $res;
587  }
588  }
589 
595  function setFeedbackFile($a_value)
596  {
597  $this->feedback_file = (string)$a_value;
598  }
599 
605  function getFeedbackFile()
606  {
607  return (string)$this->feedback_file;
608  }
609 
615  function setFeedbackCron($a_value)
616  {
617  $this->feedback_cron = (string)$a_value;
618  }
619 
625  function hasFeedbackCron()
626  {
627  return (bool)$this->feedback_cron;
628  }
629 
635  function setFeedbackDate($a_value)
636  {
637  $this->feedback_date = (int)$a_value;
638  }
639 
645  function getFeedbackDate()
646  {
647  return (int)$this->feedback_date;
648  }
649 
655  function setTeamTutor($a_value)
656  {
657  $this->team_tutor = (bool)$a_value;
658  }
659 
665  function getTeamTutor()
666  {
667  return $this->team_tutor;
668  }
669 
675  function setMaxFile($a_value)
676  {
677  if($a_value !== null)
678  {
679  $a_value = (int)$a_value;
680  }
681  $this->max_file = $a_value;
682  }
683 
689  function getMaxFile()
690  {
691  return $this->max_file;
692  }
693 
697  function read()
698  {
699  global $ilDB;
700 
701  $set = $ilDB->query("SELECT * FROM exc_assignment ".
702  " WHERE id = ".$ilDB->quote($this->getId(), "integer")
703  );
704  $rec = $ilDB->fetchAssoc($set);
705 
706  // #16172 - might be deleted
707  if(is_array($rec))
708  {
709  $this->initFromDB($rec);
710  }
711  }
712 
719  protected function initFromDB(array $a_set)
720  {
721  $this->setId($a_set["id"]);
722  $this->setExerciseId($a_set["exc_id"]);
723  $this->setDeadline($a_set["time_stamp"]);
724  $this->setExtendedDeadline($a_set["deadline2"]);
725  $this->setInstruction($a_set["instruction"]);
726  $this->setTitle($a_set["title"]);
727  $this->setStartTime($a_set["start_time"]);
728  $this->setOrderNr($a_set["order_nr"]);
729  $this->setMandatory($a_set["mandatory"]);
730  $this->setType($a_set["type"]);
731  $this->setPeerReview($a_set["peer"]);
732  $this->setPeerReviewMin($a_set["peer_min"]);
733  $this->setPeerReviewSimpleUnlock($a_set["peer_unlock"]);
734  $this->setPeerReviewDeadline($a_set["peer_dl"]);
735  $this->setPeerReviewValid($a_set["peer_valid"]);
736  $this->setPeerReviewFileUpload($a_set["peer_file"]);
737  $this->setPeerReviewPersonalized($a_set["peer_prsl"]);
738  $this->setPeerReviewChars($a_set["peer_char"]);
739  $this->setPeerReviewText($a_set["peer_text"]);
740  $this->setPeerReviewRating($a_set["peer_rating"]);
741  $this->setPeerReviewCriteriaCatalogue($a_set["peer_crit_cat"]);
742  $this->setFeedbackFile($a_set["fb_file"]);
743  $this->setFeedbackDate($a_set["fb_date"]);
744  $this->setFeedbackCron($a_set["fb_cron"]);
745  $this->setTeamTutor($a_set["team_tutor"]);
746  $this->setMaxFile($a_set["max_file"]);
747  }
748 
752  function save()
753  {
754  global $ilDB;
755 
756  if ($this->getOrderNr() == 0)
757  {
758  $this->setOrderNr(
759  self::lookupMaxOrderNrForEx($this->getExerciseId())
760  + 10);
761  }
762 
763  $next_id = $ilDB->nextId("exc_assignment");
764  $ilDB->insert("exc_assignment", array(
765  "id" => array("integer", $next_id),
766  "exc_id" => array("integer", $this->getExerciseId()),
767  "time_stamp" => array("integer", $this->getDeadline()),
768  "deadline2" => array("integer", $this->getExtendedDeadline()),
769  "instruction" => array("clob", $this->getInstruction()),
770  "title" => array("text", $this->getTitle()),
771  "start_time" => array("integer", $this->getStartTime()),
772  "order_nr" => array("integer", $this->getOrderNr()),
773  "mandatory" => array("integer", $this->getMandatory()),
774  "type" => array("integer", $this->getType()),
775  "peer" => array("integer", $this->getPeerReview()),
776  "peer_min" => array("integer", $this->getPeerReviewMin()),
777  "peer_unlock" => array("integer", $this->getPeerReviewSimpleUnlock()),
778  "peer_dl" => array("integer", $this->getPeerReviewDeadline()),
779  "peer_valid" => array("integer", $this->getPeerReviewValid()),
780  "peer_file" => array("integer", $this->hasPeerReviewFileUpload()),
781  "peer_prsl" => array("integer", $this->hasPeerReviewPersonalized()),
782  "peer_char" => array("integer", $this->getPeerReviewChars()),
783  "peer_text" => array("integer", (int) $this->hasPeerReviewText()),
784  "peer_rating" => array("integer", (int) $this->hasPeerReviewRating()),
785  "peer_crit_cat" => array("integer", $this->getPeerReviewCriteriaCatalogue()),
786  "fb_file" => array("text", $this->getFeedbackFile()),
787  "fb_date" => array("integer", $this->getFeedbackDate()),
788  "fb_cron" => array("integer", $this->hasFeedbackCron()),
789  "team_tutor" => array("integer", $this->getTeamTutor()),
790  "max_file" => array("integer", $this->getMaxFile())
791  ));
792  $this->setId($next_id);
793  $exc = new ilObjExercise($this->getExerciseId(), false);
794  $exc->updateAllUsersStatus();
795  self::createNewAssignmentRecords($next_id, $exc);
796 
797  $this->handleCalendarEntries("create");
798  }
799 
803  function update()
804  {
805  global $ilDB;
806 
807  $ilDB->update("exc_assignment",
808  array(
809  "exc_id" => array("integer", $this->getExerciseId()),
810  "time_stamp" => array("integer", $this->getDeadline()),
811  "deadline2" => array("integer", $this->getExtendedDeadline()),
812  "instruction" => array("clob", $this->getInstruction()),
813  "title" => array("text", $this->getTitle()),
814  "start_time" => array("integer", $this->getStartTime()),
815  "order_nr" => array("integer", $this->getOrderNr()),
816  "mandatory" => array("integer", $this->getMandatory()),
817  "type" => array("integer", $this->getType()),
818  "peer" => array("integer", $this->getPeerReview()),
819  "peer_min" => array("integer", $this->getPeerReviewMin()),
820  "peer_unlock" => array("integer", $this->getPeerReviewSimpleUnlock()),
821  "peer_dl" => array("integer", $this->getPeerReviewDeadline()),
822  "peer_valid" => array("integer", $this->getPeerReviewValid()),
823  "peer_file" => array("integer", $this->hasPeerReviewFileUpload()),
824  "peer_prsl" => array("integer", $this->hasPeerReviewPersonalized()),
825  "peer_char" => array("integer", $this->getPeerReviewChars()),
826  "peer_text" => array("integer", (int) $this->hasPeerReviewText()),
827  "peer_rating" => array("integer", (int) $this->hasPeerReviewRating()),
828  "peer_crit_cat" => array("integer", $this->getPeerReviewCriteriaCatalogue()),
829  "fb_file" => array("text", $this->getFeedbackFile()),
830  "fb_date" => array("integer", $this->getFeedbackDate()),
831  "fb_cron" => array("integer", $this->hasFeedbackCron()),
832  "team_tutor" => array("integer", $this->getTeamTutor()),
833  "max_file" => array("integer", $this->getMaxFile())
834  ),
835  array(
836  "id" => array("integer", $this->getId()),
837  ));
838  $exc = new ilObjExercise($this->getExerciseId(), false);
839  $exc->updateAllUsersStatus();
840 
841  $this->handleCalendarEntries("update");
842  }
843 
847  function delete()
848  {
849  global $ilDB;
850 
851  $this->deleteGlobalFeedbackFile();
852 
853  $ilDB->manipulate("DELETE FROM exc_assignment WHERE ".
854  " id = ".$ilDB->quote($this->getId(), "integer")
855  );
856  $exc = new ilObjExercise($this->getExerciseId(), false);
857  $exc->updateAllUsersStatus();
858 
859  $this->handleCalendarEntries("delete");
860  }
861 
862 
866  static function getAssignmentDataOfExercise($a_exc_id)
867  {
868  global $ilDB;
869 
870  // should be changed to self::getInstancesByExerciseId()
871 
872  $set = $ilDB->query("SELECT * FROM exc_assignment ".
873  " WHERE exc_id = ".$ilDB->quote($a_exc_id, "integer").
874  " ORDER BY order_nr ASC");
875  $data = array();
876 
877  $order_val = 10;
878  while ($rec = $ilDB->fetchAssoc($set))
879  {
880 
881  $data[] = array(
882  "id" => $rec["id"],
883  "exc_id" => $rec["exc_id"],
884  "deadline" => $rec["time_stamp"],
885  "deadline2" => $rec["deadline2"],
886  "instruction" => $rec["instruction"],
887  "title" => $rec["title"],
888  "start_time" => $rec["start_time"],
889  "order_val" => $order_val,
890  "mandatory" => $rec["mandatory"],
891  "type" => $rec["type"],
892  "peer" => $rec["peer"],
893  "peer_min" => $rec["peer_min"],
894  "peer_dl" => $rec["peer_dl"],
895  "peer_file" => $rec["peer_file"],
896  "peer_prsl" => $rec["peer_prsl"],
897  "fb_file" => $rec["fb_file"],
898  "fb_date" => $rec["fb_date"],
899  "fb_cron" => $rec["fb_cron"],
900  );
901  $order_val += 10;
902  }
903  return $data;
904  }
905 
912  function cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
913  {
914  $ass_data = self::getInstancesByExercise($a_old_exc_id);
915  foreach ($ass_data as $d)
916  {
917  // clone assignment
918  $new_ass = new ilExAssignment();
919  $new_ass->setExerciseId($a_new_exc_id);
920  $new_ass->setTitle($d->getTitle());
921  $new_ass->setDeadline($d->getDeadline());
922  $new_ass->setExtendedDeadline($d->getExtendedDeadline());
923  $new_ass->setInstruction($d->getInstruction());
924  $new_ass->setMandatory($d->getMandatory());
925  $new_ass->setOrderNr($d->getOrderNr());
926  $new_ass->setStartTime($d->getStartTime());
927  $new_ass->setType($d->getType());
928  $new_ass->setPeerReview($d->getPeerReview());
929  $new_ass->setPeerReviewMin($d->getPeerReviewMin());
930  $new_ass->setPeerReviewDeadline($d->getPeerReviewDeadline());
931  $new_ass->setPeerReviewFileUpload($d->hasPeerReviewFileUpload());
932  $new_ass->setPeerReviewPersonalized($d->hasPeerReviewPersonalized());
933  $new_ass->setPeerReviewValid($d->getPeerReviewValid());
934  $new_ass->setPeerReviewChars($d->getPeerReviewChars());
935  $new_ass->setPeerReviewText($d->hasPeerReviewText());
936  $new_ass->setPeerReviewRating($d->hasPeerReviewRating());
937  $new_ass->setPeerReviewCriteriaCatalogue($d->getPeerReviewCriteriaCatalogue());
938  $new_ass->setPeerReviewSimpleUnlock($d->getPeerReviewSimpleUnlock());
939  $new_ass->setPeerReviewText($d->hasPeerReviewText());
940  $new_ass->setPeerReviewRating($d->hasPeerReviewRating());
941  $new_ass->setFeedbackFile($d->getFeedbackFile());
942  $new_ass->setFeedbackDate($d->getFeedbackDate());
943  $new_ass->setFeedbackCron($d->hasFeedbackCron()); // #16295
944  $new_ass->setTeamTutor($d->getTeamTutor());
945  $new_ass->setMaxFile($d->getMaxFile());
946 
947  // criteria catalogue(s)
948  if($d->getPeerReviewCriteriaCatalogue() &&
949  array_key_exists($d->getPeerReviewCriteriaCatalogue(), $a_crit_cat_map))
950  {
951  $new_ass->setPeerReviewCriteriaCatalogue($a_crit_cat_map[$d->getPeerReviewCriteriaCatalogue()]);
952  }
953 
954  $new_ass->save();
955 
956  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
957  $old_storage = new ilFSStorageExercise($a_old_exc_id, (int) $d->getId());
958  $new_storage = new ilFSStorageExercise($a_new_exc_id, (int) $new_ass->getId());
959  $new_storage->create();
960 
961  // clone assignment files
962  if (is_dir($old_storage->getPath()))
963  {
964  ilUtil::rCopy($old_storage->getPath(), $new_storage->getPath());
965  }
966 
967  // clone global feedback file
968  if (is_dir($old_storage->getGlobalFeedbackPath()))
969  {
970  ilUtil::rCopy($old_storage->getGlobalFeedbackPath(), $new_storage->getGlobalFeedbackPath());
971  }
972  }
973  }
974 
978  public function getFiles()
979  {
980  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
981  $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
982  return $storage->getFiles();
983  }
984 
988  static function lookupMaxOrderNrForEx($a_exc_id)
989  {
990  global $ilDB;
991 
992  $set = $ilDB->query("SELECT MAX(order_nr) mnr FROM exc_assignment ".
993  " WHERE exc_id = ".$ilDB->quote($a_exc_id, "integer")
994  );
995  while ($rec = $ilDB->fetchAssoc($set))
996  {
997  return (int) $rec["mnr"];
998  }
999  return 0;
1000  }
1001 
1007  public static function lookupAssignmentOnline($a_ass_id)
1008  {
1009  global $ilDB;
1010 
1011  $query = "SELECT id FROM exc_assignment ".
1012  "WHERE start_time <= ".$ilDB->quote(time(),'integer').' '.
1013  "AND time_stamp >= ".$ilDB->quote(time(),'integer').' '.
1014  "AND id = ".$ilDB->quote($a_ass_id,'integer');
1015  $res = $ilDB->query($query);
1016 
1017  return $res->numRows() ? true : false;
1018  }
1019 
1020 
1024  private static function lookup($a_id, $a_field)
1025  {
1026  global $ilDB;
1027 
1028  $set = $ilDB->query("SELECT ".$a_field." FROM exc_assignment ".
1029  " WHERE id = ".$ilDB->quote($a_id, "integer")
1030  );
1031 
1032  $rec = $ilDB->fetchAssoc($set);
1033 
1034  return $rec[$a_field];
1035  }
1036 
1040  static function lookupTitle($a_id)
1041  {
1042  return self::lookup($a_id, "title");
1043  }
1044 
1048  static function lookupType($a_id)
1049  {
1050  return self::lookup($a_id, "type");
1051  }
1052 
1056  function saveAssOrderOfExercise($a_ex_id, $a_order)
1057  {
1058  global $ilDB;
1059 
1060  $result_order = array();
1061  asort($a_order);
1062  $nr = 10;
1063  foreach ($a_order as $k => $v)
1064  {
1065  // the check for exc_id is for security reasons. ass ids are unique.
1066  $ilDB->manipulate($t = "UPDATE exc_assignment SET ".
1067  " order_nr = ".$ilDB->quote($nr, "integer").
1068  " WHERE id = ".$ilDB->quote((int) $k, "integer").
1069  " AND exc_id = ".$ilDB->quote((int) $a_ex_id, "integer")
1070  );
1071  $nr+=10;
1072  }
1073  }
1074 
1078  function orderAssByDeadline($a_ex_id)
1079  {
1080  global $ilDB;
1081 
1082  $set = $ilDB->query("SELECT id FROM exc_assignment ".
1083  " WHERE exc_id = ".$ilDB->quote($a_ex_id, "integer").
1084  " ORDER BY time_stamp ASC"
1085  );
1086  $nr = 10;
1087  while ($rec = $ilDB->fetchAssoc($set))
1088  {
1089  $ilDB->manipulate("UPDATE exc_assignment SET ".
1090  " order_nr = ".$ilDB->quote($nr, "integer").
1091  " WHERE id = ".$ilDB->quote($rec["id"], "integer")
1092  );
1093  $nr += 10;
1094  }
1095  }
1096 
1100  function countMandatory($a_ex_id)
1101  {
1102  global $ilDB;
1103 
1104  $set = $ilDB->query("SELECT count(*) cntm FROM exc_assignment ".
1105  " WHERE exc_id = ".$ilDB->quote($a_ex_id, "integer").
1106  " AND mandatory = ".$ilDB->quote(1, "integer")
1107  );
1108  $rec = $ilDB->fetchAssoc($set);
1109  return $rec["cntm"];
1110  }
1111 
1113 
1117  static function lookupUpdatedSubmission($ass_id, $member_id)
1118  {
1119  global $ilDB, $lng;
1120 
1121  // team upload?
1122  $user_ids = self::getTeamMembersByAssignmentId($ass_id, $member_id);
1123  if(!$user_ids)
1124  {
1125  $user_ids = array($member_id);
1126  }
1127 
1128  $q="SELECT exc_mem_ass_status.status_time, exc_returned.ts ".
1129  "FROM exc_mem_ass_status, exc_returned ".
1130  "WHERE exc_mem_ass_status.status_time < exc_returned.ts ".
1131  "AND NOT exc_mem_ass_status.status_time IS NULL ".
1132  "AND exc_returned.ass_id = exc_mem_ass_status.ass_id ".
1133  "AND exc_returned.user_id = exc_mem_ass_status.usr_id ".
1134  "AND exc_returned.ass_id=".$ilDB->quote($ass_id, "integer").
1135  " AND ".$ilDB->in("exc_returned.user_id", $user_ids, "", "integer");
1136 
1137  $usr_set = $ilDB->query($q);
1138 
1139  $array = $ilDB->fetchAssoc($usr_set);
1140 
1141  if (count($array)==0)
1142  {
1143  return 0;
1144  }
1145  else
1146  {
1147  return 1;
1148  }
1149 
1150  }
1151 
1156  {
1157  global $ilDB;
1158 
1159  $mem = array();
1160 
1161  // first get list of members from member table
1162  $set = $ilDB->query("SELECT ud.usr_id, ud.lastname, ud.firstname, ud.login".
1163  " FROM exc_members excm".
1164  " JOIN usr_data ud ON (ud.usr_id = excm.usr_id)".
1165  " WHERE excm.obj_id = ".$ilDB->quote($this->getExerciseId(), "integer"));
1166  while($rec = $ilDB->fetchAssoc($set))
1167  {
1168  $mem[$rec["usr_id"]] =
1169  array(
1170  "name" => $rec["lastname"].", ".$rec["firstname"],
1171  "login" => $rec["login"],
1172  "usr_id" => $rec["usr_id"],
1173  "lastname" => $rec["lastname"],
1174  "firstname" => $rec["firstname"]
1175  );
1176  }
1177 
1178  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
1179 
1180  $q = "SELECT * FROM exc_mem_ass_status ".
1181  "WHERE ass_id = ".$ilDB->quote($this->getId(), "integer");
1182  $set = $ilDB->query($q);
1183  while($rec = $ilDB->fetchAssoc($set))
1184  {
1185  if (isset($mem[$rec["usr_id"]]))
1186  {
1187  $sub = new ilExSubmission($this, $rec["usr_id"]);
1188 
1189  $mem[$rec["usr_id"]]["sent_time"] = $rec["sent_time"];
1190  $mem[$rec["usr_id"]]["submission"] = $sub->getLastSubmission();
1191  $mem[$rec["usr_id"]]["status_time"] = $rec["status_time"];
1192  $mem[$rec["usr_id"]]["feedback_time"] = $rec["feedback_time"];
1193  $mem[$rec["usr_id"]]["notice"] = $rec["notice"];
1194  $mem[$rec["usr_id"]]["status"] = $rec["status"];
1195  }
1196  }
1197  return $mem;
1198  }
1199 
1203  static function createNewUserRecords($a_user_id, $a_exc_id)
1204  {
1205  global $ilDB;
1206 
1207  $ass_data = self::getAssignmentDataOfExercise($a_exc_id);
1208  foreach ($ass_data as $ass)
1209  {
1210 //echo "-".$ass["id"]."-".$a_user_id."-";
1211  $ilDB->replace("exc_mem_ass_status", array(
1212  "ass_id" => array("integer", $ass["id"]),
1213  "usr_id" => array("integer", $a_user_id)
1214  ), array(
1215  "status" => array("text", "notgraded")
1216  ));
1217  }
1218  }
1219 
1223  static function createNewAssignmentRecords($a_ass_id, $a_exc)
1224  {
1225  global $ilDB;
1226 
1227  include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
1228  $exmem = new ilExerciseMembers($a_exc);
1229  $mems = $exmem->getMembers();
1230 
1231  foreach ($mems as $mem)
1232  {
1233  $ilDB->replace("exc_mem_ass_status", array(
1234  "ass_id" => array("integer", $a_ass_id),
1235  "usr_id" => array("integer", $mem)
1236  ), array(
1237  "status" => array("text", "notgraded")
1238  ));
1239  }
1240  }
1241 
1246  function uploadAssignmentFiles($a_files)
1247  {
1248  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1249  $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1250  $storage->create();
1251  $storage->uploadAssignmentFiles($a_files);
1252  }
1253 
1254 
1258 
1263  {
1264  global $ilDB;
1265 
1266 
1267  // send and delete the zip file
1268  $deliverFilename = trim(str_replace(" ", "_", $this->getTitle()."_".$this->getId()));
1269  $deliverFilename = ilUtil::getASCIIFilename($deliverFilename);
1270  $deliverFilename = "multi_feedback_".$deliverFilename;
1271 
1272  $exc = new ilObjExercise($this->getExerciseId(), false);
1273 
1274  $cdir = getcwd();
1275 
1276  // create temporary directoy
1277  $tmpdir = ilUtil::ilTempnam();
1278  ilUtil::makeDir($tmpdir);
1279  $mfdir = $tmpdir."/".$deliverFilename;
1280  ilUtil::makeDir($mfdir);
1281 
1282  // create subfolders <lastname>_<firstname>_<id> for each participant
1283  include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
1284  $exmem = new ilExerciseMembers($exc);
1285  $mems = $exmem->getMembers();
1286 
1287  foreach ($mems as $mem)
1288  {
1289  $name = ilObjUser::_lookupName($mem);
1290  $subdir = $name["lastname"]."_".$name["firstname"]."_".$name["login"]."_".$name["user_id"];
1291  $subdir = ilUtil::getASCIIFilename($subdir);
1292  ilUtil::makeDir($mfdir."/".$subdir);
1293  }
1294 
1295  // create the zip file
1296  chdir($tmpdir);
1297  $tmpzipfile = $tmpdir."/multi_feedback.zip";
1298  ilUtil::zip($tmpdir, $tmpzipfile, true);
1299  chdir($cdir);
1300 
1301 
1302  ilUtil::deliverFile($tmpzipfile, $deliverFilename.".zip", "", false, true);
1303  }
1304 
1311  function uploadMultiFeedbackFile($a_file)
1312  {
1313  global $lng, $ilUser;
1314 
1315  include_once("./Modules/Exercise/exceptions/class.ilExerciseException.php");
1316  if (!is_file($a_file["tmp_name"]))
1317  {
1318  throw new ilExerciseException($lng->txt("exc_feedback_file_could_not_be_uploaded"));
1319  }
1320 
1321  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1322  $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1323  $mfu = $storage->getMultiFeedbackUploadPath($ilUser->getId());
1324  ilUtil::delDir($mfu, true);
1325  ilUtil::moveUploadedFile($a_file["tmp_name"], "multi_feedback.zip", $mfu."/"."multi_feedback.zip");
1326  ilUtil::unzip($mfu."/multi_feedback.zip", true);
1327  $subdirs = ilUtil::getDir($mfu);
1328  $subdir = "notfound";
1329  foreach ($subdirs as $s => $j)
1330  {
1331  if ($j["type"] == "dir" && substr($s, 0, 14) == "multi_feedback")
1332  {
1333  $subdir = $s;
1334  }
1335  }
1336 
1337  if (!is_dir($mfu."/".$subdir))
1338  {
1339  throw new ilExerciseException($lng->txt("exc_no_feedback_dir_found_in_zip"));
1340  }
1341 
1342  return true;
1343  }
1344 
1351  function getMultiFeedbackFiles($a_user_id = 0)
1352  {
1353  global $ilUser;
1354 
1355  if ($a_user_id == 0)
1356  {
1357  $a_user_id = $ilUser->getId();
1358  }
1359 
1360  $mf_files = array();
1361 
1362  // get members
1363  $exc = new ilObjExercise($this->getExerciseId(), false);
1364  include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
1365  $exmem = new ilExerciseMembers($exc);
1366  $mems = $exmem->getMembers();
1367 
1368  // read mf directory
1369  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1370  $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1371  $mfu = $storage->getMultiFeedbackUploadPath($ilUser->getId());
1372 
1373  // get subdir that starts with multi_feedback
1374  $subdirs = ilUtil::getDir($mfu);
1375  $subdir = "notfound";
1376  foreach ($subdirs as $s => $j)
1377  {
1378  if ($j["type"] == "dir" && substr($s, 0, 14) == "multi_feedback")
1379  {
1380  $subdir = $s;
1381  }
1382  }
1383 
1384  $items = ilUtil::getDir($mfu."/".$subdir);
1385  foreach ($items as $k => $i)
1386  {
1387  // check directory
1388  if ($i["type"] == "dir" && !in_array($k, array(".", "..")))
1389  {
1390  // check if valid member id is given
1391  $parts = explode("_", $i["entry"]);
1392  $user_id = (int) $parts[count($parts) - 1];
1393  if (in_array($user_id, $mems))
1394  {
1395  // read dir of user
1396  $name = ilObjUser::_lookupName($user_id);
1397  $files = ilUtil::getDir($mfu."/".$subdir."/".$k);
1398  foreach ($files as $k2 => $f)
1399  {
1400  // append files to array
1401  if ($f["type"] == "file" && substr($k2, 0, 1) != ".")
1402  {
1403  $mf_files[] = array(
1404  "lastname" => $name["lastname"],
1405  "firstname" => $name["firstname"],
1406  "login" => $name["login"],
1407  "user_id" => $name["user_id"],
1408  "full_path" => $mfu."/".$subdir."/".$k."/".$k2,
1409  "file" => $k2);
1410  }
1411  }
1412  }
1413  }
1414  }
1415  return $mf_files;
1416  }
1417 
1425  {
1426  global $lng, $ilUser;
1427 
1428  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1429  $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1430  $mfu = $storage->getMultiFeedbackUploadPath($ilUser->getId());
1431  ilUtil::delDir($mfu);
1432  }
1433 
1440  function saveMultiFeedbackFiles($a_files, ilObjExercise $a_exc)
1441  {
1442  if($this->getExerciseId() != $a_exc->getId())
1443  {
1444  return;
1445  }
1446 
1447  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1448  $fstorage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1449  $fstorage->create();
1450 
1451  $team_map = array();
1452 
1453  $mf_files = $this->getMultiFeedbackFiles();
1454  foreach ($mf_files as $f)
1455  {
1456  $user_id = $f["user_id"];
1457  $file_path = $f["full_path"];
1458  $file_name = $f["file"];
1459 
1460  // if checked in confirmation gui
1461  if ($a_files[$user_id][md5($file_name)] != "")
1462  {
1463  $submission = new ilExSubmission($this, $user_id);
1464  $feedback_id = $submission->getFeedbackId();
1465  $noti_rec_ids = $submission->getUserIds();
1466 
1467  if ($feedback_id)
1468  {
1469  $fb_path = $fstorage->getFeedbackPath($feedback_id);
1470  $target = $fb_path."/".$file_name;
1471  if (is_file($target))
1472  {
1473  unlink($target);
1474  }
1475  // rename file
1476  rename($file_path, $target);
1477 
1478  if ($noti_rec_ids)
1479  {
1480  $a_exc->sendFeedbackFileNotification($file_name, $noti_rec_ids,
1481  (int) $this->getId());
1482  }
1483  }
1484  }
1485  }
1486 
1487  $this->clearMultiFeedbackDirectory();
1488  }
1489 
1490 
1491 
1492 
1498  protected function handleCalendarEntries($a_event)
1499  {
1500  global $ilAppEventHandler;
1501 
1502  $dl_id = $this->getId()."0";
1503  $fbdl_id = $this->getId()."1";
1504 
1505  $context_ids = array($dl_id, $fbdl_id);
1506  $apps = array();
1507 
1508  if($a_event != "delete")
1509  {
1510  include_once "Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php";
1511 
1512  if($this->getDeadline())
1513  {
1514  $app = new ilCalendarAppointmentTemplate($dl_id);
1515  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1516  $app->setSubtitle("cal_exc_deadline");
1517  $app->setTitle($this->getTitle());
1518  $app->setFullday(false);
1519  $app->setStart(new ilDateTime($this->getDeadline(), IL_CAL_UNIX));
1520 
1521  $apps[] = $app;
1522  }
1523 
1524  if($this->getPeerReview() &&
1525  $this->getPeerReviewDeadline())
1526  {
1527  $app = new ilCalendarAppointmentTemplate($fbdl_id);
1528  $app->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
1529  $app->setSubtitle("cal_exc_peer_review_deadline");
1530  $app->setTitle($this->getTitle());
1531  $app->setFullday(false);
1532  $app->setStart(new ilDateTime($this->getPeerReviewDeadline(), IL_CAL_UNIX));
1533 
1534  $apps[] = $app;
1535  }
1536 
1537  }
1538 
1539  include_once "Modules/Exercise/classes/class.ilObjExercise.php";
1540  $exc = new ilObjExercise($this->getExerciseId(), false);
1541 
1542  $ilAppEventHandler->raise('Modules/Exercise',
1543  $a_event.'Assignment',
1544  array(
1545  'object' => $exc,
1546  'obj_id' => $exc->getId(),
1547  'context_ids' => $context_ids,
1548  'appointments' => $apps));
1549  }
1550 
1551 
1552  public static function getPendingFeedbackNotifications()
1553  {
1554  global $ilDB;
1555 
1556  $res = array();
1557 
1558  $set = $ilDB->query("SELECT id,fb_file FROM exc_assignment".
1559  " WHERE fb_cron = ".$ilDB->quote(1, "integer").
1560  " AND fb_date = ".$ilDB->quote(self::FEEDBACK_DATE_DEADLINE, "integer").
1561  " AND time_stamp IS NOT NULL".
1562  " AND time_stamp > ".$ilDB->quote(0, "integer").
1563  " AND time_stamp < ".$ilDB->quote(time(), "integer").
1564  " AND fb_cron_done = ".$ilDB->quote(0, "integer"));
1565  while($row = $ilDB->fetchAssoc($set))
1566  {
1567  if(trim($row["fb_file"]))
1568  {
1569  $res[] = $row["id"];
1570  }
1571  }
1572 
1573  return $res;
1574  }
1575 
1576  public static function sendFeedbackNotifications($a_ass_id, $a_user_id = null)
1577  {
1578  global $ilDB;
1579 
1580  $ass = new self($a_ass_id);
1581 
1582  // valid assignment?
1583  if(!$ass->hasFeedbackCron() || !$ass->getFeedbackFile())
1584  {
1585  return false;
1586  }
1587 
1588  if(!$a_user_id)
1589  {
1590  // already done?
1591  $set = $ilDB->query("SELECT fb_cron_done".
1592  " FROM exc_assignment".
1593  " WHERE id = ".$ilDB->quote($a_ass_id, "integer"));
1594  $row = $ilDB->fetchAssoc($set);
1595  if($row["fb_cron_done"])
1596  {
1597  return false;
1598  }
1599  }
1600 
1601  include_once "./Services/Notification/classes/class.ilSystemNotification.php";
1602  $ntf = new ilSystemNotification();
1603  $ntf->setLangModules(array("exc"));
1604  $ntf->setObjId($ass->getExerciseId());
1605  $ntf->setSubjectLangId("exc_feedback_notification_subject");
1606  $ntf->setIntroductionLangId("exc_feedback_notification_body");
1607  $ntf->addAdditionalInfo("exc_assignment", $ass->getTitle());
1608  $ntf->setGotoLangId("exc_feedback_notification_link");
1609  $ntf->setReasonLangId("exc_feedback_notification_reason");
1610 
1611  if(!$a_user_id)
1612  {
1613  include_once "./Modules/Exercise/classes/class.ilExerciseMembers.php";
1614  $ntf->sendMail(ilExerciseMembers::_getMembers($ass->getExerciseId()));
1615 
1616  $ilDB->manipulate("UPDATE exc_assignment".
1617  " SET fb_cron_done = ".$ilDB->quote(1, "integer").
1618  " WHERE id = ".$ilDB->quote($a_ass_id, "integer"));
1619  }
1620  else
1621  {
1622  $ntf->sendMail(array($a_user_id));
1623  }
1624 
1625  return true;
1626  }
1627 
1628 
1629  // status
1630 
1631  public function afterDeadline()
1632  {
1633  // no deadline === true
1634  $deadline = max($this->deadline, $this->deadline2);
1635  return ($deadline - time() <= 0);
1636  }
1637 
1638  public function afterDeadlineStrict()
1639  {
1640  // no deadline === false
1641  $deadline = max($this->deadline, $this->deadline2);
1642  return ($deadline > 0 &&
1643  $this->afterDeadline());
1644  }
1645 
1646  public function beforeDeadline()
1647  {
1648  // no deadline === true
1649  return !$this->afterDeadlineStrict();
1650  }
1651 
1652  public function notStartedYet()
1653  {
1654  return (time() - $this->start_time <= 0);
1655  }
1656 
1657 
1658  //
1659  // FEEDBACK FILES
1660  //
1661 
1663  {
1664  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1665  $storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
1666  return $storage->getGlobalFeedbackPath();
1667  }
1668 
1670  {
1672  }
1673 
1674  function handleGlobalFeedbackFileUpload(array $a_file)
1675  {
1677  ilUtil::delDir($path, true);
1678  if (ilUtil::moveUploadedFile($a_file["tmp_name"], $a_file["name"], $path."/".$a_file["name"]))
1679  {
1680  $this->setFeedbackFile($a_file["name"]);
1681  return true;
1682  }
1683  return false;
1684  }
1685 
1687  {
1688  $file = $this->getFeedbackFile();
1689  if($file)
1690  {
1692  return $path."/".$file;
1693  }
1694  }
1695 
1696  public function getMemberStatus($a_user_id = null)
1697  {
1698  global $ilUser;
1699 
1700  if(!$a_user_id)
1701  {
1702  $a_user_id = $ilUser->getId();
1703  }
1704  if(!array_key_exists($a_user_id, $this->member_status))
1705  {
1706  include_once "Modules/Exercise/classes/class.ilExAssignmentMemberStatus.php";
1707  $this->member_status[$a_user_id] = new ilExAssignmentMemberStatus($this->getId(), $a_user_id);
1708  }
1709  return $this->member_status[$a_user_id];
1710  }
1711 
1712  public function recalculateLateSubmissions()
1713  {
1714  global $ilDB;
1715 
1716  // see JF, 2015-05-11
1717 
1718  $deadline = $this->getDeadline();
1719  $ext_deadline = $this->getExtendedDeadline();
1720  $last_deadline = max($this->getDeadline(), $this->getExtendedDeadline());
1721 
1722  include_once "Modules/Exercise/classes/class.ilExSubmission.php";
1723  foreach(ilExSubmission::getAllAssignmentFiles($this->exc_id, $this->getId()) as $file)
1724  {
1725  $id = $file["returned_id"];
1726  $uploaded = new ilDateTime($file["ts"], IL_CAL_DATETIME);
1727  $uploaded = $uploaded->get(IL_CAL_UNIX);
1728 
1729  $late = null;
1730 
1731  // upload is not late anymore
1732  if($file["late"] &&
1733  (!$last_deadline ||
1734  !$ext_deadline ||
1735  $uploaded < $deadline))
1736  {
1737  $late = false;
1738  }
1739  // upload is now late
1740  else if(!$file["late"] &&
1741  $ext_deadline &&
1742  $deadline &&
1743  $uploaded > $deadline)
1744  {
1745  $late = true;
1746  }
1747  else if($last_deadline && $uploaded > $last_deadline)
1748  {
1749  // do nothing, we do not remove submissions?
1750  }
1751 
1752  if($late !== null)
1753  {
1754  $ilDB->manipulate("UPDATE exc_returned".
1755  " SET late = ".$ilDB->quote($late, "integer").
1756  " WHERE returned_id = ".$ilDB->quote($id, "integer"));
1757  }
1758  }
1759  }
1760 }
1761 
1762 ?>
getPeerReview()
Get peer review status.
static getInstanceByType($a_type)
static _lookupName($a_user_id)
lookup user name
Exercise assignment member status.
print $file
getMemberStatus($a_user_id=null)
orderAssByDeadline($a_ex_id)
Order assignments by deadline date.
saveMultiFeedbackFiles($a_files, ilObjExercise $a_exc)
Save multi feedback files.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
Exercise assignment.
static sendFeedbackNotifications($a_ass_id, $a_user_id=null)
const IL_CAL_DATETIME
getMemberListData()
get member list data
Class ilExerciseMembers.
setMaxFile($a_value)
Set max number of uploads.
getFeedbackDate()
Get (global) feedback file availability date.
setFeedbackFile($a_value)
Set (global) feedback file.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
setPeerReviewMin($a_value)
Set peer review minimum.
const IL_CAL_TRANSLATION_SYSTEM
static getPendingFeedbackNotifications()
setTeamTutor($a_value)
Set team management by tutor.
setPeerReviewFileUpload($a_val)
Set peer review file upload.
countMandatory($a_ex_id)
Order assignments by deadline date.
getStartTime()
Get start time (timestamp)
getId()
Get assignment id.
initFromDB(array $a_set)
Import DB record.
setPeerReview($a_value)
Toggle peer review.
setPeerReviewDeadline($a_val)
Set peer review deadline (timestamp)
getDeadline()
Get deadline (timestamp)
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
save()
Save assignment.
hasPeerReviewRating()
Get peer review rating status.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
hasFeedbackCron()
Get (global) feedback file cron status.
setPeerReviewValid($a_value)
Set peer review validation.
setType($a_value)
Set type.
Apointment templates are used for automatic generated apointments.
setTitle($a_val)
Set title.
saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.
const IL_CAL_UNIX
setOrderNr($a_val)
Set order nr.
static lookup($a_id, $a_field)
Private lookup.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
setInstruction($a_val)
Set instruction.
cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
Clone assignments of exercise.
handleCalendarEntries($a_event)
Handle calendar entries for deadline(s)
getTeamTutor()
Get team management by tutor.
uploadMultiFeedbackFile($a_file)
Upload multi feedback file.
static lookupAssignmentOnline($a_ass_id)
Check if assignment is online.
setStartTime($a_val)
Set start time (timestamp)
getExerciseId()
Get exercise id.
getPeerReviewValid()
Get peer review validatiob.
Class ilObjExercise.
setDeadline($a_val)
Set deadline (timestamp)
$data
hasPeerReviewPersonalized()
Get peer review personalized status.
getId()
get object id public
static getInstancesByParentId($a_parent_id)
setPeerReviewCriteriaCatalogue($a_value)
Set peer review criteria catalogue id.
static lookupUpdatedSubmission($ass_id, $member_id)
Check whether student has upload new files after tutor has set the exercise to another than notgraded...
setPeerReviewPersonalized($a_val)
Set peer review personalized.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
setPeerReviewRating($a_val)
Set peer review rating.
static getInstancesByExercise($a_exc_id)
uploadAssignmentFiles($a_files)
Upload assignment files (from creation form)
setPeerReviewSimpleUnlock($a_value)
Set peer review simple unlock.
hasPeerReviewText()
Get peer review text status.
sendMultiFeedbackStructureFile()
Create member status record for a new assignment for all participants.
Date and time handling
setPeerReviewText($a_val)
Set peer review text.
handleGlobalFeedbackFileUpload(array $a_file)
setExerciseId($a_val)
Set exercise id.
getFeedbackFile()
Get (global) feedback file.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
getMandatory()
Get mandatory.
getPeerReviewMin()
Get peer review minimum.
getExtendedDeadline()
Get extended deadline (timestamp)
sendFeedbackFileNotification($a_feedback_file, $a_user_id, $a_ass_id, $a_is_text_feedback=false)
Send feedback file notification to user.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
setFeedbackCron($a_value)
Toggle (global) feedback file cron.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static lookupType($a_id)
Lookup type.
clearMultiFeedbackDirectory()
Clear multi feedback directory.
global $ilUser
Definition: imgupload.php:15
setFeedbackDate($a_value)
Set (global) feedback file availability date.
static lookupMaxOrderNrForEx($a_exc_id)
Select the maximum order nr for an exercise.
getMultiFeedbackFiles($a_user_id=0)
Get multi feedback files (of uploader)
getInstruction()
Get instruction.
global $lng
Definition: privfeed.php:40
$path
Definition: index.php:22
getPeerReviewSimpleUnlock()
Get peer review simple unlock.
global $ilDB
setPeerReviewChars($a_value)
Set peer review minimum characters.
setId($a_val)
Set assignment id.
getPeerReviewDeadline()
Get peer review deadline (timestamp)
Exercise submission.
hasPeerReviewFileUpload()
Get peer review file upload status.
getPeerReviewChars()
Get peer review minimum characters.
static getAllAssignmentFiles($a_exc_id, $a_ass_id)
getMaxFile()
Get max number of uploads.
static createNewUserRecords($a_user_id, $a_exc_id)
Create member status record for a new participant for all assignments.
setMandatory($a_val)
Set mandatory.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getPeerReviewCriteriaCatalogue()
Get peer review criteria catalogue id.
read()
Read from db.
Wrapper classes for system notifications.
setExtendedDeadline($a_val)
Set extended deadline (timestamp)
isValidType($a_value)
Is given type valid?
static createNewAssignmentRecords($a_ass_id, $a_exc)
Create member status record for a new assignment for all participants.
__construct($a_id=0)
Constructor.
static lookupTitle($a_id)
Lookup title.
getOrderNr()
Get order nr.
Class to report exception.