*/ function mobiletemplate(){ $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); $this->template->set_file(Array('home_t' => 'template.tpl')); $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_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->print_navbar(); $filename = 'inc/class.'.$class.'.inc.php'; include_once($filename); $obj = new $class(); $obj -> $method($_REQUEST); $this->template->pfp('out', 'mobile_home'); } /* * @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(){ $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('lang_logout', lang('logout')); $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_logout', 'login.php?cd=1'); $this-> template->set_var('href_back', 'javascript:history.back()'); $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"); } /* * @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( 'css' => $this->get_mobile_css(), ); $this->template->set_var($var); } public function get_mobile_css() { $css = "/mobile/templates/%s.css"; global $path, $link; $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css ); $link = ''; $link = sprintf( $link, "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}" ); function _css( $css ) { global $link, $path; if ( file_exists( sprintf( $path, str_replace( '/', SEP, $css ) ) ) ) return sprintf( $link, $css ); return ''; } $css = _css( 'css/mobile' ); $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/base'); $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']); return ( $css ); } } ?>