source: branches/2.2/mobile/inc/class.mobiletemplate.inc.php @ 3554

Revision 3554, 3.8 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1423 - Envio das modificacoes no cabeçalho e rodape para o novo expressomini.

  • Property svn:executable set to *
Line 
1<?php
2//include_once(PHPGW_INCLUDE_ROOT.'/mobile/inc/class.ui_mobile.inc.php');
3        class mobiletemplate
4        {
5                private $template;
6               
7                /*
8                * @function mobiletemplate
9                * @abstract Construtor da classe, que monta o template home
10                * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
11                */             
12                function mobiletemplate(){
13                        $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
14                        $this->template->set_file(Array('home_t' => 'template.tpl'));   
15                        $this->template->set_block('home_t', 'mobile_home');                   
16                }
17
18                /*
19                * @function set_content
20                * @abstract Carrega o atributo "content" do template principal
21                * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
22                */             
23                public function set_content($content){
24                        $pre_content = $this->template->get_var("content");
25                        $this->template->set_var("content", $pre_content.$content);
26                }
27
28                /*
29                * @function print_all
30                * @abstract Imprime toda tela do Expresso Mini
31                * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
32                */
33                public function print_page($class, $method){           
34                        $this->print_header();
35                        $this->print_navbar();
36                        $filename = 'inc/class.'.$class.'.inc.php';
37                        include_once($filename);       
38                        $obj = new $class();           
39                        $obj -> $method($_REQUEST);
40                        $this->template->pfp('out', 'mobile_home');
41                }
42       
43                /*
44                * @function print_navbar
45                * @abstract Imprime o início da tela do Expresso Mini => barra de navegação
46                * @author Mário César Kolling <mario.kolling@serpro.gov.br>
47                */
48                private function print_navbar(){
49                       
50                        $obj = createobject("expressoMail1_2.functions");
51            // setting timezone preference
52            $zones = $obj->getTimezones();
53            $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['timezone'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['timezone'] : sprintf("%s", array_search("America/Sao_Paulo", $zones));
54
55                       
56                        $this-> template->set_var('lang_back', lang('Back'));
57                        $this-> template->set_var('lang_home', lang('home'));
58                        $this-> template->set_var('lang_email', lang('E-mail'));
59                        $this-> template->set_var('lang_contacts', lang('Contact Center'));
60                        $this-> template->set_var('lang_calendar', lang('Calendar'));
61                        $this-> template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.contacts_list');
62                        $this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0");
63                        $this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index");
64                        $this-> template->set_var('href_home', "...");
65
66                }
67
68                /*
69                * @function print_header
70                * @abstract Imprime o início da tela do Expresso Mini => headers html
71                * @author Mário César Kolling <mario.kolling@serpro.gov.br>
72                */             
73                private function print_header(){
74                        $GLOBALS['phpgw']->accounts->read_repository();
75                        $var  = Array(
76                                'css'   => $this->get_mobile_css(),
77                        );             
78                        $this->template->set_var($var);         
79                }
80
81
82                public function get_mobile_css() {
83                        $css = "/mobile/templates/%s.css";
84
85                        global $path, $link;
86
87                        $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css );
88
89                        $link = '<LINK href="%s" type="text/css" rel="StyleSheet">';
90                        $link = sprintf( $link,
91                                "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}"
92                        );
93
94                        function _css( $css )
95                        {
96                                global $link, $path;
97
98                                if ( file_exists( sprintf( $path, str_replace( '/', SEP, $css ) ) ) )
99                                        return sprintf( $link, $css );
100
101                                return '';
102                        }
103
104                        $css = _css( 'css/mobile' );
105                        $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/base');
106                        $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']);
107
108                        return ( $css );
109
110                }
111
112        }
113?>
Note: See TracBrowser for help on using the repository browser.