source: branches/2.2.0.1/jabberir_messenger/inc/class.uienabledgroups.inc.php @ 4453

Revision 4453, 5.5 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #1726 - Adicionando jabberit_messenger da comunidade.

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