ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

 $object
 
 $start_object
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilContainerStartObjectsGUI::__construct ( ilObject  $a_parent_obj)

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

19 {
20 global $ilCtrl, $ilTabs, $lng, $tpl;
21
22 $this->ctrl = $ilCtrl;
23 $this->tabs_gui = $ilTabs;
24 $this->lng = $lng;
25 $this->tpl = $tpl;
26 $this->object = $a_parent_obj;
27
28 include_once "Services/Container/classes/class.ilContainerStartObjects.php";
29 $this->start_object = new ilContainerStartObjects($this->object->getRefId(),
30 $this->object->getId());
31
32 $this->lng->loadLanguageModule("crs");
33 }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17

References $ilCtrl, $lng, and $tpl.

Member Function Documentation

◆ addStarterObject()

ilContainerStartObjectsGUI::addStarterObject ( )
protected

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

214 {
215 $this->checkPermission('write');
216
217 if(!count($_POST['starter']))
218 {
219 ilUtil::sendFailure($this->lng->txt('select_one'), true);
220 $this->ctrl->redirect($this, "selectStarter");
221 }
222
223 $added = 0;
224 foreach($_POST['starter'] as $item_ref_id)
225 {
226 if(!$this->start_object->exists($item_ref_id))
227 {
228 ++$added;
229 $this->start_object->add($item_ref_id);
230 }
231 }
232 if($added)
233 {
234 ilUtil::sendSuccess($this->lng->txt('crs_added_starters'), true);
235 $this->ctrl->redirect($this, "listStructure");
236 }
237 else
238 {
239 ilUtil::sendFailure($this->lng->txt('crs_starters_already_assigned'), true);
240 $this->ctrl->redirect($this, "selectStarter");
241 }
242 }
$_POST["username"]
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

+ Here is the call graph for this function:

◆ askDeleteStarterObject()

ilContainerStartObjectsGUI::askDeleteStarterObject ( )
protected

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

150 {
151 if(!count($_POST['starter']))
152 {
153 ilUtil::sendFailure($this->lng->txt('select_one'), true);
154 $this->ctrl->redirect($this, "listStructure");
155 }
156
157 $this->checkPermission('write');
158 $this->setTabs();
159
160 // display confirmation message
161 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
162 $cgui = new ilConfirmationGUI();
163 $cgui->setFormAction($this->ctrl->getFormAction($this, "listStructure"));
164 $cgui->setHeaderText($this->lng->txt("crs_starter_delete_sure"));
165 $cgui->setCancel($this->lng->txt("cancel"), "listStructure");
166 $cgui->setConfirm($this->lng->txt("remove"), "deleteStarter");
167
168 // list objects that should be deleted
169 $all = $this->start_object->getStartObjects();
170 foreach($_POST['starter'] as $starter_id)
171 {
172 $obj_id = ilObject::_lookupObjId($all[$starter_id]["item_ref_id"]);
174 $icon = ilObject::_getIcon($obj_id, "tiny");
175 $alt = $this->lng->txt('obj_'.ilObject::_lookupType($obj_id));
176 $cgui->addItem("starter[]", $starter_id, $title, $icon, $alt);
177 }
178
179 $this->tpl->setContent($cgui->getHTML());
180 }
Confirmation screen class.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type

References $_POST, $title, ilObject\_getIcon(), 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 84 of file class.ilContainerStartObjectsGUI.php.

85 {
86 global $ilAccess;
87
88 $ref_id = $this->object->getRefId();
89 if(!$ilAccess->checkAccess($a_cmd, "", $ref_id))
90 {
91 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
92 ilUtil::redirect("goto.php?target=".$this->object->getType()."_".$ref_id);
93 }
94 }
static redirect($a_script)
http redirect to other script
$ref_id
Definition: sahs_server.php:39

References $ref_id, 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 182 of file class.ilContainerStartObjectsGUI.php.

183 {
184 $this->checkPermission('write');
185
186 if(!count($_POST['starter']))
187 {
188 ilUtil::sendFailure($this->lng->txt('select_one'), true);
189 }
190 else
191 {
192 foreach($_POST['starter'] as $starter_id)
193 {
194 $this->start_object->delete((int)$starter_id);
195 }
196
197 ilUtil::sendSuccess($this->lng->txt('crs_starter_deleted'), true);
198 }
199
200 $this->ctrl->redirect($this, "listStructure");
201 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilContainerStartObjectsGUI::executeCommand ( )

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

36 {
37 // $this->prepareOutput();
38
39 switch($this->ctrl->getNextClass($this))
40 {
41 case "ilcontainerstartobjectspagegui":
42 $this->checkPermission("write");
43 $this->tabs_gui->clearTargets();
44 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
45 $this->ctrl->getLinkTarget($this, "listStructure"));
46
47 include_once "Services/Container/classes/class.ilContainerStartObjectsPage.php";
48 if(!ilContainerStartObjectsPage::_exists("cstr", $this->object->getId()))
49 {
50 // doesn't exist -> create new one
51 $new_page_object = new ilContainerStartObjectsPage();
52 $new_page_object->setParentId($this->object->getId());
53 $new_page_object->setId($this->object->getId());
54 $new_page_object->createFromXML();
55 unset($new_page_object);
56 }
57
58 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
60 $this->object->getStyleSheetId(), $this->object->getType())));
61
62 $this->ctrl->setReturnByClass("ilcontainerstartobjectspagegui", "edit");
63 include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
64 $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
65 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
67 $this->object->getStyleSheetId(), $this->object->getType()));
68
69 $ret = $this->ctrl->forwardCommand($pgui);
70 if($ret)
71 {
72 $this->tpl->setContent($ret);
73 }
74 break;
75
76 default:
77 $cmd = $this->ctrl->getCmd("listStructure");
78 $cmd .= "Object";
79 $this->$cmd();
80 break;
81 }
82 }
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)
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
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ listStructureObject()

ilContainerStartObjectsGUI::listStructureObject ( )
protected

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

116 {
117 global $ilToolbar;
118
119 $this->checkPermission('write');
120 $this->setTabs();
121
122 $ilToolbar->addButton($this->lng->txt('crs_add_starter'),
123 $this->ctrl->getLinkTarget($this, 'selectStarter'));
124
125 include_once './Services/Container/classes/class.ilContainerStartObjectsTableGUI.php';
126 $table = new ilContainerStartObjectsTableGUI($this, 'listStructure', $this->start_object);
127 $this->tpl->setContent($table->getHTML());
128 }

References checkPermission(), and setTabs().

+ Here is the call graph for this function:

◆ saveSortingObject()

ilContainerStartObjectsGUI::saveSortingObject ( )
protected

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

131 {
132 $pos = $_POST["pos"];
133 if(is_array($pos))
134 {
135 asort($pos);
136 $counter = 0;
137 foreach(array_keys($pos) as $start_id)
138 {
139 $counter += 10;
140 $this->start_object->setObjectPos($start_id, $counter);
141 }
142
143 ilUtil::sendSuccess($this->lng->txt('cntr_saved_sorting'), true);
144 }
145
146 $this->ctrl->redirect($this, "listStructure");
147 }
$counter

References $_POST, $counter, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ selectStarterObject()

ilContainerStartObjectsGUI::selectStarterObject ( )
protected

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

204 {
205 $this->checkPermission('write');
206 $this->setTabs();
207
208 include_once './Services/Container/classes/class.ilContainerStartObjectsTableGUI.php';
209 $table = new ilContainerStartObjectsTableGUI($this, 'selectStarter', $this->start_object);
210 $this->tpl->setContent($table->getHTML());
211 }

References checkPermission(), and setTabs().

+ Here is the call graph for this function:

◆ setTabs()

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

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

97 {
98 global $ilSetting;
99
100 $this->tabs_gui->addSubTab("manage",
101 $this->lng->txt("cntr_manage"),
102 $this->ctrl->getLinkTarget($this, "listStructure"));
103
104 // :TODO: depending on this setting?
105 if ($ilSetting->get("enable_cat_page_edit"))
106 {
107 $this->tabs_gui->addSubTab("page_editor",
108 $this->lng->txt("cntr_text_media_editor"),
109 $this->ctrl->getLinkTargetByClass("ilContainerStartObjectsPageGUI", "edit"));
110 }
111
112 $this->tabs_gui->activateSubTab($a_active);
113 }
global $ilSetting
Definition: privfeed.php:17

References $ilSetting.

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

+ Here is the caller graph for this function:

Field Documentation

◆ $object

ilContainerStartObjectsGUI::$object
protected

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

◆ $start_object

ilContainerStartObjectsGUI::$start_object
protected

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


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