ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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  {
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;
169 
170  $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "addAssignment"));
171 
172  $ilToolbar->addStickyItem($this->getTypeDropdown());
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;
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;
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 
581  switch ($a_reminder_type) {
584  break;
587  break;
590  break;
591  default:
592  exit();
593  }
594 
596  $templateService = $DIC['mail.texttemplates.service'];
597  foreach ($templateService->loadTemplatesForContextId((string) $context->getId()) as $template) {
598  $r_group->addOption(new ilRadioOption($template->getTitle(), $template->getTplId()));
599  }
600 
601  return $r_group;
602  }
603 
610  protected function processForm(ilPropertyFormGUI $a_form)
611  {
612  $lng = $this->lng;
613 
614  $protected_peer_review_groups = false;
615 
616  if ($this->assignment) {
617  if ($this->assignment->getPeerReview()) {
618  $peer_review = new ilExPeerReview($this->assignment);
619  if ($peer_review->hasPeerReviewGroups()) {
620  $protected_peer_review_groups = true;
621  }
622  }
623 
624  if ($this->assignment->getFeedbackFile()) {
625  $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
626  }
627  }
628 
629  $valid = $a_form->checkInput();
630 
631  if ($protected_peer_review_groups) {
632  // checkInput() will add alert to disabled fields
633  $a_form->getItemByPostVar("deadline")->setAlert(null);
634  $a_form->getItemByPostVar("deadline2")->setAlert(null);
635  }
636 
637  if ($valid) {
638  $type = $a_form->getInput("type");
639  $ass_type = $this->types->getById($type);
640 
641  // dates
642 
643  $time_start = $a_form->getItemByPostVar("start_time")->getDate();
644  $time_start = $time_start
645  ? $time_start->get(IL_CAL_UNIX)
646  : null;
647 
648  $time_deadline = $a_form->getItemByPostVar("deadline")->getDate();
649  $time_deadline = $time_deadline
650  ? $time_deadline->get(IL_CAL_UNIX)
651  : null;
652  $time_deadline_ext = $a_form->getItemByPostVar("deadline2")->getDate();
653  $time_deadline_ext = $time_deadline_ext
654  ? $time_deadline_ext->get(IL_CAL_UNIX)
655  : null;
656  $time_fb_custom_date = $a_form->getItemByPostVar("fb_date_custom")->getDate();
657  $time_fb_custom_date = $time_fb_custom_date
658  ? $time_fb_custom_date->get(IL_CAL_UNIX)
659  : null;
660 
661  $reminder_submit_end_date = $a_form->getItemByPostVar("rmd_submit_end")->getDate();
662  $reminder_submit_end_date = $reminder_submit_end_date
663  ? $reminder_submit_end_date->get(IL_CAL_UNIX)
664  : null;
665 
666  $reminder_grade_end_date = $a_form->getItemByPostVar("rmd_grade_end")->getDate();
667  $reminder_grade_end_date = $reminder_grade_end_date
668  ? $reminder_grade_end_date->get(IL_CAL_UNIX)
669  : null;
670 
671  $time_deadline = null;
672  $time_deadline_ext = null;
673 
674  if ((int) $a_form->getInput("deadline_mode") == ilExAssignment::DEADLINE_ABSOLUTE) {
675  $time_deadline = $a_form->getItemByPostVar("deadline")->getDate();
676  $time_deadline = $time_deadline
677  ? $time_deadline->get(IL_CAL_UNIX)
678  : null;
679  $time_deadline_ext = $a_form->getItemByPostVar("deadline2")->getDate();
680  $time_deadline_ext = $time_deadline_ext
681  ? $time_deadline_ext->get(IL_CAL_UNIX)
682  : null;
683  }
684 
685 
686  // handle disabled elements
687  if ($protected_peer_review_groups) {
688  $time_deadline = $this->assignment->getDeadline();
689  $time_deadline_ext = $this->assignment->getExtendedDeadline();
690  }
691 
692  // no deadline?
693  if (!$time_deadline) {
694  // peer review
695  if (!$protected_peer_review_groups &&
696  $a_form->getInput("peer")) {
697  $a_form->getItemByPostVar("peer")
698  ->setAlert($lng->txt("exc_needs_fixed_deadline"));
699  $valid = false;
700  }
701  // global feedback
702  if ($a_form->getInput("fb") &&
703  $a_form->getInput("fb_date") == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
704  $a_form->getItemByPostVar("fb")
705  ->setAlert($lng->txt("exc_needs_deadline"));
706  $valid = false;
707  }
708  } else {
709  // #18269
710  if ($a_form->getInput("peer")) {
711  $time_deadline_max = max($time_deadline, $time_deadline_ext);
712  $peer_dl = $this->assignment // #18380
713  ? $this->assignment->getPeerReviewDeadline()
714  : null;
715  if ($peer_dl && $peer_dl < $time_deadline_max) {
716  $a_form->getItemByPostVar($peer_dl < $time_deadline_ext
717  ? "deadline2"
718  : "deadline")
719  ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
720  $valid = false;
721  }
722  }
723 
724  if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
725  $a_form->getItemByPostVar("deadline2")
726  ->setAlert($lng->txt("exc_deadline_ext_mismatch"));
727  $valid = false;
728  }
729 
730  $time_deadline_min = $time_deadline_ext
731  ? min($time_deadline, $time_deadline_ext)
732  : $time_deadline;
733  $time_deadline_max = max($time_deadline, $time_deadline_ext);
734 
735  // start > any deadline ?
736  if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
737  $a_form->getItemByPostVar("start_time")
738  ->setAlert($lng->txt("exc_start_date_should_be_before_end_date"));
739  $valid = false;
740  }
741  }
742 
743  if ($ass_type->usesTeams()) {
744  if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM &&
745  $a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
746  $team_validation = $this->validationTeamsFormation(
747  $a_form->getInput("number_teams"),
748  $a_form->getInput("min_participants_team"),
749  $a_form->getInput("max_participants_team")
750  );
751  if ($team_validation['status'] == 'error') {
752  $a_form->getItemByPostVar("team_creation")
753  ->setAlert($team_validation['msg']);
754  $a_form->getItemByPostVar($team_validation["field"])
755  ->setAlert($lng->txt("exc_value_can_not_set"));
756  $valid = false;
757  }
758  }
759  }
760 
761  if ($valid) {
762  $res = array(
763  // core
764  "type" => $a_form->getInput("type")
765  ,"title" => trim($a_form->getInput("title"))
766  ,"instruction" => trim($a_form->getInput("instruction"))
767  // dates
768  ,"start" => $time_start
769  ,"deadline" => $time_deadline
770  ,"deadline_ext" => $time_deadline_ext
771  ,"max_file" => $a_form->getInput("max_file_tgl")
772  ? $a_form->getInput("max_file")
773  : null
774  );
775  if (!$this->random_manager->isActivated()) {
776  $res["mandatory"] = $a_form->getInput("mandatory");
777  }
778 
779  if ($a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
780  $res['team_creator'] = $a_form->getInput("team_creator");
781  $res["team_creation"] = $a_form->getInput("team_creation");
782 
783  if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
784  $res["number_teams"] = $a_form->getInput("number_teams");
785  $res["min_participants_team"] = $a_form->getInput("min_participants_team");
786  $res["max_participants_team"] = $a_form->getInput("max_participants_team");
787  } elseif ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
788  $res['ass_adpt'] = $a_form->getInput("ass_adpt");
789  }
790  }
791 
792  // portfolio template
793  //if($a_form->getInput("template_id") && $a_form->getInput("template"))
794  //{
795  // $res['template_id'] = $a_form->getInput("template_id");
796  //}
797 
798  // text limitations
799  /*
800  if($a_form->getInput("limit_characters"))
801  {
802  $res['limit_characters'] = $a_form->getInput("limit_characters");
803  }
804  if($a_form->getInput("limit_characters") && $a_form->getInput("max_char_limit"))
805  {
806  $res['max_char_limit'] = $a_form->getInput("max_char_limit");
807  }
808  if($a_form->getInput("limit_characters") && $a_form->getInput("min_char_limit"))
809  {
810  $res['min_char_limit'] = $a_form->getInput("min_char_limit");
811 
812  }*/
813 
814 
815  $res["deadline_mode"] = $a_form->getInput("deadline_mode");
816 
817  if ($res["deadline_mode"] == ilExAssignment::DEADLINE_RELATIVE) {
818  $res["relative_deadline"] = $a_form->getInput("relative_deadline");
819  $rel_deadline_last_subm = $a_form->getItemByPostVar("rel_deadline_last_subm")->getDate();
820  $rel_deadline_last_subm = $rel_deadline_last_subm
821  ? $rel_deadline_last_subm->get(IL_CAL_UNIX)
822  : null;
823  $res["rel_deadline_last_subm"] = $rel_deadline_last_subm;
824  }
825 
826  // peer
827  if ($a_form->getInput("peer") ||
828  $protected_peer_review_groups) {
829  $res["peer"] = true;
830  }
831 
832  // files
833  if (is_array($_FILES["files"])) {
834  // #15994 - we are keeping the upload files array structure
835  // see ilFSStorageExercise::uploadAssignmentFiles()
836  $res["files"] = $_FILES["files"];
837  }
838 
839  // global feedback
840  if ($a_form->getInput("fb")) {
841  $res["fb"] = true;
842  $res["fb_cron"] = $a_form->getInput("fb_cron");
843  $res["fb_date"] = $a_form->getInput("fb_date");
844  $res["fb_date_custom"] = $time_fb_custom_date;
845 
846  if ($_FILES["fb_file"]["tmp_name"]) {
847  $res["fb_file"] = $_FILES["fb_file"];
848  }
849  }
850  if ($a_form->getInput("rmd_submit_status")) {
851  $res["rmd_submit_status"] = true;
852  $res["rmd_submit_start"] = $a_form->getInput("rmd_submit_start");
853  $res["rmd_submit_freq"] = $a_form->getInput("rmd_submit_freq");
854  $res["rmd_submit_end"] = $reminder_submit_end_date;
855  $res["rmd_submit_template_id"] = $a_form->getInput("rmd_submit_template_id");
856  }
857  if ($a_form->getInput("rmd_grade_status")) {
858  $res["rmd_grade_status"] = true;
859  $res["rmd_grade_freq"] = $a_form->getInput("rmd_grade_freq");
860  $res["rmd_grade_end"] = $reminder_grade_end_date;
861  $res["rmd_grade_template_id"] = $a_form->getInput("rmd_grade_template_id");
862  }
863 
864  return $res;
865  } else {
866  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
867  }
868  }
869  }
870 
877  protected function importFormToAssignment(ilExAssignment $a_ass, array $a_input)
878  {
879  $is_create = !(bool) $a_ass->getId();
880 
881  $a_ass->setTitle($a_input["title"]);
882  $a_ass->setInstruction($a_input["instruction"]);
883  if (!$this->random_manager->isActivated()) {
884  $a_ass->setMandatory($a_input["mandatory"]);
885  }
886 
887  $a_ass->setStartTime($a_input["start"]);
888  $a_ass->setDeadline($a_input["deadline"]);
889  $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
890  $a_ass->setDeadlineMode($a_input["deadline_mode"]);
891  $a_ass->setRelativeDeadline($a_input["relative_deadline"]);
892  $a_ass->setRelDeadlineLastSubmission($a_input["rel_deadline_last_subm"]);
893 
894  $a_ass->setMaxFile($a_input["max_file"]);
895  $a_ass->setTeamTutor($a_input["team_creator"]);
896 
897  //$a_ass->setPortfolioTemplateId($a_input['template_id']);
898 
899  //$a_ass->setMinCharLimit($a_input['min_char_limit']);
900  //$a_ass->setMaxCharLimit($a_input['max_char_limit']);
901 
902  if (!$this->random_manager->isActivated()) {
903  $a_ass->setPeerReview((bool) $a_input["peer"]);
904  }
905 
906  // peer review default values (on separate form)
907  if ($is_create) {
908  $a_ass->setPeerReviewMin(2);
909  $a_ass->setPeerReviewSimpleUnlock(false);
911  $a_ass->setPeerReviewPersonalized(false);
912  $a_ass->setPeerReviewFileUpload(false);
913  $a_ass->setPeerReviewText(true);
914  $a_ass->setPeerReviewRating(true);
915  }
916 
917  if ($a_input["fb"]) {
918  $a_ass->setFeedbackCron($a_input["fb_cron"]); // #13380
919  $a_ass->setFeedbackDate($a_input["fb_date"]);
920  $a_ass->setFeedbackDateCustom($a_input["fb_date_custom"]);
921  }
922 
923  // id needed for file handling
924  if ($is_create) {
925  $a_ass->save();
926 
927  // #15994 - assignment files
928  if (is_array($a_input["files"])) {
929  $a_ass->uploadAssignmentFiles($a_input["files"]);
930  }
931  } else {
932  // remove global feedback file?
933  if (!$a_input["fb"]) {
934  $a_ass->deleteGlobalFeedbackFile();
935  $a_ass->setFeedbackFile(null);
936  }
937 
938  $a_ass->update();
939  }
940 
941  // add global feedback file?
942  if ($a_input["fb"]) {
943  if (is_array($a_input["fb_file"])) {
944  $a_ass->handleGlobalFeedbackFileUpload($a_input["fb_file"]);
945  $a_ass->update();
946  }
947  }
948  $this->importFormToAssignmentReminders($a_input, $a_ass->getId());
949  }
950 
951  protected function importFormToAssignmentReminders($a_input, $a_ass_id)
952  {
953  $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::SUBMIT_REMINDER);
954  $this->saveReminderData($reminder, $a_input);
955 
956  $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::GRADE_REMINDER);
957  $this->saveReminderData($reminder, $a_input);
958  }
959 
960  //todo maybe we can refactor this method to use only one importFormToReminders
961  protected function importPeerReviewFormToAssignmentReminders($a_input, $a_ass_id)
962  {
963  $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::FEEDBACK_REMINDER);
964  $this->saveReminderData($reminder, $a_input);
965  }
966 
967  protected function saveReminderData(ilExAssignmentReminder $reminder, $a_input)
968  {
969  if ($reminder->getReminderStatus() == null) {
970  $action = "save";
971  } else {
972  $action = "update";
973  }
974  $type = $reminder->getReminderType();
975  $reminder->setReminderStatus((bool) $a_input["rmd_" . $type . "_status"]);
976  $reminder->setReminderStart((int) $a_input["rmd_" . $type . "_start"]);
977  $reminder->setReminderEnd((int) $a_input["rmd_" . $type . "_end"]);
978  $reminder->setReminderFrequency((int) $a_input["rmd_" . $type . "_freq"]);
979  $reminder->setReminderMailTemplate((int) $a_input["rmd_" . $type . "_template_id"]);
980  $reminder->{$action}();
981  }
982 
987  public function saveAssignmentObject()
988  {
989  $tpl = $this->tpl;
990  $lng = $this->lng;
992 
993  // #16163 - ignore ass id from request
994  $this->assignment = null;
995 
996  $form = $this->initAssignmentForm((int) $_POST["type"], "create");
997  $input = $this->processForm($form);
998  if (is_array($input)) {
999  $ass = new ilExAssignment();
1000  $ass->setExerciseId($this->exercise_id);
1001  $ass->setType($input["type"]);
1002  $ass_type = $ass->getAssignmentType();
1003  $ass_type_gui = $this->type_guis->getById($ass->getType());
1004 
1005  $this->importFormToAssignment($ass, $input);
1006 
1007  $this->generateTeams($ass, $input);
1008  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1009 
1010  $ass_type_gui->importFormToAssignment($ass, $form);
1011  $ass->update();
1012 
1013  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1014 
1015  // because of sub-tabs we stay on settings screen
1016  $ilCtrl->setParameter($this, "ass_id", $ass->getId());
1017  $ilCtrl->redirect($this, "editAssignment");
1018  } else {
1019  $form->setValuesByPost();
1020  $tpl->setContent($form->getHtml());
1021  }
1022  }
1023 
1027  public function editAssignmentObject()
1028  {
1029  $ilTabs = $this->tabs;
1030  $tpl = $this->tpl;
1031 
1032  $this->setAssignmentHeader();
1033  $ilTabs->activateTab("ass_settings");
1034 
1035  $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1036  $this->getAssignmentValues($form);
1037  $tpl->setContent($form->getHTML());
1038  }
1039 
1043  public function getAssignmentValues(ilPropertyFormGUI $a_form)
1044  {
1045  $lng = $this->lng;
1046  $ilCtrl = $this->ctrl;
1047 
1048  $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1049 
1050  $values = array();
1051  $values["type"] = $this->assignment->getType();
1052  $values["title"] = $this->assignment->getTitle();
1053  $values["mandatory"] = $this->assignment->getMandatory();
1054  $values["instruction"] = $this->assignment->getInstruction();
1055  //$values['template_id'] = $this->assignment->getPortfolioTemplateId();
1056 
1057  //if($this->assignment->getPortfolioTemplateId())
1058  //{
1059  // $values["template"] = 1;
1060  //}
1061 
1062  /*if($this->assignment->getMinCharLimit())
1063  {
1064  $values['limit_characters'] = 1;
1065  $values['min_char_limit'] = $this->assignment->getMinCharLimit();
1066  }
1067  if($this->assignment->getMaxCharLimit())
1068  {
1069  $values['limit_characters'] = 1;
1070  $values['max_char_limit'] = $this->assignment->getMaxCharLimit();
1071  }*/
1072 
1073  if ($this->assignment->getStartTime()) {
1074  $values["start_time"] = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
1075  }
1076 
1077  if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1078  if ($this->assignment->getMaxFile()) {
1079  $values["max_file_tgl"] = true;
1080  $values["max_file"] = $this->assignment->getMaxFile();
1081  }
1082  }
1083 
1084  if ($this->assignment->getAssignmentType()->usesTeams()) {
1085  $values["team_creator"] = $this->assignment->getTeamTutor();
1086  }
1087 
1088  if ($this->assignment->getFeedbackDateCustom()) {
1089  $values["fb_date_custom"] = new ilDateTime($this->assignment->getFeedbackDateCustom(), IL_CAL_UNIX);
1090  }
1091 
1092  //Reminders
1093  $rmd_sub = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::SUBMIT_REMINDER);
1094  if ($rmd_sub->getReminderStatus()) {
1095  $values["rmd_submit_status"] = $rmd_sub->getReminderStatus();
1096  $values["rmd_submit_start"] = $rmd_sub->getReminderStart();
1097  $values["rmd_submit_end"] = new ilDateTime($rmd_sub->getReminderEnd(), IL_CAL_UNIX);
1098  $values["rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1099  $values["rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1100  }
1101 
1102  $rmd_grade = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::GRADE_REMINDER);
1103  if ($rmd_grade->getReminderStatus()) {
1104  $values["rmd_grade_status"] = $rmd_grade->getReminderStatus();
1105  $values["rmd_grade_end"] = new ilDateTime($rmd_grade->getReminderEnd(), IL_CAL_UNIX);
1106  $values["rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1107  $values["rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1108  }
1109 
1110  $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1111  $values = array_merge($values, $type_values);
1112 
1113 
1114  $values["deadline_mode"] = $this->assignment->getDeadlineMode();
1115  $values["relative_deadline"] = $this->assignment->getRelativeDeadline();
1116  $values["rel_deadline_last_subm"] = new ilDateTime($this->assignment->getRelDeadlineLastSubmission(), IL_CAL_UNIX);
1117 
1118 
1119  $a_form->setValuesByArray($values);
1120 
1121  // global feedback
1122  if ($this->assignment->getFeedbackFile()) {
1123  $a_form->getItemByPostVar("fb")->setChecked(true);
1124  $a_form->getItemByPostVar("fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1125  $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
1126  $a_form->getItemByPostVar("fb_file")->setInfo(
1127  // #16400
1128  '<a href="' . $ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile") . '">' .
1129  $lng->txt("download") . '</a>'
1130  );
1131  }
1132  $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1133  $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
1134 
1135  $this->handleDisabledFields($a_form, true);
1136  }
1137 
1138  protected function setDisabledFieldValues(ilPropertyFormGUI $a_form)
1139  {
1140  // dates
1141  if ($this->assignment->getDeadline() > 0) {
1142  $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
1143  $ed_item = $a_form->getItemByPostVar("deadline");
1144  $ed_item->setDate($edit_date);
1145 
1146  if ($this->assignment->getExtendedDeadline() > 0) {
1147  $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
1148  $ed_item = $a_form->getItemByPostVar("deadline2");
1149  $ed_item->setDate($edit_date);
1150  }
1151  }
1152 
1153  if ($this->assignment->getPeerReview()) {
1154  $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
1155  }
1156  }
1157 
1158  protected function handleDisabledFields(ilPropertyFormGUI $a_form, $a_force_set_values = false)
1159  {
1160  // potentially disabled elements are initialized here to re-use this
1161  // method after setValuesByPost() - see updateAssignmentObject()
1162 
1163  // team assignments do not support peer review
1164  // with no active peer review there is nothing to protect
1165  if (!$this->assignment->getAssignmentType()->usesTeams() &&
1166  $this->assignment->getPeerReview()) {
1167  // #14450
1168  $peer_review = new ilExPeerReview($this->assignment);
1169  if ($peer_review->hasPeerReviewGroups()) {
1170  // deadline(s) are past and must not change
1171  $a_form->getItemByPostVar("deadline")->setDisabled(true);
1172  $a_form->getItemByPostVar("deadline2")->setDisabled(true);
1173 
1174  $a_form->getItemByPostVar("peer")->setDisabled(true);
1175 
1176  $a_form->getItemByPostVar("deadline_mode")->setDisabled(true);
1177  }
1178  }
1179 
1180  if ($a_force_set_values ||
1181  ($peer_review && $peer_review->hasPeerReviewGroups())) {
1182  $this->setDisabledFieldValues($a_form);
1183  }
1184  }
1185 
1190  public function updateAssignmentObject()
1191  {
1192  $tpl = $this->tpl;
1193  $lng = $this->lng;
1194  $ilCtrl = $this->ctrl;
1195  $ilTabs = $this->tabs;
1196 
1197  $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1198  $input = $this->processForm($form);
1199 
1200  $ass_type = $this->assignment->getType();
1201  $ass_type_gui = $this->type_guis->getById($ass_type);
1202 
1203  if (is_array($input)) {
1204  $old_deadline = $this->assignment->getDeadline();
1205  $old_ext_deadline = $this->assignment->getExtendedDeadline();
1206 
1207  $this->importFormToAssignment($this->assignment, $input);
1208  $this->generateTeams($this->assignment, $input);
1209 
1210  $ass_type_gui->importFormToAssignment($this->assignment, $form);
1211  $this->assignment->update();
1212 
1213  $new_deadline = $this->assignment->getDeadline();
1214  $new_ext_deadline = $this->assignment->getExtendedDeadline();
1215 
1216  // if deadlines were changed
1217  if ($old_deadline != $new_deadline ||
1218  $old_ext_deadline != $new_ext_deadline) {
1219  $this->assignment->recalculateLateSubmissions();
1220  }
1221 
1222  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1223  $ilCtrl->redirect($this, "editAssignment");
1224  } else {
1225  $this->setAssignmentHeader();
1226  $ilTabs->activateTab("ass_settings");
1227 
1228  $form->setValuesByPost();
1229  $this->handleDisabledFields($form);
1230  $tpl->setContent($form->getHtml());
1231  }
1232  }
1233 
1238  {
1239  $ilCtrl = $this->ctrl;
1240  $tpl = $this->tpl;
1241  $lng = $this->lng;
1242 
1243  if (!is_array($_POST["id"]) || count($_POST["id"]) == 0) {
1244  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1245  $ilCtrl->redirect($this, "listAssignments");
1246  } else {
1247  $cgui = new ilConfirmationGUI();
1248  $cgui->setFormAction($ilCtrl->getFormAction($this));
1249  $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
1250  $cgui->setCancel($lng->txt("cancel"), "listAssignments");
1251  $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
1252 
1253  foreach ($_POST["id"] as $i) {
1254  $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
1255  }
1256 
1257  $tpl->setContent($cgui->getHTML());
1258  }
1259  }
1260 
1264  public function deleteAssignmentsObject()
1265  {
1266  $ilCtrl = $this->ctrl;
1267  $lng = $this->lng;
1268 
1269  $delete = false;
1270  if (is_array($_POST["id"])) {
1271  foreach ($_POST["id"] as $id) {
1272  $ass = new ilExAssignment(ilUtil::stripSlashes($id));
1273  $ass->delete();
1274  $delete = true;
1275  }
1276  }
1277 
1278  if ($delete) {
1279  ilUtil::sendSuccess($lng->txt("exc_assignments_deleted"), true);
1280  }
1281  $ilCtrl->setParameter($this, "ass_id", "");
1282  $ilCtrl->redirect($this, "listAssignments");
1283  }
1284 
1288  public function saveAssignmentOrderObject()
1289  {
1290  $lng = $this->lng;
1291  $ilCtrl = $this->ctrl;
1292 
1293  ilExAssignment::saveAssOrderOfExercise($this->exercise_id, $_POST["order"]);
1294 
1295  ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
1296  $ilCtrl->redirect($this, "listAssignments");
1297  }
1298 
1303  {
1304  $lng = $this->lng;
1305  $ilCtrl = $this->ctrl;
1306 
1307  ilExAssignment::orderAssByDeadline($this->exercise_id);
1308 
1309  ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
1310  $ilCtrl->redirect($this, "listAssignments");
1311  }
1312 
1316  public function setAssignmentHeader()
1317  {
1318  $ilTabs = $this->tabs;
1319  $lng = $this->lng;
1320  $ilCtrl = $this->ctrl;
1321  $tpl = $this->tpl;
1322  $ilHelp = $this->help;
1323 
1324  $tpl->setTitle($this->assignment->getTitle());
1325  $tpl->setDescription("");
1326 
1327  $ilTabs->clearTargets();
1328  $ilHelp->setScreenIdComponent("exc");
1329 
1330  $ilTabs->setBackTarget(
1331  $lng->txt("back"),
1332  $ilCtrl->getLinkTarget($this, "listAssignments")
1333  );
1334 
1335  $ilTabs->addTab(
1336  "ass_settings",
1337  $lng->txt("settings"),
1338  $ilCtrl->getLinkTarget($this, "editAssignment")
1339  );
1340 
1341  if (!$this->assignment->getAssignmentType()->usesTeams() &&
1342  $this->assignment->getPeerReview()) {
1343  $ilTabs->addTab(
1344  "peer_settings",
1345  $lng->txt("exc_peer_review"),
1346  $ilCtrl->getLinkTarget($this, "editPeerReview")
1347  );
1348  }
1349 
1350  $ilTabs->addTab(
1351  "ass_files",
1352  $lng->txt("exc_instruction_files"),
1353  $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", "ilexassignmentfilesystemgui"), "listFiles")
1354  );
1355  }
1356 
1358  {
1359  $ilCtrl = $this->ctrl;
1360 
1361  if (!$this->assignment ||
1362  !$this->assignment->getFeedbackFile()) {
1363  $ilCtrl->redirect($this, "returnToParent");
1364  }
1365 
1366  ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
1367  }
1368 
1369 
1370  //
1371  // PEER REVIEW
1372  //
1373 
1374  protected function initPeerReviewForm()
1375  {
1376  $ilCtrl = $this->ctrl;
1377  $lng = $this->lng;
1378 
1379  $form = new ilPropertyFormGUI();
1380  $form->setTitle($lng->txt("exc_peer_review"));
1381  $form->setFormAction($ilCtrl->getFormAction($this));
1382 
1383  $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
1384  $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info")); // #16161
1385  $peer_min->setRequired(true);
1386  $peer_min->setSize(3);
1387  $peer_min->setValue(2);
1388  $form->addItem($peer_min);
1389 
1390  $peer_unlock = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_simple_unlock"), "peer_unlock");
1391  $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_active"), 1));
1392  $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_inactive"), 0));
1393  $peer_unlock->setRequired(true);
1394  $peer_unlock->setValue(0);
1395  $form->addItem($peer_unlock);
1396 
1397  if ($this->enable_peer_review_completion) {
1398  $peer_cmpl = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_completion"), "peer_valid");
1399  $option = new ilRadioOption($lng->txt("exc_peer_review_completion_none"), ilExAssignment::PEER_REVIEW_VALID_NONE);
1400  $option->setInfo($lng->txt("exc_peer_review_completion_none_info"));
1401  $peer_cmpl->addOption($option);
1402  $option = new ilRadioOption($lng->txt("exc_peer_review_completion_one"), ilExAssignment::PEER_REVIEW_VALID_ONE);
1403  $option->setInfo($lng->txt("exc_peer_review_completion_one_info"));
1404  $peer_cmpl->addOption($option);
1405  $option = new ilRadioOption($lng->txt("exc_peer_review_completion_all"), ilExAssignment::PEER_REVIEW_VALID_ALL);
1406  $option->setInfo($lng->txt("exc_peer_review_completion_all_info"));
1407  $peer_cmpl->addOption($option);
1408  $peer_cmpl->setRequired(true);
1409  $peer_cmpl->setValue(ilExAssignment::PEER_REVIEW_VALID_NONE);
1410  $form->addItem($peer_cmpl);
1411  }
1412 
1413  $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
1414  $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
1415  $peer_dl->setShowTime(true);
1416  $form->addItem($peer_dl);
1417 
1418  $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
1419  $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
1420  $form->addItem($peer_prsl);
1421 
1422  //feedback reminders
1423  $rmd_feedback = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_feedback_setting"), "rmd_peer_status");
1424 
1425  $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_feedback_start"), "rmd_peer_start");
1426  $rmd_submit_start->setSize(3);
1427  $rmd_submit_start->setMaxLength(3);
1428  $rmd_submit_start->setSuffix($lng->txt('days'));
1429  $rmd_submit_start->setRequired(true);
1430  $rmd_submit_start->setMinValue(1);
1431  $rmd_feedback->addSubItem($rmd_submit_start);
1432 
1433  $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_peer_freq");
1434  $rmd_submit_frequency->setSize(3);
1435  $rmd_submit_frequency->setMaxLength(3);
1436  $rmd_submit_frequency->setSuffix($lng->txt('days'));
1437  $rmd_submit_frequency->setRequired(true);
1438  $rmd_submit_frequency->setMinValue(1);
1439  $rmd_feedback->addSubItem($rmd_submit_frequency);
1440 
1441  $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_peer_end");
1442  $rmd_submit_end->setRequired(true);
1443  $rmd_feedback->addSubItem($rmd_submit_end);
1444 
1445  $rmd_feedback->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::FEEDBACK_REMINDER));
1446 
1447  $form->addItem($rmd_feedback);
1448 
1449  // criteria
1450 
1451  $cats = new ilRadioGroupInputGUI($lng->txt("exc_criteria_catalogues"), "crit_cat");
1452  $form->addItem($cats);
1453 
1454  // default (no catalogue)
1455 
1456  $def = new ilRadioOption($lng->txt("exc_criteria_catalogue_default"), -1);
1457  $cats->addOption($def);
1458 
1459  $peer_text = new ilCheckboxInputGUI($lng->txt("exc_peer_review_text"), "peer_text");
1460  $def->addSubItem($peer_text);
1461 
1462  $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
1463  $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
1464  $peer_char->setSize(3);
1465  $peer_text->addSubItem($peer_char);
1466 
1467  $peer_rating = new ilCheckboxInputGUI($lng->txt("exc_peer_review_rating"), "peer_rating");
1468  $def->addSubItem($peer_rating);
1469 
1470  $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
1471  $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
1472  $def->addSubItem($peer_file);
1473 
1474  // catalogues
1475 
1476  $cat_objs = ilExcCriteriaCatalogue::getInstancesByParentId($this->exercise_id);
1477  if (sizeof($cat_objs)) {
1478  foreach ($cat_objs as $cat_obj) {
1479  $crits = ilExcCriteria::getInstancesByParentId($cat_obj->getId());
1480 
1481  // only non-empty catalogues
1482  if (sizeof($crits)) {
1483  $titles = array();
1484  foreach ($crits as $crit) {
1485  $titles[] = $crit->getTitle();
1486  }
1487  $opt = new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1488  $opt->setInfo(implode(", ", $titles));
1489  $cats->addOption($opt);
1490  }
1491  }
1492  } else {
1493  // see ilExcCriteriaCatalogueGUI::view()
1494  $url = $ilCtrl->getLinkTargetByClass("ilexccriteriacataloguegui", "");
1495  $def->setInfo('<a href="' . $url . '">[+] ' .
1496  $lng->txt("exc_add_criteria_catalogue") .
1497  '</a>');
1498  }
1499 
1500 
1501  $form->addCommandButton("updatePeerReview", $lng->txt("save"));
1502  $form->addCommandButton("editAssignment", $lng->txt("cancel"));
1503 
1504  return $form;
1505  }
1506 
1507  public function editPeerReviewObject(ilPropertyFormGUI $a_form = null)
1508  {
1509  $tpl = $this->tpl;
1510  $ilTabs = $this->tabs;
1511  $tpl = $this->tpl;
1512 
1513  $this->setAssignmentHeader();
1514  $ilTabs->activateTab("peer_settings");
1515 
1516  if ($a_form === null) {
1517  $a_form = $this->initPeerReviewForm();
1518  $this->getPeerReviewValues($a_form);
1519  }
1520  $tpl->setContent($a_form->getHTML());
1521  }
1522 
1523  protected function getPeerReviewValues($a_form)
1524  {
1525  $values = array();
1526 
1527  if ($this->assignment->getPeerReviewDeadline() > 0) {
1528  $values["peer_dl"] = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1529  }
1530 
1531  $this->assignment->getId();
1533  $reminder = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::FEEDBACK_REMINDER);
1534  if ($reminder->getReminderStatus()) {
1535  $values["rmd_peer_status"] = $reminder->getReminderStatus();
1536  $values["rmd_peer_start"] = $reminder->getReminderStart();
1537  $values["rmd_peer_end"] = new ilDateTime($reminder->getReminderEnd(), IL_CAL_UNIX);
1538  $values["rmd_peer_freq"] = $reminder->getReminderFrequency();
1539  $values["rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1540  }
1541 
1542  $a_form->setValuesByArray($values);
1543 
1544  $this->handleDisabledPeerFields($a_form, true);
1545  }
1546 
1548  {
1549  $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1550  $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1551  $a_form->getItemByPostVar("peer_unlock")->setValue((int) $this->assignment->getPeerReviewSimpleUnlock());
1552 
1553  if ($this->enable_peer_review_completion) {
1554  $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1555  }
1556 
1557  $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1558  if ($cat < 1) {
1559  $cat = -1;
1560 
1561  // default / no catalogue
1562  $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1563  $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1564  $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1565  if ($this->assignment->getPeerReviewChars() > 0) {
1566  $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1567  }
1568  }
1569  $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1570  }
1571 
1572  protected function handleDisabledPeerFields(ilPropertyFormGUI $a_form, $a_force_set_values = false)
1573  {
1574  // #14450
1575  $peer_review = new ilExPeerReview($this->assignment);
1576  if ($peer_review->hasPeerReviewGroups()) {
1577  // JourFixe, 2015-05-11 - editable again
1578  // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1579 
1580  $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1581  $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1582  $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1583 
1584  if ($this->enable_peer_review_completion) {
1585  $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1586  }
1587 
1588  $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1589  $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1590  $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1591  $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1592  $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1593 
1594  // required number input is a problem
1595  $min = new ilHiddenInputGUI("peer_min");
1596  $min->setValue($this->assignment->getPeerReviewMin());
1597  $a_form->addItem($min);
1598  }
1599 
1600  if ($a_force_set_values ||
1601  $peer_review->hasPeerReviewGroups()) {
1602  $this->setDisabledPeerReviewFieldValues($a_form);
1603  }
1604  }
1605 
1606  protected function processPeerReviewForm(ilPropertyFormGUI $a_form)
1607  {
1608  $lng = $this->lng;
1609 
1610  $protected_peer_review_groups = false;
1611  $peer_review = new ilExPeerReview($this->assignment);
1612  if ($peer_review->hasPeerReviewGroups()) {
1613  $protected_peer_review_groups = true;
1614  }
1615 
1616  $valid = $a_form->checkInput();
1617  if ($valid) {
1618  // dates
1619  $time_deadline = $this->assignment->getDeadline();
1620  $time_deadline_ext = $this->assignment->getExtendedDeadline();
1621  $time_deadline_max = max($time_deadline, $time_deadline_ext);
1622 
1623  $date = $a_form->getItemByPostVar("peer_dl")->getDate();
1624  $time_peer = $date
1625  ? $date->get(IL_CAL_UNIX)
1626  : null;
1627 
1628  $reminder_date = $a_form->getItemByPostVar("rmd_peer_end")->getDate();
1629  $reminder_date = $reminder_date
1630  ? $reminder_date->get(IL_CAL_UNIX)
1631  : null;
1632 
1633  // peer < any deadline?
1634  if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1635  $a_form->getItemByPostVar("peer_dl")
1636  ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1637  $valid = false;
1638  }
1639 
1640  if (!$protected_peer_review_groups) {
1641  if ($a_form->getInput("crit_cat") < 0 &&
1642  !$a_form->getInput("peer_text") &&
1643  !$a_form->getInput("peer_rating") &&
1644  !$a_form->getInput("peer_file")) {
1645  $a_form->getItemByPostVar("peer_file")
1646  ->setAlert($lng->txt("select_one"));
1647  $valid = false;
1648  }
1649  }
1650 
1651  if ($valid) {
1652  $res = array();
1653  $res["peer_dl"] = $time_peer;
1654 
1655  if ($protected_peer_review_groups) {
1656  $res["peer_min"] = $this->assignment->getPeerReviewMin();
1657  $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1658  $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1659  $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1660 
1661  $res["peer_text"] = $this->assignment->hasPeerReviewText();
1662  $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1663  $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1664  $res["peer_char"] = $this->assignment->getPeerReviewChars();
1665  $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1666 
1667  $res["peer_valid"] = $this->enable_peer_review_completion
1668  ? $res["peer_valid"]
1669  : null;
1670  } else {
1671  $res["peer_min"] = $a_form->getInput("peer_min");
1672  $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1673  $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1674  $res["peer_valid"] = $a_form->getInput("peer_valid");
1675 
1676  $res["peer_text"] = $a_form->getInput("peer_text");
1677  $res["peer_rating"] = $a_form->getInput("peer_rating");
1678  $res["peer_file"] = $a_form->getInput("peer_file");
1679  $res["peer_char"] = $a_form->getInput("peer_char");
1680  $res["crit_cat"] = $a_form->getInput("crit_cat");
1681  }
1682  if ($a_form->getInput("rmd_peer_status")) {
1683  $res["rmd_peer_status"] = $a_form->getInput("rmd_peer_status");
1684  $res["rmd_peer_start"] = $a_form->getInput("rmd_peer_start");
1685  $res["rmd_peer_end"] = $reminder_date;
1686  $res["rmd_peer_freq"] = $a_form->getInput("rmd_peer_freq");
1687  $res["rmd_peer_template_id"] = $a_form->getInput("rmd_peer_template_id");
1688  }
1689 
1690  return $res;
1691  } else {
1692  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
1693  }
1694  }
1695  }
1696 
1697  protected function importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)
1698  {
1699  $a_ass->setPeerReviewMin($a_input["peer_min"]);
1700  $a_ass->setPeerReviewDeadline($a_input["peer_dl"]);
1701  $a_ass->setPeerReviewSimpleUnlock($a_input["peer_unlock"]);
1702  $a_ass->setPeerReviewPersonalized($a_input["peer_prsl"]);
1703 
1704  // #18964
1705  $a_ass->setPeerReviewValid($a_input["peer_valid"]
1706  ? $a_input["peer_valid"]
1708 
1709  $a_ass->setPeerReviewFileUpload($a_input["peer_file"]);
1710  $a_ass->setPeerReviewChars($a_input["peer_char"]);
1711  $a_ass->setPeerReviewText($a_input["peer_text"]);
1712  $a_ass->setPeerReviewRating($a_input["peer_rating"]);
1713  $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1714  ? $a_input["crit_cat"]
1715  : null);
1716 
1717  $a_ass->update();
1718 
1719  $this->importPeerReviewFormToAssignmentReminders($a_input, $a_ass->getId());
1720  }
1721 
1722  protected function updatePeerReviewObject()
1723  {
1724  $tpl = $this->tpl;
1725  $lng = $this->lng;
1726  $ilCtrl = $this->ctrl;
1727  $ilTabs = $this->tabs;
1728 
1729  $form = $this->initPeerReviewForm();
1730  $input = $this->processPeerReviewForm($form);
1731  if (is_array($input)) {
1732  $this->importPeerReviewFormToAssignment($this->assignment, $input);
1733  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1734  $ilCtrl->redirect($this, "editPeerReview");
1735  } else {
1736  $this->setAssignmentHeader();
1737  $ilTabs->activateTab("peer_settings");
1738 
1739  $form->setValuesByPost();
1740  $this->handleDisabledPeerFields($form);
1741  $tpl->setContent($form->getHtml());
1742  }
1743  }
1744 
1745 
1746  //
1747  // TEAM
1748  //
1749 
1756  public function validationTeamsFormation($a_num_teams, $a_min_participants, $a_max_participants)
1757  {
1758  $total_members = $this->getExerciseTotalMembers();
1759  $number_of_teams = $a_num_teams;
1760 
1761  if ($number_of_teams) {
1762  $members_per_team = round($total_members / $a_num_teams);
1763  } else {
1764  if ($a_min_participants) {
1765  $number_of_teams = round($total_members / $a_min_participants);
1766  $participants_extra_team = $total_members % $a_min_participants;
1767  if ($participants_extra_team > $number_of_teams) {
1768  //Can't create teams with this minimum of participants.
1769  $message = sprintf($this->lng->txt("exc_team_minimal_too_big"), $a_min_participants);
1770  return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1771  }
1772  }
1773  $members_per_team = 0;
1774  }
1775 
1776  if ($a_min_participants > $a_max_participants) {
1777  $message = $this->lng->txt("exc_team_min_big_than_max");
1778  return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1779  }
1780 
1781  if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1782  $message = sprintf($this->lng->txt("exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1783  return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1784  }
1785 
1786  if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1787  $message = sprintf($this->lng->txt("exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1788  return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1789  }
1790 
1791  return array("status" => "success", "msg" => "");
1792  }
1793 
1798  public function getExerciseTotalMembers()
1799  {
1800  $exercise = new ilObjExercise($this->exercise_id, false);
1801  $exc_members = new ilExerciseMembers($exercise);
1802 
1803  return count($exc_members->getMembers());
1804  }
1805 
1810  public function generateTeams(ilExAssignment $a_assignment, $a_input)
1811  {
1812  $ass_type = $a_assignment->getAssignmentType();
1813  if ($ass_type->usesTeams() &&
1814  $a_input['team_creator'] == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
1815  if ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
1816  $number_teams = $a_input['number_teams'];
1817  if (count(ilExAssignmentTeam::getAssignmentTeamMap($a_assignment->getId())) == 0) {
1818  $ass_team = new ilExAssignmentTeam();
1819  $ass_team->createRandomTeams($this->exercise_id, $a_assignment->getId(), $number_teams, $a_input['min_participants_team']);
1820  }
1821  } elseif ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
1822  ilExAssignmentTeam::adoptTeams($a_input["ass_adpt"], $a_assignment->getId());
1823  ilUtil::sendInfo($this->lng->txt("exc_teams_assignment_adopted"), true);
1824  }
1825  }
1826  }
1827 }
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.
global $ilCtrl
Definition: ilias.php:18
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.
$a_type
Definition: workflow.php:92
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)
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.
$DIC
Definition: xapitoken.php:46
$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.