94 $this->ctrl = $DIC->ctrl();
95 $this->tabs = $DIC->tabs();
96 $this->lng = $DIC->language();
97 $this->tpl = $DIC[
"tpl"];
98 $this->toolbar = $DIC->toolbar();
100 $this->
help = $DIC[
"ilHelp"];
101 $this->exercise_id = $a_exercise_id;
102 $this->assignment = $a_ass;
103 $this->enable_peer_review_completion = (bool) $a_enable_peer_review_completion_settings;
106 $request = $DIC->exercise()->internal()->request();
107 $this->exc = $request->getRequestedExercise();
108 $this->random_manager = $DIC->exercise()->internal()->service()->getRandomAssignmentManager(
109 $request->getRequestedExercise()
119 $class =
$ilCtrl->getNextClass($this);
120 $cmd =
$ilCtrl->getCmd(
"listAssignments");
123 case "ilpropertyformgui":
125 $ilCtrl->forwardCommand($form);
129 case "ilexassignmentfilesystemgui":
131 $ilTabs->activateTab(
"ass_files");
138 $fs_gui->setTableId(
"excassfil" . $this->assignment->getId());
139 $fs_gui->setAllowDirectories(
false);
140 $ilCtrl->forwardCommand($fs_gui);
143 case "ilexpeerreviewgui":
144 $ilTabs->clearTargets();
145 $ilTabs->setBackTarget(
147 $ilCtrl->getLinkTarget($this,
"listAssignments")
151 $ilCtrl->forwardCommand($peer_gui);
155 $this->{$cmd .
"Object"}();
170 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this,
"addAssignment"));
175 $button->setCaption(
"exc_add_assignment");
176 $button->setCommand(
"addAssignment");
177 $ilToolbar->addStickyItem($button);
181 $tpl->setContent($t->getHTML());
193 $this->assignment = null;
195 if (!(
int)
$_POST[
"type"]) {
196 $ilCtrl->redirect($this,
"listAssignments");
200 $tpl->setContent($form->getHTML());
213 foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
214 $types[$k] = $t->getTitle();
219 $ty->setRequired(
true);
234 $ass_type = $this->types->getById(
$a_type);
235 $ass_type_gui = $this->type_guis->getById(
$a_type);
238 $lng->loadLanguageModule(
"form");
240 if ($a_mode ==
"edit") {
241 $form->setTitle(
$lng->txt(
"exc_edit_assignment"));
243 $form->setTitle(
$lng->txt(
"exc_new_assignment"));
245 $form->setFormAction(
$ilCtrl->getFormAction($this));
249 $ti->setMaxLength(200);
250 $ti->setRequired(
true);
256 $ty->setDisabled(
true);
263 $ass_type_gui->addEditFormCustomProperties($form);
269 if ($ass_type->usesTeams()) {
270 if ($a_mode ==
"edit") {
280 $lng->txt(
"exc_team_by_participants"),
282 $lng->txt(
"exc_team_by_participants_info")
286 $lng->txt(
"exc_team_by_tutors"),
288 $lng->txt(
"exc_team_by_tutors_info")
299 $lng->txt(
"exc_team_by_tutors_manual"),
301 $lng->txt(
"exc_team_by_tutors_manual_info")
303 $rd_creation_method->addOption($rd_creation_manual);
308 $add_info =
" <strong>" .
$lng->txt(
"exc_team_by_random_add_info") .
"</strong>";
311 $lng->txt(
"exc_team_by_random"),
315 $rd_creation_method->addOption($rd_creation_random);
319 $number_teams->setMinValue(1);
321 $number_teams->setRequired(
true);
322 $number_teams->setSuffix(
$lng->txt(
"exc_team_assignment_adopt_teams"));
323 $rd_creation_random->addSubItem($number_teams);
325 $min_team_participants =
new ilNumberInputGUI(
$lng->txt(
"exc_min_team_participants"),
"min_participants_team");
326 $min_team_participants->
setSize(3);
327 $min_team_participants->setMinValue(1);
329 $min_team_participants->setRequired(
true);
330 $min_team_participants->setSuffix(
$lng->txt(
"exc_participants"));
331 $rd_creation_random->addSubItem($min_team_participants);
333 $max_team_participants =
new ilNumberInputGUI(
$lng->txt(
"exc_max_team_participants"),
"max_participants_team");
334 $max_team_participants->
setSize(3);
335 $max_team_participants->setMinValue(1);
337 $max_team_participants->setRequired(
true);
338 $max_team_participants->setSuffix(
$lng->txt(
"exc_participants"));
339 $rd_creation_random->addSubItem($max_team_participants);
342 if (count($options)) {
344 $lng->txt(
"exc_team_by_assignment"),
346 $lng->txt(
"exc_team_by_assignment_info")
350 $radio_assignment_adopt->setRequired(
true);
351 $radio_assignment_adopt->addOption(
new ilRadioOption(
$lng->txt(
"exc_team_assignment_adopt_none"), -1));
353 foreach ($options as $id => $item) {
355 $option->setInfo(
$lng->txt(
"exc_team_assignment_adopt_teams") .
": " . $item[
"teams"]);
356 $radio_assignment_adopt->addOption($option);
358 $radio_assignment->
addSubItem($radio_assignment_adopt);
359 $rd_creation_method->addOption($radio_assignment);
362 $radio_tutors->
addSubItem($rd_creation_method);
364 $rd_team->addOption($radio_participants);
365 $rd_team->addOption($radio_tutors);
369 $form->addItem($rd_team);
372 $rd_team->setDisabled(
true);
377 if (!$this->random_manager->isActivated()) {
380 $cb->setChecked(
true);
385 $ne->
setValue(
$lng->txt(
"exc_mandatory_rand_determined"));
391 $sub_header->setTitle(
$lng->txt(
"exc_work_instructions"),
"work_instructions");
392 $form->addItem($sub_header);
397 $desc_input->setUseRte(
true);
398 $desc_input->setRteTagSet(
"mini");
400 $form->addItem($desc_input);
403 if ($a_mode ==
"create") {
406 $form->addItem($files);
411 $sub_header->setTitle(
$lng->txt(
"exc_schedule"),
"schedule");
412 $form->addItem($sub_header);
417 $form->addItem($start_date);
423 $radg->addOption($op1);
425 $radg->addOption($op2);
426 $form->addItem($radg);
431 $op1->addSubItem($deadline);
435 $deadline2->
setInfo(
$lng->txt(
"exc_deadline_extended_info"));
436 $deadline2->setShowTime(
true);
437 $deadline->addSubItem($deadline2);
441 $rmd_submit =
new ilCheckboxInputGUI($this->lng->txt(
"exc_reminder_submit_setting"),
"rmd_submit_status");
443 $rmd_submit_start =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_start"),
"rmd_submit_start");
444 $rmd_submit_start->setSize(3);
445 $rmd_submit_start->setMaxLength(3);
446 $rmd_submit_start->setSuffix(
$lng->txt(
'days'));
447 $rmd_submit_start->
setInfo($this->lng->txt(
"exc_reminder_start_info"));
449 $rmd_submit_start->setMinValue(1);
452 $rmd_submit_frequency =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_frequency"),
"rmd_submit_freq");
453 $rmd_submit_frequency->
setSize(3);
454 $rmd_submit_frequency->setMaxLength(3);
455 $rmd_submit_frequency->setSuffix(
$lng->txt(
'days'));
456 $rmd_submit_frequency->setRequired(
true);
457 $rmd_submit_frequency->setMinValue(1);
458 $rmd_submit->addSubItem($rmd_submit_frequency);
462 $rmd_submit->addSubItem($rmd_submit_end);
467 $rmd_grade =
new ilCheckboxInputGUI($this->lng->txt(
"exc_reminder_grade_setting"),
"rmd_grade_status");
469 $rmd_grade_frequency =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_frequency"),
"rmd_grade_freq");
470 $rmd_grade_frequency->setSize(3);
471 $rmd_grade_frequency->setMaxLength(3);
472 $rmd_grade_frequency->setSuffix(
$lng->txt(
'days'));
474 $rmd_grade_frequency->setMinValue(1);
479 $rmd_grade->addSubItem($rmd_grade_end);
483 $form->addItem($rmd_submit);
484 $form->addItem($rmd_grade);
490 $op2->addSubItem($ti);
493 $last_submission =
new ilDateTimeInputGUI(
$lng->txt(
"exc_rel_last_submission"),
"rel_deadline_last_subm");
494 $last_submission->
setInfo(
$lng->txt(
"exc_rel_last_submission_info"));
495 $last_submission->setShowTime(
true);
496 $op2->addSubItem($last_submission);
501 if ($ass_type->usesFileUpload()) {
503 $sub_header->setTitle($ass_type->getTitle());
504 $form->addItem($sub_header);
506 $form->addItem($max_file_tgl);
509 $max_file->
setInfo(
$lng->txt(
"exc_max_file_info"));
510 $max_file->setRequired(
true);
511 $max_file->setSize(3);
512 $max_file->setMinValue(1);
513 $max_file_tgl->addSubItem($max_file);
518 $sub_header->setTitle(
$lng->txt(
"exc_after_submission"),
"after_submission");
519 $form->addItem($sub_header);
521 if (!$ass_type->usesTeams() && !$this->random_manager->isActivated()) {
524 $peer->
setInfo(
$lng->txt(
"exc_peer_review_ass_setting_info"));
525 $form->addItem($peer);
537 $fb->addSubItem($fb_file);
547 $fb_date_custom_date->setShowTime(
true);
549 $fb_date_custom_option->
addSubItem($fb_date_custom_date);
550 $fb_date->addOption($fb_date_custom_option);
553 $fb->addSubItem($fb_date);
556 $fb_cron->
setInfo(
$lng->txt(
"exc_global_feedback_file_cron_info"));
557 $fb->addSubItem($fb_cron);
560 if ($a_mode ==
"create") {
561 $form->addCommandButton(
"saveAssignment",
$lng->txt(
"save"));
562 $form->addCommandButton(
"listAssignments",
$lng->txt(
"cancel"));
564 $form->addCommandButton(
"updateAssignment",
$lng->txt(
"save"));
565 $form->addCommandButton(
"listAssignments",
$lng->txt(
"cancel"));
571 public function addMailTemplatesRadio($a_reminder_type)
575 $post_var =
"rmd_" . $a_reminder_type .
"_template_id";
579 $r_group->addOption(
new ilRadioOption($this->lng->txt(
"exc_reminder_mail_no_tpl"), 0));
581 switch ($a_reminder_type) {
596 $templateService = $DIC[
'mail.texttemplates.service'];
597 foreach ($templateService->loadTemplatesForContextId((
string)
$context->getId()) as $template) {
598 $r_group->addOption(
new ilRadioOption($template->getTitle(), $template->getTplId()));
614 $protected_peer_review_groups =
false;
616 if ($this->assignment) {
617 if ($this->assignment->getPeerReview()) {
619 if ($peer_review->hasPeerReviewGroups()) {
620 $protected_peer_review_groups =
true;
624 if ($this->assignment->getFeedbackFile()) {
631 if ($protected_peer_review_groups) {
639 $ass_type = $this->types->getById(
$type);
644 $time_start = $time_start
649 $time_deadline = $time_deadline
653 $time_deadline_ext = $time_deadline_ext
656 $time_fb_custom_date = $a_form->
getItemByPostVar(
"fb_date_custom")->getDate();
657 $time_fb_custom_date = $time_fb_custom_date
661 $reminder_submit_end_date = $a_form->
getItemByPostVar(
"rmd_submit_end")->getDate();
662 $reminder_submit_end_date = $reminder_submit_end_date
666 $reminder_grade_end_date = $a_form->
getItemByPostVar(
"rmd_grade_end")->getDate();
667 $reminder_grade_end_date = $reminder_grade_end_date
671 $time_deadline = null;
672 $time_deadline_ext = null;
676 $time_deadline = $time_deadline
680 $time_deadline_ext = $time_deadline_ext
687 if ($protected_peer_review_groups) {
688 $time_deadline = $this->assignment->getDeadline();
689 $time_deadline_ext = $this->assignment->getExtendedDeadline();
693 if (!$time_deadline) {
695 if (!$protected_peer_review_groups &&
698 ->setAlert(
$lng->txt(
"exc_needs_fixed_deadline"));
705 ->setAlert(
$lng->txt(
"exc_needs_deadline"));
711 $time_deadline_max = max($time_deadline, $time_deadline_ext);
712 $peer_dl = $this->assignment
713 ? $this->assignment->getPeerReviewDeadline()
715 if ($peer_dl && $peer_dl < $time_deadline_max) {
719 ->setAlert(
$lng->txt(
"exc_peer_deadline_mismatch"));
724 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
726 ->setAlert(
$lng->txt(
"exc_deadline_ext_mismatch"));
730 $time_deadline_min = $time_deadline_ext
731 ? min($time_deadline, $time_deadline_ext)
733 $time_deadline_max = max($time_deadline, $time_deadline_ext);
736 if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
738 ->setAlert(
$lng->txt(
"exc_start_date_should_be_before_end_date"));
743 if ($ass_type->usesTeams()) {
748 $a_form->
getInput(
"min_participants_team"),
749 $a_form->
getInput(
"max_participants_team")
751 if ($team_validation[
'status'] ==
'error') {
753 ->setAlert($team_validation[
'msg']);
755 ->setAlert(
$lng->txt(
"exc_value_can_not_set"));
765 ,
"title" => trim($a_form->
getInput(
"title"))
766 ,
"instruction" => trim($a_form->
getInput(
"instruction"))
768 ,
"start" => $time_start
769 ,
"deadline" => $time_deadline
770 ,
"deadline_ext" => $time_deadline_ext
771 ,
"max_file" => $a_form->
getInput(
"max_file_tgl")
775 if (!$this->random_manager->isActivated()) {
780 $res[
'team_creator'] = $a_form->
getInput(
"team_creator");
781 $res[
"team_creation"] = $a_form->
getInput(
"team_creation");
784 $res[
"number_teams"] = $a_form->
getInput(
"number_teams");
785 $res[
"min_participants_team"] = $a_form->
getInput(
"min_participants_team");
786 $res[
"max_participants_team"] = $a_form->
getInput(
"max_participants_team");
815 $res[
"deadline_mode"] = $a_form->
getInput(
"deadline_mode");
818 $res[
"relative_deadline"] = $a_form->
getInput(
"relative_deadline");
819 $rel_deadline_last_subm = $a_form->
getItemByPostVar(
"rel_deadline_last_subm")->getDate();
820 $rel_deadline_last_subm = $rel_deadline_last_subm
823 $res[
"rel_deadline_last_subm"] = $rel_deadline_last_subm;
828 $protected_peer_review_groups) {
833 if (is_array($_FILES[
"files"])) {
836 $res[
"files"] = $_FILES[
"files"];
844 $res[
"fb_date_custom"] = $time_fb_custom_date;
846 if ($_FILES[
"fb_file"][
"tmp_name"]) {
847 $res[
"fb_file"] = $_FILES[
"fb_file"];
850 if ($a_form->
getInput(
"rmd_submit_status")) {
851 $res[
"rmd_submit_status"] =
true;
852 $res[
"rmd_submit_start"] = $a_form->
getInput(
"rmd_submit_start");
853 $res[
"rmd_submit_freq"] = $a_form->
getInput(
"rmd_submit_freq");
854 $res[
"rmd_submit_end"] = $reminder_submit_end_date;
855 $res[
"rmd_submit_template_id"] = $a_form->
getInput(
"rmd_submit_template_id");
857 if ($a_form->
getInput(
"rmd_grade_status")) {
858 $res[
"rmd_grade_status"] =
true;
859 $res[
"rmd_grade_freq"] = $a_form->
getInput(
"rmd_grade_freq");
860 $res[
"rmd_grade_end"] = $reminder_grade_end_date;
861 $res[
"rmd_grade_template_id"] = $a_form->
getInput(
"rmd_grade_template_id");
879 $is_create = !(bool) $a_ass->
getId();
881 $a_ass->
setTitle($a_input[
"title"]);
883 if (!$this->random_manager->isActivated()) {
902 if (!$this->random_manager->isActivated()) {
917 if ($a_input[
"fb"]) {
928 if (is_array($a_input[
"files"])) {
933 if (!$a_input[
"fb"]) {
942 if ($a_input[
"fb"]) {
943 if (is_array($a_input[
"fb_file"])) {
977 $reminder->
setReminderEnd((
int) $a_input[
"rmd_" . $type .
"_end"]);
980 $reminder->{$action}();
994 $this->assignment = null;
998 if (is_array($input)) {
1000 $ass->setExerciseId($this->exercise_id);
1001 $ass->setType($input[
"type"]);
1002 $ass_type = $ass->getAssignmentType();
1003 $ass_type_gui = $this->type_guis->getById($ass->getType());
1008 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1010 $ass_type_gui->importFormToAssignment($ass, $form);
1013 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1016 $ilCtrl->setParameter($this,
"ass_id", $ass->getId());
1017 $ilCtrl->redirect($this,
"editAssignment");
1019 $form->setValuesByPost();
1020 $tpl->setContent($form->getHtml());
1033 $ilTabs->activateTab(
"ass_settings");
1037 $tpl->setContent($form->getHTML());
1048 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1051 $values[
"type"] = $this->assignment->getType();
1052 $values[
"title"] = $this->assignment->getTitle();
1053 $values[
"mandatory"] = $this->assignment->getMandatory();
1054 $values[
"instruction"] = $this->assignment->getInstruction();
1073 if ($this->assignment->getStartTime()) {
1077 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1078 if ($this->assignment->getMaxFile()) {
1079 $values[
"max_file_tgl"] =
true;
1080 $values[
"max_file"] = $this->assignment->getMaxFile();
1084 if ($this->assignment->getAssignmentType()->usesTeams()) {
1085 $values[
"team_creator"] = $this->assignment->getTeamTutor();
1088 if ($this->assignment->getFeedbackDateCustom()) {
1089 $values[
"fb_date_custom"] =
new ilDateTime($this->assignment->getFeedbackDateCustom(),
IL_CAL_UNIX);
1094 if ($rmd_sub->getReminderStatus()) {
1095 $values[
"rmd_submit_status"] = $rmd_sub->getReminderStatus();
1096 $values[
"rmd_submit_start"] = $rmd_sub->getReminderStart();
1098 $values[
"rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1099 $values[
"rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1103 if ($rmd_grade->getReminderStatus()) {
1106 $values[
"rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1107 $values[
"rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1110 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1111 $values = array_merge($values, $type_values);
1114 $values[
"deadline_mode"] = $this->assignment->getDeadlineMode();
1115 $values[
"relative_deadline"] = $this->assignment->getRelativeDeadline();
1116 $values[
"rel_deadline_last_subm"] =
new ilDateTime($this->assignment->getRelDeadlineLastSubmission(),
IL_CAL_UNIX);
1122 if ($this->assignment->getFeedbackFile()) {
1124 $a_form->
getItemByPostVar(
"fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1128 '<a href="' .
$ilCtrl->getLinkTarget($this,
"downloadGlobalFeedbackFile") .
'">' .
1129 $lng->txt(
"download") .
'</a>' 1132 $a_form->
getItemByPostVar(
"fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1133 $a_form->
getItemByPostVar(
"fb_date")->setValue($this->assignment->getFeedbackDate());
1141 if ($this->assignment->getDeadline() > 0) {
1144 $ed_item->
setDate($edit_date);
1146 if ($this->assignment->getExtendedDeadline() > 0) {
1149 $ed_item->
setDate($edit_date);
1153 if ($this->assignment->getPeerReview()) {
1154 $a_form->
getItemByPostVar(
"peer")->setChecked($this->assignment->getPeerReview());
1165 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1166 $this->assignment->getPeerReview()) {
1169 if ($peer_review->hasPeerReviewGroups()) {
1180 if ($a_force_set_values ||
1181 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1200 $ass_type = $this->assignment->getType();
1201 $ass_type_gui = $this->type_guis->getById($ass_type);
1203 if (is_array($input)) {
1204 $old_deadline = $this->assignment->getDeadline();
1205 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1210 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1211 $this->assignment->update();
1213 $new_deadline = $this->assignment->getDeadline();
1214 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1217 if ($old_deadline != $new_deadline ||
1218 $old_ext_deadline != $new_ext_deadline) {
1219 $this->assignment->recalculateLateSubmissions();
1222 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1223 $ilCtrl->redirect($this,
"editAssignment");
1226 $ilTabs->activateTab(
"ass_settings");
1228 $form->setValuesByPost();
1230 $tpl->setContent($form->getHtml());
1243 if (!is_array(
$_POST[
"id"]) || count(
$_POST[
"id"]) == 0) {
1245 $ilCtrl->redirect($this,
"listAssignments");
1248 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1249 $cgui->setHeaderText(
$lng->txt(
"exc_conf_del_assignments"));
1250 $cgui->setCancel(
$lng->txt(
"cancel"),
"listAssignments");
1251 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteAssignments");
1257 $tpl->setContent($cgui->getHTML());
1270 if (is_array(
$_POST[
"id"])) {
1271 foreach (
$_POST[
"id"] as $id) {
1279 ilUtil::sendSuccess(
$lng->txt(
"exc_assignments_deleted"),
true);
1281 $ilCtrl->setParameter($this,
"ass_id",
"");
1282 $ilCtrl->redirect($this,
"listAssignments");
1295 ilUtil::sendSuccess(
$lng->txt(
"exc_saved_order"),
true);
1296 $ilCtrl->redirect($this,
"listAssignments");
1309 ilUtil::sendSuccess(
$lng->txt(
"exc_saved_order"),
true);
1310 $ilCtrl->redirect($this,
"listAssignments");
1324 $tpl->setTitle($this->assignment->getTitle());
1325 $tpl->setDescription(
"");
1327 $ilTabs->clearTargets();
1328 $ilHelp->setScreenIdComponent(
"exc");
1330 $ilTabs->setBackTarget(
1332 $ilCtrl->getLinkTarget($this,
"listAssignments")
1337 $lng->txt(
"settings"),
1338 $ilCtrl->getLinkTarget($this,
"editAssignment")
1341 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1342 $this->assignment->getPeerReview()) {
1345 $lng->txt(
"exc_peer_review"),
1346 $ilCtrl->getLinkTarget($this,
"editPeerReview")
1352 $lng->txt(
"exc_instruction_files"),
1353 $ilCtrl->getLinkTargetByClass(array(
"ilexassignmenteditorgui",
"ilexassignmentfilesystemgui"),
"listFiles")
1361 if (!$this->assignment ||
1362 !$this->assignment->getFeedbackFile()) {
1363 $ilCtrl->redirect($this,
"returnToParent");
1366 ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
1380 $form->setTitle(
$lng->txt(
"exc_peer_review"));
1381 $form->setFormAction(
$ilCtrl->getFormAction($this));
1384 $peer_min->
setInfo(
$lng->txt(
"exc_peer_review_min_number_info"));
1385 $peer_min->setRequired(
true);
1386 $peer_min->setSize(3);
1387 $peer_min->setValue(2);
1388 $form->addItem($peer_min);
1392 $peer_unlock->addOption(
new ilRadioOption(
$lng->txt(
"exc_peer_review_simple_unlock_inactive"), 0));
1393 $peer_unlock->setRequired(
true);
1394 $peer_unlock->setValue(0);
1395 $form->addItem($peer_unlock);
1397 if ($this->enable_peer_review_completion) {
1400 $option->
setInfo(
$lng->txt(
"exc_peer_review_completion_none_info"));
1401 $peer_cmpl->addOption($option);
1403 $option->
setInfo(
$lng->txt(
"exc_peer_review_completion_one_info"));
1404 $peer_cmpl->addOption($option);
1406 $option->
setInfo(
$lng->txt(
"exc_peer_review_completion_all_info"));
1407 $peer_cmpl->addOption($option);
1408 $peer_cmpl->setRequired(
true);
1410 $form->addItem($peer_cmpl);
1414 $peer_dl->
setInfo(
$lng->txt(
"exc_peer_review_deadline_info"));
1415 $peer_dl->setShowTime(
true);
1416 $form->addItem($peer_dl);
1419 $peer_prsl->
setInfo(
$lng->txt(
"exc_peer_review_personal_info"));
1420 $form->addItem($peer_prsl);
1423 $rmd_feedback =
new ilCheckboxInputGUI($this->lng->txt(
"exc_reminder_feedback_setting"),
"rmd_peer_status");
1425 $rmd_submit_start =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_feedback_start"),
"rmd_peer_start");
1426 $rmd_submit_start->setSize(3);
1427 $rmd_submit_start->setMaxLength(3);
1428 $rmd_submit_start->setSuffix(
$lng->txt(
'days'));
1430 $rmd_submit_start->setMinValue(1);
1431 $rmd_feedback->
addSubItem($rmd_submit_start);
1433 $rmd_submit_frequency =
new ilNumberInputGUI($this->lng->txt(
"exc_reminder_frequency"),
"rmd_peer_freq");
1434 $rmd_submit_frequency->
setSize(3);
1435 $rmd_submit_frequency->setMaxLength(3);
1436 $rmd_submit_frequency->setSuffix(
$lng->txt(
'days'));
1437 $rmd_submit_frequency->setRequired(
true);
1438 $rmd_submit_frequency->setMinValue(1);
1439 $rmd_feedback->addSubItem($rmd_submit_frequency);
1443 $rmd_feedback->addSubItem($rmd_submit_end);
1447 $form->addItem($rmd_feedback);
1452 $form->addItem($cats);
1457 $cats->addOption($def);
1463 $peer_char->
setInfo(
$lng->txt(
"exc_peer_review_min_chars_info"));
1464 $peer_char->setSize(3);
1465 $peer_text->addSubItem($peer_char);
1471 $peer_file->
setInfo(
$lng->txt(
"exc_peer_review_file_info"));
1472 $def->addSubItem($peer_file);
1477 if (
sizeof($cat_objs)) {
1478 foreach ($cat_objs as $cat_obj) {
1482 if (
sizeof($crits)) {
1484 foreach ($crits as $crit) {
1485 $titles[] = $crit->getTitle();
1487 $opt =
new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1488 $opt->
setInfo(implode(
", ", $titles));
1489 $cats->addOption($opt);
1494 $url =
$ilCtrl->getLinkTargetByClass(
"ilexccriteriacataloguegui",
"");
1495 $def->setInfo(
'<a href="' .
$url .
'">[+] ' .
1496 $lng->txt(
"exc_add_criteria_catalogue") .
1501 $form->addCommandButton(
"updatePeerReview",
$lng->txt(
"save"));
1502 $form->addCommandButton(
"editAssignment",
$lng->txt(
"cancel"));
1514 $ilTabs->activateTab(
"peer_settings");
1516 if ($a_form === null) {
1520 $tpl->setContent($a_form->getHTML());
1527 if ($this->assignment->getPeerReviewDeadline() > 0) {
1531 $this->assignment->getId();
1534 if ($reminder->getReminderStatus()) {
1536 $values[
"rmd_peer_start"] = $reminder->getReminderStart();
1538 $values[
"rmd_peer_freq"] = $reminder->getReminderFrequency();
1539 $values[
"rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1542 $a_form->setValuesByArray($values);
1549 $a_form->
getItemByPostVar(
"peer_min")->setValue($this->assignment->getPeerReviewMin());
1550 $a_form->
getItemByPostVar(
"peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1551 $a_form->
getItemByPostVar(
"peer_unlock")->setValue((
int) $this->assignment->getPeerReviewSimpleUnlock());
1553 if ($this->enable_peer_review_completion) {
1554 $a_form->
getItemByPostVar(
"peer_valid")->setValue($this->assignment->getPeerReviewValid());
1557 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1562 $a_form->
getItemByPostVar(
"peer_text")->setChecked($this->assignment->hasPeerReviewText());
1563 $a_form->
getItemByPostVar(
"peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1564 $a_form->
getItemByPostVar(
"peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1565 if ($this->assignment->getPeerReviewChars() > 0) {
1566 $a_form->
getItemByPostVar(
"peer_char")->setValue($this->assignment->getPeerReviewChars());
1576 if ($peer_review->hasPeerReviewGroups()) {
1584 if ($this->enable_peer_review_completion) {
1596 $min->setValue($this->assignment->getPeerReviewMin());
1600 if ($a_force_set_values ||
1601 $peer_review->hasPeerReviewGroups()) {
1610 $protected_peer_review_groups =
false;
1612 if ($peer_review->hasPeerReviewGroups()) {
1613 $protected_peer_review_groups =
true;
1619 $time_deadline = $this->assignment->getDeadline();
1620 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1621 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1629 $reminder_date = $reminder_date
1634 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1636 ->setAlert(
$lng->txt(
"exc_peer_deadline_mismatch"));
1640 if (!$protected_peer_review_groups) {
1641 if ($a_form->
getInput(
"crit_cat") < 0 &&
1643 !$a_form->
getInput(
"peer_rating") &&
1646 ->setAlert(
$lng->txt(
"select_one"));
1653 $res[
"peer_dl"] = $time_peer;
1655 if ($protected_peer_review_groups) {
1656 $res[
"peer_min"] = $this->assignment->getPeerReviewMin();
1657 $res[
"peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1658 $res[
"peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1659 $res[
"peer_valid"] = $this->assignment->getPeerReviewValid();
1661 $res[
"peer_text"] = $this->assignment->hasPeerReviewText();
1662 $res[
"peer_rating"] = $this->assignment->hasPeerReviewRating();
1663 $res[
"peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1664 $res[
"peer_char"] = $this->assignment->getPeerReviewChars();
1665 $res[
"crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1667 $res[
"peer_valid"] = $this->enable_peer_review_completion
1668 ?
$res[
"peer_valid"]
1672 $res[
"peer_unlock"] = $a_form->
getInput(
"peer_unlock");
1677 $res[
"peer_rating"] = $a_form->
getInput(
"peer_rating");
1682 if ($a_form->
getInput(
"rmd_peer_status")) {
1683 $res[
"rmd_peer_status"] = $a_form->
getInput(
"rmd_peer_status");
1684 $res[
"rmd_peer_start"] = $a_form->
getInput(
"rmd_peer_start");
1685 $res[
"rmd_peer_end"] = $reminder_date;
1686 $res[
"rmd_peer_freq"] = $a_form->
getInput(
"rmd_peer_freq");
1687 $res[
"rmd_peer_template_id"] = $a_form->
getInput(
"rmd_peer_template_id");
1706 ? $a_input[
"peer_valid"]
1714 ? $a_input[
"crit_cat"]
1731 if (is_array($input)) {
1733 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1734 $ilCtrl->redirect($this,
"editPeerReview");
1737 $ilTabs->activateTab(
"peer_settings");
1739 $form->setValuesByPost();
1741 $tpl->setContent($form->getHtml());
1759 $number_of_teams = $a_num_teams;
1761 if ($number_of_teams) {
1762 $members_per_team = round($total_members / $a_num_teams);
1764 if ($a_min_participants) {
1765 $number_of_teams = round($total_members / $a_min_participants);
1766 $participants_extra_team = $total_members % $a_min_participants;
1767 if ($participants_extra_team > $number_of_teams) {
1769 $message = sprintf($this->lng->txt(
"exc_team_minimal_too_big"), $a_min_participants);
1770 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1773 $members_per_team = 0;
1776 if ($a_min_participants > $a_max_participants) {
1777 $message = $this->lng->txt(
"exc_team_min_big_than_max");
1778 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1781 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1782 $message = sprintf($this->lng->txt(
"exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1783 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"max_participants_team");
1786 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1787 $message = sprintf($this->lng->txt(
"exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1788 return array(
"status" =>
"error",
"msg" =>
$message,
"field" =>
"min_participants_team");
1791 return array(
"status" =>
"success",
"msg" =>
"");
1803 return count($exc_members->getMembers());
1813 if ($ass_type->usesTeams() &&
1816 $number_teams = $a_input[
'number_teams'];
1819 $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
setValue($a_value)
Set Value.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
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)
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.
setDeadline($a_val)
Set deadline (timestamp)
foreach($_POST as $key=> $value) $res
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.
setPeerReviewText($a_val)
Set peer review text.
handleGlobalFeedbackFileUpload(array $a_file)
setReminderFrequency($a_num_days)
Set frequency in days.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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.
This class represents a non editable value in a property form.
setFeedbackDate($a_value)
Set (global) feedback file availability date.
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
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)
setRelDeadlineLastSubmission($a_val)
Set relative deadline last submission.
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.