ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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...
 

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
 

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.

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

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 $action_parameter_token
static getAllIdps()
ILIAS UI URLBuilder $url_builder
static _getHttpPath()
ILIAS UI URLBuilderToken $row_id_token
+ Here is the call graph for this function:

Member Function Documentation

◆ get()

ilSamlIdpTableGUI::get ( )

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

References getActions(), getColumnDefinition(), and ILIAS\Repository\lng().

58  : \ILIAS\UI\Component\Table\Data
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  }
Interface Observer Contains several chained tasks and infos about them.
+ Here is the call graph for this function:

◆ getActions()

ilSamlIdpTableGUI::getActions ( )
private
Returns
array<string, >

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

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

Referenced by get().

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, 'showIdpSettings'),
122  ),
123  'activate' => $this->ui_factory->table()->action()->single(
124  $this->lng->txt('activate'),
125  $this->url_builder->withParameter($this->action_parameter_token, 'activateIdp'),
127  ),
128  'deactivate' => $this->ui_factory->table()->action()->single(
129  $this->lng->txt('deactivate'),
130  $this->url_builder->withParameter($this->action_parameter_token, 'deactivateIdp'),
132  ),
133  'delete' => $this->ui_factory->table()->action()->single(
134  $this->lng->txt('delete'),
135  $this->url_builder->withParameter($this->action_parameter_token, 'confirmDeleteIdp'),
137  )
138  ];
139  }
ILIAS UI URLBuilderToken $row_id_token
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumnDefinition()

ilSamlIdpTableGUI::getColumnDefinition ( )
private
Returns
array<string, >

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

References ILIAS\Repository\lng().

Referenced by get().

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  }
+ 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.

References $idps, ilSamlIdp\getEntityId(), ILIAS\Repository\int(), ilSamlIdp\isActive(), and ilStr\strCmp().

Referenced by getRows().

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  }
Interface Observer Contains several chained tasks and infos about them.
static strCmp(string $a, string $b)
Definition: class.ilStr.php:87
+ Here is the call graph for this function:
+ Here is the caller 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.

References getRecords().

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)
+ Here is the call graph for this function:

◆ 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(), and getActions().

◆ $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: