ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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, ?array $filter_data, ?array $additional_parameters)
 
 getTotalRowCount (?array $filter_data, ?array $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, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $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(self::class)
68 ->withOrder(new \ILIAS\Data\Order('title', \ILIAS\Data\Order::ASC))
69 ->withActions($this->getActions())
70 ->withRequest($this->http_request);
71 }
This describes a Data Table.
Definition: Data.php:31
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(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getActions()

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

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

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

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 76 of file class.ilSamlIdpTableGUI.php.

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

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 144 of file class.ilSamlIdpTableGUI.php.

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

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

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

◆ getTotalRowCount()

ilSamlIdpTableGUI::getTotalRowCount ( ?array  $filter_data,
?array  $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 194 of file class.ilSamlIdpTableGUI.php.

194 : ?int
195 {
196 return count($this->idps);
197 }

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: