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;
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);
145 case "ilexassignmentfilesystemgui":
147 $ilTabs->activateTab(
"ass_files");
149 $fstorage =
new ilFSWebStorageExercise($this->exercise_id, $this->assignment->getId());
152 $fs_gui->
setTitle($lng->
txt(
"exc_instruction_files"));
153 $fs_gui->setTableId(
"excassfil" . $this->assignment->getId());
154 $fs_gui->setAllowDirectories(
false);
155 $ilCtrl->forwardCommand($fs_gui);
158 case "ilexpeerreviewgui":
159 $ilTabs->clearTargets();
160 $ilTabs->setBackTarget(
162 $ilCtrl->getLinkTarget($this,
"listAssignments")
166 $ilCtrl->forwardCommand($peer_gui);
170 $this->{$cmd .
"Object"}();
186 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"addAssignment"));
191 $this->
lng->txt(
"exc_add_assignment"),
193 )->submit()->toToolbar(
true);
209 $this->assignment = null;
211 if ($this->requested_type == 0) {
212 $ilCtrl->
redirect($this,
"listAssignments");
227 foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
228 $types[$k] = $t->getTitle();
233 $ty->setRequired(
true);
242 string $a_mode =
"create" 247 $ass_type = $this->types->getById($a_type);
248 $ass_type_gui = $this->type_guis->getById($a_type);
253 if ($a_mode ==
"edit") {
254 $form->setTitle($lng->
txt(
"exc_edit_assignment"));
256 $form->setTitle($lng->
txt(
"exc_new_assignment"));
258 $form->setFormAction($ilCtrl->getFormAction($this));
262 $ti->setMaxLength(200);
263 $ti->setRequired(
true);
268 $ty->setValue($a_type);
269 $ty->setDisabled(
true);
276 $ass_type_gui->addEditFormCustomProperties($form);
282 if ($ass_type->usesTeams()) {
283 if ($a_mode ==
"edit") {
293 $lng->
txt(
"exc_team_by_participants"),
295 $lng->
txt(
"exc_team_by_participants_info")
299 $lng->
txt(
"exc_team_by_tutors"),
301 $lng->
txt(
"exc_team_by_tutors_info")
309 $rd_creation_method->setValue(
"0");
313 $lng->
txt(
"exc_team_by_tutors_manual"),
315 $lng->
txt(
"exc_team_by_tutors_manual_info")
317 $rd_creation_method->addOption($rd_creation_manual);
322 $add_info =
" <strong>" . $lng->
txt(
"exc_team_by_random_add_info") .
"</strong>";
325 $lng->
txt(
"exc_team_by_random"),
329 $rd_creation_method->addOption($rd_creation_random);
332 $number_teams->setSize(3);
333 $number_teams->setMinValue(1);
335 $number_teams->setRequired(
true);
336 $number_teams->setSuffix($lng->
txt(
"exc_team_assignment_adopt_teams"));
337 $rd_creation_random->addSubItem($number_teams);
339 $min_team_participants =
new ilNumberInputGUI($lng->
txt(
"exc_min_team_participants"),
"min_participants_team");
340 $min_team_participants->setSize(3);
341 $min_team_participants->setMinValue(1);
343 $min_team_participants->setRequired(
true);
344 $min_team_participants->setSuffix($lng->
txt(
"exc_participants"));
345 $rd_creation_random->addSubItem($min_team_participants);
347 $max_team_participants =
new ilNumberInputGUI($lng->
txt(
"exc_max_team_participants"),
"max_participants_team");
348 $max_team_participants->setSize(3);
349 $max_team_participants->setMinValue(1);
351 $max_team_participants->setRequired(
true);
352 $max_team_participants->setSuffix($lng->
txt(
"exc_participants"));
353 $rd_creation_random->addSubItem($max_team_participants);
356 if (count($options)) {
358 $lng->
txt(
"exc_team_by_assignment"),
360 $lng->
txt(
"exc_team_by_assignment_info")
364 $radio_assignment_adopt->setRequired(
true);
365 $radio_assignment_adopt->addOption(
new ilRadioOption($lng->
txt(
"exc_team_assignment_adopt_none"), -1));
367 foreach ($options as
$id => $item) {
369 $option->setInfo($lng->
txt(
"exc_team_assignment_adopt_teams") .
": " . $item[
"teams"]);
370 $radio_assignment_adopt->addOption($option);
372 $radio_assignment->
addSubItem($radio_assignment_adopt);
373 $rd_creation_method->addOption($radio_assignment);
376 $radio_tutors->
addSubItem($rd_creation_method);
378 $rd_team->addOption($radio_participants);
379 $rd_team->addOption($radio_tutors);
383 $form->addItem($rd_team);
386 $rd_team->setDisabled(
true);
391 if (!$this->random_manager->isActivated()) {
393 $cb->setInfo($lng->
txt(
"exc_mandatory_info"));
394 $cb->setChecked(
true);
399 $ne->setValue($lng->
txt(
"exc_mandatory_rand_determined"));
405 $sub_header->setTitle($lng->
txt(
"exc_work_instructions"));
406 $form->addItem($sub_header);
411 $desc_input->setUseRte(
true);
412 $desc_input->setRteTagSet(
"mini");
414 $form->addItem($desc_input);
417 if ($a_mode ==
"create") {
420 $form->addItem($files);
425 $sub_header->setTitle($lng->
txt(
"exc_schedule"));
426 $form->addItem($sub_header);
431 $form->addItem($start_date);
436 $op0 =
new ilRadioOption($lng->
txt(
"exc_no_deadline"), -1, $lng->
txt(
"exc_no_deadline_info"));
437 $radg->addOption($op0);
438 $op1 =
new ilRadioOption($lng->
txt(
"exc_fixed_date"), 0, $lng->
txt(
"exc_fixed_date_info"));
439 $radg->addOption($op1);
440 if (!$ass_type->usesTeams()) {
441 $op3 =
new ilRadioOption($lng->
txt(
"exc_fixed_date_individual"), 2, $lng->
txt(
"exc_fixed_date_individual_info"));
442 $radg->addOption($op3);
444 $op2 =
new ilRadioOption($lng->
txt(
"exc_relative_date"), 1, $lng->
txt(
"exc_relative_date_info"));
445 $radg->addOption($op2);
446 $form->addItem($radg);
451 $deadline->setShowTime(
true);
452 $op1->addSubItem($deadline);
456 $deadline2->
setInfo($lng->
txt(
"exc_deadline_extended_info"));
457 $deadline2->setShowTime(
true);
458 $op1->addSubItem($deadline2);
462 $rmd_submit =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_submit_setting"),
"rmd_submit_status");
464 $rmd_submit_start =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_start"),
"rmd_submit_start");
465 $rmd_submit_start->setSize(3);
466 $rmd_submit_start->setMaxLength(3);
467 $rmd_submit_start->setSuffix($lng->
txt(
'days'));
468 $rmd_submit_start->
setInfo($this->
lng->txt(
"exc_reminder_start_info"));
470 $rmd_submit_start->setMinValue(1);
473 $rmd_submit_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_submit_freq");
474 $rmd_submit_frequency->setSize(3);
475 $rmd_submit_frequency->setMaxLength(3);
476 $rmd_submit_frequency->setSuffix($lng->
txt(
'days'));
477 $rmd_submit_frequency->setRequired(
true);
478 $rmd_submit_frequency->setMinValue(1);
479 $rmd_submit->addSubItem($rmd_submit_frequency);
483 $rmd_submit->addSubItem($rmd_submit_end);
488 $rmd_grade =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_grade_setting"),
"rmd_grade_status");
490 $rmd_grade_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_grade_freq");
491 $rmd_grade_frequency->setSize(3);
492 $rmd_grade_frequency->setMaxLength(3);
493 $rmd_grade_frequency->setSuffix($lng->
txt(
'days'));
495 $rmd_grade_frequency->setMinValue(1);
500 $rmd_grade->addSubItem($rmd_grade_end);
504 $form->addItem($rmd_submit);
505 $form->addItem($rmd_grade);
509 $ti->setSuffix($lng->
txt(
"days"));
510 $ti->setMaxLength(3);
513 $ti->setRequired(
true);
514 $op2->addSubItem($ti);
517 $last_submission =
new ilDateTimeInputGUI($lng->
txt(
"exc_rel_last_submission"),
"rel_deadline_last_subm");
518 $last_submission->
setInfo($lng->
txt(
"exc_rel_last_submission_info"));
519 $last_submission->setShowTime(
true);
520 $op2->addSubItem($last_submission);
525 if ($ass_type->usesFileUpload()) {
527 $sub_header->setTitle($ass_type->getTitle());
528 $form->addItem($sub_header);
530 $form->addItem($max_file_tgl);
533 $max_file->setInfo($lng->
txt(
"exc_max_file_info"));
534 $max_file->setRequired(
true);
535 $max_file->setSize(3);
536 $max_file->setMinValue(1);
537 $max_file_tgl->addSubItem($max_file);
542 $sub_header->setTitle($lng->
txt(
"exc_after_submission"));
543 $form->addItem($sub_header);
545 if (!$ass_type->usesTeams() && !$this->random_manager->isActivated()) {
548 $peer->setInfo($lng->
txt(
"exc_peer_review_ass_setting_info"));
549 $form->addItem($peer);
561 $fb->addSubItem($fb_file);
572 $fb_date_custom_date->setShowTime(
true);
574 $fb_date_custom_option->
addSubItem($fb_date_custom_date);
575 $fb_date->addOption($fb_date_custom_option);
578 $fb->addSubItem($fb_date);
581 $fb_cron->setInfo($lng->
txt(
"exc_global_feedback_file_cron_info"));
582 $fb->addSubItem($fb_cron);
585 if ($a_mode ==
"create") {
586 $form->addCommandButton(
"saveAssignment", $lng->
txt(
"save"));
588 $form->addCommandButton(
"updateAssignment", $lng->
txt(
"save"));
590 $form->addCommandButton(
"listAssignments", $lng->
txt(
"cancel"));
599 $post_var =
"rmd_" . $a_reminder_type .
"_template_id";
603 $r_group->addOption(
new ilRadioOption($this->
lng->txt(
"exc_reminder_mail_no_tpl"), 0));
604 $r_group->setValue(0);
606 switch ($a_reminder_type) {
620 $templateService = $DIC->mail()->textTemplates();
621 foreach ($templateService->loadTemplatesForContextId(
$context->getId()) as $template) {
622 $r_group->addOption(
new ilRadioOption($template->getTitle(), $template->getTplId()));
623 if ($template->isDefault()) {
624 $r_group->setValue($template->getTplId());
641 $protected_peer_review_groups =
false;
643 if ($this->assignment) {
644 if ($this->assignment->getPeerReview()) {
646 if ($peer_review->hasPeerReviewGroups()) {
647 $protected_peer_review_groups =
true;
651 if ($this->assignment->getFeedbackFile()) {
657 if ($protected_peer_review_groups) {
665 $ass_type = $this->types->getById($type);
670 $time_start = $time_start
674 $time_fb_custom_date = $a_form->
getItemByPostVar(
"fb_date_custom")->getDate();
675 $time_fb_custom_date = $time_fb_custom_date
679 $reminder_submit_end_date = $a_form->
getItemByPostVar(
"rmd_submit_end")->getDate();
680 $reminder_submit_end_date = $reminder_submit_end_date
684 $reminder_grade_end_date = $a_form->
getItemByPostVar(
"rmd_grade_end")->getDate();
685 $reminder_grade_end_date = $reminder_grade_end_date
689 $time_deadline = null;
690 $time_deadline_ext = null;
692 $deadline_mode = (
int) $a_form->
getInput(
"deadline_mode");
693 if ($deadline_mode === -1) {
699 $time_deadline = $time_deadline
703 $time_deadline_ext = $time_deadline_ext
710 if ($protected_peer_review_groups) {
711 $time_deadline = $this->assignment->getDeadline();
712 $time_deadline_ext = $this->assignment->getExtendedDeadline();
716 if (!$time_deadline) {
718 if (!$protected_peer_review_groups &&
721 ->setAlert($lng->
txt(
"exc_needs_fixed_deadline"));
728 ->setAlert($lng->
txt(
"exc_needs_deadline"));
734 $time_deadline_max = max($time_deadline, $time_deadline_ext);
735 $peer_dl = $this->assignment
736 ? $this->assignment->getPeerReviewDeadline()
738 if ($peer_dl && $peer_dl < $time_deadline_max) {
742 ->setAlert($lng->
txt(
"exc_peer_deadline_mismatch"));
747 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
749 ->setAlert($lng->
txt(
"exc_deadline_ext_mismatch"));
753 $time_deadline_min = $time_deadline_ext
754 ? min($time_deadline, $time_deadline_ext)
758 if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
760 ->setAlert($lng->
txt(
"exc_start_date_should_be_before_end_date"));
765 if ($ass_type->usesTeams()) {
770 $a_form->
getInput(
"min_participants_team"),
771 $a_form->
getInput(
"max_participants_team")
773 if ($team_validation[
'status'] ==
'error') {
775 ->setAlert($team_validation[
'msg']);
777 ->setAlert($lng->
txt(
"exc_value_can_not_set"));
786 ,
"title" => trim($a_form->
getInput(
"title"))
787 ,
"instruction" => trim($a_form->
getInput(
"instruction"))
789 ,
"start" => $time_start
790 ,
"deadline" => $time_deadline
791 ,
"deadline_ext" => $time_deadline_ext
792 ,
"max_file" => $a_form->
getInput(
"max_file_tgl")
796 if (!$this->random_manager->isActivated()) {
800 $res[
'team_creator'] = $a_form->
getInput(
"team_creator");
801 $res[
"team_creation"] = $a_form->
getInput(
"team_creation");
804 $res[
"number_teams"] = $a_form->
getInput(
"number_teams");
805 $res[
"min_participants_team"] = $a_form->
getInput(
"min_participants_team");
806 $res[
"max_participants_team"] = $a_form->
getInput(
"max_participants_team");
812 $res[
"deadline_mode"] = $deadline_mode;
815 $res[
"relative_deadline"] = $a_form->
getInput(
"relative_deadline");
816 $rel_deadline_last_subm = $a_form->
getItemByPostVar(
"rel_deadline_last_subm")->getDate();
817 $rel_deadline_last_subm = $rel_deadline_last_subm
820 $res[
"rel_deadline_last_subm"] = $rel_deadline_last_subm;
825 $protected_peer_review_groups) {
830 if (isset($_FILES[
"files"])) {
833 $res[
"files"] = $_FILES[
"files"];
841 $res[
"fb_date_custom"] = $time_fb_custom_date;
843 if ($_FILES[
"fb_file"][
"tmp_name"]) {
844 $res[
"fb_file"] = $_FILES[
"fb_file"];
847 if ($a_form->
getInput(
"rmd_submit_status")) {
848 $res[
"rmd_submit_status"] =
true;
849 $res[
"rmd_submit_start"] = $a_form->
getInput(
"rmd_submit_start");
850 $res[
"rmd_submit_freq"] = $a_form->
getInput(
"rmd_submit_freq");
851 $res[
"rmd_submit_end"] = $reminder_submit_end_date;
852 $res[
"rmd_submit_template_id"] = $a_form->
getInput(
"rmd_submit_template_id");
854 if ($a_form->
getInput(
"rmd_grade_status")) {
855 $res[
"rmd_grade_status"] =
true;
856 $res[
"rmd_grade_freq"] = $a_form->
getInput(
"rmd_grade_freq");
857 $res[
"rmd_grade_end"] = $reminder_grade_end_date;
858 $res[
"rmd_grade_template_id"] = $a_form->
getInput(
"rmd_grade_template_id");
863 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
"form_input_not_valid"));
879 $is_create = !(bool) $a_ass->
getId();
881 $a_ass->
setTitle($a_input[
"title"]);
883 if (!$this->random_manager->isActivated()) {
895 $a_ass->
setTeamTutor((
bool) ($a_input[
"team_creator"] ??
false));
902 if (!$this->random_manager->isActivated()) {
917 if (isset($a_input[
"fb"])) {
928 if (is_array($a_input[
"files"])) {
929 $this->domain->assignment()->instructionFiles($a_ass->
getId())->importFromLegacyUpload($a_input[
"files"]);
933 if (!isset($a_input[
"fb"])) {
942 if (isset($a_input[
"fb"], $a_input[
"fb_file"])) {
979 $reminder->
setReminderStatus((
bool) ($a_input[
"rmd_" . $type .
"_status"] ??
false));
980 $reminder->
setReminderStart((
int) ($a_input[
"rmd_" . $type .
"_start"] ?? 0));
981 $reminder->
setReminderEnd((
int) ($a_input[
"rmd_" . $type .
"_end"] ?? 0));
984 $reminder->{$action}();
999 $this->assignment = null;
1003 if (is_array($input)) {
1005 $ass->setExerciseId($this->exercise_id);
1006 $ass->setType($input[
"type"]);
1007 $ass_type_gui = $this->type_guis->getById($ass->getType());
1012 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1014 $ass_type_gui->importFormToAssignment($ass, $form);
1017 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1020 $ilCtrl->setParameter($this,
"ass_id", $ass->getId());
1021 $ilCtrl->redirect($this,
"editAssignment");
1023 $form->setValuesByPost();
1038 $ilTabs->activateTab(
"ass_settings");
1054 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1057 $values[
"type"] = $this->assignment->getType();
1058 $values[
"title"] = $this->assignment->getTitle();
1059 $values[
"mandatory"] = $this->assignment->getMandatory();
1060 $values[
"instruction"] = $this->assignment->getInstruction();
1061 if ($this->assignment->getStartTime()) {
1065 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1066 if ($this->assignment->getMaxFile()) {
1067 $values[
"max_file_tgl"] =
true;
1068 $values[
"max_file"] = $this->assignment->getMaxFile();
1072 if ($this->assignment->getAssignmentType()->usesTeams()) {
1073 $values[
"team_creator"] = (string) (
int) $this->assignment->getTeamTutor();
1074 $values[
"team_creation"] =
"0";
1077 if ($this->assignment->getFeedbackDateCustom()) {
1078 $values[
"fb_date_custom"] =
new ilDateTime($this->assignment->getFeedbackDateCustom(),
IL_CAL_UNIX);
1083 if ($rmd_sub->getReminderStatus()) {
1084 $values[
"rmd_submit_status"] = $rmd_sub->getReminderStatus();
1085 $values[
"rmd_submit_start"] = $rmd_sub->getReminderStart();
1087 $values[
"rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1088 $values[
"rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1092 if ($rmd_grade->getReminderStatus()) {
1095 $values[
"rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1096 $values[
"rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1099 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1100 $values = array_merge($values, $type_values);
1103 $values[
"deadline_mode"] = $this->assignment->getDeadlineMode();
1104 if ($values[
"deadline_mode"] === 0 && !$this->assignment->getDeadline()) {
1105 $values[
"deadline_mode"] = -1;
1107 $values[
"relative_deadline"] = $this->assignment->getRelativeDeadline();
1115 if ($this->assignment->getFeedbackFile()) {
1117 $a_form->
getItemByPostVar(
"fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1121 '<a href="' . $ilCtrl->getLinkTarget($this,
"downloadGlobalFeedbackFile") .
'">' .
1122 $lng->
txt(
"download") .
'</a>' 1125 $a_form->
getItemByPostVar(
"fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1126 $a_form->
getItemByPostVar(
"fb_date")->setValue($this->assignment->getFeedbackDate());
1137 if ($this->assignment->getDeadline() > 0) {
1140 $ed_item->
setDate($edit_date);
1142 if ($this->assignment->getExtendedDeadline() > 0) {
1145 $ed_item->
setDate($edit_date);
1149 if ($this->assignment->getPeerReview()) {
1150 $a_form->
getItemByPostVar(
"peer")->setChecked($this->assignment->getPeerReview());
1159 bool $a_force_set_values =
false 1166 $peer_review = null;
1167 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1168 $this->assignment->getPeerReview()) {
1171 if ($peer_review->hasPeerReviewGroups()) {
1182 if ($a_force_set_values ||
1183 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1203 $ass_type = $this->assignment->getType();
1204 $ass_type_gui = $this->type_guis->getById($ass_type);
1206 if (is_array($input)) {
1207 $old_deadline = $this->assignment->getDeadline();
1208 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1213 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1214 $this->assignment->update();
1216 $new_deadline = $this->assignment->getDeadline();
1217 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1220 if ($old_deadline != $new_deadline ||
1221 $old_ext_deadline != $new_ext_deadline) {
1222 $this->assignment->recalculateLateSubmissions();
1225 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1226 $ilCtrl->redirect($this,
"editAssignment");
1229 $ilTabs->activateTab(
"ass_settings");
1231 $form->setValuesByPost();
1243 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class,
"ass_id", null);
1244 if (count($this->requested_ass_ids) == 0) {
1245 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
1246 $ilCtrl->redirect($this,
"listAssignments");
1249 $cgui->setFormAction($ilCtrl->getFormAction($this));
1250 $cgui->setHeaderText(
$lng->
txt(
"exc_conf_del_assignments"));
1251 $cgui->setCancel(
$lng->
txt(
"cancel"),
"listAssignments");
1252 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteAssignments");
1254 foreach ($this->requested_ass_ids as $i) {
1271 foreach ($this->requested_ass_ids as
$id) {
1273 $ass->delete($this->exc);
1278 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_assignments_deleted"),
true);
1280 $ilCtrl->setParameter($this,
"ass_id",
"");
1281 $ilCtrl->redirect($this,
"listAssignments");
1291 $this->requested_order
1294 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_saved_order"),
true);
1295 $ilCtrl->redirect($this,
"listAssignments");
1305 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_saved_order"),
true);
1306 $ilCtrl->redirect($this,
"listAssignments");
1320 $ilTabs->clearTargets();
1321 $ilHelp->setScreenIdComponent(
"exc");
1323 $ilTabs->setBackTarget(
1325 $ilCtrl->getLinkTarget($this,
"listAssignments")
1331 $ilCtrl->getLinkTarget($this,
"editAssignment")
1334 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1335 $this->assignment->getPeerReview()) {
1339 $ilCtrl->getLinkTarget($this,
"editPeerReview")
1342 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class,
"mode", null);
1345 $lng->
txt(
"exc_instruction_files"),
1346 $ilCtrl->getLinkTargetByClass(array(
"ilexassignmenteditorgui", ilResourceCollectionGUI::class))
1354 if (!$this->assignment ||
1355 !$this->assignment->getFeedbackFile()) {
1356 $ilCtrl->
redirect($this,
"returnToParent");
1358 $this->domain->assignment()->sampleSolution($this->assignment->getId())->deliver();
1372 $form->setTitle(
$lng->
txt(
"exc_peer_review"));
1373 $form->setFormAction($ilCtrl->getFormAction($this));
1376 $peer_min->setInfo(
$lng->
txt(
"exc_peer_review_min_number_info"));
1377 $peer_min->setRequired(
true);
1378 $peer_min->setSize(3);
1379 $peer_min->setValue(2);
1380 $form->addItem($peer_min);
1384 $peer_unlock->addOption(
new ilRadioOption(
$lng->
txt(
"exc_peer_review_simple_unlock_active"), 1));
1385 $peer_unlock->addOption(
new ilRadioOption(
$lng->
txt(
"exc_peer_review_simple_unlock_inactive"), 0));
1386 $peer_unlock->setRequired(
true);
1387 $peer_unlock->setValue(0);
1388 $form->addItem($peer_unlock);
1390 if ($this->enable_peer_review_completion) {
1393 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_none_info"));
1394 $peer_cmpl->addOption($option);
1396 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_one_info"));
1397 $peer_cmpl->addOption($option);
1399 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_all_info"));
1400 $peer_cmpl->addOption($option);
1401 $peer_cmpl->setRequired(
true);
1403 $form->addItem($peer_cmpl);
1408 $peer_dl->setShowTime(
true);
1409 $form->addItem($peer_dl);
1412 $peer_prsl->setInfo(
$lng->
txt(
"exc_peer_review_personal_info"));
1413 $form->addItem($peer_prsl);
1416 $rmd_feedback =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_feedback_setting"),
"rmd_peer_status");
1418 $rmd_submit_start =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_feedback_start"),
"rmd_peer_start");
1419 $rmd_submit_start->setSize(3);
1420 $rmd_submit_start->setMaxLength(3);
1421 $rmd_submit_start->setSuffix(
$lng->
txt(
'days'));
1423 $rmd_submit_start->setMinValue(1);
1424 $rmd_feedback->
addSubItem($rmd_submit_start);
1426 $rmd_submit_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_peer_freq");
1427 $rmd_submit_frequency->setSize(3);
1428 $rmd_submit_frequency->setMaxLength(3);
1429 $rmd_submit_frequency->setSuffix(
$lng->
txt(
'days'));
1430 $rmd_submit_frequency->setRequired(
true);
1431 $rmd_submit_frequency->setMinValue(1);
1432 $rmd_feedback->addSubItem($rmd_submit_frequency);
1436 $rmd_feedback->addSubItem($rmd_submit_end);
1440 $form->addItem($rmd_feedback);
1445 $form->addItem($cats);
1450 $cats->addOption($def);
1453 $def->addSubItem($peer_text);
1456 $peer_char->setInfo(
$lng->
txt(
"exc_peer_review_min_chars_info"));
1457 $peer_char->setSize(3);
1458 $peer_text->addSubItem($peer_char);
1461 $def->addSubItem($peer_rating);
1464 $peer_file->setInfo(
$lng->
txt(
"exc_peer_review_file_info"));
1465 $def->addSubItem($peer_file);
1470 if (
sizeof($cat_objs)) {
1471 foreach ($cat_objs as $cat_obj) {
1475 if (
sizeof($crits)) {
1477 foreach ($crits as $crit) {
1478 $titles[] = $crit->getTitle();
1480 $opt =
new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1481 $opt->
setInfo(implode(
", ", $titles));
1482 $cats->addOption($opt);
1487 $url = $ilCtrl->getLinkTargetByClass(
"ilexccriteriacataloguegui",
"");
1488 $def->setInfo(
'<a href="' .
$url .
'">[+] ' .
1489 $lng->
txt(
"exc_add_criteria_catalogue") .
1494 $form->addCommandButton(
"updatePeerReview",
$lng->
txt(
"save"));
1495 $form->addCommandButton(
"editAssignment",
$lng->
txt(
"cancel"));
1509 $ilTabs->activateTab(
"peer_settings");
1511 if ($a_form === null) {
1525 if ($this->assignment->getPeerReviewDeadline() > 0) {
1530 if ($reminder->getReminderStatus()) {
1531 $values[
"rmd_peer_status"] = $reminder->getReminderStatus();
1532 $values[
"rmd_peer_start"] = $reminder->getReminderStart();
1534 $values[
"rmd_peer_freq"] = $reminder->getReminderFrequency();
1535 $values[
"rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1545 $a_form->
getItemByPostVar(
"peer_min")->setValue($this->assignment->getPeerReviewMin());
1546 $a_form->
getItemByPostVar(
"peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1547 $a_form->
getItemByPostVar(
"peer_unlock")->setValue($this->assignment->getPeerReviewSimpleUnlock());
1549 if ($this->enable_peer_review_completion) {
1550 $a_form->
getItemByPostVar(
"peer_valid")->setValue($this->assignment->getPeerReviewValid());
1553 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1558 $a_form->
getItemByPostVar(
"peer_text")->setChecked($this->assignment->hasPeerReviewText());
1559 $a_form->
getItemByPostVar(
"peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1560 $a_form->
getItemByPostVar(
"peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1561 if ($this->assignment->getPeerReviewChars() > 0) {
1562 $a_form->
getItemByPostVar(
"peer_char")->setValue($this->assignment->getPeerReviewChars());
1570 bool $a_force_set_values =
false 1574 if ($peer_review->hasPeerReviewGroups()) {
1582 if ($this->enable_peer_review_completion) {
1594 $min->setValue($this->assignment->getPeerReviewMin());
1598 if ($a_force_set_values ||
1599 $peer_review->hasPeerReviewGroups()) {
1613 $protected_peer_review_groups =
false;
1615 if ($peer_review->hasPeerReviewGroups()) {
1616 $protected_peer_review_groups =
true;
1622 $time_deadline = $this->assignment->getDeadline();
1623 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1624 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1632 $reminder_date = $reminder_date
1637 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1639 ->setAlert(
$lng->
txt(
"exc_peer_deadline_mismatch"));
1643 if (!$protected_peer_review_groups) {
1644 if ($a_form->
getInput(
"crit_cat") < 0 &&
1646 !$a_form->
getInput(
"peer_rating") &&
1649 ->setAlert(
$lng->
txt(
"select_one"));
1656 $res[
"peer_dl"] = $time_peer;
1658 if ($protected_peer_review_groups) {
1659 $res[
"peer_min"] = $this->assignment->getPeerReviewMin();
1660 $res[
"peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1661 $res[
"peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1662 $res[
"peer_valid"] = $this->assignment->getPeerReviewValid();
1664 $res[
"peer_text"] = $this->assignment->hasPeerReviewText();
1665 $res[
"peer_rating"] = $this->assignment->hasPeerReviewRating();
1666 $res[
"peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1667 $res[
"peer_char"] = $this->assignment->getPeerReviewChars();
1668 $res[
"crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1670 $res[
"peer_valid"] = $this->enable_peer_review_completion
1671 ?
$res[
"peer_valid"]
1675 $res[
"peer_unlock"] = $a_form->
getInput(
"peer_unlock");
1680 $res[
"peer_rating"] = $a_form->
getInput(
"peer_rating");
1685 if ($a_form->
getInput(
"rmd_peer_status")) {
1686 $res[
"rmd_peer_status"] = $a_form->
getInput(
"rmd_peer_status");
1687 $res[
"rmd_peer_start"] = $a_form->
getInput(
"rmd_peer_start");
1688 $res[
"rmd_peer_end"] = $reminder_date;
1689 $res[
"rmd_peer_freq"] = $a_form->
getInput(
"rmd_peer_freq");
1690 $res[
"rmd_peer_template_id"] = $a_form->
getInput(
"rmd_peer_template_id");
1695 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"form_input_not_valid"));
1722 ? (
int) $a_input[
"crit_cat"]
1742 if (is_array($input)) {
1744 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1745 $ilCtrl->redirect($this,
"editPeerReview");
1748 $ilTabs->activateTab(
"peer_settings");
1750 $form->setValuesByPost();
1763 int $a_min_participants,
1764 int $a_max_participants
1767 $number_of_teams = $a_num_teams;
1769 if ($number_of_teams) {
1770 $members_per_team = round($total_members / $a_num_teams);
1772 if ($a_min_participants) {
1773 $number_of_teams = round($total_members / $a_min_participants);
1774 $participants_extra_team = $total_members % $a_min_participants;
1775 if ($participants_extra_team > $number_of_teams) {
1777 $message = sprintf($this->
lng->txt(
"exc_team_minimal_too_big"), $a_min_participants);
1778 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1781 $members_per_team = 0;
1784 if ($a_min_participants > $a_max_participants) {
1785 $message = $this->
lng->txt(
"exc_team_min_big_than_max");
1786 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1789 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1790 $message = sprintf($this->
lng->txt(
"exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1791 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1794 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1795 $message = sprintf($this->
lng->txt(
"exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1796 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1799 return array(
"status" =>
"success",
"msg" =>
"");
1808 return count($exc_members->getMembers());
1816 if ($ass_type->usesTeams() &&
1819 $number_teams = $a_input[
'number_teams'];
1822 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->
getId(), $number_teams, $a_input[
'min_participants_team']);
1826 $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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
static getInstance()
Get instance.
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)
deleteGlobalFeedbackFile()
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.
This class represents a text area property in a property form.
setDescription(string $a_descr)
Sets description below title in standard template.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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()