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

Revision 3571, 4.7 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1408 - Modificado o layout da tela de enviar email do expresso mini.

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