ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilKioskModeService.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /* Copyright (c) 2018 - Richard Klees <richard.klees@concepts-and-training.de> - Extended GPL, see LICENSE */
6 
10 final class ilKioskModeService
11 {
12  protected ilCtrl $ctrl;
13  protected ilLanguage $language;
14  protected ilAccess $access;
16 
17  public function __construct(
18  ilCtrl $ctrl,
19  ilLanguage $language,
20  ilAccess $access,
21  ilObjectDefinition $obj_definition
22  ) {
23  $this->ctrl = $ctrl;
24  $this->language = $language;
25  $this->access = $access;
26  $this->obj_definition = $obj_definition;
27  }
28 
32  public function getViewFor(ilObject $object): ?ilKioskModeView
33  {
34  $object_type = $object->getType();
35  if (!$this->hasKioskMode($object_type)) {
36  return null;
37  }
38 
39  $class_name = $this->getClassNameForType($object_type);
40 
41  return new $class_name(
42  $object,
43  $this->ctrl,
44  $this->language,
45  $this->access
46  );
47  }
48 
54  public function hasKioskMode(string $object_type): bool
55  {
56  $class_name = $this->getClassNameForType($object_type);
57  return class_exists($class_name);
58  }
59 
63  protected function getClassNameForType(string $object_type): string
64  {
65  $class = $this->obj_definition->getClassName($object_type);
66  return "il" . $class . "KioskModeView";
67  }
68 }
Base class to be implemented and put in class-directory of module with the name il$MODULEKioskModeVie...
parses the objects.xml it handles the xml-description of all ilias objects
ilObjectDefinition $obj_definition
getClassNameForType(string $object_type)
hasKioskMode(string $object_type)
Check if objects of a certain type provides kiosk mode in general.
Central entry point for users of the service.
getViewFor(ilObject $object)
Try to get a kiosk mode view for the given object.
__construct(ilCtrl $ctrl, ilLanguage $language, ilAccess $access, ilObjectDefinition $obj_definition)