[5291] | 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 */
|
---|
[6920] | 99 | if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value))
|
---|
[5291] | 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);
|
---|
[7655] | 113 | for ($i=0;$i<(count($newvals) - 1); ++$i)
|
---|
[5291] | 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 | $mbstring = ini_get_all("mbstring");
|
---|
| 145 | $t->set_var('mbstring_value',(extension_loaded('mbstring') || function_exists('dl') && @dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX)?
|
---|
| 146 | $mbstring['mbstring.func_overload']['global_value'] != ''?
|
---|
| 147 | 'mbstring.func_overload = '.$mbstring['mbstring.func_overload']['global_value']:'' : ''));
|
---|
| 148 |
|
---|
| 149 | $t->pfp('out','body');
|
---|
| 150 |
|
---|
| 151 | $t->set_var('lang_cancel', lang('Back'));
|
---|
| 152 | $t->pfp('out','footer');
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | function row_action($action,$type,$account_id)
|
---|
| 156 | {
|
---|
| 157 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array(
|
---|
| 158 | 'menuaction' => 'reports.uireports.'.$action.'_'.$type,
|
---|
| 159 | 'account_id' => $account_id
|
---|
| 160 | )).'"> '.lang($action).' </a>';
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | function css()
|
---|
| 164 | {
|
---|
| 165 | $appCSS =
|
---|
| 166 | 'th.activetab
|
---|
| 167 | {
|
---|
| 168 | color:#000000;
|
---|
| 169 | background-color:#D3DCE3;
|
---|
| 170 | border-top-width : 1px;
|
---|
| 171 | border-top-style : solid;
|
---|
| 172 | border-top-color : Black;
|
---|
| 173 | border-left-width : 1px;
|
---|
| 174 | border-left-style : solid;
|
---|
| 175 | border-left-color : Black;
|
---|
| 176 | border-right-width : 1px;
|
---|
| 177 | border-right-style : solid;
|
---|
| 178 | border-right-color : Black;
|
---|
| 179 | font-size: 12px;
|
---|
| 180 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | th.inactivetab
|
---|
| 184 | {
|
---|
| 185 | color:#000000;
|
---|
| 186 | background-color:#E8F0F0;
|
---|
| 187 | border-bottom-width : 1px;
|
---|
| 188 | border-bottom-style : solid;
|
---|
| 189 | border-bottom-color : Black;
|
---|
| 190 | font-size: 12px;
|
---|
| 191 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | .td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
| 195 | .td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
| 196 |
|
---|
| 197 | div.activetab{ display:inline; }
|
---|
| 198 | div.inactivetab{ display:none; }';
|
---|
| 199 |
|
---|
| 200 | return $appCSS;
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | }
|
---|
| 204 | ?>
|
---|