53 'title_ASC' =>
'cert_sortable_by_title_asc',
54 'title_DESC' =>
'cert_sortable_by_title_desc',
55 'date_ASC' =>
'cert_sortable_by_issue_date_asc',
56 'date_DESC' =>
'cert_sortable_by_issue_date_desc',
102 $logger = $DIC->logger()->cert();
124 if (
$user === null) {
125 $user = $DIC->user();
169 $this->
language->loadLanguageModule(
'cert');
177 return 'listCertificates';
187 $nextClass = $this->controller->getNextClass($this);
188 $cmd = $this->controller->getCmd();
190 if (!$this->certificateSettings->get(
'active')) {
191 $this->controller->returnToParent($this);
194 $this->
template->setTitle($this->
language->txt(
'obj_cert'));
196 switch ($nextClass) {
197 case 'ilcertificatemigrationgui':
198 $migrationGui = new \ilCertificateMigrationGUI();
199 $resultMessageString = $this->controller->forwardCommand($migrationGui);
205 if (!method_exists($this, $cmd)) {
223 if (!$this->certificateSettings->get(
'active')) {
224 $this->controller->redirect($this);
228 $this->
template->setBodyClass(
'iosMyCertificates');
230 $showMigrationBox = $this->migrationVisibleValidator->isMigrationAvailable(
234 if (!$migrationWasStarted &&
true === $showMigrationBox) {
235 $migrationUiEl = new \ilCertificateMigrationUIElements();
236 $startMigrationCommand = $this->controller->getLinkTargetByClass(
237 [
'ilCertificateMigrationGUI'],
238 'startMigrationAndReturnMessage',
243 $messageBoxHtml = $migrationUiEl->getMigrationMessageBox($startMigrationCommand);
245 $this->
template->setCurrentBlock(
'mess');
246 $this->
template->setVariable(
'MESSAGE', $messageBoxHtml);
247 $this->
template->parseCurrentBlock(
'mess');
254 $this->
language->txt(
'certificate_no_object_title')
259 $this->
user->getId(),
261 'order_field' => explode(
'_', $sorting)[0],
262 'order_direction' => explode(
'_', $sorting)[1]
269 if (count(
$data[
'items']) > 0) {
273 foreach ($this->sortationOptions as $fieldAndDirection => $lngVariable) {
277 $sortViewControl = $this->uiFactory
280 ->withLabel($this->
language->txt($this->sortationOptions[$sorting]))
281 ->withTargetURL($this->controller->getLinkTarget($this,
'applySortation'),
'sort_by');
282 $uiComponents[] = $sortViewControl;
284 foreach (
$data[
'items'] as $certificateData) {
285 $thumbnailImagePath = $certificateData[
'thumbnail_image_path'];
287 if ($thumbnailImagePath === null
288 || $thumbnailImagePath ===
'' 289 || !$this->filesystem->has($thumbnailImagePath)
294 $cardImage = $this->uiFactory->image()->standard(
296 $certificateData[
'title']
302 if (strlen($certificateData[
'description']) > 0) {
303 $sections[] = $this->uiFactory->listing()->descriptive([
304 $this->
language->txt(
'cert_description_label') => $certificateData[
'description']
311 $sections[] = $this->uiFactory->listing()->descriptive([
318 $objectTypeIcon = $this->uiFactory
320 ->standard($certificateData[
'obj_type'], $certificateData[
'obj_type'],
'small');
322 $objectTitle = $certificateData[
'title'];
324 if (count($refIds) > 0) {
325 foreach ($refIds as $refId) {
326 if ($this->access->checkAccess(
'read',
'', $refId)) {
327 $objectTitle = $this->uiRenderer->render(
335 $sections[] = $this->uiFactory->listing()->descriptive([$this->
language->txt(
'cert_object_label') => implode(
'', [
336 $this->uiRenderer->render($objectTypeIcon),
340 $this->controller->setParameter($this,
'certificate_id', $certificateData[
'id']);
341 $downloadHref = $this->controller->getLinkTarget($this,
'download');
342 $this->controller->clearParameters($this);
343 $sections[] = $this->uiFactory->button()->standard(
'Download', $downloadHref);
345 $card = $this->uiFactory
347 ->standard($certificateData[
'title'], $cardImage)
348 ->withSections($sections);
353 $deck = $this->uiFactory->deck($cards);
355 $uiComponents[] = $this->uiFactory->divider()->horizontal();
357 $uiComponents[] = $deck;
362 $this->
template->setContent($this->uiRenderer->render($uiComponents));
371 if (!array_key_exists($sorting, $this->sortationOptions)) {
384 if (!array_key_exists($sorting, $this->sortationOptions)) {
399 $user = $DIC->user();
405 $userCertificateId = (int) $this->request->getQueryParams()[
'certificate_id'];
409 if ((
int) $userCertificate->getUserId() !== (int)
$user->getId()) {
410 throw new ilException(sprintf(
'User "%s" tried to access certificate: "%s"',
$user->getLogin(), $userCertificateId));
413 $this->certificateLogger->warning($exception->getMessage());
420 $this->certificateLogger,
423 $this->
language->txt(
'error_creating_certificate_pdf')
426 $pdfAction->
downloadPdf($userCertificate->getUserId(), $userCertificate->getObjId());
$userCertificateRepository
An entity that renders components to a string output.
Class ilPdfGeneratorConstantsTest.
This class provides processing control methods.
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
static setUseRelativeDates($a_status)
set use relative dates
listCertificates(bool $migrationWasStarted=false)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _getAllReferences($a_id)
get all reference ids of object
$migrationVisibleValidator
static useRelativeDates()
check if relative dates are used
Class ilCertificateMigration.
Interface ilAccessHandler.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const SORTATION_SESSION_KEY
This is how the factory for UI elements looks.
__construct(ilTemplate $template=null, ilCtrl $controller=null, ilLanguage $language=null, ilObjUser $user=null, ilUserCertificateRepository $userCertificateRepository=null, GuzzleHttp\Psr7\Request $request=null, ilLogger $certificateLogger=null, ilSetting $certificateSettings=null, Factory $uiFactory=null, Renderer $uiRenderer=null, \ilAccessHandler $access=null, \ILIAS\Filesystem\Filesystem $filesystem=null, ilCertificateMigrationValidator $migrationVisibleValidator=null)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static signFile($path_to_file)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Just a wrapper class to create Unit Test for other classes.
const MESSAGE_TYPE_SUCCESS
Component logger with individual log levels by component id.
static getWebspaceDir($mode="filesystem")
get webspace directory
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
Class FlySystemFileAccessTest.
downloadPdf(int $userId, int $objectId)