ILIAS  Release_4_2_x_branch Revision 61807
 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 "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  default:
90  if(!$cmd || $cmd == 'view')
91  {
92  $cmd = "editDownloadingSettings";
93  }
94 
95  $this->$cmd();
96  break;
97  }
98  return true;
99  }
100 
107  public function getAdminTabs()
108  {
109  global $rbacsystem, $ilAccess;
110 
111  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
112  {
113  $this->tabs_gui->addTarget('downloading_settings',
114  $this->ctrl->getLinkTarget($this, "editDownloadingSettings"),
115  array("editDownloadingSettings", "view"));
116 
117  $this->tabs_gui->addTarget('webdav',
118  $this->ctrl->getLinkTarget($this, "editWebDAVSettings"),
119  array("editWebDAVSettings", "view"));
120 
121  $this->tabs_gui->addTarget("disk_quota",
122  $this->ctrl->getLinkTarget($this, "editDiskQuotaSettings"),
123  array("editDiskQuota", "view"));
124  }
125  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
126  {
127  $this->tabs_gui->addTarget("perm_settings",
128  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
129  array(),'ilpermissiongui');
130  }
131  }
132 
136  public function editDownloadingSettings()
137  {
138  global $rbacsystem, $ilErr, $ilTabs;
139 
140  $this->tabs_gui->setTabActive('downloading_settings');
141 
142  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
143  {
144  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
145  }
146 
147  global $tpl, $ilCtrl, $lng, $tree, $settings;
148 
149  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
150  require_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
151  require_once("./Services/Form/classes/class.ilRadioGroupInputGUI.php");
152  require_once("./Services/Form/classes/class.ilRadioOption.php");
153  require_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
154 
155  $form = new ilPropertyFormGUI();
156  $form->setFormAction($ilCtrl->getFormAction($this));
157  $form->setTitle($lng->txt("settings"));
158 
159  // Backwards compatibility with ILIAS 3.9: Use the name of the
160  // uploaded file as the filename for the downloaded file instead
161  // of the title of the file object.
162  $dl_prop = new ilCheckboxInputGUI($lng->txt("download_with_uploaded_filename"), "download_with_uploaded_filename");
163  $dl_prop->setValue('1');
164  // default value should reflect previous behaviour (-> 0)
165  $dl_prop->setChecked($this->object->isDownloadWithUploadedFilename() == 1);
166  $dl_prop->setInfo($lng->txt('download_with_uploaded_filename_info'));
167  $form->addItem($dl_prop);
168 
169  // Show download action for folder
170  $dl_prop = new ilCheckboxInputGUI($lng->txt("enable_download_folder"), "enable_download_folder");
171  $dl_prop->setValue('1');
172  // default value should reflect previous behaviour (-> 0)
173  $dl_prop->setChecked($this->folderSettings->get("enable_download_folder", 0) == 1);
174  $dl_prop->setInfo($lng->txt('enable_download_folder_info'));
175  $form->addItem($dl_prop);
176 
177 
178  // Inline file extensions
179  $tai_prop = new ilTextAreaInputGUI($lng->txt('inline_file_extensions'), 'inline_file_extensions');
180  $tai_prop->setValue($this->object->getInlineFileExtensions());
181  $tai_prop->setInfo($lng->txt('inline_file_extensions_info'));
182  $tai_prop->setCols(80);
183  $tai_prop->setRows(5);
184  $form->addItem($tai_prop);
185 
186 
187  // command buttons
188  $form->addCommandButton('saveDownloadingSettings', $lng->txt('save'));
189  $form->addCommandButton('view', $lng->txt('cancel'));
190 
191  $tpl->setContent($form->getHTML());
192  }
193 
197  public function saveDownloadingSettings()
198  {
199  global $rbacsystem, $ilErr, $ilCtrl, $lng;
200 
201  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
202  {
203  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
204  }
205 
206  $this->object->setDownloadWithUploadedFilename(ilUtil::stripSlashes($_POST['download_with_uploaded_filename']));
207  $this->object->setInlineFileExtensions(ilUtil::stripSlashes($_POST['inline_file_extensions']));
208  $this->object->update();
209 
210  $this->folderSettings->set("enable_download_folder", $_POST["enable_download_folder"] == 1);
211 
212  ilUtil::sendInfo($lng->txt('settings_saved'),true);
213  $ilCtrl->redirect($this, "editDownloadingSettings");
214  }
215 
219  public function editWebDAVSettings()
220  {
221  global $rbacsystem, $ilErr, $ilTabs;
222  global $tpl, $ilCtrl, $lng, $tree, $settings;
223 
224 
225  $this->tabs_gui->setTabActive('webdav');
226 
227  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
228  {
229  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
230  }
231 
232  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
233  require_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
234  require_once("./Services/Form/classes/class.ilRadioGroupInputGUI.php");
235  require_once("./Services/Form/classes/class.ilRadioOption.php");
236  require_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
237  require_once("./Services/WebDAV/classes/class.ilDAVServer.php");
238 
239  $form = new ilPropertyFormGUI();
240  $form->setFormAction($ilCtrl->getFormAction($this));
241  $form->setTitle($lng->txt("settings"));
242 
243  // Enable webdav
244  $ilDAVServer = ilDAVServer::getInstance();
245  $isPearAuthHTTPInstalled = @include_once("Auth/HTTP.php");
246  $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_webdav"), "enable_webdav");
247  $cb_prop->setValue('1');
248  $cb_prop->setChecked($this->object->isWebdavEnabled() && $isPearAuthHTTPInstalled);
249  $cb_prop->setDisabled(! $isPearAuthHTTPInstalled);
250  $cb_prop->setInfo($isPearAuthHTTPInstalled ?
251  sprintf($lng->txt('enable_webdav_info'),$ilDAVServer->getMountURI($tree->getRootId(),0,null,null,true)) :
252  $lng->txt('webdav_pear_auth_http_needed')
253  );
254  $form->addItem($cb_prop);
255 
256  // Webdav help text
257  if ($isPearAuthHTTPInstalled)
258  {
259  $rgi_prop = new ilRadioGroupInputGUI($lng->txt('webfolder_instructions'), 'custom_webfolder_instructions_choice');
260  $rgi_prop->addOption(new ilRadioOption($lng->txt('use_default_instructions'), 'default'));
261  $rgi_prop->addOption(new ilRadioOption($lng->txt('use_customized_instructions'), 'custom'));
262  $rgi_prop->setValue($this->object->isCustomWebfolderInstructionsEnabled() ? 'custom':'default');
263  $rgi_prop->setDisabled(! $isPearAuthHTTPInstalled);
264  $form->addItem($rgi_prop);
265  $tai_prop = new ilTextAreaInputGUI('', 'custom_webfolder_instructions');
266  $tai_prop->setValue($this->object->getCustomWebfolderInstructions());
267  $tai_prop->setInfo($lng->txt("webfolder_instructions_info"));
268  $tai_prop->setCols(80);
269  $tai_prop->setRows(20);
270  $tai_prop->setDisabled(! $isPearAuthHTTPInstalled);
271  $form->addItem($tai_prop);
272  }
273 
274  // command buttons
275  $form->addCommandButton('saveWebDAVSettings', $lng->txt('save'));
276  $form->addCommandButton('view', $lng->txt('cancel'));
277 
278  $tpl->setContent($form->getHTML());
279  }
280 
284  public function saveWebDAVSettings()
285  {
286  global $rbacsystem, $ilErr, $ilCtrl, $lng;
287 
288  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
289  {
290  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
291  }
292 
293  $this->object->setWebdavEnabled($_POST['enable_webdav'] == '1');
294 // $this->object->setWebdavActionsVisible($_POST['webdav_actions_visible'] == '1');
295  $this->object->setCustomWebfolderInstructionsEnabled($_POST['custom_webfolder_instructions_choice']=='custom');
296  $this->object->setCustomWebfolderInstructions(ilUtil::stripSlashes($_POST['custom_webfolder_instructions'], false));
297  $this->object->update();
298 
299  ilUtil::sendInfo($lng->txt('settings_saved'),true);
300  $ilCtrl->redirect($this, "editWebDAVSettings");
301  }
302 
307  {
309  $this->tpl->setDescription($this->object->getDescription());
310  }
311 
312 
313  // DISK QUOTA --------------------------------------------------------------
317  function addDiskQuotaSubtabs($a_active_subtab)
318  {
319  global $ilCtrl, $ilTabs;
320 
321  include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
322 
323  $ilTabs->addSubTabTarget("settings",
324  $ilCtrl->getLinkTarget($this, "editDiskQuotaSettings"),
325  array("editDiskQuotaSettings"));
326 
327  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
329  {
330  $ilTabs->addSubTabTarget("disk_quota_report",
331  $ilCtrl->getLinkTarget($this, "viewDiskQuotaReport"),
332  array("viewDiskQuotaReport"));
333  }
334 
335  $ilTabs->addSubTabTarget("disk_quota_reminder_mail",
336  $ilCtrl->getLinkTarget($this, "editDiskQuotaMailTemplate"),
337  array("editDiskQuotaMailTemplate"));
338 
339  $ilTabs->setSubTabActive($a_active_subtab);
340  }
341 
342 
346  public function editDiskQuotaSettings()
347  {
348  global $rbacsystem, $ilErr, $ilSetting, $tpl, $lng, $ilCtrl;
349 
350 
351  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
352  {
353  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
354  }
355 
356  $this->tabs_gui->setTabActive('disk_quota');
357  $this->addDiskQuotaSubtabs('settings');
358 
359  require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
360  require_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
361  require_once("./Services/Form/classes/class.ilRadioGroupInputGUI.php");
362  require_once("./Services/Form/classes/class.ilRadioOption.php");
363  require_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
364  require_once("./Services/WebDAV/classes/class.ilDAVServer.php");
365 
366  $form = new ilPropertyFormGUI();
367  $form->setFormAction($ilCtrl->getFormAction($this));
368  $form->setTitle($lng->txt("settings"));
369 
370 
371  // Enable disk quota
372  $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_disk_quota"), "enable_disk_quota");
373  $cb_prop->setValue('1');
374  $cb_prop->setChecked($this->disk_quota_obj->isDiskQuotaEnabled());
375  $cb_prop->setInfo($lng->txt('enable_disk_quota_info'));
376  $form->addItem($cb_prop);
377 
378  // Enable disk quota reminder mail
379  $cb_prop_reminder = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
380  $cb_prop_reminder->setValue('1');
381  $cb_prop_reminder->setChecked($this->disk_quota_obj->isDiskQuotaReminderMailEnabled());
382  $cb_prop_reminder->setInfo($lng->txt('disk_quota_reminder_mail_desc'));
383  $cb_prop->addSubItem($cb_prop_reminder);
384 
385  // Enable summary mail for certain users
386  $cb_prop_summary= new ilCheckboxInputGUI($lng->txt("enable_disk_quota_summary_mail"), "enable_disk_quota_summary_mail");
387  $cb_prop_summary->setValue(1);
388  $cb_prop_summary->setChecked($this->disk_quota_obj->isDiskQuotaSummaryMailEnabled());
389  $cb_prop_summary->setInfo($lng->txt('enable_disk_quota_summary_mail_desc'));
390  $cb_prop->addSubItem($cb_prop_summary);
391 
392  // Edit disk quota recipients
393  $summary_rcpt = new ilTextInputGUI($lng->txt("disk_quota_summary_rctp"), "disk_quota_summary_rctp");
394  $summary_rcpt->setValue($this->disk_quota_obj->getSummaryRecipients());
395  $summary_rcpt->setInfo($lng->txt('disk_quota_summary_rctp_desc'));
396  $cb_prop_summary->addSubItem($summary_rcpt);
397 
398  // command buttons
399  $form->addCommandButton('saveDiskQuotaSettings', $lng->txt('save'));
400  $form->addCommandButton('editDiskQuotaSettings', $lng->txt('cancel'));
401 
402  $tpl->setContent($form->getHTML());
403  }
404 
408  public function saveDiskQuotaSettings()
409  {
410  global $rbacsystem, $ilErr, $ilCtrl, $lng;
411 
412  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
413  {
414  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
415  }
416 
417  $this->disk_quota_obj->setDiskQuotaEnabled($_POST['enable_disk_quota'] == '1');
418  $this->disk_quota_obj->setDiskQuotaReminderMailEnabled($_POST['enable_disk_quota_reminder_mail'] == '1');
419  $this->disk_quota_obj->isDiskQuotaSummaryMailEnabled($_POST['enable_disk_quota_summary_mail'] == '1');
420  $this->disk_quota_obj->setSummaryRecipients(ilUtil::stripSlashes($_POST['disk_quota_summary_rctp']));
421  $this->disk_quota_obj->update();
422 
423 
424  ilUtil::sendInfo($lng->txt('settings_saved'),true);
425  $ilCtrl->redirect($this, "editDiskQuotaSettings");
426  }
427 
432  public function viewDiskQuotaReport()
433  {
434  global $rbacsystem, $ilErr, $ilSetting, $lng;
435 
436  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
437  {
438  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
439  }
440 
441  $this->tabs_gui->setTabActive('disk_quota');
442  $this->addDiskQuotaSubtabs('disk_quota_report');
443 
444  // nothing to do if disk quota is not active
445  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
447  {
448  return;
449  }
450 
451  // get the form
452  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.disk_quota_report.html');
453 
454  // get the date of the last update
455  require_once("./Services/WebDAV/classes/class.ilDiskQuotaChecker.php");
457  if ($last_update == null)
458  {
459  // nothing to do if disk usage report has not been run
460  $this->tpl->setVariable('LAST_UPDATE_TEXT',$lng->txt('disk_quota_report_not_run_yet'));
461  return;
462  }
463  else
464  {
465  $this->tpl->setVariable('LAST_UPDATE_TEXT',$lng->txt('last_update').': '.ilFormat::formatDate($last_update,'datetime',true));
466  }
467 
468  // Filter
469  $_SESSION['quota_usage_filter'] = isset($_POST['usage_filter']) ? $_POST['usage_filter'] : $_SESSION['quota_usage_filter'];
470  if ($_SESSION['quota_usage_filter'] == 0)
471  {
472  $_SESSION['quota_usage_filter'] = 4;
473  }
474  $_SESSION['quota_access_filter'] = isset($_POST['access_filter']) ? $_POST['access_filter'] : $_SESSION['quota_access_filter'];
475  if ($_SESSION['quota_access_filter'] == 0)
476  {
477  $_SESSION['quota_access_filter'] = 1;
478  }
479  $usage_action[1] = $lng->txt('all_users');
480  $usage_action[2] = $lng->txt('filter_users_without_disk_usage');
481  $usage_action[3] = $lng->txt('filter_users_with_disk_usage');
482  $usage_action[4] = $lng->txt('filter_users_with_exceeded_disk_quota');
483  $access_action[1] = $lng->txt('all_users');
484  $access_action[2] = $lng->txt('filter_users_with_access');
485  $access_action[3] = $lng->txt('filter_users_without_access');
486 
487  $select_usage_filter = ilUtil::formSelect($_SESSION['quota_usage_filter'],"usage_filter",$usage_action,false,true);
488  $select_access_filter = ilUtil::formSelect($_SESSION['quota_access_filter'],"access_filter",$access_action,false,true);
489 
490  $this->tpl->setCurrentBlock("filter");
491  $this->tpl->setVariable("FILTER_TXT_FILTER",$lng->txt('filter'));
492  $this->tpl->setVariable("SELECT_USAGE_FILTER",$select_usage_filter);
493  $this->tpl->setVariable("SELECT_ACCESS_FILTER",$select_access_filter);
494  $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getLinkTarget($this, 'viewDiskQuotaReport'));
495  $this->tpl->setVariable("FILTER_NAME",'view');
496  $this->tpl->setVariable("FILTER_VALUE",$lng->txt('apply_filter'));
497  $this->tpl->parseCurrentBlock();
498 
499  // load templates for table
500  $a_tpl = new ilTemplate('tpl.table.html',true,true);
501  $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
502 
503  // create table
504  require_once './Services/Table/classes/class.ilTableGUI.php';
505  $tbl = new ilTableGUI(0, false);
506 
507  // title & header columns
508  $header_vars = array('login','firstname','lastname','email','access_until','last_login','disk_quota','disk_usage', 'last_reminder');
509  $tbl->setHeaderNames(
510  array(
511  $lng->txt('login'),
512  $lng->txt('firstname'),
513  $lng->txt('lastname'),
514  $lng->txt('email'),
515  $lng->txt('access_until'),
516  $lng->txt('last_login'),
517  $lng->txt('disk_quota'),
518  $lng->txt('disk_usage'),
519  $lng->txt('last_reminder')
520  )
521  );
522  $tbl->setHeaderVars(
523  $header_vars,
524  $this->ctrl->getParameterArray($this,'viewDiskQuotaReport',false)
525  );
526 
527  $tbl->enable("numinfo_header");
528  $tbl->setFormName("cmd");
529  $tbl->setSelectAllCheckbox("id");
530 
531  // sorting
532  $tbl->setOrderColumn($_GET["sort_by"]);
533  $tbl->setOrderDirection($_GET["sort_order"]);
534 
535  // fetch the data
537  $_SESSION['quota_usage_filter'],
538  $_SESSION['quota_access_filter'],
539  $header_vars[$tbl->getOrderColumn()], $tbl->getOrderDirection());
540 
541  // paging
542  $tbl->setLimit($_GET["limit"]);
543  $tbl->setOffset($_GET["offset"]);
544  $tbl->setMaxCount(count($data));
545 
546  // footer
547  $tbl->setFooter("tblfooter",$lng->txt("previous"),$lng->txt("next"));
548 
549  // render table
550  $tbl->setTemplate($a_tpl);
551 
552  // render rows
553  $count = 0;
554  for ($i = $tbl->getOffset(); $i < count($data) && $i < $tbl->getOffset() + $tbl->getLimit(); $i++)
555  {
556  $row = $data[$i];
557 
558  // build columns
559  foreach ($header_vars as $key)
560  {
561  switch ($key)
562  {
563  case 'login' :
564  //build link
565  $this->ctrl->setParameterByClass("ilobjusergui", "ref_id", "7");
566  $this->ctrl->setParameterByClass("ilobjusergui", "obj_id", $row["usr_id"]);
567  $link = $this->ctrl->getLinkTargetByClass("ilobjusergui", "view");
568  $tbl_content_cell = '<a href="'.$link.'">'.htmlspecialchars($row[$key]).'</a>';
569  break;
570  case 'disk_quota' :
571  if ($row['role_id'] == SYSTEM_ROLE_ID)
572  {
573  $tbl_content_cell = "<span class=\"smallgreen\">".$lng->txt('access_unlimited').'</span>';
574  }
575  else
576  {
577  $tbl_content_cell = ilFormat::formatSize($row[$key],'short');
578  }
579  break;
580  case 'disk_usage' :
581  if ($row['last_update'] == null)
582  {
583  $tbl_content_cell = $lng->txt('unknown');
584  }
585  else if ($row['disk_usage'] > $row['disk_quota'])
586  {
587  $tbl_content_cell = "<span class=\"smallred\">".ilFormat::formatSize($row[$key],'short').'</span>';
588  }
589  else
590  {
591  $tbl_content_cell = ilFormat::formatSize($row[$key],'short');
592  }
593  break;
594  case 'access_until' :
595  if (! $row['active'])
596  {
597  $tbl_content_cell = "<span class=\"smallred\">".$lng->txt('inactive').'</span>';
598  }
599  else if ($row['time_limit_unlimited'])
600  {
601  $tbl_content_cell = "<span class=\"smallgreen\">".$lng->txt('access_unlimited').'</span>';
602  }
603  else if ($row['expired'])
604  {
605  $tbl_content_cell = "<span class=\"smallred\">".$lng->txt('access_expired').'</span>';
606  }
607  else
608  {
609  $tbl_content_cell = ilFormat::formatDate($row[$key]);
610  }
611  break;
612  case 'last_login' :
613  case 'last_reminder' :
614  if ($row[$key] == null)
615  {
616  $tbl_content_cell = $lng->txt('no_date');
617  }
618  else
619  {
620  $tbl_content_cell = ilFormat::formatDate($row[$key]);
621  }
622  break;
623  default :
624  $tbl_content_cell = htmlspecialchars($row[$key]);
625  }
626  /*
627  if (is_array($tbl_content_cell))
628  {
629  $tbl->tpl->setCurrentBlock("tbl_cell_subtitle");
630  $tbl->tpl->setVariable("TBL_CELL_SUBTITLE",$tbl_content_cell[1]);
631  $tbl->tpl->parseCurrentBlock();
632  $tbl_content_cell = "<b>".$tbl_content_cell[0]."</b>";
633  }*/
634 
635  $tbl->tpl->setCurrentBlock("tbl_content_cell");
636  $tbl->tpl->setVariable("TBL_CONTENT_CELL",$tbl_content_cell);
637 
638  $tbl->tpl->parseCurrentBlock();
639  }
640 
641  $tbl->tpl->setCurrentBlock("tbl_content_row");
642  $rowcolor = ilUtil::switchColor($count,"tblrow1","tblrow2");
643  $tbl->tpl->setVariable("ROWCOLOR", $rowcolor);
644  $tbl->tpl->parseCurrentBlock();
645 
646  $count++;
647  }
648  $tbl->render();
649 
650  // Add table to page
651  $this->tpl->setVariable("USER_TABLE",$a_tpl->get());
652  }
653 
657  public function editDiskQuotaMailTemplate()
658  {
659  global $rbacsystem, $ilErr, $ilSetting, $tpl, $lng, $ilCtrl;
660 
661  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
662  {
663  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
664  }
665 
666  $this->tabs_gui->setTabActive('disk_quota');
667  $this->addDiskQuotaSubtabs('disk_quota_reminder_mail');
668 
669  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.disk_quota_reminder_mail.html');
670  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
671  $this->tpl->setVariable("IMG_MAIL", ilUtil::getImagePath("icon_mail.gif"));
672 
673  $lng->loadLanguageModule("meta");
674  $lng->loadLanguageModule("mail");
675  $this->tpl->setVariable("TXT_NEW_USER_ACCOUNT_MAIL", $lng->txt("disk_quota_reminder_mail"));
676  $this->tpl->setVariable("TXT_NEW_USER_ACCOUNT_MAIL_DESC", $lng->txt("disk_quota_reminder_mail_desc"));
677 
678  // placeholder help text
679  $this->tpl->setVariable("TXT_USE_PLACEHOLDERS", $lng->txt("mail_nacc_use_placeholder"));
680  $this->tpl->setVariable("TXT_MAIL_SALUTATION", $lng->txt("mail_nacc_salutation"));
681  $this->tpl->setVariable("TXT_FIRST_NAME", $lng->txt("firstname"));
682  $this->tpl->setVariable("TXT_LAST_NAME", $lng->txt("lastname"));
683  $this->tpl->setVariable("TXT_EMAIL", $lng->txt("email"));
684  $this->tpl->setVariable("TXT_LOGIN", $lng->txt("mail_nacc_login"));
685  $this->tpl->setVariable("TXT_DISK_QUOTA", $lng->txt("disk_quota"));
686  $this->tpl->setVariable("TXT_DISK_USAGE", $lng->txt("disk_usage"));
687  $this->tpl->setVariable("TXT_DISK_USAGE_DETAILS", $lng->txt("disk_usage_details"));
688  $this->tpl->setVariable("TXT_ADMIN_MAIL", $lng->txt("mail_nacc_admin_mail"));
689  $this->tpl->setVariable("TXT_ILIAS_URL", $lng->txt("mail_nacc_ilias_url"));
690  $this->tpl->setVariable("TXT_CLIENT_NAME", $lng->txt("mail_nacc_client_name"));
691 
692  $langs = $lng->getInstalledLanguages();
693  foreach($langs as $lang_key)
694  {
695  $amail = $this->disk_quota_obj->_lookupReminderMailTemplate($lang_key);
696  $this->tpl->setCurrentBlock("mail_block");
697  $add = "";
698  if ($lang_key == $lng->getDefaultLanguage())
699  {
700  $add = " (".$lng->txt("default").")";
701  }
702  $this->tpl->setVariable("TXT_LANGUAGE",
703  $lng->txt("meta_l_".$lang_key).$add);
704  $this->tpl->setVariable("TXT_BODY", $lng->txt("message_content"));
705  $this->tpl->setVariable("TA_BODY", "body_".$lang_key);
706  $this->tpl->setVariable("VAL_BODY",
707  ilUtil::prepareFormOutput($amail["body"]));
708  $this->tpl->setVariable("TXT_SUBJECT", $lng->txt("subject"));
709  $this->tpl->setVariable("INPUT_SUBJECT", "subject_".$lang_key);
710  $this->tpl->setVariable("VAL_SUBJECT",
711  ilUtil::prepareFormOutput($amail["subject"]));
712  $this->tpl->setVariable("TXT_SAL_G", $lng->txt("mail_salutation_general"));
713  $this->tpl->setVariable("INPUT_SAL_G", "sal_g_".$lang_key);
714  $this->tpl->setVariable("VAL_SAL_G",
715  ilUtil::prepareFormOutput($amail["sal_g"]));
716  $this->tpl->setVariable("TXT_SAL_M", $lng->txt("mail_salutation_male"));
717  $this->tpl->setVariable("INPUT_SAL_M", "sal_m_".$lang_key);
718  $this->tpl->setVariable("VAL_SAL_M",
719  ilUtil::prepareFormOutput($amail["sal_m"]));
720  $this->tpl->setVariable("TXT_SAL_F", $lng->txt("mail_salutation_female"));
721  $this->tpl->setVariable("INPUT_SAL_F", "sal_f_".$lang_key);
722  $this->tpl->setVariable("VAL_SAL_F",
723  ilUtil::prepareFormOutput($amail["sal_f"]));
724  $this->tpl->parseCurrentBlock();
725  }
726  $this->tpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
727  $this->tpl->setVariable("TXT_SAVE", $lng->txt("save"));
728  }
730  {
731  $this->ctrl->redirect($this, "editDiskQuotaSettings");
732  }
733 
735  {
736  global $lng;
737 
738  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
739  $langs = $lng->getInstalledLanguages();
740  foreach($langs as $lang_key)
741  {
742  $this->disk_quota_obj->_writeReminderMailTemplate($lang_key,
743  ilUtil::stripSlashes($_POST["subject_".$lang_key]),
744  ilUtil::stripSlashes($_POST["sal_g_".$lang_key]),
745  ilUtil::stripSlashes($_POST["sal_f_".$lang_key]),
746  ilUtil::stripSlashes($_POST["sal_m_".$lang_key]),
747  ilUtil::stripSlashes($_POST["body_".$lang_key]));
748  }
749  $this->ctrl->redirect($this, "editDiskQuotaMailTemplate");
750  }
751 
752 }
753 ?>