[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /** 3 * eGroupWare - resources 4 * 5 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License 6 * @package resources 7 * @link http://www.egroupware.org 8 * @version $Id: class.ui_acl.inc.php 19735 2005-11-10 23:35:55Z nelius_weiss $ 9 */ 10 11 /** 12 * ACL userinterface object for resources 13 * 14 * @package resources 15 */ 16 class ui_acl 17 { 18 var $start = 0; 19 var $query = ''; 20 var $sort = ''; 21 var $order = ''; 22 var $bo; 23 var $accounts; 24 var $nextmatchs = ''; 25 var $rights; 26 var $public_functions = array( 27 'acllist' => True, 28 ); 29 30 function ui_acl() 31 { 32 $this->bo =& createobject('resources.bo_acl',True); 33 $this->accounts = $GLOBALS['egw']->accounts->get_list(); 34 $this->nextmatchs =& createobject('phpgwapi.nextmatchs'); 35 $this->start = $this->bo->start; 36 $this->query = $this->bo->query; 37 $this->order = $this->bo->order; 38 $this->sort = $this->bo->sort; 39 $this->cat_id = $this->bo->cat_id; 40 } 41 42 function acllist() 43 { 44 if (!$GLOBALS['egw']->acl->check('run',1,'admin')) 45 { 46 $this->deny(); 47 } 48 49 if ($_POST['btnDone']) 50 { 51 $GLOBALS['egw']->redirect_link('/admin/index.php'); 52 } 53 54 $GLOBALS['egw']->common->egw_header(); 55 echo parse_navbar(); 56 57 if ($_POST['btnSave']) 58 { 59 foreach($_POST['catids'] as $cat_id) 60 { 61 $this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id], 62 $_POST['inputcalread'][$cat_id],$_POST['inputcalbook'][$cat_id],$_POST['inputadmin'][$cat_id]); 63 } 64 } 65 66 $GLOBALS['egw']->template->set_file('acl', 'acl.tpl'); 67 $GLOBALS['egw']->template->set_block('acl','cat_list','Cblock'); 68 $GLOBALS['egw']->template->set_var(array( 69 'title' => $GLOBALS['egw_info']['apps']['resources']['title'] . ' - ' . lang('Configure Access Permissions'), 70 'lang_search' => lang('Search'), 71 'lang_save' => lang('Save'), 72 'lang_done' => lang('Done'), 73 'lang_read' => lang('Read permissions'), 74 'lang_write' => lang('Write permissions'), 75 'lang_implies_read' => lang('implies read permission'), 76 'lang_calread' => lang('Read Calendar permissions'), 77 'lang_calbook' => lang('Direct booking permissions'), 78 'lang_implies_book' => lang('implies booking permission'), 79 'lang_cat_admin' => lang('Categories admin') 80 )); 81 82 $left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.uiacl.acllist'); 83 $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->catbo->total_records,'menuaction=resources.uiacl.acllist'); 84 85 $GLOBALS['egw']->template->set_var(array( 86 'left' => $left, 87 'right' => $right, 88 'lang_showing' => $this->nextmatchs->show_hits($this->bo->catbo->total_records,$this->start), 89 'th_bg' => $GLOBALS['egw_info']['theme']['th_bg'], 90 'sort_cat' => $this->nextmatchs->show_sort_order( 91 $this->sort,'cat_name','cat_name','/index.php',lang('Category'),'&menuaction=resources.uiacl.acllist' 92 ), 93 'query' => $this->query, 94 )); 95 96 @reset($this->bo->cats); 97 while (list(,$cat) = @each($this->bo->cats)) 98 { 99 $this->rights = $this->bo->get_rights($cat['id']); 100 101 $tr_color = $this->nextmatchs->alternate_row_color($tr_color); 102 $GLOBALS['egw']->template->set_var(array( 103 'tr_color' => $tr_color, 104 'catname' => $cat['name'], 105 'catid' => $cat['id'], 106 'read' => $this->selectlist(EGW_ACL_READ), 107 'write' => $this->selectlist(EGW_ACL_ADD), 108 'calread' => $this->selectlist(EGW_ACL_CALREAD), 109 'calbook' =>$this->selectlist(EGW_ACL_DIRECT_BOOKING), 110 'admin' => '<option value="" selected="1">'.lang('choose categories admin').'</option>'.$this->selectlist(EGW_ACL_CAT_ADMIN,true) 111 )); 112 $GLOBALS['egw']->template->parse('Cblock','cat_list',True); 113 } 114 $GLOBALS['egw']->template->pfp('out','acl',True); 115 } 116 117 function selectlist($right,$users_only=false) 118 { 119 reset($this->bo->accounts); 120 while (list($null,$account) = each($this->bo->accounts)) 121 { 122 if(!($users_only && $account['account_lastname'] == 'Group')) 123 { 124 $selectlist .= '<option value="' . $account['account_id'] . '"'; 125 if($this->rights[$account['account_id']] & $right) 126 { 127 $selectlist .= ' selected="selected"'; 128 } 129 $selectlist .= '>' . $account['account_firstname'] . ' ' . $account['account_lastname'] 130 . ' [ ' . $account['account_lid'] . ' ]' . '</option>' . "\n"; 131 } 132 } 133 return $selectlist; 134 } 135 136 function deny() 137 { 138 echo '<p><center><b>'.lang('Access not permitted').'</b></center>'; 139 $GLOBALS['egw']->common->egw_exit(True); 140 } 141 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |