ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExAssignmentEditorGUI Class Reference

Class ilExAssignmentEditorGUI. More...

+ Collaboration diagram for ilExAssignmentEditorGUI:

Public Member Functions

 __construct ($a_exercise_id, $a_enable_peer_review_completion_settings, ilExAssignment $a_ass=null)
 Constructor. More...
 
 executeCommand ()
 
 listAssignmentsObject ()
 List assignments. More...
 
 addAssignmentObject ()
 Create assignment. More...
 
 saveAssignmentObject ()
 Save assignment. More...
 
 editAssignmentObject ()
 Edit assignment. More...
 
 getAssignmentValues (ilPropertyFormGUI $a_form)
 Get current values for assignment from. More...
 
 updateAssignmentObject ()
 Update assignment. More...
 
 confirmAssignmentsDeletionObject ()
 Confirm assignments deletion. More...
 
 deleteAssignmentsObject ()
 Delete assignments. More...
 
 saveAssignmentOrderObject ()
 Save assignments order. More...
 
 orderAssignmentsByDeadlineObject ()
 Order by deadline. More...
 
 setAssignmentHeader ()
 Set assignment header. More...
 
 downloadGlobalFeedbackFileObject ()
 
 editPeerReviewObject (ilPropertyFormGUI $a_form=null)
 
 validationTeamsFormation ($a_num_teams, $a_min_participants, $a_max_participants)
 
 getExerciseTotalMembers ()
 Get the total number of exercise members. More...
 
 generateTeams (ilExAssignment $a_assignment, $a_input)
 

Protected Member Functions

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

Protected Attributes

 $ctrl
 
 $tabs
 
 $lng
 
 $tpl
 
 $toolbar
 
 $settings
 
 $help
 
 $exercise_id
 
 $assignment
 
 $enable_peer_review_completion
 
 $types
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExAssignmentEditorGUI::__construct (   $a_exercise_id,
  $a_enable_peer_review_completion_settings,
ilExAssignment  $a_ass = null 
)

Constructor.

Parameters
int$a_exercise_id
bool$a_enable_peer_review_completion_settings
ilExAssignment$a_ass
Returns
object

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

83 {
84 global $DIC;
85
86 $this->ctrl = $DIC->ctrl();
87 $this->tabs = $DIC->tabs();
88 $this->lng = $DIC->language();
89 $this->tpl = $DIC["tpl"];
90 $this->toolbar = $DIC->toolbar();
91 $this->settings = $DIC->settings();
92 $this->help = $DIC["ilHelp"];
93 $this->exercise_id = $a_exercise_id;
94 $this->assignment = $a_ass;
95 $this->enable_peer_review_completion = (bool) $a_enable_peer_review_completion_settings;
96 include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssignmentTypes.php");
97 $this->types = ilExAssignmentTypes::getInstance();
98 include_once("./Modules/Exercise/AssignmentTypes/GUI/classes/class.ilExAssignmentTypesGUI.php");
99 $this->type_guis = ilExAssignmentTypesGUI::getInstance();
100 }
static getInstance()
Get instance.
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, ilExAssignmentTypes\getInstance(), ilExAssignmentTypesGUI\getInstance(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAssignmentObject()

ilExAssignmentEditorGUI::addAssignmentObject ( )

Create assignment.

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

183 {
186
187 // #16163 - ignore ass id from request
188 $this->assignment = null;
189
190 if (!(int) $_POST["type"]) {
191 $ilCtrl->redirect($this, "listAssignments");
192 }
193
194 $form = $this->initAssignmentForm((int) $_POST["type"], "create");
195 $tpl->setContent($form->getHTML());
196 }
$_POST["username"]
initAssignmentForm($a_type, $a_mode="create")
Init assignment form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form

References $_POST, $ctrl, $form, $ilCtrl, $tpl, and initAssignmentForm().

+ Here is the call graph for this function:

◆ confirmAssignmentsDeletionObject()

ilExAssignmentEditorGUI::confirmAssignmentsDeletionObject ( )

Confirm assignments deletion.

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

1208 {
1210 $tpl = $this->tpl;
1211 $lng = $this->lng;
1212
1213 if (!is_array($_POST["id"]) || count($_POST["id"]) == 0) {
1214 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1215 $ilCtrl->redirect($this, "listAssignments");
1216 } else {
1217 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1218 $cgui = new ilConfirmationGUI();
1219 $cgui->setFormAction($ilCtrl->getFormAction($this));
1220 $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
1221 $cgui->setCancel($lng->txt("cancel"), "listAssignments");
1222 $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
1223
1224 foreach ($_POST["id"] as $i) {
1225 $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
1226 }
1227
1228 $tpl->setContent($cgui->getHTML());
1229 }
1230 }
Confirmation screen class.
static lookupTitle($a_id)
Lookup title.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: disco.tpl.php:19

References $_POST, $i, $ilCtrl, $lng, $tpl, ilExAssignment\lookupTitle(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ deleteAssignmentsObject()

ilExAssignmentEditorGUI::deleteAssignmentsObject ( )

Delete assignments.

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

1236 {
1238 $lng = $this->lng;
1239
1240 $delete = false;
1241 if (is_array($_POST["id"])) {
1242 foreach ($_POST["id"] as $id) {
1244 $ass->delete();
1245 $delete = true;
1246 }
1247 }
1248
1249 if ($delete) {
1250 ilUtil::sendSuccess($lng->txt("exc_assignments_deleted"), true);
1251 }
1252 $ilCtrl->setParameter($this, "ass_id", "");
1253 $ilCtrl->redirect($this, "listAssignments");
1254 }
Exercise assignment.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
if(!array_key_exists('StateId', $_REQUEST)) $id

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

+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExAssignmentEditorGUI::downloadGlobalFeedbackFileObject ( )

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

1329 {
1331
1332 if (!$this->assignment ||
1333 !$this->assignment->getFeedbackFile()) {
1334 $ilCtrl->redirect($this, "returnToParent");
1335 }
1336
1337 ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
1338 }
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.

References $ilCtrl, and ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ editAssignmentObject()

ilExAssignmentEditorGUI::editAssignmentObject ( )

Edit assignment.

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

999 {
1000 $ilTabs = $this->tabs;
1001 $tpl = $this->tpl;
1002
1003 $this->setAssignmentHeader();
1004 $ilTabs->activateTab("ass_settings");
1005
1006 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1007 $this->getAssignmentValues($form);
1008 $tpl->setContent($form->getHTML());
1009 }
setAssignmentHeader()
Set assignment header.
getAssignmentValues(ilPropertyFormGUI $a_form)
Get current values for assignment from.

References $form, $tabs, and $tpl.

◆ editPeerReviewObject()

ilExAssignmentEditorGUI::editPeerReviewObject ( ilPropertyFormGUI  $a_form = null)

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

1482 {
1483 $tpl = $this->tpl;
1484 $ilTabs = $this->tabs;
1485 $tpl = $this->tpl;
1486
1487 $this->setAssignmentHeader();
1488 $ilTabs->activateTab("peer_settings");
1489
1490 if ($a_form === null) {
1491 $a_form = $this->initPeerReviewForm();
1492 $this->getPeerReviewValues($a_form);
1493 }
1494 $tpl->setContent($a_form->getHTML());
1495 }

References $tabs, and $tpl.

◆ executeCommand()

ilExAssignmentEditorGUI::executeCommand ( )

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

103 {
105 $ilTabs = $this->tabs;
107
108 $class = $ilCtrl->getNextClass($this);
109 $cmd = $ilCtrl->getCmd("listAssignments");
110
111 switch ($class) {
112 case "ilpropertyformgui":
113 $form = $this->initAssignmentForm($_GET["ass_type"]);
114 $ilCtrl->forwardCommand($form);
115 break;
116
117 // instruction files
118 case "ilexassignmentfilesystemgui":
119 $this->setAssignmentHeader();
120 $ilTabs->activateTab("ass_files");
121
122 include_once("./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
123 $fstorage = new ilFSWebStorageExercise($this->exercise_id, $this->assignment->getId());
124 $fstorage->create();
125
126 include_once("./Modules/Exercise/classes/class.ilExAssignmentFileSystemGUI.php");
127 $fs_gui = new ilExAssignmentFileSystemGUI($fstorage->getPath());
128 $fs_gui->setTitle($lng->txt("exc_instruction_files"));
129 $fs_gui->setTableId("excassfil" . $this->assignment->getId());
130 $fs_gui->setAllowDirectories(false);
131 $ilCtrl->forwardCommand($fs_gui);
132 break;
133
134 case "ilexpeerreviewgui":
135 $ilTabs->clearTargets();
136 $ilTabs->setBackTarget(
137 $lng->txt("back"),
138 $ilCtrl->getLinkTarget($this, "listAssignments")
139 );
140
141 include_once("./Modules/Exercise/classes/class.ilExPeerReviewGUI.php");
142 $peer_gui = new ilExPeerReviewGUI($this->assignment);
143 $ilCtrl->forwardCommand($peer_gui);
144 break;
145
146 default:
147 $this->{$cmd . "Object"}();
148 break;
149 }
150 }
$_GET["client_id"]
Class ilExPeerReviewGUI.

References $_GET, $ctrl, $form, $ilCtrl, $lng, $tabs, initAssignmentForm(), and setAssignmentHeader().

+ Here is the call graph for this function:

◆ generateTeams()

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

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

1787 {
1788 $ass_type = $a_assignment->getAssignmentType();
1789 if ($ass_type->usesTeams() &&
1790 $a_input['team_creator'] == ilExAssignment::TEAMS_FORMED_BY_TUTOR) {
1791 if ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_RANDOM) {
1792 $number_teams = $a_input['number_teams'];
1793 if (count(ilExAssignmentTeam::getAssignmentTeamMap($a_assignment->getId())) == 0) {
1794 $ass_team = new ilExAssignmentTeam();
1795 $ass_team->createRandomTeams($this->exercise_id, $a_assignment->getId(), $number_teams, $a_input['min_participants_team']);
1796 }
1797 } elseif ($a_input['team_creation'] == ilExAssignment::TEAMS_FORMED_BY_ASSIGNMENT) {
1798 ilExAssignmentTeam::adoptTeams($a_input["ass_adpt"], $a_assignment->getId());
1799 ilUtil::sendInfo($this->lng->txt("exc_teams_assignment_adopted"), true);
1800 }
1801 }
1802 }
Exercise assignment team.
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
static adoptTeams($a_source_ass_id, $a_target_ass_id, $a_user_id=null, $a_exc_ref_id=null)
getId()
Get assignment id.
getAssignmentType()
Get assignment type.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilExAssignmentTeam\adoptTeams(), ilExAssignmentTeam\getAssignmentTeamMap(), ilExAssignment\getAssignmentType(), ilExAssignment\getId(), ilUtil\sendInfo(), ilExAssignment\TEAMS_FORMED_BY_ASSIGNMENT, ilExAssignment\TEAMS_FORMED_BY_RANDOM, and ilExAssignment\TEAMS_FORMED_BY_TUTOR.

+ Here is the call graph for this function:

◆ getAssignmentValues()

ilExAssignmentEditorGUI::getAssignmentValues ( ilPropertyFormGUI  $a_form)

Get current values for assignment from.

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

1015 {
1016 $lng = $this->lng;
1018
1019 $ass_type_gui = $this->type_guis->getById($this->assignment->getType());
1020
1021 $values = array();
1022 $values["type"] = $this->assignment->getType();
1023 $values["title"] = $this->assignment->getTitle();
1024 $values["mandatory"] = $this->assignment->getMandatory();
1025 $values["instruction"] = $this->assignment->getInstruction();
1026 //$values['template_id'] = $this->assignment->getPortfolioTemplateId();
1027
1028 //if($this->assignment->getPortfolioTemplateId())
1029 //{
1030 // $values["template"] = 1;
1031 //}
1032
1033 /*if($this->assignment->getMinCharLimit())
1034 {
1035 $values['limit_characters'] = 1;
1036 $values['min_char_limit'] = $this->assignment->getMinCharLimit();
1037 }
1038 if($this->assignment->getMaxCharLimit())
1039 {
1040 $values['limit_characters'] = 1;
1041 $values['max_char_limit'] = $this->assignment->getMaxCharLimit();
1042 }*/
1043
1044 if ($this->assignment->getStartTime()) {
1045 $values["start_time"] = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
1046 }
1047
1048 if ($this->assignment->getAssignmentType()->usesFileUpload()) {
1049 if ($this->assignment->getMaxFile()) {
1050 $values["max_file_tgl"] = true;
1051 $values["max_file"] = $this->assignment->getMaxFile();
1052 }
1053 }
1054
1055 if ($this->assignment->getAssignmentType()->usesTeams()) {
1056 $values["team_creator"] = $this->assignment->getTeamTutor();
1057 }
1058
1059 if ($this->assignment->getFeedbackDateCustom()) {
1060 $values["fb_date_custom"] = new ilDateTime($this->assignment->getFeedbackDateCustom(), IL_CAL_UNIX);
1061 }
1062
1063 //Reminders
1064 $rmd_sub = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::SUBMIT_REMINDER);
1065 if ($rmd_sub->getReminderStatus()) {
1066 $values["rmd_submit_status"] = $rmd_sub->getReminderStatus();
1067 $values["rmd_submit_start"] = $rmd_sub->getReminderStart();
1068 $values["rmd_submit_end"] = new ilDateTime($rmd_sub->getReminderEnd(), IL_CAL_UNIX);
1069 $values["rmd_submit_freq"] = $rmd_sub->getReminderFrequency();
1070 $values["rmd_submit_template_id"] = $rmd_sub->getReminderMailTemplate();
1071 }
1072
1073 $rmd_grade = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::GRADE_REMINDER);
1074 if ($rmd_grade->getReminderStatus()) {
1075 $values["rmd_grade_status"] = $rmd_grade->getReminderStatus();
1076 $values["rmd_grade_end"] = new ilDateTime($rmd_grade->getReminderEnd(), IL_CAL_UNIX);
1077 $values["rmd_grade_freq"] = $rmd_grade->getReminderFrequency();
1078 $values["rmd_grade_template_id"] = $rmd_grade->getReminderMailTemplate();
1079 }
1080
1081 $type_values = $ass_type_gui->getFormValuesArray($this->assignment);
1082 $values = array_merge($values, $type_values);
1083
1084
1085 $values["deadline_mode"] = $this->assignment->getDeadlineMode();
1086 $values["relative_deadline"] = $this->assignment->getRelativeDeadline();
1087
1088 $a_form->setValuesByArray($values);
1089
1090 // global feedback
1091 if ($this->assignment->getFeedbackFile()) {
1092 $a_form->getItemByPostVar("fb")->setChecked(true);
1093 $a_form->getItemByPostVar("fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
1094 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
1095 $a_form->getItemByPostVar("fb_file")->setInfo(
1096 // #16400
1097 '<a href="' . $ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile") . '">' .
1098 $lng->txt("download") . '</a>'
1099 );
1100 }
1101 $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
1102 $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
1103
1104 $this->handleDisabledFields($a_form, true);
1105 }
const IL_CAL_UNIX
@classDescription Date and time handling
handleDisabledFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)
TODO: import/export reminder data with the exercise/assignment.
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
getItemByPostVar($a_post_var)
Get Item by POST variable.
$values

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

+ Here is the call graph for this function:

◆ getExerciseTotalMembers()

ilExAssignmentEditorGUI::getExerciseTotalMembers ( )

Get the total number of exercise members.

Returns
int

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

1775 {
1776 $exercise = new ilObjExercise($this->exercise_id, false);
1777 $exc_members = new ilExerciseMembers($exercise);
1778
1779 return count($exc_members->getMembers());
1780 }
Class ilExerciseMembers.
Class ilObjExercise.

References $exercise.

Referenced by initAssignmentForm().

+ Here is the caller graph for this function:

◆ getPeerReviewValues()

ilExAssignmentEditorGUI::getPeerReviewValues (   $a_form)
protected

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

1498 {
1499 $values = array();
1500
1501 if ($this->assignment->getPeerReviewDeadline() > 0) {
1502 $values["peer_dl"] = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1503 }
1504
1505 $this->assignment->getId();
1507 $reminder = new ilExAssignmentReminder($this->exercise_id, $this->assignment->getId(), ilExAssignmentReminder::FEEDBACK_REMINDER);
1508 if ($reminder->getReminderStatus()) {
1509 $values["rmd_peer_status"] = $reminder->getReminderStatus();
1510 $values["rmd_peer_start"] = $reminder->getReminderStart();
1511 $values["rmd_peer_end"] = new ilDateTime($reminder->getReminderEnd(), IL_CAL_UNIX);
1512 $values["rmd_peer_freq"] = $reminder->getReminderFrequency();
1513 $values["rmd_peer_template_id"] = $reminder->getReminderMailTemplate();
1514 }
1515
1516 $a_form->setValuesByArray($values);
1517
1518 $this->handleDisabledPeerFields($a_form, true);
1519 }
handleDisabledPeerFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)

References $values, ilExAssignmentReminder\FEEDBACK_REMINDER, and IL_CAL_UNIX.

◆ getTypeDropdown()

ilExAssignmentEditorGUI::getTypeDropdown ( )
protected

Get type selection dropdown.

Returns
ilSelectInputGUI

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

204 {
206
207 $types = [];
208 foreach ($this->types->getAllActivated() as $k => $t) {
209 $types[$k] = $t->getTitle();
210 }
211
212 $ty = new ilSelectInputGUI($lng->txt("exc_assignment_type"), "type");
213 $ty->setOptions($types);
214 $ty->setRequired(true);
215 return $ty;
216 }
This class represents a selection list property in a property form.

References $lng, $t, and $types.

Referenced by initAssignmentForm(), and listAssignmentsObject().

+ Here is the caller graph for this function:

◆ handleDisabledFields()

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

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

1128 {
1129 // potentially disabled elements are initialized here to re-use this
1130 // method after setValuesByPost() - see updateAssignmentObject()
1131
1132 // team assignments do not support peer review
1133 // with no active peer review there is nothing to protect
1134 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1135 $this->assignment->getPeerReview()) {
1136 // #14450
1137 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1138 $peer_review = new ilExPeerReview($this->assignment);
1139 if ($peer_review->hasPeerReviewGroups()) {
1140 // deadline(s) are past and must not change
1141 $a_form->getItemByPostVar("deadline")->setDisabled(true);
1142 $a_form->getItemByPostVar("deadline2")->setDisabled(true);
1143
1144 $a_form->getItemByPostVar("peer")->setDisabled(true);
1145
1146 $a_form->getItemByPostVar("deadline_mode")->setDisabled(true);
1147 }
1148 }
1149
1150 if ($a_force_set_values ||
1151 ($peer_review && $peer_review->hasPeerReviewGroups())) {
1152 $this->setDisabledFieldValues($a_form);
1153 }
1154 }
setDisabledFieldValues(ilPropertyFormGUI $a_form)
Exercise peer review.

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ handleDisabledPeerFields()

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

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

1547 {
1548 // #14450
1549 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1550 $peer_review = new ilExPeerReview($this->assignment);
1551 if ($peer_review->hasPeerReviewGroups()) {
1552 // JourFixe, 2015-05-11 - editable again
1553 // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1554
1555 $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1556 $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1557 $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1558
1559 if ($this->enable_peer_review_completion) {
1560 $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1561 }
1562
1563 $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1564 $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1565 $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1566 $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1567 $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1568
1569 // required number input is a problem
1570 $min = new ilHiddenInputGUI("peer_min");
1571 $min->setValue($this->assignment->getPeerReviewMin());
1572 $a_form->addItem($min);
1573 }
1574
1575 if ($a_force_set_values ||
1576 $peer_review->hasPeerReviewGroups()) {
1577 $this->setDisabledPeerReviewFieldValues($a_form);
1578 }
1579 }
setDisabledPeerReviewFieldValues(ilPropertyFormGUI $a_form)
This class represents a hidden form property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).

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.

Parameters
ilExAssignment$a_ass
array$a_input

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

854 {
855 $is_create = !(bool) $a_ass->getId();
856
857 $a_ass->setTitle($a_input["title"]);
858 $a_ass->setInstruction($a_input["instruction"]);
859 $a_ass->setMandatory($a_input["mandatory"]);
860
861 $a_ass->setStartTime($a_input["start"]);
862 $a_ass->setDeadline($a_input["deadline"]);
863 $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
864 $a_ass->setDeadlineMode($a_input["deadline_mode"]);
865 $a_ass->setRelativeDeadline($a_input["relative_deadline"]);
866
867 $a_ass->setMaxFile($a_input["max_file"]);
868 $a_ass->setTeamTutor($a_input["team_creator"]);
869
870 //$a_ass->setPortfolioTemplateId($a_input['template_id']);
871
872 //$a_ass->setMinCharLimit($a_input['min_char_limit']);
873 //$a_ass->setMaxCharLimit($a_input['max_char_limit']);
874
875 $a_ass->setPeerReview((bool) $a_input["peer"]);
876
877 // peer review default values (on separate form)
878 if ($is_create) {
879 $a_ass->setPeerReviewMin(2);
880 $a_ass->setPeerReviewSimpleUnlock(false);
882 $a_ass->setPeerReviewPersonalized(false);
883 $a_ass->setPeerReviewFileUpload(false);
884 $a_ass->setPeerReviewText(true);
885 $a_ass->setPeerReviewRating(true);
886 }
887
888 if ($a_input["fb"]) {
889 $a_ass->setFeedbackCron($a_input["fb_cron"]); // #13380
890 $a_ass->setFeedbackDate($a_input["fb_date"]);
891 $a_ass->setFeedbackDateCustom($a_input["fb_date_custom"]);
892 }
893
894 // id needed for file handling
895 if ($is_create) {
896 $a_ass->save();
897
898 // #15994 - assignment files
899 if (is_array($a_input["files"])) {
900 $a_ass->uploadAssignmentFiles($a_input["files"]);
901 }
902 } else {
903 // remove global feedback file?
904 if (!$a_input["fb"]) {
905 $a_ass->deleteGlobalFeedbackFile();
906 $a_ass->setFeedbackFile(null);
907 }
908
909 $a_ass->update();
910 }
911
912 // add global feedback file?
913 if ($a_input["fb"]) {
914 if (is_array($a_input["fb_file"])) {
915 $a_ass->handleGlobalFeedbackFileUpload($a_input["fb_file"]);
916 $a_ass->update();
917 }
918 }
919 $this->importFormToAssignmentReminders($a_input, $a_ass->getId());
920 }
importFormToAssignmentReminders($a_input, $a_ass_id)
setDeadline($a_val)
Set deadline (timestamp)
setPeerReviewRating($a_val)
Set peer review rating.
setPeerReview($a_value)
Toggle peer review.
setTeamTutor($a_value)
Set team management by tutor.
setFeedbackCron($a_value)
Toggle (global) feedback file cron.
setTitle($a_val)
Set title.
setFeedbackDateCustom($a_value)
Set (global) feedback file availability using a custom date.
setPeerReviewPersonalized($a_val)
Set peer review personalized.
setRelativeDeadline($a_val)
Set relative deadline.
setPeerReviewValid($a_value)
Set peer review validation.
handleGlobalFeedbackFileUpload(array $a_file)
setPeerReviewText($a_val)
Set peer review text.
setPeerReviewSimpleUnlock($a_value)
Set peer review simple unlock.
setExtendedDeadline($a_val)
Set extended deadline (timestamp)
setPeerReviewMin($a_value)
Set peer review minimum.
setInstruction($a_val)
Set instruction.
uploadAssignmentFiles($a_files)
Upload assignment files (from creation form)
setDeadlineMode($a_val)
Set deadline mode.
setMaxFile($a_value)
Set max number of uploads.
setStartTime($a_val)
Set start time (timestamp)
setFeedbackDate($a_value)
Set (global) feedback file availability date.
setPeerReviewFileUpload($a_val)
Set peer review file upload.
save()
Save assignment.
setFeedbackFile($a_value)
Set (global) feedback file.
setMandatory($a_val)
Set mandatory.

References ilExAssignment\deleteGlobalFeedbackFile(), ilExAssignment\getId(), ilExAssignment\handleGlobalFeedbackFileUpload(), importFormToAssignmentReminders(), ilExAssignment\PEER_REVIEW_VALID_NONE, ilExAssignment\save(), ilExAssignment\setDeadline(), ilExAssignment\setDeadlineMode(), ilExAssignment\setExtendedDeadline(), ilExAssignment\setFeedbackCron(), ilExAssignment\setFeedbackDate(), ilExAssignment\setFeedbackDateCustom(), ilExAssignment\setFeedbackFile(), ilExAssignment\setInstruction(), ilExAssignment\setMandatory(), ilExAssignment\setMaxFile(), ilExAssignment\setPeerReview(), ilExAssignment\setPeerReviewFileUpload(), ilExAssignment\setPeerReviewMin(), ilExAssignment\setPeerReviewPersonalized(), ilExAssignment\setPeerReviewRating(), ilExAssignment\setPeerReviewSimpleUnlock(), ilExAssignment\setPeerReviewText(), ilExAssignment\setPeerReviewValid(), ilExAssignment\setRelativeDeadline(), ilExAssignment\setStartTime(), ilExAssignment\setTeamTutor(), ilExAssignment\setTitle(), ilExAssignment\update(), and ilExAssignment\uploadAssignmentFiles().

+ Here is the call graph for this function:

◆ importFormToAssignmentReminders()

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

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

923 {
924 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::SUBMIT_REMINDER);
925 $this->saveReminderData($reminder, $a_input);
926
927 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::GRADE_REMINDER);
928 $this->saveReminderData($reminder, $a_input);
929 }
saveReminderData(ilExAssignmentReminder $reminder, $a_input)

References ilExAssignmentReminder\GRADE_REMINDER, saveReminderData(), and ilExAssignmentReminder\SUBMIT_REMINDER.

Referenced by importFormToAssignment().

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

◆ importPeerReviewFormToAssignment()

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

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

1674 {
1675 $a_ass->setPeerReviewMin($a_input["peer_min"]);
1676 $a_ass->setPeerReviewDeadline($a_input["peer_dl"]);
1677 $a_ass->setPeerReviewSimpleUnlock($a_input["peer_unlock"]);
1678 $a_ass->setPeerReviewPersonalized($a_input["peer_prsl"]);
1679
1680 // #18964
1681 $a_ass->setPeerReviewValid($a_input["peer_valid"]
1682 ? $a_input["peer_valid"]
1684
1685 $a_ass->setPeerReviewFileUpload($a_input["peer_file"]);
1686 $a_ass->setPeerReviewChars($a_input["peer_char"]);
1687 $a_ass->setPeerReviewText($a_input["peer_text"]);
1688 $a_ass->setPeerReviewRating($a_input["peer_rating"]);
1689 $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1690 ? $a_input["crit_cat"]
1691 : null);
1692
1693 $a_ass->update();
1694
1695 $this->importPeerReviewFormToAssignmentReminders($a_input, $a_ass->getId());
1696 }
importPeerReviewFormToAssignmentReminders($a_input, $a_ass_id)
setPeerReviewChars($a_value)
Set peer review minimum characters.
setPeerReviewCriteriaCatalogue($a_value)
Set peer review criteria catalogue id.
setPeerReviewDeadline($a_val)
Set peer review deadline (timestamp)

References ilExAssignment\getId(), ilExAssignment\PEER_REVIEW_VALID_NONE, ilExAssignment\setPeerReviewChars(), ilExAssignment\setPeerReviewCriteriaCatalogue(), ilExAssignment\setPeerReviewDeadline(), ilExAssignment\setPeerReviewFileUpload(), ilExAssignment\setPeerReviewMin(), ilExAssignment\setPeerReviewPersonalized(), ilExAssignment\setPeerReviewRating(), ilExAssignment\setPeerReviewSimpleUnlock(), ilExAssignment\setPeerReviewText(), ilExAssignment\setPeerReviewValid(), and ilExAssignment\update().

+ Here is the call graph for this function:

◆ importPeerReviewFormToAssignmentReminders()

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

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

933 {
934 $reminder = new ilExAssignmentReminder($this->exercise_id, $a_ass_id, ilExAssignmentReminder::FEEDBACK_REMINDER);
935 $this->saveReminderData($reminder, $a_input);
936 }

References ilExAssignmentReminder\FEEDBACK_REMINDER, and saveReminderData().

+ Here is the call graph for this function:

◆ initAssignmentForm()

ilExAssignmentEditorGUI::initAssignmentForm (   $a_type,
  $a_mode = "create" 
)
protected

Init assignment form.

Parameters
int$a_type
int$a_mode"create"/"edit"

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

225 {
228
229 $ass_type = $this->types->getById($a_type);
230 $ass_type_gui = $this->type_guis->getById($a_type);
231 $ilCtrl->setParameter($this, "ass_type", $a_type);
232
233 $lng->loadLanguageModule("form");
234 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
235 $form = new ilPropertyFormGUI();
236 if ($a_mode == "edit") {
237 $form->setTitle($lng->txt("exc_edit_assignment"));
238 } else {
239 $form->setTitle($lng->txt("exc_new_assignment"));
240 }
241 $form->setFormAction($ilCtrl->getFormAction($this));
242
243 // title
244 $ti = new ilTextInputGUI($lng->txt("title"), "title");
245 $ti->setMaxLength(200);
246 $ti->setRequired(true);
247 $form->addItem($ti);
248
249 // type
250 $ty = $this->getTypeDropdown();
251 $ty->setValue($a_type);
252 $ty->setDisabled(true);
253 $form->addItem($ty);
254
255 //
256 // type specific start
257 //
258
259 $ass_type_gui->addEditFormCustomProperties($form);
260
261 //
262 // type specific end
263 //
264
265 if ($ass_type->usesTeams()) {
266 if ($a_mode == "edit") {
267 $has_teams = (bool) count(ilExAssignmentTeam::getAssignmentTeamMap($this->assignment->getId()));
268 } else {
269 $has_teams = false;
270 }
271
272 // Radio for creators
273 $rd_team = new ilRadioGroupInputGUI($lng->txt("exc_team_formation"), "team_creator");
274
275 $radio_participants = new ilRadioOption(
276 $lng->txt("exc_team_by_participants"),
278 $lng->txt("exc_team_by_participants_info")
279 );
280
281 $radio_tutors = new ilRadioOption(
282 $lng->txt("exc_team_by_tutors"),
284 $lng->txt("exc_team_by_tutors_info")
285 );
286
287 #23679
288 if (!$has_teams) {
289 // Creation options
290 $rd_creation_method = new ilRadioGroupInputGUI($lng->txt("exc_team_creation"), "team_creation");
291 $rd_creation_method->setRequired(true);
292
293 //manual
294 $rd_creation_manual = new ilRadioOption(
295 $lng->txt("exc_team_by_tutors_manual"),
296 0,
297 $lng->txt("exc_team_by_tutors_manual_info")
298 );
299 $rd_creation_method->addOption($rd_creation_manual);
300
301 //random options
302 $add_info = "";
303 if ($this->getExerciseTotalMembers() < 4) {
304 $add_info = " <strong>" . $lng->txt("exc_team_by_random_add_info") . "</strong>";
305 }
306 $rd_creation_random = new ilRadioOption(
307 $lng->txt("exc_team_by_random"),
309 $lng->txt("exc_team_by_random_info") . "<br>" . $lng->txt("exc_total_members") . ": " . $this->getExerciseTotalMembers() . $add_info
310 );
311 $rd_creation_method->addOption($rd_creation_random);
312
313 $number_teams = new ilNumberInputGUI($lng->txt("exc_num_teams"), "number_teams");
314 $number_teams->setSize(3);
315 $number_teams->setMinValue(1);
316 $number_teams->setMaxValue($this->getExerciseTotalMembers());
317 $number_teams->setRequired(true);
318 $number_teams->setSuffix($lng->txt("exc_team_assignment_adopt_teams"));
319 $rd_creation_random->addSubItem($number_teams);
320
321 $min_team_participants = new ilNumberInputGUI($lng->txt("exc_min_team_participants"), "min_participants_team");
322 $min_team_participants->setSize(3);
323 $min_team_participants->setMinValue(1);
324 $min_team_participants->setMaxValue($this->getExerciseTotalMembers());
325 $min_team_participants->setRequired(true);
326 $min_team_participants->setSuffix($lng->txt("exc_participants"));
327 $rd_creation_random->addSubItem($min_team_participants);
328
329 $max_team_participants = new ilNumberInputGUI($lng->txt("exc_max_team_participants"), "max_participants_team");
330 $max_team_participants->setSize(3);
331 $max_team_participants->setMinValue(1);
332 $max_team_participants->setMaxValue($this->getExerciseTotalMembers());
333 $max_team_participants->setRequired(true);
334 $max_team_participants->setSuffix($lng->txt("exc_participants"));
335 $rd_creation_random->addSubItem($max_team_participants);
336
338 if (count($options)) {
339 $radio_assignment = new ilRadioOption(
340 $lng->txt("exc_team_by_assignment"),
342 $lng->txt("exc_team_by_assignment_info")
343 );
344
345 $radio_assignment_adopt = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
346 $radio_assignment_adopt->setRequired(true);
347 $radio_assignment_adopt->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1));
348
349 foreach ($options as $id => $item) {
350 $option = new ilRadioOption($item["title"], $id);
351 $option->setInfo($lng->txt("exc_team_assignment_adopt_teams") . ": " . $item["teams"]);
352 $radio_assignment_adopt->addOption($option);
353 }
354 $radio_assignment->addSubItem($radio_assignment_adopt);
355 $rd_creation_method->addOption($radio_assignment);
356 }
357
358 $radio_tutors->addSubItem($rd_creation_method);
359 }
360 $rd_team->addOption($radio_participants);
361 $rd_team->addOption($radio_tutors);
362 /*if(!$has_teams) {
363 $rd_team->addOption($radio_assignment);
364 }*/
365 $form->addItem($rd_team);
366
367 if ($has_teams) {
368 $rd_team->setDisabled(true);
369 }
370 }
371
372 // mandatory
373 $cb = new ilCheckboxInputGUI($lng->txt("exc_mandatory"), "mandatory");
374 $cb->setInfo($lng->txt("exc_mandatory_info"));
375 $cb->setChecked(true);
376 $form->addItem($cb);
377
378 // Work Instructions
379 $sub_header = new ilFormSectionHeaderGUI();
380 $sub_header->setTitle($lng->txt("exc_work_instructions"), "work_instructions");
381 $form->addItem($sub_header);
382
383 $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
384 $desc_input->setRows(20);
385 $desc_input->setUseRte(true);
386 $desc_input->setRteTagSet("mini");
387 $form->addItem($desc_input);
388
389 // files
390 if ($a_mode == "create") {
391 $files = new ilFileWizardInputGUI($lng->txt('objs_file'), 'files');
392 $files->setFilenames(array(0 => ''));
393 $form->addItem($files);
394 }
395
396 // Schedule
397 $sub_header = new ilFormSectionHeaderGUI();
398 $sub_header->setTitle($lng->txt("exc_schedule"), "schedule");
399 $form->addItem($sub_header);
400
401 // start time
402 $start_date = new ilDateTimeInputGUI($lng->txt("exc_start_time"), "start_time");
403 $start_date->setShowTime(true);
404 $form->addItem($start_date);
405
406 // Deadline Mode
407 $radg = new ilRadioGroupInputGUI($lng->txt("exc_deadline"), "deadline_mode");
408 $radg->setValue(0);
409 $op1 = new ilRadioOption($lng->txt("exc_fixed_date"), 0, $lng->txt("exc_fixed_date_info"));
410 $radg->addOption($op1);
411 $op2 = new ilRadioOption($lng->txt("exc_relative_date"), 1, $lng->txt("exc_relative_date_info"));
412 $radg->addOption($op2);
413 $form->addItem($radg);
414
415 // Deadline fixed date
416 $deadline = new ilDateTimeInputGUI($lng->txt("date"), "deadline");
417 $deadline->setShowTime(true);
418 $op1->addSubItem($deadline);
419
420 // extended Deadline
421 $deadline2 = new ilDateTimeInputGUI($lng->txt("exc_deadline_extended"), "deadline2");
422 $deadline2->setInfo($lng->txt("exc_deadline_extended_info"));
423 $deadline2->setShowTime(true);
424 $deadline->addSubItem($deadline2);
425
426
427 // submit reminder
428 $rmd_submit = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_submit_setting"), "rmd_submit_status");
429
430 $rmd_submit_start = new ilNumberInputGUI($this->lng->txt("exc_reminder_start"), "rmd_submit_start");
431 $rmd_submit_start->setSize(3);
432 $rmd_submit_start->setMaxLength(3);
433 $rmd_submit_start->setSuffix($lng->txt('days'));
434 $rmd_submit_start->setInfo($this->lng->txt("exc_reminder_start_info"));
435 $rmd_submit_start->setRequired(true);
436 $rmd_submit_start->setMinValue(1);
437 $rmd_submit->addSubItem($rmd_submit_start);
438
439 $rmd_submit_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_submit_freq");
440 $rmd_submit_frequency->setSize(3);
441 $rmd_submit_frequency->setMaxLength(3);
442 $rmd_submit_frequency->setSuffix($lng->txt('days'));
443 $rmd_submit_frequency->setRequired(true);
444 $rmd_submit_frequency->setMinValue(1);
445 $rmd_submit->addSubItem($rmd_submit_frequency);
446
447 $rmd_submit_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_submit_end");
448 $rmd_submit_end->setRequired(true);
449 $rmd_submit->addSubItem($rmd_submit_end);
450
451 $rmd_submit->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::SUBMIT_REMINDER));
452
453 // grade reminder
454 $rmd_grade = new ilCheckboxInputGUI($this->lng->txt("exc_reminder_grade_setting"), "rmd_grade_status");
455
456 $rmd_grade_frequency = new ilNumberInputGUI($this->lng->txt("exc_reminder_frequency"), "rmd_grade_freq");
457 $rmd_grade_frequency->setSize(3);
458 $rmd_grade_frequency->setMaxLength(3);
459 $rmd_grade_frequency->setSuffix($lng->txt('days'));
460 $rmd_grade_frequency->setRequired(true);
461 $rmd_grade_frequency->setMinValue(1);
462 $rmd_grade->addSubItem($rmd_grade_frequency);
463
464 $rmd_grade_end = new ilDateTimeInputGUI($lng->txt("exc_reminder_end"), "rmd_grade_end");
465 $rmd_grade_end->setRequired(true);
466 $rmd_grade->addSubItem($rmd_grade_end);
467
468 $rmd_grade->addSubItem($this->addMailTemplatesRadio(ilExAssignmentReminder::GRADE_REMINDER));
469
470 $form->addItem($rmd_submit);
471 $form->addItem($rmd_grade);
472
473 // relative deadline
474 $ti = new ilNumberInputGUI($lng->txt("days"), "relative_deadline");
475 $ti->setMaxLength(3);
476 $ti->setSize(3);
477 $op2->addSubItem($ti);
478
479
480 // max number of files
481 if ($ass_type->usesFileUpload()) {
482 $sub_header = new ilFormSectionHeaderGUI();
483 $sub_header->setTitle($ass_type->getTitle());
484 $form->addItem($sub_header);
485 $max_file_tgl = new ilCheckboxInputGUI($lng->txt("exc_max_file_tgl"), "max_file_tgl");
486 $form->addItem($max_file_tgl);
487
488 $max_file = new ilNumberInputGUI($lng->txt("exc_max_file"), "max_file");
489 $max_file->setInfo($lng->txt("exc_max_file_info"));
490 $max_file->setRequired(true);
491 $max_file->setSize(3);
492 $max_file->setMinValue(1);
493 $max_file_tgl->addSubItem($max_file);
494 }
495
496 // after submission
497 $sub_header = new ilFormSectionHeaderGUI();
498 $sub_header->setTitle($lng->txt("exc_after_submission"), "after_submission");
499 $form->addItem($sub_header);
500 if (!$ass_type->usesTeams()) {
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 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
542 } else {
543 $form->addCommandButton("updateAssignment", $lng->txt("save"));
544 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
545 }
546
547 return $form;
548 }
This class represents a checkbox property in a property form.
This class represents a date/time property in a property form.
getExerciseTotalMembers()
Get the total number of exercise members.
getTypeDropdown()
Get type selection dropdown.
static getAdoptableTeamAssignments($a_exercise_id, $a_exclude_ass_id=null, $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.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
$files
Definition: metarefresh.php:49
$a_type
Definition: workflow.php:92

References $a_type, $ctrl, $files, $form, $id, $ilCtrl, $lng, PHPMailer\PHPMailer\$options, ilExAssignment\FEEDBACK_DATE_CUSTOM, ilExAssignment\FEEDBACK_DATE_DEADLINE, ilExAssignment\FEEDBACK_DATE_SUBMISSION, ilExAssignmentTeam\getAdoptableTeamAssignments(), ilExAssignmentTeam\getAssignmentTeamMap(), getExerciseTotalMembers(), getTypeDropdown(), ilExAssignmentReminder\GRADE_REMINDER, ilExAssignmentReminder\SUBMIT_REMINDER, ilExAssignment\TEAMS_FORMED_BY_ASSIGNMENT, ilExAssignment\TEAMS_FORMED_BY_PARTICIPANTS, ilExAssignment\TEAMS_FORMED_BY_RANDOM, and ilExAssignment\TEAMS_FORMED_BY_TUTOR.

Referenced by addAssignmentObject(), and executeCommand().

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

◆ initPeerReviewForm()

ilExAssignmentEditorGUI::initPeerReviewForm ( )
protected

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

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

References $def, $form, $ilCtrl, $lng, $url, ilExAssignmentReminder\FEEDBACK_REMINDER, ilExcCriteria\getInstancesByParentId(), ilExcCriteriaCatalogue\getInstancesByParentId(), 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 ( )

List assignments.

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

156 {
158 $ilToolbar = $this->toolbar;
161
162 $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "addAssignment"));
163
164 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
165 $ilToolbar->addStickyItem($this->getTypeDropdown());
166
167 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
168 $button = ilSubmitButton::getInstance();
169 $button->setCaption("exc_add_assignment");
170 $button->setCommand("addAssignment");
171 $ilToolbar->addStickyItem($button);
172
173
174 include_once("./Modules/Exercise/classes/class.ilAssignmentsTableGUI.php");
175 $t = new ilAssignmentsTableGUI($this, "listAssignments", $this->exercise_id);
176 $tpl->setContent($t->getHTML());
177 }
static getInstance()
Factory.

References $ctrl, $ilCtrl, $lng, $t, $toolbar, $tpl, ilSubmitButton\getInstance(), and getTypeDropdown().

+ Here is the call graph for this function:

◆ orderAssignmentsByDeadlineObject()

ilExAssignmentEditorGUI::orderAssignmentsByDeadlineObject ( )

Order by deadline.

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

1274 {
1275 $lng = $this->lng;
1277
1278 ilExAssignment::orderAssByDeadline($this->exercise_id);
1279
1280 ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
1281 $ilCtrl->redirect($this, "listAssignments");
1282 }
static orderAssByDeadline($a_ex_id)
Order assignments by deadline date.

References $ilCtrl, $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

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

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

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

+ Here is the call graph for this function:

◆ processPeerReviewForm()

ilExAssignmentEditorGUI::processPeerReviewForm ( ilPropertyFormGUI  $a_form)
protected

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

1582 {
1583 $lng = $this->lng;
1584
1585 $protected_peer_review_groups = false;
1586 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1587 $peer_review = new ilExPeerReview($this->assignment);
1588 if ($peer_review->hasPeerReviewGroups()) {
1589 $protected_peer_review_groups = true;
1590 }
1591
1592 $valid = $a_form->checkInput();
1593 if ($valid) {
1594 // dates
1595 $time_deadline = $this->assignment->getDeadline();
1596 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1597 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1598
1599 $date = $a_form->getItemByPostVar("peer_dl")->getDate();
1600 $time_peer = $date
1601 ? $date->get(IL_CAL_UNIX)
1602 : null;
1603
1604 $reminder_date = $a_form->getItemByPostVar("rmd_peer_end")->getDate();
1605 $reminder_date = $reminder_date
1606 ? $reminder_date->get(IL_CAL_UNIX)
1607 : null;
1608
1609 // peer < any deadline?
1610 if ($time_peer && $time_deadline_max && $time_peer < $time_deadline_max) {
1611 $a_form->getItemByPostVar("peer_dl")
1612 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1613 $valid = false;
1614 }
1615
1616 if (!$protected_peer_review_groups) {
1617 if ($a_form->getInput("crit_cat") < 0 &&
1618 !$a_form->getInput("peer_text") &&
1619 !$a_form->getInput("peer_rating") &&
1620 !$a_form->getInput("peer_file")) {
1621 $a_form->getItemByPostVar("peer_file")
1622 ->setAlert($lng->txt("select_one"));
1623 $valid = false;
1624 }
1625 }
1626
1627 if ($valid) {
1628 $res = array();
1629 $res["peer_dl"] = $time_peer;
1630
1631 if ($protected_peer_review_groups) {
1632 $res["peer_min"] = $this->assignment->getPeerReviewMin();
1633 $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1634 $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1635 $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1636
1637 $res["peer_text"] = $this->assignment->hasPeerReviewText();
1638 $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1639 $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1640 $res["peer_char"] = $this->assignment->getPeerReviewChars();
1641 $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1642
1643 $res["peer_valid"] = $this->enable_peer_review_completion
1644 ? $res["peer_valid"]
1645 : null;
1646 } else {
1647 $res["peer_min"] = $a_form->getInput("peer_min");
1648 $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1649 $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1650 $res["peer_valid"] = $a_form->getInput("peer_valid");
1651
1652 $res["peer_text"] = $a_form->getInput("peer_text");
1653 $res["peer_rating"] = $a_form->getInput("peer_rating");
1654 $res["peer_file"] = $a_form->getInput("peer_file");
1655 $res["peer_char"] = $a_form->getInput("peer_char");
1656 $res["crit_cat"] = $a_form->getInput("crit_cat");
1657 }
1658 if ($a_form->getInput("rmd_peer_status")) {
1659 $res["rmd_peer_status"] = $a_form->getInput("rmd_peer_status");
1660 $res["rmd_peer_start"] = $a_form->getInput("rmd_peer_start");
1661 $res["rmd_peer_end"] = $reminder_date;
1662 $res["rmd_peer_freq"] = $a_form->getInput("rmd_peer_freq");
1663 $res["rmd_peer_template_id"] = $a_form->getInput("rmd_peer_template_id");
1664 }
1665
1666 return $res;
1667 } else {
1668 ilUtil::sendFailure($lng->txt("form_input_not_valid"));
1669 }
1670 }
1671 }

References $lng, $res, $valid, ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), IL_CAL_UNIX, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ saveAssignmentObject()

ilExAssignmentEditorGUI::saveAssignmentObject ( )

Save assignment.

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

959 {
963
964 // #16163 - ignore ass id from request
965 $this->assignment = null;
966
967 $form = $this->initAssignmentForm((int) $_POST["type"], "create");
968 $input = $this->processForm($form);
969 if (is_array($input)) {
970 $ass = new ilExAssignment();
971 $ass->setExerciseId($this->exercise_id);
972 $ass->setType($input["type"]);
973 $ass_type = $ass->getAssignmentType();
974 $ass_type_gui = $this->type_guis->getById($ass->getType());
975
976 $this->importFormToAssignment($ass, $input);
977
978 $this->generateTeams($ass, $input);
979 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
980
981 $ass_type_gui->importFormToAssignment($ass, $form);
982 $ass->update();
983
984 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
985
986 // because of sub-tabs we stay on settings screen
987 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
988 $ilCtrl->redirect($this, "editAssignment");
989 } else {
990 $form->setValuesByPost();
991 $tpl->setContent($form->getHtml());
992 }
993 }
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
processForm(ilPropertyFormGUI $a_form)
Custom form validation.
generateTeams(ilExAssignment $a_assignment, $a_input)

References $_POST, $form, $ilCtrl, $input, $lng, and $tpl.

◆ saveAssignmentOrderObject()

ilExAssignmentEditorGUI::saveAssignmentOrderObject ( )

Save assignments order.

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

1260 {
1261 $lng = $this->lng;
1263
1264 ilExAssignment::saveAssOrderOfExercise($this->exercise_id, $_POST["order"]);
1265
1266 ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
1267 $ilCtrl->redirect($this, "listAssignments");
1268 }
static saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.

References $_POST, $ilCtrl, $lng, and ilExAssignment\saveAssOrderOfExercise().

+ Here is the call graph for this function:

◆ saveReminderData()

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

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

939 {
940 if ($reminder->getReminderStatus() == null) {
941 $action = "save";
942 } else {
943 $action = "update";
944 }
945 $type = $reminder->getReminderType();
946 $reminder->setReminderStatus((bool) $a_input["rmd_" . $type . "_status"]);
947 $reminder->setReminderStart((int) $a_input["rmd_" . $type . "_start"]);
948 $reminder->setReminderEnd((int) $a_input["rmd_" . $type . "_end"]);
949 $reminder->setReminderFrequency((int) $a_input["rmd_" . $type . "_freq"]);
950 $reminder->setReminderMailTemplate((int) $a_input["rmd_" . $type . "_template_id"]);
951 $reminder->{$action}();
952 }
setReminderFrequency($a_num_days)
Set frequency in days.
setReminderEnd($a_date)
Set the ending of the reminder.
setReminderStatus($a_status)
Set reminder for users without submission.
setReminderStart($a_num_days)
Set num days before the deadline to start sending notifications.
getReminderStatus()
Get the reminder status.
$action

References $action, $type, ilExAssignmentReminder\getReminderStatus(), ilExAssignmentReminder\getReminderType(), ilExAssignmentReminder\setReminderEnd(), ilExAssignmentReminder\setReminderFrequency(), ilExAssignmentReminder\setReminderMailTemplate(), ilExAssignmentReminder\setReminderStart(), and ilExAssignmentReminder\setReminderStatus().

Referenced by importFormToAssignmentReminders(), and importPeerReviewFormToAssignmentReminders().

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

◆ setAssignmentHeader()

ilExAssignmentEditorGUI::setAssignmentHeader ( )

Set assignment header.

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

1288 {
1289 $ilTabs = $this->tabs;
1290 $lng = $this->lng;
1292 $tpl = $this->tpl;
1293 $ilHelp = $this->help;
1294
1295 $tpl->setTitle($this->assignment->getTitle());
1296 $tpl->setDescription("");
1297
1298 $ilTabs->clearTargets();
1299 $ilHelp->setScreenIdComponent("exc");
1300
1301 $ilTabs->setBackTarget(
1302 $lng->txt("back"),
1303 $ilCtrl->getLinkTarget($this, "listAssignments")
1304 );
1305
1306 $ilTabs->addTab(
1307 "ass_settings",
1308 $lng->txt("settings"),
1309 $ilCtrl->getLinkTarget($this, "editAssignment")
1310 );
1311
1312 if (!$this->assignment->getAssignmentType()->usesTeams() &&
1313 $this->assignment->getPeerReview()) {
1314 $ilTabs->addTab(
1315 "peer_settings",
1316 $lng->txt("exc_peer_review"),
1317 $ilCtrl->getLinkTarget($this, "editPeerReview")
1318 );
1319 }
1320
1321 $ilTabs->addTab(
1322 "ass_files",
1323 $lng->txt("exc_instruction_files"),
1324 $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", "ilexassignmentfilesystemgui"), "listFiles")
1325 );
1326 }

References $ilCtrl, $lng, $tabs, and $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ setDisabledFieldValues()

ilExAssignmentEditorGUI::setDisabledFieldValues ( ilPropertyFormGUI  $a_form)
protected

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

1108 {
1109 // dates
1110 if ($this->assignment->getDeadline() > 0) {
1111 $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
1112 $ed_item = $a_form->getItemByPostVar("deadline");
1113 $ed_item->setDate($edit_date);
1114
1115 if ($this->assignment->getExtendedDeadline() > 0) {
1116 $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
1117 $ed_item = $a_form->getItemByPostVar("deadline2");
1118 $ed_item->setDate($edit_date);
1119 }
1120 }
1121
1122 if ($this->assignment->getPeerReview()) {
1123 $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
1124 }
1125 }

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

1522 {
1523 $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1524 $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1525 $a_form->getItemByPostVar("peer_unlock")->setValue((int) $this->assignment->getPeerReviewSimpleUnlock());
1526
1527 if ($this->enable_peer_review_completion) {
1528 $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1529 }
1530
1531 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1532 if ($cat < 1) {
1533 $cat = -1;
1534
1535 // default / no catalogue
1536 $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1537 $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1538 $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1539 if ($this->assignment->getPeerReviewChars() > 0) {
1540 $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1541 }
1542 }
1543 $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1544 }

References ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ updateAssignmentObject()

ilExAssignmentEditorGUI::updateAssignmentObject ( )

Update assignment.

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

1161 {
1162 $tpl = $this->tpl;
1163 $lng = $this->lng;
1165 $ilTabs = $this->tabs;
1166
1167 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
1168 $input = $this->processForm($form);
1169
1170 $ass_type = $this->assignment->getType();
1171 $ass_type_gui = $this->type_guis->getById($ass_type);
1172
1173 if (is_array($input)) {
1174 $old_deadline = $this->assignment->getDeadline();
1175 $old_ext_deadline = $this->assignment->getExtendedDeadline();
1176
1177 $this->importFormToAssignment($this->assignment, $input);
1178 $this->generateTeams($this->assignment, $input);
1179
1180 $ass_type_gui->importFormToAssignment($this->assignment, $form);
1181 $this->assignment->update();
1182
1183 $new_deadline = $this->assignment->getDeadline();
1184 $new_ext_deadline = $this->assignment->getExtendedDeadline();
1185
1186 // if deadlines were changed
1187 if ($old_deadline != $new_deadline ||
1188 $old_ext_deadline != $new_ext_deadline) {
1189 $this->assignment->recalculateLateSubmissions();
1190 }
1191
1192 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1193 $ilCtrl->redirect($this, "editAssignment");
1194 } else {
1195 $this->setAssignmentHeader();
1196 $ilTabs->activateTab("ass_settings");
1197
1198 $form->setValuesByPost();
1200 $tpl->setContent($form->getHtml());
1201 }
1202 }

References $form, $ilCtrl, $input, $lng, $tabs, and $tpl.

◆ updatePeerReviewObject()

ilExAssignmentEditorGUI::updatePeerReviewObject ( )
protected

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

1699 {
1700 $tpl = $this->tpl;
1701 $lng = $this->lng;
1703 $ilTabs = $this->tabs;
1704
1705 $form = $this->initPeerReviewForm();
1707 if (is_array($input)) {
1708 $this->importPeerReviewFormToAssignment($this->assignment, $input);
1709 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1710 $ilCtrl->redirect($this, "editPeerReview");
1711 } else {
1712 $this->setAssignmentHeader();
1713 $ilTabs->activateTab("peer_settings");
1714
1715 $form->setValuesByPost();
1717 $tpl->setContent($form->getHtml());
1718 }
1719 }
processPeerReviewForm(ilPropertyFormGUI $a_form)
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)

References $form, $ilCtrl, $input, $lng, $tabs, and $tpl.

◆ validationTeamsFormation()

ilExAssignmentEditorGUI::validationTeamsFormation (   $a_num_teams,
  $a_min_participants,
  $a_max_participants 
)
Parameters
$a_num_teamsinteger
$a_min_participantsinteger
$a_max_participantsinteger
Returns
array

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

1733 {
1734 $total_members = $this->getExerciseTotalMembers();
1735 $number_of_teams = $a_num_teams;
1736
1737 if ($number_of_teams) {
1738 $members_per_team = round($total_members / $a_num_teams);
1739 } else {
1740 if ($a_min_participants) {
1741 $number_of_teams = round($total_members / $a_min_participants);
1742 $participants_extra_team = $total_members % $a_min_participants;
1743 if ($participants_extra_team > $number_of_teams) {
1744 //Can't create teams with this minimum of participants.
1745 $message = sprintf($this->lng->txt("exc_team_minimal_too_big"), $a_min_participants);
1746 return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1747 }
1748 }
1749 $members_per_team = 0;
1750 }
1751
1752 if ($a_min_participants > $a_max_participants) {
1753 $message = $this->lng->txt("exc_team_min_big_than_max");
1754 return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1755 }
1756
1757 if ($a_max_participants > 0 && $members_per_team > $a_max_participants) {
1758 $message = sprintf($this->lng->txt("exc_team_max_small_than_members"), $a_max_participants, $members_per_team);
1759 return array("status" => "error", "msg" => $message, "field" => "max_participants_team");
1760 }
1761
1762 if ($members_per_team > 0 && $members_per_team < $a_min_participants) {
1763 $message = sprintf($this->lng->txt("exc_team_min_small_than_members"), $a_min_participants, $members_per_team);
1764 return array("status" => "error", "msg" => $message, "field" => "min_participants_team");
1765 }
1766
1767 return array("status" => "success", "msg" => "");
1768 }
catch(Exception $e) $message

References $message.

Referenced by processForm().

+ Here is the caller graph for this function:

Field Documentation

◆ $assignment

ilExAssignmentEditorGUI::$assignment
protected

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

◆ $ctrl

ilExAssignmentEditorGUI::$ctrl
protected

◆ $enable_peer_review_completion

ilExAssignmentEditorGUI::$enable_peer_review_completion
protected

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

◆ $exercise_id

ilExAssignmentEditorGUI::$exercise_id
protected

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

◆ $help

ilExAssignmentEditorGUI::$help
protected

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

◆ $lng

ilExAssignmentEditorGUI::$lng
protected

◆ $settings

ilExAssignmentEditorGUI::$settings
protected

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

◆ $tabs

ilExAssignmentEditorGUI::$tabs
protected

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

Referenced by executeCommand().

◆ $toolbar

ilExAssignmentEditorGUI::$toolbar
protected

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

Referenced by listAssignmentsObject().

◆ $tpl

ilExAssignmentEditorGUI::$tpl
protected

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

Referenced by addAssignmentObject(), and listAssignmentsObject().

◆ $types

ilExAssignmentEditorGUI::$types
protected

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

Referenced by getTypeDropdown().


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