ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLegacyKioskModeView Class Reference
+ Inheritance diagram for ilLegacyKioskModeView:
+ Collaboration diagram for ilLegacyKioskModeView:

Public Member Functions

 __construct (ilObject $object, ilLanguage $lng, ilAccess $access)
 
 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
 

Private Member Functions

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $access, $lng, $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 71 of file class.ilLegacyKioskModeView.php.

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

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

◆ buildInitialState()

ilLegacyKioskModeView::buildInitialState ( State  $empty_state)

Implements ILIAS\KioskMode\View.

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

63  : State
64  {
65  return $empty_state;
66  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12

◆ getMetadata()

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

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

References $id, and ILIAS\Repository\lng().

Referenced by render().

149  : array
150  {
151  $md = new ilMD($obj_id, 0, $type);
152  $meta_data = [];
153 
154  $section = $md->getGeneral();
155  if (!$section) {
156  return [];
157  }
158 
159  $meta_data['language'] = [];
160  foreach ($section->getLanguageIds() as $id) {
161  $meta_data['language'][] = $section->getLanguage($id)->getLanguageCode();
162  }
163  $meta_data['keywords'] = [];
164  foreach ($section->getKeywordIds() as $id) {
165  $meta_data['keywords'][] = $section->getKeyword($id)->getKeyword();
166  }
167 
168  $md_flat = [];
169  foreach ($meta_data as $md_label => $values) {
170  if ($values !== []) {
171  $md_flat[$this->lng->txt($md_label)] = implode(', ', $values);
172  }
173  }
174  return $md_flat;
175  }
$type
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectTitle()

ilLegacyKioskModeView::getObjectTitle ( )
protected

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

45  : string
46  {
47  return $this->object->getTitle();
48  }

◆ getTitleByType()

ilLegacyKioskModeView::getTitleByType ( string  $type)
private

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

References ILIAS\Repository\lng().

Referenced by buildControls().

177  : string
178  {
179  return $this->lng->txt("obj_" . $type);
180  }
$type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPermissionToAccessKioskMode()

ilLegacyKioskModeView::hasPermissionToAccessKioskMode ( )
protected

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

55  : bool
56  {
57  return true;
58  }

◆ render()

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

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

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

129  : Component {
130  $obj_type = $this->object->getType();
131  $obj_type_txt = $this->lng->txt('obj_' . $obj_type);
132  $icon = $factory->symbol()->icon()->standard($obj_type, $obj_type_txt, 'large');
133 
134  $props = array_merge(
135  [$this->lng->txt('obj_type') => $obj_type_txt],
136  $this->getMetadata($this->object->getId(), $obj_type)
137  );
138 
139  return $factory->item()->standard($this->object->getTitle())
140  ->withLeadIcon($icon)
141  ->withDescription($this->object->getDescription())
142  ->withProperties($props);
143  }
symbol()
description: purpose: > Symbols are graphical representations of concepts or contexts quickly compre...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
item()
description: purpose: > An item displays a unique entity within the system.
getMetadata(int $obj_id, string $type)
+ Here is the call graph for this function:

◆ setObject()

ilLegacyKioskModeView::setObject ( \ilObject  $object)
protected

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

References $object.

50  : void
51  {
52  $this->object = $object;
53  }

◆ updateGet()

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

Implements ILIAS\KioskMode\View.

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

108  : State
109  {
110  return $state;
111  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12

◆ updatePost()

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

Implements ILIAS\KioskMode\View.

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

116  : State
117  {
118  return $state;
119  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12

Field Documentation

◆ $access

ilAccess ilLegacyKioskModeView::$access
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilLegacyKioskModeView::$lng
protected

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

Referenced by __construct().

◆ $object

ilObject ilLegacyKioskModeView::$object
protected

Definition at line 31 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 29 of file class.ilLegacyKioskModeView.php.


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