ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.InternalGUIService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Exercise;
22 
23 use ILIAS\Refinery;
31 
38 {
40 
41  protected \ILIAS\Exercise\InternalDataService $data_service;
42  protected \ILIAS\Exercise\InternalDomainService $domain_service;
43  protected \ilLanguage $lng;
44  protected Refinery\Factory $refinery;
45 
47 
48  protected ?GUIRequest $request = null;
49  protected \ilExSubmissionGUI $submission_gui;
50  protected \ilObjExercise $exc;
51 
52  public function __construct(
54  InternalDataService $data_service,
55  InternalDomainService $domain_service
56  ) {
57  $this->data_service = $data_service;
58  $this->domain_service = $domain_service;
59  $this->initGUIServices($DIC);
60  }
61 
62  public function assignment(): Assignment\GUIService
63  {
64  return new Assignment\GUIService(
65  $this->domain_service,
66  $this
67  );
68  }
69 
70  public function peerReview(): PeerReview\GUIService
71  {
72  return new PeerReview\GUIService(
73  $this->domain_service,
74  $this
75  );
76  }
77 
79  {
80  return new PermanentLinkManager(
81  $this->domain_service,
82  $this
83  );
84  }
85 
86 
92  public function request(
93  ?array $query_params = null,
94  ?array $post_data = null
95  ): GUIRequest {
96  if (is_null($query_params) && is_null($post_data) && !is_null($this->request)) {
97  return $this->request;
98  }
99  $request = new GUIRequest(
100  $this->http(),
101  $this->domain_service->refinery(),
102  $query_params,
103  $post_data
104  );
105  if (is_null($query_params) && is_null($post_data)) {
106  $this->request = $request;
107  }
108  return $request;
109  }
110 
114  public function getExerciseGUI(?int $ref_id = null): \ilObjExerciseGUI
115  {
116  if ($ref_id === null) {
117  $ref_id = $this->request()->getRefId();
118  }
119  return new \ilObjExerciseGUI([], $ref_id, true);
120  }
121 
123  {
124  if ($exc === null) {
125  $exc = $this->request()->getExercise();
126  }
127  return new \ilExcRandomAssignmentGUI(
128  $this->ui(),
129  $this->toolbar(),
130  $this->domain_service->lng(),
131  $this->ctrl(),
132  $this->domain_service->assignment()->randomAssignments($exc)
133  );
134  }
135 
136  public function getSubmissionGUI(
137  \ilObjExercise $exc = null,
138  \ilExAssignment $ass = null,
139  $member_id = null
140  ): \ilExSubmissionGUI {
141  if ($exc === null) {
142  $exc = $this->request()->getExercise();
143  }
144  if ($ass === null) {
145  $ass = $this->request()->getAssignment();
146  }
147  if ($member_id === null) {
148  $member_id = $this->request()->getMemberId();
149  }
150  return new \ilExSubmissionGUI(
151  $exc,
152  $ass,
153  $member_id
154  );
155  }
156 
157  public function getTeamSubmissionGUI(
158  \ilObjExercise $exc,
159  \ilExSubmission $submission
161  return new \ilExSubmissionTeamGUI($exc, $submission);
162  }
163 }
Exercise UI frontend presentation service class.
ILIAS Exercise InternalDomainService $domain_service
Exercise assignment.
initGUIServices(\ILIAS\DI\Container $DIC)
Exercise internal service.
request(?array $query_params=null, ?array $post_data=null)
Get request wrapper.
getSubmissionGUI(\ilObjExercise $exc=null, \ilExAssignment $ass=null, $member_id=null)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $DIC, InternalDataService $data_service, InternalDomainService $domain_service)
global $DIC
Definition: feed.php:28
Class ilObjExercise.
$ref_id
Definition: ltiauth.php:67
static http()
Fetches the global http state from ILIAS.
ILIAS Exercise InternalDataService $data_service
UI for random assignment (ui)
getTeamSubmissionGUI(\ilObjExercise $exc, \ilExSubmission $submission)
Internal factory for data objects.
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...
Definition: Assignment.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRandomAssignmentGUI(\ilObjExercise $exc=null)
Exercise gui request wrapper.
Class ilExSubmissionGUI.