ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLegacyKioskModeView Class Reference

Class ilLegacyKioskModeView. More...

+ 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 $param=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

 $object
 

Private Member Functions

 getMetadata (int $obj_id, string $type)
 
 debugBuildAllControls (ControlBuilder $builder)
 
 getTitleByType (string $type)
 

Detailed Description

Class ilLegacyKioskModeView.

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $lng, and $object.

24  {
25  $this->object = $object;
26  $this->lng = $lng;
27  $this->access = $access;
28  }
$lng

Member Function Documentation

◆ buildControls()

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

Implements ILIAS\KioskMode\View.

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

References $builder, $type, $url, ilObjectListGUIFactory\_getListGUIByType(), ilLink\_getStaticLink(), and getTitleByType().

64  {
65  if (!$builder instanceof LSControlBuilder) {
66  throw new LogicException("The Legacy Mode in the Learning Sequence requires an LSControlBuilder explicitely.", 1);
67  }
68 
69  $ref_id = $this->object->getRefId();
70  $type = $this->object->getType();
71 
72  $label = sprintf(
73  $this->lng->txt('lso_start_item'),
74  $this->getTitleByType($type)
75  );
76 
78  $ref_id,
79  $type,
80  true,
81  false
82  );
83 
84  if (in_array($type, self::GET_VIEW_CMD_FROM_LIST_GUI_FOR)) {
85  $obj_id = $this->object->getId();
87  $item_list_gui->initItem($ref_id, $obj_id, $type);
88  $view_link = $item_list_gui->getCommandLink('view');
89  $view_link = str_replace('&', '&', $view_link);
90  $view_link = ILIAS_HTTP_PATH . '/' . $view_link;
91  $url = $view_link;
92  }
93 
94  $builder->start($label, $url, 0);
95 
96  // return $this->debugBuildAllControls($builder);
97  return $builder;
98  }
$type
static _getListGUIByType( $type, $context=ilObjectListGUI::CONTEXT_REPOSITORY)
Class LSControlBuilder.
Build controls for the view.
$url
$builder
Definition: parser.php:5
+ Here is the call graph for this function:

◆ buildInitialState()

ilLegacyKioskModeView::buildInitialState ( State  $empty_state)

Implements ILIAS\KioskMode\View.

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

55  : State
56  {
57  return $empty_state;
58  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:9

◆ debugBuildAllControls()

ilLegacyKioskModeView::debugBuildAllControls ( ControlBuilder  $builder)
private

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

References $builder, getObjectTitle(), and ILIAS\KioskMode\ControlBuilder\tableOfContent().

172  {
173  $builder
174 
175  ->tableOfContent($this->getObjectTitle(), 'kommando', 666)
176  ->node('node1')
177  ->item('item1.1', 1)
178  ->item('item1.2', 11)
179  ->end()
180  ->item('item2', 111)
181  ->node('node3', 1111)
182  ->item('item3.1', 2)
183  ->node('node3.2')
184  ->item('item3.2.1', 122)
185  ->end()
186  ->end()
187  ->end()
188 
189  ->locator('locator_cmd')
190  ->item('item 1', 1)
191  ->item('item 2', 2)
192  ->item('item 3', 3)
193  ->end()
194 
195  ->done('cmd', 1)
196  ->next('cmd', 1)
197  ->previous('', 1)
198  //->exit('cmd', 1)
199  ->generic('cmd 1', 'x', 1)
200  ->generic('cmd 2', 'x', 2)
201  //->toggle('toggle', 'cmd_on', 'cmd_off')
202  ->mode('modecmd', ['m1', 'm2', 'm3'])
203  ;
204 
205  return $builder;
206  }
tableOfContent(string $label, string $command, int $parameter=null, $state=null)
A table of content allows the user to get an overview over the generally available content in the obj...
Build controls for the view.
$builder
Definition: parser.php:5
+ Here is the call graph for this function:

◆ getMetadata()

ilLegacyKioskModeView::getMetadata ( int  $obj_id,
string  $type 
)
private

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

References $section.

Referenced by render().

143  : array
144  {
145  $md = new ilMD($obj_id, 0, $type);
146  $meta_data = [];
147 
148  $section = $md->getGeneral();
149  if (!$section) {
150  return [];
151  }
152 
153  $meta_data['language'] = [];
154  foreach ($section->getLanguageIds() as $id) {
155  $meta_data['language'][] = $section->getLanguage($id)->getLanguageCode();
156  }
157  $meta_data['keywords'] = [];
158  foreach ($section->getKeywordIds() as $id) {
159  $meta_data['keywords'][] = $section->getKeyword($id)->getKeyword();
160  }
161 
162  $md_flat = [];
163  foreach ($meta_data as $md_label => $values) {
164  if (count($values) > 0) {
165  $md_flat[$this->lng->txt($md_label)] = implode(', ', $values);
166  }
167  }
168  return $md_flat;
169  }
$type
$section
Definition: Utf8Test.php:83
+ Here is the caller graph for this function:

◆ getObjectTitle()

ilLegacyKioskModeView::getObjectTitle ( )
protected

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

Referenced by debugBuildAllControls().

30  : string
31  {
32  return $this->object->getTitle();
33  }
+ Here is the caller graph for this function:

◆ getTitleByType()

ilLegacyKioskModeView::getTitleByType ( string  $type)
private

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

Referenced by buildControls().

208  : string
209  {
210  return $this->lng->txt("obj_" . $type);
211  }
$type
+ Here is the caller graph for this function:

◆ hasPermissionToAccessKioskMode()

ilLegacyKioskModeView::hasPermissionToAccessKioskMode ( )
protected

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

46  : bool
47  {
48  return true;
49  //return $this->access->checkAccess('read', '', $this->contentPageObject->getRefId());
50  }

◆ render()

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

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

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

124  : Component {
125  $obj_type = $this->object->getType();
126  $obj_type_txt = $this->lng->txt('obj_' . $obj_type);
127  $icon = $factory->symbol()->icon()->standard($obj_type, $obj_type_txt, 'large');
128  $md = $this->getMetadata((int) $this->object->getId(), $obj_type);
129  $props = array_merge(
130  [$this->lng->txt('obj_type') => $obj_type_txt],
131  $this->getMetadata((int) $this->object->getId(), $obj_type)
132  );
133 
134  $info = $factory->item()->standard($this->object->getTitle())
135  ->withLeadIcon($icon)
136  ->withDescription($this->object->getDescription())
137  ->withProperties($props);
138 
139  return $info;
140  }
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.
getMetadata(int $obj_id, string $type)
+ Here is the call graph for this function:

◆ setObject()

ilLegacyKioskModeView::setObject ( \ilObject  $object)
protected

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

References $object.

39  {
40  $this->object = $object;
41  }

◆ updateGet()

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

Implements ILIAS\KioskMode\View.

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

103  : State
104  {
105  return $state;
106  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:9

◆ updatePost()

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

Implements ILIAS\KioskMode\View.

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

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

Field Documentation

◆ $object

ilLegacyKioskModeView::$object
protected

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


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