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

Revision 3731, 5.5 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1523 - Criado o layout do Expresso Mini para navegadores desktop

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