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 | $this->template->set_file(Array('home_t' => 'home.tpl')); |
---|
15 | $this->template->set_block('home_t', 'mobile_home'); |
---|
16 | } |
---|
17 | |
---|
18 | /* |
---|
19 | * @function set_content |
---|
20 | * @abstract Carrega o atributo "content" do template principal |
---|
21 | * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br> |
---|
22 | */ |
---|
23 | public function set_content($content){ |
---|
24 | $pre_content = $this->template->get_var("content"); |
---|
25 | $this->template->set_var("content", $pre_content.$content); |
---|
26 | } |
---|
27 | |
---|
28 | /* |
---|
29 | * @function print_all |
---|
30 | * @abstract Imprime toda tela do Expresso Mini |
---|
31 | * @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br> |
---|
32 | */ |
---|
33 | public function print_page($class, $method){ |
---|
34 | $this->print_header(); |
---|
35 | $this->print_navbar(); |
---|
36 | $filename = 'inc/class.'.$class.'.inc.php'; |
---|
37 | include_once($filename); |
---|
38 | $obj = new $class(); |
---|
39 | $obj -> $method(); |
---|
40 | $this->template->pfp('out', 'mobile_home'); |
---|
41 | } |
---|
42 | |
---|
43 | /* |
---|
44 | * @function print_navbar |
---|
45 | * @abstract Imprime o início da tela do Expresso Mini => barra de navegação |
---|
46 | * @author Mário César Kolling <mario.kolling@serpro.gov.br> |
---|
47 | */ |
---|
48 | private function print_navbar(){ |
---|
49 | $ui_mobilemail = CreateObject('mobile.ui_mobilemail'); |
---|
50 | |
---|
51 | $this-> template->set_var('href_newmail', 'index.php?menuaction=mobile.ui_mobilemail.new_msg&clk=01'); |
---|
52 | $this-> template->set_var('lang_newmail', lang('Create mail')); |
---|
53 | $this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0"); |
---|
54 | $this-> template->set_var('lang_email', lang('E-mail')); |
---|
55 | |
---|
56 | $obj = createobject("expressoMail1_2.functions"); |
---|
57 | // setting timezone preference |
---|
58 | $zones = $obj->getTimezones(); |
---|
59 | $_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)); |
---|
60 | |
---|
61 | $save_in_folder = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] : "-1"; |
---|
62 | $save_in_folder = @eregi_replace("INBOX/", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $save_in_folder); |
---|
63 | $save_in_folder = @eregi_replace("INBOX.", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $save_in_folder); |
---|
64 | $save_in_folder = $save_in_folder == '' ? 'INBOX/Sent':$save_in_folder; |
---|
65 | $folder_number = $ui_mobilemail->get_folder_number($save_in_folder); |
---|
66 | $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] = $save_in_folder; |
---|
67 | |
---|
68 | $this-> template->set_var('href_sent', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=".$folder_number); |
---|
69 | $this-> template->set_var('lang_sent', str_replace('*','',lang(str_replace('INBOX/','',$save_in_folder)))); |
---|
70 | $this-> template->set_var('href_more', 'index.php?menuaction=mobile.ui_mobilemail.list_folders'); |
---|
71 | $this-> template->set_var('lang_more_folders', lang('More folders...')); |
---|
72 | $this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index"); |
---|
73 | $this-> template->set_var('lang_calendar', lang('Calendar')); |
---|
74 | $this-> template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.contacts_list'); |
---|
75 | $this-> template->set_var('lang_cc', lang('Contact Center')); |
---|
76 | } |
---|
77 | |
---|
78 | /* |
---|
79 | * @function print_header |
---|
80 | * @abstract Imprime o início da tela do Expresso Mini => headers html |
---|
81 | * @author Mário César Kolling <mario.kolling@serpro.gov.br> |
---|
82 | */ |
---|
83 | private function print_header(){ |
---|
84 | $GLOBALS['phpgw']->accounts->read_repository(); |
---|
85 | $var = Array( |
---|
86 | 'fullname' => $GLOBALS['phpgw']->accounts->data['fullname'], |
---|
87 | 'account_lid' => $GLOBALS['phpgw_info']['user']['account_lid'], |
---|
88 | 'lang_logout' => lang('Logout'), |
---|
89 | 'template_set' => $GLOBALS['phpgw_info']['server']['template_set'], |
---|
90 | 'css' => $this->get_mobile_css(), |
---|
91 | 'lang_search' => lang('Search') |
---|
92 | ); |
---|
93 | $this->template->set_var($var); |
---|
94 | } |
---|
95 | |
---|
96 | |
---|
97 | public function get_mobile_css() { |
---|
98 | $css = "/mobile/templates/%s.css"; |
---|
99 | |
---|
100 | global $path, $link; |
---|
101 | |
---|
102 | $path = PHPGW_SERVER_ROOT . str_replace( '/', SEP, $css ); |
---|
103 | |
---|
104 | $link = '<LINK href="%s" type="text/css" rel="StyleSheet">'; |
---|
105 | $link = sprintf( $link, |
---|
106 | "{$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ]}{$css}" |
---|
107 | ); |
---|
108 | |
---|
109 | function _css( $css ) |
---|
110 | { |
---|
111 | global $link, $path; |
---|
112 | |
---|
113 | if ( file_exists( sprintf( $path, str_replace( '/', SEP, $css ) ) ) ) |
---|
114 | return sprintf( $link, $css ); |
---|
115 | |
---|
116 | return ''; |
---|
117 | } |
---|
118 | |
---|
119 | $css = _css( 'css/mobile' ); |
---|
120 | $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/base'); |
---|
121 | $css .= _css( $GLOBALS['phpgw_info']['server']['template_set'].'/css/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['theme']); |
---|
122 | |
---|
123 | return ( $css ); |
---|
124 | |
---|
125 | } |
---|
126 | |
---|
127 | } |
---|
128 | ?> |
---|