1 | <?php
|
---|
2 | /*************************************************************************************\
|
---|
3 | * Expresso Relatório *
|
---|
4 | * by Elvio Rufino da Silva (elviosilva@yahoo.com.br, elviosilva@cepromat.mt.gov.br) *
|
---|
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 | class uireports
|
---|
13 | {
|
---|
14 | var $public_functions = array
|
---|
15 | (
|
---|
16 | 'report_config_global' => True,
|
---|
17 | 'get_user_info' => True,
|
---|
18 | 'css' => True
|
---|
19 | );
|
---|
20 |
|
---|
21 | var $nextmatchs;
|
---|
22 | var $user;
|
---|
23 | var $functions;
|
---|
24 | var $current_config;
|
---|
25 | var $ldap_functions;
|
---|
26 | var $db_functions;
|
---|
27 | var $imap_functions;
|
---|
28 |
|
---|
29 | function uireports()
|
---|
30 | {
|
---|
31 | $this->user = CreateObject('reports.user');
|
---|
32 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
---|
33 | $this->functions = CreateObject('reports.functions');
|
---|
34 | $this->ldap_functions = CreateObject('reports.ldap_functions');
|
---|
35 | $this->db_functions = CreateObject('reports.db_functions');
|
---|
36 | $this->fpdf = CreateObject('reports.fpdf'); // Class para PDF
|
---|
37 |
|
---|
38 | $c = CreateObject('phpgwapi.config','reports'); // cria o objeto relatorio no $c
|
---|
39 | $c->read_repository(); // na classe config do phpgwapi le os dados da tabela phpgw_config where relatorio, como passagem acima
|
---|
40 | $this->current_config = $c->config_data; // carrega os dados em do array no current_config
|
---|
41 |
|
---|
42 | if(!@is_object($GLOBALS['phpgw']->js))
|
---|
43 | {
|
---|
44 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
|
---|
45 | }
|
---|
46 | $GLOBALS['phpgw']->js->validate_file('jscode','cc','reports');
|
---|
47 | }
|
---|
48 |
|
---|
49 | function report_config_global()
|
---|
50 | {
|
---|
51 | if ($GLOBALS['phpgw']->acl->check('site_config_access',1,'admin'))
|
---|
52 | {
|
---|
53 | $GLOBALS['phpgw']->redirect_link('/index.php');
|
---|
54 | }
|
---|
55 |
|
---|
56 | $t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir($appname));
|
---|
57 | $t->set_unknowns('keep');
|
---|
58 | $t->set_file(array('config' => 'config.tpl'));
|
---|
59 | $t->set_block('config','header','header');
|
---|
60 | $t->set_block('config','body','body');
|
---|
61 | $t->set_block('config','footer','footer');
|
---|
62 |
|
---|
63 | $c = CreateObject('phpgwapi.config',$config_appname);
|
---|
64 | $c->read_repository();
|
---|
65 |
|
---|
66 | if ($c->config_data)
|
---|
67 | {
|
---|
68 | $current_config = $c->config_data;
|
---|
69 | }
|
---|
70 |
|
---|
71 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
72 | echo parse_navbar();
|
---|
73 |
|
---|
74 | $t->set_var('title',lang('Site Configuration'));
|
---|
75 | $t->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname));
|
---|
76 | $t->set_var('th_bg', $GLOBALS['phpgw_info']['theme']['th_bg']);
|
---|
77 | $t->set_var('th_text', $GLOBALS['phpgw_info']['theme']['th_text']);
|
---|
78 | $t->set_var('row_on', $GLOBALS['phpgw_info']['theme']['row_on']);
|
---|
79 | $t->set_var('row_off', $GLOBALS['phpgw_info']['theme']['row_off']);
|
---|
80 | $t->pparse('out','header');
|
---|
81 |
|
---|
82 | $vars = $t->get_undefined('body');
|
---|
83 |
|
---|
84 | $GLOBALS['phpgw']->hooks->single('config',$appname);
|
---|
85 |
|
---|
86 | foreach($vars as $value)
|
---|
87 | {
|
---|
88 | $valarray = explode('_',$value);
|
---|
89 | $type = array_shift($valarray);
|
---|
90 | $newval = implode(' ',$valarray);
|
---|
91 | switch ($type)
|
---|
92 | {
|
---|
93 | case 'lang':
|
---|
94 | $t->set_var($value,lang($newval));
|
---|
95 | break;
|
---|
96 | case 'value':
|
---|
97 | $newval = str_replace(' ','_',$newval);
|
---|
98 | /* Don't show passwords in the form */
|
---|
99 | if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value))
|
---|
100 | {
|
---|
101 | $t->set_var($value,'');
|
---|
102 | }
|
---|
103 | else
|
---|
104 | {
|
---|
105 | $t->set_var($value,htmlspecialchars($current_config[$newval]));
|
---|
106 | }
|
---|
107 | break;
|
---|
108 | case 'selected':
|
---|
109 | $configs = array();
|
---|
110 | $config = '';
|
---|
111 | $newvals = explode(' ',$newval);
|
---|
112 | $setting = end($newvals);
|
---|
113 | for ($i=0;$i<(count($newvals) - 1); $i++)
|
---|
114 | {
|
---|
115 | $configs[] = $newvals[$i];
|
---|
116 | }
|
---|
117 | $config = implode('_',$configs);
|
---|
118 | /* echo $config . '=' . $current_config[$config]; */
|
---|
119 | if ($current_config[$config] == $setting)
|
---|
120 | {
|
---|
121 | $t->set_var($value,' selected');
|
---|
122 | }
|
---|
123 | else
|
---|
124 | {
|
---|
125 | $t->set_var($value,'');
|
---|
126 | }
|
---|
127 | break;
|
---|
128 | case 'hook':
|
---|
129 | $newval = str_replace(' ','_',$newval);
|
---|
130 | if(function_exists($newval))
|
---|
131 | {
|
---|
132 | $t->set_var($value,$newval($current_config));
|
---|
133 | }
|
---|
134 | else
|
---|
135 | {
|
---|
136 | $t->set_var($value,'');
|
---|
137 | }
|
---|
138 | break;
|
---|
139 | default:
|
---|
140 | $t->set_var($value,'');
|
---|
141 | break;
|
---|
142 | }
|
---|
143 | }
|
---|
144 |
|
---|
145 | $t->set_var('mbstring_value',(extension_loaded('mbstring') || function_exists('dl') && @dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX)? 'mbstring.func_overload = 7' : ''));
|
---|
146 |
|
---|
147 | $t->pfp('out','body');
|
---|
148 |
|
---|
149 | $t->set_var('lang_cancel', lang('Back'));
|
---|
150 | $t->pfp('out','footer');
|
---|
151 | }
|
---|
152 |
|
---|
153 | function row_action($action,$type,$account_id)
|
---|
154 | {
|
---|
155 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array(
|
---|
156 | 'menuaction' => 'reports.uireports.'.$action.'_'.$type,
|
---|
157 | 'account_id' => $account_id
|
---|
158 | )).'"> '.lang($action).' </a>';
|
---|
159 | }
|
---|
160 |
|
---|
161 | function css()
|
---|
162 | {
|
---|
163 | $appCSS =
|
---|
164 | 'th.activetab
|
---|
165 | {
|
---|
166 | color:#000000;
|
---|
167 | background-color:#D3DCE3;
|
---|
168 | border-top-width : 1px;
|
---|
169 | border-top-style : solid;
|
---|
170 | border-top-color : Black;
|
---|
171 | border-left-width : 1px;
|
---|
172 | border-left-style : solid;
|
---|
173 | border-left-color : Black;
|
---|
174 | border-right-width : 1px;
|
---|
175 | border-right-style : solid;
|
---|
176 | border-right-color : Black;
|
---|
177 | font-size: 12px;
|
---|
178 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
179 | }
|
---|
180 |
|
---|
181 | th.inactivetab
|
---|
182 | {
|
---|
183 | color:#000000;
|
---|
184 | background-color:#E8F0F0;
|
---|
185 | border-bottom-width : 1px;
|
---|
186 | border-bottom-style : solid;
|
---|
187 | border-bottom-color : Black;
|
---|
188 | font-size: 12px;
|
---|
189 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
190 | }
|
---|
191 |
|
---|
192 | .td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
193 | .td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
194 |
|
---|
195 | div.activetab{ display:inline; }
|
---|
196 | div.inactivetab{ display:none; }';
|
---|
197 |
|
---|
198 | return $appCSS;
|
---|
199 | }
|
---|
200 |
|
---|
201 | }
|
---|
202 | ?>
|
---|