[454] | 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 | |
---|
[480] | 117 | /********************************\ |
---|
| 118 | * Cria o link para o cc * |
---|
| 119 | \********************************/ |
---|
| 120 | $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); |
---|
| 121 | $q->set_file( |
---|
| 122 | Array( |
---|
| 123 | 'cc_t' => 'home.tpl' |
---|
| 124 | ) |
---|
| 125 | ); |
---|
| 126 | |
---|
| 127 | $q->set_block('cc_t', 'mobilecc'); |
---|
| 128 | $q->set_block('cc_t', 'begin_anchor'); |
---|
| 129 | $q->set_block('cc_t', 'end_anchor'); |
---|
| 130 | |
---|
| 131 | $q->set_var('href', 'index.php?menuaction=mobile.ui_mobilecc.contacts_list'); |
---|
| 132 | $q->set_var('lang_cc', lang('contact center')); |
---|
| 133 | $q->fp('cc_t', 'begin_anchor'); |
---|
| 134 | $q->fp('cc_t', 'end_anchor'); |
---|
| 135 | |
---|
| 136 | $p->set_var('contactcenter', trim($q->fp('cc_t', 'mobilecc'))); |
---|
| 137 | |
---|
| 138 | |
---|
[454] | 139 | /**************************************\ |
---|
| 140 | * Termina de formar o menu e imprime * |
---|
| 141 | \**************************************/ |
---|
| 142 | $p->parse('home_t', 'mobile_navbar', true); |
---|
| 143 | $p->pfp('out', 'home_t'); |
---|
| 144 | |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | /* |
---|
| 148 | * @function print_footer |
---|
| 149 | * @abstract Imprime o fim da tela do Expresso Mini, ou seja, fecha as tags <body> e <html> |
---|
| 150 | * @author Mário César Kolling <mario.kolling@serpro.gov.br> |
---|
| 151 | */ |
---|
| 152 | function print_footer(){ |
---|
| 153 | |
---|
| 154 | $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); |
---|
| 155 | $p->set_file( |
---|
| 156 | Array( |
---|
| 157 | 'home_t' => 'home.tpl' |
---|
| 158 | ) |
---|
| 159 | ); |
---|
| 160 | |
---|
| 161 | $p->set_block('home_t', 'mobile_footer'); |
---|
| 162 | $p->pfp('out', 'mobile_footer'); |
---|
| 163 | |
---|
| 164 | } |
---|
| 165 | ?> |
---|