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