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

Class ilExSubmissionGUI. More...

+ Collaboration diagram for ilExSubmissionGUI:

Public Member Functions

 __construct (ilObjExercise $a_exercise, ilExAssignment $a_ass, $a_user_id=null)
 Constructor. More...
 
 executeCommand ()
 
 getHTML ($par)
 Get HTML. More...
 
 listPublicSubmissionsObject ()
 List all submissions. More...
 
 downloadFeedbackFileObject ()
 Download feedback file. More...
 
 downloadGlobalFeedbackFileObject ()
 
 downloadFileObject ()
 Download assignment file. More...
 
 returnToParentObject ()
 

Static Public Member Functions

static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission, ilObjExercise $a_exc)
 

Data Fields

const MODE_OVERVIEW_CONTENT = 1
 

Protected Attributes

 $ctrl
 
 $tabs_gui
 
 $lng
 
 $tpl
 
 $user
 
 $exercise
 
 $submission
 
 $assignment
 
 $type_guis
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExSubmissionGUI::__construct ( ilObjExercise  $a_exercise,
ilExAssignment  $a_ass,
  $a_user_id = null 
)

Constructor.

Parameters
ilObjExercise$a_exercise
ilExAssignment$a_ass
int$a_user_id
Returns
object

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

64 {
65 global $DIC;
66
67 $this->user = $DIC->user();
68 $ilCtrl = $DIC->ctrl();
69 $ilTabs = $DIC->tabs();
70 $lng = $DIC->language();
71 $tpl = $DIC["tpl"];
72 $ilUser = $DIC->user();
73
74 if (!$a_user_id) {
75 $a_user_id = $ilUser->getId();
76 }
77
78 $this->assignment = $a_ass;
79 $this->exercise = $a_exercise;
80 $this->user_id = $a_user_id;
81
82 include_once("./Modules/Exercise/AssignmentTypes/GUI/classes/class.ilExAssignmentTypesGUI.php");
83 $this->type_guis = ilExAssignmentTypesGUI::getInstance();
84
85 // #12337
86 if (!$this->exercise->members_obj->isAssigned($a_user_id)) {
87 $this->exercise->members_obj->assignMember($a_user_id);
88 }
89
90 // public submissions ???
91 $public_submissions = false;
92 if ($this->exercise->getShowSubmissions() &&
93 $this->exercise->getTimestamp() - time() <= 0) { // ???
94 $public_submissions = true;
95 }
96 $this->submission = new ilExSubmission($a_ass, $a_user_id, null, false, $public_submissions);
97
98 // :TODO:
99 $this->ctrl = $ilCtrl;
100 $this->tabs_gui = $ilTabs;
101 $this->lng = $lng;
102 $this->tpl = $tpl;
103 }
user()
Definition: user.php:4
Exercise submission //TODO: This class has to much static methods related to delivered "files".
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18

References $DIC, $ilCtrl, $ilUser, $lng, $tpl, ilExAssignmentTypesGUI\getInstance(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ downloadFeedbackFileObject()

ilExSubmissionGUI::downloadFeedbackFileObject ( )

Download feedback file.

Definition at line 278 of file class.ilExSubmissionGUI.php.

279 {
281
282 $file = $_REQUEST["file"];
283
284 if (!isset($file)) {
285 ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true);
286 $this->ctrl->redirect($this, "view");
287 }
288
289 // check, whether file belongs to assignment
290 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
291 $storage = new ilFSStorageExercise($this->exercise->getId(), $this->assignment->getId());
292 $files = $storage->getFeedbackFiles($this->submission->getFeedbackId());
293 $file_exist = false;
294 foreach ($files as $fb_file) {
295 if ($fb_file == $file) {
296 $file_exist = true;
297 break;
298 }
299 }
300 if (!$file_exist) {
301 echo "FILE DOES NOT EXIST";
302 exit;
303 }
304
305 // check whether assignment has already started
306 if (!$this->assignment->notStartedYet()) {
307 // deliver file
308 $p = $storage->getFeedbackFilePath($this->submission->getFeedbackId(), $file);
309 ilUtil::deliverFile($p, $file);
310 }
311
312 return true;
313 }
exit
Definition: backend.php:16
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
$files
Definition: metarefresh.php:49

References $files, $ilUser, $user, ilUtil\deliverFile(), exit, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ downloadFileObject()

ilExSubmissionGUI::downloadFileObject ( )

Download assignment file.

Definition at line 339 of file class.ilExSubmissionGUI.php.

340 {
341 $file = $_REQUEST["file"];
342
343 if (!isset($file)) {
344 ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true);
345 $this->ctrl->redirect($this, "view");
346 }
347
348 // check whether assignment as already started
349 $state = ilExcAssMemberState::getInstanceByIds($this->assignment->getId(), $this->user_id);
350 if ($state->areInstructionsVisible()) {
351 // check, whether file belongs to assignment
352 $files = $this->assignment->getFiles();
353 $file_exist = false;
354 foreach ($files as $lfile) {
355 if ($lfile["name"] == $file) {
356 // deliver file
357 ilUtil::deliverFile($lfile["fullpath"], $file);
358 exit();
359 }
360 }
361 if (!$file_exist) {
362 echo "FILE DOES NOT EXIST";
363 exit;
364 }
365 }
366
367 return true;
368 }
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)

References $files, $state, ilUtil\deliverFile(), exit, ilExcAssMemberState\getInstanceByIds(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExSubmissionGUI::downloadGlobalFeedbackFileObject ( )

Definition at line 315 of file class.ilExSubmissionGUI.php.

316 {
318
319 include_once("./Modules/Exercise/classes/class.ilExcAssMemberState.php");
320 $state = ilExcAssMemberState::getInstanceByIds($this->assignment->getId(), $this->user_id);
321
322 // fix bug 28466, this code should be streamlined with the if above and
323 // the presentation of the download link in the ilExAssignmentGUI->addSubmission
324 if (!$state->isGlobalFeedbackFileAccessible($this->submission)) {
325 $ilCtrl->redirect($this, "returnToParent");
326 }
327
328 // this is due to temporary bug in handleGlobalFeedbackFileUpload that missed the last "/"
329 $file = (is_file($this->assignment->getGlobalFeedbackFilePath()))
330 ? $this->assignment->getGlobalFeedbackFilePath()
331 : $this->assignment->getGlobalFeedbackFileStoragePath() . $this->assignment->getFeedbackFile();
332
333 ilUtil::deliverFile($file, $this->assignment->getFeedbackFile());
334 }

References $ctrl, $ilCtrl, $state, ilUtil\deliverFile(), and ilExcAssMemberState\getInstanceByIds().

+ Here is the call graph for this function:

◆ executeCommand()

ilExSubmissionGUI::executeCommand ( )

Definition at line 105 of file class.ilExSubmissionGUI.php.

106 {
108
109 $class = $ilCtrl->getNextClass($this);
110 $cmd = $ilCtrl->getCmd("listPublicSubmissions");
111
112 switch ($class) {
113 case "ilexsubmissionteamgui":
114 // team gui has no base gui - see we have to handle tabs here
115
116 $this->tabs_gui->clearTargets();
117 $this->tabs_gui->setBackTarget(
118 $this->lng->txt("back"),
119 $this->ctrl->getLinkTarget($this, "returnToParent")
120 );
121
122 // forward to type gui
123 if ($this->submission->getSubmissionType() != ilExSubmission::TYPE_REPO_OBJECT) {
124 $this->tabs_gui->addTab(
125 "submission",
126 $this->lng->txt("exc_submission"),
127 $this->ctrl->getLinkTargetByClass("ilexsubmission" . $this->submission->getSubmissionType() . "gui", "")
128 );
129 }
130
131 include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
132 $gui = new ilExSubmissionTeamGUI($this->exercise, $this->submission);
133 $ilCtrl->forwardCommand($gui);
134 break;
135
136 case "ilexsubmissiontextgui":
137 include_once "Modules/Exercise/classes/class.ilExSubmissionTextGUI.php";
138 $gui = new ilExSubmissionTextGUI($this->exercise, $this->submission);
139 $ilCtrl->forwardCommand($gui);
140 break;
141
142 case "ilexsubmissionfilegui":
143 include_once "Modules/Exercise/classes/class.ilExSubmissionFileGUI.php";
144 $gui = new ilExSubmissionFileGUI($this->exercise, $this->submission);
145 $ilCtrl->forwardCommand($gui);
146 break;
147
148 case "ilexsubmissionobjectgui":
149 include_once "Modules/Exercise/classes/class.ilExSubmissionObjectGUI.php";
150 $gui = new ilExSubmissionObjectGUI($this->exercise, $this->submission);
151 $ilCtrl->forwardCommand($gui);
152 break;
153
154 case "ilexpeerreviewgui":
155 $this->tabs_gui->clearTargets();
156 $this->tabs_gui->setBackTarget(
157 $this->lng->txt("back"),
158 $this->ctrl->getLinkTarget($this, "returnToParent")
159 );
160
161 include_once("./Modules/Exercise/classes/class.ilExPeerReviewGUI.php");
162 $peer_gui = new ilExPeerReviewGUI($this->assignment, $this->submission);
163 $this->ctrl->forwardCommand($peer_gui);
164 break;
165
166 default:
167
168
169 // forward to type gui
170 if ($this->type_guis->isExAssTypeGUIClass($class)) {
171 $type_gui = $this->type_guis->getByClassName($class);
172 $type_gui->setSubmission($this->submission);
173 $type_gui->setExercise($this->exercise);
174 return $ilCtrl->forwardCommand($type_gui);
175 }
176
177 $this->{$cmd . "Object"}();
178 break;
179 }
180 }
Class ilExPeerReviewGUI.
Object-based submissions (ends up as static file)
Object-based submissions (ends up as static file)

References $ctrl, $ilCtrl, and ilExSubmission\TYPE_REPO_OBJECT.

◆ getHTML()

ilExSubmissionGUI::getHTML (   $par)

Get HTML.

Parameters

return

Definition at line 232 of file class.ilExSubmissionGUI.php.

233 {
234 switch ($par["mode"]) {
235 // get overview content from ass type gui
237 $type_gui = $this->type_guis->getById($par["submission"]->getAssignment()->getType());
238 return $type_gui->getOverviewContent($par["info"], $par["submission"]);
239 break;
240 }
241 }

References MODE_OVERVIEW_CONTENT.

◆ getOverviewContent()

static ilExSubmissionGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission,
ilObjExercise  $a_exc 
)
static
Parameters
ilInfoScreenGUI$a_info
ilExSubmission$a_submission
ilObjExercise$a_exc
Returns
string
Exceptions
ilCtrlException

Definition at line 189 of file class.ilExSubmissionGUI.php.

190 {
191 global $DIC;
192
193 $ilCtrl = $DIC->ctrl();
194
195 if (!$a_submission->canView()) {
196 return;
197 }
198
199 $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", $a_submission->getAssignment()->getId());
200
201 if ($a_submission->getAssignment()->hasTeam()) {
202 include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
203 ilExSubmissionTeamGUI::getOverviewContent($a_info, $a_submission);
204 }
205
206 $submission_type = $a_submission->getSubmissionType();
207 // old handling -> forward to submission type gui class
208 // @todo migrate everything to new concept
209 if ($submission_type != ilExSubmission::TYPE_REPO_OBJECT) {
210 $class = "ilExSubmission" . $submission_type . "GUI";
211 include_once "Modules/Exercise/classes/class." . $class . ".php";
212 $class::getOverviewContent($a_info, $a_submission);
213 } else { // new: get HTML from assignemt type gui class
214 include_once("./Modules/Exercise/classes/class.ilExSubmissionGUI.php");
215 $sub_gui = new ilExSubmissionGUI($a_exc, $a_submission->getAssignment());
216 $ilCtrl->getHTML($sub_gui, array(
217 "mode" => self::MODE_OVERVIEW_CONTENT,
218 "info" => $a_info,
219 "submission" => $a_submission
220 ));
221 }
222
223 $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", "");
224 }
Class ilExSubmissionGUI.
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)

References $DIC, $ilCtrl, ilExSubmission\canView(), ilExSubmission\getAssignment(), ilExSubmissionTeamGUI\getOverviewContent(), ilExSubmission\getSubmissionType(), and ilExSubmission\TYPE_REPO_OBJECT.

Referenced by ilExAssignmentGUI\addSubmission().

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

◆ listPublicSubmissionsObject()

ilExSubmissionGUI::listPublicSubmissionsObject ( )

List all submissions.

Definition at line 247 of file class.ilExSubmissionGUI.php.

248 {
249 $ilTabs = $this->tabs_gui;
252
253 if (!$this->exercise->getShowSubmissions()) {
254 $this->returnToParentObject();
255 }
256
257 $ilTabs->clearTargets();
258 $ilTabs->setBackTarget(
259 $lng->txt("back"),
260 $ilCtrl->getLinkTarget($this, "returnToParent")
261 );
262
263 if ($this->assignment->getType() != ilExAssignment::TYPE_TEXT) {
264 include_once("./Modules/Exercise/classes/class.ilPublicSubmissionsTableGUI.php");
265 $tab = new ilPublicSubmissionsTableGUI($this, "listPublicSubmissions", $this->assignment);
266 $this->tpl->setContent($tab->getHTML());
267 } else {
268 // #13271
269 include_once "Modules/Exercise/classes/class.ilExAssignmentListTextTableGUI.php";
270 $tbl = new ilExAssignmentListTextTableGUI($this, "listPublicSubmissions", $this->assignment, false, true);
271 $this->tpl->setContent($tbl->getHTML());
272 }
273 }
$tbl
Definition: example_048.php:81

References $ctrl, $ilCtrl, $lng, $tab, $tabs_gui, $tbl, returnToParentObject(), and ilExAssignment\TYPE_TEXT.

+ Here is the call graph for this function:

◆ returnToParentObject()

ilExSubmissionGUI::returnToParentObject ( )

Definition at line 370 of file class.ilExSubmissionGUI.php.

371 {
372 $this->ctrl->returnToParent($this);
373 }

Referenced by listPublicSubmissionsObject().

+ Here is the caller graph for this function:

Field Documentation

◆ $assignment

ilExSubmissionGUI::$assignment
protected

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

◆ $ctrl

ilExSubmissionGUI::$ctrl
protected

◆ $exercise

ilExSubmissionGUI::$exercise
protected

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

◆ $lng

ilExSubmissionGUI::$lng
protected

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

Referenced by __construct(), and listPublicSubmissionsObject().

◆ $submission

ilExSubmissionGUI::$submission
protected

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

◆ $tabs_gui

ilExSubmissionGUI::$tabs_gui
protected

Definition at line 29 of file class.ilExSubmissionGUI.php.

Referenced by listPublicSubmissionsObject().

◆ $tpl

ilExSubmissionGUI::$tpl
protected

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

Referenced by __construct().

◆ $type_guis

ilExSubmissionGUI::$type_guis
protected

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

◆ $user

ilExSubmissionGUI::$user
protected

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

Referenced by downloadFeedbackFileObject().

◆ MODE_OVERVIEW_CONTENT

const ilExSubmissionGUI::MODE_OVERVIEW_CONTENT = 1

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

Referenced by getHTML().


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