ILIAS  release_8 Revision v8.24
ilObjLearningSequenceContentGUI Class Reference
+ Collaboration diagram for ilObjLearningSequenceContentGUI:

Public Member Functions

 __construct (ilObjLearningSequenceGUI $parent_gui, ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilAccess $access, ilConfirmationGUI $confirmation_gui, LSItemOnlineStatus $ls_item_online_status, ArrayBasedRequestWrapper $post_wrapper, Factory $refinery, ILIAS\UI\Factory $ui_factory, ILIAS\UI\Renderer $ui_renderer)
 
 executeCommand ()
 
 getPossiblePostConditionsForType (string $type)
 
 getFieldName (string $field_name, int $ref_id)
 

Data Fields

const CMD_MANAGE_CONTENT = "manageContent"
 
const CMD_SAVE = "save"
 
const CMD_DELETE = "delete"
 
const CMD_CONFIRM_DELETE = "confirmDelete"
 
const CMD_CANCEL = "cancel"
 
const FIELD_ORDER = 'f_order'
 
const FIELD_ONLINE = 'f_online'
 
const FIELD_POSTCONDITION_TYPE = 'f_pct'
 

Protected Member Functions

 manageContent ()
 
 renderTable (array $ls_items)
 
 confirmDelete ()
 Handle the confirmDelete command. More...
 
 delete ()
 
 save ()
 

Protected Attributes

ilObjLearningSequenceGUI $parent_gui
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilAccess $access
 
ilConfirmationGUI $confirmation_gui
 
LSItemOnlineStatus $ls_item_online_status
 
ArrayBasedRequestWrapper $post_wrapper
 
ILIAS Refinery Factory $refinery
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $ui_renderer
 

Detailed Description

Definition at line 24 of file class.ilObjLearningSequenceContentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjLearningSequenceContentGUI::__construct ( ilObjLearningSequenceGUI  $parent_gui,
ilCtrl  $ctrl,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilAccess  $access,
ilConfirmationGUI  $confirmation_gui,
LSItemOnlineStatus  $ls_item_online_status,
ArrayBasedRequestWrapper  $post_wrapper,
Factory  $refinery,
ILIAS\UI\Factory  $ui_factory,
ILIAS\UI\Renderer  $ui_renderer 
)

Definition at line 48 of file class.ilObjLearningSequenceContentGUI.php.

60 {
61 $this->parent_gui = $parent_gui;
62 $this->ctrl = $ctrl;
63 $this->tpl = $tpl;
64 $this->lng = $lng;
65 $this->access = $access;
66 $this->confirmation_gui = $confirmation_gui;
67 $this->ls_item_online_status = $ls_item_online_status;
68 $this->post_wrapper = $post_wrapper;
69 $this->refinery = $refinery;
70 $this->ui_factory = $ui_factory;
71 $this->ui_renderer = $ui_renderer;
72 }

References $access, $confirmation_gui, $ctrl, $lng, $ls_item_online_status, $parent_gui, $post_wrapper, $refinery, $tpl, $ui_factory, $ui_renderer, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDelete()

ilObjLearningSequenceContentGUI::confirmDelete ( )
protected

Handle the confirmDelete command.

Definition at line 130 of file class.ilObjLearningSequenceContentGUI.php.

130 : void
131 {
132 $r = $this->refinery;
133 $ref_ids = $this->post_wrapper->retrieve(
134 "id",
135 $r->byTrying([
136 $r->kindlyTo()->listOf($r->kindlyTo()->int()),
137 $r->always([])
138 ])
139 );
140
141 if (!$ref_ids || count($ref_ids) < 1) {
142 $this->tpl->setOnScreenMessage("info", $this->lng->txt('no_entries_selected_for_delete'), true);
143 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
144 }
145
146 foreach ($ref_ids as $ref_id) {
148 $this->confirmation_gui->addItem("id[]", (string) $ref_id, $obj->getTitle());
149 }
150
151 $this->confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
152 $this->confirmation_gui->setHeaderText($this->lng->txt("delete_confirmation"));
153 $this->confirmation_gui->setConfirm($this->lng->txt("confirm"), self::CMD_DELETE);
154 $this->confirmation_gui->setCancel($this->lng->txt("cancel"), self::CMD_CANCEL);
155
156 $this->tpl->setContent($this->confirmation_gui->getHTML());
157 }
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
$ref_id
Definition: ltiauth.php:67

References $ref_id, $refinery, ILIAS\Repository\ctrl(), ilObjectFactory\getInstanceByRefId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ delete()

ilObjLearningSequenceContentGUI::delete ( )
protected

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

159 : void
160 {
161 $ref_ids = $this->post_wrapper->retrieve(
162 "id",
163 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
164 );
165
166 $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
167
168 $this->tpl->setOnScreenMessage("success", $this->lng->txt('entries_deleted'), true);
169 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
170 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjLearningSequenceContentGUI::executeCommand ( )

Definition at line 74 of file class.ilObjLearningSequenceContentGUI.php.

74 : void
75 {
76 $cmd = $this->ctrl->getCmd();
77
78 switch ($cmd) {
80 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
81 break;
83 case self::CMD_SAVE:
86 $this->$cmd();
87 break;
88 default:
89 throw new ilException("ilObjLearningSequenceContentGUI: Command not supported: $cmd");
90 }
91 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References CMD_CANCEL, CMD_CONFIRM_DELETE, CMD_DELETE, CMD_MANAGE_CONTENT, CMD_SAVE, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getFieldName()

ilObjLearningSequenceContentGUI::getFieldName ( string  $field_name,
int  $ref_id 
)

Definition at line 181 of file class.ilObjLearningSequenceContentGUI.php.

181 : string
182 {
183 return implode('_', [$field_name, (string) $ref_id]);
184 }

References $ref_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ getPossiblePostConditionsForType()

ilObjLearningSequenceContentGUI::getPossiblePostConditionsForType ( string  $type)
Returns
array<"value" => "option_text">

Definition at line 175 of file class.ilObjLearningSequenceContentGUI.php.

175 : array
176 {
177 return $this->parent_gui->getObject()->getPossiblePostConditionsForType($type);
178 }
$type

References $type.

◆ manageContent()

ilObjLearningSequenceContentGUI::manageContent ( )
protected

Definition at line 93 of file class.ilObjLearningSequenceContentGUI.php.

93 : void
94 {
95 // Adds a btn to the gui which allows adding possible objects.
96 $this->parent_gui->showPossibleSubObjects();
97
98 $data = $this->parent_gui->getObject()->getLSItems();
99 // Sadly, ilTable2 only wants an array for fillRow, so we need to wrap this...
100 $data = array_map(fn ($s) => [$s], $data);
101 $this->renderTable($data);
102 }

References $data, and renderTable().

+ Here is the call graph for this function:

◆ renderTable()

ilObjLearningSequenceContentGUI::renderTable ( array  $ls_items)
protected

Definition at line 104 of file class.ilObjLearningSequenceContentGUI.php.

104 : void
105 {
107 $this,
108 $this->parent_gui,
109 self::CMD_MANAGE_CONTENT,
110 $this->ctrl,
111 $this->lng,
112 $this->access,
113 $this->ui_factory,
114 $this->ui_renderer,
116 $this->ls_item_online_status
117 );
118
119 $table->setData($ls_items);
120 $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->lng->txt("delete"));
121
122 $table->addCommandButton(self::CMD_SAVE, $this->lng->txt("save"));
123
124 $this->tpl->setContent($table->getHtml());
125 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by manageContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjLearningSequenceContentGUI::save ( )
protected

Definition at line 186 of file class.ilObjLearningSequenceContentGUI.php.

186 : void
187 {
188 $data = $this->parent_gui->getObject()->getLSItems();
189 $r = $this->refinery;
190
191 $updated = [];
192 foreach ($data as $lsitem) {
193 $ref_id = $lsitem->getRefId();
194 $online = $this->getFieldName(self::FIELD_ONLINE, $ref_id);
195 $order = $this->getFieldName(self::FIELD_ORDER, $ref_id);
196 $condition_type = $this->getFieldName(self::FIELD_POSTCONDITION_TYPE, $ref_id);
197
198 $condition_type = $this->post_wrapper->retrieve($condition_type, $r->kindlyTo()->string());
199 $online = $this->post_wrapper->retrieve($online, $r->byTrying([$r->kindlyTo()->bool(), $r->always(false)]));
200 $order = $this->post_wrapper->retrieve($order, $r->kindlyTo()->int());
201
202 $condition = $lsitem->getPostCondition()
203 ->withConditionOperator($condition_type);
204 $updated[] = $lsitem
205 ->withOnline($online)
206 ->withOrderNumber($order)
207 ->withPostCondition($condition);
208 }
209
210 $this->parent_gui->getObject()->storeLSItems($updated);
211 $this->tpl->setOnScreenMessage("success", $this->lng->txt('entries_updated'), true);
212 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
213 }
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158

References $data, $ref_id, $refinery, ILIAS\LTI\ToolProvider\$updated, ILIAS\Repository\ctrl(), getFieldName(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccess ilObjLearningSequenceContentGUI::$access
protected

Definition at line 40 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct().

◆ $confirmation_gui

ilConfirmationGUI ilObjLearningSequenceContentGUI::$confirmation_gui
protected

Definition at line 41 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilObjLearningSequenceContentGUI::$ctrl
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilObjLearningSequenceContentGUI::$lng
protected

Definition at line 39 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct().

◆ $ls_item_online_status

LSItemOnlineStatus ilObjLearningSequenceContentGUI::$ls_item_online_status
protected

Definition at line 42 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct().

◆ $parent_gui

ilObjLearningSequenceGUI ilObjLearningSequenceContentGUI::$parent_gui
protected

Definition at line 36 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct().

◆ $post_wrapper

ArrayBasedRequestWrapper ilObjLearningSequenceContentGUI::$post_wrapper
protected

Definition at line 43 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct().

◆ $refinery

ILIAS Refinery Factory ilObjLearningSequenceContentGUI::$refinery
protected

Definition at line 44 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by __construct(), confirmDelete(), and save().

◆ $tpl

ilGlobalTemplateInterface ilObjLearningSequenceContentGUI::$tpl
protected

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

Referenced by __construct().

◆ $ui_factory

ILIAS UI Factory ilObjLearningSequenceContentGUI::$ui_factory
protected

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

Referenced by __construct().

◆ $ui_renderer

ILIAS UI Renderer ilObjLearningSequenceContentGUI::$ui_renderer
protected

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

Referenced by __construct().

◆ CMD_CANCEL

const ilObjLearningSequenceContentGUI::CMD_CANCEL = "cancel"

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

Referenced by executeCommand().

◆ CMD_CONFIRM_DELETE

const ilObjLearningSequenceContentGUI::CMD_CONFIRM_DELETE = "confirmDelete"

Definition at line 29 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by executeCommand().

◆ CMD_DELETE

const ilObjLearningSequenceContentGUI::CMD_DELETE = "delete"

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

Referenced by executeCommand().

◆ CMD_MANAGE_CONTENT

const ilObjLearningSequenceContentGUI::CMD_MANAGE_CONTENT = "manageContent"

Definition at line 26 of file class.ilObjLearningSequenceContentGUI.php.

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjLearningSequenceContentGUI::CMD_SAVE = "save"

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

Referenced by executeCommand().

◆ FIELD_ONLINE

const ilObjLearningSequenceContentGUI::FIELD_ONLINE = 'f_online'

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

◆ FIELD_ORDER

const ilObjLearningSequenceContentGUI::FIELD_ORDER = 'f_order'

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

◆ FIELD_POSTCONDITION_TYPE

const ilObjLearningSequenceContentGUI::FIELD_POSTCONDITION_TYPE = 'f_pct'

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


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