5 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
6 include_once(
"./Modules/Exercise/classes/class.ilExAssignmentReminder.php");
86 $this->ctrl = $DIC->ctrl();
87 $this->tabs = $DIC->tabs();
88 $this->lng = $DIC->language();
89 $this->tpl = $DIC[
"tpl"];
90 $this->toolbar = $DIC->toolbar();
92 $this->help = $DIC[
"ilHelp"];
93 $this->exercise_id = $a_exercise_id;
94 $this->assignment = $a_ass;
95 $this->enable_peer_review_completion = (bool) $a_enable_peer_review_completion_settings;
96 include_once(
"./Modules/Exercise/AssignmentTypes/classes/class.ilExAssignmentTypes.php");
98 include_once(
"./Modules/Exercise/AssignmentTypes/GUI/classes/class.ilExAssignmentTypesGUI.php");
108 $class =
$ilCtrl->getNextClass($this);
109 $cmd =
$ilCtrl->getCmd(
"listAssignments");
112 case "ilpropertyformgui":
118 case "ilexassignmentfilesystemgui":
120 $ilTabs->activateTab(
"ass_files");
122 include_once(
"./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
126 include_once(
"./Modules/Exercise/classes/class.ilExAssignmentFileSystemGUI.php");
129 $fs_gui->setTableId(
"excassfil" . $this->assignment->getId());
130 $fs_gui->setAllowDirectories(
false);
131 $ilCtrl->forwardCommand($fs_gui);
134 case "ilexpeerreviewgui":
135 $ilTabs->clearTargets();
136 $ilTabs->setBackTarget(
138 $ilCtrl->getLinkTarget($this,
"listAssignments")
141 include_once(
"./Modules/Exercise/classes/class.ilExPeerReviewGUI.php");
143 $ilCtrl->forwardCommand($peer_gui);
147 $this->{$cmd .
"Object"}();
162 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this,
"addAssignment"));
164 include_once
"Services/Form/classes/class.ilSelectInputGUI.php";
167 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
169 $button->setCaption(
"exc_add_assignment");
170 $button->setCommand(
"addAssignment");
171 $ilToolbar->addStickyItem($button);
174 include_once(
"./Modules/Exercise/classes/class.ilAssignmentsTableGUI.php");
176 $tpl->setContent(
$t->getHTML());
188 $this->assignment = null;
190 if (!(
int)
$_POST[
"type"]) {
191 $ilCtrl->redirect($this,
"listAssignments");
208 foreach ($this->types->getAllActivated() as $k =>
$t) {
214 $ty->setRequired(
true);
229 $ass_type = $this->types->getById(
$a_type);
230 $ass_type_gui = $this->type_guis->getById(
$a_type);
233 $lng->loadLanguageModule(
"form");
234 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
236 if ($a_mode ==
"edit") {
237 $form->setTitle(
$lng->txt(
"exc_edit_assignment"));
239 $form->setTitle(
$lng->txt(
"exc_new_assignment"));
246 $ti->setRequired(
true);
252 $ty->setDisabled(
true);
259 $ass_type_gui->addEditFormCustomProperties(
$form);
265 if ($ass_type->usesTeams()) {
266 if ($a_mode ==
"edit") {
276 $lng->txt(
"exc_team_by_participants"),
278 $lng->txt(
"exc_team_by_participants_info")
282 $lng->txt(
"exc_team_by_tutors"),
284 $lng->txt(
"exc_team_by_tutors_info")
295 $lng->txt(
"exc_team_by_tutors_manual"),
297 $lng->txt(
"exc_team_by_tutors_manual_info")
299 $rd_creation_method->addOption($rd_creation_manual);
304 $add_info =
" <strong>" .
$lng->txt(
"exc_team_by_random_add_info") .
"</strong>";
307 $lng->txt(
"exc_team_by_random"),
311 $rd_creation_method->addOption($rd_creation_random);
315 $number_teams->setMinValue(1);
317 $number_teams->setRequired(
true);
318 $number_teams->setSuffix(
$lng->txt(
"exc_team_assignment_adopt_teams"));
319 $rd_creation_random->addSubItem($number_teams);
321 $min_team_participants =
new ilNumberInputGUI(
$lng->txt(
"exc_min_team_participants"),
"min_participants_team");
322 $min_team_participants->
setSize(3);
323 $min_team_participants->setMinValue(1);
325 $min_team_participants->setRequired(
true);
326 $min_team_participants->setSuffix(
$lng->txt(
"exc_participants"));
327 $rd_creation_random->addSubItem($min_team_participants);
329 $max_team_participants =
new ilNumberInputGUI(
$lng->txt(
"exc_max_team_participants"),
"max_participants_team");
330 $max_team_participants->
setSize(3);
331 $max_team_participants->setMinValue(1);
333 $max_team_participants->setRequired(
true);
334 $max_team_participants->setSuffix(
$lng->txt(
"exc_participants"));
335 $rd_creation_random->addSubItem($max_team_participants);
340 $lng->txt(
"exc_team_by_assignment"),
342 $lng->txt(
"exc_team_by_assignment_info")
346 $radio_assignment_adopt->setRequired(
true);
347 $radio_assignment_adopt->addOption(
new ilRadioOption(
$lng->txt(
"exc_team_assignment_adopt_none"), -1));
351 $option->setInfo(
$lng->txt(
"exc_team_assignment_adopt_teams") .
": " . $item[
"teams"]);
352 $radio_assignment_adopt->addOption($option);
354 $radio_assignment->
addSubItem($radio_assignment_adopt);
355 $rd_creation_method->addOption($radio_assignment);
358 $radio_tutors->
addSubItem($rd_creation_method);
360 $rd_team->addOption($radio_participants);
361 $rd_team->addOption($radio_tutors);
365 $form->addItem($rd_team);
368 $rd_team->setDisabled(
true);
375 $cb->setChecked(
true);
380 $sub_header->setTitle(
$lng->txt(
"exc_work_instructions"),
"work_instructions");
381 $form->addItem($sub_header);
385 $desc_input->setUseRte(
true);
386 $desc_input->setRteTagSet(
"mini");
387 $form->addItem($desc_input);
390 if ($a_mode ==
"create") {
392 $files->setFilenames(array(0 =>
''));
398 $sub_header->setTitle(
$lng->txt(
"exc_schedule"),
"schedule");
399 $form->addItem($sub_header);
404 $form->addItem($start_date);
410 $radg->addOption($op1);
412 $radg->addOption($op2);
413 $form->addItem($radg);
418 $op1->addSubItem($deadline);
422 $deadline2->
setInfo(
$lng->txt(
"exc_deadline_extended_info"));
423 $deadline2->setShowTime(
true);
424 $deadline->addSubItem($deadline2);
428 $rmd_submit =
new ilCheckboxInputGUI($this->lng->txt(
"exc_reminder_submit_setting"),
"rmd_submit_status");
430 $rmd_submit_start =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_start"),
"rmd_submit_start");
431 $rmd_submit_start->setSize(3);
432 $rmd_submit_start->setMaxLength(3);
433 $rmd_submit_start->setSuffix(
$lng->txt(
'days'));
434 $rmd_submit_start->
setInfo($this->lng->txt(
"exc_reminder_start_info"));
436 $rmd_submit_start->setMinValue(1);
439 $rmd_submit_frequency =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_frequency"),
"rmd_submit_freq");
440 $rmd_submit_frequency->
setSize(3);
441 $rmd_submit_frequency->setMaxLength(3);
442 $rmd_submit_frequency->setSuffix(
$lng->txt(
'days'));
443 $rmd_submit_frequency->setRequired(
true);
444 $rmd_submit_frequency->setMinValue(1);
445 $rmd_submit->addSubItem($rmd_submit_frequency);
449 $rmd_submit->addSubItem($rmd_submit_end);
454 $rmd_grade =
new ilCheckboxInputGUI($this->lng->txt(
"exc_reminder_grade_setting"),
"rmd_grade_status");
456 $rmd_grade_frequency =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_frequency"),
"rmd_grade_freq");
457 $rmd_grade_frequency->setSize(3);
458 $rmd_grade_frequency->setMaxLength(3);
459 $rmd_grade_frequency->setSuffix(
$lng->txt(
'days'));
461 $rmd_grade_frequency->setMinValue(1);
466 $rmd_grade->addSubItem($rmd_grade_end);
470 $form->addItem($rmd_submit);
471 $form->addItem($rmd_grade);
477 $op2->addSubItem($ti);
481 if ($ass_type->usesFileUpload()) {
483 $sub_header->setTitle($ass_type->getTitle());
484 $form->addItem($sub_header);
486 $form->addItem($max_file_tgl);
489 $max_file->
setInfo(
$lng->txt(
"exc_max_file_info"));
490 $max_file->setRequired(
true);
491 $max_file->setSize(3);
492 $max_file->setMinValue(1);
493 $max_file_tgl->addSubItem($max_file);
498 $sub_header->setTitle(
$lng->txt(
"exc_after_submission"),
"after_submission");
499 $form->addItem($sub_header);
500 if (!$ass_type->usesTeams()) {
503 $peer->
setInfo(
$lng->txt(
"exc_peer_review_ass_setting_info"));
504 $form->addItem($peer);
516 $fb->addSubItem($fb_file);
526 $fb_date_custom_date->setShowTime(
true);
528 $fb_date_custom_option->
addSubItem($fb_date_custom_date);
529 $fb_date->addOption($fb_date_custom_option);
532 $fb->addSubItem($fb_date);
535 $fb_cron->
setInfo(
$lng->txt(
"exc_global_feedback_file_cron_info"));
536 $fb->addSubItem($fb_cron);
539 if ($a_mode ==
"create") {
540 $form->addCommandButton(
"saveAssignment",
$lng->txt(
"save"));
541 $form->addCommandButton(
"listAssignments",
$lng->txt(
"cancel"));
543 $form->addCommandButton(
"updateAssignment",
$lng->txt(
"save"));
544 $form->addCommandButton(
"listAssignments",
$lng->txt(
"cancel"));
550 public function addMailTemplatesRadio($a_reminder_type)
554 $post_var =
"rmd_" . $a_reminder_type .
"_template_id";
558 $r_group->addOption(
new ilRadioOption($this->lng->txt(
"exc_reminder_mail_no_tpl"), 0));
560 switch ($a_reminder_type) {
562 include_once
"Modules/Exercise/classes/class.ilExcMailTemplateSubmitReminderContext.php";
566 include_once
"Modules/Exercise/classes/class.ilExcMailTemplateGradeReminderContext.php";
570 include_once
"Modules/Exercise/classes/class.ilExcMailTemplatePeerReminderContext.php";
578 $templateService = $DIC[
'mail.texttemplates.service'];
579 foreach ($templateService->loadTemplatesForContextId((
string)
$context->getId()) as
$template) {
580 $r_group->addOption(
new ilRadioOption($template->getTitle(), $template->getTplId()));
596 $protected_peer_review_groups =
false;
598 if ($this->assignment) {
599 if ($this->assignment->getPeerReview()) {
600 include_once
"Modules/Exercise/classes/class.ilExPeerReview.php";
602 if ($peer_review->hasPeerReviewGroups()) {
603 $protected_peer_review_groups =
true;
607 if ($this->assignment->getFeedbackFile()) {
614 if ($protected_peer_review_groups) {
622 $ass_type = $this->types->getById(
$type);
632 $time_deadline = $time_deadline
636 $time_deadline_ext = $time_deadline_ext
639 $time_fb_custom_date = $a_form->
getItemByPostVar(
"fb_date_custom")->getDate();
640 $time_fb_custom_date = $time_fb_custom_date
644 $reminder_submit_end_date = $a_form->
getItemByPostVar(
"rmd_submit_end")->getDate();
645 $reminder_submit_end_date = $reminder_submit_end_date
649 $reminder_grade_end_date = $a_form->
getItemByPostVar(
"rmd_grade_end")->getDate();
650 $reminder_grade_end_date = $reminder_grade_end_date
654 $time_deadline = null;
655 $time_deadline_ext = null;
659 $time_deadline = $time_deadline
663 $time_deadline_ext = $time_deadline_ext
670 if ($protected_peer_review_groups) {
671 $time_deadline = $this->assignment->getDeadline();
672 $time_deadline_ext = $this->assignment->getExtendedDeadline();
676 if (!$time_deadline) {
678 if (!$protected_peer_review_groups &&
681 ->setAlert(
$lng->txt(
"exc_needs_fixed_deadline"));
688 ->setAlert(
$lng->txt(
"exc_needs_deadline"));
694 $time_deadline_max = max($time_deadline, $time_deadline_ext);
695 $peer_dl = $this->assignment
696 ? $this->assignment->getPeerReviewDeadline()
698 if ($peer_dl && $peer_dl < $time_deadline_max) {
702 ->setAlert(
$lng->txt(
"exc_peer_deadline_mismatch"));
707 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
709 ->setAlert(
$lng->txt(
"exc_deadline_ext_mismatch"));
713 $time_deadline_min = $time_deadline_ext
714 ? min($time_deadline, $time_deadline_ext)
716 $time_deadline_max = max($time_deadline, $time_deadline_ext);
721 ->setAlert(
$lng->txt(
"exc_start_date_should_be_before_end_date"));
726 if ($ass_type->usesTeams()) {
731 $a_form->
getInput(
"min_participants_team"),
732 $a_form->
getInput(
"max_participants_team")
734 if ($team_validation[
'status'] ==
'error') {
736 ->setAlert($team_validation[
'msg']);
738 ->setAlert(
$lng->txt(
"exc_value_can_not_set"));
748 ,
"title" => trim($a_form->
getInput(
"title"))
749 ,
"instruction" => trim($a_form->
getInput(
"instruction"))
750 ,
"mandatory" => $a_form->
getInput(
"mandatory")
753 ,
"deadline" => $time_deadline
754 ,
"deadline_ext" => $time_deadline_ext
755 ,
"max_file" => $a_form->
getInput(
"max_file_tgl")
761 $res[
'team_creator'] = $a_form->
getInput(
"team_creator");
762 $res[
"team_creation"] = $a_form->
getInput(
"team_creation");
765 $res[
"number_teams"] = $a_form->
getInput(
"number_teams");
766 $res[
"min_participants_team"] = $a_form->
getInput(
"min_participants_team");
767 $res[
"max_participants_team"] = $a_form->
getInput(
"max_participants_team");
796 $res[
"deadline_mode"] = $a_form->
getInput(
"deadline_mode");
799 $res[
"relative_deadline"] = $a_form->
getInput(
"relative_deadline");
804 $protected_peer_review_groups) {
809 if (is_array($_FILES[
"files"])) {
812 $res[
"files"] = $_FILES[
"files"];
820 $res[
"fb_date_custom"] = $time_fb_custom_date;
822 if ($_FILES[
"fb_file"][
"tmp_name"]) {
823 $res[
"fb_file"] = $_FILES[
"fb_file"];
826 if ($a_form->
getInput(
"rmd_submit_status")) {
827 $res[
"rmd_submit_status"] =
true;
828 $res[
"rmd_submit_start"] = $a_form->
getInput(
"rmd_submit_start");
829 $res[
"rmd_submit_freq"] = $a_form->
getInput(
"rmd_submit_freq");
830 $res[
"rmd_submit_end"] = $reminder_submit_end_date;
831 $res[
"rmd_submit_template_id"] = $a_form->
getInput(
"rmd_submit_template_id");
833 if ($a_form->
getInput(
"rmd_grade_status")) {
834 $res[
"rmd_grade_status"] =
true;
835 $res[
"rmd_grade_freq"] = $a_form->
getInput(
"rmd_grade_freq");
836 $res[
"rmd_grade_end"] = $reminder_grade_end_date;
837 $res[
"rmd_grade_template_id"] = $a_form->
getInput(
"rmd_grade_template_id");
855 $is_create = !(bool) $a_ass->
getId();
857 $a_ass->
setTitle($a_input[
"title"]);
888 if ($a_input[
"fb"]) {
899 if (is_array($a_input[
"files"])) {
904 if (!$a_input[
"fb"]) {
913 if ($a_input[
"fb"]) {
914 if (is_array($a_input[
"fb_file"])) {
948 $reminder->
setReminderEnd((
int) $a_input[
"rmd_" . $type .
"_end"]);
965 $this->assignment = null;
971 $ass->setExerciseId($this->exercise_id);
972 $ass->setType(
$input[
"type"]);
973 $ass_type = $ass->getAssignmentType();
974 $ass_type_gui = $this->type_guis->getById($ass->getType());
979 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
981 $ass_type_gui->importFormToAssignment($ass,
$form);
984 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
987 $ilCtrl->setParameter($this,
"ass_id", $ass->getId());
988 $ilCtrl->redirect($this,
"editAssignment");
990 $form->setValuesByPost();
1004 $ilTabs->activateTab(
"ass_settings");
1019 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1022 $values[
"type"] = $this->assignment->getType();
1023 $values[
"title"] = $this->assignment->getTitle();
1024 $values[
"mandatory"] = $this->assignment->getMandatory();
1025 $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"] = $this->assignment->getTeamTutor();
1059 if ($this->assignment->getFeedbackDateCustom()) {
1065 if ($rmd_sub->getReminderStatus()) {
1066 $values[
"rmd_submit_status"] = $rmd_sub->getReminderStatus();
1067 $values[
"rmd_submit_start"] = $rmd_sub->getReminderStart();
1069 $values[
"rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1070 $values[
"rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1074 if ($rmd_grade->getReminderStatus()) {
1075 $values[
"rmd_grade_status"] = $rmd_grade->getReminderStatus();
1077 $values[
"rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1078 $values[
"rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1081 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1085 $values[
"deadline_mode"] = $this->assignment->getDeadlineMode();
1086 $values[
"relative_deadline"] = $this->assignment->getRelativeDeadline();
1091 if ($this->assignment->getFeedbackFile()) {
1093 $a_form->
getItemByPostVar(
"fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1097 '<a href="' .
$ilCtrl->getLinkTarget($this,
"downloadGlobalFeedbackFile") .
'">' .
1098 $lng->txt(
"download") .
'</a>' 1101 $a_form->
getItemByPostVar(
"fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1102 $a_form->
getItemByPostVar(
"fb_date")->setValue($this->assignment->getFeedbackDate());
1110 if ($this->assignment->getDeadline() > 0) {
1113 $ed_item->
setDate($edit_date);
1115 if ($this->assignment->getExtendedDeadline() > 0) {
1118 $ed_item->
setDate($edit_date);
1122 if ($this->assignment->getPeerReview()) {
1123 $a_form->
getItemByPostVar(
"peer")->setChecked($this->assignment->getPeerReview());
1134 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1135 $this->assignment->getPeerReview()) {
1137 include_once
"Modules/Exercise/classes/class.ilExPeerReview.php";
1139 if ($peer_review->hasPeerReviewGroups()) {
1150 if ($a_force_set_values ||
1151 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1170 $ass_type = $this->assignment->getType();
1171 $ass_type_gui = $this->type_guis->getById($ass_type);
1173 if (is_array($input)) {
1174 $old_deadline = $this->assignment->getDeadline();
1175 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1180 $ass_type_gui->importFormToAssignment($this->assignment,
$form);
1181 $this->assignment->update();
1183 $new_deadline = $this->assignment->getDeadline();
1184 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1187 if ($old_deadline != $new_deadline ||
1188 $old_ext_deadline != $new_ext_deadline) {
1189 $this->assignment->recalculateLateSubmissions();
1192 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1193 $ilCtrl->redirect($this,
"editAssignment");
1196 $ilTabs->activateTab(
"ass_settings");
1198 $form->setValuesByPost();
1213 if (!is_array(
$_POST[
"id"]) || count(
$_POST[
"id"]) == 0) {
1215 $ilCtrl->redirect($this,
"listAssignments");
1217 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1219 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1220 $cgui->setHeaderText(
$lng->txt(
"exc_conf_del_assignments"));
1221 $cgui->setCancel(
$lng->txt(
"cancel"),
"listAssignments");
1222 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteAssignments");
1228 $tpl->setContent($cgui->getHTML());
1241 if (is_array(
$_POST[
"id"])) {
1250 ilUtil::sendSuccess(
$lng->txt(
"exc_assignments_deleted"),
true);
1252 $ilCtrl->setParameter($this,
"ass_id",
"");
1253 $ilCtrl->redirect($this,
"listAssignments");
1266 ilUtil::sendSuccess(
$lng->txt(
"exc_saved_order"),
true);
1267 $ilCtrl->redirect($this,
"listAssignments");
1280 ilUtil::sendSuccess(
$lng->txt(
"exc_saved_order"),
true);
1281 $ilCtrl->redirect($this,
"listAssignments");
1295 $tpl->setTitle($this->assignment->getTitle());
1296 $tpl->setDescription(
"");
1298 $ilTabs->clearTargets();
1299 $ilHelp->setScreenIdComponent(
"exc");
1301 $ilTabs->setBackTarget(
1303 $ilCtrl->getLinkTarget($this,
"listAssignments")
1308 $lng->txt(
"settings"),
1309 $ilCtrl->getLinkTarget($this,
"editAssignment")
1312 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1313 $this->assignment->getPeerReview()) {
1316 $lng->txt(
"exc_peer_review"),
1317 $ilCtrl->getLinkTarget($this,
"editPeerReview")
1323 $lng->txt(
"exc_instruction_files"),
1324 $ilCtrl->getLinkTargetByClass(array(
"ilexassignmenteditorgui",
"ilexassignmentfilesystemgui"),
"listFiles")
1332 if (!$this->assignment ||
1333 !$this->assignment->getFeedbackFile()) {
1334 $ilCtrl->redirect($this,
"returnToParent");
1337 ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
1350 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1352 $form->setTitle(
$lng->txt(
"exc_peer_review"));
1356 $peer_min->
setInfo(
$lng->txt(
"exc_peer_review_min_number_info"));
1357 $peer_min->setRequired(
true);
1358 $peer_min->setSize(3);
1359 $peer_min->setValue(2);
1360 $form->addItem($peer_min);
1364 $peer_unlock->addOption(
new ilRadioOption(
$lng->txt(
"exc_peer_review_simple_unlock_inactive"), 0));
1365 $peer_unlock->setRequired(
true);
1366 $peer_unlock->setValue(0);
1367 $form->addItem($peer_unlock);
1369 if ($this->enable_peer_review_completion) {
1372 $option->
setInfo(
$lng->txt(
"exc_peer_review_completion_none_info"));
1373 $peer_cmpl->addOption($option);
1375 $option->
setInfo(
$lng->txt(
"exc_peer_review_completion_one_info"));
1376 $peer_cmpl->addOption($option);
1378 $option->
setInfo(
$lng->txt(
"exc_peer_review_completion_all_info"));
1379 $peer_cmpl->addOption($option);
1380 $peer_cmpl->setRequired(
true);
1382 $form->addItem($peer_cmpl);
1386 $peer_dl->
setInfo(
$lng->txt(
"exc_peer_review_deadline_info"));
1387 $peer_dl->setShowTime(
true);
1388 $form->addItem($peer_dl);
1391 $peer_prsl->
setInfo(
$lng->txt(
"exc_peer_review_personal_info"));
1392 $form->addItem($peer_prsl);
1395 $rmd_feedback =
new ilCheckboxInputGUI($this->lng->txt(
"exc_reminder_feedback_setting"),
"rmd_peer_status");
1397 $rmd_submit_start =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_feedback_start"),
"rmd_peer_start");
1398 $rmd_submit_start->setSize(3);
1399 $rmd_submit_start->setMaxLength(3);
1400 $rmd_submit_start->setSuffix(
$lng->txt(
'days'));
1402 $rmd_submit_start->setMinValue(1);
1403 $rmd_feedback->
addSubItem($rmd_submit_start);
1405 $rmd_submit_frequency =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_frequency"),
"rmd_peer_freq");
1406 $rmd_submit_frequency->
setSize(3);
1407 $rmd_submit_frequency->setMaxLength(3);
1408 $rmd_submit_frequency->setSuffix(
$lng->txt(
'days'));
1409 $rmd_submit_frequency->setRequired(
true);
1410 $rmd_submit_frequency->setMinValue(1);
1411 $rmd_feedback->addSubItem($rmd_submit_frequency);
1415 $rmd_feedback->addSubItem($rmd_submit_end);
1419 $form->addItem($rmd_feedback);
1424 $form->addItem($cats);
1429 $cats->addOption(
$def);
1432 $def->addSubItem($peer_text);
1435 $peer_char->
setInfo(
$lng->txt(
"exc_peer_review_min_chars_info"));
1436 $peer_char->setSize(3);
1437 $peer_text->addSubItem($peer_char);
1440 $def->addSubItem($peer_rating);
1443 $peer_file->
setInfo(
$lng->txt(
"exc_peer_review_file_info"));
1444 $def->addSubItem($peer_file);
1448 include_once
"Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php";
1450 if (
sizeof($cat_objs)) {
1451 include_once
"Modules/Exercise/classes/class.ilExcCriteria.php";
1452 foreach ($cat_objs as $cat_obj) {
1456 if (
sizeof($crits)) {
1458 foreach ($crits as $crit) {
1459 $titles[] = $crit->getTitle();
1461 $opt =
new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1462 $opt->
setInfo(implode(
", ", $titles));
1463 $cats->addOption($opt);
1468 $url =
$ilCtrl->getLinkTargetByClass(
"ilexccriteriacataloguegui",
"");
1469 $def->setInfo(
'<a href="' .
$url .
'">[+] ' .
1470 $lng->txt(
"exc_add_criteria_catalogue") .
1475 $form->addCommandButton(
"updatePeerReview",
$lng->txt(
"save"));
1476 $form->addCommandButton(
"editAssignment",
$lng->txt(
"cancel"));
1488 $ilTabs->activateTab(
"peer_settings");
1490 if ($a_form === null) {
1494 $tpl->setContent($a_form->getHTML());
1501 if ($this->assignment->getPeerReviewDeadline() > 0) {
1505 $this->assignment->getId();
1508 if ($reminder->getReminderStatus()) {
1509 $values[
"rmd_peer_status"] = $reminder->getReminderStatus();
1510 $values[
"rmd_peer_start"] = $reminder->getReminderStart();
1512 $values[
"rmd_peer_freq"] = $reminder->getReminderFrequency();
1513 $values[
"rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1516 $a_form->setValuesByArray(
$values);
1523 $a_form->
getItemByPostVar(
"peer_min")->setValue($this->assignment->getPeerReviewMin());
1524 $a_form->
getItemByPostVar(
"peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1525 $a_form->
getItemByPostVar(
"peer_unlock")->setValue((
int) $this->assignment->getPeerReviewSimpleUnlock());
1527 if ($this->enable_peer_review_completion) {
1528 $a_form->
getItemByPostVar(
"peer_valid")->setValue($this->assignment->getPeerReviewValid());
1531 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1536 $a_form->
getItemByPostVar(
"peer_text")->setChecked($this->assignment->hasPeerReviewText());
1537 $a_form->
getItemByPostVar(
"peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1538 $a_form->
getItemByPostVar(
"peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1539 if ($this->assignment->getPeerReviewChars() > 0) {
1540 $a_form->
getItemByPostVar(
"peer_char")->setValue($this->assignment->getPeerReviewChars());
1549 include_once
"Modules/Exercise/classes/class.ilExPeerReview.php";
1551 if ($peer_review->hasPeerReviewGroups()) {
1559 if ($this->enable_peer_review_completion) {
1571 $min->setValue($this->assignment->getPeerReviewMin());
1575 if ($a_force_set_values ||
1576 $peer_review->hasPeerReviewGroups()) {
1585 $protected_peer_review_groups =
false;
1586 include_once
"Modules/Exercise/classes/class.ilExPeerReview.php";
1588 if ($peer_review->hasPeerReviewGroups()) {
1589 $protected_peer_review_groups =
true;
1595 $time_deadline = $this->assignment->getDeadline();
1596 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1597 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1605 $reminder_date = $reminder_date
1610 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1612 ->setAlert(
$lng->txt(
"exc_peer_deadline_mismatch"));
1616 if (!$protected_peer_review_groups) {
1617 if ($a_form->
getInput(
"crit_cat") < 0 &&
1619 !$a_form->
getInput(
"peer_rating") &&
1622 ->setAlert(
$lng->txt(
"select_one"));
1629 $res[
"peer_dl"] = $time_peer;
1631 if ($protected_peer_review_groups) {
1632 $res[
"peer_min"] = $this->assignment->getPeerReviewMin();
1633 $res[
"peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1634 $res[
"peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1635 $res[
"peer_valid"] = $this->assignment->getPeerReviewValid();
1637 $res[
"peer_text"] = $this->assignment->hasPeerReviewText();
1638 $res[
"peer_rating"] = $this->assignment->hasPeerReviewRating();
1639 $res[
"peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1640 $res[
"peer_char"] = $this->assignment->getPeerReviewChars();
1641 $res[
"crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1643 $res[
"peer_valid"] = $this->enable_peer_review_completion
1644 ?
$res[
"peer_valid"]
1648 $res[
"peer_unlock"] = $a_form->
getInput(
"peer_unlock");
1653 $res[
"peer_rating"] = $a_form->
getInput(
"peer_rating");
1658 if ($a_form->
getInput(
"rmd_peer_status")) {
1659 $res[
"rmd_peer_status"] = $a_form->
getInput(
"rmd_peer_status");
1660 $res[
"rmd_peer_start"] = $a_form->
getInput(
"rmd_peer_start");
1661 $res[
"rmd_peer_end"] = $reminder_date;
1662 $res[
"rmd_peer_freq"] = $a_form->
getInput(
"rmd_peer_freq");
1663 $res[
"rmd_peer_template_id"] = $a_form->
getInput(
"rmd_peer_template_id");
1682 ? $a_input[
"peer_valid"]
1690 ? $a_input[
"crit_cat"]
1709 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1710 $ilCtrl->redirect($this,
"editPeerReview");
1713 $ilTabs->activateTab(
"peer_settings");
1715 $form->setValuesByPost();
1735 $number_of_teams = $a_num_teams;
1737 if ($number_of_teams) {
1738 $members_per_team = round($total_members / $a_num_teams);
1740 if ($a_min_participants) {
1741 $number_of_teams = round($total_members / $a_min_participants);
1742 $participants_extra_team = $total_members % $a_min_participants;
1743 if ($participants_extra_team > $number_of_teams) {
1745 $message = sprintf($this->lng->txt(
"exc_team_minimal_too_big"), $a_min_participants);
1746 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1749 $members_per_team = 0;
1752 if ($a_min_participants > $a_max_participants) {
1753 $message = $this->lng->txt(
"exc_team_min_big_than_max");
1754 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1757 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1758 $message = sprintf($this->lng->txt(
"exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1759 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1762 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1763 $message = sprintf($this->lng->txt(
"exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1764 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1767 return array(
"status" =>
"success",
"msg" =>
"");
1779 return count($exc_members->getMembers());
1789 if ($ass_type->usesTeams() &&
1792 $number_teams = $a_input[
'number_teams'];
1795 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->
getId(), $number_teams, $a_input[
'min_participants_team']);
getExerciseTotalMembers()
Get the total number of exercise members.
Class ilExAssignmentEditorGUI.
This class represents an option in a radio group.
setReminderStatus($a_status)
Set reminder for users without submission.
const TEAMS_FORMED_BY_RANDOM
updateAssignmentObject()
Update assignment.
const FEEDBACK_DATE_SUBMISSION
setTitle($a_val)
Set title.
File System Explorer GUI class.
$enable_peer_review_completion
editPeerReviewObject(ilPropertyFormGUI $a_form=null)
setMaxFile($a_value)
Set max number of uploads.
setFeedbackFile($a_value)
Set (global) feedback file.
setPeerReviewMin($a_value)
Set peer review minimum.
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
confirmAssignmentsDeletionObject()
Confirm assignments deletion.
setTeamTutor($a_value)
Set team management by tutor.
setPeerReviewFileUpload($a_val)
Set peer review file upload.
getId()
Get assignment id.
saveAssignmentObject()
Save assignment.
processForm(ilPropertyFormGUI $a_form)
Custom form validation.
setPeerReview($a_value)
Toggle peer review.
setPeerReviewDeadline($a_val)
Set peer review deadline (timestamp)
if(!array_key_exists('StateId', $_REQUEST)) $id
Exercise assignment team.
setAssignmentHeader()
Set assignment header.
setPeerReviewValid($a_value)
Set peer review validation.
setTitle($a_val)
Set title.
static getInstance()
Get instance.
static adoptTeams($a_source_ass_id, $a_target_ass_id, $a_user_id=null, $a_exc_ref_id=null)
setInfo($a_info)
Set Info.
setRelativeDeadline($a_val)
Set relative deadline.
const PEER_REVIEW_VALID_ALL
setInstruction($a_val)
Set instruction.
const TEAMS_FORMED_BY_TUTOR
listAssignmentsObject()
List assignments.
addAssignmentObject()
Create assignment.
const PEER_REVIEW_VALID_ONE
setDeadlineMode($a_val)
Set deadline mode.
getPeerReviewValues($a_form)
static getAdoptableTeamAssignments($a_exercise_id, $a_exclude_ass_id=null, $a_user_id=null)
getTypeDropdown()
Get type selection dropdown.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getAssignmentValues(ilPropertyFormGUI $a_form)
Get current values for assignment from.
setStartTime($a_val)
Set start time (timestamp)
getReminderStatus()
Get the reminder status.
catch(Exception $e) $message
setDeadline($a_val)
Set deadline (timestamp)
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
static saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.
create()
Create directory.
static getInstancesByParentId($a_parent_id)
addSubItem($a_item)
Add Subitem.
processPeerReviewForm(ilPropertyFormGUI $a_form)
handleDisabledPeerFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)
setPeerReviewCriteriaCatalogue($a_value)
Set peer review criteria catalogue id.
setPeerReviewPersonalized($a_val)
Set peer review personalized.
importFormToAssignmentReminders($a_input, $a_ass_id)
setPeerReviewRating($a_val)
Set peer review rating.
TODO: import/export reminder data with the exercise/assignment.
static getInstance()
Get instance.
uploadAssignmentFiles($a_files)
Upload assignment files (from creation form)
setPeerReviewSimpleUnlock($a_value)
Set peer review simple unlock.
__construct($a_exercise_id, $a_enable_peer_review_completion_settings, ilExAssignment $a_ass=null)
Constructor.
This class represents a text property in a property form.
setPeerReviewText($a_val)
Set peer review text.
handleGlobalFeedbackFileUpload(array $a_file)
setReminderFrequency($a_num_days)
Set frequency in days.
setMaxLength($a_maxlength)
Set Max Length.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setReminderStart($a_num_days)
Set num days before the deadline to start sending notifications.
handleDisabledFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
deleteGlobalFeedbackFile()
generateTeams(ilExAssignment $a_assignment, $a_input)
setReminderEnd($a_date)
Set the ending of the reminder.
setFeedbackCron($a_value)
Toggle (global) feedback file cron.
const FEEDBACK_DATE_DEADLINE
orderAssignmentsByDeadlineObject()
Order by deadline.
validationTeamsFormation($a_num_teams, $a_min_participants, $a_max_participants)
editAssignmentObject()
Edit assignment.
static getInstancesByParentId($a_parent_id)
const TEAMS_FORMED_BY_PARTICIPANTS
saveAssignmentOrderObject()
Save assignments order.
setFeedbackDate($a_value)
Set (global) feedback file availability date.
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
setRows($a_rows)
Set Rows.
setDate($a_date, $a_format)
Set date.
This class represents a text area property in a property form.
setPeerReviewChars($a_value)
Set peer review minimum characters.
setReminderMailTemplate($a_tpl_id)
const PEER_REVIEW_VALID_NONE
initAssignmentForm($a_type, $a_mode="create")
Init assignment form.
importPeerReviewFormToAssignmentReminders($a_input, $a_ass_id)
const FEEDBACK_DATE_CUSTOM
setFeedbackDateCustom($a_value)
Set (global) feedback file availability using a custom date.
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)
const TEAMS_FORMED_BY_ASSIGNMENT
getAssignmentType()
Get assignment type.
saveReminderData(ilExAssignmentReminder $reminder, $a_input)
setDisabledPeerReviewFieldValues(ilPropertyFormGUI $a_form)
setMandatory($a_val)
Set mandatory.
static orderAssByDeadline($a_ex_id)
Order assignments by deadline date.
downloadGlobalFeedbackFileObject()
setExtendedDeadline($a_val)
Set extended deadline (timestamp)
static lookupTitle($a_id)
Lookup title.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
setDisabledFieldValues(ilPropertyFormGUI $a_form)
Confirmation screen class.
deleteAssignmentsObject()
Delete assignments.