ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjHelpSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObject2GUI.php");
5
18{
22 protected $rbacsystem;
23
27 protected $error;
28
32 protected $access;
33
37 protected $settings;
38
42 protected $tabs;
43
47 protected $toolbar;
48
52 protected $db;
53
54
58 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
59 {
60 global $DIC;
61 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
62
63 $this->rbacsystem = $DIC->rbac()->system();
64 $this->error = $DIC["ilErr"];
65 $this->access = $DIC->access();
66 $this->lng = $DIC->language();
67 $this->ctrl = $DIC->ctrl();
68 $this->settings = $DIC->settings();
69 $this->tabs = $DIC->tabs();
70 $this->toolbar = $DIC->toolbar();
71 $this->tpl = $DIC["tpl"];
72 $this->db = $DIC->database();
73 }
74
78 public function getType()
79 {
80 return "hlps";
81 }
82
89 public function executeCommand()
90 {
92 $ilAccess = $this->access;
94 $lng->loadLanguageModule("help");
95
96 $next_class = $this->ctrl->getNextClass($this);
97 $cmd = $this->ctrl->getCmd();
98
99 $this->prepareOutput();
100
101 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
102 $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
103 }
104
105 switch ($next_class) {
106 case 'ilpermissiongui':
107 $this->tabs_gui->setTabActive('perm_settings');
108 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
109 $perm_gui = new ilPermissionGUI($this);
110 $ret = $this->ctrl->forwardCommand($perm_gui);
111 break;
112
113 default:
114 if (!$cmd || $cmd == 'view') {
115 $cmd = "editSettings";
116 }
117
118 $this->$cmd();
119 break;
120 }
121 return true;
122 }
123
127 public function editSettings()
128 {
129 $ilCtrl = $this->ctrl;
132 $ilTabs = $this->tabs;
133 $ilToolbar = $this->toolbar;
134
135 $ilTabs->activateTab("settings");
136
137 if (OH_REF_ID > 0) {
138 ilUtil::sendInfo("This installation is used for online help authoring. Help modules cannot be imported.");
139 return;
140 }
141
142 if ($this->checkPermissionBool("write")) {
143 // help file
144 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
145 $fi = new ilFileInputGUI($lng->txt("help_help_file"), "help_file");
146 $fi->setSuffixes(array("zip"));
147 $ilToolbar->addInputItem($fi, true);
148 $ilToolbar->addFormButton($lng->txt("upload"), "uploadHelpFile");
149 $ilToolbar->addSeparator();
150
151 // help mode
152 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
153 $options = array(
154 "" => $lng->txt("help_tooltips_and_help"),
155 "1" => $lng->txt("help_help_only"),
156 "2" => $lng->txt("help_tooltips_only")
157 );
158 $si = new ilSelectInputGUI($this->lng->txt("help_mode"), "help_mode");
159 $si->setOptions($options);
160 $si->setValue($ilSetting->get("help_mode"));
161 $ilToolbar->addInputItem($si);
162
163 $ilToolbar->addFormButton($lng->txt("help_set_mode"), "setMode");
164 }
165 $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
166
167 include_once("./Services/Help/classes/class.ilHelpModuleTableGUI.php");
168 $tab = new ilHelpModuleTableGUI($this, "editSettings", $this->checkPermissionBool("write"));
169
170 $this->tpl->setContent($tab->getHTML());
171 }
172
176 public function getAdminTabs()
177 {
178 if ($this->checkPermissionBool("visible,read")) {
179 $this->tabs_gui->addTab(
180 "settings",
181 $this->lng->txt("settings"),
182 $this->ctrl->getLinkTarget($this, "editSettings")
183 );
184 }
185
186 if ($this->checkPermissionBool("edit_permission")) {
187 $this->tabs_gui->addTab(
188 "perm_settings",
189 $this->lng->txt("perm_settings"),
190 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
191 );
192 }
193 }
194
195
196
197
204 public function uploadHelpFile()
205 {
207 $ilCtrl = $this->ctrl;
208
209 if ($this->checkPermissionBool("write")) {
210 $this->object->uploadHelpModule($_FILES["help_file"]);
211 ilUtil::sendSuccess($lng->txt("help_module_uploaded"), true);
212 }
213
214 $ilCtrl->redirect($this, "editSettings");
215 }
216
221 {
222 $ilCtrl = $this->ctrl;
225
226 $this->checkPermission("write");
227
228 if (!is_array($_POST["id"]) || count($_POST["id"]) == 0) {
229 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
230 $ilCtrl->redirect($this, "editSettings");
231 } else {
232 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
233 $cgui = new ilConfirmationGUI();
234 $cgui->setFormAction($ilCtrl->getFormAction($this));
235 $cgui->setHeaderText($lng->txt("help_sure_delete_help_modules"));
236 $cgui->setCancel($lng->txt("cancel"), "editSettings");
237 $cgui->setConfirm($lng->txt("delete"), "deleteHelpModules");
238
239 foreach ($_POST["id"] as $i) {
240 $cgui->addItem("id[]", $i, $this->object->lookupModuleTitle($i));
241 }
242
243 $tpl->setContent($cgui->getHTML());
244 }
245 }
246
253 public function deleteHelpModules()
254 {
256 $ilCtrl = $this->ctrl;
257
258 $this->checkPermission("write");
259
260 if (is_array($_POST["id"])) {
261 foreach ($_POST["id"] as $i) {
262 $this->object->deleteModule((int) $i);
263 }
264 }
265
266 $ilCtrl->redirect($this, "editSettings");
267 }
268
275 public function activateModule()
276 {
279 $ilCtrl = $this->ctrl;
280
281 $this->checkPermission("write");
282
283 $ilSetting->set("help_module", (int) $_GET["hm_id"]);
284 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
285 $ilCtrl->redirect($this, "editSettings");
286 }
287
294 public function deactivateModule()
295 {
298 $ilCtrl = $this->ctrl;
299
300 $this->checkPermission("write");
301
302 if ($ilSetting->get("help_module") == (int) $_GET["hm_id"]) {
303 $ilSetting->set("help_module", "");
304 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
305 }
306 $ilCtrl->redirect($this, "editSettings");
307 }
308
315 public function setMode()
316 {
318 $ilCtrl = $this->ctrl;
320
321 $this->checkPermission("write");
322
323 if ($this->checkPermissionBool("write")) {
324 $ilSetting->set("help_mode", ilUtil::stripSlashes($_POST["help_mode"]));
325 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
326 }
327
328 $ilCtrl->redirect($this, "editSettings");
329 }
330}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Confirmation screen class.
This class represents a file property in a property form.
TableGUI class for help modules.
Help settings gui class.
deactivateModule()
Deactivate module.
deleteHelpModules()
Delete help modules.
getAdminTabs()
administration tabs show only permissions and trash folder
editSettings()
Edit news settings.
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
confirmHelpModulesDeletion()
Confirm help modules deletion.
New implementation of ilObjectGUI.
prepareOutput($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a selection list property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
global $ilDB