ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
$_POST["username"]
initAssignmentForm($a_type, $a_mode="create")
Init assignment form.
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 1234 of file class.ilExAssignmentEditorGUI.php.

1235 {
1236 global $ilCtrl, $ilTabs, $lng, $tpl;
1237
1238 if(!$this->assignment)
1239 {
1240 $ilCtrl->redirect($this, "listAssignments");
1241 }
1242
1243 $ilTabs->clearTargets();
1244 $ilTabs->setBackTarget($lng->txt("back"),
1245 $ilCtrl->getLinkTarget($this, "listAssignments"));
1246
1247 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1248 $form = new ilPropertyFormGUI();
1249 $form->setTitle($lng->txt("exc_team_assignment_adopt"));
1250 $form->setFormAction($ilCtrl->getFormAction($this, "adoptTeamAssignments"));
1251
1252 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1253 $options = ilExAssignmentTeam::getAdoptableTeamAssignments($this->assignment->getExerciseId());
1254
1255 // we must not have existing teams in assignment
1256 if(array_key_exists($this->assignment->getId(), $options))
1257 {
1258 $ilCtrl->redirect($this, "listAssignments");
1259 }
1260
1261 $teams = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
1262 $teams->setValue(-1);
1263
1264 $teams->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1));
1265
1266 foreach($options as $id => $item)
1267 {
1268 $option = new ilRadioOption($item["title"], $id);
1269 $option->setInfo($lng->txt("exc_team_assignment_adopt_teams").": ".$item["teams"]);
1270 $teams->addOption($option);
1271 }
1272
1273 $form->addItem($teams);
1274
1275 $form->addCommandButton("adoptTeamAssignments", $lng->txt("save"));
1276 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
1277
1278 $tpl->setContent($form->getHTML());
1279 }
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:17
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 1281 of file class.ilExAssignmentEditorGUI.php.

1282 {
1283 global $ilCtrl, $lng;
1284
1285 $src_ass_id = (int)$_POST["ass_adpt"];
1286
1287 if($this->assignment &&
1288 $src_ass_id > 0)
1289 {
1290 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
1291 ilExAssignmentTeam::adoptTeams($src_ass_id, $this->assignment->getId());
1292
1293 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
1294 }
1295
1296 $ilCtrl->redirect($this, "listAssignments");
1297 }
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 750 of file class.ilExAssignmentEditorGUI.php.

751 {
752 global $ilCtrl, $tpl, $lng;
753
754 if (!is_array($_POST["id"]) || count($_POST["id"]) == 0)
755 {
756 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
757 $ilCtrl->redirect($this, "listAssignments");
758 }
759 else
760 {
761 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
762 $cgui = new ilConfirmationGUI();
763 $cgui->setFormAction($ilCtrl->getFormAction($this));
764 $cgui->setHeaderText($lng->txt("exc_conf_del_assignments"));
765 $cgui->setCancel($lng->txt("cancel"), "listAssignments");
766 $cgui->setConfirm($lng->txt("delete"), "deleteAssignments");
767
768 foreach ($_POST["id"] as $i)
769 {
770 $cgui->addItem("id[]", $i, ilExAssignment::lookupTitle($i));
771 }
772
773 $tpl->setContent($cgui->getHTML());
774 }
775 }
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 780 of file class.ilExAssignmentEditorGUI.php.

781 {
782 global $ilCtrl, $lng;
783
784 $delete = false;
785 if (is_array($_POST["id"]))
786 {
787 foreach($_POST["id"] as $id)
788 {
789 $ass = new ilExAssignment(ilUtil::stripSlashes($id));
790 $ass->delete();
791 $delete = true;
792 }
793 }
794
795 if ($delete)
796 {
797 ilUtil::sendSuccess($lng->txt("exc_assignments_deleted"), true);
798 }
799 $ilCtrl->setParameter($this, "ass_id", "");
800 $ilCtrl->redirect($this, "listAssignments");
801 }
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 862 of file class.ilExAssignmentEditorGUI.php.

863 {
864 global $ilCtrl;
865
866 if(!$this->assignment ||
867 !$this->assignment->getFeedbackFile())
868 {
869 $ilCtrl->redirect($this, "returnToParent");
870 }
871
872 ilUtil::deliverFile($this->assignment->getGlobalFeedbackFilePath(), $this->assignment->getFeedbackFile());
873 }
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 588 of file class.ilExAssignmentEditorGUI.php.

589 {
590 global $tpl, $ilTabs, $tpl;
591
592 $this->setAssignmentHeader();
593 $ilTabs->activateTab("ass_settings");
594
595 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
596 $this->getAssignmentValues($form);
597 $tpl->setContent($form->getHTML());
598 }
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 996 of file class.ilExAssignmentEditorGUI.php.

997 {
998 global $tpl, $ilTabs, $tpl;
999
1000 $this->setAssignmentHeader();
1001 $ilTabs->activateTab("peer_settings");
1002
1003 if($a_form === null)
1004 {
1005 $a_form = $this->initPeerReviewForm();
1006 $this->getPeerReviewValues($a_form);
1007 }
1008 $tpl->setContent($a_form->getHTML());
1009 }

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

604 {
605 global $lng, $ilCtrl;
606
607 $values = array();
608 $values["type"] = $this->assignment->getType();
609 $values["title"] = $this->assignment->getTitle();
610 $values["mandatory"] = $this->assignment->getMandatory();
611 $values["instruction"] = $this->assignment->getInstruction();
612
613 if ($this->assignment->getStartTime())
614 {
615 $values["start_time"] = new ilDateTime($this->assignment->getStartTime(), IL_CAL_UNIX);
616 }
617
618 if($this->assignment->getType() == ilExAssignment::TYPE_UPLOAD ||
619 $this->assignment->getType() == ilExAssignment::TYPE_UPLOAD_TEAM)
620 {
621 if ($this->assignment->getMaxFile())
622 {
623 $values["max_file_tgl"] = true;
624 $values["max_file"] = $this->assignment->getMaxFile();
625 }
626 }
627
628 if($this->assignment->getType() == ilExAssignment::TYPE_UPLOAD_TEAM)
629 {
630 $values["team_tutor"] = $this->assignment->getTeamTutor();
631 }
632
633 $a_form->setValuesByArray($values);
634
635 // global feedback
636 if($this->assignment->getFeedbackFile())
637 {
638 $a_form->getItemByPostVar("fb")->setChecked(true);
639 $a_form->getItemByPostVar("fb_file")->setValue(basename($this->assignment->getGlobalFeedbackFilePath()));
640 $a_form->getItemByPostVar("fb_file")->setRequired(false); // #15467
641 $a_form->getItemByPostVar("fb_file")->setInfo(
642 // #16400
643 '<a href="'.$ilCtrl->getLinkTarget($this, "downloadGlobalFeedbackFile").'">'.
644 $lng->txt("download").'</a>'
645 );
646 }
647 $a_form->getItemByPostVar("fb_cron")->setChecked($this->assignment->hasFeedbackCron());
648 $a_form->getItemByPostVar("fb_date")->setValue($this->assignment->getFeedbackDate());
649
650 $this->handleDisabledFields($a_form, true);
651 }
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 1011 of file class.ilExAssignmentEditorGUI.php.

1012 {
1013 $values = array();
1014
1015 if($this->assignment->getPeerReviewDeadline() > 0)
1016 {
1017 $values["peer_dl"] = new ilDateTime($this->assignment->getPeerReviewDeadline(), IL_CAL_UNIX);
1018 }
1019
1020 $a_form->setValuesByArray($values);
1021
1022 $this->handleDisabledPeerFields($a_form, true);
1023 }
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:17

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

677 {
678 // potentially disabled elements are initialized here to re-use this
679 // method after setValuesByPost() - see updateAssignmentObject()
680
681 // team assignments do not support peer review
682 // with no active peer review there is nothing to protect
683 if($this->assignment->getType() != ilExAssignment::TYPE_UPLOAD_TEAM &&
684 $this->assignment->getPeerReview())
685 {
686 // #14450
687 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
688 $peer_review = new ilExPeerReview($this->assignment);
689 if($peer_review->hasPeerReviewGroups())
690 {
691 // deadline(s) are past and must not change
692 $a_form->getItemByPostVar("deadline")->setDisabled(true);
693 $a_form->getItemByPostVar("deadline2")->setDisabled(true);
694
695 $a_form->getItemByPostVar("peer")->setDisabled(true);
696 }
697 }
698
699 if($a_force_set_values ||
700 ($peer_review && $peer_review->hasPeerReviewGroups()))
701 {
702 $this->setDisabledFieldValues($a_form);
703 }
704 }
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 1053 of file class.ilExAssignmentEditorGUI.php.

1054 {
1055 // #14450
1056 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1057 $peer_review = new ilExPeerReview($this->assignment);
1058 if($peer_review->hasPeerReviewGroups())
1059 {
1060 // JourFixe, 2015-05-11 - editable again
1061 // $a_form->getItemByPostVar("peer_dl")->setDisabled(true);
1062
1063 $a_form->getItemByPostVar("peer_min")->setDisabled(true);
1064 $a_form->getItemByPostVar("peer_prsl")->setDisabled(true);
1065 $a_form->getItemByPostVar("peer_unlock")->setDisabled(true);
1066
1067 if($this->enable_peer_review_completion)
1068 {
1069 $a_form->getItemByPostVar("peer_valid")->setDisabled(true);
1070 }
1071
1072 $a_form->getItemByPostVar("crit_cat")->setDisabled(true);
1073 $a_form->getItemByPostVar("peer_text")->setDisabled(true);
1074 $a_form->getItemByPostVar("peer_char")->setDisabled(true);
1075 $a_form->getItemByPostVar("peer_rating")->setDisabled(true);
1076 $a_form->getItemByPostVar("peer_file")->setDisabled(true);
1077
1078 // required number input is a problem
1079 $min = new ilHiddenInputGUI("peer_min");
1080 $min->setValue($this->assignment->getPeerReviewMin());
1081 $a_form->addItem($min);
1082 }
1083
1084 if($a_force_set_values ||
1085 $peer_review->hasPeerReviewGroups())
1086 {
1087 $this->setDisabledPeerReviewFieldValues($a_form);
1088 }
1089 }
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 472 of file class.ilExAssignmentEditorGUI.php.

473 {
474 $is_create = !(bool)$a_ass->getId();
475
476 $a_ass->setTitle($a_input["title"]);
477 $a_ass->setInstruction($a_input["instruction"]);
478 $a_ass->setMandatory($a_input["mandatory"]);
479
480 $a_ass->setStartTime($a_input["start"]);
481 $a_ass->setDeadline($a_input["deadline"]);
482 $a_ass->setExtendedDeadline($a_input["deadline_ext"]);
483
484 $a_ass->setMaxFile($a_input["max_file"]);
485 $a_ass->setTeamTutor($a_input["team_tutor"]);
486
487 $a_ass->setPeerReview((bool)$a_input["peer"]);
488
489 // peer review default values (on separate form)
490 if($is_create)
491 {
492 $a_ass->setPeerReviewMin(2);
493 $a_ass->setPeerReviewSimpleUnlock(false);
495 $a_ass->setPeerReviewPersonalized(false);
496 $a_ass->setPeerReviewFileUpload(false);
497 $a_ass->setPeerReviewText(true);
498 $a_ass->setPeerReviewRating(true);
499 }
500
501 if($a_input["fb"])
502 {
503 $a_ass->setFeedbackCron($a_input["fb_cron"]); // #13380
504 $a_ass->setFeedbackDate($a_input["fb_date"]);
505 }
506
507 // id needed for file handling
508 if($is_create)
509 {
510 $a_ass->save();
511
512 // #15994 - assignment files
513 if(is_array($a_input["files"]))
514 {
515 $a_ass->uploadAssignmentFiles($a_input["files"]);
516 }
517 }
518 else
519 {
520 // remove global feedback file?
521 if(!$a_input["fb"])
522 {
523 $a_ass->deleteGlobalFeedbackFile();
524 $a_ass->setFeedbackFile(null);
525 }
526
527 $a_ass->update();
528 }
529
530 // add global feedback file?
531 if($a_input["fb"])
532 {
533 if(is_array($a_input["fb_file"]))
534 {
535 $a_ass->handleGlobalFeedbackFileUpload($a_input["fb_file"]);
536 $a_ass->update();
537 }
538 }
539 }
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 1182 of file class.ilExAssignmentEditorGUI.php.

1183 {
1184 $a_ass->setPeerReviewMin($a_input["peer_min"]);
1185 $a_ass->setPeerReviewDeadline($a_input["peer_dl"]);
1186 $a_ass->setPeerReviewSimpleUnlock($a_input["peer_unlock"]);
1187 $a_ass->setPeerReviewPersonalized($a_input["peer_prsl"]);
1188
1189 // #18964
1190 $a_ass->setPeerReviewValid($a_input["peer_valid"]
1191 ? $a_input["peer_valid"]
1193
1194 $a_ass->setPeerReviewFileUpload($a_input["peer_file"]);
1195 $a_ass->setPeerReviewChars($a_input["peer_char"]);
1196 $a_ass->setPeerReviewText($a_input["peer_text"]);
1197 $a_ass->setPeerReviewRating($a_input["peer_rating"]);
1198 $a_ass->setPeerReviewCriteriaCatalogue($a_input["crit_cat"] > 0
1199 ? $a_input["crit_cat"]
1200 : null);
1201
1202 $a_ass->update();
1203 }
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\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().

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
187 $start_date = new ilDateTimeInputGUI($lng->txt("exc_start_time"), "start_time");
188 $start_date->setShowTime(true);
189 $form->addItem($start_date);
190
191 // Deadline
192 $deadline = new ilDateTimeInputGUI($lng->txt("exc_deadline"), "deadline");
193 $deadline->setShowTime(true);
194 $form->addItem($deadline);
195
196 // extended Deadline
197 $deadline2 = new ilDateTimeInputGUI($lng->txt("exc_deadline_extended"), "deadline2");
198 $deadline2->setInfo($lng->txt("exc_deadline_extended_info"));
199 $deadline2->setShowTime(true);
200 $deadline->addSubItem($deadline2);
201
202 // mandatory
203 $cb = new ilCheckboxInputGUI($lng->txt("exc_mandatory"), "mandatory");
204 $cb->setInfo($lng->txt("exc_mandatory_info"));
205 $cb->setChecked(true);
206 $form->addItem($cb);
207
208 // Work Instructions
209 $desc_input = new ilTextAreaInputGUI($lng->txt("exc_instruction"), "instruction");
210 $desc_input->setRows(20);
211 $desc_input->setUseRte(true);
212 $desc_input->setRteTagSet("mini");
213 $form->addItem($desc_input);
214
215 // files
216 if ($a_mode == "create")
217 {
218 $files = new ilFileWizardInputGUI($lng->txt('objs_file'),'files');
219 $files->setFilenames(array(0 => ''));
220 $form->addItem($files);
221 }
222
223 // max number of files
226 {
227 $max_file_tgl = new ilCheckboxInputGUI($lng->txt("exc_max_file_tgl"), "max_file_tgl");
228 $form->addItem($max_file_tgl);
229
230 $max_file = new ilNumberInputGUI($lng->txt("exc_max_file"), "max_file");
231 $max_file->setInfo($lng->txt("exc_max_file_info"));
232 $max_file->setRequired(true);
233 $max_file->setSize(3);
234 $max_file->setMinValue(1);
235 $max_file_tgl->addSubItem($max_file);
236 }
237
239 {
240 $cbtut = new ilCheckboxInputGUI($lng->txt("exc_team_management_tutor"), "team_tutor");
241 $cbtut->setInfo($lng->txt("exc_team_management_tutor_info"));
242 $cbtut->setChecked(false);
243 $form->addItem($cbtut);
244 }
245 else
246 {
247 // peer review
248 $peer = new ilCheckboxInputGUI($lng->txt("exc_peer_review"), "peer");
249 $peer->setInfo($lng->txt("exc_peer_review_ass_setting_info"));
250 $form->addItem($peer);
251 }
252
253
254 // global feedback
255
256 $fb = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file"), "fb");
257 $form->addItem($fb);
258
259 $fb_file = new ilFileInputGUI($lng->txt("file"), "fb_file");
260 $fb_file->setRequired(true); // will be disabled on update if file exists - see getAssignmentValues()
261 // $fb_file->setAllowDeletion(true); makes no sense if required (overwrite or keep)
262 $fb->addSubItem($fb_file);
263
264 $fb_date = new ilRadioGroupInputGUI($lng->txt("exc_global_feedback_file_date"), "fb_date");
265 $fb_date->setRequired(true);
266 $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_deadline"), ilExAssignment::FEEDBACK_DATE_DEADLINE));
267 $fb_date->addOption(new ilRadioOption($lng->txt("exc_global_feedback_file_date_upload"), ilExAssignment::FEEDBACK_DATE_SUBMISSION));
268 $fb->addSubItem($fb_date);
269
270 $fb_cron = new ilCheckboxInputGUI($lng->txt("exc_global_feedback_file_cron"), "fb_cron");
271 $fb_cron->setInfo($lng->txt("exc_global_feedback_file_cron_info"));
272 $fb->addSubItem($fb_cron);
273
274
275 if ($a_mode == "create")
276 {
277 $form->addCommandButton("saveAssignment", $lng->txt("save"));
278 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
279 }
280 else
281 {
282 $form->addCommandButton("updateAssignment", $lng->txt("save"));
283 $form->addCommandButton("listAssignments", $lng->txt("cancel"));
284 }
285
286 return $form;
287 }
$files
Definition: add-vimline.php:18
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.
$a_type
Definition: workflow.php:93

References $a_type, $files, $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 880 of file class.ilExAssignmentEditorGUI.php.

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

820 {
821 global $lng, $ilCtrl;
822
823 ilExAssignment::orderAssByDeadline($this->exercise_id);
824
825 ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
826 $ilCtrl->redirect($this, "listAssignments");
827 }
static 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 295 of file class.ilExAssignmentEditorGUI.php.

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

References $lng, $res, $time_start, $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 1091 of file class.ilExAssignmentEditorGUI.php.

1092 {
1093 global $lng;
1094
1095 $protected_peer_review_groups = false;
1096 include_once "Modules/Exercise/classes/class.ilExPeerReview.php";
1097 $peer_review = new ilExPeerReview($this->assignment);
1098 if($peer_review->hasPeerReviewGroups())
1099 {
1100 $protected_peer_review_groups = true;
1101 }
1102
1103 $valid = $a_form->checkInput();
1104 if($valid)
1105 {
1106 // dates
1107 $time_deadline = $this->assignment->getDeadline();
1108 $time_deadline_ext = $this->assignment->getExtendedDeadline();
1109 $time_deadline_max = max($time_deadline, $time_deadline_ext);
1110
1111 $date = $a_form->getItemByPostVar("peer_dl")->getDate();
1112 $time_peer = $date
1113 ? $date->get(IL_CAL_UNIX)
1114 : null;
1115
1116 // peer < any deadline?
1117 if($time_peer && $time_deadline_max && $time_peer < $time_deadline_max)
1118 {
1119 $a_form->getItemByPostVar("peer_dl")
1120 ->setAlert($lng->txt("exc_peer_deadline_mismatch"));
1121 $valid = false;
1122 }
1123
1124 if(!$protected_peer_review_groups)
1125 {
1126 if($a_form->getInput("crit_cat") < 0 &&
1127 !$a_form->getInput("peer_text") &&
1128 !$a_form->getInput("peer_rating") &&
1129 !$a_form->getInput("peer_file"))
1130 {
1131 $a_form->getItemByPostVar("peer_file")
1132 ->setAlert($lng->txt("select_one"));
1133 $valid = false;
1134 }
1135 }
1136
1137 if($valid)
1138 {
1139 $res = array();
1140 $res["peer_dl"] = $time_peer;
1141
1142 if($protected_peer_review_groups)
1143 {
1144 $res["peer_min"] = $this->assignment->getPeerReviewMin();
1145 $res["peer_unlock"] = $this->assignment->getPeerReviewSimpleUnlock();
1146 $res["peer_prsl"] = $this->assignment->hasPeerReviewPersonalized();
1147 $res["peer_valid"] = $this->assignment->getPeerReviewValid();
1148
1149 $res["peer_text"] = $this->assignment->hasPeerReviewText();
1150 $res["peer_rating"] = $this->assignment->hasPeerReviewRating();
1151 $res["peer_file"] = $this->assignment->hasPeerReviewFileUpload();
1152 $res["peer_char"] = $this->assignment->getPeerReviewChars();
1153 $res["crit_cat"] = $this->assignment->getPeerReviewCriteriaCatalogue();
1154
1155 $res["peer_valid"] = $this->enable_peer_review_completion
1156 ? $res["peer_valid"]
1157 : null;
1158 }
1159 else
1160 {
1161 $res["peer_min"] = $a_form->getInput("peer_min");
1162 $res["peer_unlock"] = $a_form->getInput("peer_unlock");
1163 $res["peer_prsl"] = $a_form->getInput("peer_prsl");
1164 $res["peer_valid"] = $a_form->getInput("peer_valid");
1165
1166 $res["peer_text"] = $a_form->getInput("peer_text");
1167 $res["peer_rating"] = $a_form->getInput("peer_rating");
1168 $res["peer_file"] = $a_form->getInput("peer_file");
1169 $res["peer_char"] = $a_form->getInput("peer_char");
1170 $res["crit_cat"] = $a_form->getInput("crit_cat");
1171 }
1172
1173 return $res;
1174 }
1175 else
1176 {
1177 ilUtil::sendFailure($lng->txt("form_input_not_valid"));
1178 }
1179 }
1180 }

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

546 {
547 global $tpl, $lng, $ilCtrl;
548
549 // #16163 - ignore ass id from request
550 $this->assignment = null;
551
552 $form = $this->initAssignmentForm((int)$_POST["type"], "create");
553 $input = $this->processForm($form);
554 if(is_array($input))
555 {
556 $ass = new ilExAssignment();
557 $ass->setExerciseId($this->exercise_id);
558 $ass->setType($input["type"]);
559
560 $this->importFormToAssignment($ass, $input);
561 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
562
563 // adopt teams for team upload?
564 if($ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM)
565 {
566 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
567 if(sizeof(ilExAssignmentTeam::getAdoptableTeamAssignments($this->exercise_id, $ass->getId())))
568 {
569 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
570 $ilCtrl->redirect($this, "adoptTeamAssignmentsForm");
571 }
572 }
573
574 // because of sub-tabs we stay on settings screen
575 $ilCtrl->setParameter($this, "ass_id", $ass->getId());
576 $ilCtrl->redirect($this, "editAssignment");
577 }
578 else
579 {
580 $form->setValuesByPost();
581 $tpl->setContent($form->getHtml());
582 }
583 }
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 806 of file class.ilExAssignmentEditorGUI.php.

807 {
808 global $lng, $ilCtrl;
809
810 ilExAssignment::saveAssOrderOfExercise($this->exercise_id, $_POST["order"]);
811
812 ilUtil::sendSuccess($lng->txt("exc_saved_order"), true);
813 $ilCtrl->redirect($this, "listAssignments");
814 }
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 832 of file class.ilExAssignmentEditorGUI.php.

833 {
834 global $ilTabs, $lng, $ilCtrl, $tpl, $ilHelp;
835
836 $tpl->setTitle($this->assignment->getTitle());
837 $tpl->setDescription("");
838
839 $ilTabs->clearTargets();
840 $ilHelp->setScreenIdComponent("exc");
841
842 $ilTabs->setBackTarget($lng->txt("back"),
843 $ilCtrl->getLinkTarget($this, "listAssignments"));
844
845 $ilTabs->addTab("ass_settings",
846 $lng->txt("settings"),
847 $ilCtrl->getLinkTarget($this, "editAssignment"));
848
849 if($this->assignment->getType() != ilExAssignment::TYPE_UPLOAD_TEAM &&
850 $this->assignment->getPeerReview())
851 {
852 $ilTabs->addTab("peer_settings",
853 $lng->txt("exc_peer_review"),
854 $ilCtrl->getLinkTarget($this, "editPeerReview"));
855 }
856
857 $ilTabs->addTab("ass_files",
858 $lng->txt("exc_instruction_files"),
859 $ilCtrl->getLinkTargetByClass(array("ilexassignmenteditorgui", "ilfilesystemgui"), "listFiles"));
860 }

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

654 {
655 // dates
656 if($this->assignment->getDeadline() > 0)
657 {
658 $edit_date = new ilDateTime($this->assignment->getDeadline(), IL_CAL_UNIX);
659 $ed_item = $a_form->getItemByPostVar("deadline");
660 $ed_item->setDate($edit_date);
661
662 if($this->assignment->getExtendedDeadline() > 0)
663 {
664 $edit_date = new ilDateTime($this->assignment->getExtendedDeadline(), IL_CAL_UNIX);
665 $ed_item = $a_form->getItemByPostVar("deadline2");
666 $ed_item->setDate($edit_date);
667 }
668 }
669
670 if($this->assignment->getPeerReview())
671 {
672 $a_form->getItemByPostVar("peer")->setChecked($this->assignment->getPeerReview());
673 }
674 }

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

1026 {
1027 $a_form->getItemByPostVar("peer_min")->setValue($this->assignment->getPeerReviewMin());
1028 $a_form->getItemByPostVar("peer_prsl")->setChecked($this->assignment->hasPeerReviewPersonalized());
1029 $a_form->getItemByPostVar("peer_unlock")->setValue((int)$this->assignment->getPeerReviewSimpleUnlock());
1030
1031 if($this->enable_peer_review_completion)
1032 {
1033 $a_form->getItemByPostVar("peer_valid")->setValue($this->assignment->getPeerReviewValid());
1034 }
1035
1036 $cat = $this->assignment->getPeerReviewCriteriaCatalogue();
1037 if($cat < 1)
1038 {
1039 $cat = -1;
1040
1041 // default / no catalogue
1042 $a_form->getItemByPostVar("peer_text")->setChecked($this->assignment->hasPeerReviewText());
1043 $a_form->getItemByPostVar("peer_rating")->setChecked($this->assignment->hasPeerReviewRating());
1044 $a_form->getItemByPostVar("peer_file")->setChecked($this->assignment->hasPeerReviewFileUpload());
1045 if ($this->assignment->getPeerReviewChars() > 0)
1046 {
1047 $a_form->getItemByPostVar("peer_char")->setValue($this->assignment->getPeerReviewChars());
1048 }
1049 }
1050 $a_form->getItemByPostVar("crit_cat")->setValue($cat);
1051 }

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

711 {
712 global $tpl, $lng, $ilCtrl, $ilTabs;
713
714 $form = $this->initAssignmentForm($this->assignment->getType(), "edit");
715 $input = $this->processForm($form);
716 if(is_array($input))
717 {
718 $old_deadline = $this->assignment->getDeadline();
719 $old_ext_deadline = $this->assignment->getExtendedDeadline();
720
721 $this->importFormToAssignment($this->assignment, $input);
722
723 $new_deadline = $this->assignment->getDeadline();
724 $new_ext_deadline = $this->assignment->getExtendedDeadline();
725
726 // if deadlines were changed
727 if($old_deadline != $new_deadline ||
728 $old_ext_deadline != $new_ext_deadline)
729 {
730 $this->assignment->recalculateLateSubmissions();
731 }
732
733 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
734 $ilCtrl->redirect($this, "editAssignment");
735 }
736 else
737 {
738 $this->setAssignmentHeader();
739 $ilTabs->activateTab("ass_settings");
740
741 $form->setValuesByPost();
742 $this->handleDisabledFields($form);
743 $tpl->setContent($form->getHtml());
744 }
745 }

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

1206 {
1207 global $tpl, $lng, $ilCtrl, $ilTabs;
1208
1209 $form = $this->initPeerReviewForm();
1210 $input = $this->processPeerReviewForm($form);
1211 if(is_array($input))
1212 {
1213 $this->importPeerReviewFormToAssignment($this->assignment, $input);
1214
1215 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1216 $ilCtrl->redirect($this, "editPeerReview");
1217 }
1218 else
1219 {
1220 $this->setAssignmentHeader();
1221 $ilTabs->activateTab("peer_settings");
1222
1223 $form->setValuesByPost();
1224 $this->handleDisabledPeerFields($form);
1225 $tpl->setContent($form->getHtml());
1226 }
1227 }
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: