ILIAS  release_8 Revision v8.24
ilExAssignmentEditorGUI Class Reference

Class ilExAssignmentEditorGUI. More...

+ Collaboration diagram for ilExAssignmentEditorGUI:

Public Member Functions

 executeCommand ()
 
 listAssignmentsObject ()
 
 addAssignmentObject ()
 Create assignment. More...
 
 saveAssignmentObject ()
 
 editAssignmentObject ()
 
 getAssignmentValues (ilPropertyFormGUI $a_form)
 
 updateAssignmentObject ()
 
 confirmAssignmentsDeletionObject ()
 
 deleteAssignmentsObject ()
 
 saveAssignmentOrderObject ()
 
 orderAssignmentsByDeadlineObject ()
 
 setAssignmentHeader ()
 
 downloadGlobalFeedbackFileObject ()
 
 editPeerReviewObject (ilPropertyFormGUI $a_form=null)
 
 validationTeamsFormation (int $a_num_teams, int $a_min_participants, int $a_max_participants)
 
 getExerciseTotalMembers ()
 
 generateTeams (ilExAssignment $a_assignment, array $a_input)
 

Protected Member Functions

 getTypeDropdown ()
 
 initAssignmentForm (int $a_type, string $a_mode="create")
 
 processForm (ilPropertyFormGUI $a_form)
 Custom form validation. More...
 
 importFormToAssignment (ilExAssignment $a_ass, array $a_input)
 Import form values to assignment. More...
 
 importFormToAssignmentReminders (array $a_input, int $a_ass_id)
 
 importPeerReviewFormToAssignmentReminders (array $a_input, int $a_ass_id)
 
 saveReminderData (ilExAssignmentReminder $reminder, array $a_input)
 
 setDisabledFieldValues (ilPropertyFormGUI $a_form)
 
 handleDisabledFields (ilPropertyFormGUI $a_form, bool $a_force_set_values=false)
 
 initPeerReviewForm ()
 
 getPeerReviewValues (\ilPropertyFormGUI $a_form)
 
 setDisabledPeerReviewFieldValues (ilPropertyFormGUI $a_form)
 
 handleDisabledPeerFields (ilPropertyFormGUI $a_form, bool $a_force_set_values=false)
 
 processPeerReviewForm (ilPropertyFormGUI $a_form)
 
 importPeerReviewFormToAssignment (ilExAssignment $a_ass, array $a_input)
 
 updatePeerReviewObject ()
 

Protected Attributes

ilCtrl $ctrl
 
ilTabsGUI $tabs
 
ilLanguage $lng
 
ilGlobalPageTemplate $tpl
 
ilToolbarGUI $toolbar
 
ilSetting $settings
 
ilHelpGUI $help
 
int $exercise_id
 
ilExAssignment $assignment
 
bool $enable_peer_review_completion
 
ilExAssignmentTypes $types
 
Mandatory RandomAssignmentsManager $random_manager
 
ilObjExercise $exc
 
ilExAssignmentTypesGUI $type_guis
 
string $requested_ass_type
 
int $requested_type
 
array $requested_ass_ids
 
array $requested_order
 

Detailed Description

Member Function Documentation

◆ addAssignmentObject()

ilExAssignmentEditorGUI::addAssignmentObject ( )

Create assignment.

Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 164 of file class.ilExAssignmentEditorGUI.php.

164 : void
165 {
167 $ilCtrl = $this->ctrl;
168
169 // #16163 - ignore ass id from request
170 $this->assignment = null;
171
172 if ($this->requested_type == 0) {
173 $ilCtrl->redirect($this, "listAssignments");
174 }
175
176 $form = $this->initAssignmentForm($this->requested_type, "create");
177 $tpl->setContent($form->getHTML());
178 }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
initAssignmentForm(int $a_type, string $a_mode="create")
setContent(string $a_html)
Sets content for standard template.

References $ctrl, $tpl, initAssignmentForm(), ilCtrl\redirect(), and ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ confirmAssignmentsDeletionObject()

ilExAssignmentEditorGUI::confirmAssignmentsDeletionObject ( )

Definition at line 1184 of file class.ilExAssignmentEditorGUI.php.

1184 : void
1185 {
1186 $ilCtrl = $this->ctrl;
1187 $tpl = $this->tpl;
1188 $lng = $this->lng;
1189
1190 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class, "ass_id", null);
1191 if (count($this->requested_ass_ids) == 0) {
1192 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1193 $ilCtrl->redirect($this, "listAssignments");
1194 } else {
1195 $cgui = new ilConfirmationGUI();
1196 $cgui->setFormAction($ilCtrl->getFormAction($this));
1197 $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
1198 $cgui->setCancel($lng->txt("cancel"), "listAssignments");
1199 $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
1200
1201 foreach ($this->requested_ass_ids as $i) {
1202 $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
1203 }
1204
1205 $tpl->setContent($cgui->getHTML());
1206 }
1207 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTitle(int $a_id)
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...
$i
Definition: metadata.php:41

References $i, $lng, $tpl, and ilExAssignment\lookupTitle().

+ Here is the call graph for this function:

◆ deleteAssignmentsObject()

ilExAssignmentEditorGUI::deleteAssignmentsObject ( )
Exceptions
ilExcUnknownAssignmentTypeException
ilDateTimeException

Definition at line 1213 of file class.ilExAssignmentEditorGUI.php.

1213 : void
1214 {
1215 $ilCtrl = $this->ctrl;
1216 $lng = $this->lng;
1217
1218 $delete = false;
1219 foreach ($this->requested_ass_ids as $id) {
1221 $ass->delete($this->exc);
1222 $delete = true;
1223 }
1224
1225 if ($delete) {
1226 $this->tpl->setOnScreenMessage('success', $lng->txt("exc_assignments_deleted"), true);
1227 }
1228 $ilCtrl->setParameter($this, "ass_id", "");
1229 $ilCtrl->redirect($this, "listAssignments");
1230 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Exercise assignment.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References $id, $lng, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExAssignmentEditorGUI::downloadGlobalFeedbackFileObject ( )

Definition at line 1298 of file class.ilExAssignmentEditorGUI.php.

1298 : void
1299 {
1300 $ilCtrl = $this->ctrl;
1301
1302 if (!$this->assignment ||
1303 !$this->assignment->getFeedbackFile()) {
1304 $ilCtrl->redirect($this, "returnToParent");
1305 }
1306
1307 ilFileDelivery::deliverFileLegacy($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
1308 }
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)

References ilFileDelivery\deliverFileLegacy().

+ Here is the call graph for this function:

◆ editAssignmentObject()

ilExAssignmentEditorGUI::editAssignmentObject ( )
Exceptions
ilExcUnknownAssignmentTypeException
ilDateTimeException

Definition at line 982 of file class.ilExAssignmentEditorGUI.php.

982 : void
983 {
984 $ilTabs = $this->tabs;
986
987 $this->setAssignmentHeader();
988 $ilTabs->activateTab("ass_settings");
989
990 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
991 $this->getAssignmentValues($form);
992 $tpl->setContent($form->getHTML());
993 }
getAssignmentValues(ilPropertyFormGUI $a_form)

References $tpl.

◆ editPeerReviewObject()

ilExAssignmentEditorGUI::editPeerReviewObject ( ilPropertyFormGUI  $a_form = null)
Exceptions
ilDateTimeException

Definition at line 1451 of file class.ilExAssignmentEditorGUI.php.

1451 : void
1452 {
1453 $ilTabs = $this->tabs;
1454 $tpl = $this->tpl;
1455
1456 $this->setAssignmentHeader();
1457 $ilTabs->activateTab("peer_settings");
1458
1459 if ($a_form === null) {
1460 $a_form = $this->initPeerReviewForm();
1461 $this->getPeerReviewValues($a_form);
1462 }
1463 $tpl->setContent($a_form->getHTML());
1464 }
getPeerReviewValues(\ilPropertyFormGUI $a_form)

References $tpl, and ilPropertyFormGUI\getHTML().

+ Here is the call graph for this function:

◆ executeCommand()

ilExAssignmentEditorGUI::executeCommand ( )
Exceptions
ilCtrlException|ilExcUnknownAssignmentTypeException

Definition at line 89 of file class.ilExAssignmentEditorGUI.php.

89 : void
90 {
91 $ilCtrl = $this->ctrl;
92 $ilTabs = $this->tabs;
94
95 $class = $ilCtrl->getNextClass($this);
96 $cmd = $ilCtrl->getCmd("listAssignments");
97
98 switch ($class) {
99 case "ilpropertyformgui":
100 $form = $this->initAssignmentForm($this->requested_ass_type);
101 $ilCtrl->forwardCommand($form);
102 break;
103
104 // instruction files
105 case "ilexassignmentfilesystemgui":
106 $this->setAssignmentHeader();
107 $ilTabs->activateTab("ass_files");
108
109 $fstorage = new ilFSWebStorageExercise($this->exercise_id, $this->assignment->getId());
110 $fstorage->create();
111 $fs_gui = new ilExAssignmentFileSystemGUI($fstorage->getAbsolutePath());
112 $fs_gui->setTitle($lng->txt("exc_instruction_files"));
113 $fs_gui->setTableId("excassfil" . $this->assignment->getId());
114 $fs_gui->setAllowDirectories(false);
115 $ilCtrl->forwardCommand($fs_gui);
116 break;
117
118 case "ilexpeerreviewgui":
119 $ilTabs->clearTargets();
120 $ilTabs->setBackTarget(
121 $lng->txt("back"),
122 $ilCtrl->getLinkTarget($this, "listAssignments")
123 );
124
125 $peer_gui = new ilExPeerReviewGUI($this->assignment);
126 $ilCtrl->forwardCommand($peer_gui);
127 break;
128
129 default:
130 $this->{$cmd . "Object"}();
131 break;
132 }
133 }
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $ctrl, $lng, $tabs, initAssignmentForm(), setAssignmentHeader(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ generateTeams()

ilExAssignmentEditorGUI::generateTeams ( ilExAssignment  $a_assignment,
array  $a_input 
)

Definition at line 1759 of file class.ilExAssignmentEditorGUI.php.

1762 : void {
1763 $ass_type = $a_assignment->getAssignmentType();
1764 if ($ass_type->usesTeams() &&
1765 $a_input['team_creator'] == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
1766 if ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
1767 $number_teams = $a_input['number_teams'];
1768 if (count(ilExAssignmentTeam::getAssignmentTeamMap($a_assignment->getId())) == 0) {
1769 $ass_team = new ilExAssignmentTeam();
1770 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->getId(), $number_teams, $a_input['min_participants_team']);
1771 }
1772 } elseif ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
1773 ilExAssignmentTeam::adoptTeams($a_input["ass_adpt"], $a_assignment->getId());
1774 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exc_teams_assignment_adopted"), true);
1775 }
1776 }
1777 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static adoptTeams(int $a_source_ass_id, int $a_target_ass_id, int $a_user_id=null, int $a_exc_ref_id=null)
static getAssignmentTeamMap(int $a_ass_id)

References ilExAssignmentTeam\adoptTeams(), ilExAssignmentTeam\getAssignmentTeamMap(), ilExAssignment\getId(), ILIAS\Repository\lng(), ilExAssignment\TEAMS_FORMED_BY_ASSIGNMENT, and ilExAssignment\TEAMS_FORMED_BY_RANDOM.

+ Here is the call graph for this function:

◆ getAssignmentValues()

ilExAssignmentEditorGUI::getAssignmentValues ( ilPropertyFormGUI  $a_form)
Exceptions
ilDateTimeException
ilExcUnknownAssignmentTypeException

Definition at line 999 of file class.ilExAssignmentEditorGUI.php.

999 : void
1000 {
1001 $lng = $this->lng;
1002 $ilCtrl = $this->ctrl;
1003
1004 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1005
1006 $values = array();
1007 $values["type"] = $this->assignment->getType();
1008 $values["title"] = $this->assignment->getTitle();
1009 $values["mandatory"] = $this->assignment->getMandatory();
1010 $values["instruction"] = $this->assignment->getInstruction();
1011 if ($this->assignment->getStartTime()) {
1012 $values["start_time"] = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
1013 }
1014
1015 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1016 if ($this->assignment->getMaxFile()) {
1017 $values["max_file_tgl"] = true;
1018 $values["max_file"] = $this->assignment->getMaxFile();
1019 }
1020 }
1021
1022 if ($this->assignment->getAssignmentType()->usesTeams()) {
1023 $values["team_creator"] = (string) (int) $this->assignment->getTeamTutor();
1024 $values["team_creation"] = "0";
1025 }
1026
1027 if ($this->assignment->getFeedbackDateCustom()) {
1028 $values["fb_date_custom"] = new ilDateTime($this->assignment->getFeedbackDateCustom(), IL_CAL_UNIX);
1029 }
1030
1031 //Reminders
1032 $rmd_sub = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::SUBMIT_REMINDER);
1033 if ($rmd_sub->getReminderStatus()) {
1034 $values["rmd_submit_status"] = $rmd_sub->getReminderStatus();
1035 $values["rmd_submit_start"] = $rmd_sub->getReminderStart();
1036 $values["rmd_submit_end"] = new ilDateTime($rmd_sub->getReminderEnd(), IL_CAL_UNIX);
1037 $values["rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1038 $values["rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1039 }
1040
1041 $rmd_grade = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::GRADE_REMINDER);
1042 if ($rmd_grade->getReminderStatus()) {
1043 $values["rmd_grade_status"] = $rmd_grade->getReminderStatus();
1044 $values["rmd_grade_end"] = new ilDateTime($rmd_grade->getReminderEnd(), IL_CAL_UNIX);
1045 $values["rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1046 $values["rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1047 }
1048
1049 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1050 $values = array_merge($values, $type_values);
1051
1052
1053 $values["deadline_mode"] = $this->assignment->getDeadlineMode();
1054 $values["relative_deadline"] = $this->assignment->getRelativeDeadline();
1055 $dt = new ilDateTime($this->assignment->getRelDeadlineLastSubmission(), IL_CAL_UNIX);
1056 $values["rel_deadline_last_subm"] = $dt->get(IL_CAL_DATETIME);
1057
1058
1059 $a_form->setValuesByArray($values);
1060
1061 // global feedback
1062 if ($this->assignment->getFeedbackFile()) {
1063 $a_form->getItemByPostVar("fb")->setChecked(true);
1064 $a_form->getItemByPostVar("fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1065 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
1066 $a_form->getItemByPostVar("fb_file")->setInfo(
1067 // #16400
1068 '<a href="' . $ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile") . '">' .
1069 $lng->txt("download") . '</a>'
1070 );
1071 }
1072 $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1073 $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
1074
1075 $this->handleDisabledFields($a_form, true);
1076 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
handleDisabledFields(ilPropertyFormGUI $a_form, bool $a_force_set_values=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
getItemByPostVar(string $a_post_var)

References $lng, ilPropertyFormGUI\getItemByPostVar(), ilExAssignmentReminder\GRADE_REMINDER, IL_CAL_DATETIME, IL_CAL_UNIX, ilPropertyFormGUI\setValuesByArray(), and ilExAssignmentReminder\SUBMIT_REMINDER.

+ Here is the call graph for this function:

◆ getExerciseTotalMembers()

ilExAssignmentEditorGUI::getExerciseTotalMembers ( )

Definition at line 1751 of file class.ilExAssignmentEditorGUI.php.

1751 : int
1752 {
1753 $exercise = new ilObjExercise($this->exercise_id, false);
1754 $exc_members = new ilExerciseMembers($exercise);
1755
1756 return count($exc_members->getMembers());
1757 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjExercise.

References $exercise.

◆ getPeerReviewValues()

ilExAssignmentEditorGUI::getPeerReviewValues ( \ilPropertyFormGUI  $a_form)
protected
Exceptions
ilDateTimeException

Definition at line 1469 of file class.ilExAssignmentEditorGUI.php.

1469 : void
1470 {
1471 $values = array();
1472
1473 if ($this->assignment->getPeerReviewDeadline() > 0) {
1474 $values["peer_dl"] = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1475 }
1476
1477 $reminder = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::FEEDBACK_REMINDER);
1478 if ($reminder->getReminderStatus()) {
1479 $values["rmd_peer_status"] = $reminder->getReminderStatus();
1480 $values["rmd_peer_start"] = $reminder->getReminderStart();
1481 $values["rmd_peer_end"] = new ilDateTime($reminder->getReminderEnd(), IL_CAL_UNIX);
1482 $values["rmd_peer_freq"] = $reminder->getReminderFrequency();
1483 $values["rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1484 }
1485
1486 $a_form->setValuesByArray($values);
1487
1488 $this->handleDisabledPeerFields($a_form, true);
1489 }
handleDisabledPeerFields(ilPropertyFormGUI $a_form, bool $a_force_set_values=false)

References ilExAssignmentReminder\FEEDBACK_REMINDER, IL_CAL_UNIX, and ilPropertyFormGUI\setValuesByArray().

+ Here is the call graph for this function:

◆ getTypeDropdown()

ilExAssignmentEditorGUI::getTypeDropdown ( )
protected
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 183 of file class.ilExAssignmentEditorGUI.php.

184 {
186
187 $types = [];
188 foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
189 $types[$k] = $t->getTitle();
190 }
191
192 $ty = new ilSelectInputGUI($lng->txt("exc_assignment_type"), "type");
193 $ty->setOptions($types);
194 $ty->setRequired(true);
195 return $ty;
196 }
This class represents a selection list property in a property form.

References $lng, $types, and ilLanguage\txt().

Referenced by listAssignmentsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleDisabledFields()

ilExAssignmentEditorGUI::handleDisabledFields ( ilPropertyFormGUI  $a_form,
bool  $a_force_set_values = false 
)
protected
Exceptions
ilDateTimeException

Definition at line 1104 of file class.ilExAssignmentEditorGUI.php.

1107 : void {
1108 // potentially disabled elements are initialized here to re-use this
1109 // method after setValuesByPost() - see updateAssignmentObject()
1110
1111 // team assignments do not support peer review
1112 // with no active peer review there is nothing to protect
1113 $peer_review = null;
1114 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1115 $this->assignment->getPeerReview()) {
1116 // #14450
1117 $peer_review = new ilExPeerReview($this->assignment);
1118 if ($peer_review->hasPeerReviewGroups()) {
1119 // deadline(s) are past and must not change
1120 $a_form->getItemByPostVar("deadline")->setDisabled(true);
1121 $a_form->getItemByPostVar("deadline2")->setDisabled(true);
1122
1123 $a_form->getItemByPostVar("peer")->setDisabled(true);
1124
1125 $a_form->getItemByPostVar("deadline_mode")->setDisabled(true);
1126 }
1127 }
1128
1129 if ($a_force_set_values ||
1130 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1131 $this->setDisabledFieldValues($a_form);
1132 }
1133 }
setDisabledFieldValues(ilPropertyFormGUI $a_form)
Exercise peer review.

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ handleDisabledPeerFields()

ilExAssignmentEditorGUI::handleDisabledPeerFields ( ilPropertyFormGUI  $a_form,
bool  $a_force_set_values = false 
)
protected

Definition at line 1516 of file class.ilExAssignmentEditorGUI.php.

1519 : void {
1520 // #14450
1521 $peer_review = new ilExPeerReview($this->assignment);
1522 if ($peer_review->hasPeerReviewGroups()) {
1523 // JourFixe, 2015-05-11 - editable again
1524 // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1525
1526 $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1527 $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1528 $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1529
1530 if ($this->enable_peer_review_completion) {
1531 $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1532 }
1533
1534 $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1535 $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1536 $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1537 $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1538 $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1539
1540 // required number input is a problem
1541 $min = new ilHiddenInputGUI("peer_min");
1542 $min->setValue($this->assignment->getPeerReviewMin());
1543 $a_form->addItem($min);
1544 }
1545
1546 if ($a_force_set_values ||
1547 $peer_review->hasPeerReviewGroups()) {
1548 $this->setDisabledPeerReviewFieldValues($a_form);
1549 }
1550 }
setDisabledPeerReviewFieldValues(ilPropertyFormGUI $a_form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilPropertyFormGUI\addItem(), and ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ importFormToAssignment()

ilExAssignmentEditorGUI::importFormToAssignment ( ilExAssignment  $a_ass,
array  $a_input 
)
protected

Import form values to assignment.

Exceptions
ilDateTimeException
ilException

Definition at line 825 of file class.ilExAssignmentEditorGUI.php.

828 : void {
829 $is_create = !(bool) $a_ass->getId();
830
831 $a_ass->setTitle($a_input["title"]);
832 $a_ass->setInstruction($a_input["instruction"]);
833 if (!$this->random_manager->isActivated()) {
834 $a_ass->setMandatory($a_input["mandatory"]);
835 }
836
837 $a_ass->setStartTime($a_input["start"]);
838 $a_ass->setDeadline($a_input["deadline"]);
839 $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
840 $a_ass->setDeadlineMode($a_input["deadline_mode"]);
841 $a_ass->setRelativeDeadline((int) ($a_input["relative_deadline"] ?? 0));
842 $a_ass->setRelDeadlineLastSubmission((int) ($a_input["rel_deadline_last_subm"] ?? 0));
843
844 $a_ass->setMaxFile($a_input["max_file"]);
845 $a_ass->setTeamTutor((bool) ($a_input["team_creator"] ?? false));
846
847 //$a_ass->setPortfolioTemplateId($a_input['template_id']);
848
849 //$a_ass->setMinCharLimit($a_input['min_char_limit']);
850 //$a_ass->setMaxCharLimit($a_input['max_char_limit']);
851
852 if (!$this->random_manager->isActivated()) {
853 $a_ass->setPeerReview((bool) ($a_input["peer"] ?? false));
854 }
855
856 // peer review default values (on separate form)
857 if ($is_create) {
858 $a_ass->setPeerReviewMin(2);
859 $a_ass->setPeerReviewSimpleUnlock(false);
861 $a_ass->setPeerReviewPersonalized(false);
862 $a_ass->setPeerReviewFileUpload(false);
863 $a_ass->setPeerReviewText(true);
864 $a_ass->setPeerReviewRating(true);
865 }
866
867 if (isset($a_input["fb"])) {
868 $a_ass->setFeedbackCron((bool) $a_input["fb_cron"]); // #13380
869 $a_ass->setFeedbackDate((int) $a_input["fb_date"]);
870 $a_ass->setFeedbackDateCustom((int) $a_input["fb_date_custom"]);
871 }
872
873 // id needed for file handling
874 if ($is_create) {
875 $a_ass->save();
876
877 // #15994 - assignment files
878 if (is_array($a_input["files"])) {
879 $a_ass->uploadAssignmentFiles($a_input["files"]);
880 }
881 } else {
882 // remove global feedback file?
883 if (!isset($a_input["fb"])) {
884 $a_ass->deleteGlobalFeedbackFile();
885 $a_ass->setFeedbackFile(null);
886 }
887
888 $a_ass->update();
889 }
890
891 // add global feedback file?
892 if (isset($a_input["fb"], $a_input["fb_file"])) {
893 $a_ass->handleGlobalFeedbackFileUpload($a_input["fb_file"]);
894 $a_ass->update();
895 }
896 $this->importFormToAssignmentReminders($a_input, $a_ass->getId());
897 }
importFormToAssignmentReminders(array $a_input, int $a_ass_id)
setTeamTutor(bool $a_value)
uploadAssignmentFiles(array $a_files)
Upload assignment files (from creation form)
setRelativeDeadline(int $a_val)
setPeerReviewMin(int $a_value)
setDeadline(?int $a_val)
setExtendedDeadline(?int $a_val)
setPeerReviewText(bool $a_val)
setPeerReview(bool $a_value)
handleGlobalFeedbackFileUpload(array $a_file)
setStartTime(?int $a_val)
setDeadlineMode(int $a_val)
Set deadline mode.
setFeedbackCron(bool $a_value)
Toggle (global) feedback file cron.
setPeerReviewValid(int $a_value)
Set peer review validation.
setPeerReviewPersonalized(bool $a_val)
setInstruction(string $a_val)
setTitle(string $a_val)
setRelDeadlineLastSubmission(int $a_val)
setFeedbackFile(?string $a_value)
setPeerReviewSimpleUnlock(bool $a_value)
setPeerReviewRating(bool $a_val)
setFeedbackDateCustom(int $a_value)
Set (global) feedback file availability using a custom date.
setFeedbackDate(int $a_value)
setMaxFile(?int $a_value)
setMandatory(bool $a_val)
setPeerReviewFileUpload(bool $a_val)

References ilExAssignment\setMandatory().

+ Here is the call graph for this function:

◆ importFormToAssignmentReminders()

ilExAssignmentEditorGUI::importFormToAssignmentReminders ( array  $a_input,
int  $a_ass_id 
)
protected

Definition at line 899 of file class.ilExAssignmentEditorGUI.php.

902 : void {
903 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::SUBMIT_REMINDER);
904 $this->saveReminderData($reminder, $a_input);
905
906 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::GRADE_REMINDER);
907 $this->saveReminderData($reminder, $a_input);
908 }
saveReminderData(ilExAssignmentReminder $reminder, array $a_input)

◆ importPeerReviewFormToAssignment()

ilExAssignmentEditorGUI::importPeerReviewFormToAssignment ( ilExAssignment  $a_ass,
array  $a_input 
)
protected
Exceptions
ilDateTimeException

Definition at line 1652 of file class.ilExAssignmentEditorGUI.php.

1655 : void {
1656 $a_ass->setPeerReviewMin((int) $a_input["peer_min"]);
1657 $a_ass->setPeerReviewDeadline((int) $a_input["peer_dl"]);
1658 $a_ass->setPeerReviewSimpleUnlock((bool) $a_input["peer_unlock"]);
1659 $a_ass->setPeerReviewPersonalized((bool) $a_input["peer_prsl"]);
1660
1661 // #18964
1662 $a_ass->setPeerReviewValid($a_input["peer_valid"]
1664
1665 $a_ass->setPeerReviewFileUpload((bool) $a_input["peer_file"]);
1666 $a_ass->setPeerReviewChars((int) $a_input["peer_char"]);
1667 $a_ass->setPeerReviewText((bool) $a_input["peer_text"]);
1668 $a_ass->setPeerReviewRating((bool) $a_input["peer_rating"]);
1669 $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1670 ? (int) $a_input["crit_cat"]
1671 : null);
1672
1673 $a_ass->update();
1674
1675 $this->importPeerReviewFormToAssignmentReminders($a_input, $a_ass->getId());
1676 }
importPeerReviewFormToAssignmentReminders(array $a_input, int $a_ass_id)
setPeerReviewCriteriaCatalogue(?int $a_value)
setPeerReviewChars(?int $a_value)
setPeerReviewDeadline(int $a_val)

◆ importPeerReviewFormToAssignmentReminders()

ilExAssignmentEditorGUI::importPeerReviewFormToAssignmentReminders ( array  $a_input,
int  $a_ass_id 
)
protected

Definition at line 911 of file class.ilExAssignmentEditorGUI.php.

914 : void {
915 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::FEEDBACK_REMINDER);
916 $this->saveReminderData($reminder, $a_input);
917 }

◆ initAssignmentForm()

ilExAssignmentEditorGUI::initAssignmentForm ( int  $a_type,
string  $a_mode = "create" 
)
protected
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 201 of file class.ilExAssignmentEditorGUI.php.

206 $ilCtrl = $this->ctrl;
207
208 $ass_type = $this->types->getById($a_type);
209 $ass_type_gui = $this->type_guis->getById($a_type);
210 $ilCtrl->setParameter($this, "ass_type", $a_type);
211
212 $lng->loadLanguageModule("form");
213 $form = new ilPropertyFormGUI();
214 if ($a_mode == "edit") {
215 $form->setTitle($lng->txt("exc_edit_assignment"));
216 } else {
217 $form->setTitle($lng->txt("exc_new_assignment"));
218 }
219 $form->setFormAction($ilCtrl->getFormAction($this));
220
221 // title
222 $ti = new ilTextInputGUI($lng->txt("title"), "title");
223 $ti->setMaxLength(200);
224 $ti->setRequired(true);
225 $form->addItem($ti);
226
227 // type
228 $ty = $this->getTypeDropdown();
229 $ty->setValue($a_type);
230 $ty->setDisabled(true);
231 $form->addItem($ty);
232
233 //
234 // type specific start
235 //
236
237 $ass_type_gui->addEditFormCustomProperties($form);
238
239 //
240 // type specific end
241 //
242
243 if ($ass_type->usesTeams()) {
244 if ($a_mode == "edit") {
245 $has_teams = (bool) count(ilExAssignmentTeam::getAssignmentTeamMap($this->assignment->getId()));
246 } else {
247 $has_teams = false;
248 }
249
250 // Radio for creators
251 $rd_team = new ilRadioGroupInputGUI($lng->txt("exc_team_formation"), "team_creator");
252 $rd_team->setValue((string) ilExAssignment::TEAMS_FORMED_BY_PARTICIPANTS);
253
254 $radio_participants = new ilRadioOption(
255 $lng->txt("exc_team_by_participants"),
257 $lng->txt("exc_team_by_participants_info")
258 );
259
260 $radio_tutors = new ilRadioOption(
261 $lng->txt("exc_team_by_tutors"),
263 $lng->txt("exc_team_by_tutors_info")
264 );
265
266 #23679
267 if (!$has_teams) {
268 // Creation options
269 $rd_creation_method = new ilRadioGroupInputGUI($lng->txt("exc_team_creation"), "team_creation");
270 $rd_creation_method->setRequired(true);
271 $rd_creation_method->setValue("0");
272
273 //manual
274 $rd_creation_manual = new ilRadioOption(
275 $lng->txt("exc_team_by_tutors_manual"),
276 "0",
277 $lng->txt("exc_team_by_tutors_manual_info")
278 );
279 $rd_creation_method->addOption($rd_creation_manual);
280
281 //random options
282 $add_info = "";
283 if ($this->getExerciseTotalMembers() < 4) {
284 $add_info = " <strong>" . $lng->txt("exc_team_by_random_add_info") . "</strong>";
285 }
286 $rd_creation_random = new ilRadioOption(
287 $lng->txt("exc_team_by_random"),
289 $lng->txt("exc_team_by_random_info") . "<br>" . $lng->txt("exc_total_members") . ": " . $this->getExerciseTotalMembers() . $add_info
290 );
291 $rd_creation_method->addOption($rd_creation_random);
292
293 $number_teams = new ilNumberInputGUI($lng->txt("exc_num_teams"), "number_teams");
294 $number_teams->setSize(3);
295 $number_teams->setMinValue(1);
296 $number_teams->setMaxValue($this->getExerciseTotalMembers());
297 $number_teams->setRequired(true);
298 $number_teams->setSuffix($lng->txt("exc_team_assignment_adopt_teams"));
299 $rd_creation_random->addSubItem($number_teams);
300
301 $min_team_participants = new ilNumberInputGUI($lng->txt("exc_min_team_participants"), "min_participants_team");
302 $min_team_participants->setSize(3);
303 $min_team_participants->setMinValue(1);
304 $min_team_participants->setMaxValue($this->getExerciseTotalMembers());
305 $min_team_participants->setRequired(true);
306 $min_team_participants->setSuffix($lng->txt("exc_participants"));
307 $rd_creation_random->addSubItem($min_team_participants);
308
309 $max_team_participants = new ilNumberInputGUI($lng->txt("exc_max_team_participants"), "max_participants_team");
310 $max_team_participants->setSize(3);
311 $max_team_participants->setMinValue(1);
312 $max_team_participants->setMaxValue($this->getExerciseTotalMembers());
313 $max_team_participants->setRequired(true);
314 $max_team_participants->setSuffix($lng->txt("exc_participants"));
315 $rd_creation_random->addSubItem($max_team_participants);
316
317 $options = ilExAssignmentTeam::getAdoptableTeamAssignments($this->exercise_id);
318 if (count($options)) {
319 $radio_assignment = new ilRadioOption(
320 $lng->txt("exc_team_by_assignment"),
322 $lng->txt("exc_team_by_assignment_info")
323 );
324
325 $radio_assignment_adopt = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
326 $radio_assignment_adopt->setRequired(true);
327 $radio_assignment_adopt->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1));
328
329 foreach ($options as $id => $item) {
330 $option = new ilRadioOption($item["title"], $id);
331 $option->setInfo($lng->txt("exc_team_assignment_adopt_teams") . ": " . $item["teams"]);
332 $radio_assignment_adopt->addOption($option);
333 }
334 $radio_assignment->addSubItem($radio_assignment_adopt);
335 $rd_creation_method->addOption($radio_assignment);
336 }
337
338 $radio_tutors->addSubItem($rd_creation_method);
339 }
340 $rd_team->addOption($radio_participants);
341 $rd_team->addOption($radio_tutors);
342 /*if(!$has_teams) {
343 $rd_team->addOption($radio_assignment);
344 }*/
345 $form->addItem($rd_team);
346
347 if ($has_teams) {
348 $rd_team->setDisabled(true);
349 }
350 }
351
352 // mandatory
353 if (!$this->random_manager->isActivated()) {
354 $cb = new ilCheckboxInputGUI($lng->txt("exc_mandatory"), "mandatory");
355 $cb->setInfo($lng->txt("exc_mandatory_info"));
356 $cb->setChecked(true);
357 $form->addItem($cb);
358 } else {
359 //
360 $ne = new ilNonEditableValueGUI($lng->txt("exc_mandatory"), "");
361 $ne->setValue($lng->txt("exc_mandatory_rand_determined"));
362 $form->addItem($ne);
363 }
364
365 // Work Instructions
366 $sub_header = new ilFormSectionHeaderGUI();
367 $sub_header->setTitle($lng->txt("exc_work_instructions"));
368 $form->addItem($sub_header);
369
370 $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
371 $desc_input->setRows(20);
372 if (ilObjAdvancedEditing::_getRichTextEditor() === "tinymce") {
373 $desc_input->setUseRte(true);
374 $desc_input->setRteTagSet("mini");
375 }
376 $form->addItem($desc_input);
377
378 // files
379 if ($a_mode == "create") {
380 $files = new ilFileWizardInputGUI($lng->txt('objs_file'), 'files');
381 $files->setFilenames(array(0 => ''));
382 $form->addItem($files);
383 }
384
385 // Schedule
386 $sub_header = new ilFormSectionHeaderGUI();
387 $sub_header->setTitle($lng->txt("exc_schedule"));
388 $form->addItem($sub_header);
389
390 // start time
391 $start_date = new ilDateTimeInputGUI($lng->txt("exc_start_time"), "start_time");
392 $start_date->setShowTime(true);
393 $form->addItem($start_date);
394
395 // Deadline Mode
396 $radg = new ilRadioGroupInputGUI($lng->txt("exc_deadline"), "deadline_mode");
397 $radg->setValue(0);
398 $op1 = new ilRadioOption($lng->txt("exc_fixed_date"), 0, $lng->txt("exc_fixed_date_info"));
399 $radg->addOption($op1);
400 $op2 = new ilRadioOption($lng->txt("exc_relative_date"), 1, $lng->txt("exc_relative_date_info"));
401 $radg->addOption($op2);
402 $form->addItem($radg);
403
404 // Deadline fixed date
405 $deadline = new ilDateTimeInputGUI($lng->txt("date"), "deadline");
406 $deadline->setShowTime(true);
407 $op1->addSubItem($deadline);
408
409 // extended Deadline
410 $deadline2 = new ilDateTimeInputGUI($lng->txt("exc_deadline_extended"), "deadline2");
411 $deadline2->setInfo($lng->txt("exc_deadline_extended_info"));
412 $deadline2->setShowTime(true);
413 $deadline->addSubItem($deadline2);
414
415
416 // submit reminder
417 $rmd_submit = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_submit_setting"), "rmd_submit_status");
418
419 $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_start"), "rmd_submit_start");
420 $rmd_submit_start->setSize(3);
421 $rmd_submit_start->setMaxLength(3);
422 $rmd_submit_start->setSuffix($lng->txt('days'));
423 $rmd_submit_start->setInfo($this->lng->txt("exc_reminder_start_info"));
424 $rmd_submit_start->setRequired(true);
425 $rmd_submit_start->setMinValue(1);
426 $rmd_submit->addSubItem($rmd_submit_start);
427
428 $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_submit_freq");
429 $rmd_submit_frequency->setSize(3);
430 $rmd_submit_frequency->setMaxLength(3);
431 $rmd_submit_frequency->setSuffix($lng->txt('days'));
432 $rmd_submit_frequency->setRequired(true);
433 $rmd_submit_frequency->setMinValue(1);
434 $rmd_submit->addSubItem($rmd_submit_frequency);
435
436 $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_submit_end");
437 $rmd_submit_end->setRequired(true);
438 $rmd_submit->addSubItem($rmd_submit_end);
439
440 $rmd_submit->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::SUBMIT_REMINDER));
441
442 // grade reminder
443 $rmd_grade = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_grade_setting"), "rmd_grade_status");
444
445 $rmd_grade_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_grade_freq");
446 $rmd_grade_frequency->setSize(3);
447 $rmd_grade_frequency->setMaxLength(3);
448 $rmd_grade_frequency->setSuffix($lng->txt('days'));
449 $rmd_grade_frequency->setRequired(true);
450 $rmd_grade_frequency->setMinValue(1);
451 $rmd_grade->addSubItem($rmd_grade_frequency);
452
453 $rmd_grade_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_grade_end");
454 $rmd_grade_end->setRequired(true);
455 $rmd_grade->addSubItem($rmd_grade_end);
456
457 $rmd_grade->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::GRADE_REMINDER));
458
459 $form->addItem($rmd_submit);
460 $form->addItem($rmd_grade);
461
462 // relative deadline
463 $ti = new ilNumberInputGUI($lng->txt("exc_relative_date_period"), "relative_deadline");
464 $ti->setMinValue(1);
465 $ti->setRequired(true);
466 $ti->setMaxLength(3);
467 $ti->setSuffix($lng->txt("days"));
468 $ti->setSize(3);
469 $op2->addSubItem($ti);
470
471 // last submission for relative deadline
472 $last_submission = new ilDateTimeInputGUI($lng->txt("exc_rel_last_submission"), "rel_deadline_last_subm");
473 $last_submission->setInfo($lng->txt("exc_rel_last_submission_info"));
474 $last_submission->setShowTime(true);
475 $op2->addSubItem($last_submission);
476
477
478
479 // max number of files
480 if ($ass_type->usesFileUpload()) {
481 $sub_header = new ilFormSectionHeaderGUI();
482 $sub_header->setTitle($ass_type->getTitle());
483 $form->addItem($sub_header);
484 $max_file_tgl = new ilCheckboxInputGUI($lng->txt("exc_max_file_tgl"), "max_file_tgl");
485 $form->addItem($max_file_tgl);
486
487 $max_file = new ilNumberInputGUI($lng->txt("exc_max_file"), "max_file");
488 $max_file->setInfo($lng->txt("exc_max_file_info"));
489 $max_file->setRequired(true);
490 $max_file->setSize(3);
491 $max_file->setMinValue(1);
492 $max_file_tgl->addSubItem($max_file);
493 }
494
495 // after submission
496 $sub_header = new ilFormSectionHeaderGUI();
497 $sub_header->setTitle($lng->txt("exc_after_submission"));
498 $form->addItem($sub_header);
499
500 if (!$ass_type->usesTeams() && !$this->random_manager->isActivated()) {
501 // peer review
502 $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer");
503 $peer->setInfo($lng->txt("exc_peer_review_ass_setting_info"));
504 $form->addItem($peer);
505 }
506
507
508 // global feedback
509
510 $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb");
511 $form->addItem($fb);
512
513 $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file");
514 $fb_file->setRequired(true); // will be disabled on update if file exists - see getAssignmentValues()
515 // $fb_file->setAllowDeletion(true); makes no sense if required (overwrite or keep)
516 $fb->addSubItem($fb_file);
517
518 $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date");
519 $fb_date->setRequired(true);
520 $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE));
521 $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION));
522
523 //Extra radio option with date selection
524 $fb_date_custom_date = new ilDateTimeInputGUI($lng->txt("date"), "fb_date_custom");
525 $fb_date_custom_date->setRequired(true);
526 $fb_date_custom_date->setShowTime(true);
527 $fb_date_custom_option = new ilRadioOption($lng->txt("exc_global_feedback_file_after_date"), ilExAssignment::FEEDBACK_DATE_CUSTOM);
528 $fb_date_custom_option->addSubItem($fb_date_custom_date);
529 $fb_date->addOption($fb_date_custom_option);
530
531
532 $fb->addSubItem($fb_date);
533
534 $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron");
535 $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info"));
536 $fb->addSubItem($fb_cron);
537
538
539 if ($a_mode == "create") {
540 $form->addCommandButton("saveAssignment", $lng->txt("save"));
541 } else {
542 $form->addCommandButton("updateAssignment", $lng->txt("save"));
543 }
544 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
545
546 return $form;
547 }
This class represents a checkbox property in a property form.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAdoptableTeamAssignments(int $a_exercise_id, int $a_exclude_ass_id=null, int $a_user_id=null)
This class represents a file property in a property form.
This class represents a file wizard property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a number property in a property form.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.

Referenced by addAssignmentObject(), and executeCommand().

+ Here is the caller graph for this function:

◆ initPeerReviewForm()

ilExAssignmentEditorGUI::initPeerReviewForm ( )
protected

Definition at line 1315 of file class.ilExAssignmentEditorGUI.php.

1316 {
1317 $ilCtrl = $this->ctrl;
1318 $lng = $this->lng;
1319
1320 $form = new ilPropertyFormGUI();
1321 $form->setTitle($lng->txt("exc_peer_review"));
1322 $form->setFormAction($ilCtrl->getFormAction($this));
1323
1324 $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
1325 $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info")); // #16161
1326 $peer_min->setRequired(true);
1327 $peer_min->setSize(3);
1328 $peer_min->setValue(2);
1329 $form->addItem($peer_min);
1330
1331 $peer_unlock = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_simple_unlock"), "peer_unlock");
1332 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_active"), 1));
1333 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_inactive"), 0));
1334 $peer_unlock->setRequired(true);
1335 $peer_unlock->setValue(0);
1336 $form->addItem($peer_unlock);
1337
1338 if ($this->enable_peer_review_completion) {
1339 $peer_cmpl = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_completion"), "peer_valid");
1340 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_none"), ilExAssignment::PEER_REVIEW_VALID_NONE);
1341 $option->setInfo($lng->txt("exc_peer_review_completion_none_info"));
1342 $peer_cmpl->addOption($option);
1343 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_one"), ilExAssignment::PEER_REVIEW_VALID_ONE);
1344 $option->setInfo($lng->txt("exc_peer_review_completion_one_info"));
1345 $peer_cmpl->addOption($option);
1346 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_all"), ilExAssignment::PEER_REVIEW_VALID_ALL);
1347 $option->setInfo($lng->txt("exc_peer_review_completion_all_info"));
1348 $peer_cmpl->addOption($option);
1349 $peer_cmpl->setRequired(true);
1350 $peer_cmpl->setValue(ilExAssignment::PEER_REVIEW_VALID_NONE);
1351 $form->addItem($peer_cmpl);
1352 }
1353
1354 $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
1355 $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
1356 $peer_dl->setShowTime(true);
1357 $form->addItem($peer_dl);
1358
1359 $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
1360 $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
1361 $form->addItem($peer_prsl);
1362
1363 //feedback reminders
1364 $rmd_feedback = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_feedback_setting"), "rmd_peer_status");
1365
1366 $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_feedback_start"), "rmd_peer_start");
1367 $rmd_submit_start->setSize(3);
1368 $rmd_submit_start->setMaxLength(3);
1369 $rmd_submit_start->setSuffix($lng->txt('days'));
1370 $rmd_submit_start->setRequired(true);
1371 $rmd_submit_start->setMinValue(1);
1372 $rmd_feedback->addSubItem($rmd_submit_start);
1373
1374 $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_peer_freq");
1375 $rmd_submit_frequency->setSize(3);
1376 $rmd_submit_frequency->setMaxLength(3);
1377 $rmd_submit_frequency->setSuffix($lng->txt('days'));
1378 $rmd_submit_frequency->setRequired(true);
1379 $rmd_submit_frequency->setMinValue(1);
1380 $rmd_feedback->addSubItem($rmd_submit_frequency);
1381
1382 $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_peer_end");
1383 $rmd_submit_end->setRequired(true);
1384 $rmd_feedback->addSubItem($rmd_submit_end);
1385
1386 $rmd_feedback->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::FEEDBACK_REMINDER));
1387
1388 $form->addItem($rmd_feedback);
1389
1390 // criteria
1391
1392 $cats = new ilRadioGroupInputGUI($lng->txt("exc_criteria_catalogues"), "crit_cat");
1393 $form->addItem($cats);
1394
1395 // default (no catalogue)
1396
1397 $def = new ilRadioOption($lng->txt("exc_criteria_catalogue_default"), -1);
1398 $cats->addOption($def);
1399
1400 $peer_text = new ilCheckboxInputGUI($lng->txt("exc_peer_review_text"), "peer_text");
1401 $def->addSubItem($peer_text);
1402
1403 $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
1404 $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
1405 $peer_char->setSize(3);
1406 $peer_text->addSubItem($peer_char);
1407
1408 $peer_rating = new ilCheckboxInputGUI($lng->txt("exc_peer_review_rating"), "peer_rating");
1409 $def->addSubItem($peer_rating);
1410
1411 $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
1412 $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
1413 $def->addSubItem($peer_file);
1414
1415 // catalogues
1416
1417 $cat_objs = ilExcCriteriaCatalogue::getInstancesByParentId($this->exercise_id);
1418 if (sizeof($cat_objs)) {
1419 foreach ($cat_objs as $cat_obj) {
1420 $crits = ilExcCriteria::getInstancesByParentId($cat_obj->getId());
1421
1422 // only non-empty catalogues
1423 if (sizeof($crits)) {
1424 $titles = array();
1425 foreach ($crits as $crit) {
1426 $titles[] = $crit->getTitle();
1427 }
1428 $opt = new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1429 $opt->setInfo(implode(", ", $titles));
1430 $cats->addOption($opt);
1431 }
1432 }
1433 } else {
1434 // see ilExcCriteriaCatalogueGUI::view()
1435 $url = $ilCtrl->getLinkTargetByClass("ilexccriteriacataloguegui", "");
1436 $def->setInfo('<a href="' . $url . '">[+] ' .
1437 $lng->txt("exc_add_criteria_catalogue") .
1438 '</a>');
1439 }
1440
1441
1442 $form->addCommandButton("updatePeerReview", $lng->txt("save"));
1443 $form->addCommandButton("editAssignment", $lng->txt("cancel"));
1444
1445 return $form;
1446 }
static getInstancesByParentId(int $a_parent_id)
static getInstancesByParentId(int $a_parent_id)
$url

References $lng, $url, ilExAssignmentReminder\FEEDBACK_REMINDER, ilExcCriteria\getInstancesByParentId(), ilExcCriteriaCatalogue\getInstancesByParentId(), ILIAS\Repository\lng(), ilExAssignment\PEER_REVIEW_VALID_ALL, ilExAssignment\PEER_REVIEW_VALID_NONE, and ilExAssignment\PEER_REVIEW_VALID_ONE.

+ Here is the call graph for this function:

◆ listAssignmentsObject()

ilExAssignmentEditorGUI::listAssignmentsObject ( )
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 138 of file class.ilExAssignmentEditorGUI.php.

138 : void
139 {
141 $ilToolbar = $this->toolbar;
142 $ilCtrl = $this->ctrl;
143
144 $ilCtrl->setParameter($this, "ass_id", null);
145
146 $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "addAssignment"));
147
148 $ilToolbar->addStickyItem($this->getTypeDropdown(), true);
149
150 $button = ilSubmitButton::getInstance();
151 $button->setCaption("exc_add_assignment");
152 $button->setCommand("addAssignment");
153 $ilToolbar->addStickyItem($button);
154
155
156 $t = new ilAssignmentsTableGUI($this, "listAssignments", $this->exercise_id);
157 $tpl->setContent($t->getHTML());
158 }

References $ctrl, $toolbar, $tpl, ilSubmitButton\getInstance(), getTypeDropdown(), ilGlobalPageTemplate\setContent(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ orderAssignmentsByDeadlineObject()

ilExAssignmentEditorGUI::orderAssignmentsByDeadlineObject ( )

Definition at line 1246 of file class.ilExAssignmentEditorGUI.php.

1246 : void
1247 {
1248 $lng = $this->lng;
1249 $ilCtrl = $this->ctrl;
1250
1251 ilExAssignment::orderAssByDeadline($this->exercise_id);
1252
1253 $this->tpl->setOnScreenMessage('success', $lng->txt("exc_saved_order"), true);
1254 $ilCtrl->redirect($this, "listAssignments");
1255 }
static orderAssByDeadline(int $a_ex_id)

References $lng, and ilExAssignment\orderAssByDeadline().

+ Here is the call graph for this function:

◆ processForm()

ilExAssignmentEditorGUI::processForm ( ilPropertyFormGUI  $a_form)
protected

Custom form validation.

Parameters
ilPropertyFormGUI$a_form
Returns
array|null
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 592 of file class.ilExAssignmentEditorGUI.php.

592 : ?array
593 {
595
596 $protected_peer_review_groups = false;
597
598 if ($this->assignment) {
599 if ($this->assignment->getPeerReview()) {
600 $peer_review = new ilExPeerReview($this->assignment);
601 if ($peer_review->hasPeerReviewGroups()) {
602 $protected_peer_review_groups = true;
603 }
604 }
605
606 if ($this->assignment->getFeedbackFile()) {
607 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
608 }
609 }
610
611 $valid = $a_form->checkInput();
612 if ($protected_peer_review_groups) {
613 // checkInput() will add alert to disabled fields
614 $a_form->getItemByPostVar("deadline")->setAlert("");
615 $a_form->getItemByPostVar("deadline2")->setAlert("");
616 }
617
618 if ($valid) {
619 $type = $a_form->getInput("type");
620 $ass_type = $this->types->getById($type);
621
622 // dates
623
624 $time_start = $a_form->getItemByPostVar("start_time")->getDate();
625 $time_start = $time_start
626 ? $time_start->get(IL_CAL_UNIX)
627 : null;
628
629 $time_fb_custom_date = $a_form->getItemByPostVar("fb_date_custom")->getDate();
630 $time_fb_custom_date = $time_fb_custom_date
631 ? $time_fb_custom_date->get(IL_CAL_UNIX)
632 : null;
633
634 $reminder_submit_end_date = $a_form->getItemByPostVar("rmd_submit_end")->getDate();
635 $reminder_submit_end_date = $reminder_submit_end_date
636 ? $reminder_submit_end_date->get(IL_CAL_UNIX)
637 : null;
638
639 $reminder_grade_end_date = $a_form->getItemByPostVar("rmd_grade_end")->getDate();
640 $reminder_grade_end_date = $reminder_grade_end_date
641 ? $reminder_grade_end_date->get(IL_CAL_UNIX)
642 : null;
643
644 $time_deadline = null;
645 $time_deadline_ext = null;
646
647 if ((int) $a_form->getInput("deadline_mode") == ilExAssignment::DEADLINE_ABSOLUTE) {
648 $time_deadline = $a_form->getItemByPostVar("deadline")->getDate();
649 $time_deadline = $time_deadline
650 ? $time_deadline->get(IL_CAL_UNIX)
651 : null;
652 $time_deadline_ext = $a_form->getItemByPostVar("deadline2")->getDate();
653 $time_deadline_ext = $time_deadline_ext
654 ? $time_deadline_ext->get(IL_CAL_UNIX)
655 : null;
656 }
657
658
659 // handle disabled elements
660 if ($protected_peer_review_groups) {
661 $time_deadline = $this->assignment->getDeadline();
662 $time_deadline_ext = $this->assignment->getExtendedDeadline();
663 }
664
665 // no deadline?
666 if (!$time_deadline) {
667 // peer review
668 if (!$protected_peer_review_groups &&
669 $a_form->getInput("peer")) {
670 $a_form->getItemByPostVar("peer")
671 ->setAlert($lng->txt("exc_needs_fixed_deadline"));
672 $valid = false;
673 }
674 // global feedback
675 if ($a_form->getInput("fb") &&
676 $a_form->getInput("fb_date") == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
677 $a_form->getItemByPostVar("fb")
678 ->setAlert($lng->txt("exc_needs_deadline"));
679 $valid = false;
680 }
681 } else {
682 // #18269
683 if ($a_form->getInput("peer")) {
684 $time_deadline_max = max($time_deadline, $time_deadline_ext);
685 $peer_dl = $this->assignment // #18380
686 ? $this->assignment->getPeerReviewDeadline()
687 : null;
688 if ($peer_dl && $peer_dl < $time_deadline_max) {
689 $a_form->getItemByPostVar($peer_dl < $time_deadline_ext
690 ? "deadline2"
691 : "deadline")
692 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
693 $valid = false;
694 }
695 }
696
697 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
698 $a_form->getItemByPostVar("deadline2")
699 ->setAlert($lng->txt("exc_deadline_ext_mismatch"));
700 $valid = false;
701 }
702
703 $time_deadline_min = $time_deadline_ext
704 ? min($time_deadline, $time_deadline_ext)
705 : $time_deadline;
706
707 // start > any deadline ?
708 if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
709 $a_form->getItemByPostVar("start_time")
710 ->setAlert($lng->txt("exc_start_date_should_be_before_end_date"));
711 $valid = false;
712 }
713 }
714
715 if ($ass_type->usesTeams()) {
716 if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM &&
717 $a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
718 $team_validation = $this->validationTeamsFormation(
719 $a_form->getInput("number_teams"),
720 $a_form->getInput("min_participants_team"),
721 $a_form->getInput("max_participants_team")
722 );
723 if ($team_validation['status'] == 'error') {
724 $a_form->getItemByPostVar("team_creation")
725 ->setAlert($team_validation['msg']);
726 $a_form->getItemByPostVar($team_validation["field"])
727 ->setAlert($lng->txt("exc_value_can_not_set"));
728 $valid = false;
729 }
730 }
731 }
732 if ($valid) {
733 $res = array(
734 // core
735 "type" => $a_form->getInput("type")
736 ,"title" => trim($a_form->getInput("title"))
737 ,"instruction" => trim($a_form->getInput("instruction"))
738 // dates
739 ,"start" => $time_start
740 ,"deadline" => $time_deadline
741 ,"deadline_ext" => $time_deadline_ext
742 ,"max_file" => $a_form->getInput("max_file_tgl")
743 ? $a_form->getInput("max_file")
744 : null
745 );
746 if (!$this->random_manager->isActivated()) {
747 $res["mandatory"] = $a_form->getInput("mandatory");
748 }
749
750 $res['team_creator'] = $a_form->getInput("team_creator");
751 $res["team_creation"] = $a_form->getInput("team_creation");
752 if ($a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
753 if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
754 $res["number_teams"] = $a_form->getInput("number_teams");
755 $res["min_participants_team"] = $a_form->getInput("min_participants_team");
756 $res["max_participants_team"] = $a_form->getInput("max_participants_team");
757 } elseif ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
758 $res['ass_adpt'] = $a_form->getInput("ass_adpt");
759 }
760 }
761
762 $res["deadline_mode"] = $a_form->getInput("deadline_mode");
763
764 if ($res["deadline_mode"] == ilExAssignment::DEADLINE_RELATIVE) {
765 $res["relative_deadline"] = $a_form->getInput("relative_deadline");
766 $rel_deadline_last_subm = $a_form->getItemByPostVar("rel_deadline_last_subm")->getDate();
767 $rel_deadline_last_subm = $rel_deadline_last_subm
768 ? $rel_deadline_last_subm->get(IL_CAL_UNIX)
769 : null;
770 $res["rel_deadline_last_subm"] = $rel_deadline_last_subm;
771 }
772
773 // peer
774 if ($a_form->getInput("peer") ||
775 $protected_peer_review_groups) {
776 $res["peer"] = true;
777 }
778
779 // files
780 if (isset($_FILES["files"])) {
781 // #15994 - we are keeping the upload files array structure
782 // see ilFSStorageExercise::uploadAssignmentFiles()
783 $res["files"] = $_FILES["files"];
784 }
785
786 // global feedback
787 if ($a_form->getInput("fb")) {
788 $res["fb"] = true;
789 $res["fb_cron"] = $a_form->getInput("fb_cron");
790 $res["fb_date"] = $a_form->getInput("fb_date");
791 $res["fb_date_custom"] = $time_fb_custom_date;
792
793 if ($_FILES["fb_file"]["tmp_name"]) {
794 $res["fb_file"] = $_FILES["fb_file"];
795 }
796 }
797 if ($a_form->getInput("rmd_submit_status")) {
798 $res["rmd_submit_status"] = true;
799 $res["rmd_submit_start"] = $a_form->getInput("rmd_submit_start");
800 $res["rmd_submit_freq"] = $a_form->getInput("rmd_submit_freq");
801 $res["rmd_submit_end"] = $reminder_submit_end_date;
802 $res["rmd_submit_template_id"] = $a_form->getInput("rmd_submit_template_id");
803 }
804 if ($a_form->getInput("rmd_grade_status")) {
805 $res["rmd_grade_status"] = true;
806 $res["rmd_grade_freq"] = $a_form->getInput("rmd_grade_freq");
807 $res["rmd_grade_end"] = $reminder_grade_end_date;
808 $res["rmd_grade_template_id"] = $a_form->getInput("rmd_grade_template_id");
809 }
810
811 return $res;
812 } else {
813 $this->tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
814 }
815 }
816
817 return null;
818 }
validationTeamsFormation(int $a_num_teams, int $a_min_participants, int $a_max_participants)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
$valid
$res
Definition: ltiservices.php:69
$type

References $lng, $res, $type, $valid, ilPropertyFormGUI\checkInput(), ilExAssignment\DEADLINE_ABSOLUTE, ilExAssignment\DEADLINE_RELATIVE, ilExAssignment\FEEDBACK_DATE_DEADLINE, ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), IL_CAL_UNIX, ilExAssignment\TEAMS_FORMED_BY_ASSIGNMENT, ilExAssignment\TEAMS_FORMED_BY_RANDOM, and ilExAssignment\TEAMS_FORMED_BY_TUTOR.

+ Here is the call graph for this function:

◆ processPeerReviewForm()

ilExAssignmentEditorGUI::processPeerReviewForm ( ilPropertyFormGUI  $a_form)
protected
Parameters
ilPropertyFormGUI$a_form
Returns
array|null

Definition at line 1556 of file class.ilExAssignmentEditorGUI.php.

1558 : ?array {
1559 $lng = $this->lng;
1560
1561 $protected_peer_review_groups = false;
1562 $peer_review = new ilExPeerReview($this->assignment);
1563 if ($peer_review->hasPeerReviewGroups()) {
1564 $protected_peer_review_groups = true;
1565 }
1566
1567 $valid = $a_form->checkInput();
1568 if ($valid) {
1569 // dates
1570 $time_deadline = $this->assignment->getDeadline();
1571 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1572 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1573
1574 $date = $a_form->getItemByPostVar("peer_dl")->getDate();
1575 $time_peer = $date
1576 ? $date->get(IL_CAL_UNIX)
1577 : null;
1578
1579 $reminder_date = $a_form->getItemByPostVar("rmd_peer_end")->getDate();
1580 $reminder_date = $reminder_date
1581 ? $reminder_date->get(IL_CAL_UNIX)
1582 : null;
1583
1584 // peer < any deadline?
1585 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1586 $a_form->getItemByPostVar("peer_dl")
1587 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1588 $valid = false;
1589 }
1590
1591 if (!$protected_peer_review_groups) {
1592 if ($a_form->getInput("crit_cat") < 0 &&
1593 !$a_form->getInput("peer_text") &&
1594 !$a_form->getInput("peer_rating") &&
1595 !$a_form->getInput("peer_file")) {
1596 $a_form->getItemByPostVar("peer_file")
1597 ->setAlert($lng->txt("select_one"));
1598 $valid = false;
1599 }
1600 }
1601
1602 if ($valid) {
1603 $res = array();
1604 $res["peer_dl"] = $time_peer;
1605
1606 if ($protected_peer_review_groups) {
1607 $res["peer_min"] = $this->assignment->getPeerReviewMin();
1608 $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1609 $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1610 $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1611
1612 $res["peer_text"] = $this->assignment->hasPeerReviewText();
1613 $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1614 $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1615 $res["peer_char"] = $this->assignment->getPeerReviewChars();
1616 $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1617
1618 $res["peer_valid"] = $this->enable_peer_review_completion
1619 ? $res["peer_valid"]
1620 : null;
1621 } else {
1622 $res["peer_min"] = $a_form->getInput("peer_min");
1623 $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1624 $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1625 $res["peer_valid"] = $a_form->getInput("peer_valid");
1626
1627 $res["peer_text"] = $a_form->getInput("peer_text");
1628 $res["peer_rating"] = $a_form->getInput("peer_rating");
1629 $res["peer_file"] = $a_form->getInput("peer_file");
1630 $res["peer_char"] = $a_form->getInput("peer_char");
1631 $res["crit_cat"] = $a_form->getInput("crit_cat");
1632 }
1633 if ($a_form->getInput("rmd_peer_status")) {
1634 $res["rmd_peer_status"] = $a_form->getInput("rmd_peer_status");
1635 $res["rmd_peer_start"] = $a_form->getInput("rmd_peer_start");
1636 $res["rmd_peer_end"] = $reminder_date;
1637 $res["rmd_peer_freq"] = $a_form->getInput("rmd_peer_freq");
1638 $res["rmd_peer_template_id"] = $a_form->getInput("rmd_peer_template_id");
1639 }
1640
1641 return $res;
1642 } else {
1643 $this->tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
1644 }
1645 }
1646 return null;
1647 }

◆ saveAssignmentObject()

ilExAssignmentEditorGUI::saveAssignmentObject ( )
Exceptions
ilDateTimeException
ilExcUnknownAssignmentTypeException
ilException

Definition at line 942 of file class.ilExAssignmentEditorGUI.php.

942 : void
943 {
946 $ilCtrl = $this->ctrl;
947
948 // #16163 - ignore ass id from request
949 $this->assignment = null;
950
951 $form = $this->initAssignmentForm($this->requested_type, "create");
952 $input = $this->processForm($form);
953 if (is_array($input)) {
954 $ass = new ilExAssignment();
955 $ass->setExerciseId($this->exercise_id);
956 $ass->setType($input["type"]);
957 $ass_type_gui = $this->type_guis->getById($ass->getType());
958
959 $this->importFormToAssignment($ass, $input);
960
961 $this->generateTeams($ass, $input);
962 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
963
964 $ass_type_gui->importFormToAssignment($ass, $form);
965 $ass->update();
966
967 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
968
969 // because of sub-tabs we stay on settings screen
970 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
971 $ilCtrl->redirect($this, "editAssignment");
972 } else {
973 $form->setValuesByPost();
974 $tpl->setContent($form->getHTML());
975 }
976 }
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
generateTeams(ilExAssignment $a_assignment, array $a_input)
processForm(ilPropertyFormGUI $a_form)
Custom form validation.

References $lng, and $tpl.

◆ saveAssignmentOrderObject()

ilExAssignmentEditorGUI::saveAssignmentOrderObject ( )

Definition at line 1232 of file class.ilExAssignmentEditorGUI.php.

1232 : void
1233 {
1234 $lng = $this->lng;
1235 $ilCtrl = $this->ctrl;
1236
1238 $this->exercise_id,
1239 $this->requested_order
1240 );
1241
1242 $this->tpl->setOnScreenMessage('success', $lng->txt("exc_saved_order"), true);
1243 $ilCtrl->redirect($this, "listAssignments");
1244 }
static saveAssOrderOfExercise(int $a_ex_id, array $a_order)

References $lng, and ilExAssignment\saveAssOrderOfExercise().

+ Here is the call graph for this function:

◆ saveReminderData()

ilExAssignmentEditorGUI::saveReminderData ( ilExAssignmentReminder  $reminder,
array  $a_input 
)
protected

Definition at line 919 of file class.ilExAssignmentEditorGUI.php.

922 : void {
923 if ($reminder->getReminderStatus() === null) {
924 $action = "save";
925 } else {
926 $action = "update";
927 }
928 $type = $reminder->getReminderType();
929 $reminder->setReminderStatus((bool) ($a_input["rmd_" . $type . "_status"] ?? false));
930 $reminder->setReminderStart((int) ($a_input["rmd_" . $type . "_start"] ?? 0));
931 $reminder->setReminderEnd((int) ($a_input["rmd_" . $type . "_end"] ?? 0));
932 $reminder->setReminderFrequency((int) ($a_input["rmd_" . $type . "_freq"] ?? 0));
933 $reminder->setReminderMailTemplate((int) ($a_input["rmd_" . $type . "_template_id"] ?? 0));
934 $reminder->{$action}();
935 }
setReminderStatus(?bool $a_status)
Set reminder for users without submission.

◆ setAssignmentHeader()

ilExAssignmentEditorGUI::setAssignmentHeader ( )

Definition at line 1257 of file class.ilExAssignmentEditorGUI.php.

1257 : void
1258 {
1259 $ilTabs = $this->tabs;
1260 $lng = $this->lng;
1261 $ilCtrl = $this->ctrl;
1262 $tpl = $this->tpl;
1263 $ilHelp = $this->help;
1264
1265 $tpl->setTitle($this->assignment->getTitle());
1266 $tpl->setDescription("");
1267
1268 $ilTabs->clearTargets();
1269 $ilHelp->setScreenIdComponent("exc");
1270
1271 $ilTabs->setBackTarget(
1272 $lng->txt("back"),
1273 $ilCtrl->getLinkTarget($this, "listAssignments")
1274 );
1275
1276 $ilTabs->addTab(
1277 "ass_settings",
1278 $lng->txt("settings"),
1279 $ilCtrl->getLinkTarget($this, "editAssignment")
1280 );
1281
1282 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1283 $this->assignment->getPeerReview()) {
1284 $ilTabs->addTab(
1285 "peer_settings",
1286 $lng->txt("exc_peer_review"),
1287 $ilCtrl->getLinkTarget($this, "editPeerReview")
1288 );
1289 }
1290
1291 $ilTabs->addTab(
1292 "ass_files",
1293 $lng->txt("exc_instruction_files"),
1294 $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", "ilexassignmentfilesystemgui"), "listFiles")
1295 );
1296 }
setDescription(string $a_descr)
Sets description below title in standard template.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.

References $lng, and $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ setDisabledFieldValues()

ilExAssignmentEditorGUI::setDisabledFieldValues ( ilPropertyFormGUI  $a_form)
protected
Exceptions
ilDateTimeException

Definition at line 1081 of file class.ilExAssignmentEditorGUI.php.

1081 : void
1082 {
1083 // dates
1084 if ($this->assignment->getDeadline() > 0) {
1085 $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
1086 $ed_item = $a_form->getItemByPostVar("deadline");
1087 $ed_item->setDate($edit_date);
1088
1089 if ($this->assignment->getExtendedDeadline() > 0) {
1090 $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
1091 $ed_item = $a_form->getItemByPostVar("deadline2");
1092 $ed_item->setDate($edit_date);
1093 }
1094 }
1095
1096 if ($this->assignment->getPeerReview()) {
1097 $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
1098 }
1099 }

References ilPropertyFormGUI\getItemByPostVar(), and IL_CAL_UNIX.

+ Here is the call graph for this function:

◆ setDisabledPeerReviewFieldValues()

ilExAssignmentEditorGUI::setDisabledPeerReviewFieldValues ( ilPropertyFormGUI  $a_form)
protected

Definition at line 1491 of file class.ilExAssignmentEditorGUI.php.

1491 : void
1492 {
1493 $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1494 $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1495 $a_form->getItemByPostVar("peer_unlock")->setValue((int) $this->assignment->getPeerReviewSimpleUnlock());
1496
1497 if ($this->enable_peer_review_completion) {
1498 $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1499 }
1500
1501 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1502 if ($cat < 1) {
1503 $cat = -1;
1504
1505 // default / no catalogue
1506 $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1507 $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1508 $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1509 if ($this->assignment->getPeerReviewChars() > 0) {
1510 $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1511 }
1512 }
1513 $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1514 }

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ updateAssignmentObject()

ilExAssignmentEditorGUI::updateAssignmentObject ( )
Exceptions
ilException
ilExcUnknownAssignmentTypeException
ilDateTimeException

Definition at line 1140 of file class.ilExAssignmentEditorGUI.php.

1140 : void
1141 {
1142 $tpl = $this->tpl;
1143 $lng = $this->lng;
1144 $ilCtrl = $this->ctrl;
1145 $ilTabs = $this->tabs;
1146
1147 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1148 $input = $this->processForm($form);
1149
1150 $ass_type = $this->assignment->getType();
1151 $ass_type_gui = $this->type_guis->getById($ass_type);
1152
1153 if (is_array($input)) {
1154 $old_deadline = $this->assignment->getDeadline();
1155 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1156
1157 $this->importFormToAssignment($this->assignment, $input);
1158 $this->generateTeams($this->assignment, $input);
1159
1160 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1161 $this->assignment->update();
1162
1163 $new_deadline = $this->assignment->getDeadline();
1164 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1165
1166 // if deadlines were changed
1167 if ($old_deadline != $new_deadline ||
1168 $old_ext_deadline != $new_ext_deadline) {
1169 $this->assignment->recalculateLateSubmissions();
1170 }
1171
1172 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1173 $ilCtrl->redirect($this, "editAssignment");
1174 } else {
1175 $this->setAssignmentHeader();
1176 $ilTabs->activateTab("ass_settings");
1177
1178 $form->setValuesByPost();
1179 $this->handleDisabledFields($form);
1180 $tpl->setContent($form->getHTML());
1181 }
1182 }

References $lng, and $tpl.

◆ updatePeerReviewObject()

ilExAssignmentEditorGUI::updatePeerReviewObject ( )
protected
Exceptions
ilDateTimeException

Definition at line 1681 of file class.ilExAssignmentEditorGUI.php.

1681 : void
1682 {
1683 $tpl = $this->tpl;
1684 $lng = $this->lng;
1685 $ilCtrl = $this->ctrl;
1686 $ilTabs = $this->tabs;
1687
1688 $form = $this->initPeerReviewForm();
1689 $input = $this->processPeerReviewForm($form);
1690 if (is_array($input)) {
1691 $this->importPeerReviewFormToAssignment($this->assignment, $input);
1692 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1693 $ilCtrl->redirect($this, "editPeerReview");
1694 } else {
1695 $this->setAssignmentHeader();
1696 $ilTabs->activateTab("peer_settings");
1697
1698 $form->setValuesByPost();
1699 $this->handleDisabledPeerFields($form);
1700 $tpl->setContent($form->getHTML());
1701 }
1702 }
processPeerReviewForm(ilPropertyFormGUI $a_form)
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)

References $lng, and $tpl.

◆ validationTeamsFormation()

ilExAssignmentEditorGUI::validationTeamsFormation ( int  $a_num_teams,
int  $a_min_participants,
int  $a_max_participants 
)

Definition at line 1709 of file class.ilExAssignmentEditorGUI.php.

1713 : array {
1714 $total_members = $this->getExerciseTotalMembers();
1715 $number_of_teams = $a_num_teams;
1716
1717 if ($number_of_teams) {
1718 $members_per_team = round($total_members / $a_num_teams);
1719 } else {
1720 if ($a_min_participants) {
1721 $number_of_teams = round($total_members / $a_min_participants);
1722 $participants_extra_team = $total_members % $a_min_participants;
1723 if ($participants_extra_team > $number_of_teams) {
1724 //Can't create teams with this minimum of participants.
1725 $message = sprintf($this->lng->txt("exc_team_minimal_too_big"), $a_min_participants);
1726 return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1727 }
1728 }
1729 $members_per_team = 0;
1730 }
1731
1732 if ($a_min_participants > $a_max_participants) {
1733 $message = $this->lng->txt("exc_team_min_big_than_max");
1734 return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1735 }
1736
1737 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1738 $message = sprintf($this->lng->txt("exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1739 return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1740 }
1741
1742 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1743 $message = sprintf($this->lng->txt("exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1744 return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1745 }
1746
1747 return array("status" => "success", "msg" => "");
1748 }
$message
Definition: xapiexit.php:32

Field Documentation

◆ $assignment

ilExAssignment ilExAssignmentEditorGUI::$assignment
protected

Definition at line 38 of file class.ilExAssignmentEditorGUI.php.

◆ $ctrl

ilCtrl ilExAssignmentEditorGUI::$ctrl
protected

◆ $enable_peer_review_completion

bool ilExAssignmentEditorGUI::$enable_peer_review_completion
protected

Definition at line 39 of file class.ilExAssignmentEditorGUI.php.

◆ $exc

ilObjExercise ilExAssignmentEditorGUI::$exc
protected

Definition at line 42 of file class.ilExAssignmentEditorGUI.php.

◆ $exercise_id

int ilExAssignmentEditorGUI::$exercise_id
protected

Definition at line 37 of file class.ilExAssignmentEditorGUI.php.

◆ $help

ilHelpGUI ilExAssignmentEditorGUI::$help
protected

Definition at line 36 of file class.ilExAssignmentEditorGUI.php.

◆ $lng

ilLanguage ilExAssignmentEditorGUI::$lng
protected

Definition at line 32 of file class.ilExAssignmentEditorGUI.php.

Referenced by executeCommand(), and getTypeDropdown().

◆ $random_manager

Mandatory RandomAssignmentsManager ilExAssignmentEditorGUI::$random_manager
protected

Definition at line 41 of file class.ilExAssignmentEditorGUI.php.

◆ $requested_ass_ids

array ilExAssignmentEditorGUI::$requested_ass_ids
protected

Definition at line 49 of file class.ilExAssignmentEditorGUI.php.

◆ $requested_ass_type

string ilExAssignmentEditorGUI::$requested_ass_type
protected

Definition at line 44 of file class.ilExAssignmentEditorGUI.php.

◆ $requested_order

array ilExAssignmentEditorGUI::$requested_order
protected

Definition at line 53 of file class.ilExAssignmentEditorGUI.php.

◆ $requested_type

int ilExAssignmentEditorGUI::$requested_type
protected

Definition at line 45 of file class.ilExAssignmentEditorGUI.php.

◆ $settings

ilSetting ilExAssignmentEditorGUI::$settings
protected

Definition at line 35 of file class.ilExAssignmentEditorGUI.php.

◆ $tabs

ilTabsGUI ilExAssignmentEditorGUI::$tabs
protected

Definition at line 31 of file class.ilExAssignmentEditorGUI.php.

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilExAssignmentEditorGUI::$toolbar
protected

Definition at line 34 of file class.ilExAssignmentEditorGUI.php.

Referenced by listAssignmentsObject().

◆ $tpl

ilGlobalPageTemplate ilExAssignmentEditorGUI::$tpl
protected

Definition at line 33 of file class.ilExAssignmentEditorGUI.php.

Referenced by addAssignmentObject(), and listAssignmentsObject().

◆ $type_guis

ilExAssignmentTypesGUI ilExAssignmentEditorGUI::$type_guis
protected

Definition at line 43 of file class.ilExAssignmentEditorGUI.php.

◆ $types

ilExAssignmentTypes ilExAssignmentEditorGUI::$types
protected

Definition at line 40 of file class.ilExAssignmentEditorGUI.php.

Referenced by getTypeDropdown().


The documentation for this class was generated from the following file: