ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilExSubmissionBaseGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 abstract class ilExSubmissionBaseGUI
13 {
17  protected $ctrl;
18 
22  protected $tabs_gui;
23 
27  protected $lng;
28 
32  protected $tpl;
33 
34  protected $exercise; // [ilObjExercise]
35  protected $submission; // [ilExSubmission]
36  protected $assignment; // [ilExAssignment]
37 
41  protected $type_guis;
42 
43  public function __construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
44  {
45  global $DIC;
46 
47  $ilCtrl = $DIC->ctrl();
48  $ilTabs = $DIC->tabs();
49  $lng = $DIC->language();
50  $tpl = $DIC["tpl"];
51 
52  $this->exercise = $a_exercise;
53  $this->submission = $a_submission;
54  $this->assignment = $a_submission->getAssignment();
55 
56  // :TODO:
57  $this->ctrl = $ilCtrl;
58  $this->tabs_gui = $ilTabs;
59  $this->lng = $lng;
60  $this->tpl = $tpl;
61 
62  include_once("./Modules/Exercise/AssignmentTypes/GUI/classes/class.ilExAssignmentTypesGUI.php");
63  $this->type_guis = ilExAssignmentTypesGUI::getInstance();
64  }
65 
66  abstract public static function getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission);
67 
68  protected function handleTabs()
69  {
70  $this->tabs_gui->clearTargets();
71  $this->tabs_gui->setBackTarget(
72  $this->lng->txt("back"),
73  $this->ctrl->getLinkTarget($this, "returnToParent")
74  );
75 
76  $this->tabs_gui->addTab(
77  "submission",
78  $this->lng->txt("exc_submission"),
79  $this->ctrl->getLinkTarget($this, "")
80  );
81  $this->tabs_gui->activateTab("submission");
82 
83  if ($this->assignment->hasTeam()) {
84  include_once "Modules/Exercise/classes/class.ilExSubmissionTeamGUI.php";
86  }
87  }
88 
89  public function returnToParentObject()
90  {
91  $this->ctrl->returnToParent($this);
92  }
93 
94 
95  //
96  // RETURNED/EXERCISE STATUS
97  //
98 
99  protected function handleNewUpload($a_no_notifications = false)
100  {
101  $has_submitted = $this->submission->hasSubmitted();
102 
103  $this->exercise->processExerciseStatus(
104  $this->assignment,
105  $this->submission->getUserIds(),
106  $has_submitted,
107  $this->submission->validatePeerReviews()
108  );
109 
110  if ($has_submitted &&
111  !$a_no_notifications) {
112  include_once "./Services/Notification/classes/class.ilNotification.php";
114 
115  include_once "./Modules/Exercise/classes/class.ilExerciseMailNotification.php";
116  $not = new ilExerciseMailNotification();
118  $not->setAssignmentId($this->assignment->getId());
119  $not->setRefId($this->exercise->getRefId());
120  $not->setRecipients($users);
121  $not->send();
122  }
123  }
124 
125  protected function handleRemovedUpload()
126  {
127  // #16532 - always send notifications
128  $this->handleNewUpload();
129  }
130 }
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
Class ilInfoScreenGUI.
global $DIC
Definition: saml.php:7
Exercise submission base gui.
static getInstance()
Get instance.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
global $ilCtrl
Definition: ilias.php:18
Class ilObjExercise.
handleNewUpload($a_no_notifications=false)
$users
Definition: authpage.php:44
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)