ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilExSubmissionBaseGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
31 abstract class ilExSubmissionBaseGUI
32 {
33  protected \ILIAS\Exercise\Notification\NotificationManager $notification;
34  protected \ILIAS\Exercise\InternalDomainService $domain;
35  protected \ILIAS\Exercise\InternalGUIService $gui;
36  protected ilObjUser $user;
37  protected ilCtrl $ctrl;
38  protected ilTabsGUI $tabs_gui;
39  protected ilLanguage $lng;
47  protected int $requested_ref_id;
48  protected GUIRequest $request;
49 
53  public function __construct(
54  ilObjExercise $a_exercise,
55  ilExSubmission $a_submission
56  ) {
57  global $DIC;
58 
59  $service = $DIC->exercise()->internal();
60  $this->gui = $service->gui();
61  $this->domain = $service->domain();
62 
63  $this->user = $this->domain->user();
64  $this->ctrl = $this->gui->ctrl();
65  $this->tabs_gui = $this->gui->tabs();
66  $this->lng = $this->domain->lng();
67  $this->tpl = $this->gui->ui()->mainTemplate();
68 
69  $this->exercise = $a_exercise;
70  $this->submission = $a_submission;
71  $this->assignment = $a_submission->getAssignment();
72 
73  $this->mandatory_manager = $this->domain
74  ->assignment()
75  ->mandatoryAssignments($this->exercise);
76 
77  $this->request = $this->gui->request();
78  $this->requested_ref_id = $this->request->getRefId();
79  $this->notification = $this->domain->notification($this->requested_ref_id);
80 
81  $this->type_guis = $this->gui->assignment()->types();
82  $this->tool_context = $DIC->globalScreen()->tool()->context();
83  $this->gui = $DIC->exercise()
84  ->internal()
85  ->gui();
86  }
87 
88  abstract public static function getOverviewContent(
89  ilInfoScreenGUI $a_info,
90  ilExSubmission $a_submission
91  ): void;
92 
93  protected function handleTabs(): void
94  {
95  return;
96  $this->tabs_gui->clearTargets();
97  $this->tabs_gui->setBackTarget(
98  $this->lng->txt("back"),
99  $this->ctrl->getLinkTarget($this, "returnToParent")
100  );
101 
102  $this->tabs_gui->addTab(
103  "submission",
104  $this->lng->txt("exc_submission"),
105  $this->ctrl->getLinkTarget($this, "")
106  );
107  $this->tabs_gui->activateTab("submission");
108 
109  if ($this->assignment->hasTeam()) {
111  }
112  }
113 
114  public function returnToParentObject(): void
115  {
116  if ($this->request->getFromOverview()) {
117  $this->ctrl->redirectByClass(ilObjExerciseGUI::class, "showOverview");
118  }
119  $this->ctrl->returnToParent($this);
120  }
121 
122 
123  //
124  // RETURNED/EXERCISE STATUS
125  //
126 
127  protected function handleNewUpload(
128  bool $a_no_notifications = false
129  ): void {
130  $has_submitted = $this->submission->hasSubmitted();
131 
132  $this->exercise->processExerciseStatus(
133  $this->assignment,
134  $this->submission->getUserIds(),
135  $has_submitted,
136  $this->submission->validatePeerReviews()
137  );
138 
139  if ($has_submitted &&
140  !$a_no_notifications) {
141  $this->notification->sendUploadNotification($this->assignment->getId());
142  }
143  }
144 
145  protected function handleRemovedUpload(): void
146  {
147  // #16532 - always send notifications
148  $this->handleNewUpload();
149  }
150 
151  protected function triggerAssignmentTool(): void
152  {
153  $ass_ids = [$this->assignment->getId()];
154  $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::SHOW_EXC_ASSIGNMENT_INFO, true);
155  $this->tool_context->current()->addAdditionalData(ilExerciseGSToolProvider::EXC_ASS_IDS, $ass_ids);
156  }
157 }
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
handleNewUpload(bool $a_no_notifications=false)
ILIAS Exercise InternalGUIService $gui
Exercise assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise submission base gui.
ilGlobalTemplateInterface $tpl
notification()
description: > Example for rendring a notification glyph.
Class ilObjExercise.
MandatoryAssignmentsManager $mandatory_manager
ILIAS Exercise Notification NotificationManager $notification
global $DIC
Definition: shib_login.php:26
ilExAssignmentTypesGUI $type_guis
Exercise submission //TODO: This class has many static methods related to delivered "files"...
ILIAS Exercise InternalDomainService $domain
Exercise gui request wrapper.
$service
Definition: ltiservices.php:40
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...