ILIAS  release_8 Revision v8.23
class.InternalGUIService.php
Go to the documentation of this file.
1 <?php
2 
19 namespace ILIAS\Exercise;
20 
22 use ILIAS\HTTP;
23 use ILIAS\Refinery;
26 
33 {
37  protected \ilLanguage $lng;
38  protected \ilCtrl $ctrl;
39  protected \ilToolbarGUI $toolbar;
40  protected HTTP\Services $http;
41  protected Refinery\Factory $refinery;
42 
44 
45  protected ?GUIRequest $request = null;
46  protected \ilExSubmissionGUI $submission_gui;
47  protected \ilObjExercise $exc;
48 
49  public function __construct(
51  InternalDataService $data_service,
52  InternalDomainService $domain_service
53  ) {
54  $this->data_service = $data_service;
55  $this->domain_service = $domain_service;
56  $this->initGUIServices($DIC);
57  }
58 
64  public function request(
65  ?array $query_params = null,
66  ?array $post_data = null
67  ): GUIRequest {
68  if (is_null($query_params) && is_null($post_data) && !is_null($this->request)) {
69  return $this->request;
70  }
71  $request = new GUIRequest(
72  $this->http(),
73  $this->domain_service->refinery(),
74  $query_params,
75  $post_data
76  );
77  if (is_null($query_params) && is_null($post_data)) {
78  $this->request = $request;
79  }
80  return $request;
81  }
82 
86  public function getExerciseGUI(?int $ref_id = null): \ilObjExerciseGUI
87  {
88  if ($ref_id === null) {
89  $ref_id = $this->request()->getRefId();
90  }
91  return new \ilObjExerciseGUI([], $ref_id, true);
92  }
93 
95  {
96  if ($exc === null) {
97  $exc = $this->request()->getExercise();
98  }
99  return new \ilExcRandomAssignmentGUI(
100  $this->ui(),
101  $this->toolbar(),
102  $this->domain_service->lng(),
103  $this->ctrl(),
104  $this->domain_service->assignment()->randomAssignments($exc)
105  );
106  }
107 
108  public function getSubmissionGUI(
109  \ilObjExercise $exc = null,
110  \ilExAssignment $ass = null,
111  $member_id = null
112  ): \ilExSubmissionGUI {
113  if ($exc === null) {
114  $exc = $this->request()->getExercise();
115  }
116  if ($ass === null) {
117  $ass = $this->request()->getAssignment();
118  }
119  if ($member_id === null) {
120  $member_id = $this->request()->getMemberId();
121  }
122  return new \ilExSubmissionGUI(
123  $exc,
124  $ass,
125  $member_id
126  );
127  }
128 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise UI frontend presentation service class.
Exercise assignment.
initGUIServices(\ILIAS\DI\Container $DIC)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: ByTrying.php:21
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:31
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjExercise.
$ref_id
Definition: ltiauth.php:67
static http()
Fetches the global http state from ILIAS.
UI for random assignment (ui)
Internal factory for data objects.
Exercise domain service (business logic)
getRandomAssignmentGUI(\ilObjExercise $exc=null)
Exercise gui request wrapper.
Class ilExSubmissionGUI.