[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/news_admin/inc/ -> class.uiacl.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - News                                                        *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      * --------------------------------------------                             *
  11      \**************************************************************************/
  12  
  13      /* $Id: class.uiacl.inc.php 19414 2005-10-14 13:57:59Z ralfbecker $ */
  14  
  15      class uiacl
  16      {
  17          var $start = 0;
  18          var $query = '';
  19          var $sort  = '';
  20          var $order = '';
  21          var $bo;
  22          var $accounts;
  23          var $nextmatchs = '';
  24          var $rights;
  25          var $public_functions = array(
  26              'acllist'     => True,
  27              );
  28  
  29  		function uiacl()
  30          {
  31              $this->bo =& CreateObject('news_admin.boacl',True);
  32              $this->accounts = $GLOBALS['egw']->accounts->get_list();
  33              $this->nextmatchs =& CreateObject('phpgwapi.nextmatchs');
  34              $this->start = $this->bo->start;
  35              $this->query = $this->bo->query;
  36              $this->order = $this->bo->order;
  37              $this->sort = $this->bo->sort;
  38              $this->cat_id = $this->bo->cat_id;
  39          }
  40          
  41  		function acllist()
  42          {
  43              if (!$GLOBALS['egw']->acl->check('run',1,'admin'))
  44              {
  45                  $this->deny();
  46              }
  47  
  48              if ($_POST['btnDone'])
  49              {
  50                  $GLOBALS['egw']->redirect_link('/admin/index.php');
  51              }
  52  
  53              $GLOBALS['egw']->common->egw_header();
  54              echo parse_navbar();
  55  
  56              if ($_POST['btnSave'])
  57              {
  58                  foreach($_POST['catids'] as $cat_id)
  59                  {
  60                      $this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id]);
  61                  }
  62              }
  63  
  64              $GLOBALS['egw']->template->set_file('acl', 'acl.tpl');
  65              $GLOBALS['egw']->template->set_block('acl','cat_list','Cblock');
  66              $GLOBALS['egw']->template->set_var(array(
  67                  'title' => $GLOBALS['egw_info']['apps']['news_admin']['title'] . ' - ' . lang('Configure Access Permissions'),
  68                  'lang_search' => lang('Search'),
  69                  'lang_save' => lang('Save'),
  70                  'lang_done' => lang('Done'),
  71                  'lang_read' => lang('Read permissions'),
  72                  'lang_write' => lang('Write permissions'),
  73                  'lang_implies' => lang('implies read permission'),
  74              ));
  75  
  76              $left  = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiacl.acllist');
  77              $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=news_admin.uiacl.acllist');
  78              
  79              $GLOBALS['egw']->template->set_var(array(
  80                  'left' => $left,
  81                  'right' => $right,
  82                  'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start),
  83                  'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'],
  84                  'sort_cat' => $this->nextmatchs->show_sort_order(
  85                      $this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=news_admin.uiacl.acllist'
  86                  ),
  87                  'query' => $this->query,
  88              ));
  89  
  90              @reset($this->bo->cats);
  91              while (list(,$cat) = @each($this->bo->cats))
  92              {
  93                  $this->rights = $this->bo->get_rights($cat['id']);
  94  
  95                  $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
  96                  $GLOBALS['egw']->template->set_var(array(
  97                      'tr_color' => $tr_color,
  98                      'catname' => $cat['name'],
  99                      'catid' => $cat['id'],
 100                      'read' => $this->selectlist(EGW_ACL_READ),
 101                      'write' => $this->selectlist(EGW_ACL_ADD)
 102                  ));
 103                  $GLOBALS['egw']->template->parse('Cblock','cat_list',True);
 104              }
 105              $GLOBALS['egw']->template->pfp('out','acl',True);
 106          }
 107  
 108  		function selectlist($right)
 109          {
 110              reset($this->bo->accounts);
 111              while (list($null,$account) = each($this->bo->accounts))
 112              {
 113                   $selectlist .= '<option value="' . $account['account_id'] . '"';
 114                      if($this->rights[$account['account_id']] & $right)
 115                   {
 116                       $selectlist .= ' selected="selected"';
 117                   }
 118                  $selectlist .= '>' . $account['account_firstname'] . ' ' . $account['account_lastname']
 119                                          . ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n";
 120              }
 121              return $selectlist;
 122          }
 123  
 124  		function deny()
 125          {
 126              echo '<p><center><b>'.lang('Access not permitted').'</b></center>';
 127              $GLOBALS['egw']->common->egw_exit(True);
 128          }
 129      }
 130  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7