ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once("./Services/Object/classes/class.ilObject2GUI.php");
5 
18 {
22  function getType()
23  {
24  return "hlps";
25  }
26 
33  public function executeCommand()
34  {
35  global $rbacsystem, $ilErr, $ilAccess, $lng;
36 
37  $lng->loadLanguageModule("help");
38 
39  $next_class = $this->ctrl->getNextClass($this);
40  $cmd = $this->ctrl->getCmd();
41 
42  $this->prepareOutput();
43 
44  if (!$ilAccess->checkAccess('read','',$this->object->getRefId()))
45  {
46  $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
47  }
48 
49  switch($next_class)
50  {
51  case 'ilpermissiongui':
52  $this->tabs_gui->setTabActive('perm_settings');
53  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
54  $perm_gui = new ilPermissionGUI($this);
55  $ret = $this->ctrl->forwardCommand($perm_gui);
56  break;
57 
58  default:
59  if(!$cmd || $cmd == 'view')
60  {
61  $cmd = "editSettings";
62  }
63 
64  $this->$cmd();
65  break;
66  }
67  return true;
68  }
69 
73  public function editSettings()
74  {
75  global $ilCtrl, $lng, $ilSetting, $ilTabs, $ilToolbar;
76 
77  $ilTabs->activateTab("settings");
78 
79  if (OH_REF_ID > 0)
80  {
81  ilUtil::sendInfo("This installation is used for online help authoring. Help modules cannot be imported.");
82  return;
83  }
84 
85  if ($this->checkPermissionBool("write"))
86  {
87  // help file
88  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
89  $fi = new ilFileInputGUI($lng->txt("help_help_file"), "help_file");
90  $fi->setSuffixes(array("zip"));
91  $ilToolbar->addInputItem($fi, true);
92  $ilToolbar->addFormButton($lng->txt("upload"), "uploadHelpFile");
93  $ilToolbar->addSeparator();
94 
95  // help mode
96  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
97  $options = array(
98  "" => $lng->txt("help_tooltips_and_help"),
99  "1" => $lng->txt("help_help_only"),
100  "2" => $lng->txt("help_tooltips_only")
101  );
102  $si = new ilSelectInputGUI($this->lng->txt("help_mode"), "help_mode");
103  $si->setOptions($options);
104  $si->setValue($ilSetting->get("help_mode"));
105  $ilToolbar->addInputItem($si);
106 
107  $ilToolbar->addFormButton($lng->txt("help_set_mode"), "setMode");
108 
109  }
110  $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
111 
112  include_once("./Services/Help/classes/class.ilHelpModuleTableGUI.php");
113  $tab = new ilHelpModuleTableGUI($this, "editSettings");
114 
115  $this->tpl->setContent($tab->getHTML());
116  }
117 
121  function getAdminTabs()
122  {
123  if ($this->checkPermissionBool("visible,read"))
124  {
125  $this->tabs_gui->addTab("settings",
126  $this->lng->txt("settings"),
127  $this->ctrl->getLinkTarget($this, "editSettings"));
128 
129  }
130 
131  if ($this->checkPermissionBool("edit_permission"))
132  {
133  $this->tabs_gui->addTab("perm_settings",
134  $this->lng->txt("perm_settings"),
135  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
136  );
137  }
138  }
139 
140 
141 
142 
149  function uploadHelpFile()
150  {
151  global $lng, $ilCtrl;
152 
153  if ($this->checkPermissionBool("write"))
154  {
155  $this->object->uploadHelpModule($_FILES["help_file"]);
156  ilUtil::sendSuccess($lng->txt("help_module_uploaded"), true);
157  }
158 
159  $ilCtrl->redirect($this, "editSettings");
160  }
161 
166  {
167  global $ilCtrl, $tpl, $lng;
168 
169  if (!is_array($_POST["id"]) || count($_POST["id"]) == 0)
170  {
171  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
172  $ilCtrl->redirect($this, "editSettings");
173  }
174  else
175  {
176  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
177  $cgui = new ilConfirmationGUI();
178  $cgui->setFormAction($ilCtrl->getFormAction($this));
179  $cgui->setHeaderText($lng->txt("help_sure_delete_help_modules"));
180  $cgui->setCancel($lng->txt("cancel"), "editSettings");
181  $cgui->setConfirm($lng->txt("delete"), "deleteHelpModules");
182 
183  foreach ($_POST["id"] as $i)
184  {
185  $cgui->addItem("id[]", $i, $this->object->lookupModuleTitle($i));
186  }
187 
188  $tpl->setContent($cgui->getHTML());
189  }
190  }
191 
198  function deleteHelpModules()
199  {
200  global $ilDB, $ilCtrl;
201 
202  if (is_array($_POST["id"]))
203  {
204  foreach ($_POST["id"] as $i)
205  {
206  $this->object->deleteModule((int) $i);
207  }
208  }
209 
210  $ilCtrl->redirect($this, "editSettings");
211  }
212 
219  function activateModule()
220  {
221  global $ilSetting, $lng, $ilCtrl;
222 
223  $ilSetting->set("help_module", (int) $_GET["hm_id"]);
224  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
225  $ilCtrl->redirect($this, "editSettings");
226  }
227 
234  function deactivateModule()
235  {
236  global $ilSetting, $lng, $ilCtrl;
237 
238  if ($ilSetting->get("help_module") == (int) $_GET["hm_id"])
239  {
240  $ilSetting->set("help_module", "");
241  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
242  }
243  $ilCtrl->redirect($this, "editSettings");
244  }
245 
252  function setMode()
253  {
254  global $lng, $ilCtrl, $ilSetting;
255 
256  if ($this->checkPermissionBool("write"))
257  {
258  $ilSetting->set("help_mode", ilUtil::stripSlashes($_POST["help_mode"]));
259  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
260  }
261 
262  $ilCtrl->redirect($this, "editSettings");
263  }
264 
265 
266 }
267 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilErr
Definition: raiseError.php:16
Help settings gui class.
This class represents a selection list property in a property form.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
$_GET["client_id"]
This class represents a file property in a property form.
TableGUI class for help modules.
deleteHelpModules()
Delete help modules.
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
editSettings()
Edit news settings.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
deactivateModule()
Deactivate module.
if(!is_array($argv)) $options
getAdminTabs()
administration tabs show only permissions and trash folder
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
global $ilSetting
Definition: privfeed.php:17
confirmHelpModulesDeletion()
Confirm help modules deletion.
global $ilDB
$ret
Definition: parser.php:6
prepareOutput($a_show_subobjects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
uploadHelpFile()
Upload help file.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
$_POST["username"]
Confirmation screen class.