3 declare(strict_types=1);
32 $this->parent_gui = $parent_gui;
36 $this->access = $access;
37 $this->confirmation_gui = $confirmation_gui;
38 $this->ls_item_online_status = $ls_item_online_status;
43 $cmd = $this->ctrl->getCmd();
46 case self::CMD_CANCEL:
47 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
49 case self::CMD_MANAGE_CONTENT:
51 case self::CMD_DELETE:
52 case self::CMD_CONFIRM_DELETE:
56 throw new ilException(
"ilObjLearningSequenceContentGUI: Command not supported: $cmd");
63 $this->parent_gui->showPossibleSubObjects();
65 $data = $this->parent_gui->getObject()->getLSItems();
73 self::CMD_MANAGE_CONTENT,
78 $this->ls_item_online_status
81 $table->setData($ls_items);
82 $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->lng->txt(
"delete"));
84 $table->addCommandButton(self::CMD_SAVE, $this->lng->txt(
"save"));
86 $this->tpl->setContent(
$table->getHtml());
98 if (count($ref_ids) < 1) {
100 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
103 foreach ($ref_ids as $ref_id) {
105 $this->confirmation_gui->addItem(
"id[]", $ref_id, $obj->getTitle());
108 $this->confirmation_gui->setFormAction($this->ctrl->getFormAction($this));
109 $this->confirmation_gui->setHeaderText($this->lng->txt(
"delete_confirmation"));
110 $this->confirmation_gui->setConfirm($this->lng->txt(
"confirm"), self::CMD_DELETE);
111 $this->confirmation_gui->setCancel($this->lng->txt(
"cancel"), self::CMD_CANCEL);
113 $this->tpl->setContent($this->confirmation_gui->getHTML());
116 protected function delete()
120 $ref_ids = array_map(
function (
$i) {
124 $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
126 ilUtil::sendSuccess($this->lng->txt(
'entries_deleted'),
true);
127 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
133 return $this->parent_gui->getObject()->getPossiblePostConditionsForType($type);
139 return implode(
'_', [$field_name, (
string) $ref_id]);
145 $data = $this->parent_gui->getObject()->getLSItems();
148 foreach (
$data as $lsitem) {
149 $ref_id = $lsitem->getRefId();
150 $online = $this->
getFieldName(self::FIELD_ONLINE, $ref_id);
151 $order = $this->
getFieldName(self::FIELD_ORDER, $ref_id);
152 $condition_type = $this->
getFieldName(self::FIELD_POSTCONDITION_TYPE, $ref_id);
154 $condition = $lsitem->getPostCondition()
155 ->withConditionOperator(
$post[$condition_type]);
157 ->withOnline((
bool)
$post[$online])
158 ->withOrderNumber((
int)
$post[$order])
159 ->withPostCondition($condition);
162 $this->parent_gui->getObject()->storeLSItems($updated);
164 ilUtil::sendSuccess($this->lng->txt(
'entries_updated'),
true);
165 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
This class provides processing control methods.
getFieldName(string $field_name, int $ref_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
confirmDelete()
Handle the confirmDelete command.
special template class to simplify handling of ITX/PEAR
Class ilObjLearningSequenceContentGUI.
__construct(ilObjLearningSequenceGUI $parent_gui, ilCtrl $ctrl, ilTemplate $tpl, ilLanguage $lng, ilAccess $access, ilConfirmationGUI $confirmation_gui, LSItemOnlineStatus $ls_item_online_status)
getPossiblePostConditionsForType(string $type)
renderTable(array $ls_items)
User interface class for advanced drop-down selection lists.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjLearningSequenceGUI.
if(empty($password)) $table
const FIELD_POSTCONDITION_TYPE
Confirmation screen class.