|
| __construct (private readonly UIFactory $create, private readonly ilLanguage $lng, private readonly ilUIService $ui_service, private readonly Http $http) |
|
| build (array $multi_actions, string $target_url, callable $action) |
|
Definition at line 47 of file RelationsTable.php.
◆ __construct()
ILIAS\Contact\BuddySystem\Tables\RelationsTable::__construct |
( |
private readonly UIFactory |
$create, |
|
|
private readonly ilLanguage |
$lng, |
|
|
private readonly ilUIService |
$ui_service, |
|
|
private readonly Http |
$http |
|
) |
| |
◆ actions()
ILIAS\Contact\BuddySystem\Tables\RelationsTable::actions |
( |
array |
$data, |
|
|
callable |
$action |
|
) |
| |
|
private |
◆ build()
ILIAS\Contact\BuddySystem\Tables\RelationsTable::build |
( |
array |
$multi_actions, |
|
|
string |
$target_url, |
|
|
callable |
$action |
|
) |
| |
- Parameters
-
array<string,Action> | $multi_actions |
callable(string,string,string) | Action $action |
- Returns
- Component[]
Definition at line 112 of file RelationsTable.php.
References $data, ILIAS\Contact\BuddySystem\Tables\RelationsTable\actions(), ILIAS\Contact\BuddySystem\Tables\RelationsTable\filterComponent(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Contact\BuddySystem\Tables\RelationsTable\rows().
115 $data = static::data($this->ui_service->filter()->getData($filter) ?: []);
118 $rows = $this->
rows(
$data, array_keys($single_actions));
121 $return[] = $this->create->table()->data(
122 new TableRows($rows),
123 $this->
lng->txt(
'buddy_tbl_title_relations'),
125 'public_name' => $this->create->table()->column()->text($this->
lng->txt(
'name')),
126 'login' => $this->create->table()->column()->text($this->
lng->txt(
'login')),
127 'state-text' => $this->create->table()->column()
128 ->text($this->
lng->txt(
'buddy_tbl_state_actions_col_label')),
130 )->withRequest($this->
http->request())->withActions(
131 array_merge($single_actions, $multi_actions)
static http()
Fetches the global http state from ILIAS.
◆ filter()
static ILIAS\Contact\BuddySystem\Tables\RelationsTable::filter |
( |
string |
$public_name_query, |
|
|
ilBuddySystemArrayCollection |
$relations, |
|
|
array |
$public_names, |
|
|
array |
$logins |
|
) |
| |
|
staticprivate |
A
- Parameters
-
ilBuddySystemArrayCollection<int,A> | $relations |
array<int,string> | $public_names |
array<int,string> | $logins |
- Returns
- Closure(A): bool
Definition at line 144 of file RelationsTable.php.
References $user_id, ilObjUser\_lookupActive(), and ilBuddySystemArrayCollection\getKey().
146 $in_string =
static fn(
string $needle,
string $haystack): bool => false !==
ilStr::strpos(
147 ilStr::strtolower($haystack),
148 ilStr::strtolower($needle),
152 return self::pipe($relations->
getKey(...),
static fn(
int $user_id): bool => (
153 $in_string($public_name_query, $public_names[$user_id]) ||
154 $in_string($public_name_query, $logins[$user_id])
155 ) &&
ilObjUser::_lookupActive($user_id));
◆ filterComponent()
ILIAS\Contact\BuddySystem\Tables\RelationsTable::filterComponent |
( |
string |
$target_url | ) |
|
|
private |
◆ pipe()
static ILIAS\Contact\BuddySystem\Tables\RelationsTable::pipe |
( |
Closure |
$a, |
|
|
Closure |
$b |
|
) |
| |
|
staticprivate |
◆ rows()
ILIAS\Contact\BuddySystem\Tables\RelationsTable::rows |
( |
array |
$data, |
|
|
array |
$actions |
|
) |
| |
|
private |
- Parameters
-
Definition at line 215 of file RelationsTable.php.
References Vendor\Package\$a, Vendor\Package\$b, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow(), and ILIAS\UI\Component\Table\DataRow\withDisabledAction().
Referenced by ILIAS\Contact\BuddySystem\Tables\RelationsTable\build().
217 return static function (
218 DataRowBuilder $row_builder,
219 array $visible_column_ids,
223 $order = $order->get();
224 $times = current($order) ===
'ASC' ? 1 : -1;
225 usort(
$data, fn(array
$a, array
$b):
int => $times * strcasecmp($a[key($order)], $b[key($order)]));
226 foreach (
$data as $row) {
227 $transitions =
array_map(fn($s):
string => $row[
'state'] .
'->' . $s, $row[
'points']);
230 fn(DataRow $row,
string $action): DataRow => in_array($action, $transitions,
true) ?
232 $row->withDisabledAction($action),
233 $row_builder->buildDataRow((
string) $row[
'user_id'], $row)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
The documentation for this class was generated from the following file: