ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 addViewSwitcherToToolbar (array $views, int $table_id, string $target_class, string $target_cmd)
 

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.

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

29  {
30  $this->toolbar = $toolbar;
31  $this->ui_factory = $ui_factory;
32  $this->ctrl = $ctrl;
33  $this->lng = $lng;
34  }
ilToolbarGUI $toolbar
ILIAS UI Factory $ui_factory
+ Here is the call graph for this function:

Member Function Documentation

◆ addSwitcherToToolbar()

ilDclSwitcher::addSwitcherToToolbar ( array  $links,
string  $label 
)
protected
Parameters

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

References ILIAS\Repository\toolbar().

Referenced by addTableSwitcherToToolbar(), and addViewSwitcherToToolbar().

83  : void
84  {
85  if (count($links) > 1) {
86  $this->toolbar->addComponent(
87  $this->ui_factory->dropdown()->standard($links)->withLabel($label)
88  );
89  }
90  }
+ 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 
)
Parameters
ilDclTable[]$tables
string$target_class
string$target_cmd
Returns
void
Exceptions
ilCtrlException

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

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

43  : void
44  {
45  $links = [];
46 
47  $this->ctrl->clearParameterByClass(ilObjDataCollectionGUI::class, "tableview_id");
48  $this->ctrl->clearParameterByClass($target_class, "tableview_id");
49 
50  foreach ($tables as $table) {
51  $this->ctrl->setParameterByClass($target_class, "table_id", $table->getId());
52  $links[] = $this->ui_factory->link()->standard($table->getTitle(), $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
53  }
54  $this->ctrl->clearParameterByClass($target_class, "table_id");
55 
56  $this->addSwitcherToToolbar($links, $this->lng->txt('dcl_switch_table'));
57  }
addSwitcherToToolbar(array $links, string $label)
+ Here is the call graph for this function:

◆ addViewSwitcherToToolbar()

ilDclSwitcher::addViewSwitcherToToolbar ( array  $views,
int  $table_id,
string  $target_class,
string  $target_cmd 
)
Parameters
ilDclTableView[]$views
int$table_id
string$target_class
string$target_cmd
Returns
void
Exceptions
ilCtrlException

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

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

67  : void
68  {
69  $links = [];
70  $this->ctrl->setParameterByClass($target_class, "table_id", $table_id);
71  foreach ($views as $view) {
72  $this->ctrl->setParameterByClass($target_class, "tableview_id", $view->getId());
73  $links[] = $this->ui_factory->link()->standard($view->getTitle(), $this->ctrl->getLinkTargetByClass($target_class, $target_cmd));
74  }
75  $this->addSwitcherToToolbar($links, $this->lng->txt('dcl_switch_view'));
76  }
addSwitcherToToolbar(array $links, string $label)
+ 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: