ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjLearningSequenceContentGUI Class Reference
+ Collaboration diagram for ilObjLearningSequenceContentGUI:

Public Member Functions

 __construct (protected ilObjLearningSequenceGUI $parent_gui, protected ilCtrl $ctrl, protected ilGlobalTemplateInterface $tpl, protected ilLanguage $lng, protected ilAccess $access, protected ilConfirmationGUI $confirmation_gui, protected LSItemOnlineStatus $ls_item_online_status, protected ArrayBasedRequestWrapper $post_wrapper, protected Factory $refinery, protected ILIAS\UI\Factory $ui_factory, protected 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 ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

48 {
49 }

Member Function Documentation

◆ confirmDelete()

ilObjLearningSequenceContentGUI::confirmDelete ( )
protected

Handle the confirmDelete command.

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

124 : void
125 {
126 $this->parent_gui->deleteObject();
127 }

◆ delete()

ilObjLearningSequenceContentGUI::delete ( )
protected

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

129 : void
130 {
131 $ref_ids = $this->post_wrapper->retrieve(
132 "id",
133 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
134 );
135
136 $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
137
138 $this->tpl->setOnScreenMessage("success", $this->lng->txt('entries_deleted'), true);
139 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
140 }

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 51 of file class.ilObjLearningSequenceContentGUI.php.

51 : void
52 {
53 if (!$this->access->checkAccess("read", '', $this->parent_gui->getRefId())) {
54 $this->tpl->setOnScreenMessage('info', sprintf(
55 $this->lng->txt('msg_no_perm_read_item'),
56 $this->parent_gui->getObjTitle()
57 ), true);
58
59 $this->ctrl->redirect($this->parent_gui, 'view');
60 }
61
62 $cmd = $this->ctrl->getCmd();
63
64 switch ($cmd) {
66 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
67 break;
68 case 'view':
70 // no break
72 case self::CMD_SAVE:
75 $this->$cmd();
76 break;
77 default:
78 throw new ilException("ilObjLearningSequenceContentGUI: Command not supported: $cmd");
79 }
80 }
Base class for ILIAS Exception handling.

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

+ Here is the call graph for this function:

◆ getFieldName()

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

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

151 : string
152 {
153 return implode('_', [$field_name, (string) $ref_id]);
154 }
$ref_id
Definition: ltiauth.php:66

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 145 of file class.ilObjLearningSequenceContentGUI.php.

145 : array
146 {
147 return $this->parent_gui->getObject()->getPossiblePostConditionsForType($type);
148 }

◆ manageContent()

ilObjLearningSequenceContentGUI::manageContent ( )
protected

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

82 : void
83 {
84 // Adds a btn to the gui which allows adding possible objects.
85 $this->parent_gui->showPossibleSubObjects();
86
87 $data = $this->parent_gui->getObject()->getLSItems();
88 // Sadly, ilTable2 only wants an array for fillRow, so we need to wrap this...
89 $data = array_map(fn($s) => [$s], $data);
90 $this->renderTable($data);
91 }

References $data, and renderTable().

+ Here is the call graph for this function:

◆ renderTable()

ilObjLearningSequenceContentGUI::renderTable ( array  $ls_items)
protected

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

93 : void
94 {
95 $alert_icon = $this->ui_renderer->render(
96 $this->ui_factory->symbol()->icon()
97 ->custom(ilUtil::getImagePath("standard/icon_alert.svg"), $this->lng->txt("warning"))
98 ->withSize('small')
99 );
101 $this,
102 $this->parent_gui,
103 self::CMD_MANAGE_CONTENT,
104 $this->ctrl,
105 $this->lng,
106 $this->access,
107 $this->ui_factory,
108 $this->ui_renderer,
109 $this->ls_item_online_status,
110 $alert_icon
111 );
112
113 $table->setData($ls_items);
114 $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->lng->txt("delete"));
115
116 $table->addCommandButton(self::CMD_SAVE, $this->lng->txt("save"));
117
118 $this->tpl->setContent($table->getHtml());
119 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), 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 156 of file class.ilObjLearningSequenceContentGUI.php.

156 : void
157 {
158 $data = $this->parent_gui->getObject()->getLSItems();
159 $r = $this->refinery;
160
161 $updated = [];
162 foreach ($data as $lsitem) {
163 $ref_id = $lsitem->getRefId();
164 $online = $this->getFieldName(self::FIELD_ONLINE, $ref_id);
165 $order = $this->getFieldName(self::FIELD_ORDER, $ref_id);
166 $condition_type = $this->getFieldName(self::FIELD_POSTCONDITION_TYPE, $ref_id);
167
168 $condition_type = $this->post_wrapper->retrieve($condition_type, $r->kindlyTo()->string());
169 $online = $this->post_wrapper->retrieve($online, $r->byTrying([$r->kindlyTo()->bool(), $r->always(false)]));
170 $order = $this->post_wrapper->retrieve(
171 $order,
172 $r->in()->series([
173 $r->kindlyTo()->string(),
174 $r->custom()->transformation(fn($v) => ltrim($v, '0')),
175 $r->kindlyTo()->int()
176 ])
177 );
178
179 $condition = $lsitem->getPostCondition()
180 ->withConditionOperator($condition_type);
181 $updated[] = $lsitem
182 ->withOnline($online)
183 ->withOrderNumber($order)
184 ->withPostCondition($condition);
185 }
186
187 $this->parent_gui->getObject()->storeLSItems($updated);
188 $this->tpl->setOnScreenMessage("success", $this->lng->txt('entries_updated'), true);
189 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
190 }

References $data, $ref_id, ILIAS\UI\examples\Layout\Page\Standard\$refinery, ILIAS\Repository\ctrl(), getFieldName(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

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