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

Revision 3652, 5.1 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1404 - Adicionado link de logout na barra superior da página e retirado do rodapé

  • 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                        $this->template->set_block('home_t','success_message');
17                        $this->template->set_block('home_t','error_message');           
18                }
19
20                /*
21                * @function set_content
22                * @abstract Carrega o atributo "content" do template principal
23                * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
24                */             
25                public function set_content($content){
26                        $pre_content = $this->template->get_var("content");
27                        $this->template->set_var("content", $pre_content.$content);
28                }
29               
30                /*
31                * @function set_msg
32                * @abstract Seta a mensagem de sucesso ou error a depender do tipo.
33                * @author Thiago Antonius
34                */             
35                public function set_msg($msg, $type){
36                        if(isset($msg) && trim($msg)!="") {
37                                $this->template->set_var("message", $msg);
38                                $this->template->parse("message_box", $type."_message", true);
39                        }
40                }               
41               
42                /*
43                * @function set_success_msg
44                * @abstract Seta a mensagem de sucesso.
45                * @author Thiago Antonius
46                */             
47                public function set_success_msg($msg){
48                        $this->set_msg($msg, "success");
49                }
50
51                        /*
52                * @function set_error_msg
53                * @abstract Seta a mensagem de erro
54                * @author Thiago Antonius
55                */             
56                public function set_error_msg($msg){
57                        $this->set_msg($msg, "error");
58                }               
59
60                /*
61                * @function print_all
62                * @abstract Imprime toda tela do Expresso Mini
63                * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
64                */
65                public function print_page($class, $method){
66                        $this->print_header();
67                        $class=='ui_home' && $method=='index'?$this->print_logout():$this->print_navbar();
68                        $filename = 'inc/class.'.$class.'.inc.php';
69                        include_once($filename);
70                        $obj = new $class();           
71                        $obj -> $method($_REQUEST);
72                        $this->template->pfp('out', 'mobile_home');
73                }
74               
75                /*
76                * @function print_logout
77                * @abstract Exibe label e link para Logout
78                * @author Diego Moreno
79                */
80                public function print_logout(){
81                        $this-> template->set_var('lang_logout', lang('logout'));
82                        $this-> template->set_var('href_logout', 'login.php?cd=1');
83                }
84               
85                /*
86                * @function print_navbar
87                * @abstract Imprime o início da tela do Expresso Mini => barra de navegação
88                * @author Mário César Kolling <mario.kolling@serpro.gov.br>
89                */
90                private function print_navbar(){
91                        $ui_mobilemail = CreateObject('mobile.ui_mobilemail');
92                        $obj = createobject("expressoMail1_2.functions");
93            // setting timezone preference
94            $zones = $obj->getTimezones();
95            $_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));
96
97
98                        $this-> print_logout();                 
99                        $this-> template->set_var('lang_back', lang('Back'));
100                        $this-> template->set_var('lang_home', lang('home'));
101                        $this-> template->set_var('lang_email', lang('E-mail'));
102                        $this-> template->set_var('lang_contacts', lang('Contact Center'));
103                        $this-> template->set_var('lang_calendar', lang('Calendar'));
104                        $this-> template->set_var('href_back', 'javascript:history.back()');
105                        $this-> template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.init_cc');
106                        $this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0");
107                        $this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index");
108                        $this-> template->set_var('href_home', "index.php?menuaction=mobile.ui_home.index");
109                }
110
111                /*
112                * @function print_header
113                * @abstract Imprime o início da tela do Expresso Mini => headers html
114                * @author Mário César Kolling <mario.kolling@serpro.gov.br>
115                */             
116                private function print_header(){
117                        $GLOBALS['phpgw']->accounts->read_repository();
118                        $var  = Array(
119                                'css'   => $this->get_mobile_css(),
120                        );             
121                        $this->template->set_var($var);         
122                }
123
124
125                public function get_mobile_css() {
126                        $css = "/mobile/templates/%s.css";
127
128                        global $path, $link;
129
130                        $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css );
131
132                        $link = '<LINK href="%s" type="text/css" rel="StyleSheet">';
133                        $link = sprintf( $link,
134                                "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}"
135                        );
136
137                        function _css( $css )
138                        {
139                                global $link, $path;
140
141                                if ( file_exists( sprintf( $path, str_replace( '/', SEP, $css ) ) ) )
142                                        return sprintf( $link, $css );
143
144                                return '';
145                        }
146
147                        $css = _css( 'css/mobile' );
148                        $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/base');
149                        $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']);
150
151                        return ( $css );
152
153                }
154
155        }
156?>
Note: See TracBrowser for help on using the repository browser.