ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ilSamlIdpTableGUI Class Reference
+ Inheritance diagram for ilSamlIdpTableGUI:
+ Collaboration diagram for ilSamlIdpTableGUI:

Public Member Functions

 __construct (private ilSamlSettingsGUI $parent_gui, private \ILIAS\UI\Factory $ui_factory, private \ILIAS\UI\Renderer $ui_renderer, private ilLanguage $lng, private ilCtrlInterface $ctrl, private \Psr\Http\Message\ServerRequestInterface $http_request, private \ILIAS\Data\Factory $df, private string $parent_cmd, private bool $has_write_access)
 
 get ()
 
 getRows (\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, \ILIAS\Data\Range $range, \ILIAS\Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 
- Public Member Functions inherited from ILIAS\UI\Component\Table\DataRetrieval
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 

Private Member Functions

 getColumnDefinition ()
 
 getActions ()
 
 getRecords (\ILIAS\Data\Range $range, \ILIAS\Data\Order $order)
 

Private Attributes

array $idps
 
ILIAS UI URLBuilder $url_builder
 
ILIAS UI URLBuilderToken $action_parameter_token
 
ILIAS UI URLBuilderToken $row_id_token
 

Additional Inherited Members

- Data Fields inherited from ilSamlCommands
const string CMD_LIST_IDPS = 'listIdps'
 
const string CMD_TABLE_ACTIONS = 'handleTableActions'
 
const string CMD_SHOW_NEW_IDP_FORM = 'showNewIdpForm'
 
const string CMD_SAVE_NEW_IDP = 'saveNewIdp'
 
const string CMD_DELETE_IDP = 'deleteIdp'
 
const string CMD_SAVE_SETTINGS = 'saveSettings'
 
const string CMD_SHOW_SETTINGS = 'showSettings'
 
const string CMD_SHOW_IDP_SETTINGS = 'showIdpSettings'
 
const string CMD_SAVE_IDP_SETTINGS = 'saveIdpSettings'
 
const string CMD_SAVE_USER_ATTRIBUTE_MAPPING = 'saveUserAttributeMapping'
 
const string CMD_SHOW_USER_ATTRIBUTE_MAPPING_FORM = 'showUserAttributeMappingForm'
 
const string TABLE_ACTION_CONFIRM_DELETE_IDP = 'confirmDeleteIdp'
 
const string TABLE_ACTION_DEACTIVATE_IDP = 'deactivateIdp'
 
const string TABLE_ACTION_ACTIVATE_IDP = 'activateIdp'
 
const string TABLE_ACTION_SHOW_IDP_SETTINGS = 'showIdpSettings'
 
const array GLOBAL_COMMANDS
 
const array GLOBAL_ENTITY_COMMANDS
 
const array GLOBAL_ENTITY_TABLE_ACTIONS
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilSamlIdpTableGUI::__construct ( private ilSamlSettingsGUI  $parent_gui,
private \ILIAS\UI\Factory  $ui_factory,
private \ILIAS\UI\Renderer  $ui_renderer,
private ilLanguage  $lng,
private ilCtrlInterface  $ctrl,
private \Psr\Http\Message\ServerRequestInterface  $http_request,
private \ILIAS\Data\Factory  $df,
private string  $parent_cmd,
private bool  $has_write_access 
)

Definition at line 29 of file class.ilSamlIdpTableGUI.php.

39 {
40 $this->idps = ilSamlIdp::getAllIdps();
41
42 $form_action = $this->df->uri(
43 ilUtil::_getHttpPath() . '/' .
44 $this->ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd)
45 );
46
47 [
51 ] = (new ILIAS\UI\URLBuilder($form_action))->acquireParameters(
52 ['saml', 'idps'],
53 'table_action',
54 'idp_id'
55 );
56 }
ILIAS UI URLBuilderToken $row_id_token
ILIAS UI URLBuilder $url_builder
ILIAS UI URLBuilderToken $action_parameter_token
static getAllIdps()
static _getHttpPath()

References $action_parameter_token, $row_id_token, $url_builder, ilUtil\_getHttpPath(), ILIAS\Repository\ctrl(), and ilSamlIdp\getAllIdps().

+ Here is the call graph for this function:

Member Function Documentation

◆ get()

ilSamlIdpTableGUI::get ( )

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

59 {
60 return $this->ui_factory
61 ->table()
62 ->data(
63 $this,
64 $this->lng->txt('auth_saml_idps'),
65 $this->getColumnDefinition(),
66 )
67 ->withId(str_replace('\\', '', self::class))
68 ->withOrder(new \ILIAS\Data\Order('title', \ILIAS\Data\Order::ASC))
69 ->withRange(new \ILIAS\Data\Range(0, 100))
70 ->withActions($this->getActions())
71 ->withRequest($this->http_request);
72 }
This describes a Data Table.
Definition: Data.php:33
withId(string $id)
The DataTable comes with a storage to keep e.g.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References getActions(), getColumnDefinition(), ILIAS\Repository\lng(), ILIAS\UI\Implementation\Component\Table\withOrder(), and ILIAS\UI\Implementation\Component\Table\withRange().

+ Here is the call graph for this function:

◆ getActions()

ilSamlIdpTableGUI::getActions ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Action\Action>

Definition at line 112 of file class.ilSamlIdpTableGUI.php.

112 : array
113 {
114 if (!$this->has_write_access) {
115 return [];
116 }
117
118 return [
119 'edit' => $this->ui_factory->table()->action()->single(
120 $this->lng->txt('edit'),
121 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_SHOW_IDP_SETTINGS),
122 $this->row_id_token
123 ),
124 'activate' => $this->ui_factory->table()->action()->single(
125 $this->lng->txt('activate'),
126 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_ACTIVATE_IDP),
127 $this->row_id_token
128 ),
129 'deactivate' => $this->ui_factory->table()->action()->single(
130 $this->lng->txt('deactivate'),
131 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_DEACTIVATE_IDP),
132 $this->row_id_token
133 ),
134 'delete' => $this->ui_factory->table()->action()->single(
135 $this->lng->txt('delete'),
136 $this->url_builder->withParameter($this->action_parameter_token, self::TABLE_ACTION_CONFIRM_DELETE_IDP),
137 $this->row_id_token
138 )
139 ];
140 }

References ILIAS\Repository\lng().

Referenced by get().

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

◆ getColumnDefinition()

ilSamlIdpTableGUI::getColumnDefinition ( )
private
Returns
array<string, \ILIAS\UI\Component\Table\Column\Column>

Definition at line 77 of file class.ilSamlIdpTableGUI.php.

77 : array
78 {
79 return [
80 'title' => $this->ui_factory
81 ->table()
82 ->column()
83 ->text($this->lng->txt('saml_tab_head_idp'))
84 ->withIsSortable(true),
85 'active' => $this->ui_factory
86 ->table()
87 ->column()
88 ->boolean(
89 $this->lng->txt('status'),
90 $this->ui_factory->symbol()->icon()->custom(
91 'assets/images/standard/icon_ok.svg',
92 $this->lng->txt('active'),
93 'small'
94 ),
95 $this->ui_factory->symbol()->icon()->custom(
96 'assets/images/standard/icon_not_ok.svg',
97 $this->lng->txt('inactive'),
98 'small'
99 )
100 )
101 ->withIsSortable(true)
102 ->withOrderingLabels(
103 "{$this->lng->txt('status')}, {$this->lng->txt('active')} {$this->lng->txt('order_option_first')}",
104 "{$this->lng->txt('status')}, {$this->lng->txt('inactive')} {$this->lng->txt('order_option_first')}"
105 )
106 ];
107 }

References ILIAS\Repository\lng().

Referenced by get().

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

◆ getRecords()

ilSamlIdpTableGUI::getRecords ( \ILIAS\Data\Range  $range,
\ILIAS\Data\Order  $order 
)
private
Returns
list<ilSamlIdp>

Definition at line 145 of file class.ilSamlIdpTableGUI.php.

145 : array
146 {
147 $records = $this->idps;
148
149 [$order_field, $order_direction] = $order->join([], static function ($ret, $key, $value) {
150 return [$key, $value];
151 });
152
153 usort($records, static function (ilSamlIdp $left, ilSamlIdp $right) use ($order_field): int {
154 if ($order_field === 'title') {
155 return ilStr::strCmp($left->getEntityId(), $right->getEntityId());
156 }
157
158 return (int) $right->isActive() <=> (int) $left->isActive();
159 });
160
161 if ($order_direction === \ILIAS\Data\Order::DESC) {
162 $records = array_reverse($records);
163 }
164
165 $records = array_slice($records, $range->getStart(), $range->getLength());
166
167 return $records;
168 }
static strCmp(string $a, string $b)
Definition: class.ilStr.php:87

References $idps, ILIAS\UI\Implementation\Component\Table\$range, ilSamlIdp\getEntityId(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), ILIAS\Repository\int(), ilSamlIdp\isActive(), and ilStr\strCmp().

+ Here is the call graph for this function:

◆ getRows()

ilSamlIdpTableGUI::getRows ( \ILIAS\UI\Component\Table\DataRowBuilder  $row_builder,
array  $visible_column_ids,
\ILIAS\Data\Range  $range,
\ILIAS\Data\Order  $order,
mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Definition at line 170 of file class.ilSamlIdpTableGUI.php.

178 : Generator {
179 foreach ($this->getRecords($range, $order) as $item) {
180 yield $row_builder
181 ->buildDataRow((string) $item->getIdpId(), [
182 'title' => $item->getEntityId(),
183 'active' => $item->isActive()
184 ])
185 ->withDisabledAction(
186 'activate',
187 $item->isActive(),
188 )
189 ->withDisabledAction(
190 'deactivate',
191 !$item->isActive(),
192 );
193 }
194 }
getRecords(\ILIAS\Data\Range $range, \ILIAS\Data\Order $order)

◆ getTotalRowCount()

ilSamlIdpTableGUI::getTotalRowCount ( mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Mainly for the purpose of pagination-support, it is important to know about the total number of records available.

Given the nature of a DataTable, which is, opposite to a PresentationTable, rather administrative than explorative, this information will increase user experience quite a bit. However, you may return null, if the call is to costly, but expect the View Control to look a little different in this case.

Make sure that potential filters or user restrictions are being applied to the count.

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 196 of file class.ilSamlIdpTableGUI.php.

200 : ?int {
201 return count($this->idps);
202 }

Field Documentation

◆ $action_parameter_token

ILIAS UI URLBuilderToken ilSamlIdpTableGUI::$action_parameter_token
private

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

Referenced by __construct().

◆ $idps

array ilSamlIdpTableGUI::$idps
private

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

Referenced by getRecords().

◆ $row_id_token

ILIAS UI URLBuilderToken ilSamlIdpTableGUI::$row_id_token
private

Definition at line 27 of file class.ilSamlIdpTableGUI.php.

Referenced by __construct().

◆ $url_builder

ILIAS UI URLBuilder ilSamlIdpTableGUI::$url_builder
private

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

Referenced by __construct().


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