ILIAS  Release_4_4_x_branch Revision 61816
 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 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
6 
20 {
21  private static $ERROR_MESSAGE;
27  public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
28  {
29  $this->type = 'lrss';
30  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
31 
32  $this->lng->loadLanguageModule('content');
33  }
34 
41  public function executeCommand()
42  {
43  global $rbacsystem,$ilErr,$ilAccess;
44 
45  $next_class = $this->ctrl->getNextClass($this);
46  $cmd = $this->ctrl->getCmd();
47 
48  $this->prepareOutput();
49 
50  if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
51  {
52  $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
53  }
54 
55  switch($next_class)
56  {
57  case 'illicenseoverviewgui':
58  include_once("./Services/License/classes/class.ilLicenseOverviewGUI.php");
59  $license_gui =& new ilLicenseOverviewGUI($this,LIC_MODE_ADMINISTRATION);
60  $ret =& $this->ctrl->forwardCommand($license_gui);
61  break;
62 
63  case 'ilpermissiongui':
64  $this->tabs_gui->setTabActive('perm_settings');
65  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
66  $perm_gui =& new ilPermissionGUI($this);
67  $ret =& $this->ctrl->forwardCommand($perm_gui);
68  break;
69 
70  default:
71  if(!$cmd || $cmd == 'view')
72  {
73  $cmd = "editSettings";
74  }
75 
76  $this->$cmd();
77  break;
78  }
79  return true;
80  }
81 
88  public function getAdminTabs()
89  {
90  global $rbacsystem, $ilAccess, $ilSetting;
91 
92  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
93  {
94  $this->tabs_gui->addTarget("cont_edit_lrs_settings",
95  $this->ctrl->getLinkTarget($this, "editSettings"),
96  array("editSettings", "view"));
97 
98  include_once("Services/License/classes/class.ilLicenseAccess.php");
100  {
101  $this->tabs_gui->addTarget("licenses",
102  $this->ctrl->getLinkTargetByClass('illicenseoverviewgui', ''),
103  "", "illicenseoverviewgui");
104  }
105  }
106 
107  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
108  {
109  $this->tabs_gui->addTarget("perm_settings",
110  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
111  array(),'ilpermissiongui');
112  }
113  }
114 
118  public function editSettings()
119  {
120  global $ilCtrl, $lng, $ilSetting;
121 
122  $lm_set = new ilSetting("lm");
123  $lic_set = new ilSetting("license");
124  $lng->loadLanguageModule("license");
125  $lng->loadLanguageModule("scormdebug");
126 
127  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
128  $form = new ilPropertyFormGUI();
129  $form->setFormAction($ilCtrl->getFormAction($this));
130  $form->setTitle($lng->txt("cont_lrs_settings"));
131 
132  // Page History
133  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_enable_page_history"),
134  "page_history");
135  $cb_prop->setInfo($lng->txt("cont_enable_page_history_info"));
136  $cb_prop->setChecked($lm_set->get("page_history", 1));
137  $form->addItem($cb_prop);
138 
139  // Time scheduled page activation
140  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_enable_time_scheduled_page_activation"),
141  "time_scheduled_page_activation");
142  $cb_prop->setInfo($lng->txt("cont_enable_time_scheduled_page_activation_info"));
143  $cb_prop->setChecked($lm_set->get("time_scheduled_page_activation"));
144  $form->addItem($cb_prop);
145 
146  // Activate replace media object function
147  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_replace_mob_feature"),
148  "replace_mob_feature");
149  $cb_prop->setInfo($lng->txt("cont_replace_mob_feature_info"));
150  $cb_prop->setChecked($lm_set->get("replace_mob_feature"));
151  $form->addItem($cb_prop);
152 
153  // Activate HTML export IDs
154  $cb_prop = new ilCheckboxInputGUI($lng->txt("cont_html_export_ids"),
155  "html_export_ids");
156  $cb_prop->setInfo($lng->txt("cont_html_export_ids_info"));
157  $cb_prop->setChecked($lm_set->get("html_export_ids"));
158  $form->addItem($cb_prop);
159 
160  // Upload dir for learning resources
161  $tx_prop = new ilTextInputGUI($lng->txt("cont_upload_dir"),
162  "cont_upload_dir");
163  $tx_prop->setInfo($lng->txt("cont_upload_dir_info"));
164  $tx_prop->setValue($lm_set->get("cont_upload_dir"));
165  $form->addItem($tx_prop);
166 
167 
168  // license activation
169  $cb_prop = new ilCheckboxInputGUI($lng->txt("license_counter"),
170  "license_counter");
171  $cb_prop->setInfo($lng->txt("license_counter_info"));
172  $cb_prop->setChecked($lic_set->get("license_counter"));
173  $form->addItem($cb_prop);
174 
175  // license warning
176  $tx_prop = new ilTextInputGUI($lng->txt("license_warning"),
177  "license_warning");
178  $tx_prop->setSize(5);
179  $tx_prop->setInfo($lng->txt("license_warning_info"));
180  $tx_prop->setValue($lic_set->get("license_warning"));
181  $form->addItem($tx_prop);
182 
183  // scormDebugger activation
184  $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_global_activate"),"scormdebug_global_activate");
185  $cb_prop->setInfo($lng->txt("scormdebug_global_activate_info"));
186  $cb_prop->setChecked($lm_set->get("scormdebug_global_activate"));
187  $form->addItem($cb_prop);
188 
189  // scorm2004 login instead of userId for cmi.learner_id
190  $cb_prop = new ilCheckboxInputGUI($lng->txt("scorm_login_as_learner_id"),
191  "scorm_login_as_learner_id");
192  $cb_prop->setInfo($lng->txt("scorm_login_as_learner_id_info"));
193  $cb_prop->setChecked($lm_set->get("scorm_login_as_learner_id"));
194  $form->addItem($cb_prop);
195 
196  // scorm2004 disableRTECaching
197  $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_disable_cache"),
198  "scormdebug_disable_cache");
199  $cb_prop->setInfo($lng->txt("scormdebug_disable_cache_info"));
200  $cb_prop->setChecked($lm_set->get("scormdebug_disable_cache"));
201  $form->addItem($cb_prop);
202 
203  // scorm2004 without session
204  $cb_prop = new ilCheckboxInputGUI($lng->txt("scorm_without_session"),
205  "scorm_without_session");
206  $cb_prop->setInfo($lng->txt("scorm_without_session_info"));
207  $cb_prop->setChecked($lm_set->get("scorm_without_session"));
208  $form->addItem($cb_prop);
209 
210  $privacy = ilPrivacySettings::_getInstance();
211  $check = new ilCheckboxInputGui($lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
212  $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
213  $check->setChecked($privacy->enabledSahsProtocolData());
214  $form->addItem($check);
215 
216  // command buttons
217  $form->addCommandButton("saveSettings", $lng->txt("save"));
218  $form->addCommandButton("view", $lng->txt("cancel"));
219 
220  $this->tpl->setContent($form->getHTML());
221  }
222 
226  public function saveSettings()
227  {
228  global $ilCtrl, $ilSetting;
229 
230  $lm_set = new ilSetting("lm");
231  $lm_set->set("time_scheduled_page_activation",
232  ilUtil::stripSlashes($_POST["time_scheduled_page_activation"]));
233  $lm_set->set("page_history",
234  (int) ilUtil::stripSlashes($_POST["page_history"]));
235  $lm_set->set("replace_mob_feature",
236  ilUtil::stripSlashes($_POST["replace_mob_feature"]));
237  $lm_set->set("html_export_ids",
238  ilUtil::stripSlashes($_POST["html_export_ids"]));
239  $lm_set->set("cont_upload_dir",
240  ilUtil::stripSlashes($_POST["cont_upload_dir"]));
241  $lm_set->setScormDebug("scormdebug_global_activate",
242  ilUtil::stripSlashes($_POST["scormdebug_global_activate"]));
243  $lm_set->set("scorm_login_as_learner_id",
244  ilUtil::stripSlashes($_POST["scorm_login_as_learner_id"]));
245  $lm_set->set("scormdebug_disable_cache",
246  ilUtil::stripSlashes($_POST["scormdebug_disable_cache"]));
247  $lm_set->set("scorm_without_session",
248  ilUtil::stripSlashes($_POST["scorm_without_session"]));
249  $lic_set = new ilSetting("license");
250  $lic_set->set("license_counter",
251  ilUtil::stripSlashes($_POST["license_counter"]));
252  $lic_set->set("license_warning",
253  ilUtil::stripSlashes($_POST["license_warning"]));
254 
255  $privacy = ilPrivacySettings::_getInstance();
256  $privacy->enableSahsProtocolData((int) $_POST['enable_sahs_pd']);
257  $privacy->save();
258 
259  ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
260 
261  $ilCtrl->redirect($this, "view");
262  }
263 
264  public function addToExternalSettingsForm($a_form_id)
265  {
266  switch($a_form_id)
267  {
269 
270  $privacy = ilPrivacySettings::_getInstance();
271 
272  $fields = array('enable_sahs_protocol_data' => array($privacy->enabledSahsProtocolData(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
273 
274  return array(array("editSettings", $fields));
275  }
276  }
277 }
278 
279 ?>