ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 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)
 

Protected Attributes

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

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

References $DIC, $ilCtrl, $ilUser, $lng, $tpl, time, and user().

57  {
58  global $DIC;
59 
60  $this->user = $DIC->user();
61  $ilCtrl = $DIC->ctrl();
62  $ilTabs = $DIC->tabs();
63  $lng = $DIC->language();
64  $tpl = $DIC["tpl"];
65  $ilUser = $DIC->user();
66 
67  if (!$a_user_id) {
68  $a_user_id = $ilUser->getId();
69  }
70 
71  $this->assignment = $a_ass;
72  $this->exercise = $a_exercise;
73 
74  // #12337
75  if (!$this->exercise->members_obj->isAssigned($a_user_id)) {
76  $this->exercise->members_obj->assignMember($a_user_id);
77  }
78 
79  // public submissions ???
80  $public_submissions = false;
81  if ($this->exercise->getShowSubmissions() &&
82  $this->exercise->getTimestamp() - time() <= 0) { // ???
83  $public_submissions = true;
84  }
85  $this->submission = new ilExSubmission($a_ass, $a_user_id, null, false, $public_submissions);
86 
87  // :TODO:
88  $this->ctrl = $ilCtrl;
89  $this->tabs_gui = $ilTabs;
90  $this->lng = $lng;
91  $this->tpl = $tpl;
92  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
Exercise submission.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

Member Function Documentation

◆ downloadFeedbackFileObject()

ilExSubmissionGUI::downloadFeedbackFileObject ( )

Download feedback file.

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

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

219  {
221 
222  $file = $_REQUEST["file"];
223 
224  if (!isset($file)) {
225  ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true);
226  $this->ctrl->redirect($this, "view");
227  }
228 
229  // check, whether file belongs to assignment
230  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
231  $storage = new ilFSStorageExercise($this->exercise->getId(), $this->assignment->getId());
232  $files = $storage->getFeedbackFiles($this->submission->getFeedbackId());
233  $file_exist = false;
234  foreach ($files as $fb_file) {
235  if ($fb_file == $file) {
236  $file_exist = true;
237  break;
238  }
239  }
240  if (!$file_exist) {
241  echo "FILE DOES NOT EXIST";
242  exit;
243  }
244 
245  // check whether assignment has already started
246  if (!$this->assignment->notStartedYet()) {
247  // deliver file
248  $p = $storage->getFeedbackFilePath($this->submission->getFeedbackId(), $file);
250  }
251 
252  return true;
253  }
$files
Definition: add-vimline.php:18
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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 279 of file class.ilExSubmissionGUI.php.

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

280  {
281  $file = $_REQUEST["file"];
282 
283  if (!isset($file)) {
284  ilUtil::sendFailure($this->lng->txt("exc_select_one_file"), true);
285  $this->ctrl->redirect($this, "view");
286  }
287 
288  // check whether assignment as already started
289  if (!$this->assignment->notStartedYet()) {
290  // check, whether file belongs to assignment
291  $files = $this->assignment->getFiles();
292  $file_exist = false;
293  foreach ($files as $lfile) {
294  if ($lfile["name"] == $file) {
295  // deliver file
296  ilUtil::deliverFile($lfile["fullpath"], $file);
297  exit();
298  }
299  }
300  if (!$file_exist) {
301  echo "FILE DOES NOT EXIST";
302  exit;
303  }
304  }
305 
306  return true;
307  }
$files
Definition: add-vimline.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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 255 of file class.ilExSubmissionGUI.php.

References $ctrl, $file, $ilCtrl, ilUtil\deliverFile(), and ilExAssignment\FEEDBACK_DATE_DEADLINE.

256  {
258 
259  $needs_dl = ($this->assignment->getFeedbackDate() == ilExAssignment::FEEDBACK_DATE_DEADLINE);
260 
261  if (!$this->assignment ||
262  !$this->assignment->getFeedbackFile() ||
263  ($needs_dl && !$this->assignment->afterDeadlineStrict()) ||
264  (!$needs_dl && !$this->submission->hasSubmitted())) {
265  $ilCtrl->redirect($this, "returnToParent");
266  }
267 
268  // this is due to temporary bug in handleGlobalFeedbackFileUpload that missed the last "/"
269  $file = (is_file($this->assignment->getGlobalFeedbackFilePath()))
270  ? $this->assignment->getGlobalFeedbackFilePath()
271  : $this->assignment->getGlobalFeedbackFileStoragePath() . $this->assignment->getFeedbackFile();
272 
273  ilUtil::deliverFile($file, $this->assignment->getFeedbackFile());
274  }
global $ilCtrl
Definition: ilias.php:18
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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 94 of file class.ilExSubmissionGUI.php.

References $ctrl, and $ilCtrl.

95  {
97 
98  $class = $ilCtrl->getNextClass($this);
99  $cmd = $ilCtrl->getCmd("listPublicSubmissions");
100 
101  switch ($class) {
102  case "ilexsubmissionteamgui":
103  // team gui has no base gui - see we have to handle tabs here
104 
105  $this->tabs_gui->clearTargets();
106  $this->tabs_gui->setBackTarget(
107  $this->lng->txt("back"),
108  $this->ctrl->getLinkTarget($this, "returnToParent")
109  );
110 
111  $this->tabs_gui->addTab(
112  "submission",
113  $this->lng->txt("exc_submission"),
114  $this->ctrl->getLinkTargetByClass("ilexsubmission" . $this->submission->getSubmissionType() . "gui", "")
115  );
116 
117  include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
118  $gui = new ilExSubmissionTeamGUI($this->exercise, $this->submission);
119  $ilCtrl->forwardCommand($gui);
120  break;
121 
122  case "ilexsubmissiontextgui":
123  include_once "Modules/Exercise/classes/class.ilExSubmissionTextGUI.php";
124  $gui = new ilExSubmissionTextGUI($this->exercise, $this->submission);
125  $ilCtrl->forwardCommand($gui);
126  break;
127 
128  case "ilexsubmissionfilegui":
129  include_once "Modules/Exercise/classes/class.ilExSubmissionFileGUI.php";
130  $gui = new ilExSubmissionFileGUI($this->exercise, $this->submission);
131  $ilCtrl->forwardCommand($gui);
132  break;
133 
134  case "ilexsubmissionobjectgui":
135  include_once "Modules/Exercise/classes/class.ilExSubmissionObjectGUI.php";
136  $gui = new ilExSubmissionObjectGUI($this->exercise, $this->submission);
137  $ilCtrl->forwardCommand($gui);
138  break;
139 
140  case "ilexpeerreviewgui":
141  $this->tabs_gui->clearTargets();
142  $this->tabs_gui->setBackTarget(
143  $this->lng->txt("back"),
144  $this->ctrl->getLinkTarget($this, "returnToParent")
145  );
146 
147  include_once("./Modules/Exercise/classes/class.ilExPeerReviewGUI.php");
148  $peer_gui = new ilExPeerReviewGUI($this->assignment, $this->submission);
149  $this->ctrl->forwardCommand($peer_gui);
150  break;
151 
152  default:
153  $this->{$cmd . "Object"}();
154  break;
155  }
156  }
global $ilCtrl
Definition: ilias.php:18
Class ilExPeerReviewGUI.
Object-based submissions (ends up as static file)
Object-based submissions (ends up as static file)

◆ getOverviewContent()

static ilExSubmissionGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
static

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

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

Referenced by ilExAssignmentGUI\addSubmission().

159  {
160  global $DIC;
161 
162  $ilCtrl = $DIC->ctrl();
163 
164  if (!$a_submission->canView()) {
165  return;
166  }
167 
168  $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", $a_submission->getAssignment()->getId());
169 
170  if ($a_submission->getAssignment()->hasTeam()) {
171  include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
172  ilExSubmissionTeamGUI::getOverviewContent($a_info, $a_submission);
173  }
174 
175  $submission_type = $a_submission->getSubmissionType();
176  $class = "ilExSubmission" . $submission_type . "GUI";
177  include_once "Modules/Exercise/classes/class." . $class . ".php";
178  $class::getOverviewContent($a_info, $a_submission);
179 
180  $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", "");
181  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
+ 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 187 of file class.ilExSubmissionGUI.php.

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

188  {
189  $ilTabs = $this->tabs_gui;
191  $lng = $this->lng;
192 
193  if (!$this->exercise->getShowSubmissions()) {
194  $this->returnToParentObject();
195  }
196 
197  $ilTabs->clearTargets();
198  $ilTabs->setBackTarget(
199  $lng->txt("back"),
200  $ilCtrl->getLinkTarget($this, "returnToParent")
201  );
202 
203  if ($this->assignment->getType() != ilExAssignment::TYPE_TEXT) {
204  include_once("./Modules/Exercise/classes/class.ilPublicSubmissionsTableGUI.php");
205  $tab = new ilPublicSubmissionsTableGUI($this, "listPublicSubmissions", $this->assignment);
206  $this->tpl->setContent($tab->getHTML());
207  } else {
208  // #13271
209  include_once "Modules/Exercise/classes/class.ilExAssignmentListTextTableGUI.php";
210  $tbl = new ilExAssignmentListTextTableGUI($this, "listPublicSubmissions", $this->assignment, false, true);
211  $this->tpl->setContent($tbl->getHTML());
212  }
213  }
$tbl
Definition: example_048.php:81
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ returnToParentObject()

ilExSubmissionGUI::returnToParentObject ( )

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

Referenced by listPublicSubmissionsObject().

310  {
311  $this->ctrl->returnToParent($this);
312  }
+ Here is the caller graph for this function:

Field Documentation

◆ $assignment

ilExSubmissionGUI::$assignment
protected

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

◆ $ctrl

ilExSubmissionGUI::$ctrl
protected

◆ $exercise

ilExSubmissionGUI::$exercise
protected

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

◆ $lng

ilExSubmissionGUI::$lng
protected

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

Referenced by __construct(), and listPublicSubmissionsObject().

◆ $submission

ilExSubmissionGUI::$submission
protected

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

◆ $tabs_gui

ilExSubmissionGUI::$tabs_gui
protected

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

Referenced by listPublicSubmissionsObject().

◆ $tpl

ilExSubmissionGUI::$tpl
protected

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

Referenced by __construct().

◆ $user

ilExSubmissionGUI::$user
protected

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

Referenced by downloadFeedbackFileObject().


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