19 declare(strict_types=1);
76 $cmd = $this->
ctrl->getCmd();
79 case self::CMD_CANCEL:
80 $this->
ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
82 case self::CMD_MANAGE_CONTENT:
84 case self::CMD_DELETE:
85 case self::CMD_CONFIRM_DELETE:
89 throw new ilException(
"ilObjLearningSequenceContentGUI: Command not supported: $cmd");
96 $this->parent_gui->showPossibleSubObjects();
98 $data = $this->parent_gui->getObject()->getLSItems();
109 self::CMD_MANAGE_CONTENT,
116 $this->ls_item_online_status
119 $table->setData($ls_items);
120 $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->
lng->txt(
"delete"));
122 $table->addCommandButton(self::CMD_SAVE, $this->
lng->txt(
"save"));
124 $this->tpl->setContent($table->getHtml());
133 $ref_ids = $this->post_wrapper->retrieve(
136 $r->kindlyTo()->listOf($r->kindlyTo()->int()),
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);
146 foreach ($ref_ids as
$ref_id) {
148 $this->confirmation_gui->addItem(
"id[]", (
string) $ref_id, $obj->getTitle());
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);
156 $this->tpl->setContent($this->confirmation_gui->getHTML());
159 protected function delete():
void 161 $ref_ids = $this->post_wrapper->retrieve(
166 $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
168 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
'entries_deleted'),
true);
169 $this->
ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
177 return $this->parent_gui->getObject()->getPossiblePostConditionsForType($type);
183 return implode(
'_', [$field_name, (
string) $ref_id]);
186 protected function save(): void
188 $data = $this->parent_gui->getObject()->getLSItems();
192 foreach (
$data as $lsitem) {
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());
202 $condition = $lsitem->getPostCondition()
203 ->withConditionOperator($condition_type);
205 ->withOnline($online)
206 ->withOrderNumber($order)
207 ->withPostCondition($condition);
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);
ilObjLearningSequenceGUI $parent_gui
ILIAS UI Factory $ui_factory
Class ChatMainBarProvider .
ilGlobalTemplateInterface $tpl
getFieldName(string $field_name, int $ref_id)
__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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Refinery Factory $refinery
confirmDelete()
Handle the confirmDelete command.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
getPossiblePostConditionsForType(string $type)
renderTable(array $ls_items)
ilConfirmationGUI $confirmation_gui
LSItemOnlineStatus $ls_item_online_status
ArrayBasedRequestWrapper $post_wrapper
Class ilObjLearningSequenceGUI ilObjLearningSequenceGUI: ilRepositoryGUI ilObjLearningSequenceGUI: ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS UI Renderer $ui_renderer
const FIELD_POSTCONDITION_TYPE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...