source: trunk/mobile/mobile_header.inc.php @ 454

Revision 454, 5.0 KB checked in by rafaelraymundo, 16 years ago (diff)

Mobile com os arquivos e alterações finais para as novas implementações

Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare                                                               *
4        * http://www.egroupware.org                                                *
5        * The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12
13        /*******************************************\
14         * Define a aplicação mobile preferencial  *
15        \*******************************************/
16        //TODO: Ler do banco do expresso as preferências do usuário e definir a aplicação móvel padrão
17        // por enquanto isto será hardcoded para mobilemail.
18        $GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] = 'mobilemail';
19        //TODO: Fazer mais genérico... Parecido com o home.php do expresso.
20
21        /*
22         * @function start_prefered_app
23         * @abstract Função que chama a aplicação móvel preferencial.
24         * @author Mário César Kolling <mario.kolling@serpro.gov.br>
25         */
26        function start_prefered_app(){
27
28                //TODO: Determinar qual a aplicação móvel preferida e iniciá-la.
29                //TODO: Costruir agenda como uma classe.
30
31                if ($GLOBALS['phpgw_info']['flags']['currentapp'] === 'mobile'){
32                        $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/'
33                                . $GLOBALS['phpgw_info']['flags']['currentapp'] . '/'
34                                . $GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] . '_'
35                                . 'index.php'));
36                }
37
38        }
39
40        // Não será necessário implementar nada aqui
41        function print_navbar(){
42
43        }
44
45        /*
46         * @function print_header
47         * @abstract Imprime o início da tela do Expresso Mini, headers html e a barra de navegação
48         * @author Mário César Kolling <mario.kolling@serpro.gov.br>
49         */
50        function print_header(){
51
52                $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
53                $p->set_file(
54                                Array(
55                                        'home_t' => 'home.tpl'
56                                )
57                );
58
59                $p->set_block('home_t', 'mobile_header');
60                $p->set_block('home_t', 'mobile_navbar');
61                $GLOBALS['phpgw']->accounts->read_repository();
62
63                $var  = Array(
64                        'fullname'      => $GLOBALS['phpgw']->accounts->data['fullname'],   //$GLOBALS['phpgw_info']['user']['firstname'],
65                        //'last_name'           => $GLOBALS['phpgw']->accounts->data['last_name'], //$GLOBALS['phpgw_info']['user']['lastname'],
66                        'account_lid'   => $GLOBALS['phpgw_info']['user']['account_lid'],
67                        'lang_logout'   => lang('Logout'),
68                        'template_set'  => $GLOBALS['phpgw_info']['server']['template_set']
69                );
70
71                $p->set_var($var);
72                $p->parse('home_t', 'mobile_header');
73
74                /*****************************\
75                 * Cria o link para a agenda *
76                \*****************************/
77                //TODO: Passar estes passos para um laço quando tivermos um modo de registrar aplicações mobile
78                $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
79                $q->set_file(
80                                Array(
81                                        'agenda_t' => 'home.tpl'
82                                )
83                );
84
85                $q->set_block('agenda_t', 'agenda');
86                $q->set_block('agenda_t', 'begin_anchor');
87                $q->set_block('agenda_t', 'end_anchor');
88
89                $q->set_var('href', 'calendar.php');
90                $q->set_var('lang_agenda', lang('Calendar'));
91                $q->fp('agenda_t', 'begin_anchor');
92                $q->fp('agenda_t', 'end_anchor');
93
94                $p->set_var('agenda', trim($q->fp('agenda_t', 'agenda')));
95
96                /********************************\
97                 * Cria o link para o mobilemail *
98                \********************************/
99                $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
100                $q->set_file(
101                                Array(
102                                        'mobilemail_t' => 'home.tpl'
103                                )
104                );
105
106                $q->set_block('mobilemail_t', 'mobilemail');
107                $q->set_block('mobilemail_t', 'begin_anchor');
108                $q->set_block('mobilemail_t', 'end_anchor');
109
110                $q->set_var('href', 'mobilemail_index.php');
111                $q->set_var('lang_email', lang('E-mail'));
112                $q->fp('mobilemail_t', 'begin_anchor');
113                $q->fp('mobilemail_t', 'end_anchor');
114
115                $p->set_var('mobilemail', trim($q->fp('mobilemail_t', 'mobilemail')));
116
117                /**************************************\
118                 * Termina de formar o menu e imprime *
119                \**************************************/
120                $p->parse('home_t', 'mobile_navbar', true);
121                $p->pfp('out', 'home_t');
122
123        }
124
125        /*
126         * @function print_footer
127         * @abstract Imprime o fim da tela do Expresso Mini, ou seja, fecha as tags <body> e <html>
128         * @author Mário César Kolling <mario.kolling@serpro.gov.br>
129         */
130        function print_footer(){
131
132                $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
133                $p->set_file(
134                                Array(
135                                        'home_t' => 'home.tpl'
136                                )
137                );
138
139                $p->set_block('home_t', 'mobile_footer');
140                $p->pfp('out', 'mobile_footer');
141
142        }
143?>
Note: See TracBrowser for help on using the repository browser.