19 declare(strict_types=1);
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()
59 $this->
ctrl->redirect($this->parent_gui,
'view');
62 $cmd = $this->
ctrl->getCmd();
65 case self::CMD_CANCEL:
66 $this->
ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
69 $cmd = self::CMD_MANAGE_CONTENT;
71 case self::CMD_MANAGE_CONTENT:
73 case self::CMD_DELETE:
74 case self::CMD_CONFIRM_DELETE:
78 throw new ilException(
"ilObjLearningSequenceContentGUI: Command not supported: $cmd");
85 $this->parent_gui->showPossibleSubObjects();
87 $data = $this->parent_gui->getObject()->getLSItems();
95 $alert_icon = $this->ui_renderer->render(
96 $this->ui_factory->symbol()->icon()
103 self::CMD_MANAGE_CONTENT,
109 $this->ls_item_online_status,
113 $table->setData($ls_items);
114 $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->
lng->txt(
"delete"));
116 $table->addCommandButton(self::CMD_SAVE, $this->
lng->txt(
"save"));
118 $this->tpl->setContent($table->getHtml());
126 $this->parent_gui->deleteObject();
129 protected function delete():
void 131 $ref_ids = $this->post_wrapper->retrieve(
136 $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
138 $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
'entries_deleted'),
true);
139 $this->
ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
147 return $this->parent_gui->getObject()->getPossiblePostConditionsForType($type);
153 return implode(
'_', [$field_name, (
string) $ref_id]);
156 protected function save(): void
158 $data = $this->parent_gui->getObject()->getLSItems();
162 foreach (
$data as $lsitem) {
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(
173 $r->kindlyTo()->string(),
174 $r->custom()->transformation(fn($v) => ltrim($v,
'0')),
175 $r->kindlyTo()->int()
179 $condition = $lsitem->getPostCondition()
180 ->withConditionOperator($condition_type);
182 ->withOnline($online)
183 ->withOrderNumber($order)
184 ->withPostCondition($condition);
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);
Interface Observer Contains several chained tasks and infos about them.
getFieldName(string $field_name, int $ref_id)
confirmDelete()
Handle the confirmDelete command.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getPossiblePostConditionsForType(string $type)
renderTable(array $ls_items)
Class ilObjLearningSequenceGUI ilObjLearningSequenceGUI: ilRepositoryGUI ilObjLearningSequenceGUI: ...
__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)
const FIELD_POSTCONDITION_TYPE
Class ArrayBasedRequestWrapper.