ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjLearningSequenceContentGUI Class Reference

Class ilObjLearningSequenceContentGUI. More...

+ 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)
 
 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

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 
)

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

31 {
32 $this->parent_gui = $parent_gui;
33 $this->ctrl = $ctrl;
34 $this->tpl = $tpl;
35 $this->lng = $lng;
36 $this->access = $access;
37 $this->confirmation_gui = $confirmation_gui;
38 $this->ls_item_online_status = $ls_item_online_status;
39 }
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $lng, and $tpl.

Member Function Documentation

◆ confirmDelete()

ilObjLearningSequenceContentGUI::confirmDelete ( )
protected

Handle the confirmDelete command.

Returns
void

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

95 {
96 $ref_ids = $_POST["id"];
97
98 if (!$ref_ids || count($ref_ids) < 1) {
99 ilUtil::sendInfo($this->lng->txt('no_entries_selected_for_delete'), true);
100 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
101 }
102
103 foreach ($ref_ids as $ref_id) {
105 $this->confirmation_gui->addItem("id[]", $ref_id, $obj->getTitle());
106 }
107
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);
112
113 $this->tpl->setContent($this->confirmation_gui->getHTML());
114 }
$_POST["username"]
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_POST, ilObjectFactory\getInstanceByRefId(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ delete()

ilObjLearningSequenceContentGUI::delete ( )
protected

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

117 {
118 $ref_ids = $_POST["id"];
119
120 $ref_ids = array_map(function ($i) {
121 return (int) $i;
122 }, $ref_ids);
123
124 $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
125
126 ilUtil::sendSuccess($this->lng->txt('entries_deleted'), true);
127 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
128 }
$i
Definition: metadata.php:24

References $_POST, and $i.

◆ executeCommand()

ilObjLearningSequenceContentGUI::executeCommand ( )

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

42 {
43 $cmd = $this->ctrl->getCmd();
44
45 switch ($cmd) {
47 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
48 break;
50 case self::CMD_SAVE:
53 $this->$cmd();
54 break;
55 default:
56 throw new ilException("ilObjLearningSequenceContentGUI: Command not supported: $cmd");
57 }
58 }
Base class for ILIAS Exception handling.

References CMD_CANCEL, CMD_CONFIRM_DELETE, CMD_DELETE, CMD_MANAGE_CONTENT, and CMD_SAVE.

◆ getFieldName()

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

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

137 : string
138 {
139 return implode('_', [$field_name, (string) $ref_id]);
140 }

Referenced by save().

+ Here is the caller graph for this function:

◆ getPossiblePostConditionsForType()

ilObjLearningSequenceContentGUI::getPossiblePostConditionsForType ( string  $type)

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

131 : array
132 {
133 return $this->parent_gui->getObject()->getPossiblePostConditionsForType($type);
134 }
$type

References $type.

◆ manageContent()

ilObjLearningSequenceContentGUI::manageContent ( )
protected

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

61 {
62 // Adds a btn to the gui which allows adding possible objects.
63 $this->parent_gui->showPossibleSubObjects();
64
65 $data = $this->parent_gui->getObject()->getLSItems();
66 $this->renderTable($data);
67 }
$data
Definition: storeScorm.php:23

References $data, and renderTable().

+ Here is the call graph for this function:

◆ renderTable()

ilObjLearningSequenceContentGUI::renderTable ( array  $ls_items)
protected

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

70 {
72 $this,
73 self::CMD_MANAGE_CONTENT,
74 $this->ctrl,
75 $this->lng,
76 $this->access,
78 $this->ls_item_online_status
79 );
80
81 $table->setData($ls_items);
82 $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->lng->txt("delete"));
83
84 $table->addCommandButton(self::CMD_SAVE, $this->lng->txt("save"));
85
86 $this->tpl->setContent($table->getHtml());
87 }
User interface class for advanced drop-down selection lists.

Referenced by manageContent().

+ Here is the caller graph for this function:

◆ save()

ilObjLearningSequenceContentGUI::save ( )
protected

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

143 {
144 $post = $_POST;
145 $data = $this->parent_gui->getObject()->getLSItems();
146
147 $updated = [];
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);
153
154 $condition = $lsitem->getPostCondition()
155 ->withConditionOperator($post[$condition_type]);
156 $updated[] = $lsitem
157 ->withOnline((bool) $post[$online])
158 ->withOrderNumber((int) $post[$order])
159 ->withPostCondition($condition);
160 }
161
162 $this->parent_gui->getObject()->storeLSItems($updated);
163
164 ilUtil::sendSuccess($this->lng->txt('entries_updated'), true);
165 $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
166 }

References $_POST, $data, and getFieldName().

+ Here is the call graph for this function:

Field Documentation

◆ CMD_CANCEL

const ilObjLearningSequenceContentGUI::CMD_CANCEL = "cancel"

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

Referenced by executeCommand().

◆ CMD_CONFIRM_DELETE

const ilObjLearningSequenceContentGUI::CMD_CONFIRM_DELETE = "confirmDelete"

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

Referenced by executeCommand().

◆ CMD_DELETE

const ilObjLearningSequenceContentGUI::CMD_DELETE = "delete"

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

Referenced by executeCommand().

◆ CMD_MANAGE_CONTENT

const ilObjLearningSequenceContentGUI::CMD_MANAGE_CONTENT = "manageContent"

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

Referenced by executeCommand().

◆ CMD_SAVE

const ilObjLearningSequenceContentGUI::CMD_SAVE = "save"

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

Referenced by executeCommand().

◆ FIELD_ONLINE

const ilObjLearningSequenceContentGUI::FIELD_ONLINE = 'f_online'

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

◆ FIELD_ORDER

const ilObjLearningSequenceContentGUI::FIELD_ORDER = 'f_order'

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

◆ FIELD_POSTCONDITION_TYPE

const ilObjLearningSequenceContentGUI::FIELD_POSTCONDITION_TYPE = 'f_pct'

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


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