ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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, ilStudyProgrammeTypeRepository $type_repository, Input\Factory $input_factory, Renderer $renderer, ServerRequest $request, Refinery\Factory $refinery_factory)
 
 executeCommand ()
 
 setParentGUI ($parent_gui)
 

Data Fields

 $tpl
 
 $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

 $access
 
 $toolbar
 
 $lng
 
 $ilias
 
 $tabs
 
 $type_repository
 
 $input_factory
 
 $renderer
 
 $request
 
 $refinery_factory
 
 $parent_gui
 
 $installed_languages
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeTypeGUI::__construct ( ilGlobalTemplateInterface  $tpl,
ilCtrl  $ilCtrl,
ilAccess  $ilAccess,
ilToolbarGUI  $ilToolbar,
ilLanguage  $lng,
ILIAS  $ilias,
ilTabsGUI  $ilTabs,
ilStudyProgrammeTypeRepository  $type_repository,
Input\Factory  $input_factory,
Renderer  $renderer,
ServerRequest  $request,
Refinery\Factory  $refinery_factory 
)

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

103 {
104 $this->tpl = $tpl;
105 $this->ctrl = $ilCtrl;
106 $this->access = $ilAccess;
107 $this->toolbar = $ilToolbar;
108 $this->tabs = $ilTabs;
109 $this->lng = $lng;
110 $this->ilias = $ilias;
111 $this->type_repository = $type_repository;
112 $this->input_factory = $input_factory;
113 $this->renderer = $renderer;
114 $this->request = $request;
115 $this->refinery_factory = $refinery_factory;
116
117 $this->lng->loadLanguageModule('prg');
118 $this->ctrl->saveParameter($this, 'type_id');
119 $this->lng->loadLanguageModule('meta');
120 }
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)

References $ilCtrl, $ilias, $input_factory, $lng, $refinery_factory, $renderer, $request, $tpl, and $type_repository.

Member Function Documentation

◆ add()

ilStudyProgrammeTypeGUI::add ( )
protected

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

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

References buildForm().

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 }
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 425 of file class.ilStudyProgrammeTypeGUI.php.

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

References $type.

◆ buildModalHeading()

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

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

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

◆ checkAccess()

ilStudyProgrammeTypeGUI::checkAccess ( )
protected

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

178 : void
179 {
180 if (!$this->access->checkAccess("read", "", $this->parent_gui->object->getRefId())) {
181 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
182 $this->ctrl->redirect($this->parent_gui);
183 }
184 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References ilUtil\sendFailure().

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 307 of file class.ilStudyProgrammeTypeGUI.php.

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

References $result, $type, buildForm(), and ilUtil\sendFailure().

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 368 of file class.ilStudyProgrammeTypeGUI.php.

368 : void
369 {
370 $type = $this->type_repository->readType((int) $_GET['type_id']);
371 try {
372 $this->type_repository->deleteType($type);
373 ilUtil::sendSuccess($this->lng->txt('prg_type_msg_deleted'), true);
374 $this->ctrl->redirect($this);
375 } catch (Exception $e) {
376 ilUtil::sendFailure($e->getMessage(), true);
377 $this->ctrl->redirect($this);
378 }
379 }
$_GET["client_id"]

References $_GET, Vendor\Package\$e, $type, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ edit()

ilStudyProgrammeTypeGUI::edit ( )
protected

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

291 : void
292 {
293 $type = $this->type_repository->readType((int) $_GET['type_id']);
294
295 $form = $this->buildForm(
296 $this->ctrl->getFormActionByClass(
297 ilStudyProgrammeTypeGUI::class,
298 'update'
299 ),
300 $this->lng->txt('prg_type_edit'),
301 $type
302 );
303
304 $this->tpl->setContent($this->renderer->render($form));
305 }

References $_GET, $type, and buildForm().

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 237 of file class.ilStudyProgrammeTypeGUI.php.

237 : void
238 {
240 $this,
241 $this->type_repository
242 );
243 $form->fillForm($this->type_repository->readType((int) $_GET['type_id']));
244 $this->tpl->setContent($form->getHTML());
245 }

References $_GET.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ editCustomIcons()

ilStudyProgrammeTypeGUI::editCustomIcons ( )
protected

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

213 : void
214 {
216 $this,
217 $this->type_repository
218 );
219 $form->fillForm($this->type_repository->readType((int) $_GET['type_id']));
220 $this->tpl->setContent($form->getHTML());
221 }

References $_GET.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeTypeGUI::executeCommand ( )

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

122 : void
123 {
124 $this->checkAccess();
125 $cmd = $this->ctrl->getCmd();
126 switch ($cmd) {
127 case '':
128 case 'view':
129 case 'listTypes':
130 $this->listTypes();
131 break;
132 case 'add':
133 $this->add();
134 break;
135 case 'edit':
136 $this->setSubTabsEdit('general');
137 $this->edit();
138 break;
139 case 'editCustomIcons':
140 $this->setSubTabsEdit('custom_icons');
141 $this->editCustomIcons();
142 break;
143 case 'editAMD':
144 $this->setSubTabsEdit('amd');
145 $this->editAMD();
146 break;
147 case 'updateAMD':
148 $this->setSubTabsEdit('amd');
149 $this->updateAMD();
150 break;
151 case 'updateCustomIcons':
152 $this->setSubTabsEdit('custom_icons');
153 $this->updateCustomIcons();
154 break;
155 case 'create':
156 $this->create();
157 break;
158 case 'update':
159 $this->setSubTabsEdit('general');
160 $this->update();
161 break;
162 case 'delete':
163 $this->delete();
164 break;
165 case 'cancel':
166 $this->ctrl->redirect($this->parent_gui);
167 break;
168 default:
169 throw new LogicException("Unknown command: $cmd");
170 }
171 }

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

+ Here is the call graph for this function:

◆ getInstalledLanguages()

ilStudyProgrammeTypeGUI::getInstalledLanguages ( )
protected

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

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

◆ listTypes()

ilStudyProgrammeTypeGUI::listTypes ( )
protected

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

261 : void
262 {
263 if ($this->access->checkAccess("write", "", $this->parent_gui->object->getRefId())) {
264 $button = ilLinkButton::getInstance();
265 $button->setCaption('prg_subtype_add');
266 $button->setUrl($this->ctrl->getLinkTarget($this, 'add'));
267 $this->toolbar->addButtonInstance($button);
268 }
269 $table = new ilStudyProgrammeTypeTableGUI(
270 $this,
271 'listTypes',
272 $this->parent_gui->object->getRefId(),
273 $this->type_repository
274 );
275 $this->tpl->setContent($table->getHTML());
276 }
static getInstance()
Factory.

References ilLinkButton\getInstance().

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 173 of file class.ilStudyProgrammeTypeGUI.php.

173 : void
174 {
175 $this->parent_gui = $parent_gui;
176 }

References $parent_gui.

◆ setSubTabsEdit()

ilStudyProgrammeTypeGUI::setSubTabsEdit ( string  $active_tab_id)
protected

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

186 : void
187 {
188 $this->tabs->addSubTab(
189 'general',
190 $this->lng->txt('meta_general'),
191 $this->ctrl->getLinkTarget($this, 'edit')
192 );
193
194 if ($this->ilias->getSetting('custom_icons')) {
195 $this->tabs->addSubTab(
196 'custom_icons',
197 $this->lng->txt('icon_settings'),
198 $this->ctrl->getLinkTarget($this, 'editCustomIcons')
199 );
200 }
201
202 if (count($this->type_repository->readAllAMDRecordIds()) > 0) {
203 $this->tabs->addSubTab(
204 'amd',
205 $this->lng->txt('md_advanced'),
206 $this->ctrl->getLinkTarget($this, 'editAMD')
207 );
208 }
209
210 $this->tabs->setSubTabActive($active_tab_id);
211 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ update()

ilStudyProgrammeTypeGUI::update ( )
protected

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

329 : void
330 {
331 $type = $this->type_repository->readType((int)$_GET['type_id']);
332 $form = $this->buildForm(
333 $this->ctrl->getFormActionByClass(
334 ilStudyProgrammeTypeGUI::class,
335 'update'
336 ),
337 $this->lng->txt('prg_type_edit'),
338 $type
339 )->withRequest($this->request);
340
341 $result = $form->getData();
342 if (!is_null($result)) {
343 $this->updateTypeFromFormResult($type, $result);
344 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
345 $this->ctrl->redirect($this, 'view');
346 } else {
347 ilUtil::sendFailure($this->lng->txt("msg_fill_required"), true);
348 $this->tpl->setContent($this->renderer->render($form));
349 }
350 }

References $_GET, $result, $type, buildForm(), and ilUtil\sendFailure().

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 247 of file class.ilStudyProgrammeTypeGUI.php.

247 : void
248 {
250 $this,
251 $this->type_repository
252 );
253 if ($form->saveObject($this->type_repository->readType((int) $_GET['type_id']))) {
254 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
255 $this->ctrl->redirect($this, 'editAMD');
256 } else {
257 $this->tpl->setContent($form->getHTML());
258 }
259 }

References $_GET.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ updateCustomIcons()

ilStudyProgrammeTypeGUI::updateCustomIcons ( )
protected

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

223 : void
224 {
226 $this,
227 $this->type_repository
228 );
229 if ($form->saveObject($this->type_repository->readType((int) $_GET['type_id']))) {
230 ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
231 $this->ctrl->redirect($this, 'editCustomIcons');
232 } else {
233 $this->tpl->setContent($form->getHTML());
234 }
235 }

References $_GET.

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilStudyProgrammeTypeGUI::$access
protected

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

◆ $ctrl

ilStudyProgrammeTypeGUI::$ctrl

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

◆ $ilias

ilStudyProgrammeTypeGUI::$ilias
protected

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

Referenced by __construct().

◆ $input_factory

ilStudyProgrammeTypeGUI::$input_factory
protected

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

Referenced by __construct().

◆ $installed_languages

ilStudyProgrammeTypeGUI::$installed_languages
protected

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

◆ $lng

ilStudyProgrammeTypeGUI::$lng
protected

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

Referenced by __construct().

◆ $parent_gui

ilStudyProgrammeTypeGUI::$parent_gui
protected
Parameters
ilObjStudyProgrammeGUI$parent_gui

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

Referenced by setParentGUI().

◆ $refinery_factory

ilStudyProgrammeTypeGUI::$refinery_factory
protected

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

Referenced by __construct().

◆ $renderer

ilStudyProgrammeTypeGUI::$renderer
protected

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

Referenced by __construct().

◆ $request

ilStudyProgrammeTypeGUI::$request
protected

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

Referenced by __construct().

◆ $tabs

ilStudyProgrammeTypeGUI::$tabs
protected

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

◆ $toolbar

ilStudyProgrammeTypeGUI::$toolbar
protected

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

◆ $tpl

ilStudyProgrammeTypeGUI::$tpl

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

Referenced by __construct().

◆ $type_repository

ilStudyProgrammeTypeGUI::$type_repository
protected

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

Referenced by __construct().


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