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

Revision 3595, 4.9 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1412 - adição do novo layout na tela de contatos.

  • 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                        $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_navbar
77                * @abstract Imprime o início da tela do Expresso Mini => barra de navegação
78                * @author Mário César Kolling <mario.kolling@serpro.gov.br>
79                */
80                private function print_navbar(){
81                        $ui_mobilemail = CreateObject('mobile.ui_mobilemail');
82                        $obj = createobject("expressoMail1_2.functions");
83            // setting timezone preference
84            $zones = $obj->getTimezones();
85            $_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));
86
87                       
88                        $this-> template->set_var('lang_logout', lang('logout'));
89                        $this-> template->set_var('lang_back', lang('Back'));
90                        $this-> template->set_var('lang_home', lang('home'));
91                        $this-> template->set_var('lang_email', lang('E-mail'));
92                        $this-> template->set_var('lang_contacts', lang('Contact Center'));
93                        $this-> template->set_var('lang_calendar', lang('Calendar'));
94                        $this-> template->set_var('href_logout', 'login.php?cd=1');
95                        $this-> template->set_var('href_back', 'javascript:history.back()');
96                        $this-> template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.init_cc');
97                        $this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0");
98                        $this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index");
99                        $this-> template->set_var('href_home', "index.php?menuaction=mobile.ui_home.index");
100                }
101
102                /*
103                * @function print_header
104                * @abstract Imprime o início da tela do Expresso Mini => headers html
105                * @author Mário César Kolling <mario.kolling@serpro.gov.br>
106                */             
107                private function print_header(){
108                        $GLOBALS['phpgw']->accounts->read_repository();
109                        $var  = Array(
110                                'css'   => $this->get_mobile_css(),
111                        );             
112                        $this->template->set_var($var);         
113                }
114
115
116                public function get_mobile_css() {
117                        $css = "/mobile/templates/%s.css";
118
119                        global $path, $link;
120
121                        $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css );
122
123                        $link = '<LINK href="%s" type="text/css" rel="StyleSheet">';
124                        $link = sprintf( $link,
125                                "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}"
126                        );
127
128                        function _css( $css )
129                        {
130                                global $link, $path;
131
132                                if ( file_exists( sprintf( $path, str_replace( '/', SEP, $css ) ) ) )
133                                        return sprintf( $link, $css );
134
135                                return '';
136                        }
137
138                        $css = _css( 'css/mobile' );
139                        $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/base');
140                        $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']);
141
142                        return ( $css );
143
144                }
145
146        }
147?>
Note: See TracBrowser for help on using the repository browser.