ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilKioskModeView.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2018 - Richard Klees <richard.klees@concepts-and-training.de> - Extended GPL, see LICENSE */
3
8abstract class ilKioskModeView implements ILIAS\KioskMode\View
9{
13 protected $ctrl;
14
18 protected $lng;
19
23 protected $access;
24
31 final public function __construct(
32 \ilObject $object,
36 ) {
37 $this->ctrl = $ctrl;
38 $this->lng = $lng;
39 $this->access = $access;
40
41 $objectClassName = $this->getObjectClass();
42 if (!($object instanceof $objectClassName)) {
43 throw new \LogicException(
44 "Provided object of class '" . get_class($object) . "' does not " .
45 "fit view for '" . $this->getObjectClass() . "'"
46 );
47 }
48 $this->setObject($object);
49 if (!$this->hasPermissionToAccessKioskMode()) {
50 throw new \RuntimeException(
51 "User is not allowed to access the kiosk mode for the supplied object."
52 );
53 }
54 }
55
59 abstract protected function getObjectClass() : string;
60
67 abstract protected function setObject(\ilObject $object);
68
73 abstract protected function hasPermissionToAccessKioskMode() : bool;
74
75 // Note that methods of ILIAS\KioskMode\View need to be implemented as well.
76}
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
Base class to be implemented and put in class-directory of module with the name il$MODULEKioskModeVie...
__construct(\ilObject $object, \ilCtrl $ctrl, \ilLanguage $lng, \ilAccessHandler $access)
getObjectClass()
Get the class of objects this view displays.
setObject(\ilObject $object)
Set the object for this view.
hasPermissionToAccessKioskMode()
Check if the global user has permission to access the kiosk mode of the supplied object.
language handling
Class ilObject Basic functions for all objects.
A kiosk mode view on a certain object.
Definition: View.php:14
Interface ilAccessHandler.