[623] | 1 | <?php |
---|
[3554] | 2 | //include_once(PHPGW_INCLUDE_ROOT.'/mobile/inc/class.ui_mobile.inc.php'); |
---|
[623] | 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']); |
---|
[3554] | 14 | $this->template->set_file(Array('home_t' => 'template.tpl')); |
---|
[3571] | 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'); |
---|
[623] | 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 | } |
---|
[3571] | 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 | } |
---|
[623] | 50 | |
---|
[3571] | 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 | |
---|
[623] | 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 | */ |
---|
[3571] | 65 | public function print_page($class, $method){ |
---|
[623] | 66 | $this->print_header(); |
---|
| 67 | $this->print_navbar(); |
---|
| 68 | $filename = 'inc/class.'.$class.'.inc.php'; |
---|
[3571] | 69 | include_once($filename); |
---|
[623] | 70 | $obj = new $class(); |
---|
[3554] | 71 | $obj -> $method($_REQUEST); |
---|
[623] | 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(){ |
---|
[3564] | 81 | $ui_mobilemail = CreateObject('mobile.ui_mobilemail'); |
---|
[3554] | 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)); |
---|
[1474] | 86 | |
---|
[3554] | 87 | |
---|
[3576] | 88 | $this-> template->set_var('lang_logout', lang('logout')); |
---|
[3554] | 89 | $this-> template->set_var('lang_back', lang('Back')); |
---|
| 90 | $this-> template->set_var('lang_home', lang('home')); |
---|
| 91 | $this-> template->set_var('lang_email', lang('E-mail')); |
---|
| 92 | $this-> template->set_var('lang_contacts', lang('Contact Center')); |
---|
[623] | 93 | $this-> template->set_var('lang_calendar', lang('Calendar')); |
---|
[3576] | 94 | $this-> template->set_var('href_logout', 'login.php?cd=1'); |
---|
| 95 | $this-> template->set_var('href_back', 'javascript:history.back()'); |
---|
[3595] | 96 | $this-> template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.init_cc'); |
---|
[3554] | 97 | $this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0"); |
---|
| 98 | $this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index"); |
---|
[3564] | 99 | $this-> template->set_var('href_home', "index.php?menuaction=mobile.ui_home.index"); |
---|
[623] | 100 | } |
---|
| 101 | |
---|
| 102 | /* |
---|
| 103 | * @function print_header |
---|
| 104 | * @abstract Imprime o início da tela do Expresso Mini => headers html |
---|
| 105 | * @author Mário César Kolling <mario.kolling@serpro.gov.br> |
---|
| 106 | */ |
---|
| 107 | private function print_header(){ |
---|
| 108 | $GLOBALS['phpgw']->accounts->read_repository(); |
---|
| 109 | $var = Array( |
---|
[3484] | 110 | 'css' => $this->get_mobile_css(), |
---|
[623] | 111 | ); |
---|
| 112 | $this->template->set_var($var); |
---|
[3484] | 113 | } |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | public function get_mobile_css() { |
---|
| 117 | $css = "/mobile/templates/%s.css"; |
---|
| 118 | |
---|
| 119 | global $path, $link; |
---|
| 120 | |
---|
| 121 | $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css ); |
---|
| 122 | |
---|
| 123 | $link = '<LINK href="%s" type="text/css" rel="StyleSheet">'; |
---|
| 124 | $link = sprintf( $link, |
---|
| 125 | "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}" |
---|
| 126 | ); |
---|
| 127 | |
---|
| 128 | function _css( $css ) |
---|
| 129 | { |
---|
| 130 | global $link, $path; |
---|
| 131 | |
---|
| 132 | if ( file_exists( sprintf( $path, str_replace( '/', SEP, $css ) ) ) ) |
---|
| 133 | return sprintf( $link, $css ); |
---|
| 134 | |
---|
| 135 | return ''; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | $css = _css( 'css/mobile' ); |
---|
| 139 | $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/base'); |
---|
| 140 | $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']); |
---|
| 141 | |
---|
| 142 | return ( $css ); |
---|
| 143 | |
---|
| 144 | } |
---|
| 145 | |
---|
[623] | 146 | } |
---|
[1474] | 147 | ?> |
---|