119 : void
120 {
121 $this->
help->setScreenIdComponent(
'cert');
122
123 if (!$this->certificateSettings->get('active', '0')) {
124 $this->
ctrl->redirect($this);
125 }
126
127 $this->template->setPermanentLink('cert', null, 'list');
128
130 $this->db,
132 $this->
language->txt(
'certificate_no_object_title')
133 );
134
137 $this->
user->getId(),
138 [
139 'order_field' => explode('_', $sorting)[0],
140 'order_direction' => explode('_', $sorting)[1],
141 'language' => $this->
user->getLanguage()
142 ],
143 []
144 );
145
146 $uiComponents = [];
147
148 if (
$data[
'items'] !== []) {
149 $sortationOptions = [];
150 $cards = [];
151
152 foreach ($this->sortation_options as $fieldAndDirection => $lngVariable) {
153 $sortationOptions[$fieldAndDirection] = $this->
language->txt($lngVariable);
154 }
155
156 $sortViewControl = $this->ui_factory
157 ->viewControl()
158 ->sortation($sortationOptions, $sorting)
159 ->withTargetURL($this->
ctrl->getLinkTarget($this,
'applySortation'),
'sort_by');
160
161 $uiComponents[] = $sortViewControl;
162
163 foreach (
$data[
'items'] as $certificateData) {
164 $tile_image_identification = $certificateData['tile_image_ident'] ?? '';
165 $imagePath = '';
166 $tile_image_rid = $this->irss->manage()->find($tile_image_identification);
168 $imagePath = $this->irss->consume()->src($tile_image_rid)->getSrc(true);
169 }
170
171 if ($imagePath === '') {
173 }
174
175 $cardImage = $this->ui_factory->image()->standard(
176 $imagePath,
177 $certificateData['title']
178 );
179
180 $sections = [];
181
182 if ($certificateData['description'] !== '') {
183 $sections[] = $this->ui_factory->listing()->descriptive([
184 $this->
language->txt(
'cert_description_label') => $certificateData[
'description']
185 ]);
186 }
187
190 $sections[] = $this->ui_factory->listing()->descriptive([
193 )
194 ]);
196
197 $objectTypeIcon = $this->ui_factory
198 ->symbol()
199 ->icon()
200 ->standard($certificateData['obj_type'], $certificateData['obj_type'])
201 ;
202
203 $objectTitle = $certificateData['title'];
205 foreach ($refIds as
$refId) {
206 if ($this->
access->checkAccess(
'read',
'', $refId)) {
207 $objectTitle = $this->ui_renderer->render(
208 $this->ui_factory->link()->standard($objectTitle, ilLink::_getLink(
$refId))
209 );
210
211 break;
212 }
213 }
214
215 $sections[] = $this->ui_factory->listing()->descriptive([$this->
language->txt(
'cert_object_label') => implode(
216 '',
217 [
218 $this->ui_renderer->render($objectTypeIcon),
219 $objectTitle
220 ]
221 )
222 ]);
223
224 $this->
ctrl->setParameter($this,
'certificate_id', $certificateData[
'id']);
225 $downloadHref = $this->
ctrl->getLinkTarget($this,
'download');
226 $this->
ctrl->clearParameters($this);
227 $sections[] = $this->ui_factory->button()->standard('Download', $downloadHref);
228
229 $card = $this->ui_factory
230 ->card()
231 ->standard($certificateData['title'], $cardImage)
232 ->withSections($sections)
233 ;
234
235 $cards[] = $card;
236 }
237
238 $deck = $this->ui_factory->deck($cards)->withSmallCardsSize();
239
240 $uiComponents[] = $this->ui_factory->divider()->horizontal();
241
242 $uiComponents[] = $deck;
243 } else {
244 $this->
template->setOnScreenMessage(
'info', $this->
language->txt(
'cert_currently_no_certs'));
245 }
246
247 $this->template->setContent($this->ui_renderer->render($uiComponents));
248 }
Class ResourceIdentification.
static useRelativeDates()
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static _getAllReferences(int $id)
get all reference ids for object ID
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)