ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilDclSwitcher Class Reference
+ Collaboration diagram for ilDclSwitcher:

Public Member Functions

 __construct (ilToolbarGUI $toolbar, \ILIAS\UI\Factory $ui_factory, ilCtrl $ctrl, ilLanguage $lng)
 
 addTableSwitcherToToolbar (array $tables, string $target_class, string $target_cmd, int $table_id=0)
 
 addViewSwitcherToToolbar (array $views, int $table_id, string $target_class, string $target_cmd, int $tableview_id=0)
 

Protected Member Functions

 addSwitcherToToolbar (array $links, string $label)
 

Protected Attributes

ilToolbarGUI $toolbar
 
ILIAS UI Factory $ui_factory
 
ilLanguage $lng
 
ilCtrl $ctrl
 

Detailed Description

Definition at line 21 of file class.ilDclSwitcher.php.

Constructor & Destructor Documentation

◆ __construct()

ilDclSwitcher::__construct ( ilToolbarGUI  $toolbar,
\ILIAS\UI\Factory  $ui_factory,
ilCtrl  $ctrl,
ilLanguage  $lng 
)

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

29 {
30 $this->toolbar = $toolbar;
31 $this->ui_factory = $ui_factory;
32 $this->ctrl = $ctrl;
33 $this->lng = $lng;
34 }
ILIAS UI Factory $ui_factory
ilToolbarGUI $toolbar

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addSwitcherToToolbar()

ilDclSwitcher::addSwitcherToToolbar ( array  $links,
string  $label 
)
protected
Parameters
\ILIAS\UI\Component\Link\Standard[]$links
string$label
Returns
void

Definition at line 86 of file class.ilDclSwitcher.php.

86 : void
87 {
88 if (count($links) > 1) {
89 $this->toolbar->addComponent(
90 $this->ui_factory->dropdown()->standard($links)->withLabel($label)
91 );
92 }
93 }

References ILIAS\Repository\toolbar().

Referenced by addTableSwitcherToToolbar(), and addViewSwitcherToToolbar().

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

◆ addTableSwitcherToToolbar()

ilDclSwitcher::addTableSwitcherToToolbar ( array  $tables,
string  $target_class,
string  $target_cmd,
int  $table_id = 0 
)
Parameters
ilDclTable[]$tables

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

39 : void
40 {
41 $this->ctrl->clearParameterByClass($target_class, 'tableview_id');
42 $links = [];
43 $current = '';
44 foreach ($tables as $table) {
45 $title = $table->getTitle();
46 if ($table->getId() == $table_id) {
47 $current = $title;
48 }
49 $title = ($current === $title ? '✓ ' : '⠀ ') . $title;
50 $this->ctrl->setParameterByClass($target_class, 'table_id', $table->getId());
51 $links[] = $this->ui_factory->link()->standard($title, $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
52 }
53 $this->ctrl->clearParameterByClass($target_class, 'table_id');
54
55 $this->addSwitcherToToolbar($links, $this->lng->txt('dcl_table') . ': ' . $current);
56 }
addSwitcherToToolbar(array $links, string $label)

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

+ Here is the call graph for this function:

◆ addViewSwitcherToToolbar()

ilDclSwitcher::addViewSwitcherToToolbar ( array  $views,
int  $table_id,
string  $target_class,
string  $target_cmd,
int  $tableview_id = 0 
)
Parameters
ilDclTableView[]$views

Definition at line 61 of file class.ilDclSwitcher.php.

61 : void
62 {
63 $this->ctrl->setParameterByClass($target_class, 'table_id', $table_id);
64 $links = [];
65 $current = '';
66 foreach ($views as $view) {
67 $title = $view->getTitle();
68 if ($view->getId() == $tableview_id) {
69 $current = $title;
70 }
71 $title = ($current === $title ? '✓⠀' : '⠀⠀') . $title;
72 $this->ctrl->setParameterByClass($target_class, 'tableview_id', $view->getId());
73 $links[] = $this->ui_factory->link()->standard($title, $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
74 }
75 $this->ctrl->clearParameterByClass($target_class, 'tableview_id');
76 $this->ctrl->clearParameterByClass($target_class, 'table_id');
77
78 $this->addSwitcherToToolbar($links, $this->lng->txt('dcl_tableview') . ': ' . $current);
79 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilDclSwitcher::$ctrl
protected

Definition at line 26 of file class.ilDclSwitcher.php.

Referenced by __construct().

◆ $lng

ilLanguage ilDclSwitcher::$lng
protected

Definition at line 25 of file class.ilDclSwitcher.php.

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilDclSwitcher::$toolbar
protected

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

Referenced by __construct().

◆ $ui_factory

ILIAS UI Factory ilDclSwitcher::$ui_factory
protected

Definition at line 24 of file class.ilDclSwitcher.php.

Referenced by __construct().


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