ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
DataRetrieval.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use Generator;
28use ilObjUser;
29use ilObject;
30use ilLanguage;
31use ILIAS\UI\Factory as UIFactory;
33
35{
37
38 public function __construct(
39 protected int $calendar_id,
40 protected ilLanguage $lng,
41 protected UIFactory $ui_factory
42 ) {
43 }
44
45 protected function getShared(): ilCalendarShared
46 {
47 return $this->shared ??= new ilCalendarShared($this->calendar_id);
48 }
49
50 public function getRows(
51 DataRowBuilder $row_builder,
52 array $visible_column_ids,
54 Order $order,
55 mixed $additional_viewcontrol_data,
56 mixed $filter_data,
57 mixed $additional_parameters
58 ): Generator {
59 $data = [];
60 foreach ($this->getShared()->getShared() as $item) {
61 $datum = [];
62 $obj_id = (int) $item['obj_id'];
63 switch ($item['obj_type']) {
65 $datum[TableBuilder::TYPE_COLUMN] = 'usr';
66 $name = ilObjUser::_lookupName($obj_id);
67 $datum[TableBuilder::TITLE_COLUMN] = $name['lastname'] . ', ' . $name['firstname'];
69 break;
70
72 $datum[TableBuilder::TYPE_COLUMN] = 'role';
75 break;
76 }
77 $datum[TableBuilder::WRITABLE_COLUMN] = (bool) $item['writable'];
78
79 $data[$obj_id] = $datum;
80 }
81
82 $order_field = array_keys($order->get())[0];
83 $order_direction = $order->get()[$order_field];
84 uasort($data, fn($a, $b) => strtolower((string) $a[$order_field]) <=> strtolower((string) $b[$order_field]));
85 if ($order_direction === Order::DESC) {
86 $data = array_reverse($data, true);
87 }
88 $data = array_slice($data, $range->getStart(), $range->getLength(), true);
89
90 $usr_icon = $this->ui_factory->symbol()->icon()->standard('usr', $this->lng->txt('obj_usr'));
91 $role_icon = $this->ui_factory->symbol()->icon()->standard('role', $this->lng->txt('obj_role'));
92
93 foreach ($data as $id => $datum) {
95 'usr' => $usr_icon,
96 'role' => $role_icon
97 };
99 true => $this->lng->txt('cal_shared_access_read_write'),
100 false => $this->lng->txt('cal_shared_access_read_only')
101 };
102 yield $row_builder->buildDataRow(
103 (string) $id,
104 $datum
105 );
106 }
107 }
108
112 public function getAllIDs(): array
113 {
114 $ids = [];
115 foreach ($this->getShared()->getShared() as $item) {
116 $ids[] = (int) $item['obj_id'];
117 }
118 return $ids;
119 }
120
121 public function getTotalRowCount(
122 mixed $additional_viewcontrol_data,
123 mixed $filter_data,
124 mixed $additional_parameters
125 ): ?int {
126 return count($this->getShared()->getShared());
127 }
128}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(protected int $calendar_id, protected ilLanguage $lng, protected UIFactory $ui_factory)
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 recor...
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....
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
const DESC
Definition: Order.php:31
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
Handles shared calendars.
language handling
User class.
static _lookupName(int $a_user_id)
Class ilObject Basic functions for all objects.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildDataRow(string $id, array $record)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
global $lng
Definition: privfeed.php:26
$data
Definition: storeScorm.php:45