34 protected \ILIAS\Exercise\InternalDomainService
$domain;
38 protected \ILIAS\Exercise\InternalGUIService
$gui;
63 private \ILIAS\ResourceStorage\Services
$irss;
64 private \ILIAS\FileUpload\FileUpload
$upload;
68 bool $a_enable_peer_review_completion_settings,
74 $this->
ctrl = $DIC->ctrl();
75 $this->
tabs = $DIC->tabs();
76 $this->
lng = $DIC->language();
77 $this->tpl = $DIC[
"tpl"];
78 $this->
toolbar = $DIC->toolbar();
80 $this->
help = $DIC[
"ilHelp"];
81 $this->exercise_id = $a_exercise_id;
82 $this->assignment = $a_ass;
83 $this->gui = $DIC->exercise()
86 $this->enable_peer_review_completion = $a_enable_peer_review_completion_settings;
88 $this->type_guis = $this->gui->assignment()->types();
89 $request = $DIC->exercise()->internal()->gui()->request();
90 $this->exc = $request->getExercise();
91 $this->requested_ass_type = $request->getAssType();
92 $this->requested_type = $request->getType();
93 $this->random_manager = $DIC->exercise()->internal()->domain()->assignment()->randomAssignments(
94 $request->getExercise()
96 $this->domain = $DIC->exercise()->internal()->domain();
97 $this->requested_ass_ids = $request->getAssignmentIds();
98 $this->requested_order = $request->getOrder();
99 $this->irss = $DIC->resourceStorage();
100 $this->
access = $DIC->access();
101 $this->ref_id = $DIC->http()->wrapper()->query()->has(
'ref_id')
102 ? $DIC->http()->wrapper()->query()->retrieve(
104 $DIC->refinery()->kindlyTo()->int()
117 $class = $ilCtrl->getNextClass($this);
118 $cmd = $ilCtrl->getCmd(
"listAssignments");
121 case "ilpropertyformgui":
123 $ilCtrl->forwardCommand($form);
126 case strtolower(ilResourceCollectionGUI::class):
128 $ilTabs->activateTab(
"ass_files");
129 $irss = $this->domain->assignment()->instructionFiles($this->assignment->getId());
130 if ($irss->getCollectionIdString() ===
"") {
131 $this->tpl->setOnScreenMessage(
133 $this->
lng->txt(
"exc_instruction_migration_not_run")
136 $gui = $this->gui->assignment()->getInstructionFileResourceCollectionGUI(
138 $this->assignment->getId()
140 $this->
ctrl->forwardCommand($gui);
144 case "ilexpeerreviewgui":
145 $ilTabs->clearTargets();
146 $ilTabs->setBackTarget(
148 $ilCtrl->getLinkTarget($this,
"listAssignments")
152 $ilCtrl->forwardCommand($peer_gui);
156 $this->{$cmd .
"Object"}();
172 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"addAssignment"));
177 $this->
lng->txt(
"exc_add_assignment"),
179 )->submit()->toToolbar(
true);
195 $this->assignment = null;
197 if ($this->requested_type == 0) {
198 $ilCtrl->
redirect($this,
"listAssignments");
213 foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
214 $types[$k] = $t->getTitle();
219 $ty->setRequired(
true);
228 string $a_mode =
"create" 233 $ass_type = $this->types->getById($a_type);
234 $ass_type_gui = $this->type_guis->getById($a_type);
239 if ($a_mode ==
"edit") {
240 $form->setTitle($lng->
txt(
"exc_edit_assignment"));
242 $form->setTitle($lng->
txt(
"exc_new_assignment"));
244 $form->setFormAction($ilCtrl->getFormAction($this));
248 $ti->setMaxLength(200);
249 $ti->setRequired(
true);
254 $ty->setValue($a_type);
255 $ty->setDisabled(
true);
262 $ass_type_gui->addEditFormCustomProperties($form);
268 if ($ass_type->usesTeams()) {
269 if ($a_mode ==
"edit") {
279 $lng->
txt(
"exc_team_by_participants"),
281 $lng->
txt(
"exc_team_by_participants_info")
285 $lng->
txt(
"exc_team_by_tutors"),
287 $lng->
txt(
"exc_team_by_tutors_info")
295 $rd_creation_method->setValue(
"0");
299 $lng->
txt(
"exc_team_by_tutors_manual"),
301 $lng->
txt(
"exc_team_by_tutors_manual_info")
303 $rd_creation_method->addOption($rd_creation_manual);
308 $add_info =
" <strong>" . $lng->
txt(
"exc_team_by_random_add_info") .
"</strong>";
311 $lng->
txt(
"exc_team_by_random"),
315 $rd_creation_method->addOption($rd_creation_random);
318 $number_teams->setSize(3);
319 $number_teams->setMinValue(1);
321 $number_teams->setRequired(
true);
322 $number_teams->setSuffix($lng->
txt(
"exc_team_assignment_adopt_teams"));
323 $rd_creation_random->addSubItem($number_teams);
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);
329 $min_team_participants->setRequired(
true);
330 $min_team_participants->setSuffix($lng->
txt(
"exc_participants"));
331 $rd_creation_random->addSubItem($min_team_participants);
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);
337 $max_team_participants->setRequired(
true);
338 $max_team_participants->setSuffix($lng->
txt(
"exc_participants"));
339 $rd_creation_random->addSubItem($max_team_participants);
342 if (count($options)) {
344 $lng->
txt(
"exc_team_by_assignment"),
346 $lng->
txt(
"exc_team_by_assignment_info")
350 $radio_assignment_adopt->setRequired(
true);
351 $radio_assignment_adopt->addOption(
new ilRadioOption($lng->
txt(
"exc_team_assignment_adopt_none"), -1));
353 foreach ($options as
$id => $item) {
355 $option->setInfo($lng->
txt(
"exc_team_assignment_adopt_teams") .
": " . $item[
"teams"]);
356 $radio_assignment_adopt->addOption($option);
358 $radio_assignment->
addSubItem($radio_assignment_adopt);
359 $rd_creation_method->addOption($radio_assignment);
362 $radio_tutors->
addSubItem($rd_creation_method);
364 $rd_team->addOption($radio_participants);
365 $rd_team->addOption($radio_tutors);
369 $form->addItem($rd_team);
372 $rd_team->setDisabled(
true);
377 if (!$this->random_manager->isActivated()) {
379 $cb->setInfo($lng->
txt(
"exc_mandatory_info"));
380 $cb->setChecked(
true);
385 $ne->setValue($lng->
txt(
"exc_mandatory_rand_determined"));
391 $sub_header->setTitle($lng->
txt(
"exc_work_instructions"));
392 $form->addItem($sub_header);
397 $desc_input->setUseRte(
true);
398 $desc_input->setRteTagSet(
"mini");
400 $form->addItem($desc_input);
403 if ($a_mode ==
"create") {
406 $form->addItem($files);
411 $sub_header->setTitle($lng->
txt(
"exc_schedule"));
412 $form->addItem($sub_header);
417 $form->addItem($start_date);
422 $op0 =
new ilRadioOption($lng->
txt(
"exc_no_deadline"), -1, $lng->
txt(
"exc_no_deadline_info"));
423 $radg->addOption($op0);
424 $op1 =
new ilRadioOption($lng->
txt(
"exc_fixed_date"), 0, $lng->
txt(
"exc_fixed_date_info"));
425 $radg->addOption($op1);
426 if (!$ass_type->usesTeams()) {
427 $op3 =
new ilRadioOption($lng->
txt(
"exc_fixed_date_individual"), 2, $lng->
txt(
"exc_fixed_date_individual_info"));
428 $radg->addOption($op3);
430 $op2 =
new ilRadioOption($lng->
txt(
"exc_relative_date"), 1, $lng->
txt(
"exc_relative_date_info"));
431 $radg->addOption($op2);
432 $form->addItem($radg);
437 $deadline->setShowTime(
true);
438 $op1->addSubItem($deadline);
442 $deadline2->
setInfo($lng->
txt(
"exc_deadline_extended_info"));
443 $deadline2->setShowTime(
true);
444 $op1->addSubItem($deadline2);
448 $rmd_submit =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_submit_setting"),
"rmd_submit_status");
450 $rmd_submit_start =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_start"),
"rmd_submit_start");
451 $rmd_submit_start->setSize(3);
452 $rmd_submit_start->setMaxLength(3);
453 $rmd_submit_start->setSuffix($lng->
txt(
'days'));
454 $rmd_submit_start->
setInfo($this->
lng->txt(
"exc_reminder_start_info"));
456 $rmd_submit_start->setMinValue(1);
459 $rmd_submit_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_submit_freq");
460 $rmd_submit_frequency->setSize(3);
461 $rmd_submit_frequency->setMaxLength(3);
462 $rmd_submit_frequency->setSuffix($lng->
txt(
'days'));
463 $rmd_submit_frequency->setRequired(
true);
464 $rmd_submit_frequency->setMinValue(1);
465 $rmd_submit->addSubItem($rmd_submit_frequency);
469 $rmd_submit->addSubItem($rmd_submit_end);
474 $rmd_grade =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_grade_setting"),
"rmd_grade_status");
476 $rmd_grade_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_grade_freq");
477 $rmd_grade_frequency->setSize(3);
478 $rmd_grade_frequency->setMaxLength(3);
479 $rmd_grade_frequency->setSuffix($lng->
txt(
'days'));
481 $rmd_grade_frequency->setMinValue(1);
486 $rmd_grade->addSubItem($rmd_grade_end);
490 $form->addItem($rmd_submit);
491 $form->addItem($rmd_grade);
495 $ti->setSuffix($lng->
txt(
"days"));
496 $ti->setMaxLength(3);
499 $ti->setRequired(
true);
500 $op2->addSubItem($ti);
503 $last_submission =
new ilDateTimeInputGUI($lng->
txt(
"exc_rel_last_submission"),
"rel_deadline_last_subm");
504 $last_submission->
setInfo($lng->
txt(
"exc_rel_last_submission_info"));
505 $last_submission->setShowTime(
true);
506 $op2->addSubItem($last_submission);
511 if ($ass_type->usesFileUpload()) {
513 $sub_header->setTitle($ass_type->getTitle());
514 $form->addItem($sub_header);
516 $form->addItem($max_file_tgl);
519 $max_file->setInfo($lng->
txt(
"exc_max_file_info"));
520 $max_file->setRequired(
true);
521 $max_file->setSize(3);
522 $max_file->setMinValue(1);
523 $max_file_tgl->addSubItem($max_file);
528 $sub_header->setTitle($lng->
txt(
"exc_after_submission"));
529 $form->addItem($sub_header);
531 if (!$ass_type->usesTeams() && !$this->random_manager->isActivated()) {
534 $peer->setInfo($lng->
txt(
"exc_peer_review_ass_setting_info"));
535 $form->addItem($peer);
547 $fb->addSubItem($fb_file);
558 $fb_date_custom_date->setShowTime(
true);
560 $fb_date_custom_option->
addSubItem($fb_date_custom_date);
561 $fb_date->addOption($fb_date_custom_option);
564 $fb->addSubItem($fb_date);
567 $fb_cron->setInfo($lng->
txt(
"exc_global_feedback_file_cron_info"));
568 $fb->addSubItem($fb_cron);
571 if ($a_mode ==
"create") {
572 $form->addCommandButton(
"saveAssignment", $lng->
txt(
"save"));
574 $form->addCommandButton(
"updateAssignment", $lng->
txt(
"save"));
576 $form->addCommandButton(
"listAssignments", $lng->
txt(
"cancel"));
585 $post_var =
"rmd_" . $a_reminder_type .
"_template_id";
589 $r_group->addOption(
new ilRadioOption($this->
lng->txt(
"exc_reminder_mail_no_tpl"), 0));
590 $r_group->setValue(0);
592 switch ($a_reminder_type) {
606 $templateService = $DIC->mail()->textTemplates();
607 foreach ($templateService->loadTemplatesForContextId(
$context->getId()) as $template) {
608 $r_group->addOption(
new ilRadioOption($template->getTitle(), $template->getTplId()));
609 if ($template->isDefault()) {
610 $r_group->setValue($template->getTplId());
627 $protected_peer_review_groups =
false;
629 if ($this->assignment) {
630 if ($this->assignment->getPeerReview()) {
632 if ($peer_review->hasPeerReviewGroups()) {
633 $protected_peer_review_groups =
true;
637 if ($this->assignment->getFeedbackFile()) {
643 if ($protected_peer_review_groups) {
651 $ass_type = $this->types->getById($type);
656 $time_start = $time_start
660 $time_fb_custom_date = $a_form->
getItemByPostVar(
"fb_date_custom")->getDate();
661 $time_fb_custom_date = $time_fb_custom_date
665 $reminder_submit_end_date = $a_form->
getItemByPostVar(
"rmd_submit_end")->getDate();
666 $reminder_submit_end_date = $reminder_submit_end_date
670 $reminder_grade_end_date = $a_form->
getItemByPostVar(
"rmd_grade_end")->getDate();
671 $reminder_grade_end_date = $reminder_grade_end_date
675 $time_deadline = null;
676 $time_deadline_ext = null;
678 $deadline_mode = (
int) $a_form->
getInput(
"deadline_mode");
679 if ($deadline_mode === -1) {
685 $time_deadline = $time_deadline
689 $time_deadline_ext = $time_deadline_ext
696 if ($protected_peer_review_groups) {
697 $time_deadline = $this->assignment->getDeadline();
698 $time_deadline_ext = $this->assignment->getExtendedDeadline();
702 if (!$time_deadline) {
704 if (!$protected_peer_review_groups &&
707 ->setAlert($lng->
txt(
"exc_needs_fixed_deadline"));
714 ->setAlert($lng->
txt(
"exc_needs_deadline"));
720 $time_deadline_max = max($time_deadline, $time_deadline_ext);
721 $peer_dl = $this->assignment
722 ? $this->assignment->getPeerReviewDeadline()
724 if ($peer_dl && $peer_dl < $time_deadline_max) {
728 ->setAlert($lng->
txt(
"exc_peer_deadline_mismatch"));
733 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
735 ->setAlert($lng->
txt(
"exc_deadline_ext_mismatch"));
739 $time_deadline_min = $time_deadline_ext
740 ? min($time_deadline, $time_deadline_ext)
744 if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
746 ->setAlert($lng->
txt(
"exc_start_date_should_be_before_end_date"));
751 if ($ass_type->usesTeams()) {
756 $a_form->
getInput(
"min_participants_team"),
757 $a_form->
getInput(
"max_participants_team")
759 if ($team_validation[
'status'] ==
'error') {
761 ->setAlert($team_validation[
'msg']);
763 ->setAlert($lng->
txt(
"exc_value_can_not_set"));
772 ,
"title" => trim($a_form->
getInput(
"title"))
773 ,
"instruction" => trim($a_form->
getInput(
"instruction"))
775 ,
"start" => $time_start
776 ,
"deadline" => $time_deadline
777 ,
"deadline_ext" => $time_deadline_ext
778 ,
"max_file" => $a_form->
getInput(
"max_file_tgl")
782 if (!$this->random_manager->isActivated()) {
786 $res[
'team_creator'] = $a_form->
getInput(
"team_creator");
787 $res[
"team_creation"] = $a_form->
getInput(
"team_creation");
790 $res[
"number_teams"] = $a_form->
getInput(
"number_teams");
791 $res[
"min_participants_team"] = $a_form->
getInput(
"min_participants_team");
792 $res[
"max_participants_team"] = $a_form->
getInput(
"max_participants_team");
798 $res[
"deadline_mode"] = $deadline_mode;
801 $res[
"relative_deadline"] = $a_form->
getInput(
"relative_deadline");
802 $rel_deadline_last_subm = $a_form->
getItemByPostVar(
"rel_deadline_last_subm")->getDate();
803 $rel_deadline_last_subm = $rel_deadline_last_subm
806 $res[
"rel_deadline_last_subm"] = $rel_deadline_last_subm;
811 $protected_peer_review_groups) {
816 if (isset($_FILES[
"files"])) {
818 $res[
"files"] = $_FILES[
"files"];
826 $res[
"fb_date_custom"] = $time_fb_custom_date;
828 if ($_FILES[
"fb_file"][
"tmp_name"]) {
829 $res[
"fb_file"] = $_FILES[
"fb_file"];
832 if ($a_form->
getInput(
"rmd_submit_status")) {
833 $res[
"rmd_submit_status"] =
true;
834 $res[
"rmd_submit_start"] = $a_form->
getInput(
"rmd_submit_start");
835 $res[
"rmd_submit_freq"] = $a_form->
getInput(
"rmd_submit_freq");
836 $res[
"rmd_submit_end"] = $reminder_submit_end_date;
837 $res[
"rmd_submit_template_id"] = $a_form->
getInput(
"rmd_submit_template_id");
839 if ($a_form->
getInput(
"rmd_grade_status")) {
840 $res[
"rmd_grade_status"] =
true;
841 $res[
"rmd_grade_freq"] = $a_form->
getInput(
"rmd_grade_freq");
842 $res[
"rmd_grade_end"] = $reminder_grade_end_date;
843 $res[
"rmd_grade_template_id"] = $a_form->
getInput(
"rmd_grade_template_id");
848 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
"form_input_not_valid"));
864 $is_create = !(bool) $a_ass->
getId();
866 $a_ass->
setTitle($a_input[
"title"]);
868 if (!$this->random_manager->isActivated()) {
880 $a_ass->
setTeamTutor((
bool) ($a_input[
"team_creator"] ??
false));
887 if (!$this->random_manager->isActivated()) {
902 if (isset($a_input[
"fb"])) {
913 if (is_array($a_input[
"files"])) {
914 $this->domain->assignment()->instructionFiles($a_ass->
getId())->importFromLegacyUpload($a_input[
"files"]);
918 if (!isset($a_input[
"fb"])) {
926 if (isset($a_input[
"fb"], $a_input[
"fb_file"])) {
963 $reminder->
setReminderStatus((
bool) ($a_input[
"rmd_" . $type .
"_status"] ??
false));
964 $reminder->
setReminderStart((
int) ($a_input[
"rmd_" . $type .
"_start"] ?? 0));
965 $reminder->
setReminderEnd((
int) ($a_input[
"rmd_" . $type .
"_end"] ?? 0));
968 $reminder->{$action}();
983 $this->assignment = null;
987 if (is_array($input)) {
989 $ass->setExerciseId($this->exercise_id);
990 $ass->setType($input[
"type"]);
991 $ass_type_gui = $this->type_guis->getById($ass->getType());
996 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
998 $ass_type_gui->importFormToAssignment($ass, $form);
1001 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1004 $ilCtrl->setParameter($this,
"ass_id", $ass->getId());
1005 $ilCtrl->redirect($this,
"editAssignment");
1007 $form->setValuesByPost();
1022 $ilTabs->activateTab(
"ass_settings");
1037 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1040 $values[
"type"] = $this->assignment->getType();
1041 $values[
"title"] = $this->assignment->getTitle();
1042 $values[
"mandatory"] = $this->assignment->getMandatory();
1043 $values[
"instruction"] = $this->assignment->getInstruction();
1044 if ($this->assignment->getStartTime()) {
1048 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1049 if ($this->assignment->getMaxFile()) {
1050 $values[
"max_file_tgl"] =
true;
1051 $values[
"max_file"] = $this->assignment->getMaxFile();
1055 if ($this->assignment->getAssignmentType()->usesTeams()) {
1056 $values[
"team_creator"] = (string) (
int) $this->assignment->getTeamTutor();
1057 $values[
"team_creation"] =
"0";
1060 if ($this->assignment->getFeedbackDateCustom()) {
1061 $values[
"fb_date_custom"] =
new ilDateTime($this->assignment->getFeedbackDateCustom(),
IL_CAL_UNIX);
1066 if ($rmd_sub->getReminderStatus()) {
1067 $values[
"rmd_submit_status"] = $rmd_sub->getReminderStatus();
1068 $values[
"rmd_submit_start"] = $rmd_sub->getReminderStart();
1070 $values[
"rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1071 $values[
"rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1075 if ($rmd_grade->getReminderStatus()) {
1078 $values[
"rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1079 $values[
"rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1082 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1083 $values = array_merge($values, $type_values);
1086 $values[
"deadline_mode"] = $this->assignment->getDeadlineMode();
1087 if ($values[
"deadline_mode"] === 0 && !$this->assignment->getDeadline()) {
1088 $values[
"deadline_mode"] = -1;
1090 $values[
"relative_deadline"] = $this->assignment->getRelativeDeadline();
1098 if ($this->assignment->getFeedbackFile()) {
1099 $sample_solution = $this->domain->assignment()->sampleSolution($this->assignment->getId());
1102 $a_form->
getItemByPostVar(
"fb_file")->setValue($sample_solution->getFilename());
1106 '<a href="' . $ilCtrl->getLinkTarget($this,
"downloadGlobalFeedbackFile") .
'">' .
1107 $lng->
txt(
"download") .
'</a>' 1110 $a_form->
getItemByPostVar(
"fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1111 $a_form->
getItemByPostVar(
"fb_date")->setValue($this->assignment->getFeedbackDate());
1122 if ($this->assignment->getDeadline() > 0) {
1125 $ed_item->
setDate($edit_date);
1127 if ($this->assignment->getExtendedDeadline() > 0) {
1130 $ed_item->
setDate($edit_date);
1134 if ($this->assignment->getPeerReview()) {
1135 $a_form->
getItemByPostVar(
"peer")->setChecked($this->assignment->getPeerReview());
1144 bool $a_force_set_values =
false 1151 $peer_review = null;
1152 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1153 $this->assignment->getPeerReview()) {
1156 if ($peer_review->hasPeerReviewGroups()) {
1167 if ($a_force_set_values ||
1168 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1188 $ass_type = $this->assignment->getType();
1189 $ass_type_gui = $this->type_guis->getById($ass_type);
1191 if (is_array($input)) {
1192 $old_deadline = $this->assignment->getDeadline();
1193 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1198 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1199 $this->assignment->update();
1201 $new_deadline = $this->assignment->getDeadline();
1202 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1205 if ($old_deadline != $new_deadline ||
1206 $old_ext_deadline != $new_ext_deadline) {
1207 $subm = $this->domain->submission($this->assignment->getId());
1208 $subm->recalculateLateSubmissions();
1211 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1212 $ilCtrl->redirect($this,
"editAssignment");
1215 $ilTabs->activateTab(
"ass_settings");
1217 $form->setValuesByPost();
1229 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class,
"ass_id", null);
1230 if (count($this->requested_ass_ids) == 0) {
1231 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
1232 $ilCtrl->redirect($this,
"listAssignments");
1235 $cgui->setFormAction($ilCtrl->getFormAction($this));
1236 $cgui->setHeaderText(
$lng->
txt(
"exc_conf_del_assignments"));
1237 $cgui->setCancel(
$lng->
txt(
"cancel"),
"listAssignments");
1238 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteAssignments");
1240 foreach ($this->requested_ass_ids as $i) {
1257 foreach ($this->requested_ass_ids as
$id) {
1259 $ass->delete($this->exc);
1264 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_assignments_deleted"),
true);
1266 $ilCtrl->setParameter($this,
"ass_id",
"");
1267 $ilCtrl->redirect($this,
"listAssignments");
1277 $this->requested_order
1280 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_saved_order"),
true);
1281 $ilCtrl->redirect($this,
"listAssignments");
1291 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_saved_order"),
true);
1292 $ilCtrl->redirect($this,
"listAssignments");
1306 $ilTabs->clearTargets();
1307 $ilHelp->setScreenIdComponent(
"exc");
1309 $ilTabs->setBackTarget(
1311 $ilCtrl->getLinkTarget($this,
"listAssignments")
1317 $ilCtrl->getLinkTarget($this,
"editAssignment")
1320 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1321 $this->assignment->getPeerReview()) {
1325 $ilCtrl->getLinkTarget($this,
"editPeerReview")
1328 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class,
"mode", null);
1331 $lng->
txt(
"exc_instruction_files"),
1332 $ilCtrl->getLinkTargetByClass(array(
"ilexassignmenteditorgui", ilResourceCollectionGUI::class))
1340 if (!$this->assignment ||
1341 !$this->assignment->getFeedbackFile()) {
1342 $ilCtrl->
redirect($this,
"returnToParent");
1344 $this->domain->assignment()->sampleSolution($this->assignment->getId())->deliver();
1358 $form->setTitle(
$lng->
txt(
"exc_peer_review"));
1359 $form->setFormAction($ilCtrl->getFormAction($this));
1362 $peer_min->setInfo(
$lng->
txt(
"exc_peer_review_min_number_info"));
1363 $peer_min->setRequired(
true);
1364 $peer_min->setSize(3);
1365 $peer_min->setValue(2);
1366 $form->addItem($peer_min);
1370 $peer_unlock->addOption(
new ilRadioOption(
$lng->
txt(
"exc_peer_review_simple_unlock_active"), 1));
1371 $peer_unlock->addOption(
new ilRadioOption(
$lng->
txt(
"exc_peer_review_simple_unlock_inactive"), 0));
1372 $peer_unlock->setRequired(
true);
1373 $peer_unlock->setValue(0);
1374 $form->addItem($peer_unlock);
1376 if ($this->enable_peer_review_completion) {
1379 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_none_info"));
1380 $peer_cmpl->addOption($option);
1382 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_one_info"));
1383 $peer_cmpl->addOption($option);
1385 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_all_info"));
1386 $peer_cmpl->addOption($option);
1387 $peer_cmpl->setRequired(
true);
1389 $form->addItem($peer_cmpl);
1394 $peer_dl->setShowTime(
true);
1395 $form->addItem($peer_dl);
1398 $peer_prsl->setInfo(
$lng->
txt(
"exc_peer_review_personal_info"));
1399 $form->addItem($peer_prsl);
1402 $rmd_feedback =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_feedback_setting"),
"rmd_peer_status");
1404 $rmd_submit_start =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_feedback_start"),
"rmd_peer_start");
1405 $rmd_submit_start->setSize(3);
1406 $rmd_submit_start->setMaxLength(3);
1407 $rmd_submit_start->setSuffix(
$lng->
txt(
'days'));
1409 $rmd_submit_start->setMinValue(1);
1410 $rmd_feedback->
addSubItem($rmd_submit_start);
1412 $rmd_submit_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_peer_freq");
1413 $rmd_submit_frequency->setSize(3);
1414 $rmd_submit_frequency->setMaxLength(3);
1415 $rmd_submit_frequency->setSuffix(
$lng->
txt(
'days'));
1416 $rmd_submit_frequency->setRequired(
true);
1417 $rmd_submit_frequency->setMinValue(1);
1418 $rmd_feedback->addSubItem($rmd_submit_frequency);
1422 $rmd_feedback->addSubItem($rmd_submit_end);
1426 $form->addItem($rmd_feedback);
1431 $form->addItem($cats);
1436 $cats->addOption($def);
1439 $def->addSubItem($peer_text);
1442 $peer_char->setInfo(
$lng->
txt(
"exc_peer_review_min_chars_info"));
1443 $peer_char->setSize(3);
1444 $peer_text->addSubItem($peer_char);
1447 $def->addSubItem($peer_rating);
1450 $peer_file->setInfo(
$lng->
txt(
"exc_peer_review_file_info"));
1451 $def->addSubItem($peer_file);
1456 if (
sizeof($cat_objs)) {
1457 foreach ($cat_objs as $cat_obj) {
1461 if (
sizeof($crits)) {
1463 foreach ($crits as $crit) {
1464 $titles[] = $crit->getTitle();
1466 $opt =
new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1467 $opt->
setInfo(implode(
", ", $titles));
1468 $cats->addOption($opt);
1473 $url = $ilCtrl->getLinkTargetByClass(
"ilexccriteriacataloguegui",
"");
1474 $def->setInfo(
'<a href="' .
$url .
'">[+] ' .
1475 $lng->
txt(
"exc_add_criteria_catalogue") .
1480 $form->addCommandButton(
"updatePeerReview",
$lng->
txt(
"save"));
1481 $form->addCommandButton(
"editAssignment",
$lng->
txt(
"cancel"));
1495 $ilTabs->activateTab(
"peer_settings");
1497 if ($a_form === null) {
1511 if ($this->assignment->getPeerReviewDeadline() > 0) {
1516 if ($reminder->getReminderStatus()) {
1517 $values[
"rmd_peer_status"] = $reminder->getReminderStatus();
1518 $values[
"rmd_peer_start"] = $reminder->getReminderStart();
1520 $values[
"rmd_peer_freq"] = $reminder->getReminderFrequency();
1521 $values[
"rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1531 $a_form->
getItemByPostVar(
"peer_min")->setValue($this->assignment->getPeerReviewMin());
1532 $a_form->
getItemByPostVar(
"peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1533 $a_form->
getItemByPostVar(
"peer_unlock")->setValue($this->assignment->getPeerReviewSimpleUnlock());
1535 if ($this->enable_peer_review_completion) {
1536 $a_form->
getItemByPostVar(
"peer_valid")->setValue($this->assignment->getPeerReviewValid());
1539 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1544 $a_form->
getItemByPostVar(
"peer_text")->setChecked($this->assignment->hasPeerReviewText());
1545 $a_form->
getItemByPostVar(
"peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1546 $a_form->
getItemByPostVar(
"peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1547 if ($this->assignment->getPeerReviewChars() > 0) {
1548 $a_form->
getItemByPostVar(
"peer_char")->setValue($this->assignment->getPeerReviewChars());
1556 bool $a_force_set_values =
false 1560 if ($peer_review->hasPeerReviewGroups()) {
1568 if ($this->enable_peer_review_completion) {
1580 $min->setValue($this->assignment->getPeerReviewMin());
1584 if ($a_force_set_values ||
1585 $peer_review->hasPeerReviewGroups()) {
1599 $protected_peer_review_groups =
false;
1601 if ($peer_review->hasPeerReviewGroups()) {
1602 $protected_peer_review_groups =
true;
1608 $time_deadline = $this->assignment->getDeadline();
1609 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1610 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1618 $reminder_date = $reminder_date
1623 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1625 ->setAlert(
$lng->
txt(
"exc_peer_deadline_mismatch"));
1629 if (!$protected_peer_review_groups) {
1630 if ($a_form->
getInput(
"crit_cat") < 0 &&
1632 !$a_form->
getInput(
"peer_rating") &&
1635 ->setAlert(
$lng->
txt(
"select_one"));
1642 $res[
"peer_dl"] = $time_peer;
1644 if ($protected_peer_review_groups) {
1645 $res[
"peer_min"] = $this->assignment->getPeerReviewMin();
1646 $res[
"peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1647 $res[
"peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1648 $res[
"peer_valid"] = $this->assignment->getPeerReviewValid();
1650 $res[
"peer_text"] = $this->assignment->hasPeerReviewText();
1651 $res[
"peer_rating"] = $this->assignment->hasPeerReviewRating();
1652 $res[
"peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1653 $res[
"peer_char"] = $this->assignment->getPeerReviewChars();
1654 $res[
"crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1656 $res[
"peer_valid"] = $this->enable_peer_review_completion
1657 ?
$res[
"peer_valid"]
1661 $res[
"peer_unlock"] = $a_form->
getInput(
"peer_unlock");
1666 $res[
"peer_rating"] = $a_form->
getInput(
"peer_rating");
1671 if ($a_form->
getInput(
"rmd_peer_status")) {
1672 $res[
"rmd_peer_status"] = $a_form->
getInput(
"rmd_peer_status");
1673 $res[
"rmd_peer_start"] = $a_form->
getInput(
"rmd_peer_start");
1674 $res[
"rmd_peer_end"] = $reminder_date;
1675 $res[
"rmd_peer_freq"] = $a_form->
getInput(
"rmd_peer_freq");
1676 $res[
"rmd_peer_template_id"] = $a_form->
getInput(
"rmd_peer_template_id");
1681 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"form_input_not_valid"));
1708 ? (
int) $a_input[
"crit_cat"]
1728 if (is_array($input)) {
1730 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1731 $ilCtrl->redirect($this,
"editPeerReview");
1734 $ilTabs->activateTab(
"peer_settings");
1736 $form->setValuesByPost();
1749 int $a_min_participants,
1750 int $a_max_participants
1753 $number_of_teams = $a_num_teams;
1755 if ($number_of_teams) {
1756 $members_per_team = round($total_members / $a_num_teams);
1758 if ($a_min_participants) {
1759 $number_of_teams = round($total_members / $a_min_participants);
1760 $participants_extra_team = $total_members % $a_min_participants;
1761 if ($participants_extra_team > $number_of_teams) {
1763 $message = sprintf($this->
lng->txt(
"exc_team_minimal_too_big"), $a_min_participants);
1764 return array(
"status" =>
"error",
"msg" => $message,
"field" =>
"min_participants_team");
1767 $members_per_team = 0;
1770 if ($a_min_participants > $a_max_participants) {
1771 $message = $this->
lng->txt(
"exc_team_min_big_than_max");
1772 return array(
"status" =>
"error",
"msg" => $message,
"field" =>
"max_participants_team");
1775 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1776 $message = sprintf($this->
lng->txt(
"exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1777 return array(
"status" =>
"error",
"msg" => $message,
"field" =>
"max_participants_team");
1780 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1781 $message = sprintf($this->
lng->txt(
"exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1782 return array(
"status" =>
"error",
"msg" => $message,
"field" =>
"min_participants_team");
1785 return array(
"status" =>
"success",
"msg" =>
"");
1794 return count($exc_members->getMembers());
1802 if ($ass_type->usesTeams() &&
1805 $number_teams = $a_input[
'number_teams'];
1808 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->
getId(), $number_teams, $a_input[
'min_participants_team']);
1812 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exc_teams_assignment_adopted"),
true);
getPeerReviewValues(\ilPropertyFormGUI $a_form)
setStartTime(?int $a_val)
setRelativeDeadline(int $a_val)
importPeerReviewFormToAssignmentReminders(array $a_input, int $a_ass_id)
getExerciseTotalMembers()
Class ilExAssignmentEditorGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEAMS_FORMED_BY_RANDOM
initAssignmentForm(int $a_type, string $a_mode="create")
handleDisabledFields(ilPropertyFormGUI $a_form, bool $a_force_set_values=false)
const FEEDBACK_DATE_SUBMISSION
ILIAS Exercise InternalDomainService $domain
setReminderMailTemplate(int $a_tpl_id)
ILIAS ResourceStorage Services $irss
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
editPeerReviewObject(ilPropertyFormGUI $a_form=null)
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
setFeedbackFile(?string $a_value)
setPeerReviewValid(int $a_value)
Set peer review validation.
confirmAssignmentsDeletionObject()
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setFeedbackDateCustom(int $a_value)
Set (global) feedback file availability using a custom date.
static getInstancesByParentId(int $a_parent_id)
handleGlobalFeedbackFileUpload(int $ass_id, array $a_file)
processForm(ilPropertyFormGUI $a_form)
Custom form validation.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setPeerReviewMin(int $a_value)
setPeerReviewFileUpload(bool $a_val)
static lookupTitle(int $a_id)
Handles exercise Grade reminder mail placeholders If all contexts are using the same placeholders...
setDate($a_date, int $a_format)
Set date.
static saveAssOrderOfExercise(int $a_ex_id, array $a_order)
setDeadlineMode(int $a_val)
Set deadline mode.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAdoptableTeamAssignments(int $a_exercise_id, int $a_exclude_ass_id=null, int $a_user_id=null)
validationTeamsFormation(int $a_num_teams, int $a_min_participants, int $a_max_participants)
Mandatory RandomAssignmentsManager $random_manager
static getInstancesByParentId(int $a_parent_id)
loadLanguageModule(string $a_module)
Load language module.
setFeedbackCron(bool $a_value)
Toggle (global) feedback file cron.
setReminderFrequency(int $a_num_days)
static orderAssByDeadline(int $a_ex_id)
generateTeams(ilExAssignment $a_assignment, array $a_input)
Handles exercise Peer reminder mail placeholders If all contexts are using the same placeholders...
const PEER_REVIEW_VALID_ALL
const TEAMS_FORMED_BY_TUTOR
setInstruction(string $a_val)
addAssignmentObject()
Create assignment.
const PEER_REVIEW_VALID_ONE
string $requested_ass_type
getAssignmentValues(ilPropertyFormGUI $a_form)
setTeamTutor(bool $a_value)
ilExAssignment $assignment
ILIAS Exercise InternalGUIService $gui
setPeerReviewRating(bool $a_val)
setExtendedDeadline(?int $a_val)
Manages random mandatory assignments of an exercise (business logic)
processPeerReviewForm(ilPropertyFormGUI $a_form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilExAssignmentTypes $types
setMandatory(bool $a_val)
setFeedbackDate(int $a_value)
ilExAssignmentTypesGUI $type_guis
setReminderEnd(int $a_date)
setPeerReviewDeadline(int $a_val)
setRelDeadlineLastSubmission(int $a_val)
static getAssignmentTeamMap(int $a_ass_id)
importFormToAssignmentReminders(array $a_input, int $a_ass_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $enable_peer_review_completion
setPeerReviewPersonalized(bool $a_val)
const FEEDBACK_DATE_DEADLINE
saveReminderData(ilExAssignmentReminder $reminder, array $a_input)
orderAssignmentsByDeadlineObject()
ilGlobalPageTemplate $tpl
const TEAMS_FORMED_BY_PARTICIPANTS
saveAssignmentOrderObject()
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
setDescription(string $a_descr)
Sets description below title in standard template.
setPeerReviewSimpleUnlock(int $a_value)
setPeerReviewChars(?int $a_value)
handleDisabledPeerFields(ilPropertyFormGUI $a_form, bool $a_force_set_values=false)
setPeerReviewText(bool $a_val)
static adoptTeams(int $a_source_ass_id, int $a_target_ass_id, int $a_user_id=null, int $a_exc_ref_id=null)
const PEER_REVIEW_VALID_NONE
const FEEDBACK_DATE_CUSTOM
ILIAS Exercise InstructionFile InstructionFileManager $instruction_files
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)
const TEAMS_FORMED_BY_ASSIGNMENT
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
setMaxFile(?int $a_value)
setReminderStart(int $a_num_days)
setDisabledPeerReviewFieldValues(ilPropertyFormGUI $a_form)
downloadGlobalFeedbackFileObject()
setPeerReview(bool $a_value)
setReminderStatus(?bool $a_status)
Set reminder for users without submission.
addMailTemplatesRadio(string $a_reminder_type)
setPeerReviewCriteriaCatalogue(?int $a_value)
Handles exercise Submit reminder mail placeholders If all contexts are using the same placeholders...
setContent(string $a_html)
Sets content for standard template.
ILIAS FileUpload FileUpload $upload
setDisabledFieldValues(ilPropertyFormGUI $a_form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
deleteAssignmentsObject()