ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjLearningResourcesSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Object/classes/class.ilObjectGUI.php");
5 
19 {
20  private static $ERROR_MESSAGE;
26  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
27  {
28  $this->type = 'lrss';
29  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
30 
31  $this->lng->loadLanguageModule('content');
32  }
33 
40  public function executeCommand()
41  {
42  global $rbacsystem,$ilErr,$ilAccess;
43 
44  $next_class = $this->ctrl->getNextClass($this);
45  $cmd = $this->ctrl->getCmd();
46 
47  $this->prepareOutput();
48 
49  if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
50  {
51  $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
52  }
53 
54  switch($next_class)
55  {
56  case 'illicenseoverviewgui':
57  include_once("./Services/License/classes/class.ilLicenseOverviewGUI.php");
58  $license_gui =& new ilLicenseOverviewGUI($this,LIC_MODE_ADMINISTRATION);
59  $ret =& $this->ctrl->forwardCommand($license_gui);
60  break;
61 
62  case 'ilpermissiongui':
63  $this->tabs_gui->setTabActive('perm_settings');
64  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
65  $perm_gui =& new ilPermissionGUI($this);
66  $ret =& $this->ctrl->forwardCommand($perm_gui);
67  break;
68 
69  default:
70  if(!$cmd || $cmd == 'view')
71  {
72  $cmd = "editSettings";
73  }
74 
75  $this->$cmd();
76  break;
77  }
78  return true;
79  }
80 
87  public function getAdminTabs()
88  {
89  global $rbacsystem, $ilAccess, $ilSetting;
90 
91  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
92  {
93  $this->tabs_gui->addTarget("cont_edit_lrs_settings",
94  $this->ctrl->getLinkTarget($this, "editSettings"),
95  array("editSettings", "view"));
96 
97  include_once("Services/License/classes/class.ilLicenseAccess.php");
99  {
100  $this->tabs_gui->addTarget("licenses",
101  $this->ctrl->getLinkTargetByClass('illicenseoverviewgui', ''),
102  "", "illicenseoverviewgui");
103  }
104  }
105 
106  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
107  {
108  $this->tabs_gui->addTarget("perm_settings",
109  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
110  array(),'ilpermissiongui');
111  }
112  }
113 
117  public function editSettings()
118  {
119  global $ilCtrl, $lng, $ilSetting;
120 
121  $lm_set = new ilSetting("lm");
122  $lic_set = new ilSetting("license");
123  $lng->loadLanguageModule("license");
124  $lng->loadLanguageModule("scormdebug");
125 
126  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
127  $form = new ilPropertyFormGUI();
128  $form->setFormAction($ilCtrl->getFormAction($this));
129  $form->setTitle($lng->txt("cont_lrs_settings"));
130 
131  // Page History
132  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_enable_page_history"),
133  "page_history");
134  $cb_prop->setInfo($lng->txt("cont_enable_page_history_info"));
135  $cb_prop->setChecked($lm_set->get("page_history", 1));
136  $form->addItem($cb_prop);
137 
138  // Time scheduled page activation
139  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_enable_time_scheduled_page_activation"),
140  "time_scheduled_page_activation");
141  $cb_prop->setInfo($lng->txt("cont_enable_time_scheduled_page_activation_info"));
142  $cb_prop->setChecked($lm_set->get("time_scheduled_page_activation"));
143  $form->addItem($cb_prop);
144 
145  // Activate replace media object function
146  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_replace_mob_feature"),
147  "replace_mob_feature");
148  $cb_prop->setInfo($lng->txt("cont_replace_mob_feature_info"));
149  $cb_prop->setChecked($lm_set->get("replace_mob_feature"));
150  $form->addItem($cb_prop);
151 
152  // Activate HTML export IDs
153  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_html_export_ids"),
154  "html_export_ids");
155  $cb_prop->setInfo($lng->txt("cont_html_export_ids_info"));
156  $cb_prop->setChecked($lm_set->get("html_export_ids"));
157  $form->addItem($cb_prop);
158 
159  // Upload dir for learning resources
160  $tx_prop = new ilTextInputGUI($lng->txt("cont_upload_dir"),
161  "cont_upload_dir");
162  $tx_prop->setInfo($lng->txt("cont_upload_dir_info"));
163  $tx_prop->setValue($lm_set->get("cont_upload_dir"));
164  $form->addItem($tx_prop);
165 
166 
167  // license activation
168  $cb_prop = new ilCheckboxInputGUI($lng->txt("license_counter"),
169  "license_counter");
170  $cb_prop->setInfo($lng->txt("license_counter_info"));
171  $cb_prop->setChecked($lic_set->get("license_counter"));
172  $form->addItem($cb_prop);
173 
174  // license warning
175  $tx_prop = new ilTextInputGUI($lng->txt("license_warning"),
176  "license_warning");
177  $tx_prop->setSize(5);
178  $tx_prop->setInfo($lng->txt("license_warning_info"));
179  $tx_prop->setValue($lic_set->get("license_warning"));
180  $form->addItem($tx_prop);
181 
182  // scormDebugger activation
183  $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_global_activate"),"scormdebug_global_activate");
184  $cb_prop->setInfo($lng->txt("scormdebug_global_activate_info"));
185  $cb_prop->setChecked($lm_set->get("scormdebug_global_activate"));
186  $form->addItem($cb_prop);
187 
188  // scormDebugger disableRTECaching
189  $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_disable_cache"),
190  "scormdebug_disable_cache");
191  $cb_prop->setInfo($lng->txt("scormdebug_disable_cache_info"));
192  $cb_prop->setChecked($lm_set->get("scormdebug_disable_cache"));
193  $form->addItem($cb_prop);
194 
195  // command buttons
196  $form->addCommandButton("saveSettings", $lng->txt("save"));
197  $form->addCommandButton("view", $lng->txt("cancel"));
198 
199  $this->tpl->setContent($form->getHTML());
200  }
201 
205  public function saveSettings()
206  {
207  global $ilCtrl, $ilSetting;
208 
209  $lm_set = new ilSetting("lm");
210  $lm_set->set("time_scheduled_page_activation",
211  ilUtil::stripSlashes($_POST["time_scheduled_page_activation"]));
212  $lm_set->set("page_history",
213  (int) ilUtil::stripSlashes($_POST["page_history"]));
214  $lm_set->set("replace_mob_feature",
215  ilUtil::stripSlashes($_POST["replace_mob_feature"]));
216  $lm_set->set("html_export_ids",
217  ilUtil::stripSlashes($_POST["html_export_ids"]));
218  $lm_set->set("cont_upload_dir",
219  ilUtil::stripSlashes($_POST["cont_upload_dir"]));
220  $lm_set->setScormDebug("scormdebug_global_activate",
221  ilUtil::stripSlashes($_POST["scormdebug_global_activate"]));
222  $lm_set->set("scormdebug_disable_cache",
223  ilUtil::stripSlashes($_POST["scormdebug_disable_cache"]));
224  $lic_set = new ilSetting("license");
225  $lic_set->set("license_counter",
226  ilUtil::stripSlashes($_POST["license_counter"]));
227  $lic_set->set("license_warning",
228  ilUtil::stripSlashes($_POST["license_warning"]));
229 
230  ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
231 
232  $ilCtrl->redirect($this, "view");
233  }
234 }
235 ?>