ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLegacyKioskModeView Class Reference
+ Inheritance diagram for ilLegacyKioskModeView:
+ Collaboration diagram for ilLegacyKioskModeView:

Public Member Functions

 __construct (ilObject $object, ilLanguage $lng, ilAccess $access, LOMServices $lom_services)
 
 buildInitialState (State $empty_state)
 
 buildControls (State $state, ControlBuilder $builder)
 
 updateGet (State $state, string $command, ?int $parameter=null)
 
 updatePost (State $state, string $command, array $post)
 
 render (State $state, Factory $factory, URLBuilder $url_builder, ?array $post=null)
 
- Public Member Functions inherited from ILIAS\KioskMode\View
 render (State $state, UI\Factory $factory, URLBuilder $url_builder, ?array $post=null)
 Render a state using the ui-factory and URLs from the builder. More...
 

Data Fields

const GET_VIEW_CMD_FROM_LIST_GUI_FOR = ['sahs']
 

Protected Member Functions

 getObjectTitle ()
 
 setObject (\ilObject $object)
 
 hasPermissionToAccessKioskMode ()
 

Protected Attributes

ilObject $object
 
ilLanguage $lng
 
ilAccess $access
 
LOMServices $lom_services
 

Private Member Functions

 getMetadata (int $obj_id, string $type)
 
 getTitleByType (string $type)
 

Detailed Description

Definition at line 28 of file class.ilLegacyKioskModeView.php.

Constructor & Destructor Documentation

◆ __construct()

ilLegacyKioskModeView::__construct ( ilObject  $object,
ilLanguage  $lng,
ilAccess  $access,
LOMServices  $lom_services 
)

Definition at line 37 of file class.ilLegacyKioskModeView.php.

References $access, $lng, $lom_services, $object, ILIAS\Repository\access(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildControls()

ilLegacyKioskModeView::buildControls ( State  $state,
ControlBuilder  $builder 
)

Implements ILIAS\KioskMode\View.

Definition at line 75 of file class.ilLegacyKioskModeView.php.

References $ref_id, $url, ilObjectListGUIFactory\_getListGUIByType(), ilLink\_getStaticLink(), getTitleByType(), and ILIAS\Repository\lng().

76  {
77  if (!$builder instanceof LSControlBuilder) {
78  throw new LogicException("The Legacy Mode in the Learning Sequence requires an LSControlBuilder explicitely.", 1);
79  }
80 
81  $ref_id = $this->object->getRefId();
82  $type = $this->object->getType();
83 
84  $label = sprintf(
85  $this->lng->txt('lso_start_item'),
86  $this->getTitleByType($type)
87  );
88 
90  $ref_id,
91  $type
92  );
93 
94  $obj_id = $this->object->getId();
95  if (in_array($type, self::GET_VIEW_CMD_FROM_LIST_GUI_FOR)) {
96  $item_list_gui = \ilObjectListGUIFactory::_getListGUIByType($type);
97  $item_list_gui->initItem($ref_id, $obj_id, $type);
98  $view_link = $item_list_gui->getCommandLink('view');
99  $view_link = str_replace('&', '&', $view_link);
100  $view_link = ILIAS_HTTP_PATH . '/' . $view_link;
101  $url = $view_link;
102  }
103 
104  $builder->start($label, $url, $obj_id);
105 
106  return $builder;
107  }
$url
Definition: shib_logout.php:66
$ref_id
Definition: ltiauth.php:65
static _getListGUIByType(string $type, int $context=ilObjectListGUI::CONTEXT_REPOSITORY)
Build controls for the view.
+ Here is the call graph for this function:

◆ buildInitialState()

ilLegacyKioskModeView::buildInitialState ( State  $empty_state)

Implements ILIAS\KioskMode\View.

Definition at line 67 of file class.ilLegacyKioskModeView.php.

67  : State
68  {
69  return $empty_state;
70  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26

◆ getMetadata()

ilLegacyKioskModeView::getMetadata ( int  $obj_id,
string  $type 
)
private
Returns
array<string, string>|[]

Definition at line 159 of file class.ilLegacyKioskModeView.php.

References ILIAS\Repository\lng().

Referenced by render().

159  : array
160  {
161  $paths = $this->lom_services->paths();
162  $data_helper = $this->lom_services->dataHelper();
163  $reader = $this->lom_services->read(
164  $obj_id,
165  0,
166  $type,
167  $paths->custom()->withNextStep('general')->get()
168  );
169 
170  $meta_data = [];
171 
172  $languages = $data_helper->makePresentableAsList(
173  ', ',
174  ...$reader->allData($paths->languages())
175  );
176  if ($languages !== '') {
177  $meta_data[$this->lng->txt('language')] = $languages;
178  }
179 
180  $keywords = $data_helper->makePresentableAsList(
181  ', ',
182  ...$reader->allData($paths->keywords())
183  );
184  if ($keywords !== '') {
185  $meta_data[$this->lng->txt('keywords')] = $keywords;
186  }
187 
188  return $meta_data;
189  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectTitle()

ilLegacyKioskModeView::getObjectTitle ( )
protected

Definition at line 49 of file class.ilLegacyKioskModeView.php.

49  : string
50  {
51  return $this->object->getTitle();
52  }

◆ getTitleByType()

ilLegacyKioskModeView::getTitleByType ( string  $type)
private

Definition at line 191 of file class.ilLegacyKioskModeView.php.

References ILIAS\Repository\lng().

Referenced by buildControls().

191  : string
192  {
193  return $this->lng->txt("obj_" . $type);
194  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPermissionToAccessKioskMode()

ilLegacyKioskModeView::hasPermissionToAccessKioskMode ( )
protected

Definition at line 59 of file class.ilLegacyKioskModeView.php.

59  : bool
60  {
61  return true;
62  }

◆ render()

ilLegacyKioskModeView::render ( State  $state,
Factory  $factory,
URLBuilder  $url_builder,
?array  $post = null 
)

Definition at line 128 of file class.ilLegacyKioskModeView.php.

References getMetadata(), ILIAS\UI\Factory\item(), ILIAS\Repository\lng(), ILIAS\UI\Factory\messageBox(), ILIAS\Repository\object(), ILIAS\UI\Factory\panel(), and ILIAS\UI\Factory\symbol().

133  : Component {
134  $obj_type = $this->object->getType();
135  $obj_type_txt = $this->lng->txt('obj_' . $obj_type);
136  $icon = $factory->symbol()->icon()->standard($obj_type, $obj_type_txt, 'large');
137 
138  $props = array_merge(
139  [$this->lng->txt('obj_type') => $obj_type_txt],
140  $this->getMetadata($this->object->getId(), $obj_type)
141  );
142 
143  return $factory->panel()->standard(
144  $this->object->getTitle(),
145  [
146  $factory->messageBox()->info($this->lng->txt('lso_legacy_info')),
147  $factory->item()->standard($this->object->getTitle())
148  ->withLeadIcon($icon)
149  ->withDescription($this->object->getDescription())
150  ->withProperties($props)
151  ]
152  );
153  }
panel()
description: purpose: > Panels are used to group titled content.
symbol()
description: purpose: > Symbols are graphical representations of concepts or contexts quickly compre...
item()
description: purpose: > An item displays a unique entity within the system.
messageBox()
description: purpose: > Message Boxes inform the user about the state of the system or an ongoing us...
getMetadata(int $obj_id, string $type)
+ Here is the call graph for this function:

◆ setObject()

ilLegacyKioskModeView::setObject ( \ilObject  $object)
protected

Definition at line 54 of file class.ilLegacyKioskModeView.php.

References $object.

54  : void
55  {
56  $this->object = $object;
57  }

◆ updateGet()

ilLegacyKioskModeView::updateGet ( State  $state,
string  $command,
?int  $parameter = null 
)

Implements ILIAS\KioskMode\View.

Definition at line 112 of file class.ilLegacyKioskModeView.php.

112  : State
113  {
114  return $state;
115  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26

◆ updatePost()

ilLegacyKioskModeView::updatePost ( State  $state,
string  $command,
array  $post 
)

Implements ILIAS\KioskMode\View.

Definition at line 120 of file class.ilLegacyKioskModeView.php.

120  : State
121  {
122  return $state;
123  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26

Field Documentation

◆ $access

ilAccess ilLegacyKioskModeView::$access
protected

Definition at line 34 of file class.ilLegacyKioskModeView.php.

Referenced by __construct().

◆ $lng

ilLanguage ilLegacyKioskModeView::$lng
protected

Definition at line 33 of file class.ilLegacyKioskModeView.php.

Referenced by __construct().

◆ $lom_services

LOMServices ilLegacyKioskModeView::$lom_services
protected

Definition at line 35 of file class.ilLegacyKioskModeView.php.

Referenced by __construct().

◆ $object

ilObject ilLegacyKioskModeView::$object
protected

Definition at line 32 of file class.ilLegacyKioskModeView.php.

Referenced by __construct(), and setObject().

◆ GET_VIEW_CMD_FROM_LIST_GUI_FOR

const ilLegacyKioskModeView::GET_VIEW_CMD_FROM_LIST_GUI_FOR = ['sahs']

Definition at line 30 of file class.ilLegacyKioskModeView.php.


The documentation for this class was generated from the following file: