ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExAssignmentEditorGUI Class Reference

Class ilExAssignmentEditorGUI. More...

+ Collaboration diagram for ilExAssignmentEditorGUI:

Public Member Functions

 executeCommand ()
 
 listAssignmentsObject ()
 
 addAssignmentObject ()
 Create assignment. More...
 
 addMailTemplatesRadio (string $a_reminder_type)
 
 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

ILIAS Exercise InternalDomainService $domain
 
ILIAS Exercise InstructionFile InstructionFileManager $instruction_files
 
int $ref_id = null
 
ilAccessHandler $access
 
ILIAS Exercise InternalGUIService $gui
 
ilObjUser $user
 
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
 

Private Attributes

ILIAS ResourceStorage Services $irss
 
ILIAS FileUpload FileUpload $upload
 

Detailed Description

Member Function Documentation

◆ addAssignmentObject()

ilExAssignmentEditorGUI::addAssignmentObject ( )

Create assignment.

Exceptions
ilExcUnknownAssignmentTypeException

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

191 : void
192 {
194 $ilCtrl = $this->ctrl;
195
196 // #16163 - ignore ass id from request
197 $this->assignment = null;
198
199 if ($this->requested_type == 0) {
200 $ilCtrl->redirect($this, "listAssignments");
201 }
202
203 $form = $this->initAssignmentForm($this->requested_type, "create");
204 $tpl->setContent($form->getHTML());
205 }
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:

◆ addMailTemplatesRadio()

ilExAssignmentEditorGUI::addMailTemplatesRadio ( string  $a_reminder_type)

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

584 {
585 global $DIC;
586
587 $post_var = "rmd_" . $a_reminder_type . "_template_id";
588
589 $r_group = new ilRadioGroupInputGUI($this->lng->txt("exc_reminder_mail_template"), $post_var);
590 $r_group->setRequired(true);
591 $r_group->addOption(new ilRadioOption($this->lng->txt("exc_reminder_mail_no_tpl"), 0));
592 $r_group->setValue(0);
593
594 switch ($a_reminder_type) {
597 break;
600 break;
603 break;
604 default:
605 exit();
606 }
607
608 $templateService = $DIC->mail()->textTemplates();
609 foreach ($templateService->loadTemplatesForContextId($context->getId()) as $template) {
610 $r_group->addOption(new ilRadioOption($template->getTitle(), $template->getTplId()));
611 if ($template->isDefault()) {
612 $r_group->setValue($template->getTplId());
613 }
614 }
615
616 return $r_group;
617 }
Handles exercise Grade reminder mail placeholders If all contexts are using the same placeholders,...
Handles exercise Peer reminder mail placeholders If all contexts are using the same placeholders,...
Handles exercise Submit reminder mail placeholders If all contexts are using the same placeholders,...
This class represents a property in a property form.
This class represents an option in a radio group.
exit
global $DIC
Definition: shib_login.php:26
$context
Definition: webdav.php:31

References $context, $DIC, exit, ilExAssignmentReminder\FEEDBACK_REMINDER, ilExAssignmentReminder\GRADE_REMINDER, ILIAS\Repository\lng(), and ilExAssignmentReminder\SUBMIT_REMINDER.

+ Here is the call graph for this function:

◆ confirmAssignmentsDeletionObject()

ilExAssignmentEditorGUI::confirmAssignmentsDeletionObject ( )

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

1225 : void
1226 {
1227 $ilCtrl = $this->ctrl;
1228 $tpl = $this->tpl;
1229 $lng = $this->lng;
1230
1231 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class, "ass_id", null);
1232 if (count($this->requested_ass_ids) == 0) {
1233 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1234 $ilCtrl->redirect($this, "listAssignments");
1235 } else {
1236 $cgui = new ilConfirmationGUI();
1237 $cgui->setFormAction($ilCtrl->getFormAction($this));
1238 $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
1239 $cgui->setCancel($lng->txt("cancel"), "listAssignments");
1240 $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
1241
1242 foreach ($this->requested_ass_ids as $i) {
1243 $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
1244 }
1245
1246 $tpl->setContent($cgui->getHTML());
1247 }
1248 }
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...

References $lng, ilExAssignment\lookupTitle(), and ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ deleteAssignmentsObject()

ilExAssignmentEditorGUI::deleteAssignmentsObject ( )
Exceptions
ilExcUnknownAssignmentTypeException
ilDateTimeException

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

1254 : void
1255 {
1256 $ilCtrl = $this->ctrl;
1257 $lng = $this->lng;
1258 $delete = false;
1259 foreach ($this->requested_ass_ids as $id) {
1261 $ass->delete($this->exc);
1262 $delete = true;
1263 }
1264
1265 if ($delete) {
1266 $this->tpl->setOnScreenMessage('success', $lng->txt("exc_assignments_deleted"), true);
1267 }
1268 $ilCtrl->setParameter($this, "ass_id", "");
1269 $ilCtrl->redirect($this, "listAssignments");
1270 }
$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 1338 of file class.ilExAssignmentEditorGUI.php.

1338 : void
1339 {
1340 $ilCtrl = $this->ctrl;
1341
1342 if (!$this->assignment ||
1343 !$this->assignment->getFeedbackFile()) {
1344 $ilCtrl->redirect($this, "returnToParent");
1345 }
1346 $this->domain->assignment()->sampleSolution($this->assignment->getId())->deliver();
1347 }

◆ editAssignmentObject()

ilExAssignmentEditorGUI::editAssignmentObject ( )
Exceptions
ilExcUnknownAssignmentTypeException
ilDateTimeException

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

1018 : void
1019 {
1020 $ilTabs = $this->tabs;
1021 $tpl = $this->tpl;
1022
1023 $this->setAssignmentHeader();
1024 $ilTabs->activateTab("ass_settings");
1025
1026 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1027 $this->getAssignmentValues($form);
1028 $tpl->setContent($form->getHTML());
1029 }
getAssignmentValues(ilPropertyFormGUI $a_form)

References ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ editPeerReviewObject()

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

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

1491 : void
1492 {
1493 $ilTabs = $this->tabs;
1494 $tpl = $this->tpl;
1495
1496 $this->setAssignmentHeader();
1497 $ilTabs->activateTab("peer_settings");
1498
1499 if ($a_form === null) {
1500 $a_form = $this->initPeerReviewForm();
1501 $this->getPeerReviewValues($a_form);
1502 }
1503 $tpl->setContent($a_form->getHTML());
1504 }
getPeerReviewValues(\ilPropertyFormGUI $a_form)

References ilPropertyFormGUI\getHTML(), and ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ executeCommand()

ilExAssignmentEditorGUI::executeCommand ( )
Exceptions
ilCtrlException|ilExcUnknownAssignmentTypeException

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

113 : void
114 {
115 $ilCtrl = $this->ctrl;
116 $ilTabs = $this->tabs;
118
119 $class = $ilCtrl->getNextClass($this);
120 $cmd = $ilCtrl->getCmd("listAssignments");
121
122 switch ($class) {
123 case "ilpropertyformgui":
124 $form = $this->initAssignmentForm($this->requested_ass_type);
125 $ilCtrl->forwardCommand($form);
126 break;
127
128 case strtolower(ilResourceCollectionGUI::class):
129 $this->setAssignmentHeader();
130 $ilTabs->activateTab("ass_files");
131 $irss = $this->domain->assignment()->instructionFiles($this->assignment->getId());
132 if ($irss->getCollectionIdString() === "") {
133 $this->tpl->setOnScreenMessage(
134 "info",
135 $this->lng->txt("exc_instruction_migration_not_run")
136 );
137 } else {
138 $gui = $this->gui->assignment()->getInstructionFileResourceCollectionGUI(
139 (int) $this->ref_id,
140 $this->assignment->getId()
141 );
142 $this->ctrl->forwardCommand($gui);
143 }
144 break;
145
146 case "ilexpeerreviewgui":
147 $ilTabs->clearTargets();
148 $ilTabs->setBackTarget(
149 $lng->txt("back"),
150 $ilCtrl->getLinkTarget($this, "listAssignments")
151 );
152
153 $peer_gui = new ilExPeerReviewGUI($this->assignment);
154 $ilCtrl->forwardCommand($peer_gui);
155 break;
156
157 default:
158 $this->{$cmd . "Object"}();
159 break;
160 }
161 }
ILIAS ResourceStorage Services $irss
ILIAS Exercise InternalGUIService $gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ generateTeams()

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

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

1802 : void {
1803 $ass_type = $a_assignment->getAssignmentType();
1804 if ($ass_type->usesTeams() &&
1805 $a_input['team_creator'] == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
1806 if ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
1807 $number_teams = $a_input['number_teams'];
1808 if (count(ilExAssignmentTeam::getAssignmentTeamMap($a_assignment->getId())) == 0) {
1809 $ass_team = new ilExAssignmentTeam();
1810 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->getId(), $number_teams, $a_input['min_participants_team']);
1811 }
1812 } elseif ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
1813 ilExAssignmentTeam::adoptTeams($a_input["ass_adpt"], $a_assignment->getId());
1814 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exc_teams_assignment_adopted"), true);
1815 }
1816 }
1817 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAssignmentTeamMap(int $a_ass_id)
static adoptTeams(int $a_source_ass_id, int $a_target_ass_id, ?int $a_user_id=null, ?int $a_exc_ref_id=null)

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 1035 of file class.ilExAssignmentEditorGUI.php.

1035 : void
1036 {
1037 $lng = $this->lng;
1038 $ilCtrl = $this->ctrl;
1039 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1040
1041 $values = array();
1042 $values["type"] = $this->assignment->getType();
1043 $values["title"] = $this->assignment->getTitle();
1044 $values["mandatory"] = $this->assignment->getMandatory();
1045 $values["instruction"] = $this->assignment->getInstruction();
1046 if ($this->assignment->getStartTime()) {
1047 $values["start_time"] = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
1048 }
1049
1050 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1051 if ($this->assignment->getMaxFile()) {
1052 $values["max_file_tgl"] = true;
1053 $values["max_file"] = $this->assignment->getMaxFile();
1054 }
1055 }
1056
1057 if ($this->assignment->getAssignmentType()->usesTeams()) {
1058 $values["team_creator"] = (string) (int) $this->assignment->getTeamTutor();
1059 $values["team_creation"] = "0";
1060 }
1061
1062 if ($this->assignment->getFeedbackDateCustom()) {
1063 $values["fb_date_custom"] = new ilDateTime($this->assignment->getFeedbackDateCustom(), IL_CAL_UNIX);
1064 }
1065
1066 //Reminders
1067 $rmd_sub = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::SUBMIT_REMINDER);
1068 if ($rmd_sub->getReminderStatus()) {
1069 $values["rmd_submit_status"] = $rmd_sub->getReminderStatus();
1070 $values["rmd_submit_start"] = $rmd_sub->getReminderStart();
1071 $values["rmd_submit_end"] = new ilDateTime($rmd_sub->getReminderEnd(), IL_CAL_UNIX);
1072 $values["rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1073 $values["rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1074 }
1075
1076 $rmd_grade = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::GRADE_REMINDER);
1077 if ($rmd_grade->getReminderStatus()) {
1078 $values["rmd_grade_status"] = $rmd_grade->getReminderStatus();
1079 $values["rmd_grade_end"] = new ilDateTime($rmd_grade->getReminderEnd(), IL_CAL_UNIX);
1080 $values["rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1081 $values["rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1082 }
1083
1084 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1085 $values = array_merge($values, $type_values);
1086
1087
1088 $values["deadline_mode"] = $this->assignment->getDeadlineMode();
1089 if ($values["deadline_mode"] === 0 && !$this->assignment->getDeadline()) {
1090 $values["deadline_mode"] = -1;
1091 }
1092 $values["relative_deadline"] = $this->assignment->getRelativeDeadline();
1093 $dt = new ilDateTime($this->assignment->getRelDeadlineLastSubmission(), IL_CAL_UNIX);
1094 $values["rel_deadline_last_subm"] = $dt->get(IL_CAL_DATETIME);
1095
1096
1097 $a_form->setValuesByArray($values);
1098
1099 // global feedback
1100 if ($this->assignment->getFeedbackFile()) {
1101 $sample_solution = $this->domain->assignment()->sampleSolution($this->assignment->getId());
1102 $a_form->getItemByPostVar("fb")->setChecked(true);
1103
1104 $a_form->getItemByPostVar("fb_file")->setValue($sample_solution->getFilename());
1105 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
1106 $a_form->getItemByPostVar("fb_file")->setInfo(
1107 // #16400
1108 '<a href="' . $ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile") . '">' .
1109 $lng->txt("download") . '</a>'
1110 );
1111 }
1112 $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1113 $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
1114
1115 $this->handleDisabledFields($a_form, true);
1116 }
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 1791 of file class.ilExAssignmentEditorGUI.php.

1791 : int
1792 {
1793 $exercise = new ilObjExercise($this->exercise_id, false);
1794 $exc_members = new ilExerciseMembers($exercise);
1795
1796 return count($exc_members->getMembers());
1797 }
Class ilExerciseMembers.
Class ilObjExercise.

References $exercise.

◆ getPeerReviewValues()

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

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

1509 : void
1510 {
1511 $values = array();
1512
1513 if ($this->assignment->getPeerReviewDeadline() > 0) {
1514 $values["peer_dl"] = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1515 }
1516
1517 $reminder = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::FEEDBACK_REMINDER);
1518 if ($reminder->getReminderStatus()) {
1519 $values["rmd_peer_status"] = $reminder->getReminderStatus();
1520 $values["rmd_peer_start"] = $reminder->getReminderStart();
1521 $values["rmd_peer_end"] = new ilDateTime($reminder->getReminderEnd(), IL_CAL_UNIX);
1522 $values["rmd_peer_freq"] = $reminder->getReminderFrequency();
1523 $values["rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1524 }
1525
1526 $a_form->setValuesByArray($values);
1527
1528 $this->handleDisabledPeerFields($a_form, true);
1529 }
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 210 of file class.ilExAssignmentEditorGUI.php.

211 {
213
214 $types = [];
215 foreach ($this->types->getAllAllowed($this->exc) as $k => $t) {
216 $types[$k] = $t->getTitle();
217 }
218
219 $ty = new ilSelectInputGUI($lng->txt("exc_assignment_type"), "type");
220 $ty->setOptions($types);
221 $ty->setRequired(true);
222 return $ty;
223 }
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 1144 of file class.ilExAssignmentEditorGUI.php.

1147 : void {
1148 // potentially disabled elements are initialized here to re-use this
1149 // method after setValuesByPost() - see updateAssignmentObject()
1150
1151 // team assignments do not support peer review
1152 // with no active peer review there is nothing to protect
1153 $peer_review = null;
1154 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1155 $this->assignment->getPeerReview()) {
1156 // #14450
1157 $peer_review = new ilExPeerReview($this->assignment);
1158 if ($peer_review->hasPeerReviewGroups()) {
1159 // deadline(s) are past and must not change
1160 $a_form->getItemByPostVar("deadline")->setDisabled(true);
1161 $a_form->getItemByPostVar("deadline2")->setDisabled(true);
1162
1163 $a_form->getItemByPostVar("peer")->setDisabled(true);
1164
1165 $a_form->getItemByPostVar("deadline_mode")->setDisabled(true);
1166 }
1167 }
1168
1169 if ($a_force_set_values ||
1170 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1171 $this->setDisabledFieldValues($a_form);
1172 }
1173 }
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 1556 of file class.ilExAssignmentEditorGUI.php.

1559 : void {
1560 // #14450
1561 $peer_review = new ilExPeerReview($this->assignment);
1562 if ($peer_review->hasPeerReviewGroups()) {
1563 // JourFixe, 2015-05-11 - editable again
1564 // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1565
1566 $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1567 $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1568 $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1569
1570 if ($this->enable_peer_review_completion) {
1571 $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1572 }
1573
1574 $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1575 $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1576 $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1577 $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1578 $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1579
1580 // required number input is a problem
1581 $min = new ilHiddenInputGUI("peer_min");
1582 $min->setValue($this->assignment->getPeerReviewMin());
1583 $a_form->addItem($min);
1584 }
1585
1586 if ($a_force_set_values ||
1587 $peer_review->hasPeerReviewGroups()) {
1588 $this->setDisabledPeerReviewFieldValues($a_form);
1589 }
1590 }
setDisabledPeerReviewFieldValues(ilPropertyFormGUI $a_form)
This class represents a hidden form property in a property form.

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 862 of file class.ilExAssignmentEditorGUI.php.

865 : void {
866 $is_create = !(bool) $a_ass->getId();
867
868 $a_ass->setTitle($a_input["title"]);
869 $a_ass->setInstruction($a_input["instruction"]);
870 if (!$this->random_manager->isActivated()) {
871 $a_ass->setMandatory($a_input["mandatory"]);
872 }
873
874 $a_ass->setStartTime($a_input["start"]);
875 $a_ass->setDeadline($a_input["deadline"]);
876 $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
877 $a_ass->setDeadlineMode($a_input["deadline_mode"]);
878 $a_ass->setRelativeDeadline((int) ($a_input["relative_deadline"] ?? 0));
879 $a_ass->setRelDeadlineLastSubmission((int) ($a_input["rel_deadline_last_subm"] ?? 0));
880
881 $a_ass->setMaxFile($a_input["max_file"]);
882 $a_ass->setTeamTutor((bool) ($a_input["team_creator"] ?? false));
883
884 //$a_ass->setPortfolioTemplateId($a_input['template_id']);
885
886 //$a_ass->setMinCharLimit($a_input['min_char_limit']);
887 //$a_ass->setMaxCharLimit($a_input['max_char_limit']);
888
889 if (!$this->random_manager->isActivated()) {
890 $a_ass->setPeerReview((bool) ($a_input["peer"] ?? false));
891 }
892
893 // peer review default values (on separate form)
894 if ($is_create) {
895 $a_ass->setPeerReviewMin(2);
896 $a_ass->setPeerReviewSimpleUnlock(0);
898 $a_ass->setPeerReviewPersonalized(false);
899 $a_ass->setPeerReviewFileUpload(false);
900 $a_ass->setPeerReviewText(true);
901 $a_ass->setPeerReviewRating(true);
902 }
903
904 if (isset($a_input["fb"])) {
905 $a_ass->setFeedbackCron((bool) $a_input["fb_cron"]); // #13380
906 $a_ass->setFeedbackDate((int) $a_input["fb_date"]);
907 $a_ass->setFeedbackDateCustom((int) $a_input["fb_date_custom"]);
908 }
909
910 // id needed for file handling
911 if ($is_create) {
912 $a_ass->save();
913
914 // #15994 - assignment files
915 if (is_array($a_input["files"])) {
916 $this->domain->assignment()->instructionFiles($a_ass->getId())->importFromLegacyUpload($a_input["files"]);
917 }
918 } else {
919 // remove global feedback file?
920 if (!isset($a_input["fb"])) {
921 $a_ass->setFeedbackFile(null);
922 }
923
924 $a_ass->update();
925 }
926
927 // add global feedback file?
928 if (isset($a_input["fb"], $a_input["fb_file"])) {
929 $a_ass->handleGlobalFeedbackFileUpload($a_ass->getId(), $a_input["fb_file"]);
930 $a_ass->update();
931 }
932 $this->importFormToAssignmentReminders($a_input, $a_ass->getId());
933 }
importFormToAssignmentReminders(array $a_input, int $a_ass_id)
setTeamTutor(bool $a_value)
setPeerReviewSimpleUnlock(int $a_value)
setRelativeDeadline(int $a_val)
setPeerReviewMin(int $a_value)
setDeadline(?int $a_val)
setExtendedDeadline(?int $a_val)
setPeerReviewText(bool $a_val)
setPeerReview(bool $a_value)
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)
handleGlobalFeedbackFileUpload(int $ass_id, array $a_file)
setRelDeadlineLastSubmission(int $a_val)
setFeedbackFile(?string $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 935 of file class.ilExAssignmentEditorGUI.php.

938 : void {
939 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::SUBMIT_REMINDER);
940 $this->saveReminderData($reminder, $a_input);
941
942 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::GRADE_REMINDER);
943 $this->saveReminderData($reminder, $a_input);
944 }
saveReminderData(ilExAssignmentReminder $reminder, array $a_input)

◆ importPeerReviewFormToAssignment()

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

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

1695 : void {
1696 $a_ass->setPeerReviewMin((int) $a_input["peer_min"]);
1697 $a_ass->setPeerReviewDeadline((int) $a_input["peer_dl"]);
1698 $a_ass->setPeerReviewSimpleUnlock((int) $a_input["peer_unlock"]);
1699 $a_ass->setPeerReviewPersonalized((bool) $a_input["peer_prsl"]);
1700
1701 // #18964
1702 $a_ass->setPeerReviewValid($a_input["peer_valid"]
1704
1705 $a_ass->setPeerReviewFileUpload((bool) $a_input["peer_file"]);
1706 $a_ass->setPeerReviewChars((int) $a_input["peer_char"]);
1707 $a_ass->setPeerReviewText((bool) $a_input["peer_text"]);
1708 $a_ass->setPeerReviewRating((bool) $a_input["peer_rating"]);
1709 $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1710 ? (int) $a_input["crit_cat"]
1711 : null);
1712
1713 $a_ass->update();
1714
1715 $this->importPeerReviewFormToAssignmentReminders($a_input, $a_ass->getId());
1716 }
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 947 of file class.ilExAssignmentEditorGUI.php.

950 : void {
951 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::FEEDBACK_REMINDER);
952 $this->saveReminderData($reminder, $a_input);
953 }

◆ initAssignmentForm()

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

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

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

1355 {
1356 $ilCtrl = $this->ctrl;
1357 $lng = $this->lng;
1358
1359 $form = new ilPropertyFormGUI();
1360 $form->setTitle($lng->txt("exc_peer_review"));
1361 $form->setFormAction($ilCtrl->getFormAction($this));
1362
1363 $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
1364 $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info")); // #16161
1365 $peer_min->setRequired(true);
1366 $peer_min->setSize(3);
1367 $peer_min->setValue(2);
1368 $form->addItem($peer_min);
1369
1370 $peer_unlock = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_simple_unlock"), "peer_unlock");
1371 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_immed"), 2));
1372 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_active"), 1));
1373 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_inactive"), 0));
1374 $peer_unlock->setRequired(true);
1375 $peer_unlock->setValue(0);
1376 $form->addItem($peer_unlock);
1377
1378 if ($this->enable_peer_review_completion) {
1379 $peer_cmpl = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_completion"), "peer_valid");
1380 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_none"), ilExAssignment::PEER_REVIEW_VALID_NONE);
1381 $option->setInfo($lng->txt("exc_peer_review_completion_none_info"));
1382 $peer_cmpl->addOption($option);
1383 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_one"), ilExAssignment::PEER_REVIEW_VALID_ONE);
1384 $option->setInfo($lng->txt("exc_peer_review_completion_one_info"));
1385 $peer_cmpl->addOption($option);
1386 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_all"), ilExAssignment::PEER_REVIEW_VALID_ALL);
1387 $option->setInfo($lng->txt("exc_peer_review_completion_all_info"));
1388 $peer_cmpl->addOption($option);
1389 $peer_cmpl->setRequired(true);
1390 $peer_cmpl->setValue(ilExAssignment::PEER_REVIEW_VALID_NONE);
1391 $form->addItem($peer_cmpl);
1392 }
1393
1394 $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
1395 $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
1396 $peer_dl->setShowTime(true);
1397 $form->addItem($peer_dl);
1398
1399 $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
1400 $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
1401 $form->addItem($peer_prsl);
1402
1403 //feedback reminders
1404 $rmd_feedback = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_feedback_setting"), "rmd_peer_status");
1405
1406 $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_feedback_start"), "rmd_peer_start");
1407 $rmd_submit_start->setSize(3);
1408 $rmd_submit_start->setMaxLength(3);
1409 $rmd_submit_start->setSuffix($lng->txt('days'));
1410 $rmd_submit_start->setRequired(true);
1411 $rmd_submit_start->setMinValue(1);
1412 $rmd_feedback->addSubItem($rmd_submit_start);
1413
1414 $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_peer_freq");
1415 $rmd_submit_frequency->setSize(3);
1416 $rmd_submit_frequency->setMaxLength(3);
1417 $rmd_submit_frequency->setSuffix($lng->txt('days'));
1418 $rmd_submit_frequency->setRequired(true);
1419 $rmd_submit_frequency->setMinValue(1);
1420 $rmd_feedback->addSubItem($rmd_submit_frequency);
1421
1422 $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_peer_end");
1423 $rmd_submit_end->setRequired(true);
1424 $rmd_feedback->addSubItem($rmd_submit_end);
1425
1426 $rmd_feedback->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::FEEDBACK_REMINDER));
1427
1428 $form->addItem($rmd_feedback);
1429
1430 // criteria
1431
1432 $cats = new ilRadioGroupInputGUI($lng->txt("exc_criteria_catalogues"), "crit_cat");
1433 $form->addItem($cats);
1434
1435 // default (no catalogue)
1436
1437 $def = new ilRadioOption($lng->txt("exc_criteria_catalogue_default"), -1);
1438 $cats->addOption($def);
1439
1440 $peer_text = new ilCheckboxInputGUI($lng->txt("exc_peer_review_text"), "peer_text");
1441 $def->addSubItem($peer_text);
1442
1443 $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
1444 $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
1445 $peer_char->setSize(3);
1446 $peer_text->addSubItem($peer_char);
1447
1448 $peer_rating = new ilCheckboxInputGUI($lng->txt("exc_peer_review_rating"), "peer_rating");
1449 $def->addSubItem($peer_rating);
1450
1451 $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
1452 $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
1453 $def->addSubItem($peer_file);
1454
1455 // catalogues
1456
1457 $cat_objs = ilExcCriteriaCatalogue::getInstancesByParentId($this->exercise_id);
1458 if (sizeof($cat_objs)) {
1459 foreach ($cat_objs as $cat_obj) {
1460 $crits = ilExcCriteria::getInstancesByParentId($cat_obj->getId());
1461
1462 // only non-empty catalogues
1463 if (sizeof($crits)) {
1464 $titles = array();
1465 foreach ($crits as $crit) {
1466 $titles[] = $crit->getTitle();
1467 }
1468 $opt = new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
1469 $opt->setInfo(implode(", ", $titles));
1470 $cats->addOption($opt);
1471 }
1472 }
1473 } else {
1474 // see ilExcCriteriaCatalogueGUI::view()
1475 $url = $ilCtrl->getLinkTargetByClass("ilexccriteriacataloguegui", "");
1476 $def->setInfo('<a href="' . $url . '">[+] ' .
1477 $lng->txt("exc_add_criteria_catalogue") .
1478 '</a>');
1479 }
1480
1481
1482 $form->addCommandButton("updatePeerReview", $lng->txt("save"));
1483 $form->addCommandButton("editAssignment", $lng->txt("cancel"));
1484
1485 return $form;
1486 }
static getInstancesByParentId(int $a_parent_id)
static getInstancesByParentId(int $a_parent_id)
$url
Definition: shib_logout.php:68

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 166 of file class.ilExAssignmentEditorGUI.php.

166 : void
167 {
169 $ilToolbar = $this->toolbar;
170 $ilCtrl = $this->ctrl;
171
172 $ilCtrl->setParameter($this, "ass_id", null);
173
174 $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "addAssignment"));
175
176 $ilToolbar->addStickyItem($this->getTypeDropdown(), true);
177
178 $this->gui->button(
179 $this->lng->txt("exc_add_assignment"),
180 "addAssignment"
181 )->submit()->toToolbar(true);
182
183 $t = new ilAssignmentsTableGUI($this, "listAssignments", $this->exercise_id);
184 $tpl->setContent($t->getHTML());
185 }

References $ctrl, $toolbar, $tpl, getTypeDropdown(), ILIAS\Repository\lng(), ilGlobalPageTemplate\setContent(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ orderAssignmentsByDeadlineObject()

ilExAssignmentEditorGUI::orderAssignmentsByDeadlineObject ( )

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

1286 : void
1287 {
1288 $lng = $this->lng;
1289 $ilCtrl = $this->ctrl;
1290
1291 ilExAssignment::orderAssByDeadline($this->exercise_id);
1292
1293 $this->tpl->setOnScreenMessage('success', $lng->txt("exc_saved_order"), true);
1294 $ilCtrl->redirect($this, "listAssignments");
1295 }
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 625 of file class.ilExAssignmentEditorGUI.php.

625 : ?array
626 {
628
629 $protected_peer_review_groups = false;
630
631 if ($this->assignment) {
632 if ($this->assignment->getPeerReview()) {
633 $peer_review = new ilExPeerReview($this->assignment);
634 if ($peer_review->hasPeerReviewGroups()) {
635 $protected_peer_review_groups = true;
636 }
637 }
638
639 if ($this->assignment->getFeedbackFile()) {
640 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
641 }
642 }
643
644 $valid = $a_form->checkInput();
645 if ($protected_peer_review_groups) {
646 // checkInput() will add alert to disabled fields
647 $a_form->getItemByPostVar("deadline")->setAlert("");
648 $a_form->getItemByPostVar("deadline2")->setAlert("");
649 }
650
651 if ($valid) {
652 $type = $a_form->getInput("type");
653 $ass_type = $this->types->getById($type);
654
655 // dates
656
657 $time_start = $a_form->getItemByPostVar("start_time")->getDate();
658 $time_start = $time_start
659 ? $time_start->get(IL_CAL_UNIX)
660 : null;
661
662 $time_fb_custom_date = $a_form->getItemByPostVar("fb_date_custom")->getDate();
663 $time_fb_custom_date = $time_fb_custom_date
664 ? $time_fb_custom_date->get(IL_CAL_UNIX)
665 : null;
666
667 $reminder_submit_end_date = $a_form->getItemByPostVar("rmd_submit_end")->getDate();
668 $reminder_submit_end_date = $reminder_submit_end_date
669 ? $reminder_submit_end_date->get(IL_CAL_UNIX)
670 : null;
671
672 $reminder_grade_end_date = $a_form->getItemByPostVar("rmd_grade_end")->getDate();
673 $reminder_grade_end_date = $reminder_grade_end_date
674 ? $reminder_grade_end_date->get(IL_CAL_UNIX)
675 : null;
676
677 $time_deadline = null;
678 $time_deadline_ext = null;
679
680 $deadline_mode = (int) $a_form->getInput("deadline_mode");
681 if ($deadline_mode === -1) {
682 $deadline_mode = 0;
683 }
684
685 if ($deadline_mode === ilExAssignment::DEADLINE_ABSOLUTE) {
686 $time_deadline = $a_form->getItemByPostVar("deadline")->getDate();
687 $time_deadline = $time_deadline
688 ? $time_deadline->get(IL_CAL_UNIX)
689 : null;
690 $time_deadline_ext = $a_form->getItemByPostVar("deadline2")->getDate();
691 $time_deadline_ext = $time_deadline_ext
692 ? $time_deadline_ext->get(IL_CAL_UNIX)
693 : null;
694 }
695
696
697 // handle disabled elements
698 if ($protected_peer_review_groups) {
699 $time_deadline = $this->assignment->getDeadline();
700 $time_deadline_ext = $this->assignment->getExtendedDeadline();
701 }
702
703 // no deadline?
704 if (!$time_deadline) {
705 // peer review
706 if (!$protected_peer_review_groups &&
707 $a_form->getInput("peer")) {
708 $a_form->getItemByPostVar("peer")
709 ->setAlert($lng->txt("exc_needs_fixed_deadline"));
710 $valid = false;
711 }
712 // global feedback
713 if ($a_form->getInput("fb") &&
714 $a_form->getInput("fb_date") == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
715 $a_form->getItemByPostVar("fb")
716 ->setAlert($lng->txt("exc_needs_deadline"));
717 $valid = false;
718 }
719 } else {
720 // #18269
721 if ($a_form->getInput("peer")) {
722 $time_deadline_max = max($time_deadline, $time_deadline_ext);
723 $peer_dl = $this->assignment // #18380
724 ? $this->assignment->getPeerReviewDeadline()
725 : null;
726 if ($peer_dl && $peer_dl < $time_deadline_max) {
727 $a_form->getItemByPostVar($peer_dl < $time_deadline_ext
728 ? "deadline2"
729 : "deadline")
730 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
731 $valid = false;
732 }
733 }
734
735 if ($time_deadline_ext && $time_deadline_ext < $time_deadline) {
736 $a_form->getItemByPostVar("deadline2")
737 ->setAlert($lng->txt("exc_deadline_ext_mismatch"));
738 $valid = false;
739 }
740
741 $time_deadline_min = $time_deadline_ext
742 ? min($time_deadline, $time_deadline_ext)
743 : $time_deadline;
744
745 // start > any deadline ?
746 if ($time_start && $time_deadline_min && $time_start > $time_deadline_min) {
747 $a_form->getItemByPostVar("start_time")
748 ->setAlert($lng->txt("exc_start_date_should_be_before_end_date"));
749 $valid = false;
750 }
751 }
752
753 if ($ass_type->usesTeams()) {
754 if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM &&
755 $a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
756 $team_validation = $this->validationTeamsFormation(
757 $a_form->getInput("number_teams"),
758 $a_form->getInput("min_participants_team"),
759 $a_form->getInput("max_participants_team")
760 );
761 if ($team_validation['status'] == 'error') {
762 $a_form->getItemByPostVar("team_creation")
763 ->setAlert($team_validation['msg']);
764 $a_form->getItemByPostVar($team_validation["field"])
765 ->setAlert($lng->txt("exc_value_can_not_set"));
766 $valid = false;
767 }
768 }
769 }
770 if ($valid) {
771 $res = array(
772 // core
773 "type" => $a_form->getInput("type")
774 ,"title" => trim($a_form->getInput("title"))
775 ,"instruction" => trim($a_form->getInput("instruction"))
776 // dates
777 ,"start" => $time_start
778 ,"deadline" => $time_deadline
779 ,"deadline_ext" => $time_deadline_ext
780 ,"max_file" => $a_form->getInput("max_file_tgl")
781 ? $a_form->getInput("max_file")
782 : null
783 );
784 if (!$this->random_manager->isActivated()) {
785 $res["mandatory"] = $a_form->getInput("mandatory");
786 }
787
788 $res['team_creator'] = $a_form->getInput("team_creator");
789 $res["team_creation"] = $a_form->getInput("team_creation");
790 if ($a_form->getInput("team_creator") == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
791 if ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
792 $res["number_teams"] = $a_form->getInput("number_teams");
793 $res["min_participants_team"] = $a_form->getInput("min_participants_team");
794 $res["max_participants_team"] = $a_form->getInput("max_participants_team");
795 } elseif ($a_form->getInput("team_creation") == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
796 $res['ass_adpt'] = $a_form->getInput("ass_adpt");
797 }
798 }
799
800 $res["deadline_mode"] = $deadline_mode;
801
802 if ($res["deadline_mode"] == ilExAssignment::DEADLINE_RELATIVE) {
803 $res["relative_deadline"] = $a_form->getInput("relative_deadline");
804 $rel_deadline_last_subm = $a_form->getItemByPostVar("rel_deadline_last_subm")->getDate();
805 $rel_deadline_last_subm = $rel_deadline_last_subm
806 ? $rel_deadline_last_subm->get(IL_CAL_UNIX)
807 : null;
808 $res["rel_deadline_last_subm"] = $rel_deadline_last_subm;
809 }
810
811 // peer
812 if ($a_form->getInput("peer") ||
813 $protected_peer_review_groups) {
814 $res["peer"] = true;
815 }
816
817 // files
818 if (isset($_FILES["files"])) {
819 // #15994 - we are keeping the upload files array structure
820 $res["files"] = $_FILES["files"];
821 }
822
823 // global feedback
824 if ($a_form->getInput("fb")) {
825 $res["fb"] = true;
826 $res["fb_cron"] = $a_form->getInput("fb_cron");
827 $res["fb_date"] = $a_form->getInput("fb_date");
828 $res["fb_date_custom"] = $time_fb_custom_date;
829
830 if ($_FILES["fb_file"]["tmp_name"]) {
831 $res["fb_file"] = $_FILES["fb_file"];
832 }
833 }
834 if ($a_form->getInput("rmd_submit_status")) {
835 $res["rmd_submit_status"] = true;
836 $res["rmd_submit_start"] = $a_form->getInput("rmd_submit_start");
837 $res["rmd_submit_freq"] = $a_form->getInput("rmd_submit_freq");
838 $res["rmd_submit_end"] = $reminder_submit_end_date;
839 $res["rmd_submit_template_id"] = $a_form->getInput("rmd_submit_template_id");
840 }
841 if ($a_form->getInput("rmd_grade_status")) {
842 $res["rmd_grade_status"] = true;
843 $res["rmd_grade_freq"] = $a_form->getInput("rmd_grade_freq");
844 $res["rmd_grade_end"] = $reminder_grade_end_date;
845 $res["rmd_grade_template_id"] = $a_form->getInput("rmd_grade_template_id");
846 }
847
848 return $res;
849 } else {
850 $this->tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
851 }
852 }
853
854 return null;
855 }
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

References $lng, $res, $valid, ilPropertyFormGUI\checkInput(), ilExAssignment\DEADLINE_ABSOLUTE, ilExAssignment\DEADLINE_RELATIVE, ilExAssignment\FEEDBACK_DATE_DEADLINE, ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), IL_CAL_UNIX, ILIAS\Repository\int(), 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 1596 of file class.ilExAssignmentEditorGUI.php.

1598 : ?array {
1599 $lng = $this->lng;
1600
1601 $protected_peer_review_groups = false;
1602 $peer_review = new ilExPeerReview($this->assignment);
1603 if ($peer_review->hasPeerReviewGroups()) {
1604 $protected_peer_review_groups = true;
1605 }
1606
1607 $valid = $a_form->checkInput();
1608 if ($valid) {
1609 // dates
1610 $time_deadline = $this->assignment->getDeadline();
1611 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1612 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1613
1614 $date = $a_form->getItemByPostVar("peer_dl")->getDate();
1615 $time_peer = $date
1616 ? $date->get(IL_CAL_UNIX)
1617 : null;
1618
1619 $reminder_date = $a_form->getItemByPostVar("rmd_peer_end")->getDate();
1620 $reminder_date = $reminder_date
1621 ? $reminder_date->get(IL_CAL_UNIX)
1622 : null;
1623
1624 // peer < any deadline?
1625 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1626 $a_form->getItemByPostVar("peer_dl")
1627 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1628 $valid = false;
1629 }
1630
1631 if (!$protected_peer_review_groups) {
1632 if ($a_form->getInput("crit_cat") < 0 &&
1633 !$a_form->getInput("peer_text") &&
1634 !$a_form->getInput("peer_rating") &&
1635 !$a_form->getInput("peer_file")) {
1636 $a_form->getItemByPostVar("peer_file")
1637 ->setAlert($lng->txt("select_one"));
1638 $valid = false;
1639 }
1640 }
1641
1642 if ($valid) {
1643 $res = array();
1644 $res["peer_dl"] = $time_peer;
1645
1646 if ($protected_peer_review_groups) {
1647 $res["peer_min"] = $this->assignment->getPeerReviewMin();
1648 $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1649 $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1650 $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1651
1652 $res["peer_text"] = $this->assignment->hasPeerReviewText();
1653 $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1654 $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1655 $res["peer_char"] = $this->assignment->getPeerReviewChars();
1656 $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1657
1658 $res["peer_valid"] = $this->enable_peer_review_completion
1659 ? $res["peer_valid"]
1660 : null;
1661 } else {
1662 $res["peer_min"] = $a_form->getInput("peer_min");
1663 $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1664 $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1665 $res["peer_valid"] = $a_form->getInput("peer_valid");
1666
1667 $res["peer_text"] = $a_form->getInput("peer_text");
1668 $res["peer_rating"] = $a_form->getInput("peer_rating");
1669 $res["peer_file"] = $a_form->getInput("peer_file");
1670 $res["peer_char"] = $a_form->getInput("peer_char");
1671 $res["crit_cat"] = $a_form->getInput("crit_cat");
1672 }
1673 if ($a_form->getInput("rmd_peer_status")) {
1674 $res["rmd_peer_status"] = $a_form->getInput("rmd_peer_status");
1675 $res["rmd_peer_start"] = $a_form->getInput("rmd_peer_start");
1676 $res["rmd_peer_end"] = $reminder_date;
1677 $res["rmd_peer_freq"] = $a_form->getInput("rmd_peer_freq");
1678 $res["rmd_peer_template_id"] = $a_form->getInput("rmd_peer_template_id");
1679 }
1680
1681 return $res;
1682 } else {
1683 $this->tpl->setOnScreenMessage('failure', $lng->txt("form_input_not_valid"));
1684 }
1685 }
1686 return null;
1687 }

◆ saveAssignmentObject()

ilExAssignmentEditorGUI::saveAssignmentObject ( )
Exceptions
ilDateTimeException
ilExcUnknownAssignmentTypeException
ilException

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

978 : void
979 {
982 $ilCtrl = $this->ctrl;
983
984 // #16163 - ignore ass id from request
985 $this->assignment = null;
986
987 $form = $this->initAssignmentForm($this->requested_type, "create");
988 $input = $this->processForm($form);
989 if (is_array($input)) {
990 $ass = new ilExAssignment();
991 $ass->setExerciseId($this->exercise_id);
992 $ass->setType($input["type"]);
993 $ass_type_gui = $this->type_guis->getById($ass->getType());
994
995 $this->importFormToAssignment($ass, $input);
996
997 $this->generateTeams($ass, $input);
998 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
999
1000 $ass_type_gui->importFormToAssignment($ass, $form);
1001 $ass->update();
1002
1003 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1004
1005 // because of sub-tabs we stay on settings screen
1006 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
1007 $ilCtrl->redirect($this, "editAssignment");
1008 } else {
1009 $form->setValuesByPost();
1010 $tpl->setContent($form->getHTML());
1011 }
1012 }
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 ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ saveAssignmentOrderObject()

ilExAssignmentEditorGUI::saveAssignmentOrderObject ( )

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

1272 : void
1273 {
1274 $lng = $this->lng;
1275 $ilCtrl = $this->ctrl;
1276
1278 $this->exercise_id,
1279 $this->requested_order
1280 );
1281
1282 $this->tpl->setOnScreenMessage('success', $lng->txt("exc_saved_order"), true);
1283 $ilCtrl->redirect($this, "listAssignments");
1284 }
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 955 of file class.ilExAssignmentEditorGUI.php.

958 : void {
959 if ($reminder->getReminderStatus() === null) {
960 $action = "save";
961 } else {
962 $action = "update";
963 }
964 $type = $reminder->getReminderType();
965 $reminder->setReminderStatus((bool) ($a_input["rmd_" . $type . "_status"] ?? false));
966 $reminder->setReminderStart((int) ($a_input["rmd_" . $type . "_start"] ?? 0));
967 $reminder->setReminderEnd((int) ($a_input["rmd_" . $type . "_end"] ?? 0));
968 $reminder->setReminderFrequency((int) ($a_input["rmd_" . $type . "_freq"] ?? 0));
969 $reminder->setReminderMailTemplate((int) ($a_input["rmd_" . $type . "_template_id"] ?? 0));
970 $reminder->{$action}();
971 }
setReminderStatus(?bool $a_status)
Set reminder for users without submission.

◆ setAssignmentHeader()

ilExAssignmentEditorGUI::setAssignmentHeader ( )

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

1297 : void
1298 {
1299 $ilTabs = $this->tabs;
1300 $lng = $this->lng;
1301 $ilCtrl = $this->ctrl;
1302 $tpl = $this->tpl;
1303 $ilHelp = $this->help;
1304
1305 $tpl->setTitle($this->assignment->getTitle());
1306 $tpl->setDescription("");
1307
1308 $ilTabs->clearTargets();
1309 $ilHelp->setScreenIdComponent("exc");
1310
1311 $ilTabs->setBackTarget(
1312 $lng->txt("back"),
1313 $ilCtrl->getLinkTarget($this, "listAssignments")
1314 );
1315
1316 $ilTabs->addTab(
1317 "ass_settings",
1318 $lng->txt("settings"),
1319 $ilCtrl->getLinkTarget($this, "editAssignment")
1320 );
1321
1322 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1323 $this->assignment->getPeerReview()) {
1324 $ilTabs->addTab(
1325 "peer_settings",
1326 $lng->txt("exc_peer_review"),
1327 $ilCtrl->getLinkTarget($this, "editPeerReview")
1328 );
1329 }
1330 $ilCtrl->setParameterByClass(ilObjExerciseGUI::class, "mode", null);
1331 $ilTabs->addTab(
1332 "ass_files",
1333 $lng->txt("exc_instruction_files"),
1334 $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", ilResourceCollectionGUI::class))
1335 );
1336 }
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, ilGlobalPageTemplate\setDescription(), and ilGlobalPageTemplate\setTitle().

Referenced by executeCommand().

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

◆ setDisabledFieldValues()

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

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

1121 : void
1122 {
1123 // dates
1124 if ($this->assignment->getDeadline() > 0) {
1125 $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
1126 $ed_item = $a_form->getItemByPostVar("deadline");
1127 $ed_item->setDate($edit_date);
1128
1129 if ($this->assignment->getExtendedDeadline() > 0) {
1130 $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
1131 $ed_item = $a_form->getItemByPostVar("deadline2");
1132 $ed_item->setDate($edit_date);
1133 }
1134 }
1135
1136 if ($this->assignment->getPeerReview()) {
1137 $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
1138 }
1139 }

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 1531 of file class.ilExAssignmentEditorGUI.php.

1531 : void
1532 {
1533 $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1534 $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1535 $a_form->getItemByPostVar("peer_unlock")->setValue($this->assignment->getPeerReviewSimpleUnlock());
1536
1537 if ($this->enable_peer_review_completion) {
1538 $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1539 }
1540
1541 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1542 if ($cat < 1) {
1543 $cat = -1;
1544
1545 // default / no catalogue
1546 $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1547 $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1548 $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1549 if ($this->assignment->getPeerReviewChars() > 0) {
1550 $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1551 }
1552 }
1553 $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1554 }

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ updateAssignmentObject()

ilExAssignmentEditorGUI::updateAssignmentObject ( )
Exceptions
ilException
ilExcUnknownAssignmentTypeException
ilDateTimeException

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

1180 : void
1181 {
1182 $tpl = $this->tpl;
1183 $lng = $this->lng;
1184 $ilCtrl = $this->ctrl;
1185 $ilTabs = $this->tabs;
1186
1187 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1188 $input = $this->processForm($form);
1189
1190 $ass_type = $this->assignment->getType();
1191 $ass_type_gui = $this->type_guis->getById($ass_type);
1192
1193 if (is_array($input)) {
1194 $old_deadline = $this->assignment->getDeadline();
1195 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1196
1197 $this->importFormToAssignment($this->assignment, $input);
1198 $this->generateTeams($this->assignment, $input);
1199
1200 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1201 $this->assignment->update();
1202
1203 $new_deadline = $this->assignment->getDeadline();
1204 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1205
1206 // if deadlines were changed
1207 if ($old_deadline != $new_deadline ||
1208 $old_ext_deadline != $new_ext_deadline) {
1209 $subm = $this->domain->submission($this->assignment->getId());
1210 $subm->recalculateLateSubmissions();
1211 }
1212
1213 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1214 $ilCtrl->redirect($this, "editAssignment");
1215 } else {
1216 $this->setAssignmentHeader();
1217 $ilTabs->activateTab("ass_settings");
1218
1219 $form->setValuesByPost();
1220 $this->handleDisabledFields($form);
1221 $tpl->setContent($form->getHTML());
1222 }
1223 }

References $lng, and ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ updatePeerReviewObject()

ilExAssignmentEditorGUI::updatePeerReviewObject ( )
protected
Exceptions
ilDateTimeException

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

1721 : void
1722 {
1723 $tpl = $this->tpl;
1724 $lng = $this->lng;
1725 $ilCtrl = $this->ctrl;
1726 $ilTabs = $this->tabs;
1727
1728 $form = $this->initPeerReviewForm();
1729 $input = $this->processPeerReviewForm($form);
1730 if (is_array($input)) {
1731 $this->importPeerReviewFormToAssignment($this->assignment, $input);
1732 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1733 $ilCtrl->redirect($this, "editPeerReview");
1734 } else {
1735 $this->setAssignmentHeader();
1736 $ilTabs->activateTab("peer_settings");
1737
1738 $form->setValuesByPost();
1739 $this->handleDisabledPeerFields($form);
1740 $tpl->setContent($form->getHTML());
1741 }
1742 }
processPeerReviewForm(ilPropertyFormGUI $a_form)
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)

References $lng, and ilGlobalPageTemplate\setContent().

+ Here is the call graph for this function:

◆ validationTeamsFormation()

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

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

1753 : array {
1754 $total_members = $this->getExerciseTotalMembers();
1755 $number_of_teams = $a_num_teams;
1756
1757 if ($number_of_teams) {
1758 $members_per_team = round($total_members / $a_num_teams);
1759 } else {
1760 if ($a_min_participants) {
1761 $number_of_teams = round($total_members / $a_min_participants);
1762 $participants_extra_team = $total_members % $a_min_participants;
1763 if ($participants_extra_team > $number_of_teams) {
1764 //Can't create teams with this minimum of participants.
1765 $message = sprintf($this->lng->txt("exc_team_minimal_too_big"), $a_min_participants);
1766 return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1767 }
1768 }
1769 $members_per_team = 0;
1770 }
1771
1772 if ($a_min_participants > $a_max_participants) {
1773 $message = $this->lng->txt("exc_team_min_big_than_max");
1774 return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1775 }
1776
1777 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1778 $message = sprintf($this->lng->txt("exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1779 return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1780 }
1781
1782 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1783 $message = sprintf($this->lng->txt("exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1784 return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1785 }
1786
1787 return array("status" => "success", "msg" => "");
1788 }
$message
Definition: xapiexit.php:31

Field Documentation

◆ $access

ilAccessHandler ilExAssignmentEditorGUI::$access
protected

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

◆ $assignment

ilExAssignment ilExAssignmentEditorGUI::$assignment
protected

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

◆ $ctrl

ilCtrl ilExAssignmentEditorGUI::$ctrl
protected

◆ $domain

ILIAS Exercise InternalDomainService ilExAssignmentEditorGUI::$domain
protected

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

◆ $enable_peer_review_completion

bool ilExAssignmentEditorGUI::$enable_peer_review_completion
protected

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

◆ $exc

ilObjExercise ilExAssignmentEditorGUI::$exc
protected

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

◆ $exercise_id

int ilExAssignmentEditorGUI::$exercise_id
protected

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

◆ $gui

ILIAS Exercise InternalGUIService ilExAssignmentEditorGUI::$gui
protected

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

◆ $help

ilHelpGUI ilExAssignmentEditorGUI::$help
protected

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

◆ $instruction_files

ILIAS Exercise InstructionFile InstructionFileManager ilExAssignmentEditorGUI::$instruction_files
protected

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

◆ $irss

ILIAS ResourceStorage Services ilExAssignmentEditorGUI::$irss
private

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

Referenced by executeCommand().

◆ $lng

ilLanguage ilExAssignmentEditorGUI::$lng
protected

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

Referenced by executeCommand(), and getTypeDropdown().

◆ $random_manager

Mandatory RandomAssignmentsManager ilExAssignmentEditorGUI::$random_manager
protected

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

◆ $ref_id

int ilExAssignmentEditorGUI::$ref_id = null
protected

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

◆ $requested_ass_ids

array ilExAssignmentEditorGUI::$requested_ass_ids
protected

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

◆ $requested_ass_type

string ilExAssignmentEditorGUI::$requested_ass_type
protected

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

◆ $requested_order

array ilExAssignmentEditorGUI::$requested_order
protected

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

◆ $requested_type

int ilExAssignmentEditorGUI::$requested_type
protected

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

◆ $settings

ilSetting ilExAssignmentEditorGUI::$settings
protected

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

◆ $tabs

ilTabsGUI ilExAssignmentEditorGUI::$tabs
protected

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

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilExAssignmentEditorGUI::$toolbar
protected

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

Referenced by listAssignmentsObject().

◆ $tpl

ilGlobalPageTemplate ilExAssignmentEditorGUI::$tpl
protected

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

Referenced by addAssignmentObject(), and listAssignmentsObject().

◆ $type_guis

ilExAssignmentTypesGUI ilExAssignmentEditorGUI::$type_guis
protected

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

◆ $types

ilExAssignmentTypes ilExAssignmentEditorGUI::$types
protected

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

Referenced by getTypeDropdown().

◆ $upload

ILIAS FileUpload FileUpload ilExAssignmentEditorGUI::$upload
private

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

◆ $user

ilObjUser ilExAssignmentEditorGUI::$user
protected

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


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