ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilOrgUnitTypeGUI Class Reference

Class ilOrgUnitTypeGUI. More...

+ Inheritance diagram for ilOrgUnitTypeGUI:
+ Collaboration diagram for ilOrgUnitTypeGUI:

Public Member Functions

 __construct (private ilObjOrgUnitGUI $parent_gui)
 
 executeCommand ()
 
 getSingleTypeLinkTarget (string $action, ?int $type_id=null)
 

Protected Member Functions

 getIconForm (?string $section_title=null, ?string $current_identifier=null)
 
 getAvailableAMDRecords ()
 
 getCurrentOrgUnitType ()
 
 getRowIdFromQuery ()
 
 getAmdForm (string $action, array $available_records, ilOrgUnitType $type)
 
 getTable ()
 
 getTableDataRetrieval ()
 
 getEditForm (ilOrgUnitType $type)
 

Protected Attributes

ilLanguage $lng
 
ILIAS UI Component Link Factory $link_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Refinery $refinery
 
ServerRequestInterface $request
 
DataFactory $data_factory
 
URLBuilder $url_builder
 
array $query_namespace
 
URLBuilderToken $action_token
 
URLBuilderToken $row_id_token
 
ILIAS HTTP Wrapper ArrayBasedRequestWrapper $query
 

Private Member Functions

 checkAccess ()
 
 setSubTabsEdit (string $active_tab_id)
 
 editCustomIcons ()
 
 updateCustomIcons ()
 
 editAMD ()
 
 updateAMD ()
 
 listTypes ()
 Display all types in a table with actions to edit/delete. More...
 
 edit ()
 Display form to edit an existing OrgUnit type. More...
 
 update ()
 Update (save) type. More...
 
 delete ()
 Delete a type. More...
 

Private Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ilSetting $settings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitTypeGUI::__construct ( private ilObjOrgUnitGUI  $parent_gui)
Parameters
ilObjOrgUnitGUI$parent_gui

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

References $action_token, $DIC, $row_id_token, $url_builder, ILIAS\Repository\access(), checkAccess(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

Referenced by getTableDataRetrieval().

65  {
66  global $DIC;
67 
68  $this->tpl = $DIC->ui()->mainTemplate();
69  $this->ctrl = $DIC->ctrl();
70  $this->access = $DIC->access();
71  $this->toolbar = $DIC->toolbar();
72  $this->tabs = $DIC->tabs();
73  $this->lng = $DIC->language();
74  $this->settings = $DIC->settings();
75  $this->lng->loadLanguageModule('orgu');
76  $this->ctrl->saveParameter($this, 'type_id');
77  $this->lng->loadLanguageModule('meta');
78  $this->checkAccess();
79  $this->link_factory = $DIC['ui.factory']->link();
80  $this->ui_factory = $DIC['ui.factory'];
81  $this->ui_renderer = $DIC['ui.renderer'];
82  $this->refinery = $DIC['refinery'];
83  $this->request = $DIC->http()->request();
84  $this->lng->loadLanguageModule('meta');
85 
86  $this->data_factory = new DataFactory();
87  $here_uri = $this->data_factory->uri(
88  $this->request->getUri()->__toString()
89  );
90  $this->url_builder = new URLBuilder($here_uri);
91  $this->query_namespace = ['orgu', 'typeedit'];
93  $this->url_builder->acquireParameters($this->query_namespace, "action", "row_ids");
94  $this->url_builder = $url_builder;
95  $this->action_token = $action_token;
96  $this->row_id_token = $row_id_token;
97  $this->query = $DIC->http()->wrapper()->query();
98  }
URLBuilderToken $action_token
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:22
URLBuilder.
Definition: URLBuilder.php:40
URLBuilderToken $row_id_token
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ checkAccess()

ilOrgUnitTypeGUI::checkAccess ( )
private

Definition at line 163 of file class.ilOrgUnitTypeGUI.php.

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

Referenced by __construct().

163  : void
164  {
165  if (!$this->access->checkAccess("write", "", $this->parent_gui->object->getRefId())) {
166  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
167  $this->ctrl->redirect($this->parent_gui);
168  }
169  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilOrgUnitTypeGUI::delete ( )
private

Delete a type.

Definition at line 595 of file class.ilOrgUnitTypeGUI.php.

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

595  : void
596  {
597  $type = $this->getCurrentOrgUnitType();
598  try {
599  $type->delete();
600  $this->tpl->setOnScreenMessage('success', $this->lng->txt('orgu_type_msg_deleted'), true);
601  $this->ctrl->redirect($this);
602  } catch (ilException $e) {
603  $this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
604  $this->ctrl->redirect($this);
605  }
606  }
+ Here is the call graph for this function:

◆ edit()

ilOrgUnitTypeGUI::edit ( )
private

Display form to edit an existing OrgUnit type.

Definition at line 566 of file class.ilOrgUnitTypeGUI.php.

References getCurrentOrgUnitType(), and getEditForm().

Referenced by executeCommand().

566  : void
567  {
568  $type = $this->getCurrentOrgUnitType();
569  $form = $this->getEditForm($type);
570  $this->tpl->setContent($this->ui_renderer->render($form));
571  }
getEditForm(ilOrgUnitType $type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editAMD()

ilOrgUnitTypeGUI::editAMD ( )
private

Definition at line 355 of file class.ilOrgUnitTypeGUI.php.

References getAmdForm(), getAvailableAMDRecords(), getCurrentOrgUnitType(), and getSingleTypeLinkTarget().

Referenced by executeCommand().

355  : void
356  {
357  $form = $this->getAmdForm(
358  $this->getSingleTypeLinkTarget('updateAMD'),
359  $this->getAvailableAMDRecords(),
360  $this->getCurrentOrgUnitType()
361  );
362  $this->tpl->setContent(
363  $this->ui_renderer->render($form)
364  );
365  }
getAmdForm(string $action, array $available_records, ilOrgUnitType $type)
getSingleTypeLinkTarget(string $action, ?int $type_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editCustomIcons()

ilOrgUnitTypeGUI::editCustomIcons ( )
private

Definition at line 238 of file class.ilOrgUnitTypeGUI.php.

References getCurrentOrgUnitType(), and getIconForm().

Referenced by executeCommand().

238  : void
239  {
240  $type = $this->getCurrentOrgUnitType();
241  $form = $this->getIconForm(
242  $type->getTitle() . ': ',
243  $type->getIconIdentifier()
244  );
245  $this->tpl->setContent($this->ui_renderer->render($form));
246  }
getIconForm(?string $section_title=null, ?string $current_identifier=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilOrgUnitTypeGUI::executeCommand ( )

Definition at line 100 of file class.ilOrgUnitTypeGUI.php.

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

100  : void
101  {
102  $cmd = $this->ctrl->getCmd();
103 
104  if ($this->query->has($this->action_token->getName())) {
105  $cmd = $this->query->retrieve(
106  $this->action_token->getName(),
107  $this->refinery->to()->string()
108  );
109  }
110 
111  $next_class = $this->ctrl->getNextClass($this);
112  switch ($next_class) {
113  case strtolower(ilOrgUnitTypeUploadHandlerGUI::class):
114  $this->ctrl->forwardCommand(
116  );
117  break;
118 
119  case '':
120  switch ($cmd) {
121  case '':
122  case 'listTypes':
123  $this->listTypes();
124  break;
125  case 'add':
126  $this->edit();
127  break;
128  case 'edit':
129  $this->setSubTabsEdit('general');
130  $this->edit();
131  break;
132  case 'editCustomIcons':
133  $this->setSubTabsEdit('custom_icons');
134  $this->editCustomIcons();
135  break;
136  case 'editAMD':
137  $this->setSubTabsEdit('amd');
138  $this->editAMD();
139  break;
140  case 'updateAMD':
141  $this->setSubTabsEdit('amd');
142  $this->updateAMD();
143  break;
144  case 'updateCustomIcons':
145  $this->setSubTabsEdit('custom_icons');
146  $this->updateCustomIcons();
147  break;
148  case 'create':
149  $this->create();
150  break;
151  case 'update':
152  $this->setSubTabsEdit('general');
153  $this->update();
154  break;
155  case 'delete':
156  $this->delete();
157  break;
158  }
159  break;
160  }
161  }
update()
Update (save) type.
edit()
Display form to edit an existing OrgUnit type.
setSubTabsEdit(string $active_tab_id)
listTypes()
Display all types in a table with actions to edit/delete.
ilOrgUnitTypeUploadHandlerGUI: ilOrgUnitTypeGUI
+ Here is the call graph for this function:

◆ getAmdForm()

ilOrgUnitTypeGUI::getAmdForm ( string  $action,
array  $available_records,
ilOrgUnitType  $type 
)
protected

Definition at line 308 of file class.ilOrgUnitTypeGUI.php.

References ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by editAMD(), mock_ilOrgUnitTypeGUI\mockGetAmdForm(), and updateAMD().

312  : StandardForm {
313  $options = [];
314  foreach ($available_records as $record) {
315  $options[$record->getRecordId()] = $record->getTitle();
316  }
317  $selected_ids = $type->getAssignedAdvancedMDRecordIds();
318 
319  $trafo = $this->refinery->custom()->transformation(
320  fn($v) => is_array($v) ? array_shift($v) : []
321  );
322 
323  $field = $this->ui_factory->input()->field()->multiselect(
324  $this->lng->txt('orgu_type_available_amd_sets'),
325  $options
326  )
327  ->withValue($selected_ids);
328 
329  $section = $this->ui_factory->input()->field()->section(
330  [$field],
331  $this->lng->txt('orgu_type_assign_amd_sets')
332  )
334 
335  $store = $this->refinery->custom()->transformation(
336  function (?array $record_ids) use ($type, $selected_ids) {
337  $record_ids = $record_ids ?? [];
338  $record_ids_removed = array_diff($selected_ids, $record_ids);
339  $record_ids_added = array_diff($record_ids, $selected_ids);
340  foreach ($record_ids_added as $record_id) {
341  $type->assignAdvancedMDRecord((int) $record_id);
342  }
343  foreach ($record_ids_removed as $record_id) {
344  $type->deassignAdvancedMdRecord((int) $record_id);
345  }
346  return true;
347  }
348  );
349 
350  return $this->ui_factory->input()->container()->form()->standard($action, [$section])
351  ->withAdditionalTransformation($trafo)
352  ->withAdditionalTransformation($store);
353  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableAMDRecords()

ilOrgUnitTypeGUI::getAvailableAMDRecords ( )
protected
Returns
ilAdvancedMDRecord[]

Definition at line 277 of file class.ilOrgUnitTypeGUI.php.

References ilOrgUnitType\getAvailableAdvancedMDRecords().

Referenced by editAMD(), and updateAMD().

277  : array
278  {
280  }
static getAvailableAdvancedMDRecords()
Get all available AdvancedMDRecord objects for OrgUnits/Types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentOrgUnitType()

ilOrgUnitTypeGUI::getCurrentOrgUnitType ( )
protected

Definition at line 282 of file class.ilOrgUnitTypeGUI.php.

References getRowIdFromQuery().

Referenced by delete(), edit(), editAMD(), editCustomIcons(), update(), updateAMD(), and updateCustomIcons().

282  : ilOrgUnitType
283  {
284  $type_id = $this->getRowIdFromQuery();
285  return new ilOrgUnitType($type_id);
286  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEditForm()

ilOrgUnitTypeGUI::getEditForm ( ilOrgUnitType  $type)
protected

Definition at line 498 of file class.ilOrgUnitTypeGUI.php.

References Vendor\Package\$e, Vendor\Package\$f, ilOrgUnitType\getDefaultLang(), ilOrgUnitType\getDescription(), ilOrgUnitType\getId(), getSingleTypeLinkTarget(), ilOrgUnitType\getTitle(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilOrgUnitType\setDescription(), ilOrgUnitType\setTitle(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by edit(), and update().

498  : StandardForm
499  {
500  $title = $this->lng->txt('orgu_type_add');
501  $action = $this->getSingleTypeLinkTarget('update');
502  if ($type->getId()) {
503  $title = $this->lng->txt('orgu_type_edit');
504  }
505 
506  $f = $this->ui_factory->input()->field();
507  $sections = [];
508  $options = [];
509  foreach ($this->lng->getInstalledLanguages() as $lang_code) {
510  $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
511  $sections[] = $f->section(
512  [
513  $f->hidden()->withValue($lang_code),
514  $f->text($this->lng->txt('title'))
515  ->withValue($type->getTitle($lang_code)),
516  $f->textarea($this->lng->txt('description'))
517  ->withValue($type->getDescription($lang_code) ?? ''),
518  ],
519  $options[$lang_code]
520  );
521  }
522 
523  array_unshift(
524  $sections,
525  $f->section(
526  [$f->select($this->lng->txt('default_language'), $options)
527  ->withRequired(true)
528  ->withValue($type->getDefaultLang())
529  ],
530  $title
531  )
532  ->withAdditionalTransformation(
533  $this->refinery->custom()->transformation(
534  fn($v) => array_shift($v)
535  )
536  )
537  );
538 
539  $form = $this->ui_factory->input()->container()->form()
540  ->standard($action, $sections)
541  ->withAdditionalTransformation(
542  $this->refinery->custom()->transformation(
543  function ($v) use ($type) { //: ilOrgUnitType
544  try {
545 
546  $type->setDefaultLang(array_shift($v));
547  foreach ($v as $lang_entry) {
548  list($lang_code, $title, $description) = $lang_entry;
549  $type->setTitle($title, $lang_code);
550  $type->setDescription($description, $lang_code);
551  }
552  return $type;
553  } catch (ilOrgUnitTypePluginException $e) {
554  return $e->getMessage();
555  }
556  }
557  )
558  );
559 
560  return $form;
561  }
getTitle(string $a_lang_code='')
Get the title of an OrgUnit type.
setDescription(string $a_description, string $a_lang_code='')
Set description of OrgUnit type.
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
setTitle(string $a_title, string $a_lang_code='')
Set title of OrgUnit type.
getSingleTypeLinkTarget(string $action, ?int $type_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDescription(string $a_lang_code='')
Get the description of an OrgUnit type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIconForm()

ilOrgUnitTypeGUI::getIconForm ( ?string  $section_title = null,
?string  $current_identifier = null 
)
protected

Definition at line 200 of file class.ilOrgUnitTypeGUI.php.

References getSingleTypeLinkTarget(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by editCustomIcons(), and updateCustomIcons().

203  : StandardForm {
204  $handler_gui = new ilOrgUnitTypeUploadHandlerGUI();
205 
206  $input = $this->ui_factory->input()->field()->file(
207  $handler_gui,
208  $this->lng->txt('icon'),
209  $this->lng->txt('file_allowed_suffixes') . ' .svg'
210  );
211 
212  if ($current_identifier) {
213  $input = $input->withValue([$current_identifier]);
214  }
215 
216  $section = $this->ui_factory->input()->field()->section(
217  ['iconfile' => $input],
218  $section_title . $this->lng->txt('orgu_type_custom_icon'),
219  $this->lng->txt('orgu_type_custom_icon_info')
220  );
221 
222  $form_action = $this->getSingleTypeLinkTarget('updateCustomIcons');
223  $form = $this->ui_factory->input()->container()->form()->standard(
224  $form_action,
225  [$section]
226  );
227 
228  $form = $form->withAdditionalTransformation(
229  $this->refinery->custom()->transformation(
230  function ($values) {
231  return array_shift($values)['iconfile'];
232  }
233  )
234  );
235  return $form;
236  }
ilOrgUnitTypeUploadHandlerGUI: ilOrgUnitTypeGUI
getSingleTypeLinkTarget(string $action, ?int $type_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRowIdFromQuery()

ilOrgUnitTypeGUI::getRowIdFromQuery ( )
protected

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

References ILIAS\Repository\refinery().

Referenced by getCurrentOrgUnitType(), getSingleTypeLinkTarget(), and setSubTabsEdit().

288  : int
289  {
290  if ($this->query->has($this->row_id_token->getName())) {
291  return $this->query->retrieve(
292  $this->row_id_token->getName(),
293  $this->refinery->custom()->transformation(fn($v) => (int) array_shift($v))
294  );
295  }
296  return 0;
297  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSingleTypeLinkTarget()

ilOrgUnitTypeGUI::getSingleTypeLinkTarget ( string  $action,
?int  $type_id = null 
)

Definition at line 299 of file class.ilOrgUnitTypeGUI.php.

References getRowIdFromQuery().

Referenced by editAMD(), getEditForm(), getIconForm(), setSubTabsEdit(), and updateAMD().

299  : string
300  {
301  $target_id = $type_id ? [$type_id] : [$this->getRowIdFromQuery()];
302  return $this->url_builder
303  ->withParameter($this->row_id_token, $target_id)
304  ->withParameter($this->action_token, $action)
305  ->buildURI()->__toString();
306  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTable()

ilOrgUnitTypeGUI::getTable ( )
protected

Definition at line 404 of file class.ilOrgUnitTypeGUI.php.

References $row_id_token, getTableDataRetrieval(), and ILIAS\Repository\lng().

Referenced by listTypes().

404  : Table\Data
405  {
406  $columns = [
407  'title' => $this->ui_factory->table()->column()->text($this->lng->txt("title")),
408  'description' => $this->ui_factory->table()->column()->text($this->lng->txt("description")),
409  'default_language' => $this->ui_factory->table()->column()->status($this->lng->txt("default_language")),
410  'icon' => $this->ui_factory->table()->column()->text($this->lng->txt("icon"))
411  ->withIsSortable(false),
412  ];
413 
414  $actions = [
415  'edit' => $this->ui_factory->table()->action()->single(
416  $this->lng->txt('edit'),
417  $this->url_builder->withParameter($this->action_token, "edit"),
419  ),
420  'delete' => $this->ui_factory->table()->action()->single(
421  $this->lng->txt('delete'),
422  $this->url_builder->withParameter($this->action_token, "delete"),
424  ),
425  ];
426 
427  return $this->ui_factory->table()
428  ->data($this->getTableDataRetrieval(), '', $columns)
429  ->withId('orgu_types')
430  ->withActions($actions);
431  }
URLBuilderToken $row_id_token
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableDataRetrieval()

ilOrgUnitTypeGUI::getTableDataRetrieval ( )
protected

Definition at line 433 of file class.ilOrgUnitTypeGUI.php.

References Vendor\Package\$a, Vendor\Package\$b, $data, ILIAS\UI\Implementation\Component\Table\$range, $ui_factory, $ui_renderer, __construct(), ilOrgUnitType\getAllTypes(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ILIAS\Data\Order\join().

Referenced by getTable().

433  : Table\DataRetrieval
434  {
435  return new class (
439  ) implements Table\DataRetrieval {
440  public function __construct(
441  protected array $data,
442  protected UIFactory $ui_factory,
443  protected UIRenderer $ui_renderer
444  ) {
445  }
446 
447  public function getTotalRowCount(
448  ?array $filter_data,
449  ?array $additional_parameters
450  ): ?int {
451  return count($this->data);
452  }
453 
454  public function getRows(
455  Table\DataRowBuilder $row_builder,
456  array $visible_column_ids,
457  Range $range,
458  Order $order,
459  ?array $filter_data,
460  ?array $additional_parameters
461  ): \Generator {
462  $records = array_map(
463  fn($type) => [
464  'id' => $type->getId(),
465  'title' => $type->getTitle(),
466  'description' => $type->getDescription(),
467  'default_language' => $type->getDefaultLang(),
468  'icon' => $type->getIconIdentifier() ?
469  $this->renderIcon($type->getIconSrc()) : '',
470  ],
471  $this->data
472  );
473  if ($order) {
474  list($order_field, $order_direction) = $order->join([], fn($ret, $key, $value) => [$key, $value]);
475  usort($records, fn($a, $b) => $a[$order_field] <=> $b[$order_field]);
476  if ($order_direction === 'DESC') {
477  $records = array_reverse($records);
478  }
479  }
480  if ($range) {
481  $records = array_slice($records, $range->getStart(), $range->getLength());
482  }
483  foreach ($records as $record) {
484  $row_id = (string) $record['id'];
485  yield $row_builder->buildDataRow($row_id, $record);
486  }
487  }
488 
489  protected function renderIcon(string $src): string
490  {
491  return $this->ui_renderer->render(
492  $this->ui_factory->symbol()->icon()->custom($src, '')
493  );
494  }
495  };
496  }
__construct(private ilObjOrgUnitGUI $parent_gui)
join($init, callable $fn)
Definition: Order.php:75
static getAllTypes()
Get array of all instances of ilOrgUnitType objects.
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listTypes()

ilOrgUnitTypeGUI::listTypes ( )
private

Display all types in a table with actions to edit/delete.

Definition at line 388 of file class.ilOrgUnitTypeGUI.php.

References $url, ILIAS\Repository\ctrl(), getTable(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by executeCommand().

388  : void
389  {
390  $url = $this->ctrl->getLinkTarget($this, 'add');
391  $link = $this->link_factory->standard(
392  $this->lng->txt('orgu_type_add'),
393  $url
394  );
395  $this->toolbar->addComponent($link);
396 
397  $table = $this->getTable()
398  ->withRequest($this->request);
399  $this->tpl->setContent(
400  $this->ui_renderer->render($table)
401  );
402  }
$url
Definition: shib_logout.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabsEdit()

ilOrgUnitTypeGUI::setSubTabsEdit ( string  $active_tab_id)
private

Definition at line 171 of file class.ilOrgUnitTypeGUI.php.

References getRowIdFromQuery(), getSingleTypeLinkTarget(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), and ILIAS\UI\URLBuilder\withParameter().

Referenced by executeCommand().

171  : void
172  {
173 
174  $url_builder = $this->url_builder
175  ->withParameter($this->row_id_token, [$this->getRowIdFromQuery()]);
176 
177  $this->tabs->addSubTab(
178  'general',
179  $this->lng->txt('meta_general'),
180  $this->getSingleTypeLinkTarget('edit')
181  );
182 
183  if ($this->settings->get('custom_icons')) {
184  $this->tabs->addSubTab(
185  'custom_icons',
186  $this->lng->txt('icon_settings'),
187  $this->getSingleTypeLinkTarget('editCustomIcons')
188  );
189  }
190  if (count(ilOrgUnitType::getAvailableAdvancedMDRecordIds())) {
191  $this->tabs->addSubTab(
192  'amd',
193  $this->lng->txt('md_advanced'),
194  $this->getSingleTypeLinkTarget('editAMD')
195  );
196  }
197  $this->tabs->setSubTabActive($active_tab_id);
198  }
getSingleTypeLinkTarget(string $action, ?int $type_id=null)
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter&#39;s value if the supplied token is valid.
Definition: URLBuilder.php:166
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilOrgUnitTypeGUI::update ( )
private

Update (save) type.

Definition at line 576 of file class.ilOrgUnitTypeGUI.php.

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

Referenced by executeCommand().

576  : void
577  {
578  $form = $this->getEditForm($this->getCurrentOrgUnitType())
579  ->withRequest($this->request);
580 
581  $type = $form->getData();
582  if ($type && $type instanceof ilOrgUnitType) {
583  $type->save();
584  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
585  $this->ctrl->redirect($this);
586  } else {
587  $this->tpl->setOnScreenMessage('failure', $type);
588  $this->tpl->setContent($this->ui_renderer->render($form));
589  }
590  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getEditForm(ilOrgUnitType $type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateAMD()

ilOrgUnitTypeGUI::updateAMD ( )
private

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

References ILIAS\Repository\ctrl(), getAmdForm(), getAvailableAMDRecords(), getCurrentOrgUnitType(), getSingleTypeLinkTarget(), and ILIAS\Repository\lng().

Referenced by executeCommand().

367  : void
368  {
369  $form = $this->getAmdForm(
370  $this->getSingleTypeLinkTarget('updateAMD'),
371  $this->getAvailableAMDRecords(),
372  $this->getCurrentOrgUnitType()
373  )
374  ->withRequest($this->request);
375 
376  if ($form->getData()) {
377  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
378  $this->ctrl->redirect($this);
379  } else {
380  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('error'), true);
381  $this->tpl->setContent($this->ui_renderer->render($form));
382  }
383  }
getAmdForm(string $action, array $available_records, ilOrgUnitType $type)
getSingleTypeLinkTarget(string $action, ?int $type_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCustomIcons()

ilOrgUnitTypeGUI::updateCustomIcons ( )
private

Definition at line 248 of file class.ilOrgUnitTypeGUI.php.

References $data, ILIAS\Repository\ctrl(), getCurrentOrgUnitType(), getIconForm(), and ILIAS\Repository\lng().

Referenced by executeCommand().

248  : void
249  {
250  $type = $this->getCurrentOrgUnitType();
251  $form = $this->getIconForm(
252  $type->getTitle() . ': ',
253  $type->getIconIdentifier()
254  )
255  ->withRequest($this->request);
256 
257  $data = $form->getData();
258 
259  if (!is_null($data)) {
260  $new_icon_id = current($data) ? current($data) : '';
261  $identifier = $type->getIconIdentifier();
262  if ($identifier && $new_icon_id == '') {
263  $type->removeIconFromIrss($identifier);
264  }
265  $type = $type->withIconIdentifier($new_icon_id);
266  $type->save();
267  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
268  $this->ctrl->redirect($this);
269  } else {
270  $this->tpl->setContent($this->ui_renderer->render($form));
271  }
272  }
getIconForm(?string $section_title=null, ?string $current_identifier=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilOrgUnitTypeGUI::$access
private

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

◆ $action_token

URLBuilderToken ilOrgUnitTypeGUI::$action_token
protected

Definition at line 56 of file class.ilOrgUnitTypeGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilOrgUnitTypeGUI::$ctrl
private

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

◆ $data_factory

DataFactory ilOrgUnitTypeGUI::$data_factory
protected

◆ $link_factory

ILIAS UI Component Link Factory ilOrgUnitTypeGUI::$link_factory
protected

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

◆ $lng

ilLanguage ilOrgUnitTypeGUI::$lng
protected

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

Referenced by mock_ilOrgUnitTypeGUI\__construct().

◆ $query

ILIAS HTTP Wrapper ArrayBasedRequestWrapper ilOrgUnitTypeGUI::$query
protected

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

◆ $query_namespace

array ilOrgUnitTypeGUI::$query_namespace
protected

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

◆ $refinery

Refinery ilOrgUnitTypeGUI::$refinery
protected

◆ $request

ServerRequestInterface ilOrgUnitTypeGUI::$request
protected

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

◆ $row_id_token

URLBuilderToken ilOrgUnitTypeGUI::$row_id_token
protected

Definition at line 57 of file class.ilOrgUnitTypeGUI.php.

Referenced by __construct(), and getTable().

◆ $settings

ilSetting ilOrgUnitTypeGUI::$settings
private

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

◆ $tabs

ilTabsGUI ilOrgUnitTypeGUI::$tabs
private

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

◆ $toolbar

ilToolbarGUI ilOrgUnitTypeGUI::$toolbar
private

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

◆ $tpl

ilGlobalTemplateInterface ilOrgUnitTypeGUI::$tpl
private

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

◆ $ui_factory

UIFactory ilOrgUnitTypeGUI::$ui_factory
protected

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

Referenced by getTableDataRetrieval().

◆ $ui_renderer

UIRenderer ilOrgUnitTypeGUI::$ui_renderer
protected

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

Referenced by getTableDataRetrieval().

◆ $url_builder

URLBuilder ilOrgUnitTypeGUI::$url_builder
protected

Definition at line 54 of file class.ilOrgUnitTypeGUI.php.

Referenced by __construct().


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