source: trunk/news_admin/inc/class.uiacl.inc.php @ 2698

Revision 2698, 4.4 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1058 - Removendo reload nos formulários do admin na ação cancelar.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
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
14        class uiacl
15        {
16                var $start = 0;
17                var $query = '';
18                var $sort  = '';
19                var $order = '';
20                var $bo;
21                var $accounts;
22                var $nextmatchs = '';
23                var $rights;
24                var $public_functions = array(
25                        'acllist'       => True,
26                        );
27
28                function uiacl()
29                {
30                        $this->bo = createobject('news_admin.boacl',True);
31                        $this->accounts = $GLOBALS['phpgw']->accounts->get_list('groups');
32                        $this->nextmatchs = createobject('phpgwapi.nextmatchs');
33                        $this->start = $this->bo->start;
34                        $this->query = $this->bo->query;
35                        $this->order = $this->bo->order;
36                        $this->sort = $this->bo->sort;
37                        $this->cat_id = $this->bo->cat_id;
38                }
39               
40                function acllist()
41                {
42                        if (!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
43                        {
44                                $this->deny();
45                        }
46
47                        if ($_POST['btnDone'])
48                        {
49                                $GLOBALS['phpgw']->redirect_link('/admin/index.php');
50                        }
51
52                        //$GLOBALS['phpgw']->common->phpgw_header();
53                        //echo parse_navbar();
54
55                        if ($_POST['btnSave'])
56                        {
57                                foreach($_POST['catids'] as $cat_id)
58                                {
59                                        $this->bo->set_rights($cat_id,$_POST['inputread'][$cat_id],$_POST['inputwrite'][$cat_id]);
60                                }
61                        }
62
63                        $GLOBALS['phpgw']->template->set_file('acl', 'acl.tpl');
64                        $GLOBALS['phpgw']->template->set_block('acl','cat_list','Cblock');
65                        $GLOBALS['phpgw']->template->set_var(array(
66                                'title' => $GLOBALS['phpgw_info']['apps']['news_admin']['title'] . ' - ' . lang('Configure Access Permissions'),
67                                'lang_search' => lang('Search'),
68                                'lang_save' => lang('Save'),
69                                'lang_done' => lang('Done'),
70                                'done_button' => $GLOBALS[ 'phpgw' ] -> link( '/admin/' ),
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['phpgw']->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['phpgw_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['phpgw']->template->set_var(array(
97                                        'tr_color' => $tr_color,
98                                        'catname' => $cat['name'],
99                                        'catid' => $cat['id'],
100                                        'read' => $this->selectlist(PHPGW_ACL_READ),
101                                        'write' => $this->selectlist(PHPGW_ACL_ADD)
102                                ));
103                                $GLOBALS['phpgw']->template->parse('Cblock','cat_list',True);
104                        }
105                        $GLOBALS['phpgw']->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['phpgw']->common->phpgw_exit(True);
128                }
129        }
130?>
Note: See TracBrowser for help on using the repository browser.