ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilContainerStartObjectsGUI Class Reference

Class ilContainerStartObjectsGUI. More...

+ Collaboration diagram for ilContainerStartObjectsGUI:

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $ctrl
 
 $tabs_gui
 
 $lng
 
 $tpl
 
 $access
 
 $settings
 
 $toolbar
 
 $object
 
 $start_object
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilContainerStartObjectsGUI::__construct ( ilObject  $a_parent_obj)

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

54 {
55 global $DIC;
56
57 $this->access = $DIC->access();
58 $this->settings = $DIC->settings();
59 $this->toolbar = $DIC->toolbar();
60 $ilCtrl = $DIC->ctrl();
61 $ilTabs = $DIC->tabs();
62 $lng = $DIC->language();
63 $tpl = $DIC["tpl"];
64
65 $this->ctrl = $ilCtrl;
66 $this->tabs_gui = $ilTabs;
67 $this->lng = $lng;
68 $this->tpl = $tpl;
69 $this->object = $a_parent_obj;
70
71 include_once "Services/Container/classes/class.ilContainerStartObjects.php";
72 $this->start_object = new ilContainerStartObjects(
73 $this->object->getRefId(),
74 $this->object->getId()
75 );
76
77 $this->lng->loadLanguageModule("crs");
78 }
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, $ilCtrl, $lng, $tpl, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStarterObject()

ilContainerStartObjectsGUI::addStarterObject ( )
protected

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

260 {
261 $this->checkPermission('write');
262
263 if (empty($_POST['starter'])) {
264 ilUtil::sendFailure($this->lng->txt('select_one'), true);
265 $this->ctrl->redirect($this, "selectStarter");
266 }
267
268 $added = 0;
269 foreach ($_POST['starter'] as $item_ref_id) {
270 if (!$this->start_object->exists($item_ref_id)) {
271 ++$added;
272 $this->start_object->add($item_ref_id);
273 }
274 }
275 if ($added) {
276 ilUtil::sendSuccess($this->lng->txt('crs_added_starters'), true);
277 $this->ctrl->redirect($this, "listStructure");
278 } else {
279 ilUtil::sendFailure($this->lng->txt('crs_starters_already_assigned'), true);
280 $this->ctrl->redirect($this, "selectStarter");
281 }
282 }
$_POST["username"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, checkPermission(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ askDeleteStarterObject()

ilContainerStartObjectsGUI::askDeleteStarterObject ( )
protected

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

202 {
203 if (empty($_POST['starter'])) {
204 ilUtil::sendFailure($this->lng->txt('select_one'), true);
205 $this->ctrl->redirect($this, "listStructure");
206 }
207
208 $this->checkPermission('write');
209 $this->setTabs();
210
211 // display confirmation message
212 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
213 $cgui = new ilConfirmationGUI();
214 $cgui->setFormAction($this->ctrl->getFormAction($this, "listStructure"));
215 $cgui->setHeaderText($this->lng->txt("crs_starter_delete_sure"));
216 $cgui->setCancel($this->lng->txt("cancel"), "listStructure");
217 $cgui->setConfirm($this->lng->txt("remove"), "deleteStarter");
218
219 // list objects that should be deleted
220 $all = $this->start_object->getStartObjects();
221 foreach ($_POST['starter'] as $starter_id) {
222 $obj_id = ilObject::_lookupObjId($all[$starter_id]["item_ref_id"]);
224 $icon = ilObject::_getIcon($obj_id, "tiny");
225 $alt = $this->lng->txt('obj_' . ilObject::_lookupType($obj_id));
226 $cgui->addItem("starter[]", $starter_id, $title, $icon, $alt);
227 }
228
229 $this->tpl->setContent($cgui->getHTML());
230 }
Confirmation screen class.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type

References $_POST, $title, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), checkPermission(), ilUtil\sendFailure(), and setTabs().

+ Here is the call graph for this function:

◆ checkPermission()

ilContainerStartObjectsGUI::checkPermission (   $a_cmd)
protected

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

135 {
136 $ilAccess = $this->access;
137
138 $ref_id = $this->object->getRefId();
139 if (!$ilAccess->checkAccess($a_cmd, "", $ref_id)) {
140 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
141 ilUtil::redirect("goto.php?target=" . $this->object->getType() . "_" . $ref_id);
142 }
143 }
static redirect($a_script)

References $access, ilUtil\redirect(), and ilUtil\sendFailure().

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 232 of file class.ilContainerStartObjectsGUI.php.

233 {
234 $this->checkPermission('write');
235
236 if (!count($_POST['starter'])) {
237 ilUtil::sendFailure($this->lng->txt('select_one'), true);
238 } else {
239 foreach ($_POST['starter'] as $starter_id) {
240 $this->start_object->delete((int) $starter_id);
241 }
242
243 ilUtil::sendSuccess($this->lng->txt('crs_starter_deleted'), true);
244 }
245
246 $this->ctrl->redirect($this, "listStructure");
247 }

References $_POST, checkPermission(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ executeCommand()

ilContainerStartObjectsGUI::executeCommand ( )

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

81 {
82 // $this->prepareOutput();
83
84 switch ($this->ctrl->getNextClass($this)) {
85 case "ilcontainerstartobjectspagegui":
86 $this->checkPermission("write");
87 $this->tabs_gui->clearTargets();
88 $this->tabs_gui->setBackTarget(
89 $this->lng->txt("back"),
90 $this->ctrl->getLinkTarget($this, "listStructure")
91 );
92
93 include_once "Services/Container/classes/class.ilContainerStartObjectsPage.php";
94 if (!ilContainerStartObjectsPage::_exists("cstr", $this->object->getId())) {
95 // doesn't exist -> create new one
96 $new_page_object = new ilContainerStartObjectsPage();
97 $new_page_object->setParentId($this->object->getId());
98 $new_page_object->setId($this->object->getId());
99 $new_page_object->createFromXML();
100 unset($new_page_object);
101 }
102
103 $this->tpl->setVariable(
104 "LOCATION_CONTENT_STYLESHEET",
106 $this->object->getStyleSheetId(),
107 $this->object->getType()
108 ))
109 );
110
111 $this->ctrl->setReturnByClass("ilcontainerstartobjectspagegui", "edit");
112 include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
113 $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
114 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
116 $this->object->getStyleSheetId(),
117 $this->object->getType()
118 ));
119
120 $ret = $this->ctrl->forwardCommand($pgui);
121 if ($ret) {
122 $this->tpl->setContent($ret);
123 }
124 break;
125
126 default:
127 $cmd = $this->ctrl->getCmd("listStructure");
128 $cmd .= "Object";
129 $this->$cmd();
130 break;
131 }
132 }
Container start objects page GUI class.
Container start objects page object.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
$ret
Definition: parser.php:6

References $ret, ilPageObject\_exists(), checkPermission(), ilObjStyleSheet\getContentStylePath(), and ilObjStyleSheet\getEffectiveContentStyleId().

+ Here is the call graph for this function:

◆ listStructureObject()

ilContainerStartObjectsGUI::listStructureObject ( )
protected

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

168 {
169 $ilToolbar = $this->toolbar;
170
171 $this->checkPermission('write');
172 $this->setTabs();
173
174 $ilToolbar->addButton(
175 $this->lng->txt('crs_add_starter'),
176 $this->ctrl->getLinkTarget($this, 'selectStarter')
177 );
178
179 include_once './Services/Container/classes/class.ilContainerStartObjectsTableGUI.php';
180 $table = new ilContainerStartObjectsTableGUI($this, 'listStructure', $this->start_object);
181 $this->tpl->setContent($table->getHTML());
182 }
if(empty($password)) $table
Definition: pwgen.php:24

References $table, $toolbar, checkPermission(), and setTabs().

+ Here is the call graph for this function:

◆ saveSortingObject()

ilContainerStartObjectsGUI::saveSortingObject ( )
protected

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

185 {
186 $pos = $_POST["pos"];
187 if (is_array($pos)) {
188 asort($pos);
189 $counter = 0;
190 foreach (array_keys($pos) as $start_id) {
191 $counter += 10;
192 $this->start_object->setObjectPos($start_id, $counter);
193 }
194
195 ilUtil::sendSuccess($this->lng->txt('cntr_saved_sorting'), true);
196 }
197
198 $this->ctrl->redirect($this, "listStructure");
199 }

References $_POST.

◆ selectStarterObject()

ilContainerStartObjectsGUI::selectStarterObject ( )
protected

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

250 {
251 $this->checkPermission('write');
252 $this->setTabs();
253
254 include_once './Services/Container/classes/class.ilContainerStartObjectsTableGUI.php';
255 $table = new ilContainerStartObjectsTableGUI($this, 'selectStarter', $this->start_object);
256 $this->tpl->setContent($table->getHTML());
257 }

References $table, checkPermission(), and setTabs().

+ Here is the call graph for this function:

◆ setTabs()

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

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

146 {
148
149 $this->tabs_gui->addSubTab(
150 "manage",
151 $this->lng->txt("cntr_manage"),
152 $this->ctrl->getLinkTarget($this, "listStructure")
153 );
154
155 // :TODO: depending on this setting?
156 if ($ilSetting->get("enable_cat_page_edit")) {
157 $this->tabs_gui->addSubTab(
158 "page_editor",
159 $this->lng->txt("cntr_text_media_editor"),
160 $this->ctrl->getLinkTargetByClass("ilContainerStartObjectsPageGUI", "edit")
161 );
162 }
163
164 $this->tabs_gui->activateSubTab($a_active);
165 }
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, and $settings.

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

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilContainerStartObjectsGUI::$access
protected

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

Referenced by checkPermission().

◆ $ctrl

ilContainerStartObjectsGUI::$ctrl
protected

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

◆ $lng

ilContainerStartObjectsGUI::$lng
protected

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

Referenced by __construct().

◆ $object

ilContainerStartObjectsGUI::$object
protected

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

◆ $settings

ilContainerStartObjectsGUI::$settings
protected

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

Referenced by setTabs().

◆ $start_object

ilContainerStartObjectsGUI::$start_object
protected

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

◆ $tabs_gui

ilContainerStartObjectsGUI::$tabs_gui
protected

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

◆ $toolbar

ilContainerStartObjectsGUI::$toolbar
protected

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

Referenced by listStructureObject().

◆ $tpl

ilContainerStartObjectsGUI::$tpl
protected

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

Referenced by __construct().


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