ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 60 of file class.ilExSubmissionGUI.php.

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

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

Member Function Documentation

◆ downloadFeedbackFileObject()

ilExSubmissionGUI::downloadFeedbackFileObject ( )

Download feedback file.

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

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

265  {
267 
268  $file = $_REQUEST["file"];
269 
270  if (!isset($file)) {
271  ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true);
272  $this->ctrl->redirect($this, "view");
273  }
274 
275  // check, whether file belongs to assignment
276  $storage = new ilFSStorageExercise($this->exercise->getId(), $this->assignment->getId());
277  $files = $storage->getFeedbackFiles($this->submission->getFeedbackId());
278  $file_exist = false;
279  foreach ($files as $fb_file) {
280  if ($fb_file == $file) {
281  $file_exist = true;
282  break;
283  }
284  }
285  if (!$file_exist) {
286  echo "FILE DOES NOT EXIST";
287  exit;
288  }
289 
290  // check whether assignment has already started
291  if (!$this->assignment->notStartedYet()) {
292  // deliver file
293  $p = $storage->getFeedbackFilePath($this->submission->getFeedbackId(), $file);
294  ilUtil::deliverFile($p, $file);
295  }
296 
297  return true;
298  }
exit
Definition: login.php:29
getFeedbackFiles($a_user_id)
Get number of feedback files.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ilUser
Definition: imgupload.php:18
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ downloadFileObject()

ilExSubmissionGUI::downloadFileObject ( )

Download assignment file.

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

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

324  {
325  $file = $_REQUEST["file"];
326 
327  if (!isset($file)) {
328  ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true);
329  $this->ctrl->redirect($this, "view");
330  }
331 
332  // check whether assignment as already started
333  $state = ilExcAssMemberState::getInstanceByIds($this->assignment->getId(), $this->user_id);
334  if ($state->areInstructionsVisible()) {
335  // check, whether file belongs to assignment
336  $files = $this->assignment->getFiles();
337  $file_exist = false;
338  foreach ($files as $lfile) {
339  if ($lfile["name"] == $file) {
340  // deliver file
341  ilUtil::deliverFile($lfile["fullpath"], $file);
342  exit();
343  }
344  }
345  if (!$file_exist) {
346  echo "FILE DOES NOT EXIST";
347  exit;
348  }
349  }
350 
351  return true;
352  }
exit
Definition: login.php:29
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)
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.
+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExSubmissionGUI::downloadGlobalFeedbackFileObject ( )

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

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

301  {
302  $ilCtrl = $this->ctrl;
303 
304  $state = ilExcAssMemberState::getInstanceByIds($this->assignment->getId(), $this->user_id);
305 
306  // fix bug 28466, this code should be streamlined with the if above and
307  // the presentation of the download link in the ilExAssignmentGUI->addSubmission
308  if (!$state->isGlobalFeedbackFileAccessible($this->submission)) {
309  $ilCtrl->redirect($this, "returnToParent");
310  }
311 
312  // this is due to temporary bug in handleGlobalFeedbackFileUpload that missed the last "/"
313  $file = (is_file($this->assignment->getGlobalFeedbackFilePath()))
314  ? $this->assignment->getGlobalFeedbackFilePath()
315  : $this->assignment->getGlobalFeedbackFileStoragePath() . $this->assignment->getFeedbackFile();
316 
317  ilUtil::deliverFile($file, $this->assignment->getFeedbackFile());
318  }
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ executeCommand()

ilExSubmissionGUI::executeCommand ( )

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

References $ctrl, and ilExSubmission\TYPE_REPO_OBJECT.

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

◆ getHTML()

ilExSubmissionGUI::getHTML (   $par)

Get HTML.

Parameters

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

Referenced by getOverviewContent().

221  {
222  switch ($par["mode"]) {
223  // get overview content from ass type gui
224  case self::MODE_OVERVIEW_CONTENT:
225  $type_gui = $this->type_guis->getById($par["submission"]->getAssignment()->getType());
226  return $type_gui->getOverviewContent($par["info"], $par["submission"]);
227  break;
228  }
229  }
+ Here is the caller graph for this function:

◆ 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 180 of file class.ilExSubmissionGUI.php.

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

Referenced by ilExAssignmentGUI\addSubmission().

181  {
182  global $DIC;
183 
184  $ilCtrl = $DIC->ctrl();
185 
186  if (!$a_submission->canView()) {
187  return;
188  }
189 
190  $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", $a_submission->getAssignment()->getId());
191 
192  if ($a_submission->getAssignment()->hasTeam()) {
193  ilExSubmissionTeamGUI::getOverviewContent($a_info, $a_submission);
194  }
195 
196  $submission_type = $a_submission->getSubmissionType();
197  // old handling -> forward to submission type gui class
198  // @todo migrate everything to new concept
199  if ($submission_type != ilExSubmission::TYPE_REPO_OBJECT) {
200  $class = "ilExSubmission" . $submission_type . "GUI";
201  $class::getOverviewContent($a_info, $a_submission);
202  } else { // new: get HTML from assignemt type gui class
203  $sub_gui = new ilExSubmissionGUI($a_exc, $a_submission->getAssignment());
204  $ilCtrl->getHTML($sub_gui, array(
205  "mode" => self::MODE_OVERVIEW_CONTENT,
206  "info" => $a_info,
207  "submission" => $a_submission
208  ));
209  }
210 
211  $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", "");
212  }
global $DIC
Definition: goto.php:24
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
Class ilExSubmissionGUI.
+ 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 235 of file class.ilExSubmissionGUI.php.

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

236  {
237  $ilTabs = $this->tabs_gui;
238  $ilCtrl = $this->ctrl;
239  $lng = $this->lng;
240 
241  if (!$this->exercise->getShowSubmissions()) {
242  $this->returnToParentObject();
243  }
244 
245  $ilTabs->clearTargets();
246  $ilTabs->setBackTarget(
247  $lng->txt("back"),
248  $ilCtrl->getLinkTarget($this, "returnToParent")
249  );
250 
251  if ($this->assignment->getType() != ilExAssignment::TYPE_TEXT) {
252  $tab = new ilPublicSubmissionsTableGUI($this, "listPublicSubmissions", $this->assignment);
253  $this->tpl->setContent($tab->getHTML());
254  } else {
255  // #13271
256  $tbl = new ilExAssignmentListTextTableGUI($this, "listPublicSubmissions", $this->assignment, false, true);
257  $this->tpl->setContent($tbl->getHTML());
258  }
259  }
+ Here is the call graph for this function:

◆ returnToParentObject()

ilExSubmissionGUI::returnToParentObject ( )

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

Referenced by listPublicSubmissionsObject().

355  {
356  $this->ctrl->returnToParent($this);
357  }
+ Here is the caller graph for this function:

Field Documentation

◆ $assignment

ilExSubmissionGUI::$assignment
protected

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

◆ $ctrl

ilExSubmissionGUI::$ctrl
protected

◆ $exercise

ilExSubmissionGUI::$exercise
protected

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

◆ $lng

ilExSubmissionGUI::$lng
protected

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

Referenced by __construct(), and listPublicSubmissionsObject().

◆ $submission

ilExSubmissionGUI::$submission
protected

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

◆ $tabs_gui

ilExSubmissionGUI::$tabs_gui
protected

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

Referenced by listPublicSubmissionsObject().

◆ $tpl

ilExSubmissionGUI::$tpl
protected

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

Referenced by __construct().

◆ $type_guis

ilExSubmissionGUI::$type_guis
protected

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

◆ $user

ilExSubmissionGUI::$user
protected

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

Referenced by downloadFeedbackFileObject().

◆ MODE_OVERVIEW_CONTENT

const ilExSubmissionGUI::MODE_OVERVIEW_CONTENT = 1

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


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