34 protected \ILIAS\Exercise\InternalDomainService
$domain;
38 protected \ILIAS\Exercise\InternalGUIService
$gui;
64 private \ILIAS\ResourceStorage\Services
$irss;
65 private \ILIAS\FileUpload\FileUpload
$upload;
69 bool $a_enable_peer_review_completion_settings,
75 $this->
user = $DIC->user();
76 $this->
ctrl = $DIC->ctrl();
77 $this->
tabs = $DIC->tabs();
78 $this->
lng = $DIC->language();
79 $this->tpl = $DIC[
"tpl"];
80 $this->
toolbar = $DIC->toolbar();
82 $this->
help = $DIC[
"ilHelp"];
83 $this->exercise_id = $a_exercise_id;
84 $this->assignment = $a_ass;
85 $this->gui = $DIC->exercise()
88 $this->enable_peer_review_completion = $a_enable_peer_review_completion_settings;
90 $this->type_guis = $this->gui->assignment()->types();
91 $request = $DIC->exercise()->internal()->gui()->request();
92 $this->exc = $request->getExercise();
93 $this->requested_ass_type = $request->getAssType();
94 $this->requested_type = $request->getType();
95 $this->random_manager = $DIC->exercise()->internal()->domain()->assignment()->randomAssignments(
96 $request->getExercise()
98 $this->domain = $DIC->exercise()->internal()->domain();
99 $this->requested_ass_ids = $request->getAssignmentIds();
100 $this->requested_order = $request->getOrder();
101 $this->irss = $DIC->resourceStorage();
102 $this->
access = $DIC->access();
103 $this->ref_id = $DIC->http()->wrapper()->query()->has(
'ref_id')
104 ? $DIC->http()->wrapper()->query()->retrieve(
106 $DIC->refinery()->kindlyTo()->int()
119 $class = $ilCtrl->getNextClass($this);
120 $cmd = $ilCtrl->getCmd(
"listAssignments");
123 case "ilpropertyformgui":
125 $ilCtrl->forwardCommand($form);
128 case strtolower(ilResourceCollectionGUI::class):
130 $ilTabs->activateTab(
"ass_files");
131 $irss = $this->domain->assignment()->instructionFiles($this->assignment->getId());
132 if ($irss->getCollectionIdString() ===
"") {
133 $this->tpl->setOnScreenMessage(
135 $this->
lng->txt(
"exc_instruction_migration_not_run")
138 $gui = $this->gui->assignment()->getInstructionFileResourceCollectionGUI(
140 $this->assignment->getId()
142 $this->
ctrl->forwardCommand($gui);
146 case "ilexpeerreviewgui":
147 $ilTabs->clearTargets();
148 $ilTabs->setBackTarget(
150 $ilCtrl->getLinkTarget($this,
"listAssignments")
154 $ilCtrl->forwardCommand($peer_gui);
158 $this->{$cmd .
"Object"}();
174 $ilToolbar->setFormAction($ilCtrl->getFormAction($this,
"addAssignment"));
179 $this->
lng->txt(
"exc_add_assignment"),
181 )->submit()->toToolbar(
true);
197 $this->assignment =
null;
199 if ($this->requested_type == 0) {
200 $ilCtrl->redirect($this,
"listAssignments");
215 foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
216 $types[$k] = $t->getTitle();
221 $ty->setRequired(
true);
230 string $a_mode =
"create" 235 $ass_type = $this->types->getById($a_type);
236 $ass_type_gui = $this->type_guis->getById($a_type);
241 if ($a_mode ==
"edit") {
242 $form->setTitle($lng->
txt(
"exc_edit_assignment"));
244 $form->setTitle($lng->
txt(
"exc_new_assignment"));
246 $form->setFormAction($ilCtrl->getFormAction($this));
250 $ti->setMaxLength(200);
251 $ti->setRequired(
true);
256 $ty->setValue($a_type);
257 $ty->setDisabled(
true);
264 $ass_type_gui->addEditFormCustomProperties($form);
270 if ($ass_type->usesTeams()) {
271 if ($a_mode ==
"edit") {
281 $lng->
txt(
"exc_team_by_participants"),
283 $lng->
txt(
"exc_team_by_participants_info")
287 $lng->
txt(
"exc_team_by_tutors"),
289 $lng->
txt(
"exc_team_by_tutors_info")
297 $rd_creation_method->setValue(
"0");
301 $lng->
txt(
"exc_team_by_tutors_manual"),
303 $lng->
txt(
"exc_team_by_tutors_manual_info")
305 $rd_creation_method->addOption($rd_creation_manual);
310 $add_info =
" <strong>" . $lng->
txt(
"exc_team_by_random_add_info") .
"</strong>";
313 $lng->
txt(
"exc_team_by_random"),
317 $rd_creation_method->addOption($rd_creation_random);
321 $number_teams->setMinValue(1);
323 $number_teams->setRequired(
true);
324 $number_teams->setSuffix($lng->
txt(
"exc_team_assignment_adopt_teams"));
325 $rd_creation_random->addSubItem($number_teams);
327 $min_team_participants =
new ilNumberInputGUI($lng->
txt(
"exc_min_team_participants"),
"min_participants_team");
328 $min_team_participants->
setSize(3);
329 $min_team_participants->setMinValue(1);
331 $min_team_participants->setRequired(
true);
332 $min_team_participants->setSuffix($lng->
txt(
"exc_participants"));
333 $rd_creation_random->addSubItem($min_team_participants);
335 $max_team_participants =
new ilNumberInputGUI($lng->
txt(
"exc_max_team_participants"),
"max_participants_team");
336 $max_team_participants->
setSize(3);
337 $max_team_participants->setMinValue(1);
339 $max_team_participants->setRequired(
true);
340 $max_team_participants->setSuffix($lng->
txt(
"exc_participants"));
341 $rd_creation_random->addSubItem($max_team_participants);
344 if (count($options)) {
346 $lng->
txt(
"exc_team_by_assignment"),
348 $lng->
txt(
"exc_team_by_assignment_info")
352 $radio_assignment_adopt->setRequired(
true);
353 $radio_assignment_adopt->addOption(
new ilRadioOption($lng->
txt(
"exc_team_assignment_adopt_none"), -1));
355 foreach ($options as
$id => $item) {
357 $option->setInfo($lng->
txt(
"exc_team_assignment_adopt_teams") .
": " . $item[
"teams"]);
358 $radio_assignment_adopt->addOption($option);
360 $radio_assignment->
addSubItem($radio_assignment_adopt);
361 $rd_creation_method->addOption($radio_assignment);
364 $radio_tutors->
addSubItem($rd_creation_method);
366 $rd_team->addOption($radio_participants);
367 $rd_team->addOption($radio_tutors);
371 $form->addItem($rd_team);
374 $rd_team->setDisabled(
true);
379 if (!$this->random_manager->isActivated()) {
381 $cb->setInfo($lng->
txt(
"exc_mandatory_info"));
382 $cb->setChecked(
true);
387 $ne->setValue($lng->
txt(
"exc_mandatory_rand_determined"));
393 $sub_header->setTitle($lng->
txt(
"exc_work_instructions"));
394 $form->addItem($sub_header);
399 $desc_input->setUseRte(
true);
400 $desc_input->setRteTagSet(
"mini");
402 $form->addItem($desc_input);
405 if ($a_mode ==
"create") {
408 $form->addItem($files);
413 $sub_header->setTitle($lng->
txt(
"exc_schedule"));
414 $form->addItem($sub_header);
419 $form->addItem($start_date);
424 $op0 =
new ilRadioOption($lng->
txt(
"exc_no_deadline"), -1, $lng->
txt(
"exc_no_deadline_info"));
425 $radg->addOption($op0);
426 $op1 =
new ilRadioOption($lng->
txt(
"exc_fixed_date"), 0, $lng->
txt(
"exc_fixed_date_info"));
427 $radg->addOption($op1);
428 if (!$ass_type->usesTeams()) {
429 $op3 =
new ilRadioOption($lng->
txt(
"exc_fixed_date_individual"), 2, $lng->
txt(
"exc_fixed_date_individual_info"));
430 $radg->addOption($op3);
432 $op2 =
new ilRadioOption($lng->
txt(
"exc_relative_date"), 1, $lng->
txt(
"exc_relative_date_info"));
433 $radg->addOption($op2);
434 $form->addItem($radg);
439 $deadline->setShowTime(
true);
440 $op1->addSubItem($deadline);
444 $deadline2->
setInfo($lng->
txt(
"exc_deadline_extended_info"));
445 $deadline2->setShowTime(
true);
446 $op1->addSubItem($deadline2);
450 $rmd_submit =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_submit_setting"),
"rmd_submit_status");
452 $rmd_submit_start =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_start"),
"rmd_submit_start");
453 $rmd_submit_start->setSize(3);
454 $rmd_submit_start->setMaxLength(3);
455 $rmd_submit_start->setSuffix($lng->
txt(
'days'));
456 $rmd_submit_start->
setInfo($this->
lng->txt(
"exc_reminder_start_info"));
458 $rmd_submit_start->setMinValue(1);
461 $rmd_submit_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_submit_freq");
462 $rmd_submit_frequency->
setSize(3);
463 $rmd_submit_frequency->setMaxLength(3);
464 $rmd_submit_frequency->setSuffix($lng->
txt(
'days'));
465 $rmd_submit_frequency->setRequired(
true);
466 $rmd_submit_frequency->setMinValue(1);
467 $rmd_submit->addSubItem($rmd_submit_frequency);
471 $rmd_submit->addSubItem($rmd_submit_end);
476 $rmd_grade =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_grade_setting"),
"rmd_grade_status");
478 $rmd_grade_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_grade_freq");
479 $rmd_grade_frequency->setSize(3);
480 $rmd_grade_frequency->setMaxLength(3);
481 $rmd_grade_frequency->setSuffix($lng->
txt(
'days'));
483 $rmd_grade_frequency->setMinValue(1);
488 $rmd_grade->addSubItem($rmd_grade_end);
492 $form->addItem($rmd_submit);
493 $form->addItem($rmd_grade);
498 $ti->setMaxLength(3);
501 $ti->setRequired(
true);
502 $op2->addSubItem($ti);
505 $last_submission =
new ilDateTimeInputGUI($lng->
txt(
"exc_rel_last_submission"),
"rel_deadline_last_subm");
506 $last_submission->
setInfo($lng->
txt(
"exc_rel_last_submission_info"));
507 $last_submission->setShowTime(
true);
508 $op2->addSubItem($last_submission);
513 if ($ass_type->usesFileUpload()) {
515 $sub_header->setTitle($ass_type->getTitle());
516 $form->addItem($sub_header);
518 $form->addItem($max_file_tgl);
521 $max_file->
setInfo($lng->
txt(
"exc_max_file_info"));
522 $max_file->setRequired(
true);
523 $max_file->setSize(3);
524 $max_file->setMinValue(1);
525 $max_file_tgl->addSubItem($max_file);
530 $sub_header->setTitle($lng->
txt(
"exc_after_submission"));
531 $form->addItem($sub_header);
533 if (!$ass_type->usesTeams() && !$this->random_manager->isActivated()) {
536 $peer->setInfo($lng->
txt(
"exc_peer_review_ass_setting_info"));
537 $form->addItem($peer);
549 $fb->addSubItem($fb_file);
560 $fb_date_custom_date->setShowTime(
true);
562 $fb_date_custom_option->
addSubItem($fb_date_custom_date);
563 $fb_date->addOption($fb_date_custom_option);
566 $fb->addSubItem($fb_date);
569 $fb_cron->setInfo($lng->
txt(
"exc_global_feedback_file_cron_info"));
570 $fb->addSubItem($fb_cron);
573 if ($a_mode ==
"create") {
574 $form->addCommandButton(
"saveAssignment", $lng->
txt(
"save"));
576 $form->addCommandButton(
"updateAssignment", $lng->
txt(
"save"));
578 $form->addCommandButton(
"listAssignments", $lng->
txt(
"cancel"));
587 $post_var =
"rmd_" . $a_reminder_type .
"_template_id";
591 $r_group->addOption(
new ilRadioOption($this->
lng->txt(
"exc_reminder_mail_no_tpl"), 0));
592 $r_group->setValue(0);
594 switch ($a_reminder_type) {
608 $templateService = $DIC->mail()->textTemplates();
609 foreach ($templateService->loadTemplatesForContextId(
$context->getId()) as $template) {
610 $r_group->addOption(
new ilRadioOption($template->getTitle(), $template->getTplId()));
611 if ($template->isDefault()) {
612 $r_group->setValue($template->getTplId());
629 $protected_peer_review_groups =
false;
631 if ($this->assignment) {
632 if ($this->assignment->getPeerReview()) {
634 if ($peer_review->hasPeerReviewGroups()) {
635 $protected_peer_review_groups =
true;
639 if ($this->assignment->getFeedbackFile()) {
645 if ($protected_peer_review_groups) {
653 $ass_type = $this->types->getById($type);
658 $time_start = $time_start
662 $time_fb_custom_date = $a_form->
getItemByPostVar(
"fb_date_custom")->getDate();
663 $time_fb_custom_date = $time_fb_custom_date
667 $reminder_submit_end_date = $a_form->
getItemByPostVar(
"rmd_submit_end")->getDate();
668 $reminder_submit_end_date = $reminder_submit_end_date
672 $reminder_grade_end_date = $a_form->
getItemByPostVar(
"rmd_grade_end")->getDate();
673 $reminder_grade_end_date = $reminder_grade_end_date
677 $time_deadline =
null;
678 $time_deadline_ext =
null;
680 $deadline_mode = (
int) $a_form->
getInput(
"deadline_mode");
681 if ($deadline_mode === -1) {
687 $time_deadline = $time_deadline
691 $time_deadline_ext = $time_deadline_ext
698 if ($protected_peer_review_groups) {
699 $time_deadline = $this->assignment->getDeadline();
700 $time_deadline_ext = $this->assignment->getExtendedDeadline();
704 if (!$time_deadline) {
706 if (!$protected_peer_review_groups &&
709 ->setAlert($lng->
txt(
"exc_needs_fixed_deadline"));
716 ->setAlert($lng->
txt(
"exc_needs_deadline"));
722 $time_deadline_max = max($time_deadline, $time_deadline_ext);
723 $peer_dl = $this->assignment
724 ? $this->assignment->getPeerReviewDeadline()
726 if ($peer_dl && $peer_dl < $time_deadline_max) {
730 ->setAlert($lng->
txt(
"exc_peer_deadline_mismatch"));
735 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
737 ->setAlert($lng->
txt(
"exc_deadline_ext_mismatch"));
741 $time_deadline_min = $time_deadline_ext
742 ? min($time_deadline, $time_deadline_ext)
746 if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
748 ->setAlert($lng->
txt(
"exc_start_date_should_be_before_end_date"));
753 if ($ass_type->usesTeams()) {
758 $a_form->
getInput(
"min_participants_team"),
759 $a_form->
getInput(
"max_participants_team")
761 if ($team_validation[
'status'] ==
'error') {
763 ->setAlert($team_validation[
'msg']);
765 ->setAlert($lng->
txt(
"exc_value_can_not_set"));
774 ,
"title" => trim($a_form->
getInput(
"title"))
775 ,
"instruction" => trim($a_form->
getInput(
"instruction"))
777 ,
"start" => $time_start
778 ,
"deadline" => $time_deadline
779 ,
"deadline_ext" => $time_deadline_ext
780 ,
"max_file" => $a_form->
getInput(
"max_file_tgl")
784 if (!$this->random_manager->isActivated()) {
788 $res[
'team_creator'] = $a_form->
getInput(
"team_creator");
789 $res[
"team_creation"] = $a_form->
getInput(
"team_creation");
792 $res[
"number_teams"] = $a_form->
getInput(
"number_teams");
793 $res[
"min_participants_team"] = $a_form->
getInput(
"min_participants_team");
794 $res[
"max_participants_team"] = $a_form->
getInput(
"max_participants_team");
800 $res[
"deadline_mode"] = $deadline_mode;
803 $res[
"relative_deadline"] = $a_form->
getInput(
"relative_deadline");
804 $rel_deadline_last_subm = $a_form->
getItemByPostVar(
"rel_deadline_last_subm")->getDate();
805 $rel_deadline_last_subm = $rel_deadline_last_subm
808 $res[
"rel_deadline_last_subm"] = $rel_deadline_last_subm;
813 $protected_peer_review_groups) {
818 if (isset($_FILES[
"files"])) {
820 $res[
"files"] = $_FILES[
"files"];
828 $res[
"fb_date_custom"] = $time_fb_custom_date;
830 if ($_FILES[
"fb_file"][
"tmp_name"]) {
831 $res[
"fb_file"] = $_FILES[
"fb_file"];
834 if ($a_form->
getInput(
"rmd_submit_status")) {
835 $res[
"rmd_submit_status"] =
true;
836 $res[
"rmd_submit_start"] = $a_form->
getInput(
"rmd_submit_start");
837 $res[
"rmd_submit_freq"] = $a_form->
getInput(
"rmd_submit_freq");
838 $res[
"rmd_submit_end"] = $reminder_submit_end_date;
839 $res[
"rmd_submit_template_id"] = $a_form->
getInput(
"rmd_submit_template_id");
841 if ($a_form->
getInput(
"rmd_grade_status")) {
842 $res[
"rmd_grade_status"] =
true;
843 $res[
"rmd_grade_freq"] = $a_form->
getInput(
"rmd_grade_freq");
844 $res[
"rmd_grade_end"] = $reminder_grade_end_date;
845 $res[
"rmd_grade_template_id"] = $a_form->
getInput(
"rmd_grade_template_id");
850 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
"form_input_not_valid"));
866 $is_create = !(bool) $a_ass->
getId();
868 $a_ass->
setTitle($a_input[
"title"]);
870 if (!$this->random_manager->isActivated()) {
882 $a_ass->
setTeamTutor((
bool) ($a_input[
"team_creator"] ??
false));
889 if (!$this->random_manager->isActivated()) {
904 if (isset($a_input[
"fb"])) {
915 if (is_array($a_input[
"files"])) {
916 $this->domain->assignment()->instructionFiles($a_ass->
getId())->importFromLegacyUpload($a_input[
"files"]);
920 if (!isset($a_input[
"fb"])) {
928 if (isset($a_input[
"fb"], $a_input[
"fb_file"])) {
965 $reminder->
setReminderStatus((
bool) ($a_input[
"rmd_" . $type .
"_status"] ??
false));
966 $reminder->
setReminderStart((
int) ($a_input[
"rmd_" . $type .
"_start"] ?? 0));
967 $reminder->
setReminderEnd((
int) ($a_input[
"rmd_" . $type .
"_end"] ?? 0));
970 $reminder->{$action}();
985 $this->assignment =
null;
989 if (is_array($input)) {
991 $ass->setExerciseId($this->exercise_id);
992 $ass->setType($input[
"type"]);
993 $ass_type_gui = $this->type_guis->getById($ass->getType());
998 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1000 $ass_type_gui->importFormToAssignment($ass, $form);
1003 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1006 $ilCtrl->setParameter($this,
"ass_id", $ass->getId());
1007 $ilCtrl->redirect($this,
"editAssignment");
1009 $form->setValuesByPost();
1024 $ilTabs->activateTab(
"ass_settings");
1039 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1042 $values[
"type"] = $this->assignment->getType();
1043 $values[
"title"] = $this->assignment->getTitle();
1044 $values[
"mandatory"] = $this->assignment->getMandatory();
1045 $values[
"instruction"] = $this->assignment->getInstruction();
1046 if ($this->assignment->getStartTime()) {
1050 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1051 if ($this->assignment->getMaxFile()) {
1052 $values[
"max_file_tgl"] =
true;
1053 $values[
"max_file"] = $this->assignment->getMaxFile();
1057 if ($this->assignment->getAssignmentType()->usesTeams()) {
1058 $values[
"team_creator"] = (string) (
int) $this->assignment->getTeamTutor();
1059 $values[
"team_creation"] =
"0";
1062 if ($this->assignment->getFeedbackDateCustom()) {
1063 $values[
"fb_date_custom"] =
new ilDateTime($this->assignment->getFeedbackDateCustom(),
IL_CAL_UNIX);
1068 if ($rmd_sub->getReminderStatus()) {
1069 $values[
"rmd_submit_status"] = $rmd_sub->getReminderStatus();
1070 $values[
"rmd_submit_start"] = $rmd_sub->getReminderStart();
1072 $values[
"rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1073 $values[
"rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1077 if ($rmd_grade->getReminderStatus()) {
1080 $values[
"rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1081 $values[
"rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1084 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1085 $values = array_merge($values, $type_values);
1088 $values[
"deadline_mode"] = $this->assignment->getDeadlineMode();
1089 if ($values[
"deadline_mode"] === 0 && !$this->assignment->getDeadline()) {
1090 $values[
"deadline_mode"] = -1;
1092 $values[
"relative_deadline"] = $this->assignment->getRelativeDeadline();
1100 if ($this->assignment->getFeedbackFile()) {
1101 $sample_solution = $this->domain->assignment()->sampleSolution($this->assignment->getId());
1104 $a_form->
getItemByPostVar(
"fb_file")->setValue($sample_solution->getFilename());
1108 '<a href="' . $ilCtrl->getLinkTarget($this,
"downloadGlobalFeedbackFile") .
'">' .
1109 $lng->
txt(
"download") .
'</a>' 1112 $a_form->
getItemByPostVar(
"fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1113 $a_form->
getItemByPostVar(
"fb_date")->setValue($this->assignment->getFeedbackDate());
1124 if ($this->assignment->getDeadline() > 0) {
1127 $ed_item->
setDate($edit_date);
1129 if ($this->assignment->getExtendedDeadline() > 0) {
1132 $ed_item->
setDate($edit_date);
1136 if ($this->assignment->getPeerReview()) {
1137 $a_form->
getItemByPostVar(
"peer")->setChecked($this->assignment->getPeerReview());
1146 bool $a_force_set_values =
false 1153 $peer_review =
null;
1154 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1155 $this->assignment->getPeerReview()) {
1158 if ($peer_review->hasPeerReviewGroups()) {
1169 if ($a_force_set_values ||
1170 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1190 $ass_type = $this->assignment->getType();
1191 $ass_type_gui = $this->type_guis->getById($ass_type);
1193 if (is_array($input)) {
1194 $old_deadline = $this->assignment->getDeadline();
1195 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1200 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1201 $this->assignment->update();
1203 $new_deadline = $this->assignment->getDeadline();
1204 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1207 if ($old_deadline != $new_deadline ||
1208 $old_ext_deadline != $new_ext_deadline) {
1209 $subm = $this->domain->submission($this->assignment->getId());
1210 $subm->recalculateLateSubmissions();
1213 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1214 $ilCtrl->redirect($this,
"editAssignment");
1217 $ilTabs->activateTab(
"ass_settings");
1219 $form->setValuesByPost();
1231 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class,
"ass_id",
null);
1232 if (count($this->requested_ass_ids) == 0) {
1233 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
1234 $ilCtrl->redirect($this,
"listAssignments");
1237 $cgui->setFormAction($ilCtrl->getFormAction($this));
1238 $cgui->setHeaderText(
$lng->
txt(
"exc_conf_del_assignments"));
1239 $cgui->setCancel(
$lng->
txt(
"cancel"),
"listAssignments");
1240 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteAssignments");
1242 foreach ($this->requested_ass_ids as $i) {
1259 foreach ($this->requested_ass_ids as
$id) {
1261 $ass->delete($this->exc);
1266 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_assignments_deleted"),
true);
1268 $ilCtrl->setParameter($this,
"ass_id",
"");
1269 $ilCtrl->redirect($this,
"listAssignments");
1279 $this->requested_order
1282 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_saved_order"),
true);
1283 $ilCtrl->redirect($this,
"listAssignments");
1293 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"exc_saved_order"),
true);
1294 $ilCtrl->redirect($this,
"listAssignments");
1308 $ilTabs->clearTargets();
1309 $ilHelp->setScreenIdComponent(
"exc");
1311 $ilTabs->setBackTarget(
1313 $ilCtrl->getLinkTarget($this,
"listAssignments")
1319 $ilCtrl->getLinkTarget($this,
"editAssignment")
1322 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1323 $this->assignment->getPeerReview()) {
1327 $ilCtrl->getLinkTarget($this,
"editPeerReview")
1330 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class,
"mode",
null);
1333 $lng->
txt(
"exc_instruction_files"),
1334 $ilCtrl->getLinkTargetByClass(array(
"ilexassignmenteditorgui", ilResourceCollectionGUI::class))
1342 if (!$this->assignment ||
1343 !$this->assignment->getFeedbackFile()) {
1344 $ilCtrl->
redirect($this,
"returnToParent");
1346 $this->domain->assignment()->sampleSolution($this->assignment->getId())->deliver();
1360 $form->setTitle(
$lng->
txt(
"exc_peer_review"));
1361 $form->setFormAction($ilCtrl->getFormAction($this));
1364 $peer_min->
setInfo(
$lng->
txt(
"exc_peer_review_min_number_info"));
1365 $peer_min->setRequired(
true);
1366 $peer_min->setSize(3);
1367 $peer_min->setValue(2);
1368 $form->addItem($peer_min);
1372 $peer_unlock->addOption(
new ilRadioOption(
$lng->
txt(
"exc_peer_review_simple_unlock_active"), 1));
1373 $peer_unlock->addOption(
new ilRadioOption(
$lng->
txt(
"exc_peer_review_simple_unlock_inactive"), 0));
1374 $peer_unlock->setRequired(
true);
1375 $peer_unlock->setValue(0);
1376 $form->addItem($peer_unlock);
1378 if ($this->enable_peer_review_completion) {
1381 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_none_info"));
1382 $peer_cmpl->addOption($option);
1384 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_one_info"));
1385 $peer_cmpl->addOption($option);
1387 $option->
setInfo(
$lng->
txt(
"exc_peer_review_completion_all_info"));
1388 $peer_cmpl->addOption($option);
1389 $peer_cmpl->setRequired(
true);
1391 $form->addItem($peer_cmpl);
1396 $peer_dl->setShowTime(
true);
1397 $form->addItem($peer_dl);
1400 $peer_prsl->setInfo(
$lng->
txt(
"exc_peer_review_personal_info"));
1401 $form->addItem($peer_prsl);
1404 $rmd_feedback =
new ilCheckboxInputGUI($this->
lng->txt(
"exc_reminder_feedback_setting"),
"rmd_peer_status");
1406 $rmd_submit_start =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_feedback_start"),
"rmd_peer_start");
1407 $rmd_submit_start->setSize(3);
1408 $rmd_submit_start->setMaxLength(3);
1409 $rmd_submit_start->setSuffix(
$lng->
txt(
'days'));
1411 $rmd_submit_start->setMinValue(1);
1412 $rmd_feedback->
addSubItem($rmd_submit_start);
1414 $rmd_submit_frequency =
new ilNumberInputGUI($this->
lng->txt(
"exc_reminder_frequency"),
"rmd_peer_freq");
1415 $rmd_submit_frequency->
setSize(3);
1416 $rmd_submit_frequency->setMaxLength(3);
1417 $rmd_submit_frequency->setSuffix(
$lng->
txt(
'days'));
1418 $rmd_submit_frequency->setRequired(
true);
1419 $rmd_submit_frequency->setMinValue(1);
1420 $rmd_feedback->addSubItem($rmd_submit_frequency);
1424 $rmd_feedback->addSubItem($rmd_submit_end);
1428 $form->addItem($rmd_feedback);
1433 $form->addItem($cats);
1438 $cats->addOption($def);
1441 $def->addSubItem($peer_text);
1444 $peer_char->
setInfo(
$lng->
txt(
"exc_peer_review_min_chars_info"));
1445 $peer_char->setSize(3);
1446 $peer_text->addSubItem($peer_char);
1449 $def->addSubItem($peer_rating);
1452 $peer_file->setInfo(
$lng->
txt(
"exc_peer_review_file_info"));
1453 $def->addSubItem($peer_file);
1458 if (
sizeof($cat_objs)) {
1459 foreach ($cat_objs as $cat_obj) {
1463 if (
sizeof($crits)) {
1465 foreach ($crits as $crit) {
1466 $titles[] = $crit->getTitle();
1468 $opt =
new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1469 $opt->
setInfo(implode(
", ", $titles));
1470 $cats->addOption($opt);
1475 $url = $ilCtrl->getLinkTargetByClass(
"ilexccriteriacataloguegui",
"");
1476 $def->setInfo(
'<a href="' .
$url .
'">[+] ' .
1477 $lng->
txt(
"exc_add_criteria_catalogue") .
1482 $form->addCommandButton(
"updatePeerReview",
$lng->
txt(
"save"));
1483 $form->addCommandButton(
"editAssignment",
$lng->
txt(
"cancel"));
1497 $ilTabs->activateTab(
"peer_settings");
1499 if ($a_form ===
null) {
1513 if ($this->assignment->getPeerReviewDeadline() > 0) {
1518 if ($reminder->getReminderStatus()) {
1519 $values[
"rmd_peer_status"] = $reminder->getReminderStatus();
1520 $values[
"rmd_peer_start"] = $reminder->getReminderStart();
1522 $values[
"rmd_peer_freq"] = $reminder->getReminderFrequency();
1523 $values[
"rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1533 $a_form->
getItemByPostVar(
"peer_min")->setValue($this->assignment->getPeerReviewMin());
1534 $a_form->
getItemByPostVar(
"peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1535 $a_form->
getItemByPostVar(
"peer_unlock")->setValue($this->assignment->getPeerReviewSimpleUnlock());
1537 if ($this->enable_peer_review_completion) {
1538 $a_form->
getItemByPostVar(
"peer_valid")->setValue($this->assignment->getPeerReviewValid());
1541 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1546 $a_form->
getItemByPostVar(
"peer_text")->setChecked($this->assignment->hasPeerReviewText());
1547 $a_form->
getItemByPostVar(
"peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1548 $a_form->
getItemByPostVar(
"peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1549 if ($this->assignment->getPeerReviewChars() > 0) {
1550 $a_form->
getItemByPostVar(
"peer_char")->setValue($this->assignment->getPeerReviewChars());
1558 bool $a_force_set_values =
false 1562 if ($peer_review->hasPeerReviewGroups()) {
1570 if ($this->enable_peer_review_completion) {
1582 $min->setValue($this->assignment->getPeerReviewMin());
1586 if ($a_force_set_values ||
1587 $peer_review->hasPeerReviewGroups()) {
1601 $protected_peer_review_groups =
false;
1603 if ($peer_review->hasPeerReviewGroups()) {
1604 $protected_peer_review_groups =
true;
1610 $time_deadline = $this->assignment->getDeadline();
1611 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1612 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1620 $reminder_date = $reminder_date
1625 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1627 ->setAlert(
$lng->
txt(
"exc_peer_deadline_mismatch"));
1631 if (!$protected_peer_review_groups) {
1632 if ($a_form->
getInput(
"crit_cat") < 0 &&
1634 !$a_form->
getInput(
"peer_rating") &&
1637 ->setAlert(
$lng->
txt(
"select_one"));
1644 $res[
"peer_dl"] = $time_peer;
1646 if ($protected_peer_review_groups) {
1647 $res[
"peer_min"] = $this->assignment->getPeerReviewMin();
1648 $res[
"peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1649 $res[
"peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1650 $res[
"peer_valid"] = $this->assignment->getPeerReviewValid();
1652 $res[
"peer_text"] = $this->assignment->hasPeerReviewText();
1653 $res[
"peer_rating"] = $this->assignment->hasPeerReviewRating();
1654 $res[
"peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1655 $res[
"peer_char"] = $this->assignment->getPeerReviewChars();
1656 $res[
"crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1658 $res[
"peer_valid"] = $this->enable_peer_review_completion
1659 ?
$res[
"peer_valid"]
1663 $res[
"peer_unlock"] = $a_form->
getInput(
"peer_unlock");
1668 $res[
"peer_rating"] = $a_form->
getInput(
"peer_rating");
1673 if ($a_form->
getInput(
"rmd_peer_status")) {
1674 $res[
"rmd_peer_status"] = $a_form->
getInput(
"rmd_peer_status");
1675 $res[
"rmd_peer_start"] = $a_form->
getInput(
"rmd_peer_start");
1676 $res[
"rmd_peer_end"] = $reminder_date;
1677 $res[
"rmd_peer_freq"] = $a_form->
getInput(
"rmd_peer_freq");
1678 $res[
"rmd_peer_template_id"] = $a_form->
getInput(
"rmd_peer_template_id");
1683 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"form_input_not_valid"));
1710 ? (
int) $a_input[
"crit_cat"]
1730 if (is_array($input)) {
1732 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1733 $ilCtrl->redirect($this,
"editPeerReview");
1736 $ilTabs->activateTab(
"peer_settings");
1738 $form->setValuesByPost();
1751 int $a_min_participants,
1752 int $a_max_participants
1755 $number_of_teams = $a_num_teams;
1757 if ($number_of_teams) {
1758 $members_per_team = round($total_members / $a_num_teams);
1760 if ($a_min_participants) {
1761 $number_of_teams = round($total_members / $a_min_participants);
1762 $participants_extra_team = $total_members % $a_min_participants;
1763 if ($participants_extra_team > $number_of_teams) {
1765 $message = sprintf($this->
lng->txt(
"exc_team_minimal_too_big"), $a_min_participants);
1766 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1769 $members_per_team = 0;
1772 if ($a_min_participants > $a_max_participants) {
1773 $message = $this->
lng->txt(
"exc_team_min_big_than_max");
1774 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1777 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1778 $message = sprintf($this->
lng->txt(
"exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1779 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1782 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1783 $message = sprintf($this->
lng->txt(
"exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1784 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1787 return array(
"status" =>
"success",
"msg" =>
"");
1796 return count($exc_members->getMembers());
1804 if ($ass_type->usesTeams() &&
1807 $number_teams = $a_input[
'number_teams'];
1810 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->
getId(), $number_teams, $a_input[
'min_participants_team']);
1814 $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)
static getAdoptableTeamAssignments(int $a_exercise_id, ?int $a_exclude_ass_id=null, ?int $a_user_id=null)
getExerciseTotalMembers()
Class ilExAssignmentEditorGUI.
This class represents an option in a radio group.
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...
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...
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
editPeerReviewObject(?ilPropertyFormGUI $a_form=null)
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
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)
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)
static adoptTeams(int $a_source_ass_id, int $a_target_ass_id, ?int $a_user_id=null, ?int $a_exc_ref_id=null)
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()