ILIAS  Release_4_0_x_branch Revision 61816
 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 = new ilDAVServer();
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']));
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 = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
380  $cb_prop->setValue('1');
381  $cb_prop->setChecked($this->disk_quota_obj->isDiskQuotaReminderMailEnabled());
382  $cb_prop->setInfo($lng->txt('disk_quota_reminder_mail_desc'));
383  $form->addItem($cb_prop);
384 
385 
386 
387  // command buttons
388  $form->addCommandButton('saveDiskQuotaSettings', $lng->txt('save'));
389  $form->addCommandButton('editDiskQuotaSettings', $lng->txt('cancel'));
390 
391  $tpl->setContent($form->getHTML());
392  }
393 
397  public function saveDiskQuotaSettings()
398  {
399  global $rbacsystem, $ilErr, $ilCtrl, $lng;
400 
401  if (! $rbacsystem->checkAccess("write",$this->object->getRefId()))
402  {
403  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
404  }
405 
406  $this->disk_quota_obj->setDiskQuotaEnabled($_POST['enable_disk_quota'] == '1');
407  $this->disk_quota_obj->setDiskQuotaReminderMailEnabled($_POST['enable_disk_quota_reminder_mail'] == '1');
408  $this->disk_quota_obj->update();
409 
410 
411  ilUtil::sendInfo($lng->txt('settings_saved'),true);
412  $ilCtrl->redirect($this, "editDiskQuotaSettings");
413  }
414 
419  public function viewDiskQuotaReport()
420  {
421  global $rbacsystem, $ilErr, $ilSetting, $lng;
422 
423  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
424  {
425  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
426  }
427 
428  $this->tabs_gui->setTabActive('disk_quota');
429  $this->addDiskQuotaSubtabs('disk_quota_report');
430 
431  // nothing to do if disk quota is not active
432  require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
434  {
435  return;
436  }
437 
438  // get the form
439  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.disk_quota_report.html');
440 
441  // get the date of the last update
442  require_once("./Services/WebDAV/classes/class.ilDiskQuotaChecker.php");
444  if ($last_update == null)
445  {
446  // nothing to do if disk usage report has not been run
447  $this->tpl->setVariable('LAST_UPDATE_TEXT',$lng->txt('disk_quota_report_not_run_yet'));
448  return;
449  }
450  else
451  {
452  $this->tpl->setVariable('LAST_UPDATE_TEXT',$lng->txt('last_update').': '.ilFormat::formatDate($last_update,'datetime',true));
453  }
454 
455  // Filter
456  $_SESSION['quota_usage_filter'] = isset($_POST['usage_filter']) ? $_POST['usage_filter'] : $_SESSION['quota_usage_filter'];
457  if ($_SESSION['quota_usage_filter'] == 0)
458  {
459  $_SESSION['quota_usage_filter'] = 4;
460  }
461  $_SESSION['quota_access_filter'] = isset($_POST['access_filter']) ? $_POST['access_filter'] : $_SESSION['quota_access_filter'];
462  if ($_SESSION['quota_access_filter'] == 0)
463  {
464  $_SESSION['quota_access_filter'] = 1;
465  }
466  $usage_action[1] = $lng->txt('all_users');
467  $usage_action[2] = $lng->txt('filter_users_without_disk_usage');
468  $usage_action[3] = $lng->txt('filter_users_with_disk_usage');
469  $usage_action[4] = $lng->txt('filter_users_with_exceeded_disk_quota');
470  $access_action[1] = $lng->txt('all_users');
471  $access_action[2] = $lng->txt('filter_users_with_access');
472  $access_action[3] = $lng->txt('filter_users_without_access');
473 
474  $select_usage_filter = ilUtil::formSelect($_SESSION['quota_usage_filter'],"usage_filter",$usage_action,false,true);
475  $select_access_filter = ilUtil::formSelect($_SESSION['quota_access_filter'],"access_filter",$access_action,false,true);
476 
477  $this->tpl->setCurrentBlock("filter");
478  $this->tpl->setVariable("FILTER_TXT_FILTER",$lng->txt('filter'));
479  $this->tpl->setVariable("SELECT_USAGE_FILTER",$select_usage_filter);
480  $this->tpl->setVariable("SELECT_ACCESS_FILTER",$select_access_filter);
481  $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getLinkTarget($this, 'viewDiskQuotaReport'));
482  $this->tpl->setVariable("FILTER_NAME",'view');
483  $this->tpl->setVariable("FILTER_VALUE",$lng->txt('apply_filter'));
484  $this->tpl->parseCurrentBlock();
485 
486  // load templates for table
487  $a_tpl = new ilTemplate('tpl.table.html',true,true);
488  $a_tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
489 
490  // create table
491  require_once './Services/Table/classes/class.ilTableGUI.php';
492  $tbl = new ilTableGUI(0, false);
493 
494  // title & header columns
495  $header_vars = array('login','firstname','lastname','email','access_until','last_login','disk_quota','disk_usage', 'last_reminder');
496  $tbl->setHeaderNames(
497  array(
498  $lng->txt('login'),
499  $lng->txt('firstname'),
500  $lng->txt('lastname'),
501  $lng->txt('email'),
502  $lng->txt('access_until'),
503  $lng->txt('last_login'),
504  $lng->txt('disk_quota'),
505  $lng->txt('disk_usage'),
506  $lng->txt('last_reminder')
507  )
508  );
509  $tbl->setHeaderVars(
510  $header_vars,
511  $this->ctrl->getParameterArray($this,'viewDiskQuotaReport',false)
512  );
513 
514  $tbl->enable("numinfo_header");
515  $tbl->setFormName("cmd");
516  $tbl->setSelectAllCheckbox("id");
517 
518  // sorting
519  $tbl->setOrderColumn($_GET["sort_by"]);
520  $tbl->setOrderDirection($_GET["sort_order"]);
521 
522  // fetch the data
524  $_SESSION['quota_usage_filter'],
525  $_SESSION['quota_access_filter'],
526  $header_vars[$tbl->getOrderColumn()], $tbl->getOrderDirection());
527 
528  // paging
529  $tbl->setLimit($_GET["limit"]);
530  $tbl->setOffset($_GET["offset"]);
531  $tbl->setMaxCount(count($data));
532 
533  // footer
534  $tbl->setFooter("tblfooter",$lng->txt("previous"),$lng->txt("next"));
535 
536  // render table
537  $tbl->setTemplate($a_tpl);
538 
539  // render rows
540  $count = 0;
541  for ($i = $tbl->getOffset(); $i < count($data) && $i < $tbl->getOffset() + $tbl->getLimit(); $i++)
542  {
543  $row = $data[$i];
544 
545  // build columns
546  foreach ($header_vars as $key)
547  {
548  switch ($key)
549  {
550  case 'login' :
551  //build link
552  $this->ctrl->setParameterByClass("ilobjusergui", "ref_id", "7");
553  $this->ctrl->setParameterByClass("ilobjusergui", "obj_id", $row["usr_id"]);
554  $link = $this->ctrl->getLinkTargetByClass("ilobjusergui", "view");
555  $tbl_content_cell = '<a href="'.$link.'">'.htmlspecialchars($row[$key]).'</a>';
556  break;
557  case 'disk_quota' :
558  if ($row['role_id'] == SYSTEM_ROLE_ID)
559  {
560  $tbl_content_cell = "<span class=\"smallgreen\">".$lng->txt('access_unlimited').'</span>';
561  }
562  else
563  {
564  $tbl_content_cell = ilFormat::formatSize($row[$key],'short');
565  }
566  break;
567  case 'disk_usage' :
568  if ($row['last_update'] == null)
569  {
570  $tbl_content_cell = $lng->txt('unknown');
571  }
572  else if ($row['disk_usage'] > $row['disk_quota'])
573  {
574  $tbl_content_cell = "<span class=\"smallred\">".ilFormat::formatSize($row[$key],'short').'</span>';
575  }
576  else
577  {
578  $tbl_content_cell = ilFormat::formatSize($row[$key],'short');
579  }
580  break;
581  case 'access_until' :
582  if (! $row['active'])
583  {
584  $tbl_content_cell = "<span class=\"smallred\">".$lng->txt('inactive').'</span>';
585  }
586  else if ($row['time_limit_unlimited'])
587  {
588  $tbl_content_cell = "<span class=\"smallgreen\">".$lng->txt('access_unlimited').'</span>';
589  }
590  else if ($row['expired'])
591  {
592  $tbl_content_cell = "<span class=\"smallred\">".$lng->txt('access_expired').'</span>';
593  }
594  else
595  {
596  $tbl_content_cell = ilFormat::formatDate($row[$key]);
597  }
598  break;
599  case 'last_login' :
600  case 'last_reminder' :
601  if ($row[$key] == null)
602  {
603  $tbl_content_cell = $lng->txt('no_date');
604  }
605  else
606  {
607  $tbl_content_cell = ilFormat::formatDate($row[$key]);
608  }
609  break;
610  default :
611  $tbl_content_cell = htmlspecialchars($row[$key]);
612  }
613  /*
614  if (is_array($tbl_content_cell))
615  {
616  $tbl->tpl->setCurrentBlock("tbl_cell_subtitle");
617  $tbl->tpl->setVariable("TBL_CELL_SUBTITLE",$tbl_content_cell[1]);
618  $tbl->tpl->parseCurrentBlock();
619  $tbl_content_cell = "<b>".$tbl_content_cell[0]."</b>";
620  }*/
621 
622  $tbl->tpl->setCurrentBlock("tbl_content_cell");
623  $tbl->tpl->setVariable("TBL_CONTENT_CELL",$tbl_content_cell);
624 
625  $tbl->tpl->parseCurrentBlock();
626  }
627 
628  $tbl->tpl->setCurrentBlock("tbl_content_row");
629  $rowcolor = ilUtil::switchColor($count,"tblrow1","tblrow2");
630  $tbl->tpl->setVariable("ROWCOLOR", $rowcolor);
631  $tbl->tpl->parseCurrentBlock();
632 
633  $count++;
634  }
635  $tbl->render();
636 
637  // Add table to page
638  $this->tpl->setVariable("USER_TABLE",$a_tpl->get());
639  }
640 
644  public function editDiskQuotaMailTemplate()
645  {
646  global $rbacsystem, $ilErr, $ilSetting, $tpl, $lng, $ilCtrl;
647 
648  if (! $rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
649  {
650  $ilErr->raiseError($lng->txt("no_permission"),$ilErr->WARNING);
651  }
652 
653  $this->tabs_gui->setTabActive('disk_quota');
654  $this->addDiskQuotaSubtabs('disk_quota_reminder_mail');
655 
656  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.disk_quota_reminder_mail.html');
657  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
658  $this->tpl->setVariable("IMG_MAIL", ilUtil::getImagePath("icon_mail.gif"));
659 
660  $lng->loadLanguageModule("meta");
661  $lng->loadLanguageModule("mail");
662  $this->tpl->setVariable("TXT_NEW_USER_ACCOUNT_MAIL", $lng->txt("disk_quota_reminder_mail"));
663  $this->tpl->setVariable("TXT_NEW_USER_ACCOUNT_MAIL_DESC", $lng->txt("disk_quota_reminder_mail_desc"));
664 
665  // placeholder help text
666  $this->tpl->setVariable("TXT_USE_PLACEHOLDERS", $lng->txt("mail_nacc_use_placeholder"));
667  $this->tpl->setVariable("TXT_MAIL_SALUTATION", $lng->txt("mail_nacc_salutation"));
668  $this->tpl->setVariable("TXT_FIRST_NAME", $lng->txt("firstname"));
669  $this->tpl->setVariable("TXT_LAST_NAME", $lng->txt("lastname"));
670  $this->tpl->setVariable("TXT_EMAIL", $lng->txt("email"));
671  $this->tpl->setVariable("TXT_LOGIN", $lng->txt("mail_nacc_login"));
672  $this->tpl->setVariable("TXT_DISK_QUOTA", $lng->txt("disk_quota"));
673  $this->tpl->setVariable("TXT_DISK_USAGE", $lng->txt("disk_usage"));
674  $this->tpl->setVariable("TXT_DISK_USAGE_DETAILS", $lng->txt("disk_usage_details"));
675  $this->tpl->setVariable("TXT_ADMIN_MAIL", $lng->txt("mail_nacc_admin_mail"));
676  $this->tpl->setVariable("TXT_ILIAS_URL", $lng->txt("mail_nacc_ilias_url"));
677  $this->tpl->setVariable("TXT_CLIENT_NAME", $lng->txt("mail_nacc_client_name"));
678 
679  $langs = $lng->getInstalledLanguages();
680  foreach($langs as $lang_key)
681  {
682  $amail = $this->disk_quota_obj->_lookupReminderMailTemplate($lang_key);
683  $this->tpl->setCurrentBlock("mail_block");
684  $add = "";
685  if ($lang_key == $lng->getDefaultLanguage())
686  {
687  $add = " (".$lng->txt("default").")";
688  }
689  $this->tpl->setVariable("TXT_LANGUAGE",
690  $lng->txt("meta_l_".$lang_key).$add);
691  $this->tpl->setVariable("TXT_BODY", $lng->txt("message_content"));
692  $this->tpl->setVariable("TA_BODY", "body_".$lang_key);
693  $this->tpl->setVariable("VAL_BODY",
694  ilUtil::prepareFormOutput($amail["body"]));
695  $this->tpl->setVariable("TXT_SUBJECT", $lng->txt("subject"));
696  $this->tpl->setVariable("INPUT_SUBJECT", "subject_".$lang_key);
697  $this->tpl->setVariable("VAL_SUBJECT",
698  ilUtil::prepareFormOutput($amail["subject"]));
699  $this->tpl->setVariable("TXT_SAL_G", $lng->txt("mail_salutation_general"));
700  $this->tpl->setVariable("INPUT_SAL_G", "sal_g_".$lang_key);
701  $this->tpl->setVariable("VAL_SAL_G",
702  ilUtil::prepareFormOutput($amail["sal_g"]));
703  $this->tpl->setVariable("TXT_SAL_M", $lng->txt("mail_salutation_male"));
704  $this->tpl->setVariable("INPUT_SAL_M", "sal_m_".$lang_key);
705  $this->tpl->setVariable("VAL_SAL_M",
706  ilUtil::prepareFormOutput($amail["sal_m"]));
707  $this->tpl->setVariable("TXT_SAL_F", $lng->txt("mail_salutation_female"));
708  $this->tpl->setVariable("INPUT_SAL_F", "sal_f_".$lang_key);
709  $this->tpl->setVariable("VAL_SAL_F",
710  ilUtil::prepareFormOutput($amail["sal_f"]));
711  $this->tpl->parseCurrentBlock();
712  }
713  $this->tpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
714  $this->tpl->setVariable("TXT_SAVE", $lng->txt("save"));
715  }
717  {
718  $this->ctrl->redirect($this, "editDiskQuotaSettings");
719  }
720 
722  {
723  global $lng;
724 
725  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
726  $langs = $lng->getInstalledLanguages();
727  foreach($langs as $lang_key)
728  {
729  $this->disk_quota_obj->_writeReminderMailTemplate($lang_key,
730  ilUtil::stripSlashes($_POST["subject_".$lang_key]),
731  ilUtil::stripSlashes($_POST["sal_g_".$lang_key]),
732  ilUtil::stripSlashes($_POST["sal_f_".$lang_key]),
733  ilUtil::stripSlashes($_POST["sal_m_".$lang_key]),
734  ilUtil::stripSlashes($_POST["body_".$lang_key]));
735  }
736  $this->ctrl->redirect($this, "editDiskQuotaMailTemplate");
737  }
738 
739 }
740 ?>