source: companies/celepar/jabberit_messenger/inc/class.uienabledgroups.inc.php @ 763

Revision 763, 5.6 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<?php
2  /***************************************************************************\
3  *  Expresso - Expresso Messenger                                            *
4  *     - Alexandre Correia / Rodrigo Souza                                                               *
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 
12require_once "class.boenabledgroups.inc.php";
13
14class uienabledgroups
15{
16        private $bo;
17       
18        public $public_functions = array(
19                'backPage'  => True,
20                'editGroups' => True,
21                'getGroups' => True,
22        );
23       
24        function __construct()
25        {
26                $this->bo = new boenabledgroups();
27        }
28       
29        public final function backPage()
30        {
31                echo "<pre>";
32                print_r($_POST);
33                echo "</pre>";
34        }       
35
36        public final function editGroups()
37        {
38                if($_GET['menuaction'])
39                {
40                        if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
41                        {
42                                $GLOBALS['phpgw']->redirect_link('/index.php');
43                        }               
44                       
45                        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Liberar Organizações para grupos restritos';
46       
47                        $GLOBALS['phpgw']->common->phpgw_header();
48                        echo parse_navbar();
49       
50                        $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
51                        $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
52       
53                        if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
54                                $webserver_url .= '/';
55       
56                        // Load Language;
57                        require_once "load_lang.php";
58                       
59                        // Load Ldap;
60                        require_once "class.ldap_im.inc.php";
61                       
62                        $ldap = new ldap_im();
63                       
64                        $ous = "<option value='-1'>-- ".lang('Select Organization')." --</option>";     
65                        if( ($LdapOus = $ldap->listOrganizationsLdap()) )
66                        {
67                                foreach($LdapOus as $tmp )
68                                        $ous .= "<option value='".$tmp."'>".$tmp."</option>";
69                        }
70
71                        $group = unserialize($_GET['groups']);
72                        $valueGroupsOrganizations = "";
73                       
74                        if( $group[2] )
75                        {
76                                $ou_groups = explode(",",$group[2]);
77                       
78                                natcasesort($ou_groups);
79                       
80                                foreach($ou_groups as $tmp)
81                                {
82                                        $valueGroupsOrganizations .= "<tr id='".$tmp."'>";
83                                        $valueGroupsOrganizations .= "<td align='left' class='row_on'>".$tmp."</td>";
84                                        $valueGroupsOrganizations .= "<td align='left' class='row_on' style='width:30% !important'><a href='javascript:constructScript.removeOrgGroupsLocked(\"".$tmp."\");'>Excluir</a></td>";                                 
85                                        $valueGroupsOrganizations .= "</tr>";
86                                }
87                        }
88                       
89                       
90                        $GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'confGroupsLocked.tpl'));
91                        $GLOBALS['phpgw']->template->set_block('jabberit_messenger','confGroups');     
92                        $var = array(
93                                                        'action_url' => "./index.php?menuaction=jabberit_messenger.uienabledgroups.getGroups",
94                                                        'lang_Back' => "Voltar",       
95                                                        'lang_Cadastrar_Organizacao' => "Cadastrar Organização",       
96                                                        'lang_Delete' => "Excluir",                                                     
97                                                        'lang_Informe_as_Organizacoes' => "Informe as Organizações",
98                                                        'lang_Nome_Grupo' => "Nome do Grupo",
99                                                        'lang_Organizacoes_cadastradas_para_grupo' => "Organizações cadastradas para o grupo", 
100                                                        'lang_Organization' => "Organização",
101                                                        'lang_save' => "Salvar",
102                                                        'value_Groups_Organizations' => $valueGroupsOrganizations,     
103                                                        'value_organizations_ldap' => $ous,                                                     
104                                                        'value_Name_Group' => $group[0],
105                                                        'value_gidNumber' => $group[1],
106                                                );     
107                        $GLOBALS['phpgw']->template->set_var($var);
108                        $GLOBALS['phpgw']->template->pparse('out','confGroups');
109                }
110        }
111
112        public final function getGroups()
113        {
114                if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
115                {
116                        $GLOBALS['phpgw']->redirect_link('/index.php');
117                }               
118               
119                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Liberar Organizações para grupos restritos';
120
121                $GLOBALS['phpgw']->common->phpgw_header();
122                echo parse_navbar();
123
124                $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
125                $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
126
127                if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
128                        $webserver_url .= '/';
129
130                echo '<script type="text/javascript">var path_jabberit="'.$webserver_url .'"</script>';
131
132                // Load Language;
133                require_once "load_lang.php";
134
135                $groups_locked_jabberit = $this->bo->getGroupsBlocked();
136
137                if(trim($groups_locked_jabberit))
138                {
139                        $glocked = explode(';',$GLOBALS['phpgw_info']['server']['groups_locked_jabberit']);
140                        $list_groups = "";
141
142                        natcasesort($glocked);
143                                               
144                        foreach( $glocked as $tmp )
145                        {
146                                $groups = explode(":",$tmp);
147                                $list_groups .= "<tr class='row_off'>";
148                                $list_groups .= "<td width='30%'>".$groups[0]."</td>";
149                                $list_groups .= "<td width='55%'>".$groups[2]."</td>";
150                                $list_groups .= "<td width='5%' align='center'><a href='./index.php?menuaction=jabberit_messenger.uienabledgroups.editGroups&groups=".serialize($groups)."'>Editar</a></td>";
151                                $list_groups .= "</tr>";
152                        }
153                }
154
155                $GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'enabled_ou_groups.tpl'));
156                $GLOBALS['phpgw']->template->set_block('jabberit_messenger','enabled_ous');     
157                $var = array(
158                                                'action_url' => './admin',                                             
159                                                'lang_back' => lang("Back"),
160                                                'list_groups' => (trim($list_groups) != "") ? $list_groups : "",
161                                        );     
162                $GLOBALS['phpgw']->template->set_var($var);
163                $GLOBALS['phpgw']->template->pparse('out','enabled_ous');
164        }
165}
166
167
168?>
Note: See TracBrowser for help on using the repository browser.