ILIAS  release_8 Revision v8.24
ilContainerStartObjectsGUI Class Reference

Class ilContainerStartObjectsGUI. More...

+ Collaboration diagram for ilContainerStartObjectsGUI:

Public Member Functions

 __construct (ilObject $a_parent_obj)
 
 executeCommand ()
 
 setTabs (string $a_active="manage")
 

Protected Member Functions

 checkPermission (string $a_cmd)
 
 listStructureObject ()
 
 saveSortingObject ()
 
 askDeleteStarterObject ()
 
 deleteStarterObject ()
 
 selectStarterObject ()
 
 addStarterObject ()
 

Protected Attributes

ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilObject $object
 
ilContainerStartObjects $start_object
 
StandardGUIRequest $request
 
ILIAS Style Content GUIService $content_style_gui
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilContainerStartObjectsGUI::__construct ( ilObject  $a_parent_obj)

Definition at line 42 of file class.ilContainerStartObjectsGUI.php.

43 {
44 global $DIC;
45
46 $this->access = $DIC->access();
47 $this->settings = $DIC->settings();
48 $this->toolbar = $DIC->toolbar();
49 $ilCtrl = $DIC->ctrl();
50 $ilTabs = $DIC->tabs();
51 $lng = $DIC->language();
52 $tpl = $DIC["tpl"];
53
54 $this->ctrl = $ilCtrl;
55 $this->tabs_gui = $ilTabs;
56 $this->lng = $lng;
57 $this->tpl = $tpl;
58 $this->object = $a_parent_obj;
59
60 $this->start_object = new ilContainerStartObjects(
61 $this->object->getRefId(),
62 $this->object->getId()
63 );
64
65 $this->request = $DIC->container()
66 ->internal()
67 ->gui()
68 ->standardRequest();
69
70 $this->lng->loadLanguageModule("crs");
71 $cs = $DIC->contentStyle();
72 $this->content_style_domain = $cs->domain()->styleForRefId($a_parent_obj->getRefId());
73 $this->content_style_gui = $cs->gui();
74 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

References $DIC, $lng, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObject\getRefId(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\settings(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStarterObject()

ilContainerStartObjectsGUI::addStarterObject ( )
protected

Definition at line 243 of file class.ilContainerStartObjectsGUI.php.

243 : void
244 {
245 $this->checkPermission('write');
246
247 if (count($this->request->getStartObjIds()) === 0) {
248 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
249 $this->ctrl->redirect($this, "selectStarter");
250 }
251
252 $added = 0;
253 foreach ($this->request->getStartObjIds() as $item_ref_id) {
254 if (!$this->start_object->exists($item_ref_id)) {
255 ++$added;
256 $this->start_object->add($item_ref_id);
257 }
258 }
259 if ($added) {
260 $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_added_starters'), true);
261 $this->ctrl->redirect($this, "listStructure");
262 } else {
263 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('crs_starters_already_assigned'), true);
264 $this->ctrl->redirect($this, "selectStarter");
265 }
266 }

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

+ Here is the call graph for this function:

◆ askDeleteStarterObject()

ilContainerStartObjectsGUI::askDeleteStarterObject ( )
protected

Definition at line 187 of file class.ilContainerStartObjectsGUI.php.

187 : void
188 {
189 if (count($this->request->getStartObjIds()) === 0) {
190 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
191 $this->ctrl->redirect($this, "listStructure");
192 }
193
194 $this->checkPermission('write');
195 $this->setTabs();
196
197 // display confirmation message
198 $cgui = new ilConfirmationGUI();
199 $cgui->setFormAction($this->ctrl->getFormAction($this, "listStructure"));
200 $cgui->setHeaderText($this->lng->txt("crs_starter_delete_sure"));
201 $cgui->setCancel($this->lng->txt("cancel"), "listStructure");
202 $cgui->setConfirm($this->lng->txt("remove"), "deleteStarter");
203
204 // list objects that should be deleted
205 $all = $this->start_object->getStartObjects();
206 foreach ($this->request->getStartObjIds() as $starter_id) {
207 $obj_id = ilObject::_lookupObjId($all[$starter_id]["item_ref_id"]);
208 $title = ilObject::_lookupTitle($obj_id);
209 $icon = ilObject::_getIcon($obj_id, "tiny");
210 $alt = $this->lng->txt('obj_' . ilObject::_lookupType($obj_id));
211 $cgui->addItem("starter[]", (string) $starter_id, $title, $icon, $alt);
212 }
213
214 $this->tpl->setContent($cgui->getHTML());
215 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)

References ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and setTabs().

+ Here is the call graph for this function:

◆ checkPermission()

ilContainerStartObjectsGUI::checkPermission ( string  $a_cmd)
protected

Definition at line 121 of file class.ilContainerStartObjectsGUI.php.

121 : void
122 {
123 $ilAccess = $this->access;
124
125 $ref_id = $this->object->getRefId();
126 if (!$ilAccess->checkAccess($a_cmd, "", $ref_id)) {
127 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
128 ilUtil::redirect("goto.php?target=" . $this->object->getType() . "_" . $ref_id);
129 }
130 }
static redirect(string $a_script)
$ref_id
Definition: ltiauth.php:67

References $access, $ref_id, ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilUtil\redirect().

Referenced by addStarterObject(), askDeleteStarterObject(), deleteStarterObject(), executeCommand(), listStructureObject(), and selectStarterObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteStarterObject()

ilContainerStartObjectsGUI::deleteStarterObject ( )
protected

Definition at line 217 of file class.ilContainerStartObjectsGUI.php.

217 : void
218 {
219 $this->checkPermission('write');
220
221 if (count($this->request->getStartObjIds()) === 0) {
222 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
223 } else {
224 foreach ($this->request->getStartObjIds() as $starter_id) {
225 $this->start_object->delete((int) $starter_id);
226 }
227
228 $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_starter_deleted'), true);
229 }
230
231 $this->ctrl->redirect($this, "listStructure");
232 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilContainerStartObjectsGUI::executeCommand ( )

Definition at line 76 of file class.ilContainerStartObjectsGUI.php.

76 : void
77 {
78 switch ($this->ctrl->getNextClass($this)) {
79 case "ilcontainerstartobjectspagegui":
80 $this->checkPermission("write");
81 $this->tabs_gui->clearTargets();
82 $this->tabs_gui->setBackTarget(
83 $this->lng->txt("back"),
84 $this->ctrl->getLinkTarget($this, "listStructure")
85 );
86
87 if (!ilContainerStartObjectsPage::_exists("cstr", $this->object->getId())) {
88 // doesn't exist -> create new one
89 $new_page_object = new ilContainerStartObjectsPage();
90 $new_page_object->setParentId($this->object->getId());
91 $new_page_object->setId($this->object->getId());
92 $new_page_object->createFromXML();
93 unset($new_page_object);
94 }
95
96 $this->content_style_gui->addCss(
97 $this->tpl,
98 $this->object->getRefId()
99 );
100
101 $this->ctrl->setReturnByClass("ilcontainerstartobjectspagegui", "edit");
102 $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
103 $pgui->setStyleId(
104 $this->content_style_domain->getEffectiveStyleId()
105 );
106
107 $ret = $this->ctrl->forwardCommand($pgui);
108 if ($ret) {
109 $this->tpl->setContent($ret);
110 }
111 break;
112
113 default:
114 $cmd = $this->ctrl->getCmd("listStructure");
115 $cmd .= "Object";
116 $this->$cmd();
117 break;
118 }
119 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.

References ilPageObject\_exists(), checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ listStructureObject()

ilContainerStartObjectsGUI::listStructureObject ( )
protected

Definition at line 145 of file class.ilContainerStartObjectsGUI.php.

145 : void
146 {
147 $ilToolbar = $this->toolbar;
149
150 $this->checkPermission('write');
151 $this->setTabs();
152
153 $ilToolbar->addButton(
154 $this->lng->txt('crs_add_starter'),
155 $this->ctrl->getLinkTarget($this, 'selectStarter')
156 );
157
158 // :TODO: depending on this setting?
159 if ($ilSetting->get("enable_cat_page_edit")) {
160 $ilToolbar->addButton(
161 $this->lng->txt("cntr_text_media_editor"),
162 $this->ctrl->getLinkTargetByClass("ilContainerStartObjectsPageGUI", "edit")
163 );
164 }
165
166 $table = new ilContainerStartObjectsTableGUI($this, 'listStructure', $this->start_object);
167 $this->tpl->setContent($table->getHTML());
168 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, $settings, $toolbar, checkPermission(), ILIAS\Repository\lng(), and setTabs().

+ Here is the call graph for this function:

◆ saveSortingObject()

ilContainerStartObjectsGUI::saveSortingObject ( )
protected

Definition at line 170 of file class.ilContainerStartObjectsGUI.php.

170 : void
171 {
172 $pos = $this->request->getStartObjPositions();
173 if (is_array($pos)) {
174 asort($pos);
175 $counter = 0;
176 foreach (array_keys($pos) as $start_id) {
177 $counter += 10;
178 $this->start_object->setObjectPos($start_id, $counter);
179 }
180
181 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cntr_saved_sorting'), true);
182 }
183
184 $this->ctrl->redirect($this, "listStructure");
185 }

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

+ Here is the call graph for this function:

◆ selectStarterObject()

ilContainerStartObjectsGUI::selectStarterObject ( )
protected

Definition at line 234 of file class.ilContainerStartObjectsGUI.php.

234 : void
235 {
236 $this->checkPermission('write');
237 $this->setTabs();
238
239 $table = new ilContainerStartObjectsTableGUI($this, 'selectStarter', $this->start_object);
240 $this->tpl->setContent($table->getHTML());
241 }

References checkPermission(), and setTabs().

+ Here is the call graph for this function:

◆ setTabs()

ilContainerStartObjectsGUI::setTabs ( string  $a_active = "manage")

Definition at line 132 of file class.ilContainerStartObjectsGUI.php.

132 : void
133 {
135
136 $this->tabs_gui->addSubTab(
137 "manage",
138 $this->lng->txt("cntr_manage"),
139 $this->ctrl->getLinkTarget($this, "listStructure")
140 );
141
142 $this->tabs_gui->activateSubTab($a_active);
143 }

References $ilSetting, $settings, and ILIAS\Repository\lng().

Referenced by askDeleteStarterObject(), listStructureObject(), and selectStarterObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilContainerStartObjectsGUI::$access
protected

Definition at line 33 of file class.ilContainerStartObjectsGUI.php.

Referenced by checkPermission().

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ilContainerStartObjectsGUI::$content_style_domain
protected

Definition at line 40 of file class.ilContainerStartObjectsGUI.php.

◆ $content_style_gui

ILIAS Style Content GUIService ilContainerStartObjectsGUI::$content_style_gui
protected

Definition at line 39 of file class.ilContainerStartObjectsGUI.php.

◆ $ctrl

ilCtrl ilContainerStartObjectsGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilContainerStartObjectsGUI::$lng
protected

Definition at line 31 of file class.ilContainerStartObjectsGUI.php.

Referenced by __construct().

◆ $object

ilObject ilContainerStartObjectsGUI::$object
protected

Definition at line 36 of file class.ilContainerStartObjectsGUI.php.

◆ $request

StandardGUIRequest ilContainerStartObjectsGUI::$request
protected

Definition at line 38 of file class.ilContainerStartObjectsGUI.php.

◆ $settings

ilSetting ilContainerStartObjectsGUI::$settings
protected

Definition at line 34 of file class.ilContainerStartObjectsGUI.php.

Referenced by listStructureObject(), and setTabs().

◆ $start_object

ilContainerStartObjects ilContainerStartObjectsGUI::$start_object
protected

Definition at line 37 of file class.ilContainerStartObjectsGUI.php.

◆ $tabs_gui

ilTabsGUI ilContainerStartObjectsGUI::$tabs_gui
protected

Definition at line 30 of file class.ilContainerStartObjectsGUI.php.

◆ $toolbar

ilToolbarGUI ilContainerStartObjectsGUI::$toolbar
protected

Definition at line 35 of file class.ilContainerStartObjectsGUI.php.

Referenced by listStructureObject().

◆ $tpl

ilGlobalTemplateInterface ilContainerStartObjectsGUI::$tpl
protected

Definition at line 32 of file class.ilContainerStartObjectsGUI.php.

Referenced by __construct().


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