29 protected \ILIAS\Exercise\Submission\SubmissionManager
$sub_manager;
40 $this->
user = $DIC->user();
41 $this->
help = $DIC[
"ilHelp"];
42 $this->sub_manager =
$DIC->exercise()->internal()->domain()->submission(
51 if (!$this->assignment ||
53 !$this->submission->canView()) {
58 $cmd = $ilCtrl->getCmd(
"showassignmenttext");
62 $this->{$cmd .
"Object"}();
74 $ilCtrl =
$DIC->ctrl();
75 $gui =
$DIC->exercise()->internal()->gui();
79 $lng->
txt(
"exc_text_assignment_edit"),
80 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTextGUI"),
"editAssignmentText")
84 $lng->
txt(
"exc_text_assignment_show"),
85 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTextGUI"),
"showAssignmentText")
88 $files_str = $link->render();
99 bool $a_read_only =
false
101 $ilCtrl = $this->
ctrl;
105 $form->setTitle($this->
lng->txt(
"exc_assignment") .
" \"" . $this->assignment->getTitle() .
"\"");
110 $this->mandatory_manager->isMandatoryForUser($this->submission->getAssignment()->getId(), $this->user->getId())
113 $text->setMaxNumOfChars($this->assignment->getMaxCharLimit());
114 $text->setMinNumOfChars($this->assignment->getMinCharLimit());
116 if ($text->isCharLimited()) {
118 if ($this->assignment->getMinCharLimit() !== 0) {
119 $char_msg .=
$lng->txt(
"exc_min_char_limit") .
": " . $this->assignment->getMinCharLimit();
121 if ($this->assignment->getMaxCharLimit() !== 0) {
122 $char_msg .=
" " .
$lng->txt(
"exc_max_char_limit") .
": " . $this->assignment->getMaxCharLimit();
124 $text->setInfo($char_msg);
127 $form->addItem($text);
130 $text->setUseRte(
true);
131 $text->setRteTagSet(
"mini");
134 $form->setFormAction($ilCtrl->getFormAction($this,
"updateAssignmentText"));
135 $form->addCommandButton(
"updateAssignmentTextAndReturn", $this->
lng->txt(
"save_return"));
136 $form->addCommandButton(
"updateAssignmentText", $this->
lng->txt(
"save"));
137 $form->addCommandButton(
"returnToParent", $this->
lng->txt(
"cancel"));
139 $form->setFormAction($ilCtrl->getFormAction($this,
"returnToParent"));
141 $form->addItem($text);
150 $ilCtrl = $this->
ctrl;
152 if (!$this->submission->canSubmit()) {
153 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
154 $ilCtrl->redirect($this,
"returnToParent");
157 $this->triggerAssignmentTool();
161 $ilHelp = $this->help;
162 $ilHelp->setScreenIdComponent(
"exc");
163 $ilHelp->setScreenId(
"text_submission");
165 if ($a_form ===
null) {
166 $a_form = $this->initAssignmentTextForm();
168 $sub = $this->sub_manager->getSubmissionsOfUser($this->submission->getUserId())->current();
170 if (trim($sub->getText()) !==
'' && trim($sub->getText()) !==
'0') {
171 $text = $a_form->getItemByPostVar(
"atxt");
178 $this->tpl->setContent($a_form->getHTML());
183 $this->updateAssignmentTextObject(
true);
191 bool $a_return =
false
193 $ilCtrl = $this->
ctrl;
195 if (!$this->submission->canSubmit()) {
196 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
197 $ilCtrl->redirect($this,
"returnToParent");
200 $form = $this->initAssignmentTextForm();
204 $rte = $form->getItemByPostVar(
"atxt");
207 if ($form->checkInput()) {
208 $text = trim($form->getInput(
"atxt"));
210 $returned_id = $this->submission->updateTextSubmission(
218 $this->handleNewUpload();
222 foreach ($mobs as $mob) {
229 $this->handleRemovedUpload();
232 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_text_saved"),
true);
234 $ilCtrl->redirect($this,
"returnToParent");
236 $ilCtrl->redirect($this,
"editAssignmentText");
240 $form->setValuesByPost();
241 $this->editAssignmentTextObject($form);
246 if (!$this->submission->isTutor()) {
250 $a_form = $this->initAssignmentTextForm(
true);
252 $sub = $this->sub_manager->getSubmissionsOfUser($this->submission->getUserId())->current();
254 if (trim($sub->getText()) !==
'' && trim($sub->getText()) !==
'0') {
255 if ($sub->getLate() &&
256 !$this->submission->hasPeerReviewAccess()) {
257 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exc_late_submission"));
260 $text = $a_form->getItemByPostVar(
"atxt");
263 $val = $this->gui->html()->escapeCurly($val);
264 $text->setValue($val);
267 $this->tpl->setContent($a_form->getHTML());
getNextClass($a_gui_class=null)
@inheritDoc
Exercise submission base gui.
ILIAS Exercise InternalGUIService $gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
updateAssignmentTextObject(bool $a_return=false)
ILIAS Exercise Submission SubmissionManager $sub_manager
showAssignmentTextObject()
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
initAssignmentTextForm(bool $a_read_only=false)
editAssignmentTextObject(?ilPropertyFormGUI $a_form=null)
updateAssignmentTextAndReturnObject()
Exercise submission //TODO: This class has many static methods related to delivered "files".
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a non editable value in a property form.
static _getUsedHTMLTags(string $module='')
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _getMediaObjects(string $a_text, int $a_direction=0)
Returns all media objects found in the passed string.
This class represents a text area property in a property form.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc