*/ function mobiletemplate(){ $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); $template = $GLOBALS['phpgw']->session->appsession('mobile.layout','mobile'); if($template == "mini_desktop") { $this->template->set_file(array('home_t' => 'pc_template.tpl')); $this->template->set_file(array('home_t_search_bar' => 'search_bar.tpl')); $this->template->set_block('home_t_search_bar','search_bar'); $this->template->set_var('search',$this->template->fp('out','search_bar')); $this->template->set_var('lang_mini_mobile', lang('mini mobile')); $this->template->set_var('lang_search_error_message',lang("need choose one option")); $this->template->set_var('lang_search_error_message_four_digits',lang("search word need not be empty and has more then four char")); } else { $this->template->set_file(array('home_t' => 'template.tpl')); $this->template->set_var('lang_mini_desktop', lang('mini desktop')); } $this->template->set_block('home_t', 'mobile_home'); $this->template->set_block('home_t','success_message'); $this->template->set_block('home_t','error_message'); } /* * @function set_content * @abstract Carrega o atributo "content" do template principal * @author Nilton Emilio Buhrer Neto */ public function set_content($content){ $pre_content = $this->template->get_var("content"); $this->template->set_var("content", $pre_content.$content); } /* * @function set_home * @abstract Carrega o atributo "home" do template principal para PC. * @author Diógenes Ribeiro Duarte */ public function set_home($content) { $pre_content = $this->template->get_var("home"); $this->template->set_var("home", $pre_content.$content); } /* * @function set_msg * @abstract Seta a mensagem de sucesso ou error a depender do tipo. * @author Thiago Antonius */ public function set_msg($msg, $type){ if(isset($msg) && trim($msg)!="") { $this->template->set_var("message", $msg); $this->template->parse("message_box", $type."_message", true); } } /* * @function set_success_msg * @abstract Seta a mensagem de sucesso. * @author Thiago Antonius */ public function set_success_msg($msg){ $this->set_msg($msg, "success"); } /* * @function set_error_msg * @abstract Seta a mensagem de erro * @author Thiago Antonius */ public function set_error_msg($msg){ $this->set_msg($msg, "error"); } /* * @function print_all * @abstract Imprime toda tela do Expresso Mini * @author Nilton Emilio Buhrer Neto */ public function print_page($class, $method){ $this->print_header(); $this->init_mobile(); if(!($class == 'ui_home' && $method == 'index')) $this->print_navbar(); $filename = 'inc/class.'.$class.'.inc.php'; include_once($filename); $obj = new $class(); $obj -> $method($_REQUEST); if($GLOBALS['phpgw']->session->appsession('mobile.layout','mobile') == "mini_desktop") { $ui_home = CreateObject('mobile.ui_home'); $ui_home->index($_REQUEST); } $this->template->pfp('out', 'mobile_home'); } public function init_mobile() { $ui_mobilemail = CreateObject('mobile.ui_mobilemail'); $obj = createobject("expressoMail1_2.functions"); // setting timezone preference $zones = $obj->getTimezones(); $_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)); $this->template->set_var('global_title', lang('expresso mini')); $this->template->set_var('lang_logout', lang('logout')); $this->template->set_var('lang_search', lang('search')); $this->template->set_var('href_logout', 'login.php?cd=1'); } /* * @function print_navbar * @abstract Imprime o início da tela do Expresso Mini => barra de navegação * @author Mário César Kolling */ private function print_navbar(){ $this->template->set_var('lang_back', lang('Back')); $this->template->set_var('lang_home', lang('home')); $this->template->set_var('lang_email', lang('E-mail')); $this->template->set_var('lang_contacts', lang('Contact Center')); $this->template->set_var('lang_calendar', lang('Calendar')); $this->template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.init_cc'); $this->template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0"); $this->template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index"); $this->template->set_var('href_home', "index.php?menuaction=mobile.ui_home.index"); } private function process_back_link() { $url = $GLOBALS['phpgw']->session->appsession('mobile.last_url','mobile'); if($url) { $params = $GLOBALS['phpgw']->session->appsession('mobile.last_request','mobile'); $query_string = ""; unset($params['sessionid']); unset($params['domain']); unset($params['last_loginid']); unset($params['last_domain']); unset($params['kp3']); unset($params['showHeader']); foreach ($params as $key => $value) { $query_string .= "&".$key."=".$value; } if($query_string != "") $url .= "?".substr($query_string,1); $this->href_back = $url; } else { $this->href_back = 'javascript:history.back()'; } $GLOBALS['phpgw']->session->appsession('mobile.last_url','mobile',$_SERVER["SCRIPT_NAME"]); $GLOBALS['phpgw']->session->appsession('mobile.last_request','mobile',$_REQUEST); } function get_back_link(){ return $this->href_back; } /* * @function print_header * @abstract Imprime o início da tela do Expresso Mini => headers html * @author Mário César Kolling */ private function print_header(){ $GLOBALS['phpgw']->accounts->read_repository(); $var = Array('title' => lang("expresso mini")); $this->template->set_var($var); $this->process_back_link(); } } ?>