ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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

References $ilCtrl, $ilUser, $lng, $tpl, and time.

32  {
33  global $ilCtrl, $ilTabs, $lng, $tpl, $ilUser;
34 
35  if(!$a_user_id)
36  {
37  $a_user_id = $ilUser->getId();
38  }
39 
40  $this->assignment = $a_ass;
41  $this->exercise = $a_exercise;
42 
43  // #12337
44  if (!$this->exercise->members_obj->isAssigned($a_user_id))
45  {
46  $this->exercise->members_obj->assignMember($a_user_id);
47  }
48 
49  // public submissions ???
50  $public_submissions = false;
51  if ($this->exercise->getShowSubmissions() &&
52  $this->exercise->getTimestamp() - time() <= 0) // ???
53  {
54  $public_submissions = true;
55  }
56  $this->submission = new ilExSubmission($a_ass, $a_user_id, null, false, $public_submissions);
57 
58  // :TODO:
59  $this->ctrl = $ilCtrl;
60  $this->tabs_gui = $ilTabs;
61  $this->lng = $lng;
62  $this->tpl = $tpl;
63  }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
Exercise submission.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

Member Function Documentation

◆ downloadFeedbackFileObject()

ilExSubmissionGUI::downloadFeedbackFileObject ( )

Download feedback file.

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

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

184  {
185  global $ilUser;
186 
187  $file = $_REQUEST["file"];
188 
189  if (!isset($file))
190  {
191  ilUtil::sendFailure($this->lng->txt("exc_select_one_file"),true);
192  $this->ctrl->redirect($this, "view");
193  }
194 
195  // check, whether file belongs to assignment
196  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
197  $storage = new ilFSStorageExercise($this->exercise->getId(), $this->assignment->getId());
198  $files = $storage->getFeedbackFiles($this->submission->getFeedbackId());
199  $file_exist = false;
200  foreach($files as $fb_file)
201  {
202  if($fb_file == $file)
203  {
204  $file_exist = true;
205  break;
206  }
207  }
208  if(!$file_exist)
209  {
210  echo "FILE DOES NOT EXIST";
211  exit;
212  }
213 
214  // check whether assignment has already started
215  if (!$this->assignment->notStartedYet())
216  {
217  // deliver file
218  $p = $storage->getFeedbackFilePath($this->submission->getFeedbackId(), $file);
220  }
221 
222  return true;
223  }
$files
Definition: add-vimline.php:18
$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.
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
+ Here is the call graph for this function:

◆ downloadFileObject()

ilExSubmissionGUI::downloadFileObject ( )

Download assignment file.

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

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

251  {
252  $file = $_REQUEST["file"];
253 
254  if (!isset($file))
255  {
256  ilUtil::sendFailure($this->lng->txt("exc_select_one_file"),true);
257  $this->ctrl->redirect($this, "view");
258  }
259 
260  // check whether assignment as already started
261  if (!$this->assignment->notStartedYet())
262  {
263  // check, whether file belongs to assignment
264  $files = $this->assignment->getFiles();
265  $file_exist = false;
266  foreach($files as $lfile)
267  {
268  if($lfile["name"] == $file)
269  {
270  // deliver file
271  ilUtil::deliverFile($lfile["fullpath"], $file);
272  exit();
273  }
274  }
275  if(!$file_exist)
276  {
277  echo "FILE DOES NOT EXIST";
278  exit;
279  }
280  }
281 
282  return true;
283  }
$files
Definition: add-vimline.php:18
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
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
+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExSubmissionGUI::downloadGlobalFeedbackFileObject ( )

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

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

226  {
227  global $ilCtrl;
228 
229  $needs_dl = ($this->assignment->getFeedbackDate() == ilExAssignment::FEEDBACK_DATE_DEADLINE);
230 
231  if(!$this->assignment ||
232  !$this->assignment->getFeedbackFile() ||
233  ($needs_dl && !$this->assignment->afterDeadlineStrict()) ||
234  (!$needs_dl && !$this->submission->hasSubmitted()))
235  {
236  $ilCtrl->redirect($this, "returnToParent");
237  }
238 
239  // this is due to temporary bug in handleGlobalFeedbackFileUpload that missed the last "/"
240  $file = (is_file($this->assignment->getGlobalFeedbackFilePath()))
241  ? $this->assignment->getGlobalFeedbackFilePath()
242  : $this->assignment->getGlobalFeedbackFileStoragePath().$this->assignment->getFeedbackFile();
243 
244  ilUtil::deliverFile($file, $this->assignment->getFeedbackFile());
245  }
global $ilCtrl
Definition: ilias.php:18
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ executeCommand()

ilExSubmissionGUI::executeCommand ( )

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

References $cmd, and $ilCtrl.

66  {
67  global $ilCtrl;
68 
69  $class = $ilCtrl->getNextClass($this);
70  $cmd = $ilCtrl->getCmd("listPublicSubmissions");
71 
72  switch($class)
73  {
74  case "ilexsubmissionteamgui":
75  // team gui has no base gui - see we have to handle tabs here
76 
77  $this->tabs_gui->clearTargets();
78  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
79  $this->ctrl->getLinkTarget($this, "returnToParent"));
80 
81  $this->tabs_gui->addTab("submission", $this->lng->txt("exc_submission"),
82  $this->ctrl->getLinkTargetByClass("ilexsubmission".$this->submission->getSubmissionType()."gui", ""));
83 
84  include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
85  $gui = new ilExSubmissionTeamGUI($this->exercise, $this->submission);
86  $ilCtrl->forwardCommand($gui);
87  break;
88 
89  case "ilexsubmissiontextgui":
90  include_once "Modules/Exercise/classes/class.ilExSubmissionTextGUI.php";
91  $gui = new ilExSubmissionTextGUI($this->exercise, $this->submission);
92  $ilCtrl->forwardCommand($gui);
93  break;
94 
95  case "ilexsubmissionfilegui":
96  include_once "Modules/Exercise/classes/class.ilExSubmissionFileGUI.php";
97  $gui = new ilExSubmissionFileGUI($this->exercise, $this->submission);
98  $ilCtrl->forwardCommand($gui);
99  break;
100 
101  case "ilexsubmissionobjectgui":
102  include_once "Modules/Exercise/classes/class.ilExSubmissionObjectGUI.php";
103  $gui = new ilExSubmissionObjectGUI($this->exercise, $this->submission);
104  $ilCtrl->forwardCommand($gui);
105  break;
106 
107  case "ilexpeerreviewgui":
108  $this->tabs_gui->clearTargets();
109  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
110  $this->ctrl->getLinkTarget($this, "returnToParent"));
111 
112  include_once("./Modules/Exercise/classes/class.ilExPeerReviewGUI.php");
113  $peer_gui = new ilExPeerReviewGUI($this->assignment, $this->submission);
114  $this->ctrl->forwardCommand($peer_gui);
115  break;
116 
117  default:
118  $this->{$cmd."Object"}();
119  break;
120  }
121  }
$cmd
Definition: sahs_server.php:35
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 123 of file class.ilExSubmissionGUI.php.

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

Referenced by ilExAssignmentGUI\addSubmission().

124  {
125  global $ilCtrl;
126 
127  if(!$a_submission->canView())
128  {
129  return;
130  }
131 
132  $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", $a_submission->getAssignment()->getId());
133 
134  if($a_submission->getAssignment()->hasTeam())
135  {
136  include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
137  ilExSubmissionTeamGUI::getOverviewContent($a_info, $a_submission);
138  }
139 
140  $submission_type = $a_submission->getSubmissionType();
141  $class = "ilExSubmission".$submission_type."GUI";
142  include_once "Modules/Exercise/classes/class.".$class.".php";
143  $class::getOverviewContent($a_info, $a_submission);
144 
145  $ilCtrl->setParameterByClass("ilExSubmissionGUI", "ass_id", "");
146  }
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 152 of file class.ilExSubmissionGUI.php.

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

153  {
154  global $ilTabs, $ilCtrl, $lng;
155 
156  if(!$this->exercise->getShowSubmissions())
157  {
158  $this->returnToParentObject();
159  }
160 
161  $ilTabs->clearTargets();
162  $ilTabs->setBackTarget($lng->txt("back"),
163  $ilCtrl->getLinkTarget($this, "returnToParent"));
164 
165  if($this->assignment->getType() != ilExAssignment::TYPE_TEXT)
166  {
167  include_once("./Modules/Exercise/classes/class.ilPublicSubmissionsTableGUI.php");
168  $tab = new ilPublicSubmissionsTableGUI($this, "listPublicSubmissions", $this->assignment);
169  $this->tpl->setContent($tab->getHTML());
170  }
171  else
172  {
173  // #13271
174  include_once "Modules/Exercise/classes/class.ilExAssignmentListTextTableGUI.php";
175  $tbl = new ilExAssignmentListTextTableGUI($this, "listPublicSubmissions", $this->assignment, false, true);
176  $this->tpl->setContent($tbl->getHTML());
177  }
178  }
$tbl
Definition: example_048.php:81
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ returnToParentObject()

ilExSubmissionGUI::returnToParentObject ( )

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

Referenced by listPublicSubmissionsObject().

286  {
287  $this->ctrl->returnToParent($this);
288  }
+ Here is the caller graph for this function:

Field Documentation

◆ $assignment

ilExSubmissionGUI::$assignment
protected

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

◆ $exercise

ilExSubmissionGUI::$exercise
protected

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

◆ $submission

ilExSubmissionGUI::$submission
protected

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


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