ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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  }
redirection script todo: (a better solution should control the processing via a xml file) ...

Member Function Documentation

◆ add()

ilStudyProgrammeTypeGUI::add ( )
protected

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

References buildForm().

Referenced by executeCommand().

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)
+ 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.

References buildLanguagesForms(), buildModalHeading(), and ilStudyProgrammeType\getDefaultLang().

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

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  }
buildLanguagesForms(ilStudyProgrammeType $type=null)
buildModalHeading(string $title, string $default_lng)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLanguagesForms()

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

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

References $lng, $refinery_factory, ilStudyProgrammeType\getDescription(), getInstalledLanguages(), and ilStudyProgrammeType\getTitle().

Referenced by buildForm().

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,
440  );
441  }
442 
443  return $this->input_factory->field()->group($return);
444  }
getTitle(string $a_lang_code='')
Get the title of an StudyProgramme type.
getDescription(string $lang_code='')
Get the description of an StudyProgramme type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildModalHeading()

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

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

References getInstalledLanguages().

Referenced by buildForm().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccess()

ilStudyProgrammeTypeGUI::checkAccess ( )
protected

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

References ilUtil\sendFailure().

Referenced by executeCommand().

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.
+ 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.

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

Referenced by executeCommand().

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
$type
buildForm(string $submit_action, string $type_action, ilStudyProgrammeType $type=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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.

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

368  : void
369  {
370  $type = $this->type_repository->getType((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  }
$type
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ edit()

ilStudyProgrammeTypeGUI::edit ( )
protected

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

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

Referenced by executeCommand().

291  : void
292  {
293  $type = $this->type_repository->getType((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  }
$type
$_GET["client_id"]
buildForm(string $submit_action, string $type_action, ilStudyProgrammeType $type=null)
+ 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.

References $_GET.

Referenced by executeCommand().

237  : void
238  {
240  $this,
241  $this->type_repository
242  );
243  $form->fillForm($this->type_repository->getType((int) $_GET['type_id']));
244  $this->tpl->setContent($form->getHTML());
245  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ editCustomIcons()

ilStudyProgrammeTypeGUI::editCustomIcons ( )
protected

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

References $_GET.

Referenced by executeCommand().

213  : void
214  {
216  $this,
217  $this->type_repository
218  );
219  $form->fillForm($this->type_repository->getType((int) $_GET['type_id']));
220  $this->tpl->setContent($form->getHTML());
221  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ executeCommand()

ilStudyProgrammeTypeGUI::executeCommand ( )

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

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

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  }
+ Here is the call graph for this function:

◆ getInstalledLanguages()

ilStudyProgrammeTypeGUI::getInstalledLanguages ( )
protected

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

References $installed_languages.

Referenced by buildLanguagesForms(), and buildModalHeading().

446  : array
447  {
448  if (is_null($this->installed_languages)) {
449  $this->installed_languages = $this->lng->getInstalledLanguages();
450  }
451 
453  }
+ Here is the caller graph for this function:

◆ listTypes()

ilStudyProgrammeTypeGUI::listTypes ( )
protected

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

References $type_repository, and ilLinkButton\getInstance().

Referenced by executeCommand().

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(),
274  );
275  $this->tpl->setContent($table->getHTML());
276  }
+ 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.

References $parent_gui.

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

◆ setSubTabsEdit()

ilStudyProgrammeTypeGUI::setSubTabsEdit ( string  $active_tab_id)
protected

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

Referenced by executeCommand().

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->getAllAMDRecordIds()) > 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  }
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the caller graph for this function:

◆ update()

ilStudyProgrammeTypeGUI::update ( )
protected

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

References $_GET, $result, $type, buildForm(), ilUtil\sendFailure(), ilStudyProgrammeType\setDefaultLang(), ilStudyProgrammeType\setDescription(), and ilStudyProgrammeType\setTitle().

Referenced by executeCommand().

329  : void
330  {
331  $type = $this->type_repository->getType((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  }
$result
$type
$_GET["client_id"]
buildForm(string $submit_action, string $type_action, ilStudyProgrammeType $type=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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.

References $_GET.

Referenced by executeCommand().

247  : void
248  {
250  $this,
251  $this->type_repository
252  );
253  if ($form->saveObject($this->type_repository->getType((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  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ updateCustomIcons()

ilStudyProgrammeTypeGUI::updateCustomIcons ( )
protected

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

References $_GET.

Referenced by executeCommand().

223  : void
224  {
226  $this,
227  $this->type_repository
228  );
229  if ($form->saveObject($this->type_repository->getType((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  }
$_GET["client_id"]
+ 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.

Referenced by getInstalledLanguages().

◆ $lng

ilStudyProgrammeTypeGUI::$lng
protected

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

Referenced by __construct(), and buildLanguagesForms().

◆ $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(), and buildLanguagesForms().

◆ $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(), and listTypes().


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