ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 @inheritDoc More...
 
 buildControls (State $state, ControlBuilder $builder)
 @inheritDoc More...
 
 updateGet (State $state, string $command, ?int $parameter=null)
 @inheritDoc More...
 
 updatePost (State $state, string $command, array $post)
 @inheritDoc More...
 
 render (State $state, Factory $factory, URLBuilder $url_builder, ?array $post=null)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\KioskMode\View
 buildInitialState (State $empty_state)
 Build an initial state based on the Provided empty state. More...
 
 buildControls (State $state, ControlBuilder $builder)
 Construct the controls for the view based on the current state. More...
 
 updateGet (State $state, string $command, ?int $parameter=null)
 Update the state based on the provided command. More...
 
 updatePost (State $state, string $command, array $post)
 Update the state and the object based on the provided command and post-data. More...
 
 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 
)

@inheritDoc

Implements ILIAS\KioskMode\View.

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

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 }
static _getListGUIByType(string $type, int $context=ilObjectListGUI::CONTEXT_REPOSITORY)
Build controls for the view.
$ref_id
Definition: ltiauth.php:66
$url
Definition: shib_logout.php:68

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

+ Here is the call graph for this function:

◆ buildInitialState()

ilLegacyKioskModeView::buildInitialState ( State  $empty_state)

@inheritDoc

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:27

◆ getMetadata()

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

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

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 }

References ILIAS\Repository\lng().

+ Here is the call 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.

191 : string
192 {
193 return $this->lng->txt("obj_" . $type);
194 }

References ILIAS\Repository\lng().

+ Here is the call 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 
)

@inheritDoc

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

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 }

◆ setObject()

ilLegacyKioskModeView::setObject ( \ilObject  $object)
protected

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

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

References $object.

◆ updateGet()

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

@inheritDoc

Implements ILIAS\KioskMode\View.

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

112 : State
113 {
114 return $state;
115 }

◆ updatePost()

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

@inheritDoc

Implements ILIAS\KioskMode\View.

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

120 : State
121 {
122 return $state;
123 }

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: