ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilExAssignmentEditorGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
15 {
19  protected $ctrl;
20 
24  protected $tabs;
25 
29  protected $lng;
30 
34  protected $tpl;
35 
39  protected $toolbar;
40 
44  protected $settings;
45 
49  protected $help;
50 
54  protected $exercise_id;
55 
59  protected $assignment;
60 
65 
69  protected $types;
70 
71 
75  protected $random_manager;
76 
80  protected $exc;
81 
90  public function __construct($a_exercise_id, $a_enable_peer_review_completion_settings, ilExAssignment $a_ass = null)
91  {
92  global $DIC;
93 
94  $this->ctrl = $DIC->ctrl();
95  $this->tabs = $DIC->tabs();
96  $this->lng = $DIC->language();
97  $this->tpl = $DIC["tpl"];
98  $this->toolbar = $DIC->toolbar();
99  $this->settings = $DIC->settings();
100  $this->help = $DIC["ilHelp"];
101  $this->exercise_id = $a_exercise_id;
102  $this->assignment = $a_ass;
103  $this->enable_peer_review_completion = (bool) $a_enable_peer_review_completion_settings;
104  $this->types = ilExAssignmentTypes::getInstance();
105  $this->type_guis = ilExAssignmentTypesGUI::getInstance();
106  $request = $DIC->exercise()->internal()->request();
107  $this->exc = $request->getRequestedExercise();
108  $this->random_manager = $DIC->exercise()->internal()->service()->getRandomAssignmentManager(
109  $request->getRequestedExercise()
110  );
111  }
112 
113  public function executeCommand()
114  {
115  $ilCtrl = $this->ctrl;
116  $ilTabs = $this->tabs;
117  $lng = $this->lng;
118 
119  $class = $ilCtrl->getNextClass($this);
120  $cmd = $ilCtrl->getCmd("listAssignments");
121 
122  switch ($class) {
123  case "ilpropertyformgui":
124  $form = $this->initAssignmentForm($_GET["ass_type"]);
125  $ilCtrl->forwardCommand($form);
126  break;
127 
128  // instruction files
129  case "ilexassignmentfilesystemgui":
130  $this->setAssignmentHeader();
131  $ilTabs->activateTab("ass_files");
132 
133  $fstorage = new ilFSWebStorageExercise($this->exercise_id, $this->assignment->getId());
134  $fstorage->create();
135 
136  $fs_gui = new ilExAssignmentFileSystemGUI($fstorage->getPath());
137  $fs_gui->setTitle($lng->txt("exc_instruction_files"));
138  $fs_gui->setTableId("excassfil" . $this->assignment->getId());
139  $fs_gui->setAllowDirectories(false);
140  $ilCtrl->forwardCommand($fs_gui);
141  break;
142 
143  case "ilexpeerreviewgui":
144  $ilTabs->clearTargets();
145  $ilTabs->setBackTarget(
146  $lng->txt("back"),
147  $ilCtrl->getLinkTarget($this, "listAssignments")
148  );
149 
150  $peer_gui = new ilExPeerReviewGUI($this->assignment);
151  $ilCtrl->forwardCommand($peer_gui);
152  break;
153 
154  default:
155  $this->{$cmd . "Object"}();
156  break;
157  }
158  }
159 
163  public function listAssignmentsObject()
164  {
165  $tpl = $this->tpl;
166  $ilToolbar = $this->toolbar;
167  $lng = $this->lng;
168  $ilCtrl = $this->ctrl;
169 
170  $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "addAssignment"));
171 
172  $ilToolbar->addStickyItem($this->getTypeDropdown(), true);
173 
174  $button = ilSubmitButton::getInstance();
175  $button->setCaption("exc_add_assignment");
176  $button->setCommand("addAssignment");
177  $ilToolbar->addStickyItem($button);
178 
179 
180  $t = new ilAssignmentsTableGUI($this, "listAssignments", $this->exercise_id);
181  $tpl->setContent($t->getHTML());
182  }
183 
187  public function addAssignmentObject()
188  {
189  $tpl = $this->tpl;
190  $ilCtrl = $this->ctrl;
191 
192  // #16163 - ignore ass id from request
193  $this->assignment = null;
194 
195  if (!(int) $_POST["type"]) {
196  $ilCtrl->redirect($this, "listAssignments");
197  }
198 
199  $form = $this->initAssignmentForm((int) $_POST["type"], "create");
200  $tpl->setContent($form->getHTML());
201  }
202 
208  protected function getTypeDropdown()
209  {
210  $lng = $this->lng;
211 
212  $types = [];
213  foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
214  $types[$k] = $t->getTitle();
215  }
216 
217  $ty = new ilSelectInputGUI($lng->txt("exc_assignment_type"), "type");
218  $ty->setOptions($types);
219  $ty->setRequired(true);
220  return $ty;
221  }
222 
229  protected function initAssignmentForm($a_type, $a_mode = "create")
230  {
231  $lng = $this->lng;
232  $ilCtrl = $this->ctrl;
233 
234  $ass_type = $this->types->getById($a_type);
235  $ass_type_gui = $this->type_guis->getById($a_type);
236  $ilCtrl->setParameter($this, "ass_type", $a_type);
237 
238  $lng->loadLanguageModule("form");
239  $form = new ilPropertyFormGUI();
240  if ($a_mode == "edit") {
241  $form->setTitle($lng->txt("exc_edit_assignment"));
242  } else {
243  $form->setTitle($lng->txt("exc_new_assignment"));
244  }
245  $form->setFormAction($ilCtrl->getFormAction($this));
246 
247  // title
248  $ti = new ilTextInputGUI($lng->txt("title"), "title");
249  $ti->setMaxLength(200);
250  $ti->setRequired(true);
251  $form->addItem($ti);
252 
253  // type
254  $ty = $this->getTypeDropdown();
255  $ty->setValue($a_type);
256  $ty->setDisabled(true);
257  $form->addItem($ty);
258 
259  //
260  // type specific start
261  //
262 
263  $ass_type_gui->addEditFormCustomProperties($form);
264 
265  //
266  // type specific end
267  //
268 
269  if ($ass_type->usesTeams()) {
270  if ($a_mode == "edit") {
271  $has_teams = (bool) count(ilExAssignmentTeam::getAssignmentTeamMap($this->assignment->getId()));
272  } else {
273  $has_teams = false;
274  }
275 
276  // Radio for creators
277  $rd_team = new ilRadioGroupInputGUI($lng->txt("exc_team_formation"), "team_creator");
278 
279  $radio_participants = new ilRadioOption(
280  $lng->txt("exc_team_by_participants"),
282  $lng->txt("exc_team_by_participants_info")
283  );
284 
285  $radio_tutors = new ilRadioOption(
286  $lng->txt("exc_team_by_tutors"),
288  $lng->txt("exc_team_by_tutors_info")
289  );
290 
291  #23679
292  if (!$has_teams) {
293  // Creation options
294  $rd_creation_method = new ilRadioGroupInputGUI($lng->txt("exc_team_creation"), "team_creation");
295  $rd_creation_method->setRequired(true);
296 
297  //manual
298  $rd_creation_manual = new ilRadioOption(
299  $lng->txt("exc_team_by_tutors_manual"),
300  0,
301  $lng->txt("exc_team_by_tutors_manual_info")
302  );
303  $rd_creation_method->addOption($rd_creation_manual);
304 
305  //random options
306  $add_info = "";
307  if ($this->getExerciseTotalMembers() < 4) {
308  $add_info = " <strong>" . $lng->txt("exc_team_by_random_add_info") . "</strong>";
309  }
310  $rd_creation_random = new ilRadioOption(
311  $lng->txt("exc_team_by_random"),
313  $lng->txt("exc_team_by_random_info") . "<br>" . $lng->txt("exc_total_members") . ": " . $this->getExerciseTotalMembers() . $add_info
314  );
315  $rd_creation_method->addOption($rd_creation_random);
316 
317  $number_teams = new ilNumberInputGUI($lng->txt("exc_num_teams"), "number_teams");
318  $number_teams->setSize(3);
319  $number_teams->setMinValue(1);
320  $number_teams->setMaxValue($this->getExerciseTotalMembers());
321  $number_teams->setRequired(true);
322  $number_teams->setSuffix($lng->txt("exc_team_assignment_adopt_teams"));
323  $rd_creation_random->addSubItem($number_teams);
324 
325  $min_team_participants = new ilNumberInputGUI($lng->txt("exc_min_team_participants"), "min_participants_team");
326  $min_team_participants->setSize(3);
327  $min_team_participants->setMinValue(1);
328  $min_team_participants->setMaxValue($this->getExerciseTotalMembers());
329  $min_team_participants->setRequired(true);
330  $min_team_participants->setSuffix($lng->txt("exc_participants"));
331  $rd_creation_random->addSubItem($min_team_participants);
332 
333  $max_team_participants = new ilNumberInputGUI($lng->txt("exc_max_team_participants"), "max_participants_team");
334  $max_team_participants->setSize(3);
335  $max_team_participants->setMinValue(1);
336  $max_team_participants->setMaxValue($this->getExerciseTotalMembers());
337  $max_team_participants->setRequired(true);
338  $max_team_participants->setSuffix($lng->txt("exc_participants"));
339  $rd_creation_random->addSubItem($max_team_participants);
340 
341  $options = ilExAssignmentTeam::getAdoptableTeamAssignments($this->exercise_id);
342  if (count($options)) {
343  $radio_assignment = new ilRadioOption(
344  $lng->txt("exc_team_by_assignment"),
346  $lng->txt("exc_team_by_assignment_info")
347  );
348 
349  $radio_assignment_adopt = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
350  $radio_assignment_adopt->setRequired(true);
351  $radio_assignment_adopt->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1));
352 
353  foreach ($options as $id => $item) {
354  $option = new ilRadioOption($item["title"], $id);
355  $option->setInfo($lng->txt("exc_team_assignment_adopt_teams") . ": " . $item["teams"]);
356  $radio_assignment_adopt->addOption($option);
357  }
358  $radio_assignment->addSubItem($radio_assignment_adopt);
359  $rd_creation_method->addOption($radio_assignment);
360  }
361 
362  $radio_tutors->addSubItem($rd_creation_method);
363  }
364  $rd_team->addOption($radio_participants);
365  $rd_team->addOption($radio_tutors);
366  /*if(!$has_teams) {
367  $rd_team->addOption($radio_assignment);
368  }*/
369  $form->addItem($rd_team);
370 
371  if ($has_teams) {
372  $rd_team->setDisabled(true);
373  }
374  }
375 
376  // mandatory
377  if (!$this->random_manager->isActivated()) {
378  $cb = new ilCheckboxInputGUI($lng->txt("exc_mandatory"), "mandatory");
379  $cb->setInfo($lng->txt("exc_mandatory_info"));
380  $cb->setChecked(true);
381  $form->addItem($cb);
382  } else {
383  //
384  $ne = new ilNonEditableValueGUI($lng->txt("exc_mandatory"), "");
385  $ne->setValue($lng->txt("exc_mandatory_rand_determined"));
386  $form->addItem($ne);
387  }
388 
389  // Work Instructions
390  $sub_header = new ilFormSectionHeaderGUI();
391  $sub_header->setTitle($lng->txt("exc_work_instructions"), "work_instructions");
392  $form->addItem($sub_header);
393 
394  $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
395  $desc_input->setRows(20);
396  if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
397  $desc_input->setUseRte(true);
398  $desc_input->setRteTagSet("mini");
399  }
400  $form->addItem($desc_input);
401 
402  // files
403  if ($a_mode == "create") {
404  $files = new ilFileWizardInputGUI($lng->txt('objs_file'), 'files');
405  $files->setFilenames(array(0 => ''));
406  $form->addItem($files);
407  }
408 
409  // Schedule
410  $sub_header = new ilFormSectionHeaderGUI();
411  $sub_header->setTitle($lng->txt("exc_schedule"), "schedule");
412  $form->addItem($sub_header);
413 
414  // start time
415  $start_date = new ilDateTimeInputGUI($lng->txt("exc_start_time"), "start_time");
416  $start_date->setShowTime(true);
417  $form->addItem($start_date);
418 
419  // Deadline Mode
420  $radg = new ilRadioGroupInputGUI($lng->txt("exc_deadline"), "deadline_mode");
421  $radg->setValue(0);
422  $op1 = new ilRadioOption($lng->txt("exc_fixed_date"), 0, $lng->txt("exc_fixed_date_info"));
423  $radg->addOption($op1);
424  $op2 = new ilRadioOption($lng->txt("exc_relative_date"), 1, $lng->txt("exc_relative_date_info"));
425  $radg->addOption($op2);
426  $form->addItem($radg);
427 
428  // Deadline fixed date
429  $deadline = new ilDateTimeInputGUI($lng->txt("date"), "deadline");
430  $deadline->setShowTime(true);
431  $op1->addSubItem($deadline);
432 
433  // extended Deadline
434  $deadline2 = new ilDateTimeInputGUI($lng->txt("exc_deadline_extended"), "deadline2");
435  $deadline2->setInfo($lng->txt("exc_deadline_extended_info"));
436  $deadline2->setShowTime(true);
437  $deadline->addSubItem($deadline2);
438 
439 
440  // submit reminder
441  $rmd_submit = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_submit_setting"), "rmd_submit_status");
442 
443  $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_start"), "rmd_submit_start");
444  $rmd_submit_start->setSize(3);
445  $rmd_submit_start->setMaxLength(3);
446  $rmd_submit_start->setSuffix($lng->txt('days'));
447  $rmd_submit_start->setInfo($this->lng->txt("exc_reminder_start_info"));
448  $rmd_submit_start->setRequired(true);
449  $rmd_submit_start->setMinValue(1);
450  $rmd_submit->addSubItem($rmd_submit_start);
451 
452  $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_submit_freq");
453  $rmd_submit_frequency->setSize(3);
454  $rmd_submit_frequency->setMaxLength(3);
455  $rmd_submit_frequency->setSuffix($lng->txt('days'));
456  $rmd_submit_frequency->setRequired(true);
457  $rmd_submit_frequency->setMinValue(1);
458  $rmd_submit->addSubItem($rmd_submit_frequency);
459 
460  $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_submit_end");
461  $rmd_submit_end->setRequired(true);
462  $rmd_submit->addSubItem($rmd_submit_end);
463 
464  $rmd_submit->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::SUBMIT_REMINDER));
465 
466  // grade reminder
467  $rmd_grade = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_grade_setting"), "rmd_grade_status");
468 
469  $rmd_grade_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_grade_freq");
470  $rmd_grade_frequency->setSize(3);
471  $rmd_grade_frequency->setMaxLength(3);
472  $rmd_grade_frequency->setSuffix($lng->txt('days'));
473  $rmd_grade_frequency->setRequired(true);
474  $rmd_grade_frequency->setMinValue(1);
475  $rmd_grade->addSubItem($rmd_grade_frequency);
476 
477  $rmd_grade_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_grade_end");
478  $rmd_grade_end->setRequired(true);
479  $rmd_grade->addSubItem($rmd_grade_end);
480 
481  $rmd_grade->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::GRADE_REMINDER));
482 
483  $form->addItem($rmd_submit);
484  $form->addItem($rmd_grade);
485 
486  // relative deadline
487  $ti = new ilNumberInputGUI($lng->txt("days"), "relative_deadline");
488  $ti->setMaxLength(3);
489  $ti->setSize(3);
490  $op2->addSubItem($ti);
491 
492  // last submission for relative deadline
493  $last_submission = new ilDateTimeInputGUI($lng->txt("exc_rel_last_submission"), "rel_deadline_last_subm");
494  $last_submission->setInfo($lng->txt("exc_rel_last_submission_info"));
495  $last_submission->setShowTime(true);
496  $op2->addSubItem($last_submission);
497 
498 
499 
500  // max number of files
501  if ($ass_type->usesFileUpload()) {
502  $sub_header = new ilFormSectionHeaderGUI();
503  $sub_header->setTitle($ass_type->getTitle());
504  $form->addItem($sub_header);
505  $max_file_tgl = new ilCheckboxInputGUI($lng->txt("exc_max_file_tgl"), "max_file_tgl");
506  $form->addItem($max_file_tgl);
507 
508  $max_file = new ilNumberInputGUI($lng->txt("exc_max_file"), "max_file");
509  $max_file->setInfo($lng->txt("exc_max_file_info"));
510  $max_file->setRequired(true);
511  $max_file->setSize(3);
512  $max_file->setMinValue(1);
513  $max_file_tgl->addSubItem($max_file);
514  }
515 
516  // after submission
517  $sub_header = new ilFormSectionHeaderGUI();
518  $sub_header->setTitle($lng->txt("exc_after_submission"), "after_submission");
519  $form->addItem($sub_header);
520 
521  if (!$ass_type->usesTeams() && !$this->random_manager->isActivated()) {
522  // peer review
523  $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer");
524  $peer->setInfo($lng->txt("exc_peer_review_ass_setting_info"));
525  $form->addItem($peer);
526  }
527 
528 
529  // global feedback
530 
531  $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb");
532  $form->addItem($fb);
533 
534  $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file");
535  $fb_file->setRequired(true); // will be disabled on update if file exists - see getAssignmentValues()
536  // $fb_file->setAllowDeletion(true); makes no sense if required (overwrite or keep)
537  $fb->addSubItem($fb_file);
538 
539  $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date");
540  $fb_date->setRequired(true);
541  $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE));
542  $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION));
543 
544  //Extra radio option with date selection
545  $fb_date_custom_date = new ilDateTimeInputGUI($lng->txt("date"), "fb_date_custom");
546  $fb_date_custom_date->setRequired(true);
547  $fb_date_custom_date->setShowTime(true);
548  $fb_date_custom_option = new ilRadioOption($lng->txt("exc_global_feedback_file_after_date"), ilExAssignment::FEEDBACK_DATE_CUSTOM);
549  $fb_date_custom_option->addSubItem($fb_date_custom_date);
550  $fb_date->addOption($fb_date_custom_option);
551 
552 
553  $fb->addSubItem($fb_date);
554 
555  $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron");
556  $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info"));
557  $fb->addSubItem($fb_cron);
558 
559 
560  if ($a_mode == "create") {
561  $form->addCommandButton("saveAssignment", $lng->txt("save"));
562  $form->addCommandButton("listAssignments", $lng->txt("cancel"));
563  } else {
564  $form->addCommandButton("updateAssignment", $lng->txt("save"));
565  $form->addCommandButton("listAssignments", $lng->txt("cancel"));
566  }
567 
568  return $form;
569  }
570 
571  public function addMailTemplatesRadio($a_reminder_type)
572  {
573  global $DIC;
574 
575  $post_var = "rmd_" . $a_reminder_type . "_template_id";
576 
577  $r_group = new ilRadioGroupInputGUI($this->lng->txt("exc_reminder_mail_template"), $post_var);
578  $r_group->setRequired(true);
579  $r_group->addOption(new ilRadioOption($this->lng->txt("exc_reminder_mail_no_tpl"), 0));
580  $r_group->setValue(0);
581 
582  switch ($a_reminder_type) {
585  break;
588  break;
591  break;
592  default:
593  exit();
594  }
595 
597  $templateService = $DIC['mail.texttemplates.service'];
598  foreach ($templateService->loadTemplatesForContextId((string) $context->getId()) as $template) {
599  $r_group->addOption(new ilRadioOption($template->getTitle(), $template->getTplId()));
600  if ($template->isDefault()) {
601  $r_group->setValue($template->getTplId());
602  }
603  }
604 
605  return $r_group;
606  }
607 
614  protected function processForm(ilPropertyFormGUI $a_form)
615  {
616  $lng = $this->lng;
617 
618  $protected_peer_review_groups = false;
619 
620  if ($this->assignment) {
621  if ($this->assignment->getPeerReview()) {
622  $peer_review = new ilExPeerReview($this->assignment);
623  if ($peer_review->hasPeerReviewGroups()) {
624  $protected_peer_review_groups = true;
625  }
626  }
627 
628  if ($this->assignment->getFeedbackFile()) {
629  $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
630  }
631  }
632 
633  $valid = $a_form->checkInput();
634 
635  if ($protected_peer_review_groups) {
636  // checkInput() will add alert to disabled fields
637  $a_form->getItemByPostVar("deadline")->setAlert(null);
638  $a_form->getItemByPostVar("deadline2")->setAlert(null);
639  }
640 
641  if ($valid) {
642  $type = $a_form->getInput("type");
643  $ass_type = $this->types->getById($type);
644 
645  // dates
646 
647  $time_start = $a_form->getItemByPostVar("start_time")->getDate();
648  $time_start = $time_start
649  ? $time_start->get(IL_CAL_UNIX)
650  : null;
651 
652  $time_deadline = $a_form->getItemByPostVar("deadline")->getDate();
653  $time_deadline = $time_deadline
654  ? $time_deadline->get(IL_CAL_UNIX)
655  : null;
656  $time_deadline_ext = $a_form->getItemByPostVar("deadline2")->getDate();
657  $time_deadline_ext = $time_deadline_ext
658  ? $time_deadline_ext->get(IL_CAL_UNIX)
659  : null;
660  $time_fb_custom_date = $a_form->getItemByPostVar("fb_date_custom")->getDate();
661  $time_fb_custom_date = $time_fb_custom_date
662  ? $time_fb_custom_date->get(IL_CAL_UNIX)
663  : null;
664 
665  $reminder_submit_end_date = $a_form->getItemByPostVar("rmd_submit_end")->getDate();
666  $reminder_submit_end_date = $reminder_submit_end_date
667  ? $reminder_submit_end_date->get(IL_CAL_UNIX)
668  : null;
669 
670  $reminder_grade_end_date = $a_form->getItemByPostVar("rmd_grade_end")->getDate();
671  $reminder_grade_end_date = $reminder_grade_end_date
672  ? $reminder_grade_end_date->get(IL_CAL_UNIX)
673  : null;
674 
675  $time_deadline = null;
676  $time_deadline_ext = null;
677 
678  if ((int) $a_form->getInput("deadline_mode") == ilExAssignment::DEADLINE_ABSOLUTE) {
679  $time_deadline = $a_form->getItemByPostVar("deadline")->getDate();
680  $time_deadline = $time_deadline
681  ? $time_deadline->get(IL_CAL_UNIX)
682  : null;
683  $time_deadline_ext = $a_form->getItemByPostVar("deadline2")->getDate();
684  $time_deadline_ext = $time_deadline_ext
685  ? $time_deadline_ext->get(IL_CAL_UNIX)
686  : null;
687  }
688 
689 
690  // handle disabled elements
691  if ($protected_peer_review_groups) {
692  $time_deadline = $this->assignment->getDeadline();
693  $time_deadline_ext = $this->assignment->getExtendedDeadline();
694  }
695 
696  // no deadline?
697  if (!$time_deadline) {
698  // peer review
699  if (!$protected_peer_review_groups &&
700  $a_form->getInput("peer")) {
701  $a_form->getItemByPostVar("peer")
702  ->setAlert($lng->txt("exc_needs_fixed_deadline"));
703  $valid = false;
704  }
705  // global feedback
706  if ($a_form->getInput("fb") &&
707  $a_form->getInput("fb_date") == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
708  $a_form->getItemByPostVar("fb")
709  ->setAlert($lng->txt("exc_needs_deadline"));
710  $valid = false;
711  }
712  } else {
713  // #18269
714  if ($a_form->getInput("peer")) {
715  $time_deadline_max = max($time_deadline, $time_deadline_ext);
716  $peer_dl = $this->assignment // #18380
717  ? $this->assignment->getPeerReviewDeadline()
718  : null;
719  if ($peer_dl && $peer_dl < $time_deadline_max) {
720  $a_form->getItemByPostVar($peer_dl < $time_deadline_ext
721  ? "deadline2"
722  : "deadline")
723  ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
724  $valid = false;
725  }
726  }
727 
728  if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
729  $a_form->getItemByPostVar("deadline2")
730  ->setAlert($lng->txt("exc_deadline_ext_mismatch"));
731  $valid = false;
732  }
733 
734  $time_deadline_min = $time_deadline_ext
735  ? min($time_deadline, $time_deadline_ext)
736  : $time_deadline;
737  $time_deadline_max = max($time_deadline, $time_deadline_ext);
738 
739  // start > any deadline ?
740  if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
741  $a_form->getItemByPostVar("start_time")
742  ->setAlert($lng->txt("exc_start_date_should_be_before_end_date"));
743  $valid = false;
744  }
745  }
746 
747  if ($ass_type->usesTeams()) {
748  if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM &&
749  $a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
750  $team_validation = $this->validationTeamsFormation(
751  $a_form->getInput("number_teams"),
752  $a_form->getInput("min_participants_team"),
753  $a_form->getInput("max_participants_team")
754  );
755  if ($team_validation['status'] == 'error') {
756  $a_form->getItemByPostVar("team_creation")
757  ->setAlert($team_validation['msg']);
758  $a_form->getItemByPostVar($team_validation["field"])
759  ->setAlert($lng->txt("exc_value_can_not_set"));
760  $valid = false;
761  }
762  }
763  }
764 
765  if ($valid) {
766  $res = array(
767  // core
768  "type" => $a_form->getInput("type")
769  ,"title" => trim($a_form->getInput("title"))
770  ,"instruction" => trim($a_form->getInput("instruction"))
771  // dates
772  ,"start" => $time_start
773  ,"deadline" => $time_deadline
774  ,"deadline_ext" => $time_deadline_ext
775  ,"max_file" => $a_form->getInput("max_file_tgl")
776  ? $a_form->getInput("max_file")
777  : null
778  );
779  if (!$this->random_manager->isActivated()) {
780  $res["mandatory"] = $a_form->getInput("mandatory");
781  }
782 
783  if ($a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
784  $res['team_creator'] = $a_form->getInput("team_creator");
785  $res["team_creation"] = $a_form->getInput("team_creation");
786 
787  if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
788  $res["number_teams"] = $a_form->getInput("number_teams");
789  $res["min_participants_team"] = $a_form->getInput("min_participants_team");
790  $res["max_participants_team"] = $a_form->getInput("max_participants_team");
791  } elseif ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
792  $res['ass_adpt'] = $a_form->getInput("ass_adpt");
793  }
794  }
795 
796  // portfolio template
797  //if($a_form->getInput("template_id") && $a_form->getInput("template"))
798  //{
799  // $res['template_id'] = $a_form->getInput("template_id");
800  //}
801 
802  // text limitations
803  /*
804  if($a_form->getInput("limit_characters"))
805  {
806  $res['limit_characters'] = $a_form->getInput("limit_characters");
807  }
808  if($a_form->getInput("limit_characters") && $a_form->getInput("max_char_limit"))
809  {
810  $res['max_char_limit'] = $a_form->getInput("max_char_limit");
811  }
812  if($a_form->getInput("limit_characters") && $a_form->getInput("min_char_limit"))
813  {
814  $res['min_char_limit'] = $a_form->getInput("min_char_limit");
815 
816  }*/
817 
818 
819  $res["deadline_mode"] = $a_form->getInput("deadline_mode");
820 
821  if ($res["deadline_mode"] == ilExAssignment::DEADLINE_RELATIVE) {
822  $res["relative_deadline"] = $a_form->getInput("relative_deadline");
823  $rel_deadline_last_subm = $a_form->getItemByPostVar("rel_deadline_last_subm")->getDate();
824  $rel_deadline_last_subm = $rel_deadline_last_subm
825  ? $rel_deadline_last_subm->get(IL_CAL_UNIX)
826  : null;
827  $res["rel_deadline_last_subm"] = $rel_deadline_last_subm;
828  }
829 
830  // peer
831  if ($a_form->getInput("peer") ||
832  $protected_peer_review_groups) {
833  $res["peer"] = true;
834  }
835 
836  // files
837  if (is_array($_FILES["files"])) {
838  // #15994 - we are keeping the upload files array structure
839  // see ilFSStorageExercise::uploadAssignmentFiles()
840  $res["files"] = $_FILES["files"];
841  }
842 
843  // global feedback
844  if ($a_form->getInput("fb")) {
845  $res["fb"] = true;
846  $res["fb_cron"] = $a_form->getInput("fb_cron");
847  $res["fb_date"] = $a_form->getInput("fb_date");
848  $res["fb_date_custom"] = $time_fb_custom_date;
849 
850  if ($_FILES["fb_file"]["tmp_name"]) {
851  $res["fb_file"] = $_FILES["fb_file"];
852  }
853  }
854  if ($a_form->getInput("rmd_submit_status")) {
855  $res["rmd_submit_status"] = true;
856  $res["rmd_submit_start"] = $a_form->getInput("rmd_submit_start");
857  $res["rmd_submit_freq"] = $a_form->getInput("rmd_submit_freq");
858  $res["rmd_submit_end"] = $reminder_submit_end_date;
859  $res["rmd_submit_template_id"] = $a_form->getInput("rmd_submit_template_id");
860  }
861  if ($a_form->getInput("rmd_grade_status")) {
862  $res["rmd_grade_status"] = true;
863  $res["rmd_grade_freq"] = $a_form->getInput("rmd_grade_freq");
864  $res["rmd_grade_end"] = $reminder_grade_end_date;
865  $res["rmd_grade_template_id"] = $a_form->getInput("rmd_grade_template_id");
866  }
867 
868  return $res;
869  } else {
870  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
871  }
872  }
873  }
874 
881  protected function importFormToAssignment(ilExAssignment $a_ass, array $a_input)
882  {
883  $is_create = !(bool) $a_ass->getId();
884 
885  $a_ass->setTitle($a_input["title"]);
886  $a_ass->setInstruction($a_input["instruction"]);
887  if (!$this->random_manager->isActivated()) {
888  $a_ass->setMandatory($a_input["mandatory"]);
889  }
890 
891  $a_ass->setStartTime($a_input["start"]);
892  $a_ass->setDeadline($a_input["deadline"]);
893  $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
894  $a_ass->setDeadlineMode($a_input["deadline_mode"]);
895  $a_ass->setRelativeDeadline($a_input["relative_deadline"]);
896  $a_ass->setRelDeadlineLastSubmission($a_input["rel_deadline_last_subm"]);
897 
898  $a_ass->setMaxFile($a_input["max_file"]);
899  $a_ass->setTeamTutor($a_input["team_creator"]);
900 
901  //$a_ass->setPortfolioTemplateId($a_input['template_id']);
902 
903  //$a_ass->setMinCharLimit($a_input['min_char_limit']);
904  //$a_ass->setMaxCharLimit($a_input['max_char_limit']);
905 
906  if (!$this->random_manager->isActivated()) {
907  $a_ass->setPeerReview((bool) $a_input["peer"]);
908  }
909 
910  // peer review default values (on separate form)
911  if ($is_create) {
912  $a_ass->setPeerReviewMin(2);
913  $a_ass->setPeerReviewSimpleUnlock(false);
915  $a_ass->setPeerReviewPersonalized(false);
916  $a_ass->setPeerReviewFileUpload(false);
917  $a_ass->setPeerReviewText(true);
918  $a_ass->setPeerReviewRating(true);
919  }
920 
921  if ($a_input["fb"]) {
922  $a_ass->setFeedbackCron($a_input["fb_cron"]); // #13380
923  $a_ass->setFeedbackDate($a_input["fb_date"]);
924  $a_ass->setFeedbackDateCustom($a_input["fb_date_custom"]);
925  }
926 
927  // id needed for file handling
928  if ($is_create) {
929  $a_ass->save();
930 
931  // #15994 - assignment files
932  if (is_array($a_input["files"])) {
933  $a_ass->uploadAssignmentFiles($a_input["files"]);
934  }
935  } else {
936  // remove global feedback file?
937  if (!$a_input["fb"]) {
938  $a_ass->deleteGlobalFeedbackFile();
939  $a_ass->setFeedbackFile(null);
940  }
941 
942  $a_ass->update();
943  }
944 
945  // add global feedback file?
946  if ($a_input["fb"]) {
947  if (is_array($a_input["fb_file"])) {
948  $a_ass->handleGlobalFeedbackFileUpload($a_input["fb_file"]);
949  $a_ass->update();
950  }
951  }
952  $this->importFormToAssignmentReminders($a_input, $a_ass->getId());
953  }
954 
955  protected function importFormToAssignmentReminders($a_input, $a_ass_id)
956  {
957  $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::SUBMIT_REMINDER);
958  $this->saveReminderData($reminder, $a_input);
959 
960  $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::GRADE_REMINDER);
961  $this->saveReminderData($reminder, $a_input);
962  }
963 
964  //todo maybe we can refactor this method to use only one importFormToReminders
965  protected function importPeerReviewFormToAssignmentReminders($a_input, $a_ass_id)
966  {
967  $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::FEEDBACK_REMINDER);
968  $this->saveReminderData($reminder, $a_input);
969  }
970 
971  protected function saveReminderData(ilExAssignmentReminder $reminder, $a_input)
972  {
973  if ($reminder->getReminderStatus() == null) {
974  $action = "save";
975  } else {
976  $action = "update";
977  }
978  $type = $reminder->getReminderType();
979  $reminder->setReminderStatus((bool) $a_input["rmd_" . $type . "_status"]);
980  $reminder->setReminderStart((int) $a_input["rmd_" . $type . "_start"]);
981  $reminder->setReminderEnd((int) $a_input["rmd_" . $type . "_end"]);
982  $reminder->setReminderFrequency((int) $a_input["rmd_" . $type . "_freq"]);
983  $reminder->setReminderMailTemplate((int) $a_input["rmd_" . $type . "_template_id"]);
984  $reminder->{$action}();
985  }
986 
991  public function saveAssignmentObject()
992  {
993  $tpl = $this->tpl;
994  $lng = $this->lng;
995  $ilCtrl = $this->ctrl;
996 
997  // #16163 - ignore ass id from request
998  $this->assignment = null;
999 
1000  $form = $this->initAssignmentForm((int) $_POST["type"], "create");
1001  $input = $this->processForm($form);
1002  if (is_array($input)) {
1003  $ass = new ilExAssignment();
1004  $ass->setExerciseId($this->exercise_id);
1005  $ass->setType($input["type"]);
1006  $ass_type = $ass->getAssignmentType();
1007  $ass_type_gui = $this->type_guis->getById($ass->getType());
1008 
1009  $this->importFormToAssignment($ass, $input);
1010 
1011  $this->generateTeams($ass, $input);
1012  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1013 
1014  $ass_type_gui->importFormToAssignment($ass, $form);
1015  $ass->update();
1016 
1017  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1018 
1019  // because of sub-tabs we stay on settings screen
1020  $ilCtrl->setParameter($this, "ass_id", $ass->getId());
1021  $ilCtrl->redirect($this, "editAssignment");
1022  } else {
1023  $form->setValuesByPost();
1024  $tpl->setContent($form->getHtml());
1025  }
1026  }
1027 
1031  public function editAssignmentObject()
1032  {
1033  $ilTabs = $this->tabs;
1034  $tpl = $this->tpl;
1035 
1036  $this->setAssignmentHeader();
1037  $ilTabs->activateTab("ass_settings");
1038 
1039  $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1040  $this->getAssignmentValues($form);
1041  $tpl->setContent($form->getHTML());
1042  }
1043 
1047  public function getAssignmentValues(ilPropertyFormGUI $a_form)
1048  {
1049  $lng = $this->lng;
1050  $ilCtrl = $this->ctrl;
1051 
1052  $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1053 
1054  $values = array();
1055  $values["type"] = $this->assignment->getType();
1056  $values["title"] = $this->assignment->getTitle();
1057  $values["mandatory"] = $this->assignment->getMandatory();
1058  $values["instruction"] = $this->assignment->getInstruction();
1059  //$values['template_id'] = $this->assignment->getPortfolioTemplateId();
1060 
1061  //if($this->assignment->getPortfolioTemplateId())
1062  //{
1063  // $values["template"] = 1;
1064  //}
1065 
1066  /*if($this->assignment->getMinCharLimit())
1067  {
1068  $values['limit_characters'] = 1;
1069  $values['min_char_limit'] = $this->assignment->getMinCharLimit();
1070  }
1071  if($this->assignment->getMaxCharLimit())
1072  {
1073  $values['limit_characters'] = 1;
1074  $values['max_char_limit'] = $this->assignment->getMaxCharLimit();
1075  }*/
1076 
1077  if ($this->assignment->getStartTime()) {
1078  $values["start_time"] = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
1079  }
1080 
1081  if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1082  if ($this->assignment->getMaxFile()) {
1083  $values["max_file_tgl"] = true;
1084  $values["max_file"] = $this->assignment->getMaxFile();
1085  }
1086  }
1087 
1088  if ($this->assignment->getAssignmentType()->usesTeams()) {
1089  $values["team_creator"] = $this->assignment->getTeamTutor();
1090  }
1091 
1092  if ($this->assignment->getFeedbackDateCustom()) {
1093  $values["fb_date_custom"] = new ilDateTime($this->assignment->getFeedbackDateCustom(), IL_CAL_UNIX);
1094  }
1095 
1096  //Reminders
1097  $rmd_sub = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::SUBMIT_REMINDER);
1098  if ($rmd_sub->getReminderStatus()) {
1099  $values["rmd_submit_status"] = $rmd_sub->getReminderStatus();
1100  $values["rmd_submit_start"] = $rmd_sub->getReminderStart();
1101  $values["rmd_submit_end"] = new ilDateTime($rmd_sub->getReminderEnd(), IL_CAL_UNIX);
1102  $values["rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1103  $values["rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1104  }
1105 
1106  $rmd_grade = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::GRADE_REMINDER);
1107  if ($rmd_grade->getReminderStatus()) {
1108  $values["rmd_grade_status"] = $rmd_grade->getReminderStatus();
1109  $values["rmd_grade_end"] = new ilDateTime($rmd_grade->getReminderEnd(), IL_CAL_UNIX);
1110  $values["rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1111  $values["rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1112  }
1113 
1114  $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1115  $values = array_merge($values, $type_values);
1116 
1117 
1118  $values["deadline_mode"] = $this->assignment->getDeadlineMode();
1119  $values["relative_deadline"] = $this->assignment->getRelativeDeadline();
1120  $values["rel_deadline_last_subm"] = new ilDateTime($this->assignment->getRelDeadlineLastSubmission(), IL_CAL_UNIX);
1121 
1122 
1123  $a_form->setValuesByArray($values);
1124 
1125  // global feedback
1126  if ($this->assignment->getFeedbackFile()) {
1127  $a_form->getItemByPostVar("fb")->setChecked(true);
1128  $a_form->getItemByPostVar("fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1129  $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
1130  $a_form->getItemByPostVar("fb_file")->setInfo(
1131  // #16400
1132  '<a href="' . $ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile") . '">' .
1133  $lng->txt("download") . '</a>'
1134  );
1135  }
1136  $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1137  $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
1138 
1139  $this->handleDisabledFields($a_form, true);
1140  }
1141 
1142  protected function setDisabledFieldValues(ilPropertyFormGUI $a_form)
1143  {
1144  // dates
1145  if ($this->assignment->getDeadline() > 0) {
1146  $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
1147  $ed_item = $a_form->getItemByPostVar("deadline");
1148  $ed_item->setDate($edit_date);
1149 
1150  if ($this->assignment->getExtendedDeadline() > 0) {
1151  $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
1152  $ed_item = $a_form->getItemByPostVar("deadline2");
1153  $ed_item->setDate($edit_date);
1154  }
1155  }
1156 
1157  if ($this->assignment->getPeerReview()) {
1158  $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
1159  }
1160  }
1161 
1162  protected function handleDisabledFields(ilPropertyFormGUI $a_form, $a_force_set_values = false)
1163  {
1164  // potentially disabled elements are initialized here to re-use this
1165  // method after setValuesByPost() - see updateAssignmentObject()
1166 
1167  // team assignments do not support peer review
1168  // with no active peer review there is nothing to protect
1169  if (!$this->assignment->getAssignmentType()->usesTeams() &&
1170  $this->assignment->getPeerReview()) {
1171  // #14450
1172  $peer_review = new ilExPeerReview($this->assignment);
1173  if ($peer_review->hasPeerReviewGroups()) {
1174  // deadline(s) are past and must not change
1175  $a_form->getItemByPostVar("deadline")->setDisabled(true);
1176  $a_form->getItemByPostVar("deadline2")->setDisabled(true);
1177 
1178  $a_form->getItemByPostVar("peer")->setDisabled(true);
1179 
1180  $a_form->getItemByPostVar("deadline_mode")->setDisabled(true);
1181  }
1182  }
1183 
1184  if ($a_force_set_values ||
1185  ($peer_review && $peer_review->hasPeerReviewGroups())) {
1186  $this->setDisabledFieldValues($a_form);
1187  }
1188  }
1189 
1194  public function updateAssignmentObject()
1195  {
1196  $tpl = $this->tpl;
1197  $lng = $this->lng;
1198  $ilCtrl = $this->ctrl;
1199  $ilTabs = $this->tabs;
1200 
1201  $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1202  $input = $this->processForm($form);
1203 
1204  $ass_type = $this->assignment->getType();
1205  $ass_type_gui = $this->type_guis->getById($ass_type);
1206 
1207  if (is_array($input)) {
1208  $old_deadline = $this->assignment->getDeadline();
1209  $old_ext_deadline = $this->assignment->getExtendedDeadline();
1210 
1211  $this->importFormToAssignment($this->assignment, $input);
1212  $this->generateTeams($this->assignment, $input);
1213 
1214  $ass_type_gui->importFormToAssignment($this->assignment, $form);
1215  $this->assignment->update();
1216 
1217  $new_deadline = $this->assignment->getDeadline();
1218  $new_ext_deadline = $this->assignment->getExtendedDeadline();
1219 
1220  // if deadlines were changed
1221  if ($old_deadline != $new_deadline ||
1222  $old_ext_deadline != $new_ext_deadline) {
1223  $this->assignment->recalculateLateSubmissions();
1224  }
1225 
1226  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1227  $ilCtrl->redirect($this, "editAssignment");
1228  } else {
1229  $this->setAssignmentHeader();
1230  $ilTabs->activateTab("ass_settings");
1231 
1232  $form->setValuesByPost();
1233  $this->handleDisabledFields($form);
1234  $tpl->setContent($form->getHtml());
1235  }
1236  }
1237 
1242  {
1243  $ilCtrl = $this->ctrl;
1244  $tpl = $this->tpl;
1245  $lng = $this->lng;
1246 
1247  if (!is_array($_POST["id"]) || count($_POST["id"]) == 0) {
1248  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1249  $ilCtrl->redirect($this, "listAssignments");
1250  } else {
1251  $cgui = new ilConfirmationGUI();
1252  $cgui->setFormAction($ilCtrl->getFormAction($this));
1253  $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
1254  $cgui->setCancel($lng->txt("cancel"), "listAssignments");
1255  $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
1256 
1257  foreach ($_POST["id"] as $i) {
1258  $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
1259  }
1260 
1261  $tpl->setContent($cgui->getHTML());
1262  }
1263  }
1264 
1268  public function deleteAssignmentsObject()
1269  {
1270  $ilCtrl = $this->ctrl;
1271  $lng = $this->lng;
1272 
1273  $delete = false;
1274  if (is_array($_POST["id"])) {
1275  foreach ($_POST["id"] as $id) {
1276  $ass = new ilExAssignment(ilUtil::stripSlashes($id));
1277  $ass->delete();
1278  $delete = true;
1279  }
1280  }
1281 
1282  if ($delete) {
1283  ilUtil::sendSuccess($lng->txt("exc_assignments_deleted"), true);
1284  }
1285  $ilCtrl->setParameter($this, "ass_id", "");
1286  $ilCtrl->redirect($this, "listAssignments");
1287  }
1288 
1292  public function saveAssignmentOrderObject()
1293  {
1294  $lng = $this->lng;
1295  $ilCtrl = $this->ctrl;
1296 
1297  ilExAssignment::saveAssOrderOfExercise($this->exercise_id, $_POST["order"]);
1298 
1299  ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
1300  $ilCtrl->redirect($this, "listAssignments");
1301  }
1302 
1307  {
1308  $lng = $this->lng;
1309  $ilCtrl = $this->ctrl;
1310 
1311  ilExAssignment::orderAssByDeadline($this->exercise_id);
1312 
1313  ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
1314  $ilCtrl->redirect($this, "listAssignments");
1315  }
1316 
1320  public function setAssignmentHeader()
1321  {
1322  $ilTabs = $this->tabs;
1323  $lng = $this->lng;
1324  $ilCtrl = $this->ctrl;
1325  $tpl = $this->tpl;
1326  $ilHelp = $this->help;
1327 
1328  $tpl->setTitle($this->assignment->getTitle());
1329  $tpl->setDescription("");
1330 
1331  $ilTabs->clearTargets();
1332  $ilHelp->setScreenIdComponent("exc");
1333 
1334  $ilTabs->setBackTarget(
1335  $lng->txt("back"),
1336  $ilCtrl->getLinkTarget($this, "listAssignments")
1337  );
1338 
1339  $ilTabs->addTab(
1340  "ass_settings",
1341  $lng->txt("settings"),
1342  $ilCtrl->getLinkTarget($this, "editAssignment")
1343  );
1344 
1345  if (!$this->assignment->getAssignmentType()->usesTeams() &&
1346  $this->assignment->getPeerReview()) {
1347  $ilTabs->addTab(
1348  "peer_settings",
1349  $lng->txt("exc_peer_review"),
1350  $ilCtrl->getLinkTarget($this, "editPeerReview")
1351  );
1352  }
1353 
1354  $ilTabs->addTab(
1355  "ass_files",
1356  $lng->txt("exc_instruction_files"),
1357  $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", "ilexassignmentfilesystemgui"), "listFiles")
1358  );
1359  }
1360 
1362  {
1363  $ilCtrl = $this->ctrl;
1364 
1365  if (!$this->assignment ||
1366  !$this->assignment->getFeedbackFile()) {
1367  $ilCtrl->redirect($this, "returnToParent");
1368  }
1369 
1370  ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
1371  }
1372 
1373 
1374  //
1375  // PEER REVIEW
1376  //
1377 
1378  protected function initPeerReviewForm()
1379  {
1380  $ilCtrl = $this->ctrl;
1381  $lng = $this->lng;
1382 
1383  $form = new ilPropertyFormGUI();
1384  $form->setTitle($lng->txt("exc_peer_review"));
1385  $form->setFormAction($ilCtrl->getFormAction($this));
1386 
1387  $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
1388  $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info")); // #16161
1389  $peer_min->setRequired(true);
1390  $peer_min->setSize(3);
1391  $peer_min->setValue(2);
1392  $form->addItem($peer_min);
1393 
1394  $peer_unlock = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_simple_unlock"), "peer_unlock");
1395  $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_active"), 1));
1396  $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_inactive"), 0));
1397  $peer_unlock->setRequired(true);
1398  $peer_unlock->setValue(0);
1399  $form->addItem($peer_unlock);
1400 
1401  if ($this->enable_peer_review_completion) {
1402  $peer_cmpl = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_completion"), "peer_valid");
1403  $option = new ilRadioOption($lng->txt("exc_peer_review_completion_none"), ilExAssignment::PEER_REVIEW_VALID_NONE);
1404  $option->setInfo($lng->txt("exc_peer_review_completion_none_info"));
1405  $peer_cmpl->addOption($option);
1406  $option = new ilRadioOption($lng->txt("exc_peer_review_completion_one"), ilExAssignment::PEER_REVIEW_VALID_ONE);
1407  $option->setInfo($lng->txt("exc_peer_review_completion_one_info"));
1408  $peer_cmpl->addOption($option);
1409  $option = new ilRadioOption($lng->txt("exc_peer_review_completion_all"), ilExAssignment::PEER_REVIEW_VALID_ALL);
1410  $option->setInfo($lng->txt("exc_peer_review_completion_all_info"));
1411  $peer_cmpl->addOption($option);
1412  $peer_cmpl->setRequired(true);
1413  $peer_cmpl->setValue(ilExAssignment::PEER_REVIEW_VALID_NONE);
1414  $form->addItem($peer_cmpl);
1415  }
1416 
1417  $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
1418  $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
1419  $peer_dl->setShowTime(true);
1420  $form->addItem($peer_dl);
1421 
1422  $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
1423  $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
1424  $form->addItem($peer_prsl);
1425 
1426  //feedback reminders
1427  $rmd_feedback = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_feedback_setting"), "rmd_peer_status");
1428 
1429  $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_feedback_start"), "rmd_peer_start");
1430  $rmd_submit_start->setSize(3);
1431  $rmd_submit_start->setMaxLength(3);
1432  $rmd_submit_start->setSuffix($lng->txt('days'));
1433  $rmd_submit_start->setRequired(true);
1434  $rmd_submit_start->setMinValue(1);
1435  $rmd_feedback->addSubItem($rmd_submit_start);
1436 
1437  $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_peer_freq");
1438  $rmd_submit_frequency->setSize(3);
1439  $rmd_submit_frequency->setMaxLength(3);
1440  $rmd_submit_frequency->setSuffix($lng->txt('days'));
1441  $rmd_submit_frequency->setRequired(true);
1442  $rmd_submit_frequency->setMinValue(1);
1443  $rmd_feedback->addSubItem($rmd_submit_frequency);
1444 
1445  $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_peer_end");
1446  $rmd_submit_end->setRequired(true);
1447  $rmd_feedback->addSubItem($rmd_submit_end);
1448 
1449  $rmd_feedback->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::FEEDBACK_REMINDER));
1450 
1451  $form->addItem($rmd_feedback);
1452 
1453  // criteria
1454 
1455  $cats = new ilRadioGroupInputGUI($lng->txt("exc_criteria_catalogues"), "crit_cat");
1456  $form->addItem($cats);
1457 
1458  // default (no catalogue)
1459 
1460  $def = new ilRadioOption($lng->txt("exc_criteria_catalogue_default"), -1);
1461  $cats->addOption($def);
1462 
1463  $peer_text = new ilCheckboxInputGUI($lng->txt("exc_peer_review_text"), "peer_text");
1464  $def->addSubItem($peer_text);
1465 
1466  $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
1467  $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
1468  $peer_char->setSize(3);
1469  $peer_text->addSubItem($peer_char);
1470 
1471  $peer_rating = new ilCheckboxInputGUI($lng->txt("exc_peer_review_rating"), "peer_rating");
1472  $def->addSubItem($peer_rating);
1473 
1474  $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
1475  $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
1476  $def->addSubItem($peer_file);
1477 
1478  // catalogues
1479 
1480  $cat_objs = ilExcCriteriaCatalogue::getInstancesByParentId($this->exercise_id);
1481  if (sizeof($cat_objs)) {
1482  foreach ($cat_objs as $cat_obj) {
1483  $crits = ilExcCriteria::getInstancesByParentId($cat_obj->getId());
1484 
1485  // only non-empty catalogues
1486  if (sizeof($crits)) {
1487  $titles = array();
1488  foreach ($crits as $crit) {
1489  $titles[] = $crit->getTitle();
1490  }
1491  $opt = new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1492  $opt->setInfo(implode(", ", $titles));
1493  $cats->addOption($opt);
1494  }
1495  }
1496  } else {
1497  // see ilExcCriteriaCatalogueGUI::view()
1498  $url = $ilCtrl->getLinkTargetByClass("ilexccriteriacataloguegui", "");
1499  $def->setInfo('<a href="' . $url . '">[+] ' .
1500  $lng->txt("exc_add_criteria_catalogue") .
1501  '</a>');
1502  }
1503 
1504 
1505  $form->addCommandButton("updatePeerReview", $lng->txt("save"));
1506  $form->addCommandButton("editAssignment", $lng->txt("cancel"));
1507 
1508  return $form;
1509  }
1510 
1511  public function editPeerReviewObject(ilPropertyFormGUI $a_form = null)
1512  {
1513  $tpl = $this->tpl;
1514  $ilTabs = $this->tabs;
1515  $tpl = $this->tpl;
1516 
1517  $this->setAssignmentHeader();
1518  $ilTabs->activateTab("peer_settings");
1519 
1520  if ($a_form === null) {
1521  $a_form = $this->initPeerReviewForm();
1522  $this->getPeerReviewValues($a_form);
1523  }
1524  $tpl->setContent($a_form->getHTML());
1525  }
1526 
1527  protected function getPeerReviewValues($a_form)
1528  {
1529  $values = array();
1530 
1531  if ($this->assignment->getPeerReviewDeadline() > 0) {
1532  $values["peer_dl"] = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1533  }
1534 
1535  $this->assignment->getId();
1537  $reminder = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::FEEDBACK_REMINDER);
1538  if ($reminder->getReminderStatus()) {
1539  $values["rmd_peer_status"] = $reminder->getReminderStatus();
1540  $values["rmd_peer_start"] = $reminder->getReminderStart();
1541  $values["rmd_peer_end"] = new ilDateTime($reminder->getReminderEnd(), IL_CAL_UNIX);
1542  $values["rmd_peer_freq"] = $reminder->getReminderFrequency();
1543  $values["rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1544  }
1545 
1546  $a_form->setValuesByArray($values);
1547 
1548  $this->handleDisabledPeerFields($a_form, true);
1549  }
1550 
1552  {
1553  $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1554  $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1555  $a_form->getItemByPostVar("peer_unlock")->setValue((int) $this->assignment->getPeerReviewSimpleUnlock());
1556 
1557  if ($this->enable_peer_review_completion) {
1558  $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1559  }
1560 
1561  $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1562  if ($cat < 1) {
1563  $cat = -1;
1564 
1565  // default / no catalogue
1566  $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1567  $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1568  $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1569  if ($this->assignment->getPeerReviewChars() > 0) {
1570  $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1571  }
1572  }
1573  $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1574  }
1575 
1576  protected function handleDisabledPeerFields(ilPropertyFormGUI $a_form, $a_force_set_values = false)
1577  {
1578  // #14450
1579  $peer_review = new ilExPeerReview($this->assignment);
1580  if ($peer_review->hasPeerReviewGroups()) {
1581  // JourFixe, 2015-05-11 - editable again
1582  // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1583 
1584  $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1585  $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1586  $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1587 
1588  if ($this->enable_peer_review_completion) {
1589  $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1590  }
1591 
1592  $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1593  $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1594  $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1595  $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1596  $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1597 
1598  // required number input is a problem
1599  $min = new ilHiddenInputGUI("peer_min");
1600  $min->setValue($this->assignment->getPeerReviewMin());
1601  $a_form->addItem($min);
1602  }
1603 
1604  if ($a_force_set_values ||
1605  $peer_review->hasPeerReviewGroups()) {
1606  $this->setDisabledPeerReviewFieldValues($a_form);
1607  }
1608  }
1609 
1610  protected function processPeerReviewForm(ilPropertyFormGUI $a_form)
1611  {
1612  $lng = $this->lng;
1613 
1614  $protected_peer_review_groups = false;
1615  $peer_review = new ilExPeerReview($this->assignment);
1616  if ($peer_review->hasPeerReviewGroups()) {
1617  $protected_peer_review_groups = true;
1618  }
1619 
1620  $valid = $a_form->checkInput();
1621  if ($valid) {
1622  // dates
1623  $time_deadline = $this->assignment->getDeadline();
1624  $time_deadline_ext = $this->assignment->getExtendedDeadline();
1625  $time_deadline_max = max($time_deadline, $time_deadline_ext);
1626 
1627  $date = $a_form->getItemByPostVar("peer_dl")->getDate();
1628  $time_peer = $date
1629  ? $date->get(IL_CAL_UNIX)
1630  : null;
1631 
1632  $reminder_date = $a_form->getItemByPostVar("rmd_peer_end")->getDate();
1633  $reminder_date = $reminder_date
1634  ? $reminder_date->get(IL_CAL_UNIX)
1635  : null;
1636 
1637  // peer < any deadline?
1638  if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1639  $a_form->getItemByPostVar("peer_dl")
1640  ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1641  $valid = false;
1642  }
1643 
1644  if (!$protected_peer_review_groups) {
1645  if ($a_form->getInput("crit_cat") < 0 &&
1646  !$a_form->getInput("peer_text") &&
1647  !$a_form->getInput("peer_rating") &&
1648  !$a_form->getInput("peer_file")) {
1649  $a_form->getItemByPostVar("peer_file")
1650  ->setAlert($lng->txt("select_one"));
1651  $valid = false;
1652  }
1653  }
1654 
1655  if ($valid) {
1656  $res = array();
1657  $res["peer_dl"] = $time_peer;
1658 
1659  if ($protected_peer_review_groups) {
1660  $res["peer_min"] = $this->assignment->getPeerReviewMin();
1661  $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1662  $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1663  $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1664 
1665  $res["peer_text"] = $this->assignment->hasPeerReviewText();
1666  $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1667  $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1668  $res["peer_char"] = $this->assignment->getPeerReviewChars();
1669  $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1670 
1671  $res["peer_valid"] = $this->enable_peer_review_completion
1672  ? $res["peer_valid"]
1673  : null;
1674  } else {
1675  $res["peer_min"] = $a_form->getInput("peer_min");
1676  $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1677  $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1678  $res["peer_valid"] = $a_form->getInput("peer_valid");
1679 
1680  $res["peer_text"] = $a_form->getInput("peer_text");
1681  $res["peer_rating"] = $a_form->getInput("peer_rating");
1682  $res["peer_file"] = $a_form->getInput("peer_file");
1683  $res["peer_char"] = $a_form->getInput("peer_char");
1684  $res["crit_cat"] = $a_form->getInput("crit_cat");
1685  }
1686  if ($a_form->getInput("rmd_peer_status")) {
1687  $res["rmd_peer_status"] = $a_form->getInput("rmd_peer_status");
1688  $res["rmd_peer_start"] = $a_form->getInput("rmd_peer_start");
1689  $res["rmd_peer_end"] = $reminder_date;
1690  $res["rmd_peer_freq"] = $a_form->getInput("rmd_peer_freq");
1691  $res["rmd_peer_template_id"] = $a_form->getInput("rmd_peer_template_id");
1692  }
1693 
1694  return $res;
1695  } else {
1696  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
1697  }
1698  }
1699  }
1700 
1701  protected function importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)
1702  {
1703  $a_ass->setPeerReviewMin($a_input["peer_min"]);
1704  $a_ass->setPeerReviewDeadline($a_input["peer_dl"]);
1705  $a_ass->setPeerReviewSimpleUnlock($a_input["peer_unlock"]);
1706  $a_ass->setPeerReviewPersonalized($a_input["peer_prsl"]);
1707 
1708  // #18964
1709  $a_ass->setPeerReviewValid($a_input["peer_valid"]
1710  ? $a_input["peer_valid"]
1712 
1713  $a_ass->setPeerReviewFileUpload($a_input["peer_file"]);
1714  $a_ass->setPeerReviewChars($a_input["peer_char"]);
1715  $a_ass->setPeerReviewText($a_input["peer_text"]);
1716  $a_ass->setPeerReviewRating($a_input["peer_rating"]);
1717  $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1718  ? $a_input["crit_cat"]
1719  : null);
1720 
1721  $a_ass->update();
1722 
1723  $this->importPeerReviewFormToAssignmentReminders($a_input, $a_ass->getId());
1724  }
1725 
1726  protected function updatePeerReviewObject()
1727  {
1728  $tpl = $this->tpl;
1729  $lng = $this->lng;
1730  $ilCtrl = $this->ctrl;
1731  $ilTabs = $this->tabs;
1732 
1733  $form = $this->initPeerReviewForm();
1734  $input = $this->processPeerReviewForm($form);
1735  if (is_array($input)) {
1736  $this->importPeerReviewFormToAssignment($this->assignment, $input);
1737  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1738  $ilCtrl->redirect($this, "editPeerReview");
1739  } else {
1740  $this->setAssignmentHeader();
1741  $ilTabs->activateTab("peer_settings");
1742 
1743  $form->setValuesByPost();
1744  $this->handleDisabledPeerFields($form);
1745  $tpl->setContent($form->getHtml());
1746  }
1747  }
1748 
1749 
1750  //
1751  // TEAM
1752  //
1753 
1760  public function validationTeamsFormation($a_num_teams, $a_min_participants, $a_max_participants)
1761  {
1762  $total_members = $this->getExerciseTotalMembers();
1763  $number_of_teams = $a_num_teams;
1764 
1765  if ($number_of_teams) {
1766  $members_per_team = round($total_members / $a_num_teams);
1767  } else {
1768  if ($a_min_participants) {
1769  $number_of_teams = round($total_members / $a_min_participants);
1770  $participants_extra_team = $total_members % $a_min_participants;
1771  if ($participants_extra_team > $number_of_teams) {
1772  //Can't create teams with this minimum of participants.
1773  $message = sprintf($this->lng->txt("exc_team_minimal_too_big"), $a_min_participants);
1774  return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1775  }
1776  }
1777  $members_per_team = 0;
1778  }
1779 
1780  if ($a_min_participants > $a_max_participants) {
1781  $message = $this->lng->txt("exc_team_min_big_than_max");
1782  return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1783  }
1784 
1785  if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1786  $message = sprintf($this->lng->txt("exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1787  return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1788  }
1789 
1790  if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1791  $message = sprintf($this->lng->txt("exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1792  return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1793  }
1794 
1795  return array("status" => "success", "msg" => "");
1796  }
1797 
1802  public function getExerciseTotalMembers()
1803  {
1804  $exercise = new ilObjExercise($this->exercise_id, false);
1805  $exc_members = new ilExerciseMembers($exercise);
1806 
1807  return count($exc_members->getMembers());
1808  }
1809 
1814  public function generateTeams(ilExAssignment $a_assignment, $a_input)
1815  {
1816  $ass_type = $a_assignment->getAssignmentType();
1817  if ($ass_type->usesTeams() &&
1818  $a_input['team_creator'] == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
1819  if ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
1820  $number_teams = $a_input['number_teams'];
1821  if (count(ilExAssignmentTeam::getAssignmentTeamMap($a_assignment->getId())) == 0) {
1822  $ass_team = new ilExAssignmentTeam();
1823  $ass_team->createRandomTeams($this->exercise_id, $a_assignment->getId(), $number_teams, $a_input['min_participants_team']);
1824  }
1825  } elseif ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
1826  ilExAssignmentTeam::adoptTeams($a_input["ass_adpt"], $a_assignment->getId());
1827  ilUtil::sendInfo($this->lng->txt("exc_teams_assignment_adopted"), true);
1828  }
1829  }
1830  }
1831 }
getExerciseTotalMembers()
Get the total number of exercise members.
Class ilExAssignmentEditorGUI.
This class represents an option in a radio group.
setReminderStatus($a_status)
Set reminder for users without submission.
exit
Definition: login.php:29
setTitle($a_val)
Set title.
settings()
Definition: settings.php:2
Exercise assignment.
$context
Definition: webdav.php:26
getItemByPostVar($a_post_var)
Get Item by POST variable.
Class ilExerciseMembers.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
This class represents a property form user interface.
editPeerReviewObject(ilPropertyFormGUI $a_form=null)
setMaxFile($a_value)
Set max number of uploads.
setFeedbackFile($a_value)
Set (global) feedback file.
$type
setPeerReviewMin($a_value)
Set peer review minimum.
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
confirmAssignmentsDeletionObject()
Confirm assignments deletion.
$_GET["client_id"]
setTeamTutor($a_value)
Set team management by tutor.
setPeerReviewFileUpload($a_val)
Set peer review file upload.
This class represents a section header in a property form.
This class represents a file property in a property form.
getId()
Get assignment id.
processForm(ilPropertyFormGUI $a_form)
Custom form validation.
$valid
This class represents a file wizard property in a property form.
setPeerReview($a_value)
Toggle peer review.
setPeerReviewDeadline($a_val)
Set peer review deadline (timestamp)
save()
Save assignment.
Exercise assignment team.
setAssignmentHeader()
Set assignment header.
This class represents a checkbox property in a property form.
setPeerReviewValid($a_value)
Set peer review validation.
setTitle($a_val)
Set title.
addItem($a_item)
Add Item (Property, SectionHeader).
static getInstance()
Get instance.
static adoptTeams($a_source_ass_id, $a_target_ass_id, $a_user_id=null, $a_exc_ref_id=null)
const IL_CAL_UNIX
setInfo($a_info)
Set Info.
setRelativeDeadline($a_val)
Set relative deadline.
setInstruction($a_val)
Set instruction.
This class represents a date/time property in a property form.
setDeadlineMode($a_val)
Set deadline mode.
static getAdoptableTeamAssignments($a_exercise_id, $a_exclude_ass_id=null, $a_user_id=null)
help()
Definition: help.php:2
setInfo($a_info)
Set Information Text.
getTypeDropdown()
Get type selection dropdown.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getAssignmentValues(ilPropertyFormGUI $a_form)
Get current values for assignment from.
setStartTime($a_val)
Set start time (timestamp)
This class represents a hidden form property in a property form.
Exercise peer review.
getReminderStatus()
Get the reminder status.
Class ilObjExercise.
setDeadline($a_val)
Set deadline (timestamp)
This class represents a property in a property form.
addOption($a_option)
Add Option.
foreach($_POST as $key=> $value) $res
static saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.
static getInstancesByParentId($a_parent_id)
addSubItem($a_item)
Add Subitem.
processPeerReviewForm(ilPropertyFormGUI $a_form)
handleDisabledPeerFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)
setPeerReviewCriteriaCatalogue($a_value)
Set peer review criteria catalogue id.
This class represents a number property in a property form.
setPeerReviewPersonalized($a_val)
Set peer review personalized.
importFormToAssignmentReminders($a_input, $a_ass_id)
setPeerReviewRating($a_val)
Set peer review rating.
Class ilExPeerReviewGUI.
TODO: import/export reminder data with the exercise/assignment.
static getInstance()
Get instance.
uploadAssignmentFiles($a_files)
Upload assignment files (from creation form)
global $DIC
Definition: goto.php:24
setPeerReviewSimpleUnlock($a_value)
Set peer review simple unlock.
__construct($a_exercise_id, $a_enable_peer_review_completion_settings, ilExAssignment $a_ass=null)
Constructor.
checkInput()
Check Post Input.
setPeerReviewText($a_val)
Set peer review text.
handleGlobalFeedbackFileUpload(array $a_file)
setReminderFrequency($a_num_days)
Set frequency in days.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
setReminderStart($a_num_days)
Set num days before the deadline to start sending notifications.
handleDisabledFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
generateTeams(ilExAssignment $a_assignment, $a_input)
setSize($a_size)
Set Size.
setReminderEnd($a_date)
Set the ending of the reminder.
setFeedbackCron($a_value)
Toggle (global) feedback file cron.
orderAssignmentsByDeadlineObject()
Order by deadline.
validationTeamsFormation($a_num_teams, $a_min_participants, $a_max_participants)
setMaxLength($a_maxlength)
Set Max Length.
static getInstancesByParentId($a_parent_id)
saveAssignmentOrderObject()
Save assignments order.
This class represents a non editable value in a property form.
setFeedbackDate($a_value)
Set (global) feedback file availability date.
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
setFilenames($a_filenames)
Set filenames.
setDate($a_date, $a_format)
Set date.
This class represents a text area property in a property form.
setPeerReviewChars($a_value)
Set peer review minimum characters.
$message
Definition: xapiexit.php:14
initAssignmentForm($a_type, $a_mode="create")
Init assignment form.
importPeerReviewFormToAssignmentReminders($a_input, $a_ass_id)
$url
setFeedbackDateCustom($a_value)
Set (global) feedback file availability using a custom date.
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)
getAssignmentType()
Get assignment type.
saveReminderData(ilExAssignmentReminder $reminder, $a_input)
setDisabledPeerReviewFieldValues(ilPropertyFormGUI $a_form)
setMandatory($a_val)
Set mandatory.
static orderAssByDeadline($a_ex_id)
Order assignments by deadline date.
setExtendedDeadline($a_val)
Set extended deadline (timestamp)
setRelDeadlineLastSubmission($a_val)
Set relative deadline last submission.
$_POST["username"]
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
setRequired($a_required)
Set Required.
static lookupTitle($a_id)
Lookup title.
setShowTime($a_showtime)
Set Show Time Information.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
setDisabledFieldValues(ilPropertyFormGUI $a_form)
$i
Definition: metadata.php:24
Confirmation screen class.
deleteAssignmentsObject()
Delete assignments.