ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjFileAccessSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
37 include_once "./Services/Object/classes/class.ilObjectGUI.php";
38 
40 {
41  private $disk_quota_obj;
42 
47  function ilObjFileAccessSettingsGUI($a_data,$a_id,$a_call_by_reference)
48  {
49  global $tree;
50 
51  $this->type = "facs";
52  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
53  $this->folderSettings = new ilSetting('fold');
54 
55  // Load the disk quota settings object
56  require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
57  $this->disk_quota_obj = new ilObjDiskQuotaSettings($a_id, $a_call_by_reference);
58  $this->disk_quota_obj->read();
59  }
66  public function executeCommand()
67  {
68  global $rbacsystem,$ilErr,$ilAccess, $ilias, $lng;
69 
70  $next_class = $this->ctrl->getNextClass($this);
71  $cmd = $this->ctrl->getCmd();
72 
73  $this->prepareOutput();
74 
75  if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
76  {
77  $ilias->raiseError($lng->txt('no_permission'),$ilias->error_obj->MESSAGE);
78  }
79 
80  switch($next_class)
81  {
82  case 'ilpermissiongui':
83  $this->tabs_gui->setTabActive('perm_settings');
84  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
85  $perm_gui =& new ilPermissionGUI($this);
86  $ret =& $this->ctrl->forwardCommand($perm_gui);
87  break;
88 
89  case 'ilfmsettingsgui':
90  $this->tabs_gui->setTabActive('fm_settings_tab');
91  include_once './Services/WebServices/FileManager/classes/class.ilFMSettingsGUI.php';
92  $fmg = new ilFMSettingsGUI($this);
93  $this->ctrl->forwardCommand($fmg);
94  break;
95 
96  default:
97  if(!$cmd || $cmd == 'view')
98  {
99  $cmd = "editDownloadingSettings";
100  }
101 
102  $this->$cmd();
103  break;
104  }
105  return true;
106  }
107 
114  public function getAdminTabs()
115  {
116  global $rbacsystem, $ilAccess;
117 
118  $GLOBALS['lng']->loadLanguageModule('fm');
119 
120  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
121  {
122  $this->tabs_gui->addTarget('downloading_settings',
123  $this->ctrl->getLinkTarget($this, "editDownloadingSettings"),
124  array("editDownloadingSettings", "view"));
125 
126  $this->tabs_gui->addTarget('webdav',
127  $this->ctrl->getLinkTarget($this, "editWebDAVSettings"),
128  array("editWebDAVSettings", "view"));
129 
130  $this->tabs_gui->addTarget(
131  'fm_settings_tab',
132  $this->ctrl->getLinkTargetByClass('ilFMSettingsGUI','settings'),
133  array(),
134  'ilfmsettingsgui'
135  );
136 
137  $this->tabs_gui->addTarget("disk_quota",
138  $this->ctrl->getLinkTarget($this, "editDiskQuotaSettings"),
139  array("editDiskQuota", "view"));
140  }
141  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
142  {
143  $this->tabs_gui->addTarget("perm_settings",
144  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
145  array(),'ilpermissiongui');
146  }
147  }
148 
152  public function editDownloadingSettings()
153  {
154  global $rbacsystem, $ilErr, $ilTabs;
155 
156  $this->tabs_gui->setTabActive('downloading_settings');
157 
158  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
159  {
160  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
161  }
162 
163  global $tpl, $ilCtrl, $lng, $tree, $settings;
164 
165  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
166  require_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
167  require_once("./Services/Form/classes/class.ilRadioGroupInputGUI.php");
168  require_once("./Services/Form/classes/class.ilRadioOption.php");
169  require_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
170 
171  $form = new ilPropertyFormGUI();
172  $form->setFormAction($ilCtrl->getFormAction($this));
173  $form->setTitle($lng->txt("settings"));
174 
175  // Backwards compatibility with ILIAS 3.9: Use the name of the
176  // uploaded file as the filename for the downloaded file instead
177  // of the title of the file object.
178  $dl_prop = new ilCheckboxInputGUI($lng->txt("download_with_uploaded_filename"), "download_with_uploaded_filename");
179  $dl_prop->setValue('1');
180  // default value should reflect previous behaviour (-> 0)
181  $dl_prop->setChecked($this->object->isDownloadWithUploadedFilename() == 1);
182  $dl_prop->setInfo($lng->txt('download_with_uploaded_filename_info'));
183  $form->addItem($dl_prop);
184 
185  // Show download action for folder
186  $dl_prop = new ilCheckboxInputGUI($lng->txt("enable_download_folder"), "enable_download_folder");
187  $dl_prop->setValue('1');
188  // default value should reflect previous behaviour (-> 0)
189  $dl_prop->setChecked($this->folderSettings->get("enable_download_folder", 0) == 1);
190  $dl_prop->setInfo($lng->txt('enable_download_folder_info'));
191  $form->addItem($dl_prop);
192 
193 
194  // Inline file extensions
195  $tai_prop = new ilTextAreaInputGUI($lng->txt('inline_file_extensions'), 'inline_file_extensions');
196  $tai_prop->setValue($this->object->getInlineFileExtensions());
197  $tai_prop->setInfo($lng->txt('inline_file_extensions_info'));
198  $tai_prop->setCols(80);
199  $tai_prop->setRows(5);
200  $form->addItem($tai_prop);
201 
202 
203  // command buttons
204  $form->addCommandButton('saveDownloadingSettings', $lng->txt('save'));
205  $form->addCommandButton('view', $lng->txt('cancel'));
206 
207  $tpl->setContent($form->getHTML());
208  }
209 
213  public function saveDownloadingSettings()
214  {
215  global $rbacsystem, $ilErr, $ilCtrl, $lng;
216 
217  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
218  {
219  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
220  }
221 
222  $this->object->setDownloadWithUploadedFilename(ilUtil::stripSlashes($_POST['download_with_uploaded_filename']));
223  $this->object->setInlineFileExtensions(ilUtil::stripSlashes($_POST['inline_file_extensions']));
224  $this->object->update();
225 
226  $this->folderSettings->set("enable_download_folder", $_POST["enable_download_folder"] == 1);
227 
228  ilUtil::sendInfo($lng->txt('settings_saved'),true);
229  $ilCtrl->redirect($this, "editDownloadingSettings");
230  }
231 
235  public function editWebDAVSettings()
236  {
237  global $rbacsystem, $ilErr, $ilTabs;
238  global $tpl, $ilCtrl, $lng, $tree, $settings;
239 
240 
241  $this->tabs_gui->setTabActive('webdav');
242 
243  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
244  {
245  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
246  }
247 
248  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
249  require_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
250  require_once("./Services/Form/classes/class.ilRadioGroupInputGUI.php");
251  require_once("./Services/Form/classes/class.ilRadioOption.php");
252  require_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
253  require_once("./Services/WebDAV/classes/class.ilDAVServer.php");
254 
255  $form = new ilPropertyFormGUI();
256  $form->setFormAction($ilCtrl->getFormAction($this));
257  $form->setTitle($lng->txt("settings"));
258 
259  // Enable webdav
260  $ilDAVServer = ilDAVServer::getInstance();
261  $isPearAuthHTTPInstalled = @include_once("Auth/HTTP.php");
262  $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_webdav"), "enable_webdav");
263  $cb_prop->setValue('1');
264  $cb_prop->setChecked($this->object->isWebdavEnabled() && $isPearAuthHTTPInstalled);
265  $cb_prop->setDisabled(! $isPearAuthHTTPInstalled);
266  $cb_prop->setInfo($isPearAuthHTTPInstalled ?
267  sprintf($lng->txt('enable_webdav_info'),$ilDAVServer->getMountURI($tree->getRootId(),0,null,null,true)) :
268  $lng->txt('webdav_pear_auth_http_needed')
269  );
270  $form->addItem($cb_prop);
271 
272  // Webdav help text
273  if ($isPearAuthHTTPInstalled)
274  {
275  $rgi_prop = new ilRadioGroupInputGUI($lng->txt('webfolder_instructions'), 'custom_webfolder_instructions_choice');
276  $rgi_prop->addOption(new ilRadioOption($lng->txt('use_default_instructions'), 'default'));
277  $rgi_prop->addOption(new ilRadioOption($lng->txt('use_customized_instructions'), 'custom'));
278  $rgi_prop->setValue($this->object->isCustomWebfolderInstructionsEnabled() ? 'custom':'default');
279  $rgi_prop->setDisabled(! $isPearAuthHTTPInstalled);
280  $form->addItem($rgi_prop);
281  $tai_prop = new ilTextAreaInputGUI('', 'custom_webfolder_instructions');
282  $tai_prop->setValue($this->object->getCustomWebfolderInstructions());
283  $tai_prop->setInfo($lng->txt("webfolder_instructions_info"));
284  $tai_prop->setCols(80);
285  $tai_prop->setRows(20);
286  $tai_prop->setDisabled(! $isPearAuthHTTPInstalled);
287  $form->addItem($tai_prop);
288  }
289 
290  // command buttons
291  $form->addCommandButton('saveWebDAVSettings', $lng->txt('save'));
292  $form->addCommandButton('view', $lng->txt('cancel'));
293 
294  $tpl->setContent($form->getHTML());
295  }
296 
300  public function saveWebDAVSettings()
301  {
302  global $rbacsystem, $ilErr, $ilCtrl, $lng;
303 
304  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
305  {
306  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
307  }
308 
309  $this->object->setWebdavEnabled($_POST['enable_webdav'] == '1');
310 // $this->object->setWebdavActionsVisible($_POST['webdav_actions_visible'] == '1');
311  $this->object->setCustomWebfolderInstructionsEnabled($_POST['custom_webfolder_instructions_choice']=='custom');
312  $this->object->setCustomWebfolderInstructions(ilUtil::stripSlashes($_POST['custom_webfolder_instructions'], false));
313  $this->object->update();
314 
315  ilUtil::sendInfo($lng->txt('settings_saved'),true);
316  $ilCtrl->redirect($this, "editWebDAVSettings");
317  }
318 
323  {
325  $this->tpl->setDescription($this->object->getDescription());
326  }
327 
328 
329  // DISK QUOTA --------------------------------------------------------------
333  function addDiskQuotaSubtabs($a_active_subtab)
334  {
335  global $ilCtrl, $ilTabs;
336 
337  include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
338 
339  $ilTabs->addSubTabTarget("settings",
340  $ilCtrl->getLinkTarget($this, "editDiskQuotaSettings"),
341  array("editDiskQuotaSettings"));
342 
343  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
345  {
346  $ilTabs->addSubTabTarget("disk_quota_report",
347  $ilCtrl->getLinkTarget($this, "viewDiskQuotaReport"),
348  array("viewDiskQuotaReport"));
349  }
350 
351  $ilTabs->addSubTabTarget("disk_quota_reminder_mail",
352  $ilCtrl->getLinkTarget($this, "editDiskQuotaMailTemplate"),
353  array("editDiskQuotaMailTemplate"));
354 
355  $ilTabs->setSubTabActive($a_active_subtab);
356  }
357 
358 
362  public function editDiskQuotaSettings()
363  {
364  global $rbacsystem, $ilErr, $ilSetting, $tpl, $lng, $ilCtrl;
365 
366 
367  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
368  {
369  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
370  }
371 
372  $this->tabs_gui->setTabActive('disk_quota');
373  $this->addDiskQuotaSubtabs('settings');
374 
375  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
376  require_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
377  require_once("./Services/Form/classes/class.ilRadioGroupInputGUI.php");
378  require_once("./Services/Form/classes/class.ilRadioOption.php");
379  require_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
380  require_once("./Services/WebDAV/classes/class.ilDAVServer.php");
381 
382  $form = new ilPropertyFormGUI();
383  $form->setFormAction($ilCtrl->getFormAction($this));
384  $form->setTitle($lng->txt("settings"));
385 
386 
387  // Enable disk quota
388  $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_disk_quota"), "enable_disk_quota");
389  $cb_prop->setValue('1');
390  $cb_prop->setChecked($this->disk_quota_obj->isDiskQuotaEnabled());
391  $cb_prop->setInfo($lng->txt('enable_disk_quota_info'));
392  $form->addItem($cb_prop);
393 
394  // Enable disk quota reminder mail
395  $cb_prop_reminder = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
396  $cb_prop_reminder->setValue('1');
397  $cb_prop_reminder->setChecked($this->disk_quota_obj->isDiskQuotaReminderMailEnabled());
398  $cb_prop_reminder->setInfo($lng->txt('disk_quota_reminder_mail_desc'));
399  $cb_prop->addSubItem($cb_prop_reminder);
400 
401  // Enable summary mail for certain users
402  $cb_prop_summary= new ilCheckboxInputGUI($lng->txt("enable_disk_quota_summary_mail"), "enable_disk_quota_summary_mail");
403  $cb_prop_summary->setValue(1);
404  $cb_prop_summary->setChecked($this->disk_quota_obj->isDiskQuotaSummaryMailEnabled());
405  $cb_prop_summary->setInfo($lng->txt('enable_disk_quota_summary_mail_desc'));
406  $cb_prop->addSubItem($cb_prop_summary);
407 
408  // Edit disk quota recipients
409  $summary_rcpt = new ilTextInputGUI($lng->txt("disk_quota_summary_rctp"), "disk_quota_summary_rctp");
410  $summary_rcpt->setValue($this->disk_quota_obj->getSummaryRecipients());
411  $summary_rcpt->setInfo($lng->txt('disk_quota_summary_rctp_desc'));
412  $cb_prop_summary->addSubItem($summary_rcpt);
413 
414  // command buttons
415  $form->addCommandButton('saveDiskQuotaSettings', $lng->txt('save'));
416  $form->addCommandButton('editDiskQuotaSettings', $lng->txt('cancel'));
417 
418  $tpl->setContent($form->getHTML());
419  }
420 
424  public function saveDiskQuotaSettings()
425  {
426  global $rbacsystem, $ilErr, $ilCtrl, $lng;
427 
428  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
429  {
430  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
431  }
432 
433  $this->disk_quota_obj->setDiskQuotaEnabled($_POST['enable_disk_quota'] == '1');
434  $this->disk_quota_obj->setDiskQuotaReminderMailEnabled($_POST['enable_disk_quota_reminder_mail'] == '1');
435  $this->disk_quota_obj->isDiskQuotaSummaryMailEnabled($_POST['enable_disk_quota_summary_mail'] == '1');
436  $this->disk_quota_obj->setSummaryRecipients(ilUtil::stripSlashes($_POST['disk_quota_summary_rctp']));
437  $this->disk_quota_obj->update();
438 
439 
440  ilUtil::sendInfo($lng->txt('settings_saved'),true);
441  $ilCtrl->redirect($this, "editDiskQuotaSettings");
442  }
443 
448  public function viewDiskQuotaReport()
449  {
450  global $rbacsystem, $ilErr, $ilSetting, $lng;
451 
452  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
453  {
454  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
455  }
456 
457  $this->tabs_gui->setTabActive('disk_quota');
458  $this->addDiskQuotaSubtabs('disk_quota_report');
459 
460  // nothing to do if disk quota is not active
461  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
463  {
464  return;
465  }
466 
467  // get the form
468  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.disk_quota_report.html',
469  "Services/WebDAV");
470 
471  // get the date of the last update
472  require_once("./Services/WebDAV/classes/class.ilDiskQuotaChecker.php");
474  if ($last_update == null)
475  {
476  // nothing to do if disk usage report has not been run
477  $this->tpl->setVariable('LAST_UPDATE_TEXT',$lng->txt('disk_quota_report_not_run_yet'));
478  return;
479  }
480  else
481  {
482  $this->tpl->setVariable('LAST_UPDATE_TEXT',$lng->txt('last_update').': '.ilFormat::formatDate($last_update,'datetime',true));
483  }
484 
485  // Filter
486  $_SESSION['quota_usage_filter'] = isset($_POST['usage_filter']) ? $_POST['usage_filter'] : $_SESSION['quota_usage_filter'];
487  if ($_SESSION['quota_usage_filter'] == 0)
488  {
489  $_SESSION['quota_usage_filter'] = 4;
490  }
491  $_SESSION['quota_access_filter'] = isset($_POST['access_filter']) ? $_POST['access_filter'] : $_SESSION['quota_access_filter'];
492  if ($_SESSION['quota_access_filter'] == 0)
493  {
494  $_SESSION['quota_access_filter'] = 1;
495  }
496  $usage_action[1] = $lng->txt('all_users');
497  $usage_action[2] = $lng->txt('filter_users_without_disk_usage');
498  $usage_action[3] = $lng->txt('filter_users_with_disk_usage');
499  $usage_action[4] = $lng->txt('filter_users_with_exceeded_disk_quota');
500  $access_action[1] = $lng->txt('all_users');
501  $access_action[2] = $lng->txt('filter_users_with_access');
502  $access_action[3] = $lng->txt('filter_users_without_access');
503 
504  $select_usage_filter = ilUtil::formSelect($_SESSION['quota_usage_filter'],"usage_filter",$usage_action,false,true);
505  $select_access_filter = ilUtil::formSelect($_SESSION['quota_access_filter'],"access_filter",$access_action,false,true);
506 
507  $this->tpl->setCurrentBlock("filter");
508  $this->tpl->setVariable("FILTER_TXT_FILTER",$lng->txt('filter'));
509  $this->tpl->setVariable("SELECT_USAGE_FILTER",$select_usage_filter);
510  $this->tpl->setVariable("SELECT_ACCESS_FILTER",$select_access_filter);
511  $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getLinkTarget($this, 'viewDiskQuotaReport'));
512  $this->tpl->setVariable("FILTER_NAME",'view');
513  $this->tpl->setVariable("FILTER_VALUE",$lng->txt('apply_filter'));
514  $this->tpl->parseCurrentBlock();
515 
516  // load templates for table
517  $a_tpl = new ilTemplate('tpl.table.html',true,true);
518  $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
519 
520  // create table
521  require_once './Services/Table/classes/class.ilTableGUI.php';
522  $tbl = new ilTableGUI(0, false);
523 
524  // title & header columns
525  $header_vars = array('login','firstname','lastname','email','access_until','last_login','disk_quota','disk_usage', 'last_reminder');
526  $tbl->setHeaderNames(
527  array(
528  $lng->txt('login'),
529  $lng->txt('firstname'),
530  $lng->txt('lastname'),
531  $lng->txt('email'),
532  $lng->txt('access_until'),
533  $lng->txt('last_login'),
534  $lng->txt('disk_quota'),
535  $lng->txt('disk_usage'),
536  $lng->txt('last_reminder')
537  )
538  );
539  $tbl->setHeaderVars(
540  $header_vars,
541  $this->ctrl->getParameterArray($this,'viewDiskQuotaReport',false)
542  );
543 
544  $tbl->enable("numinfo_header");
545  $tbl->setFormName("cmd");
546  $tbl->setSelectAllCheckbox("id");
547 
548  // sorting
549  $tbl->setOrderColumn($_GET["sort_by"]);
550  $tbl->setOrderDirection($_GET["sort_order"]);
551 
552  // fetch the data
554  $_SESSION['quota_usage_filter'],
555  $_SESSION['quota_access_filter'],
556  $header_vars[$tbl->getOrderColumn()], $tbl->getOrderDirection());
557 
558  // paging
559  $tbl->setLimit($_GET["limit"]);
560  $tbl->setOffset($_GET["offset"]);
561  $tbl->setMaxCount(count($data));
562 
563  // footer
564  $tbl->setFooter("tblfooter",$lng->txt("previous"),$lng->txt("next"));
565 
566  // render table
567  $tbl->setTemplate($a_tpl);
568 
569  // render rows
570  $count = 0;
571  for ($i = $tbl->getOffset(); $i < count($data) && $i < $tbl->getOffset() + $tbl->getLimit(); $i++)
572  {
573  $row = $data[$i];
574 
575  // build columns
576  foreach ($header_vars as $key)
577  {
578  switch ($key)
579  {
580  case 'login' :
581  //build link
582  $this->ctrl->setParameterByClass("ilobjusergui", "ref_id", "7");
583  $this->ctrl->setParameterByClass("ilobjusergui", "obj_id", $row["usr_id"]);
584  $link = $this->ctrl->getLinkTargetByClass("ilobjusergui", "view");
585  $tbl_content_cell = '<a href="'.$link.'">'.htmlspecialchars($row[$key]).'</a>';
586  break;
587  case 'disk_quota' :
588  if ($row['role_id'] == SYSTEM_ROLE_ID)
589  {
590  $tbl_content_cell = "<span class=\"smallgreen\">".$lng->txt('access_unlimited').'</span>';
591  }
592  else
593  {
594  $tbl_content_cell = ilFormat::formatSize($row[$key],'short');
595  }
596  break;
597  case 'disk_usage' :
598  if ($row['last_update'] == null)
599  {
600  $tbl_content_cell = $lng->txt('unknown');
601  }
602  else if ($row['disk_usage'] > $row['disk_quota'])
603  {
604  $tbl_content_cell = "<span class=\"smallred\">".ilFormat::formatSize($row[$key],'short').'</span>';
605  }
606  else
607  {
608  $tbl_content_cell = ilFormat::formatSize($row[$key],'short');
609  }
610  break;
611  case 'access_until' :
612  if (! $row['active'])
613  {
614  $tbl_content_cell = "<span class=\"smallred\">".$lng->txt('inactive').'</span>';
615  }
616  else if ($row['time_limit_unlimited'])
617  {
618  $tbl_content_cell = "<span class=\"smallgreen\">".$lng->txt('access_unlimited').'</span>';
619  }
620  else if ($row['expired'])
621  {
622  $tbl_content_cell = "<span class=\"smallred\">".$lng->txt('access_expired').'</span>';
623  }
624  else
625  {
626  $tbl_content_cell = ilFormat::formatDate($row[$key]);
627  }
628  break;
629  case 'last_login' :
630  case 'last_reminder' :
631  if ($row[$key] == null)
632  {
633  $tbl_content_cell = $lng->txt('no_date');
634  }
635  else
636  {
637  $tbl_content_cell = ilFormat::formatDate($row[$key]);
638  }
639  break;
640  default :
641  $tbl_content_cell = htmlspecialchars($row[$key]);
642  }
643  /*
644  if (is_array($tbl_content_cell))
645  {
646  $tbl->tpl->setCurrentBlock("tbl_cell_subtitle");
647  $tbl->tpl->setVariable("TBL_CELL_SUBTITLE",$tbl_content_cell[1]);
648  $tbl->tpl->parseCurrentBlock();
649  $tbl_content_cell = "<b>".$tbl_content_cell[0]."</b>";
650  }*/
651 
652  $tbl->tpl->setCurrentBlock("tbl_content_cell");
653  $tbl->tpl->setVariable("TBL_CONTENT_CELL",$tbl_content_cell);
654 
655  $tbl->tpl->parseCurrentBlock();
656  }
657 
658  $tbl->tpl->setCurrentBlock("tbl_content_row");
659  $rowcolor = ilUtil::switchColor($count,"tblrow1","tblrow2");
660  $tbl->tpl->setVariable("ROWCOLOR", $rowcolor);
661  $tbl->tpl->parseCurrentBlock();
662 
663  $count++;
664  }
665  $tbl->render();
666 
667  // Add table to page
668  $this->tpl->setVariable("USER_TABLE",$a_tpl->get());
669  }
670 
674  public function editDiskQuotaMailTemplate()
675  {
676  global $rbacsystem, $ilErr, $ilSetting, $tpl, $lng, $ilCtrl;
677 
678  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
679  {
680  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
681  }
682 
683  $this->tabs_gui->setTabActive('disk_quota');
684  $this->addDiskQuotaSubtabs('disk_quota_reminder_mail');
685 
686  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.disk_quota_reminder_mail.html',
687  "Services/WebDAV");
688  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
689  $this->tpl->setVariable("IMG_MAIL", ilUtil::getImagePath("icon_mail.png"));
690 
691  $lng->loadLanguageModule("meta");
692  $lng->loadLanguageModule("mail");
693  $this->tpl->setVariable("TXT_NEW_USER_ACCOUNT_MAIL", $lng->txt("disk_quota_reminder_mail"));
694  $this->tpl->setVariable("TXT_NEW_USER_ACCOUNT_MAIL_DESC", $lng->txt("disk_quota_reminder_mail_desc"));
695 
696  // placeholder help text
697  $this->tpl->setVariable("TXT_USE_PLACEHOLDERS", $lng->txt("mail_nacc_use_placeholder"));
698  $this->tpl->setVariable("TXT_MAIL_SALUTATION", $lng->txt("mail_nacc_salutation"));
699  $this->tpl->setVariable("TXT_FIRST_NAME", $lng->txt("firstname"));
700  $this->tpl->setVariable("TXT_LAST_NAME", $lng->txt("lastname"));
701  $this->tpl->setVariable("TXT_EMAIL", $lng->txt("email"));
702  $this->tpl->setVariable("TXT_LOGIN", $lng->txt("mail_nacc_login"));
703  $this->tpl->setVariable("TXT_DISK_QUOTA", $lng->txt("disk_quota"));
704  $this->tpl->setVariable("TXT_DISK_USAGE", $lng->txt("disk_usage"));
705  $this->tpl->setVariable("TXT_DISK_USAGE_DETAILS", $lng->txt("disk_usage_details"));
706  $this->tpl->setVariable("TXT_ADMIN_MAIL", $lng->txt("mail_nacc_admin_mail"));
707  $this->tpl->setVariable("TXT_ILIAS_URL", $lng->txt("mail_nacc_ilias_url"));
708  $this->tpl->setVariable("TXT_CLIENT_NAME", $lng->txt("mail_nacc_client_name"));
709 
710  $langs = $lng->getInstalledLanguages();
711  foreach($langs as $lang_key)
712  {
713  $amail = $this->disk_quota_obj->_lookupReminderMailTemplate($lang_key);
714  $this->tpl->setCurrentBlock("mail_block");
715  $add = "";
716  if ($lang_key == $lng->getDefaultLanguage())
717  {
718  $add = " (".$lng->txt("default").")";
719  }
720  $this->tpl->setVariable("TXT_LANGUAGE",
721  $lng->txt("meta_l_".$lang_key).$add);
722  $this->tpl->setVariable("TXT_BODY", $lng->txt("message_content"));
723  $this->tpl->setVariable("TA_BODY", "body_".$lang_key);
724  $this->tpl->setVariable("VAL_BODY",
725  ilUtil::prepareFormOutput($amail["body"]));
726  $this->tpl->setVariable("TXT_SUBJECT", $lng->txt("subject"));
727  $this->tpl->setVariable("INPUT_SUBJECT", "subject_".$lang_key);
728  $this->tpl->setVariable("VAL_SUBJECT",
729  ilUtil::prepareFormOutput($amail["subject"]));
730  $this->tpl->setVariable("TXT_SAL_G", $lng->txt("mail_salutation_general"));
731  $this->tpl->setVariable("INPUT_SAL_G", "sal_g_".$lang_key);
732  $this->tpl->setVariable("VAL_SAL_G",
733  ilUtil::prepareFormOutput($amail["sal_g"]));
734  $this->tpl->setVariable("TXT_SAL_M", $lng->txt("mail_salutation_male"));
735  $this->tpl->setVariable("INPUT_SAL_M", "sal_m_".$lang_key);
736  $this->tpl->setVariable("VAL_SAL_M",
737  ilUtil::prepareFormOutput($amail["sal_m"]));
738  $this->tpl->setVariable("TXT_SAL_F", $lng->txt("mail_salutation_female"));
739  $this->tpl->setVariable("INPUT_SAL_F", "sal_f_".$lang_key);
740  $this->tpl->setVariable("VAL_SAL_F",
741  ilUtil::prepareFormOutput($amail["sal_f"]));
742  $this->tpl->parseCurrentBlock();
743  }
744  $this->tpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
745  $this->tpl->setVariable("TXT_SAVE", $lng->txt("save"));
746  }
748  {
749  $this->ctrl->redirect($this, "editDiskQuotaSettings");
750  }
751 
753  {
754  global $lng;
755 
756  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
757  $langs = $lng->getInstalledLanguages();
758  foreach($langs as $lang_key)
759  {
760  $this->disk_quota_obj->_writeReminderMailTemplate($lang_key,
761  ilUtil::stripSlashes($_POST["subject_".$lang_key]),
762  ilUtil::stripSlashes($_POST["sal_g_".$lang_key]),
763  ilUtil::stripSlashes($_POST["sal_f_".$lang_key]),
764  ilUtil::stripSlashes($_POST["sal_m_".$lang_key]),
765  ilUtil::stripSlashes($_POST["body_".$lang_key]));
766  }
767  $this->ctrl->redirect($this, "editDiskQuotaMailTemplate");
768  }
769 
770 }
771 ?>