source: trunk/admin/inc/class.uivoip.inc.php @ 2419

Revision 2419, 5.6 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1009 - Removendo a chamada redundante ao método 'phpgw_header' no ExpressoLivre?

  • Property svn:executable set to *
Line 
1<?php
2
3 /**************************************************************************\
4  * Expresso Livre - Voip - administration                                   *
5  *                                                                                                                                      *
6  * --------------------------------------------                             *
7  *  This program is free software; you can redistribute it and/or modify it *
8  *  under the terms of the GNU General Public License as published by the   *
9  *  Free Software Foundation; either version 2 of the License, or (at your  *
10  *  option) any later version.                                              *
11  \**************************************************************************/
12
13class uivoip
14{
15        var $public_functions = array(
16                'add'      => True,
17                'edit_conf' => True,
18        );
19
20        var $bo;
21
22        final function __construct()
23        {
24                if(!isset($_SESSION['admin']['ldap_host']))
25                {
26                        $_SESSION['admin']['server']['ldap_host'] = $GLOBALS['phpgw_info']['server']['ldap_host'];
27                        $_SESSION['admin']['server']['ldap_root_dn'] = $GLOBALS['phpgw_info']['server']['ldap_root_dn'];
28                        $_SESSION['admin']['server']['ldap_host_pw'] = $GLOBALS['phpgw_info']['server']['ldap_root_pw'];
29                        $_SESSION['admin']['server']['ldap_context'] = $GLOBALS['phpgw_info']['server']['ldap_context'];
30                }
31                $this->bo = CreateObject('admin.bovoip');
32        }
33
34        final function edit_conf()
35        {
36                if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
37                {
38                        $GLOBALS['phpgw']->redirect_link('/index.php');
39                }               
40
41                $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . lang('Configuration Service VoIP');
42
43                if(!@is_object($GLOBALS['phpgw']->js))
44                {
45                        $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
46                }
47
48                $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
49                $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
50
51                if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
52                        $webserver_url .= '/';
53
54                $js = array('connector','xtools','functions');
55               
56                foreach( $js as $tmp )
57                        $GLOBALS['phpgw']->js->validate_file('voip',$tmp,'admin');
58               
59                //$GLOBALS['phpgw']->common->phpgw_header();
60                //echo parse_navbar();
61                echo '<script type="text/javascript">var path_adm="'.$webserver_url .'"</script>';
62                echo $GLOBALS['phpgw']->js->get_script_links();
63
64                $ous = "<option value='-1'>-- ".lang('Select Organization')." --</option>";     
65                if( ($LdapOus = $this->bo->getOuLdap()) )
66                {
67                        foreach($LdapOus as $tmp )
68                                $ous .= "<option value='".$tmp."'>".$tmp."</option>";
69                }
70               
71                $groups_voip = $GLOBALS['phpgw_info']['server']['voip_groups'];
72
73                if( $groups_voip )
74                {
75                        $gvoip = explode(',', $groups_voip);
76                        natcasesort($gvoip);
77                       
78                        foreach( $gvoip as $tmp ){
79                                $option = explode(";",$tmp);
80                                $gvoip .= "<option value='".$tmp."'>".$option[0]."</option>";
81                        }
82                }
83
84                $GLOBALS['phpgw']->template->set_file(array('voip' => 'voip.tpl'));
85                $GLOBALS['phpgw']->template->set_block('voip','voip_page','voip_page');
86                $GLOBALS['phpgw']->template->set_var(array(
87                                                                                'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uivoip.add'),
88                                                                                'lang_Email_Voip' => "Caixa Voip (Email) para habilitar o alerta telefônico",//lang('Email Voip'),
89                                                                                'lang_VoIP_settings' => lang('Configuration Service VoIP'),
90                                                                                'lang_Enter_your_VoIP_server_address' => lang('Enter your VoIP server address'),       
91                                                                                'lang_Enter_your_VoIP_server_url' => lang('Enter your VoIP server url'),       
92                                                                                'lang_Enter_your_VoIP_server_port' => lang('Enter your VoIP server port'),
93                                                                                'lang_save' => lang('Save'),
94                                                                                'lang_cancel' => lang('Cancel'),
95                                                                                'value_voip_email_redirect' => ($GLOBALS['phpgw_info']['server']['voip_email_redirect']) ? $GLOBALS['phpgw_info']['server']['voip_email_redirect'] : '',
96                                                                                'value_voip_server' => ($GLOBALS['phpgw_info']['server']['voip_server']) ? $GLOBALS['phpgw_info']['server']['voip_server'] : '',
97                                                                                'value_voip_url' => ($GLOBALS['phpgw_info']['server']['voip_url']) ? $GLOBALS['phpgw_info']['server']['voip_url'] : '',
98                                                                                'value_voip_port' => ($GLOBALS['phpgw_info']['server']['voip_port']) ? $GLOBALS['phpgw_info']['server']['voip_port'] : '',
99                                                                                'lang_load' => lang('Wait Loading...!'),
100                                                                                'lang_grupos_ldap' => 'Grupos Ldap',
101                                                                                'lang_grupos_liberados' => 'Grupos Liberados',
102                                                                                'lang_groups_ldap' => lang('groups ldap'),
103                                                                                'lang_organizations' => lang('Organizations'),
104                                                                                'groups_voip' => $gvoip,
105                                                                                'ous_ldap' => $ous
106                                                                                ));
107       
108                $GLOBALS['phpgw']->template->pparse('out','voip_page');
109        }
110       
111        function display_row($label, $value)
112        {
113                $GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color());
114                $GLOBALS['phpgw']->template->set_var('label',$label);
115                $GLOBALS['phpgw']->template->set_var('value',$value);
116                $GLOBALS['phpgw']->template->parse('rows','row',True);
117        }
118
119        function add()
120        {
121               
122                if($GLOBALS['phpgw']->acl->check('applications_access',1,'admin'))
123                {
124                        $GLOBALS['phpgw']->redirect_link('/index.php');
125                }               
126               
127                if ($_POST['cancel'])
128                {
129                        $GLOBALS['phpgw']->redirect_link('/admin/index.php');
130                }
131
132                if ( $_POST['save'] )
133                {
134                        $conf['voip_server']= $_POST['voip_server'];
135                        $conf['voip_url']       = $_POST['voip_url'];
136                        $conf['voip_port']      = $_POST['voip_port'];
137                        $conf['voip_email_redirect'] = $_POST['voip_email_redirect'];
138                       
139                        if( is_array($_POST['voip_groups']) )
140                                foreach($_POST['voip_groups'] as $tmp)
141                                        $conf['voip_groups'] = (count($conf['voip_groups']) > 0 ) ? $conf['voip_groups'] . "," . $tmp : $tmp;
142                        else{
143                                $conf['voip_groups'] = '';
144                        }
145                        $this->bo->setConfDB($conf);
146                }
147
148                $GLOBALS['phpgw']->redirect_link('/admin/index.php');
149        }
150}
151?>
Note: See TracBrowser for help on using the repository browser.