ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 adoptTeamAssignmentsFormObject ()
 
 adoptTeamAssignmentsObject ()
 

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...
 
 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

 $exercise_id
 
 $assignment
 
 $enable_peer_review_completion
 

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

31 {
32 $this->exercise_id = $a_exercise_id;
33 $this->assignment = $a_ass;
34 $this->enable_peer_review_completion = (bool)$a_enable_peer_review_completion_settings;
35 }

Member Function Documentation

◆ addAssignmentObject()

ilExAssignmentEditorGUI::addAssignmentObject ( )

Create assignment.

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

107 {
108 global $tpl, $ilCtrl;
109
110 // #16163 - ignore ass id from request
111 $this->assignment = null;
112
113 if(!(int)$_POST["type"])
114 {
115 $ilCtrl->redirect($this, "listAssignments");
116 }
117
118 $form = $this->initAssignmentForm((int)$_POST["type"], "create");
119 $tpl->setContent($form->getHTML());
120 }
global $tpl
Definition: ilias.php:8
initAssignmentForm($a_type, $a_mode="create")
Init assignment form.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

◆ adoptTeamAssignmentsFormObject()

ilExAssignmentEditorGUI::adoptTeamAssignmentsFormObject ( )

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

1252 {
1253 global $ilCtrl, $ilTabs, $lng, $tpl;
1254
1255 if(!$this->assignment)
1256 {
1257 $ilCtrl->redirect($this, "listAssignments");
1258 }
1259
1260 $ilTabs->clearTargets();
1261 $ilTabs->setBackTarget($lng->txt("back"),
1262 $ilCtrl->getLinkTarget($this, "listAssignments"));
1263
1264 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1265 $form = new ilPropertyFormGUI();
1266 $form->setTitle($lng->txt("exc_team_assignment_adopt"));
1267 $form->setFormAction($ilCtrl->getFormAction($this, "adoptTeamAssignments"));
1268
1269 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1270 $options = ilExAssignmentTeam::getAdoptableTeamAssignments($this->assignment->getExerciseId());
1271
1272 // we must not have existing teams in assignment
1273 if(array_key_exists($this->assignment->getId(), $options))
1274 {
1275 $ilCtrl->redirect($this, "listAssignments");
1276 }
1277
1278 $teams = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
1279 $teams->setValue(-1);
1280
1281 $teams->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1));
1282
1283 foreach($options as $id => $item)
1284 {
1285 $option = new ilRadioOption($item["title"], $id);
1286 $option->setInfo($lng->txt("exc_team_assignment_adopt_teams").": ".$item["teams"]);
1287 $teams->addOption($option);
1288 }
1289
1290 $form->addItem($teams);
1291
1292 $form->addCommandButton("adoptTeamAssignments", $lng->txt("save"));
1293 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
1294
1295 $tpl->setContent($form->getHTML());
1296 }
static getAdoptableTeamAssignments($a_exercise_id, $a_exclude_ass_id=null, $a_user_id=null)
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.
global $lng
Definition: privfeed.php:40
if(!is_array($argv)) $options

References $ilCtrl, $lng, $options, $tpl, and ilExAssignmentTeam\getAdoptableTeamAssignments().

+ Here is the call graph for this function:

◆ adoptTeamAssignmentsObject()

ilExAssignmentEditorGUI::adoptTeamAssignmentsObject ( )

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

1299 {
1300 global $ilCtrl, $lng;
1301
1302 $src_ass_id = (int)$_POST["ass_adpt"];
1303
1304 if($this->assignment &&
1305 $src_ass_id > 0)
1306 {
1307 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1308 ilExAssignmentTeam::adoptTeams($src_ass_id, $this->assignment->getId());
1309
1310 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
1311 }
1312
1313 $ilCtrl->redirect($this, "listAssignments");
1314 }
static adoptTeams($a_source_ass_id, $a_target_ass_id, $a_user_id=null, $a_exc_ref_id=null)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, $ilCtrl, $lng, ilExAssignmentTeam\adoptTeams(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ confirmAssignmentsDeletionObject()

ilExAssignmentEditorGUI::confirmAssignmentsDeletionObject ( )

Confirm assignments deletion.

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

769 {
770 global $ilCtrl, $tpl, $lng;
771
772 if (!is_array($_POST["id"]) || count($_POST["id"]) == 0)
773 {
774 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
775 $ilCtrl->redirect($this, "listAssignments");
776 }
777 else
778 {
779 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
780 $cgui = new ilConfirmationGUI();
781 $cgui->setFormAction($ilCtrl->getFormAction($this));
782 $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
783 $cgui->setCancel($lng->txt("cancel"), "listAssignments");
784 $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
785
786 foreach ($_POST["id"] as $i)
787 {
788 $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
789 }
790
791 $tpl->setContent($cgui->getHTML());
792 }
793 }
Confirmation screen class.
static lookupTitle($a_id)
Lookup title.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

+ Here is the call graph for this function:

◆ deleteAssignmentsObject()

ilExAssignmentEditorGUI::deleteAssignmentsObject ( )

Delete assignments.

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

799 {
800 global $ilCtrl, $lng;
801
802 $delete = false;
803 if (is_array($_POST["id"]))
804 {
805 foreach($_POST["id"] as $id)
806 {
807 $ass = new ilExAssignment(ilUtil::stripSlashes($id));
808 $ass->delete();
809 $delete = true;
810 }
811 }
812
813 if ($delete)
814 {
815 ilUtil::sendSuccess($lng->txt("exc_assignments_deleted"), true);
816 }
817 $ilCtrl->setParameter($this, "ass_id", "");
818 $ilCtrl->redirect($this, "listAssignments");
819 }
Exercise assignment.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExAssignmentEditorGUI::downloadGlobalFeedbackFileObject ( )

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

881 {
882 global $ilCtrl;
883
884 if(!$this->assignment ||
885 !$this->assignment->getFeedbackFile())
886 {
887 $ilCtrl->redirect($this, "returnToParent");
888 }
889
890 ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
891 }
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 599 of file class.ilExAssignmentEditorGUI.php.

600 {
601 global $tpl, $ilTabs, $tpl;
602
603 $this->setAssignmentHeader();
604 $ilTabs->activateTab("ass_settings");
605
606 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
607 $this->getAssignmentValues($form);
608 $tpl->setContent($form->getHTML());
609 }
setAssignmentHeader()
Set assignment header.
getAssignmentValues(ilPropertyFormGUI $a_form)
Get current values for assignment from

References $tpl, getAssignmentValues(), initAssignmentForm(), and setAssignmentHeader().

+ Here is the call graph for this function:

◆ editPeerReviewObject()

ilExAssignmentEditorGUI::editPeerReviewObject ( ilPropertyFormGUI  $a_form = null)

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

1016 {
1017 global $tpl, $ilTabs, $tpl;
1018
1019 $this->setAssignmentHeader();
1020 $ilTabs->activateTab("peer_settings");
1021
1022 if($a_form === null)
1023 {
1024 $a_form = $this->initPeerReviewForm();
1025 $this->getPeerReviewValues($a_form);
1026 }
1027 $tpl->setContent($a_form->getHTML());
1028 }

References $tpl, getPeerReviewValues(), initPeerReviewForm(), and setAssignmentHeader().

+ Here is the call graph for this function:

◆ executeCommand()

ilExAssignmentEditorGUI::executeCommand ( )

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

38 {
39 global $ilCtrl, $ilTabs, $lng;
40
41 $class = $ilCtrl->getNextClass($this);
42 $cmd = $ilCtrl->getCmd("listAssignments");
43
44 switch($class)
45 {
46 // instruction files
47 case "ilfilesystemgui":
48 $this->setAssignmentHeader();
49 $ilTabs->activateTab("ass_files");
50
51 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
52 $fstorage = new ilFSStorageExercise($this->exercise_id, $this->assignment->getId());
53 $fstorage->create();
54
55 include_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
56 $fs_gui = new ilFileSystemGUI($fstorage->getPath());
57 $fs_gui->setTitle($lng->txt("exc_instruction_files"));
58 $fs_gui->setTableId("excassfil".$this->assignment->getId());
59 $fs_gui->setAllowDirectories(false);
60 $ilCtrl->forwardCommand($fs_gui);
61 break;
62
63 case "ilexpeerreviewgui":
64 $ilTabs->clearTargets();
65 $ilTabs->setBackTarget($lng->txt("back"),
66 $ilCtrl->getLinkTarget($this, "listAssignments"));
67
68 include_once("./Modules/Exercise/classes/class.ilExPeerReviewGUI.php");
69 $peer_gui = new ilExPeerReviewGUI($this->assignment);
70 $ilCtrl->forwardCommand($peer_gui);
71 break;
72
73 default:
74 $this->{$cmd."Object"}();
75 break;
76 }
77 }
Class ilExPeerReviewGUI.
File System Explorer GUI class.
$cmd
Definition: sahs_server.php:35

References $cmd, $ilCtrl, $lng, and setAssignmentHeader().

+ Here is the call graph for this function:

◆ getAssignmentValues()

ilExAssignmentEditorGUI::getAssignmentValues ( ilPropertyFormGUI  $a_form)

Get current values for assignment from

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

615 {
616 global $lng, $ilCtrl;
617
618 $values = array();
619 $values["type"] = $this->assignment->getType();
620 $values["title"] = $this->assignment->getTitle();
621 $values["mandatory"] = $this->assignment->getMandatory();
622 $values["instruction"] = $this->assignment->getInstruction();
623
624 if ($this->assignment->getStartTime())
625 {
626 $values["start_time_cb"] = true;
627 $edit_date = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
628 $ed_item = $a_form->getItemByPostVar("start_time");
629 $ed_item->setDate($edit_date);
630 }
631
632 if($this->assignment->getType() == ilExAssignment::TYPE_UPLOAD ||
633 $this->assignment->getType() == ilExAssignment::TYPE_UPLOAD_TEAM)
634 {
635 if ($this->assignment->getMaxFile())
636 {
637 $values["max_file_tgl"] = true;
638 $values["max_file"] = $this->assignment->getMaxFile();
639 }
640 }
641
642 if($this->assignment->getType() == ilExAssignment::TYPE_UPLOAD_TEAM)
643 {
644 $values["team_tutor"] = $this->assignment->getTeamTutor();
645 }
646
647 $a_form->setValuesByArray($values);
648
649 // global feedback
650 if($this->assignment->getFeedbackFile())
651 {
652 $a_form->getItemByPostVar("fb")->setChecked(true);
653 $a_form->getItemByPostVar("fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
654 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
655 $a_form->getItemByPostVar("fb_file")->setInfo(
656 // #16400
657 '<a href="'.$ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile").'">'.
658 $lng->txt("download").'</a>'
659 );
660 }
661 $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
662 $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
663
664 $this->handleDisabledFields($a_form, true);
665 }
const IL_CAL_UNIX
@classDescription Date and time handling
handleDisabledFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
getItemByPostVar($a_post_var)
Get Item by POST variable.

References $ilCtrl, $lng, ilPropertyFormGUI\getItemByPostVar(), handleDisabledFields(), IL_CAL_UNIX, ilPropertyFormGUI\setValuesByArray(), ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by editAssignmentObject().

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

◆ getPeerReviewValues()

ilExAssignmentEditorGUI::getPeerReviewValues (   $a_form)
protected

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

1031 {
1032 $values = array();
1033
1034 if($this->assignment->getPeerReviewDeadline() > 0)
1035 {
1036 $values["peer_dl_tgl"] = true;
1037 $peer_dl_date = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1038 $peer_dl = $a_form->getItemByPostVar("peer_dl");
1039 $peer_dl->setDate($peer_dl_date);
1040 }
1041
1042 $a_form->setValuesByArray($values);
1043
1044 $this->handleDisabledPeerFields($a_form, true);
1045 }
handleDisabledPeerFields(ilPropertyFormGUI $a_form, $a_force_set_values=false)

References handleDisabledPeerFields(), and IL_CAL_UNIX.

Referenced by editPeerReviewObject().

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

◆ getTypeDropdown()

ilExAssignmentEditorGUI::getTypeDropdown ( )
protected

Get type selection dropdown.

Returns
ilSelectInputGUI

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

128 {
129 global $ilSetting, $lng;
130
131 $types = array(
132 ilExAssignment::TYPE_UPLOAD => $lng->txt("exc_type_upload"),
133 ilExAssignment::TYPE_UPLOAD_TEAM => $lng->txt("exc_type_upload_team"),
134 ilExAssignment::TYPE_TEXT => $lng->txt("exc_type_text")
135 );
136 if(!$ilSetting->get('disable_wsp_blogs'))
137 {
138 $types[ilExAssignment::TYPE_BLOG] = $lng->txt("exc_type_blog");
139 }
140 if($ilSetting->get('user_portfolios'))
141 {
142 $types[ilExAssignment::TYPE_PORTFOLIO] = $lng->txt("exc_type_portfolio");
143 }
144 $ty = new ilSelectInputGUI($lng->txt("exc_assignment_type"), "type");
145 $ty->setOptions($types);
146 $ty->setRequired(true);
147 return $ty;
148 }
This class represents a selection list property in a property form.
global $ilSetting
Definition: privfeed.php:40

References $ilSetting, $lng, ilExAssignment\TYPE_BLOG, ilExAssignment\TYPE_PORTFOLIO, ilExAssignment\TYPE_TEXT, ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

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

693 {
694 // potentially disabled elements are initialized here to re-use this
695 // method after setValuesByPost() - see updateAssignmentObject()
696
697 // team assignments do not support peer review
698 // with no active peer review there is nothing to protect
699 if($this->assignment->getType() != ilExAssignment::TYPE_UPLOAD_TEAM &&
700 $this->assignment->getPeerReview())
701 {
702 // #14450
703 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
704 $peer_review = new ilExPeerReview($this->assignment);
705 if($peer_review->hasPeerReviewGroups())
706 {
707 // deadline(s) are past and must not change
708 $a_form->getItemByPostVar("deadline_cb")->setDisabled(true);
709 $a_form->getItemByPostVar("deadline")->setDisabled(true);
710 $a_form->getItemByPostVar("deadline2_cb")->setDisabled(true);
711 $a_form->getItemByPostVar("deadline2")->setDisabled(true);
712
713 $a_form->getItemByPostVar("peer")->setDisabled(true);
714 }
715 }
716
717 if($a_force_set_values ||
718 ($peer_review && $peer_review->hasPeerReviewGroups()))
719 {
720 $this->setDisabledFieldValues($a_form);
721 }
722 }
setDisabledFieldValues(ilPropertyFormGUI $a_form)
Exercise peer review.

References ilPropertyFormGUI\getItemByPostVar(), setDisabledFieldValues(), and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by getAssignmentValues(), and updateAssignmentObject().

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

◆ handleDisabledPeerFields()

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

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

1076 {
1077 // #14450
1078 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1079 $peer_review = new ilExPeerReview($this->assignment);
1080 if($peer_review->hasPeerReviewGroups())
1081 {
1082 // JourFixe, 2015-05-11 - editable again
1083 // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1084
1085 $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1086 $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1087 $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1088
1089 if($this->enable_peer_review_completion)
1090 {
1091 $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1092 }
1093
1094 $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1095 $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1096 $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1097 $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1098 $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1099
1100 // required number input is a problem
1101 $min = new ilHiddenInputGUI("peer_min");
1102 $min->setValue($this->assignment->getPeerReviewMin());
1103 $a_form->addItem($min);
1104 }
1105
1106 if($a_force_set_values ||
1107 $peer_review->hasPeerReviewGroups())
1108 {
1109 $this->setDisabledPeerReviewFieldValues($a_form);
1110 }
1111 }
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(), ilPropertyFormGUI\getItemByPostVar(), and setDisabledPeerReviewFieldValues().

Referenced by getPeerReviewValues(), and updatePeerReviewObject().

+ Here is the call graph for this function:
+ Here is the caller 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 483 of file class.ilExAssignmentEditorGUI.php.

484 {
485 $is_create = !(bool)$a_ass->getId();
486
487 $a_ass->setTitle($a_input["title"]);
488 $a_ass->setInstruction($a_input["instruction"]);
489 $a_ass->setMandatory($a_input["mandatory"]);
490
491 $a_ass->setStartTime($a_input["start"]);
492 $a_ass->setDeadline($a_input["deadline"]);
493 $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
494
495 $a_ass->setMaxFile($a_input["max_file"]);
496 $a_ass->setTeamTutor($a_input["team_tutor"]);
497
498 $a_ass->setPeerReview((bool)$a_input["peer"]);
499
500 // peer review default values (on separate form)
501 if($is_create)
502 {
503 $a_ass->setPeerReviewMin(2);
504 $a_ass->setPeerReviewSimpleUnlock(false);
506 $a_ass->setPeerReviewPersonalized(false);
507 $a_ass->setPeerReviewFileUpload(false);
508 $a_ass->setPeerReviewText(true);
509 $a_ass->setPeerReviewRating(true);
510 }
511
512 if($a_input["fb"])
513 {
514 $a_ass->setFeedbackCron($a_input["fb_cron"]); // #13380
515 $a_ass->setFeedbackDate($a_input["fb_date"]);
516 }
517
518 // id needed for file handling
519 if($is_create)
520 {
521 $a_ass->save();
522
523 // #15994 - assignment files
524 if(is_array($a_input["files"]))
525 {
526 $a_ass->uploadAssignmentFiles($a_input["files"]);
527 }
528 }
529 else
530 {
531 // remove global feedback file?
532 if(!$a_input["fb"])
533 {
534 $a_ass->deleteGlobalFeedbackFile();
535 $a_ass->setFeedbackFile(null);
536 }
537
538 $a_ass->update();
539 }
540
541 // add global feedback file?
542 if($a_input["fb"])
543 {
544 if(is_array($a_input["fb_file"]))
545 {
546 $a_ass->handleGlobalFeedbackFileUpload($a_input["fb_file"]);
547 $a_ass->update();
548 }
549 }
550 }
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.
getId()
Get assignment id.
setPeerReviewPersonalized($a_val)
Set peer review personalized.
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)
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(), ilExAssignment\PEER_REVIEW_VALID_NONE, ilExAssignment\save(), ilExAssignment\setDeadline(), ilExAssignment\setExtendedDeadline(), ilExAssignment\setFeedbackCron(), ilExAssignment\setFeedbackDate(), 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\setStartTime(), ilExAssignment\setTeamTutor(), ilExAssignment\setTitle(), ilExAssignment\update(), and ilExAssignment\uploadAssignmentFiles().

Referenced by saveAssignmentObject(), and updateAssignmentObject().

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

1204 {
1205 $a_ass->setPeerReviewMin($a_input["peer_min"]);
1206 $a_ass->setPeerReviewDeadline($a_input["peer_dl"]);
1207 $a_ass->setPeerReviewSimpleUnlock($a_input["peer_unlock"]);
1208 $a_ass->setPeerReviewValid($a_input["peer_valid"]);
1209 $a_ass->setPeerReviewPersonalized($a_input["peer_prsl"]);
1210
1211 $a_ass->setPeerReviewFileUpload($a_input["peer_file"]);
1212 $a_ass->setPeerReviewChars($a_input["peer_char"]);
1213 $a_ass->setPeerReviewText($a_input["peer_text"]);
1214 $a_ass->setPeerReviewRating($a_input["peer_rating"]);
1215 $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1216 ? $a_input["crit_cat"]
1217 : null);
1218
1219 $a_ass->update();
1220 }
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\setPeerReviewChars(), ilExAssignment\setPeerReviewCriteriaCatalogue(), ilExAssignment\setPeerReviewDeadline(), ilExAssignment\setPeerReviewFileUpload(), ilExAssignment\setPeerReviewMin(), ilExAssignment\setPeerReviewPersonalized(), ilExAssignment\setPeerReviewRating(), ilExAssignment\setPeerReviewSimpleUnlock(), ilExAssignment\setPeerReviewText(), ilExAssignment\setPeerReviewValid(), and ilExAssignment\update().

Referenced by updatePeerReviewObject().

+ Here is the call graph for this function:
+ Here is the caller 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 156 of file class.ilExAssignmentEditorGUI.php.

157 {
158 global $lng, $ilCtrl;
159
160 $lng->loadLanguageModule("form");
161 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
162 $form = new ilPropertyFormGUI();
163 $form->setTableWidth("600px");
164 if ($a_mode == "edit")
165 {
166 $form->setTitle($lng->txt("exc_edit_assignment"));
167 }
168 else
169 {
170 $form->setTitle($lng->txt("exc_new_assignment"));
171 }
172 $form->setFormAction($ilCtrl->getFormAction($this));
173
174 // type
175 $ty = $this->getTypeDropdown();
176 $ty->setValue($a_type);
177 $ty->setDisabled(true);
178 $form->addItem($ty);
179
180 // title
181 $ti = new ilTextInputGUI($lng->txt("title"), "title");
182 $ti->setMaxLength(200);
183 $ti->setRequired(true);
184 $form->addItem($ti);
185
186 // start time y/n
187 $cb = new ilCheckboxInputGUI($lng->txt("exc_start_time"), "start_time_cb");
188 $form->addItem($cb);
189
190 // start time
191 $edit_date = new ilDateTimeInputGUI("", "start_time");
192 $edit_date->setShowTime(true);
193 $cb->addSubItem($edit_date);
194
195
196 // deadline y/n
197 $dcb = new ilCheckboxInputGUI($lng->txt("exc_deadline"), "deadline_cb");
198 $dcb->setChecked(true);
199 $form->addItem($dcb);
200
201 // Deadline
202 $edit_date = new ilDateTimeInputGUI($lng->txt(""), "deadline");
203 $edit_date->setShowTime(true);
204 $dcb->addSubItem($edit_date);
205
206 // extended deadline y/n
207 $edcb = new ilCheckboxInputGUI($lng->txt("exc_deadline_extended"), "deadline2_cb");
208 $dcb->addSubItem($edcb);
209
210 // extended Deadline
211 $deadline2 = new ilDateTimeInputGUI($lng->txt(""), "deadline2");
212 $deadline2->setInfo($lng->txt("exc_deadline_extended_info"));
213 $deadline2->setShowTime(true);
214 $edcb->addSubItem($deadline2);
215
216 // mandatory
217 $cb = new ilCheckboxInputGUI($lng->txt("exc_mandatory"), "mandatory");
218 $cb->setInfo($lng->txt("exc_mandatory_info"));
219 $cb->setChecked(true);
220 $form->addItem($cb);
221
222 // Work Instructions
223 $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
224 $desc_input->setRows(20);
225 $desc_input->setUseRte(true);
226 $desc_input->setRteTagSet("mini");
227 $form->addItem($desc_input);
228
229 // files
230 if ($a_mode == "create")
231 {
232 $files = new ilFileWizardInputGUI($lng->txt('objs_file'),'files');
233 $files->setFilenames(array(0 => ''));
234 $form->addItem($files);
235 }
236
237 // max number of files
238 if($a_type == ilExAssignment::TYPE_UPLOAD ||
240 {
241 $max_file_tgl = new ilCheckboxInputGUI($lng->txt("exc_max_file_tgl"), "max_file_tgl");
242 $form->addItem($max_file_tgl);
243
244 $max_file = new ilNumberInputGUI($lng->txt("exc_max_file"), "max_file");
245 $max_file->setInfo($lng->txt("exc_max_file_info"));
246 $max_file->setRequired(true);
247 $max_file->setSize(3);
248 $max_file->setMinValue(1);
249 $max_file_tgl->addSubItem($max_file);
250 }
251
253 {
254 $cbtut = new ilCheckboxInputGUI($lng->txt("exc_team_management_tutor"), "team_tutor");
255 $cbtut->setInfo($lng->txt("exc_team_management_tutor_info"));
256 $cbtut->setChecked(false);
257 $form->addItem($cbtut);
258 }
259 else
260 {
261 // peer review
262 $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer");
263 $peer->setInfo($lng->txt("exc_peer_review_ass_setting_info"));
264 $form->addItem($peer);
265 }
266
267
268 // global feedback
269
270 $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb");
271 $form->addItem($fb);
272
273 $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file");
274 $fb_file->setRequired(true); // will be disabled on update if file exists - see getAssignmentValues()
275 // $fb_file->setAllowDeletion(true); makes no sense if required (overwrite or keep)
276 $fb->addSubItem($fb_file);
277
278 $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date");
279 $fb_date->setRequired(true);
280 $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE));
281 $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION));
282 $fb->addSubItem($fb_date);
283
284 $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron");
285 $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info"));
286 $fb->addSubItem($fb_cron);
287
288
289 if ($a_mode == "create")
290 {
291 $form->addCommandButton("saveAssignment", $lng->txt("save"));
292 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
293 }
294 else
295 {
296 $form->addCommandButton("updateAssignment", $lng->txt("save"));
297 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
298 }
299
300 return $form;
301 }
This class represents a checkbox property in a property form.
This class represents a date/time property in a property form.
getTypeDropdown()
Get type selection dropdown.
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 number property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $ilCtrl, $lng, ilExAssignment\FEEDBACK_DATE_DEADLINE, ilExAssignment\FEEDBACK_DATE_SUBMISSION, getTypeDropdown(), ilExAssignment\TYPE_UPLOAD, and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by addAssignmentObject(), editAssignmentObject(), saveAssignmentObject(), and updateAssignmentObject().

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

◆ initPeerReviewForm()

ilExAssignmentEditorGUI::initPeerReviewForm ( )
protected

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

899 {
900 global $ilCtrl, $lng;
901
902 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
903 $form = new ilPropertyFormGUI();
904 $form->setTitle($lng->txt("exc_peer_review"));
905 $form->setFormAction($ilCtrl->getFormAction($this));
906
907 $peer_min = new ilNumberInputGUI($lng->txt("exc_peer_review_min_number"), "peer_min");
908 $peer_min->setInfo($lng->txt("exc_peer_review_min_number_info")); // #16161
909 $peer_min->setRequired(true);
910 $peer_min->setSize(3);
911 $peer_min->setValue(2);
912 $form->addItem($peer_min);
913
914 $peer_unlock = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_simple_unlock"), "peer_unlock");
915 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_active"), 1));
916 $peer_unlock->addOption(new ilRadioOption($lng->txt("exc_peer_review_simple_unlock_inactive"), 0));
917 $peer_unlock->setRequired(true);
918 $peer_unlock->setValue(0);
919 $form->addItem($peer_unlock);
920
921 if($this->enable_peer_review_completion)
922 {
923 $peer_cmpl = new ilRadioGroupInputGUI($lng->txt("exc_peer_review_completion"), "peer_valid");
924 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_none"), ilExAssignment::PEER_REVIEW_VALID_NONE);
925 $option->setInfo($lng->txt("exc_peer_review_completion_none_info"));
926 $peer_cmpl->addOption($option);
927 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_one"), ilExAssignment::PEER_REVIEW_VALID_ONE);
928 $option->setInfo($lng->txt("exc_peer_review_completion_one_info"));
929 $peer_cmpl->addOption($option);
930 $option = new ilRadioOption($lng->txt("exc_peer_review_completion_all"), ilExAssignment::PEER_REVIEW_VALID_ALL);
931 $option->setInfo($lng->txt("exc_peer_review_completion_all_info"));
932 $peer_cmpl->addOption($option);
933 $peer_cmpl->setRequired(true);
934 $peer_cmpl->setValue(ilExAssignment::PEER_REVIEW_VALID_NONE);
935 $form->addItem($peer_cmpl);
936 }
937
938 $peer_dl = new ilDateTimeInputGUI($lng->txt("exc_peer_review_deadline"), "peer_dl");
939 $peer_dl->setInfo($lng->txt("exc_peer_review_deadline_info"));
940 $peer_dl->enableDateActivation("", "peer_dl_tgl");
941 $peer_dl->setShowTime(true);
942 $form->addItem($peer_dl);
943
944 $peer_prsl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_personal"), "peer_prsl");
945 $peer_prsl->setInfo($lng->txt("exc_peer_review_personal_info"));
946 $form->addItem($peer_prsl);
947
948
949 // criteria
950
951 $cats = new ilRadioGroupInputGUI($lng->txt("exc_criteria_catalogues"), "crit_cat");
952 $form->addItem($cats);
953
954 // default (no catalogue)
955
956 $def = new ilRadioOption($lng->txt("exc_criteria_catalogue_default"), -1);
957 $cats->addOption($def);
958
959 $peer_text = new ilCheckboxInputGUI($lng->txt("exc_peer_review_text"), "peer_text");
960 $def->addSubItem($peer_text);
961
962 $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
963 $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
964 $peer_char->setSize(3);
965 $peer_text->addSubItem($peer_char);
966
967 $peer_rating = new ilCheckboxInputGUI($lng->txt("exc_peer_review_rating"), "peer_rating");
968 $def->addSubItem($peer_rating);
969
970 $peer_file = new ilCheckboxInputGUI($lng->txt("exc_peer_review_file"), "peer_file");
971 $peer_file->setInfo($lng->txt("exc_peer_review_file_info"));
972 $def->addSubItem($peer_file);
973
974 // catalogues
975
976 include_once "Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php";
977 $cat_objs = ilExcCriteriaCatalogue::getInstancesByParentId($this->exercise_id);
978 if(sizeof($cat_objs))
979 {
980 include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
981 foreach($cat_objs as $cat_obj)
982 {
983 $crits = ilExcCriteria::getInstancesByParentId($cat_obj->getId());
984
985 // only non-empty catalogues
986 if(sizeof($crits))
987 {
988 $titles = array();
989 foreach($crits as $crit)
990 {
991 $titles[] = $crit->getTitle();
992 }
993 $opt = new ilRadioOption($cat_obj->getTitle(), $cat_obj->getId());
994 $opt->setInfo(implode(", ", $titles));
995 $cats->addOption($opt);
996 }
997 }
998 }
999 else
1000 {
1001 // see ilExcCriteriaCatalogueGUI::view()
1002 $url = $ilCtrl->getLinkTargetByClass("ilexccriteriacataloguegui", "");
1003 $def->setInfo('<a href="'.$url.'">[+] '.
1004 $lng->txt("exc_add_criteria_catalogue").
1005 '</a>');
1006 }
1007
1008
1009 $form->addCommandButton("updatePeerReview", $lng->txt("save"));
1010 $form->addCommandButton("editAssignment", $lng->txt("cancel"));
1011
1012 return $form;
1013 }
static getInstancesByParentId($a_parent_id)
static getInstancesByParentId($a_parent_id)
$url
Definition: shib_logout.php:72

References $ilCtrl, $lng, $url, ilExcCriteria\getInstancesByParentId(), ilExcCriteriaCatalogue\getInstancesByParentId(), ilExAssignment\PEER_REVIEW_VALID_ALL, ilExAssignment\PEER_REVIEW_VALID_NONE, and ilExAssignment\PEER_REVIEW_VALID_ONE.

Referenced by editPeerReviewObject(), and updatePeerReviewObject().

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

◆ listAssignmentsObject()

ilExAssignmentEditorGUI::listAssignmentsObject ( )

List assignments.

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

83 {
84 global $tpl, $ilToolbar, $lng, $ilCtrl;
85
86 $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "addAssignment"));
87
88 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
89 $ilToolbar->addStickyItem($this->getTypeDropdown());
90
91 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
93 $button->setCaption("exc_add_assignment");
94 $button->setCommand("addAssignment");
95 $ilToolbar->addStickyItem($button);
96
97
98 include_once("./Modules/Exercise/classes/class.ilAssignmentsTableGUI.php");
99 $t = new ilAssignmentsTableGUI($this, "listAssignments", $this->exercise_id);
100 $tpl->setContent($t->getHTML());
101 }
static getInstance()
Factory.

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

+ Here is the call graph for this function:

◆ orderAssignmentsByDeadlineObject()

ilExAssignmentEditorGUI::orderAssignmentsByDeadlineObject ( )

Order by deadline.

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

838 {
839 global $lng, $ilCtrl;
840
841 ilExAssignment::orderAssByDeadline($this->exercise_id);
842
843 ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
844 $ilCtrl->redirect($this, "listAssignments");
845 }
orderAssByDeadline($a_ex_id)
Order assignments by deadline date.

References $ilCtrl, $lng, ilExAssignment\orderAssByDeadline(), and ilUtil\sendSuccess().

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

310 {
311 global $lng;
312
313 $protected_peer_review_groups = false;
314
315 if($this->assignment)
316 {
317 if($this->assignment->getPeerReview())
318 {
319 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
320 $peer_review = new ilExPeerReview($this->assignment);
321 if($peer_review->hasPeerReviewGroups())
322 {
323 $protected_peer_review_groups = true;
324 }
325 }
326
327 if($this->assignment->getFeedbackFile())
328 {
329 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
330 }
331 }
332
333 $valid = $a_form->checkInput();
334
335 if($protected_peer_review_groups)
336 {
337 // checkInput() will add alert to disabled fields
338 $a_form->getItemByPostVar("deadline")->setAlert(null);
339 $a_form->getItemByPostVar("deadline2")->setAlert(null);
340 }
341
342 if($valid)
343 {
344 // dates
345
346 $time_start = $a_form->getInput("start_time_cb")
347 ? $a_form->getItemByPostVar("start_time")->getDate()->get(IL_CAL_UNIX)
348 : null;
349 $time_deadline = $a_form->getInput("deadline_cb")
350 ? $a_form->getItemByPostVar("deadline")->getDate()->get(IL_CAL_UNIX)
351 : null;
352 $time_deadline_ext = ($a_form->getInput("deadline_cb") && $a_form->getInput("deadline2_cb")) // #17325
353 ? $a_form->getItemByPostVar("deadline2")->getDate()->get(IL_CAL_UNIX)
354 : null;
355
356 // handle disabled elements
357 if($protected_peer_review_groups)
358 {
359 $time_deadline = $this->assignment->getDeadline();
360 $time_deadline_ext = $this->assignment->getExtendedDeadline();
361 }
362
363 // no deadline?
364 if(!$time_deadline)
365 {
366 // peer review
367 if(!$protected_peer_review_groups &&
368 $a_form->getInput("peer"))
369 {
370 $a_form->getItemByPostVar("peer")
371 ->setAlert($lng->txt("exc_needs_deadline"));
372 $valid = false;
373 }
374 // global feedback
375 if($a_form->getInput("fb") &&
377 {
378 $a_form->getItemByPostVar("fb")
379 ->setAlert($lng->txt("exc_needs_deadline"));
380 $valid = false;
381 }
382 }
383 else
384 {
385 // #18269
386 if($a_form->getInput("peer"))
387 {
388 $time_deadline_max = max($time_deadline, $time_deadline_ext);
389 $peer_dl = $this->assignment // #18380
390 ? $this->assignment->getPeerReviewDeadline()
391 : null;
392 if($peer_dl && $peer_dl < $time_deadline_max)
393 {
394 $a_form->getItemByPostVar($peer_dl < $time_deadline_ext
395 ? "deadline2"
396 : "deadline")
397 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
398 $valid = false;
399 }
400 }
401
402 if($time_deadline_ext && $time_deadline_ext < $time_deadline)
403 {
404 $a_form->getItemByPostVar("deadline2")
405 ->setAlert($lng->txt("exc_deadline_ext_mismatch"));
406 $valid = false;
407 }
408
409 $time_deadline_min = $time_deadline_ext
410 ? min($time_deadline, $time_deadline_ext)
411 : $time_deadline;
412 $time_deadline_max = max($time_deadline, $time_deadline_ext);
413
414 // start > any deadline ?
415 if($time_start && $time_deadline_min && $time_start > $time_deadline_min)
416 {
417 $a_form->getItemByPostVar("start_time")
418 ->setAlert($lng->txt("exc_start_date_should_be_before_end_date"));
419 $valid = false;
420 }
421 }
422
423 if($valid)
424 {
425 $res = array(
426 // core
427 "type" => $a_form->getInput("type")
428 ,"title" => trim($a_form->getInput("title"))
429 ,"instruction" => trim($a_form->getInput("instruction"))
430 ,"mandatory" => $a_form->getInput("mandatory")
431 // dates
432 ,"start" => $time_start
433 ,"deadline" => $time_deadline
434 ,"deadline_ext" => $time_deadline_ext
435 ,"max_file" => $a_form->getInput("max_file_tgl")
436 ? $a_form->getInput("max_file")
437 : null
438 ,"team_tutor" => $a_form->getInput("team_tutor")
439 );
440
441 // peer
442 if($a_form->getInput("peer") ||
443 $protected_peer_review_groups)
444 {
445 $res["peer"] = true;
446 }
447
448 // files
449 if(is_array($_FILES["files"]))
450 {
451 // #15994 - we are keeping the upload files array structure
452 // see ilFSStorageExercise::uploadAssignmentFiles()
453 $res["files"] = $_FILES["files"];
454 }
455
456 // global feedback
457 if($a_form->getInput("fb"))
458 {
459 $res["fb"] = true;
460 $res["fb_cron"] = $a_form->getInput("fb_cron");
461 $res["fb_date"] = $a_form->getInput("fb_date");
462 if($_FILES["fb_file"]["tmp_name"])
463 {
464 $res["fb_file"] = $_FILES["fb_file"];
465 }
466 }
467
468 return $res;
469 }
470 else
471 {
472 ilUtil::sendFailure($lng->txt("form_input_not_valid"));
473 }
474 }
475 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
checkInput()
Check Post Input.
$valid

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

Referenced by saveAssignmentObject(), and updateAssignmentObject().

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

◆ processPeerReviewForm()

ilExAssignmentEditorGUI::processPeerReviewForm ( ilPropertyFormGUI  $a_form)
protected

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

1114 {
1115 global $lng;
1116
1117 $protected_peer_review_groups = false;
1118 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1119 $peer_review = new ilExPeerReview($this->assignment);
1120 if($peer_review->hasPeerReviewGroups())
1121 {
1122 $protected_peer_review_groups = true;
1123 }
1124
1125 $valid = $a_form->checkInput();
1126 if($valid)
1127 {
1128 // dates
1129 $time_deadline = $this->assignment->getDeadline();
1130 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1131 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1132
1133 $time_peer = $a_form->getInput("peer_dl_tgl")
1134 ? $a_form->getItemByPostVar("peer_dl")->getDate()->get(IL_CAL_UNIX)
1135 : null;
1136
1137 // peer < any deadline?
1138 if($time_peer && $time_deadline_max && $time_peer < $time_deadline_max)
1139 {
1140 $a_form->getItemByPostVar("peer_dl")
1141 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1142 $valid = false;
1143 }
1144
1145 if(!$protected_peer_review_groups)
1146 {
1147 if($a_form->getInput("crit_cat") < 0 &&
1148 !$a_form->getInput("peer_text") &&
1149 !$a_form->getInput("peer_rating") &&
1150 !$a_form->getInput("peer_file"))
1151 {
1152 $a_form->getItemByPostVar("peer_file")
1153 ->setAlert($lng->txt("select_one"));
1154 $valid = false;
1155 }
1156 }
1157
1158 if($valid)
1159 {
1160 $res = array();
1161 $res["peer_dl"] = $time_peer;
1162
1163 if($protected_peer_review_groups)
1164 {
1165 $res["peer_min"] = $this->assignment->getPeerReviewMin();
1166 $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1167 $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1168 $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1169
1170 $res["peer_text"] = $this->assignment->hasPeerReviewText();
1171 $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1172 $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1173 $res["peer_char"] = $this->assignment->getPeerReviewChars();
1174 $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1175
1176 $res["peer_valid"] = $this->enable_peer_review_completion
1177 ? $res["peer_valid"]
1178 : null;
1179 }
1180 else
1181 {
1182 $res["peer_min"] = $a_form->getInput("peer_min");
1183 $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1184 $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1185 $res["peer_valid"] = $a_form->getInput("peer_valid");
1186
1187 $res["peer_text"] = $a_form->getInput("peer_text");
1188 $res["peer_rating"] = $a_form->getInput("peer_rating");
1189 $res["peer_file"] = $a_form->getInput("peer_file");
1190 $res["peer_char"] = $a_form->getInput("peer_char");
1191 $res["crit_cat"] = $a_form->getInput("crit_cat");
1192 }
1193
1194 return $res;
1195 }
1196 else
1197 {
1198 ilUtil::sendFailure($lng->txt("form_input_not_valid"));
1199 }
1200 }
1201 }

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

Referenced by updatePeerReviewObject().

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

◆ saveAssignmentObject()

ilExAssignmentEditorGUI::saveAssignmentObject ( )

Save assignment.

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

557 {
558 global $tpl, $lng, $ilCtrl;
559
560 // #16163 - ignore ass id from request
561 $this->assignment = null;
562
563 $form = $this->initAssignmentForm((int)$_POST["type"], "create");
564 $input = $this->processForm($form);
565 if(is_array($input))
566 {
567 $ass = new ilExAssignment();
568 $ass->setExerciseId($this->exercise_id);
569 $ass->setType($input["type"]);
570
571 $this->importFormToAssignment($ass, $input);
572 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
573
574 // adopt teams for team upload?
575 if($ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM)
576 {
577 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
578 if(sizeof(ilExAssignmentTeam::getAdoptableTeamAssignments($this->exercise_id, $ass->getId())))
579 {
580 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
581 $ilCtrl->redirect($this, "adoptTeamAssignmentsForm");
582 }
583 }
584
585 // because of sub-tabs we stay on settings screen
586 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
587 $ilCtrl->redirect($this, "editAssignment");
588 }
589 else
590 {
591 $form->setValuesByPost();
592 $tpl->setContent($form->getHtml());
593 }
594 }
importFormToAssignment(ilExAssignment $a_ass, array $a_input)
Import form values to assignment.
processForm(ilPropertyFormGUI $a_form)
Custom form validation.

References $_POST, $ilCtrl, $lng, $tpl, ilExAssignmentTeam\getAdoptableTeamAssignments(), importFormToAssignment(), initAssignmentForm(), processForm(), ilUtil\sendSuccess(), and ilExAssignment\TYPE_UPLOAD_TEAM.

+ Here is the call graph for this function:

◆ saveAssignmentOrderObject()

ilExAssignmentEditorGUI::saveAssignmentOrderObject ( )

Save assignments order.

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

825 {
826 global $lng, $ilCtrl;
827
828 ilExAssignment::saveAssOrderOfExercise($this->exercise_id, $_POST["order"]);
829
830 ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
831 $ilCtrl->redirect($this, "listAssignments");
832 }
saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.

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

+ Here is the call graph for this function:

◆ setAssignmentHeader()

ilExAssignmentEditorGUI::setAssignmentHeader ( )

Set assignment header.

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

851 {
852 global $ilTabs, $lng, $ilCtrl, $tpl, $ilHelp;
853
854 $tpl->setTitle($this->assignment->getTitle());
855 $tpl->setDescription("");
856
857 $ilTabs->clearTargets();
858 $ilHelp->setScreenIdComponent("exc");
859
860 $ilTabs->setBackTarget($lng->txt("back"),
861 $ilCtrl->getLinkTarget($this, "listAssignments"));
862
863 $ilTabs->addTab("ass_settings",
864 $lng->txt("settings"),
865 $ilCtrl->getLinkTarget($this, "editAssignment"));
866
867 if($this->assignment->getType() != ilExAssignment::TYPE_UPLOAD_TEAM &&
868 $this->assignment->getPeerReview())
869 {
870 $ilTabs->addTab("peer_settings",
871 $lng->txt("exc_peer_review"),
872 $ilCtrl->getLinkTarget($this, "editPeerReview"));
873 }
874
875 $ilTabs->addTab("ass_files",
876 $lng->txt("exc_instruction_files"),
877 $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", "ilfilesystemgui"), "listFiles"));
878 }

References $ilCtrl, $lng, $tpl, and ilExAssignment\TYPE_UPLOAD_TEAM.

Referenced by editAssignmentObject(), editPeerReviewObject(), executeCommand(), updateAssignmentObject(), and updatePeerReviewObject().

+ Here is the caller graph for this function:

◆ setDisabledFieldValues()

ilExAssignmentEditorGUI::setDisabledFieldValues ( ilPropertyFormGUI  $a_form)
protected

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

668 {
669 // dates
670 if($this->assignment->getDeadline() > 0)
671 {
672 $a_form->getItemByPostVar("deadline_cb")->setChecked(true);
673 $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
674 $ed_item = $a_form->getItemByPostVar("deadline");
675 $ed_item->setDate($edit_date);
676
677 if($this->assignment->getExtendedDeadline() > 0)
678 {
679 $a_form->getItemByPostVar("deadline2_cb")->setChecked(true);
680 $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
681 $ed_item = $a_form->getItemByPostVar("deadline2");
682 $ed_item->setDate($edit_date);
683 }
684 }
685
686 if($this->assignment->getPeerReview())
687 {
688 $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
689 }
690 }

References ilPropertyFormGUI\getItemByPostVar(), and IL_CAL_UNIX.

Referenced by handleDisabledFields().

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

◆ setDisabledPeerReviewFieldValues()

ilExAssignmentEditorGUI::setDisabledPeerReviewFieldValues ( ilPropertyFormGUI  $a_form)
protected

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

1048 {
1049 $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1050 $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1051 $a_form->getItemByPostVar("peer_unlock")->setValue((int)$this->assignment->getPeerReviewSimpleUnlock());
1052
1053 if($this->enable_peer_review_completion)
1054 {
1055 $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1056 }
1057
1058 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1059 if($cat < 1)
1060 {
1061 $cat = -1;
1062
1063 // default / no catalogue
1064 $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1065 $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1066 $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1067 if ($this->assignment->getPeerReviewChars() > 0)
1068 {
1069 $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1070 }
1071 }
1072 $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1073 }

References ilPropertyFormGUI\getItemByPostVar().

Referenced by handleDisabledPeerFields().

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

◆ updateAssignmentObject()

ilExAssignmentEditorGUI::updateAssignmentObject ( )

Update assignment.

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

729 {
730 global $tpl, $lng, $ilCtrl, $ilTabs;
731
732 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
733 $input = $this->processForm($form);
734 if(is_array($input))
735 {
736 $old_deadline = $this->assignment->getDeadline();
737 $old_ext_deadline = $this->assignment->getExtendedDeadline();
738
739 $this->importFormToAssignment($this->assignment, $input);
740
741 $new_deadline = $this->assignment->getDeadline();
742 $new_ext_deadline = $this->assignment->getExtendedDeadline();
743
744 // if deadlines were changed
745 if($old_deadline != $new_deadline ||
746 $old_ext_deadline != $new_ext_deadline)
747 {
748 $this->assignment->recalculateLateSubmissions();
749 }
750
751 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
752 $ilCtrl->redirect($this, "editAssignment");
753 }
754 else
755 {
756 $this->setAssignmentHeader();
757 $ilTabs->activateTab("ass_settings");
758
759 $form->setValuesByPost();
760 $this->handleDisabledFields($form);
761 $tpl->setContent($form->getHtml());
762 }
763 }

References $ilCtrl, $lng, $tpl, handleDisabledFields(), importFormToAssignment(), initAssignmentForm(), processForm(), ilUtil\sendSuccess(), and setAssignmentHeader().

+ Here is the call graph for this function:

◆ updatePeerReviewObject()

ilExAssignmentEditorGUI::updatePeerReviewObject ( )
protected

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

1223 {
1224 global $tpl, $lng, $ilCtrl, $ilTabs;
1225
1226 $form = $this->initPeerReviewForm();
1227 $input = $this->processPeerReviewForm($form);
1228 if(is_array($input))
1229 {
1230 $this->importPeerReviewFormToAssignment($this->assignment, $input);
1231
1232 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1233 $ilCtrl->redirect($this, "editPeerReview");
1234 }
1235 else
1236 {
1237 $this->setAssignmentHeader();
1238 $ilTabs->activateTab("peer_settings");
1239
1240 $form->setValuesByPost();
1241 $this->handleDisabledPeerFields($form);
1242 $tpl->setContent($form->getHtml());
1243 }
1244 }
processPeerReviewForm(ilPropertyFormGUI $a_form)
importPeerReviewFormToAssignment(ilExAssignment $a_ass, array $a_input)

References $ilCtrl, $lng, $tpl, handleDisabledPeerFields(), importPeerReviewFormToAssignment(), initPeerReviewForm(), processPeerReviewForm(), ilUtil\sendSuccess(), and setAssignmentHeader().

+ Here is the call graph for this function:

Field Documentation

◆ $assignment

ilExAssignmentEditorGUI::$assignment
protected

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

◆ $enable_peer_review_completion

ilExAssignmentEditorGUI::$enable_peer_review_completion
protected

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

◆ $exercise_id

ilExAssignmentEditorGUI::$exercise_id
protected

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


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