ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExSubmissionGUI Class Reference

Class ilExSubmissionGUI. More...

+ Collaboration diagram for ilExSubmissionGUI:

Public Member Functions

 __construct (ilObjExercise $a_exercise, ilExAssignment $a_ass, ?int $a_user_id=null)
 
 executeCommand ()
 
 getHTML (array $par)
 
 listPublicSubmissionsObject ()
 
 downloadFeedbackFileObject ()
 Download feedback file. More...
 
 downloadGlobalFeedbackFileObject ()
 
 downloadFileObject ()
 
 returnToParentObject ()
 

Data Fields

const MODE_OVERVIEW_CONTENT = 1
 

Protected Attributes

ILIAS Exercise InternalDomainService $domain
 
ILIAS Exercise InternalGUIService $gui
 
ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilObjUser $user
 
ilObjExercise $exercise
 
ilExSubmission $submission
 
ilExAssignment $assignment
 
ilExAssignmentTypesGUI $type_guis
 
int $user_id
 
GUIRequest $request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $lng, $service, $tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), null, and ILIAS\Repository\user().

52  {
53  global $DIC;
54 
55  $service = $DIC->exercise()->internal();
56  $this->gui = $gui = $service->gui();
57  $this->domain = $domain = $service->domain();
58 
59  $this->user = $domain->user();
60  $ilCtrl = $gui->ctrl();
61  $ilTabs = $gui->tabs();
62  $lng = $domain->lng();
63  $tpl = $gui->ui()->mainTemplate();
64 
65  if (!$a_user_id) {
66  $a_user_id = $this->user->getId();
67  }
68 
69  $this->assignment = $a_ass;
70  $this->exercise = $a_exercise;
71  $this->user_id = $a_user_id;
72 
73  $this->type_guis = $gui->assignment()->types();
74 
75  // #12337
76  if (!$this->exercise->members_obj->isAssigned($a_user_id)) {
77  $this->exercise->members_obj->assignMember($a_user_id);
78  }
79 
80  // public submissions ???
81  $public_submissions = false;
82  if ($this->exercise->getShowSubmissions() &&
83  $this->exercise->getTimestamp() - time() <= 0) { // ???
84  $public_submissions = true;
85  }
86  $this->submission = new ilExSubmission($a_ass, $a_user_id, null, false, $public_submissions);
87 
88  // :TODO:
89  $this->ctrl = $ilCtrl;
90  $this->tabs_gui = $ilTabs;
91  $this->lng = $lng;
92  $this->tpl = $tpl;
93  $this->request = $DIC->exercise()->internal()->gui()->request();
94  $this->domain = $DIC->exercise()->internal()->domain();
95  }
ILIAS Exercise InternalDomainService $domain
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
ilGlobalTemplateInterface $tpl
Exercise submission //TODO: This class has many static methods related to delivered "files"...
ILIAS Exercise InternalGUIService $gui
$service
Definition: ltiservices.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ downloadFeedbackFileObject()

ilExSubmissionGUI::downloadFeedbackFileObject ( )

Download feedback file.

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

254  : bool
255  {
256  $file = $this->request->getFile();
257 
258  if (!isset($file)) {
259  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("exc_select_one_file"), true);
260  $this->ctrl->redirect($this, "view");
261  }
262 
263  $this->domain->assignment()->tutorFeedbackFile($this->assignment->getId())
264  ->deliver($this->user_id, $file);
265  return true;
266  }
+ Here is the call graph for this function:

◆ downloadFileObject()

ilExSubmissionGUI::downloadFileObject ( )

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

References $user_id, ILIAS\Repository\ctrl(), ilExcAssMemberState\getInstanceByIds(), and ILIAS\Repository\lng().

283  : bool
284  {
285  $file = $this->request->getFile();
286 
287  if (!isset($file)) {
288  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("exc_select_one_file"), true);
289  $this->ctrl->redirect($this, "view");
290  }
291 
292  // check whether assignment as already started
293  $state = ilExcAssMemberState::getInstanceByIds($this->assignment->getId(), $this->user_id);
294  if ($state->areInstructionsVisible()) {
295  // check, whether file belongs to assignment
296  $files = $this->assignment->getFiles();
297  $file_exist = false;
298  foreach ($files as $lfile) {
299  if ($lfile["name"] == $file) {
300  $this->domain->assignment()->instructionFiles($this->assignment->getId())->deliver($lfile["fullpath"], $file);
301  }
302  }
303  if (!$file_exist) {
304  return false;
305  }
306  }
307 
308  return true;
309  }
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
+ Here is the call graph for this function:

◆ downloadGlobalFeedbackFileObject()

ilExSubmissionGUI::downloadGlobalFeedbackFileObject ( )

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

References $ctrl, $user_id, and ilExcAssMemberState\getInstanceByIds().

268  : void
269  {
270  $ilCtrl = $this->ctrl;
271 
272  $state = ilExcAssMemberState::getInstanceByIds($this->assignment->getId(), $this->user_id);
273 
274  // fix bug 28466, this code should be streamlined with the if above and
275  // the presentation of the download link in the ilExAssignmentGUI->addSubmission
276  if (!$state->isGlobalFeedbackFileAccessible($this->submission)) {
277  $ilCtrl->redirect($this, "returnToParent");
278  }
279 
280  $this->domain->assignment()->sampleSolution($this->assignment->getId())->deliver();
281  }
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
+ Here is the call graph for this function:

◆ executeCommand()

ilExSubmissionGUI::executeCommand ( )
Exceptions
ilCtrlException

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

References $ctrl, $DIC, ilExSubmission\canView(), ILIAS\Repository\ctrl(), ilExSubmission\getAssignment(), getHTML(), ilCtrl\getNextClass(), ilExSubmissionTeamGUI\getOverviewContent(), ilExSubmission\getSubmissionType(), ILIAS\Repository\lng(), and ilExSubmission\TYPE_REPO_OBJECT.

100  : void
101  {
102  $ilCtrl = $this->ctrl;
103 
104  $class = $ilCtrl->getNextClass($this);
105  $cmd = $ilCtrl->getCmd("listPublicSubmissions");
106 
107  switch ($class) {
108  case "ilexsubmissionteamgui":
109  // team gui has no base gui - see we have to handle tabs here
110 
111  $this->tabs_gui->clearTargets();
112  $this->tabs_gui->setBackTarget(
113  $this->lng->txt("back"),
114  $this->ctrl->getLinkTarget($this, "returnToParent")
115  );
116 
117  // forward to type gui
118  if ($this->submission->getSubmissionType() != ilExSubmission::TYPE_REPO_OBJECT) {
119  $this->tabs_gui->addTab(
120  "submission",
121  $this->lng->txt("exc_submission"),
122  $this->ctrl->getLinkTargetByClass("ilexsubmission" . $this->submission->getSubmissionType() . "gui", "")
123  );
124  }
125 
126  $gui = $this->gui->getTeamSubmissionGUI($this->exercise, $this->submission);
127  $ilCtrl->forwardCommand($gui);
128  break;
129 
130  case "ilexsubmissiontextgui":
131  $gui = new ilExSubmissionTextGUI($this->exercise, $this->submission);
132  $ilCtrl->forwardCommand($gui);
133  break;
134 
135  case "ilexsubmissionfilegui":
136  $gui = new ilExSubmissionFileGUI($this->exercise, $this->submission);
137  $ilCtrl->forwardCommand($gui);
138  break;
139 
140  case "ilexsubmissionobjectgui":
141  $gui = new ilExSubmissionObjectGUI($this->exercise, $this->submission);
142  $ilCtrl->forwardCommand($gui);
143  break;
144 
145  case "ilexpeerreviewgui":
146  /*
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  $ilCtrl->forwardCommand($type_gui);
166  }
167 
168  $this->{$cmd . "Object"}();
169  break;
170  }
171  }
getNextClass($a_gui_class=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Exercise InternalGUIService $gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Object-based submissions (ends up as static file)
+ Here is the call graph for this function:

◆ getHTML()

ilExSubmissionGUI::getHTML ( array  $par)
Exceptions
ilExcUnknownAssignmentTypeException

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

Referenced by executeCommand().

213  : string
214  {
215  switch ($par["mode"]) {
216  // get overview content from ass type gui
217  case self::MODE_OVERVIEW_CONTENT:
218  $type_gui = $this->type_guis->getById($par["submission"]->getAssignment()->getType());
219  $type_gui->getOverviewContent($par["info"], $par["submission"]);
220  break;
221  }
222  return "";
223  }
+ Here is the caller graph for this function:

◆ listPublicSubmissionsObject()

ilExSubmissionGUI::listPublicSubmissionsObject ( )

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

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

225  : void
226  {
227  $ilTabs = $this->tabs_gui;
228  $ilCtrl = $this->ctrl;
229  $lng = $this->lng;
230 
231  if (!$this->exercise->getShowSubmissions()) {
232  $this->returnToParentObject();
233  }
234 
235  $ilTabs->clearTargets();
236  $ilTabs->setBackTarget(
237  $lng->txt("back"),
238  $ilCtrl->getLinkTarget($this, "returnToParent")
239  );
240 
241  if ($this->assignment->getType() != ilExAssignment::TYPE_TEXT) {
242  $tab = new ilPublicSubmissionsTableGUI($this, "listPublicSubmissions", $this->assignment);
243  $this->tpl->setContent($tab->getHTML());
244  } else {
245  // #13271
246  $tbl = new ilExAssignmentListTextTableGUI($this, "listPublicSubmissions", $this->assignment, false, true);
247  $this->tpl->setContent($tbl->getHTML());
248  }
249  }
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ returnToParentObject()

ilExSubmissionGUI::returnToParentObject ( )

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

References ILIAS\Repository\ctrl().

Referenced by listPublicSubmissionsObject().

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

Field Documentation

◆ $assignment

ilExAssignment ilExSubmissionGUI::$assignment
protected

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

◆ $ctrl

ilCtrl ilExSubmissionGUI::$ctrl
protected

◆ $domain

ILIAS Exercise InternalDomainService ilExSubmissionGUI::$domain
protected

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

◆ $exercise

ilObjExercise ilExSubmissionGUI::$exercise
protected

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

◆ $gui

ILIAS Exercise InternalGUIService ilExSubmissionGUI::$gui
protected

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

◆ $lng

ilLanguage ilExSubmissionGUI::$lng
protected

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

Referenced by __construct(), and listPublicSubmissionsObject().

◆ $request

GUIRequest ilExSubmissionGUI::$request
protected

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

◆ $submission

ilExSubmission ilExSubmissionGUI::$submission
protected

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

◆ $tabs_gui

ilTabsGUI ilExSubmissionGUI::$tabs_gui
protected

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

Referenced by listPublicSubmissionsObject().

◆ $tpl

ilGlobalTemplateInterface ilExSubmissionGUI::$tpl
protected

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

Referenced by __construct().

◆ $type_guis

ilExAssignmentTypesGUI ilExSubmissionGUI::$type_guis
protected

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

◆ $user

ilObjUser ilExSubmissionGUI::$user
protected

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

◆ $user_id

int ilExSubmissionGUI::$user_id
protected

◆ MODE_OVERVIEW_CONTENT

const ilExSubmissionGUI::MODE_OVERVIEW_CONTENT = 1

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


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