ILIAS  release_8 Revision v8.24
ilStudyProgrammeTypeGUI Class Reference
+ Collaboration diagram for ilStudyProgrammeTypeGUI:

Public Member Functions

 __construct (ilGlobalTemplateInterface $tpl, ilCtrl $ilCtrl, ilAccess $ilAccess, ilToolbarGUI $ilToolbar, ilLanguage $lng, ILIAS $ilias, ilTabsGUI $ilTabs, ilObjUser $user, ilStudyProgrammeTypeRepository $type_repository, Input\Factory $input_factory, Renderer $renderer, Psr\Http\Message\ServerRequestInterface $request, Refinery\Factory $refinery_factory, Filesystem $web_dir, RequestWrapper $request_wrapper)
 
 executeCommand ()
 
 setParentGUI ($parent_gui)
 

Data Fields

ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 

Protected Member Functions

 checkAccess ()
 
 setSubTabsEdit (string $active_tab_id)
 
 editCustomIcons ()
 
 updateCustomIcons ()
 
 editAMD ()
 
 updateAMD ()
 
 listTypes ()
 
 add ()
 
 edit ()
 
 create ()
 
 update ()
 
 delete ()
 
 buildForm (string $submit_action, string $type_action, ilStudyProgrammeType $type=null)
 
 buildModalHeading (string $title, string $default_lng)
 
 buildLanguagesForms (ilStudyProgrammeType $type=null)
 
 getInstalledLanguages ()
 

Protected Attributes

ilAccess $access
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ILIAS $ilias
 
ilTabsGUI $tabs
 
ilObjUser $user
 
ilStudyProgrammeTypeRepository $type_repository
 
Input Factory $input_factory
 
Renderer $renderer
 
Psr Http Message ServerRequestInterface $request
 
Refinery Factory $refinery_factory
 
 $parent_gui
 
array $installed_languages = null
 
Filesystem $web_dir
 
RequestWrapper $request_wrapper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeTypeGUI::__construct ( ilGlobalTemplateInterface  $tpl,
ilCtrl  $ilCtrl,
ilAccess  $ilAccess,
ilToolbarGUI  $ilToolbar,
ilLanguage  $lng,
ILIAS  $ilias,
ilTabsGUI  $ilTabs,
ilObjUser  $user,
ilStudyProgrammeTypeRepository  $type_repository,
Input\Factory  $input_factory,
Renderer  $renderer,
Psr\Http\Message\ServerRequestInterface  $request,
Refinery\Factory  $refinery_factory,
Filesystem  $web_dir,
RequestWrapper  $request_wrapper 
)

Definition at line 55 of file class.ilStudyProgrammeTypeGUI.php.

71 {
72 $this->tpl = $tpl;
73 $this->ctrl = $ilCtrl;
74 $this->access = $ilAccess;
75 $this->toolbar = $ilToolbar;
76 $this->tabs = $ilTabs;
77 $this->user = $user;
78 $this->lng = $lng;
79 $this->ilias = $ilias;
80 $this->type_repository = $type_repository;
81 $this->input_factory = $input_factory;
82 $this->renderer = $renderer;
83 $this->request = $request;
84 $this->refinery_factory = $refinery_factory;
85 $this->web_dir = $web_dir;
86 $this->request_wrapper = $request_wrapper;
87
88 $this->lng->loadLanguageModule('prg');
89 $this->ctrl->saveParameter($this, 'type_id');
90 $this->lng->loadLanguageModule('meta');
91 }
Psr Http Message ServerRequestInterface $request
ilStudyProgrammeTypeRepository $type_repository
header include for all ilias files.

References $ilias, $input_factory, $lng, $refinery_factory, $renderer, $request, $request_wrapper, $tpl, $type_repository, $user, $web_dir, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilStudyProgrammeTypeGUI::add ( )
protected

Definition at line 275 of file class.ilStudyProgrammeTypeGUI.php.

275 : void
276 {
277 $form = $this->buildForm(
278 $this->ctrl->getFormActionByClass(
279 __CLASS__,
280 'create'
281 ),
282 $this->lng->txt('prg_type_add')
283 );
284
285 $this->tpl->setContent($this->renderer->render($form));
286 }
buildForm(string $submit_action, string $type_action, ilStudyProgrammeType $type=null)

References buildForm(), and ILIAS\Repository\ctrl().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildForm()

ilStudyProgrammeTypeGUI::buildForm ( string  $submit_action,
string  $type_action,
ilStudyProgrammeType  $type = null 
)
protected

Definition at line 381 of file class.ilStudyProgrammeTypeGUI.php.

385 : Input\Container\Form\Form {
386 $default_lng = "";
387 if (!is_null($type)) {
388 $default_lng = $type->getDefaultLang();
389 }
390
391 return $this->input_factory->container()->form()->standard(
392 $submit_action,
393 [
394 "default_lang" => $this->buildModalHeading($type_action, $default_lng),
395 "info" => $this->buildLanguagesForms($type)
396 ]
397 )->withAdditionalTransformation(
398 $this->refinery_factory->custom()->transformation(
399 function ($values) {
400 return [
401 'default_lang' => $values['default_lang']['default_lang'],
402 'info' => $values['info']
403 ];
404 }
405 )
406 );
407 }
static return function(ContainerConfigurator $containerConfigurator)
Definition: basic_rector.php:9
buildModalHeading(string $title, string $default_lng)
buildLanguagesForms(ilStudyProgrammeType $type=null)
$type

References $type.

Referenced by add(), create(), edit(), and update().

+ Here is the caller graph for this function:

◆ buildLanguagesForms()

ilStudyProgrammeTypeGUI::buildLanguagesForms ( ilStudyProgrammeType  $type = null)
protected

Definition at line 426 of file class.ilStudyProgrammeTypeGUI.php.

426 : InputField
427 {
428 $return = [];
429 foreach ($this->getInstalledLanguages() as $lng_code) {
430 $title = null;
431 $description = null;
432 if (!is_null($type)) {
433 $title = $type->getTitle($lng_code);
434 $description = $type->getDescription($lng_code);
435 }
436 $lng_field = new ilStudyProgrammeTypeInfo($title, $description, $lng_code);
437 $return[] = $lng_field->toFormInput(
438 $this->input_factory->field(),
439 $this->lng,
440 $this->refinery_factory
441 );
442 }
443
444 return $this->input_factory->field()->group($return);
445 }

References $type.

◆ buildModalHeading()

ilStudyProgrammeTypeGUI::buildModalHeading ( string  $title,
string  $default_lng 
)
protected

Definition at line 409 of file class.ilStudyProgrammeTypeGUI.php.

409 : InputField
410 {
411 $options = [];
412 foreach ($this->getInstalledLanguages() as $lang_code) {
413 $options[$lang_code] = $this->lng->txt("meta_l_$lang_code");
414 }
415
416 $select = $this->input_factory->field()->select(
417 $this->lng->txt('default_language'),
418 $options,
419 ''
420 )->withValue($default_lng)
421 ->withRequired(true);
422
423 return $this->input_factory->field()->section(['default_lang' => $select], $title);
424 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ checkAccess()

ilStudyProgrammeTypeGUI::checkAccess ( )
protected

Definition at line 149 of file class.ilStudyProgrammeTypeGUI.php.

149 : void
150 {
151 if (!$this->access->checkAccess("read", "", $this->parent_gui->getObject()->getRefId())) {
152 $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
153 $this->ctrl->redirect($this->parent_gui);
154 }
155 }

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilStudyProgrammeTypeGUI::create ( )
protected

Definition at line 305 of file class.ilStudyProgrammeTypeGUI.php.

305 : void
306 {
307 $form = $this->buildForm(
308 $this->ctrl->getFormActionByClass(
309 __CLASS__,
310 'create'
311 ),
312 $this->lng->txt('prg_type_add')
313 )->withRequest($this->request);
314
315 $result = $form->getData();
316 if (!is_null($result)) {
317 $type = $this->type_repository->createType($this->lng->getDefaultLanguage());
318 $this->updateTypeFromFormResult($type, $result);
319 $this->tpl->setOnScreenMessage("success", $this->lng->txt('msg_obj_modified'), true);
320 $this->ctrl->redirect($this, 'view');
321 } else {
322 $this->tpl->setOnScreenMessage("failure", $this->lng->txt("msg_fill_required"), true);
323 $this->tpl->setContent($this->renderer->render($form));
324 }
325 }

References $type, buildForm(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilStudyProgrammeTypeGUI::delete ( )
protected

Definition at line 367 of file class.ilStudyProgrammeTypeGUI.php.

367 : void
368 {
369 $type_id = $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int());
370 $type = $this->type_repository->getType($type_id);
371 try {
372 $this->type_repository->deleteType($type);
373 $this->tpl->setOnScreenMessage("success", $this->lng->txt('prg_type_msg_deleted'), true);
374 $this->ctrl->redirect($this);
375 } catch (Exception $e) {
376 $this->tpl->setOnScreenMessage("failure", $e->getMessage(), true);
377 $this->ctrl->redirect($this);
378 }
379 }

References Vendor\Package\$e, $type, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ edit()

ilStudyProgrammeTypeGUI::edit ( )
protected

Definition at line 288 of file class.ilStudyProgrammeTypeGUI.php.

288 : void
289 {
290 $type_id = $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int());
291 $type = $this->type_repository->getType($type_id);
292
293 $form = $this->buildForm(
294 $this->ctrl->getFormActionByClass(
295 __CLASS__,
296 'update'
297 ),
298 $this->lng->txt('prg_type_edit'),
299 $type
300 );
301
302 $this->tpl->setContent($this->renderer->render($form));
303 }

References $type, buildForm(), and ILIAS\Repository\ctrl().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editAMD()

ilStudyProgrammeTypeGUI::editAMD ( )
protected

Definition at line 221 of file class.ilStudyProgrammeTypeGUI.php.

221 : void
222 {
224 $this,
225 $this->type_repository,
226 $this->ctrl,
227 $this->tpl,
228 $this->lng
229 );
230 $type_id = $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int());
231 $form->fillForm($this->type_repository->getType($type_id));
232 $this->tpl->setContent($form->getHTML());
233 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editCustomIcons()

ilStudyProgrammeTypeGUI::editCustomIcons ( )
protected

Definition at line 184 of file class.ilStudyProgrammeTypeGUI.php.

184 : void
185 {
187 $this,
188 $this->type_repository,
189 $this->ctrl,
190 $this->tpl,
191 $this->lng,
192 $this->user,
193 $this->web_dir
194 );
195 $form->fillForm($this->type_repository->getType(
196 $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int())
197 ));
198 $this->tpl->setContent($form->getHTML());
199 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeTypeGUI::executeCommand ( )

Definition at line 93 of file class.ilStudyProgrammeTypeGUI.php.

93 : void
94 {
95 $this->checkAccess();
96 $cmd = $this->ctrl->getCmd();
97 switch ($cmd) {
98 case '':
99 case 'view':
100 case 'listTypes':
101 $this->listTypes();
102 break;
103 case 'add':
104 $this->add();
105 break;
106 case 'edit':
107 $this->setSubTabsEdit('general');
108 $this->edit();
109 break;
110 case 'editCustomIcons':
111 $this->setSubTabsEdit('custom_icons');
112 $this->editCustomIcons();
113 break;
114 case 'editAMD':
115 $this->setSubTabsEdit('amd');
116 $this->editAMD();
117 break;
118 case 'updateAMD':
119 $this->setSubTabsEdit('amd');
120 $this->updateAMD();
121 break;
122 case 'updateCustomIcons':
123 $this->setSubTabsEdit('custom_icons');
124 $this->updateCustomIcons();
125 break;
126 case 'create':
127 $this->create();
128 break;
129 case 'update':
130 $this->setSubTabsEdit('general');
131 $this->update();
132 break;
133 case 'delete':
134 $this->delete();
135 break;
136 case 'cancel':
137 $this->ctrl->redirect($this->parent_gui);
138 break;
139 default:
140 throw new LogicException("Unknown command: $cmd");
141 }
142 }

References add(), checkAccess(), create(), ILIAS\Repository\ctrl(), edit(), editAMD(), editCustomIcons(), listTypes(), setSubTabsEdit(), update(), updateAMD(), and updateCustomIcons().

+ Here is the call graph for this function:

◆ getInstalledLanguages()

ilStudyProgrammeTypeGUI::getInstalledLanguages ( )
protected

Definition at line 447 of file class.ilStudyProgrammeTypeGUI.php.

447 : array
448 {
449 if (is_null($this->installed_languages)) {
450 $this->installed_languages = $this->lng->getInstalledLanguages();
451 }
452
454 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ listTypes()

ilStudyProgrammeTypeGUI::listTypes ( )
protected

Definition at line 253 of file class.ilStudyProgrammeTypeGUI.php.

253 : void
254 {
255 if ($this->access->checkAccess("write", "", $this->parent_gui->getObject()->getRefId())) {
256 $button = ilLinkButton::getInstance();
257 $button->setCaption('prg_subtype_add');
258 $button->setUrl($this->ctrl->getLinkTarget($this, 'add'));
259 $this->toolbar->addButtonInstance($button);
260 }
261 $table = new ilStudyProgrammeTypeTableGUI(
262 $this,
263 'listTypes',
264 $this->parent_gui->getObject()->getRefId(),
265 $this->type_repository,
266 $this->ctrl,
267 $this->tabs,
268 $this->access,
269 $this->lng,
270 $this->web_dir
271 );
272 $this->tpl->setContent($table->getHTML());
273 }

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), and ILIAS\Repository\toolbar().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParentGUI()

ilStudyProgrammeTypeGUI::setParentGUI (   $parent_gui)

Definition at line 144 of file class.ilStudyProgrammeTypeGUI.php.

144 : void
145 {
146 $this->parent_gui = $parent_gui;
147 }

References $parent_gui.

◆ setSubTabsEdit()

ilStudyProgrammeTypeGUI::setSubTabsEdit ( string  $active_tab_id)
protected

Definition at line 157 of file class.ilStudyProgrammeTypeGUI.php.

157 : void
158 {
159 $this->tabs->addSubTab(
160 'general',
161 $this->lng->txt('meta_general'),
162 $this->ctrl->getLinkTarget($this, 'edit')
163 );
164
165 if ($this->ilias->getSetting('custom_icons')) {
166 $this->tabs->addSubTab(
167 'custom_icons',
168 $this->lng->txt('icon_settings'),
169 $this->ctrl->getLinkTarget($this, 'editCustomIcons')
170 );
171 }
172
173 if (count($this->type_repository->getAllAMDRecordIds()) > 0) {
174 $this->tabs->addSubTab(
175 'amd',
176 $this->lng->txt('md_advanced'),
177 $this->ctrl->getLinkTarget($this, 'editAMD')
178 );
179 }
180
181 $this->tabs->activateSubTab($active_tab_id);
182 }

References ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilStudyProgrammeTypeGUI::update ( )
protected

Definition at line 327 of file class.ilStudyProgrammeTypeGUI.php.

327 : void
328 {
329 $type_id = $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int());
330 $type = $this->type_repository->getType($type_id);
331 $form = $this->buildForm(
332 $this->ctrl->getFormActionByClass(
333 __CLASS__,
334 'update'
335 ),
336 $this->lng->txt('prg_type_edit'),
337 $type
338 )->withRequest($this->request);
339
340 $result = $form->getData();
341 if (!is_null($result)) {
342 $this->updateTypeFromFormResult($type, $result);
343 $this->tpl->setOnScreenMessage("success", $this->lng->txt('msg_obj_modified'), true);
344 $this->ctrl->redirect($this, 'view');
345 } else {
346 $this->tpl->setOnScreenMessage("failure", $this->lng->txt("msg_fill_required"), true);
347 $this->tpl->setContent($this->renderer->render($form));
348 }
349 }

References $type, buildForm(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAMD()

ilStudyProgrammeTypeGUI::updateAMD ( )
protected

Definition at line 235 of file class.ilStudyProgrammeTypeGUI.php.

235 : void
236 {
238 $this,
239 $this->type_repository,
240 $this->ctrl,
241 $this->tpl,
242 $this->lng
243 );
244 $type_id = $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int());
245 if ($form->saveObject($this->type_repository->getType($type_id))) {
246 $this->tpl->setOnScreenMessage("success", $this->lng->txt('msg_obj_modified'), true);
247 $this->ctrl->redirect($this, 'editAMD');
248 } else {
249 $this->tpl->setContent($form->getHTML());
250 }
251 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCustomIcons()

ilStudyProgrammeTypeGUI::updateCustomIcons ( )
protected

Definition at line 201 of file class.ilStudyProgrammeTypeGUI.php.

201 : void
202 {
204 $this,
205 $this->type_repository,
206 $this->ctrl,
207 $this->tpl,
208 $this->lng,
209 $this->user,
210 $this->web_dir
211 );
212 $type_id = $this->request_wrapper->retrieve("type_id", $this->refinery_factory->kindlyTo()->int());
213 if ($form->saveObject($this->type_repository->getType($type_id))) {
214 $this->tpl->setOnScreenMessage("success", $this->lng->txt('msg_obj_modified'), true);
215 $this->ctrl->redirect($this, 'editCustomIcons');
216 } else {
217 $this->tpl->setContent($form->getHTML());
218 }
219 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccess ilStudyProgrammeTypeGUI::$access
protected

Definition at line 39 of file class.ilStudyProgrammeTypeGUI.php.

◆ $ctrl

ilCtrl ilStudyProgrammeTypeGUI::$ctrl

Definition at line 38 of file class.ilStudyProgrammeTypeGUI.php.

◆ $ilias

ILIAS ilStudyProgrammeTypeGUI::$ilias
protected

Definition at line 42 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $input_factory

Input Factory ilStudyProgrammeTypeGUI::$input_factory
protected

Definition at line 46 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $installed_languages

array ilStudyProgrammeTypeGUI::$installed_languages = null
protected

Definition at line 51 of file class.ilStudyProgrammeTypeGUI.php.

◆ $lng

ilLanguage ilStudyProgrammeTypeGUI::$lng
protected

Definition at line 41 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $parent_gui

ilStudyProgrammeTypeGUI::$parent_gui
protected

Definition at line 50 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by setParentGUI().

◆ $refinery_factory

Refinery Factory ilStudyProgrammeTypeGUI::$refinery_factory
protected

Definition at line 49 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $renderer

Renderer ilStudyProgrammeTypeGUI::$renderer
protected

Definition at line 47 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $request

Psr Http Message ServerRequestInterface ilStudyProgrammeTypeGUI::$request
protected

Definition at line 48 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $request_wrapper

RequestWrapper ilStudyProgrammeTypeGUI::$request_wrapper
protected

Definition at line 53 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $tabs

ilTabsGUI ilStudyProgrammeTypeGUI::$tabs
protected

Definition at line 43 of file class.ilStudyProgrammeTypeGUI.php.

◆ $toolbar

ilToolbarGUI ilStudyProgrammeTypeGUI::$toolbar
protected

Definition at line 40 of file class.ilStudyProgrammeTypeGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilStudyProgrammeTypeGUI::$tpl

Definition at line 37 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $type_repository

ilStudyProgrammeTypeRepository ilStudyProgrammeTypeGUI::$type_repository
protected

Definition at line 45 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $user

ilObjUser ilStudyProgrammeTypeGUI::$user
protected

Definition at line 44 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().

◆ $web_dir

Filesystem ilStudyProgrammeTypeGUI::$web_dir
protected

Definition at line 52 of file class.ilStudyProgrammeTypeGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: