ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 112 of file class.ilObjLearningSequenceContentGUI.php.

112  : void
113  {
114  $this->parent_gui->deleteObject();
115  }

◆ delete()

ilObjLearningSequenceContentGUI::delete ( )
protected

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

117  : void
118  {
119  $ref_ids = $this->post_wrapper->retrieve(
120  "id",
121  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
122  );
123 
124  $this->parent_gui->getObject()->deletePostConditionsForSubObjects($ref_ids);
125 
126  $this->tpl->setOnScreenMessage("success", $this->lng->txt('entries_deleted'), true);
127  $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
128  }
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLearningSequenceContentGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

51  : void
52  {
53  $cmd = $this->ctrl->getCmd();
54 
55  switch ($cmd) {
56  case self::CMD_CANCEL:
57  $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
58  break;
59  case self::CMD_MANAGE_CONTENT:
60  case self::CMD_SAVE:
61  case self::CMD_DELETE:
62  case self::CMD_CONFIRM_DELETE:
63  $this->$cmd();
64  break;
65  default:
66  throw new ilException("ilObjLearningSequenceContentGUI: Command not supported: $cmd");
67  }
68  }
+ Here is the call graph for this function:

◆ getFieldName()

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

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

Referenced by save().

139  : string
140  {
141  return implode('_', [$field_name, (string) $ref_id]);
142  }
$ref_id
Definition: ltiauth.php:67
+ Here is the caller graph for this function:

◆ getPossiblePostConditionsForType()

ilObjLearningSequenceContentGUI::getPossiblePostConditionsForType ( string  $type)
Returns
array<"value" => "option_text">

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

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

◆ manageContent()

ilObjLearningSequenceContentGUI::manageContent ( )
protected

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

References $data, and renderTable().

70  : void
71  {
72  // Adds a btn to the gui which allows adding possible objects.
73  $this->parent_gui->showPossibleSubObjects();
74 
75  $data = $this->parent_gui->getObject()->getLSItems();
76  // Sadly, ilTable2 only wants an array for fillRow, so we need to wrap this...
77  $data = array_map(fn($s) => [$s], $data);
78  $this->renderTable($data);
79  }
+ Here is the call graph for this function:

◆ renderTable()

ilObjLearningSequenceContentGUI::renderTable ( array  $ls_items)
protected

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

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), and ILIAS\Repository\lng().

Referenced by manageContent().

81  : void
82  {
83  $alert_icon = $this->ui_renderer->render(
84  $this->ui_factory->symbol()->icon()
85  ->custom(ilUtil::getImagePath("standard/icon_alert.svg"), $this->lng->txt("warning"))
86  ->withSize('small')
87  );
89  $this,
90  $this->parent_gui,
91  self::CMD_MANAGE_CONTENT,
92  $this->ctrl,
93  $this->lng,
94  $this->access,
95  $this->ui_factory,
96  $this->ui_renderer,
97  $this->ls_item_online_status,
98  $alert_icon
99  );
100 
101  $table->setData($ls_items);
102  $table->addMultiCommand(self::CMD_CONFIRM_DELETE, $this->lng->txt("delete"));
103 
104  $table->addCommandButton(self::CMD_SAVE, $this->lng->txt("save"));
105 
106  $this->tpl->setContent($table->getHtml());
107  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjLearningSequenceContentGUI::save ( )
protected

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

References $data, $r, $ref_id, ILIAS\Repository\$refinery, ILIAS\LTI\ToolProvider\$updated, ILIAS\Repository\ctrl(), getFieldName(), and ILIAS\Repository\lng().

144  : void
145  {
146  $data = $this->parent_gui->getObject()->getLSItems();
148 
149  $updated = [];
150  foreach ($data as $lsitem) {
151  $ref_id = $lsitem->getRefId();
152  $online = $this->getFieldName(self::FIELD_ONLINE, $ref_id);
153  $order = $this->getFieldName(self::FIELD_ORDER, $ref_id);
154  $condition_type = $this->getFieldName(self::FIELD_POSTCONDITION_TYPE, $ref_id);
155 
156  $condition_type = $this->post_wrapper->retrieve($condition_type, $r->kindlyTo()->string());
157  $online = $this->post_wrapper->retrieve($online, $r->byTrying([$r->kindlyTo()->bool(), $r->always(false)]));
158  $order = $this->post_wrapper->retrieve(
159  $order,
160  $r->in()->series([
161  $r->kindlyTo()->string(),
162  $r->custom()->transformation(fn($v) => ltrim($v, '0')),
163  $r->kindlyTo()->int()
164  ])
165  );
166 
167  $condition = $lsitem->getPostCondition()
168  ->withConditionOperator($condition_type);
169  $updated[] = $lsitem
170  ->withOnline($online)
171  ->withOrderNumber($order)
172  ->withPostCondition($condition);
173  }
174 
175  $this->parent_gui->getObject()->storeLSItems($updated);
176  $this->tpl->setOnScreenMessage("success", $this->lng->txt('entries_updated'), true);
177  $this->ctrl->redirect($this, self::CMD_MANAGE_CONTENT);
178  }
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158
$ref_id
Definition: ltiauth.php:67
$r
Refinery Factory $refinery
+ 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.

◆ CMD_CONFIRM_DELETE

const ilObjLearningSequenceContentGUI::CMD_CONFIRM_DELETE = "confirmDelete"

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

◆ CMD_DELETE

const ilObjLearningSequenceContentGUI::CMD_DELETE = "delete"

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

◆ CMD_MANAGE_CONTENT

const ilObjLearningSequenceContentGUI::CMD_MANAGE_CONTENT = "manageContent"

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

◆ CMD_SAVE

const ilObjLearningSequenceContentGUI::CMD_SAVE = "save"

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

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