ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExSubmissionBaseGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
31 abstract class ilExSubmissionBaseGUI
32 {
33  protected ilCtrl $ctrl;
34  protected ilTabsGUI $tabs_gui;
35  protected ilLanguage $lng;
43  protected int $requested_ref_id;
44  protected GUIRequest $request;
45 
49  public function __construct(
50  ilObjExercise $a_exercise,
51  ilExSubmission $a_submission
52  ) {
54  global $DIC;
55 
56  $ilCtrl = $DIC->ctrl();
57  $ilTabs = $DIC->tabs();
58  $lng = $DIC->language();
59  $tpl = $DIC["tpl"];
60 
61  $this->exercise = $a_exercise;
62  $this->submission = $a_submission;
63  $this->assignment = $a_submission->getAssignment();
64 
65  $this->mandatory_manager = $DIC
66  ->exercise()
67  ->internal()
68  ->domain()
69  ->assignment()
70  ->mandatoryAssignments($this->exercise);
71 
72  $this->request = $DIC->exercise()->internal()->gui()->request();
73  $this->requested_ref_id = $this->request->getRefId();
74 
75  // :TODO:
76  $this->ctrl = $ilCtrl;
77  $this->tabs_gui = $ilTabs;
78  $this->lng = $lng;
79  $this->tpl = $tpl;
80 
81  $this->type_guis = ilExAssignmentTypesGUI::getInstance();
82  $this->tool_context = $DIC->globalScreen()->tool()->context();
83  }
84 
85  abstract public static function getOverviewContent(
86  ilInfoScreenGUI $a_info,
87  ilExSubmission $a_submission
88  ): void;
89 
90  protected function handleTabs(): void
91  {
92  $this->tabs_gui->clearTargets();
93  $this->tabs_gui->setBackTarget(
94  $this->lng->txt("back"),
95  $this->ctrl->getLinkTarget($this, "returnToParent")
96  );
97 
98  $this->tabs_gui->addTab(
99  "submission",
100  $this->lng->txt("exc_submission"),
101  $this->ctrl->getLinkTarget($this, "")
102  );
103  $this->tabs_gui->activateTab("submission");
104 
105  if ($this->assignment->hasTeam()) {
107  }
108  }
109 
110  public function returnToParentObject(): void
111  {
112  $this->ctrl->returnToParent($this);
113  }
114 
115 
116  //
117  // RETURNED/EXERCISE STATUS
118  //
119 
120  protected function handleNewUpload(
121  bool $a_no_notifications = false
122  ): void {
123  $has_submitted = $this->submission->hasSubmitted();
124 
125  $this->exercise->processExerciseStatus(
126  $this->assignment,
127  $this->submission->getUserIds(),
128  $has_submitted,
129  $this->submission->validatePeerReviews()
130  );
131 
132  if ($has_submitted &&
133  !$a_no_notifications) {
135 
136  $not = new ilExerciseMailNotification();
138  $not->setAssignmentId($this->assignment->getId());
139  $not->setRefId($this->exercise->getRefId());
140  $not->setRecipients($users);
141  $not->send();
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)
Class ilInfoScreenGUI.
Exercise assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise submission base gui.
static getInstance()
Get instance.
static getNotificationsForObject(int $type, int $id, ?int $page_id=null, bool $ignore_threshold=false)
Get all users/recipients for given object.
ilGlobalTemplateInterface $tpl
global $DIC
Definition: feed.php:28
Class ilObjExercise.
MandatoryAssignmentsManager $mandatory_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
ilExAssignmentTypesGUI $type_guis
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise gui request wrapper.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...