ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilKioskModeService.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 
7 final class ilKioskModeService
8 {
12  protected $ctrl;
13 
17  protected $language;
18 
22  protected $access;
23 
27  protected $obj_definition;
28 
29  public function __construct(
30  ilCtrl $ctrl,
34  ) {
35  $this->ctrl = $ctrl;
36  $this->language = $language;
37  $this->access = $access;
38  $this->obj_definition = $obj_definition;
39  }
40 
46  public function getViewFor(\ilObject $object)
47  {
48  $object_type = $object->getType();
49  if (!$this->hasKioskMode($object_type)) {
50  return null;
51  }
52 
53  $class_name = $this->getClassNameForType($object_type);
54 
55  return new $class_name(
56  $object,
57  $this->ctrl,
58  $this->language,
59  $this->access
60  );
61  }
62 
68  public function hasKioskMode(string $object_type) : bool
69  {
70  $class_name = $this->getClassNameForType($object_type);
71  return class_exists($class_name);
72  }
73 
77  protected function getClassNameForType(string $object_type) : string
78  {
79  $class = $this->obj_definition->getClassName($object_type);
80  $full_class = "il" . $class . "KioskModeView";
81  return $full_class;
82  }
83 }
getViewFor(\ilObject $object)
Try to get a kiosk mode view for the given object.
This class provides processing control methods.
Class ilAccessHandler.
parses the objects.xml it handles the xml-description of all ilias objects
getClassNameForType(string $object_type)
hasKioskMode(string $object_type)
Check if objects of a certain type provides kiosk mode in general.
getType()
get object type public
Central entry point for users of the service.
language handling
__construct(ilCtrl $ctrl, ilLanguage $language, ilAccess $access, ilObjectDefinition $obj_definition)