Ignore:
Timestamp:
01/26/09 14:47:04 (15 years ago)
Author:
niltonneto
Message:

Resolve #399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mobile/mobile_header.inc.php

    r517 r623  
    1616        //TODO: Ler do banco do expresso as preferências do usuário e definir a aplicação móvel padrão 
    1717        // 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. 
     18        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'mobile'; 
     19        $GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] = 'mobilemail'; // mobilecalendar, mobilecc ou mobilemail 
    2020 
    2121        /* 
     
    2525         */ 
    2626        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 o new_mail  * 
    76                 \********************************/ 
    77                 $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
    78                 $q->set_file( 
    79                                 Array( 
    80                                         'new_mail_t' => 'home.tpl' 
    81                                 ) 
    82                 ); 
    83  
    84                 $q->set_block('new_mail_t', 'new_mail'); 
    85                 $q->set_block('new_mail_t', 'begin_anchor'); 
    86                 $q->set_block('new_mail_t', 'end_anchor'); 
    87  
    88                 $q->set_var('href', 'index.php?menuaction=mobile.mobilemail.new_msg&clk=01'); 
    89                 $q->set_var('lang_newmail', lang('Create mail')); 
    90                 $q->fp('new_mail_t', 'begin_anchor'); 
    91                 $q->fp('new_mail_t', 'end_anchor'); 
    92  
    93                 $p->set_var('newmail', trim($q->fp('new_mail_t', 'new_mail'))); 
    94  
    95                 /********************************\ 
    96                  * Cria o link para o mobilemail * 
    97                 \********************************/ 
    98                 $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
    99                 $q->set_file( 
    100                                 Array( 
    101                                         'mobilemail_t' => 'home.tpl' 
    102                                 ) 
    103                 ); 
    104  
    105                 $q->set_block('mobilemail_t', 'mobilemail'); 
    106                 $q->set_block('mobilemail_t', 'begin_anchor'); 
    107                 $q->set_block('mobilemail_t', 'end_anchor'); 
    108  
    109                 $q->set_var('href', 'mobilemail_index.php'); 
    110                 $q->set_var('lang_email', lang('E-mail')); 
    111                 $q->fp('mobilemail_t', 'begin_anchor'); 
    112                 $q->fp('mobilemail_t', 'end_anchor'); 
    113  
    114                 $p->set_var('mobilemail', trim($q->fp('mobilemail_t', 'mobilemail'))); 
    115  
    116                 /*****************************\ 
    117                  * Cria o link para a agenda * 
    118                 \*****************************/ 
    119                 //TODO: Passar estes passos para um laço quando tivermos um modo de registrar aplicações mobile 
    120                 $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
    121                 $q->set_file( 
    122                                 Array( 
    123                                         'agenda_t' => 'home.tpl' 
    124                                 ) 
    125                 ); 
    126  
    127                 $q->set_block('agenda_t', 'agenda'); 
    128                 $q->set_block('agenda_t', 'begin_anchor'); 
    129                 $q->set_block('agenda_t', 'end_anchor'); 
    130  
    131                 $q->set_var('href', 'calendar.php'); 
    132                 $q->set_var('lang_agenda', lang('Calendar')); 
    133                 $q->fp('agenda_t', 'begin_anchor'); 
    134                 $q->fp('agenda_t', 'end_anchor'); 
    135  
    136                 $p->set_var('agenda', trim($q->fp('agenda_t', 'agenda'))); 
    137  
    138                 /********************************\ 
    139                  * Cria o link para o mobilemail * 
    140                 \********************************/ 
    141 /*              $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
    142                 $q->set_file( 
    143                                 Array( 
    144                                         'mobilemail_t' => 'home.tpl' 
    145                                 ) 
    146                 ); 
    147  
    148                 $q->set_block('mobilemail_t', 'mobilemail'); 
    149                 $q->set_block('mobilemail_t', 'begin_anchor'); 
    150                 $q->set_block('mobilemail_t', 'end_anchor'); 
    151  
    152                 $q->set_var('href', 'mobilemail_index.php'); 
    153                 $q->set_var('lang_email', lang('E-mail')); 
    154                 $q->fp('mobilemail_t', 'begin_anchor'); 
    155                 $q->fp('mobilemail_t', 'end_anchor'); 
    156  
    157                 $p->set_var('mobilemail', trim($q->fp('mobilemail_t', 'mobilemail'))); 
    158 */ 
    159  
    160                 /********************************\ 
    161                  * Cria o link para o cc         * 
    162                 \********************************/ 
    163                 $q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
    164                 $q->set_file( 
    165                         Array( 
    166                                 'cc_t' => 'home.tpl' 
    167                         ) 
    168                 ); 
    169  
    170                 $q->set_block('cc_t', 'mobilecc'); 
    171                 $q->set_block('cc_t', 'begin_anchor'); 
    172                 $q->set_block('cc_t', 'end_anchor'); 
    173                  
    174                 $q->set_var('href', 'index.php?menuaction=mobile.ui_mobilecc.contacts_list'); 
    175                 $q->set_var('lang_cc', lang('Contact Center')); 
    176                 $q->fp('cc_t', 'begin_anchor'); 
    177                 $q->fp('cc_t', 'end_anchor'); 
    178                  
    179                 $p->set_var('contactcenter', trim($q->fp('cc_t', 'mobilecc'))); 
    180  
    181                 /**************************************\ 
    182                  * Termina de formar o menu e imprime * 
    183                 \**************************************/ 
    184                 $p->parse('home_t', 'mobile_navbar', true); 
    185                 $p->pfp('out', 'home_t'); 
    186  
    187         } 
    188  
    189         /* 
    190          * @function print_footer 
    191          * @abstract Imprime o fim da tela do Expresso Mini, ou seja, fecha as tags <body> e <html> 
    192          * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
    193          */ 
    194         function print_footer(){ 
    195  
    196                 $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
    197                 $p->set_file( 
    198                                 Array( 
    199                                         'home_t' => 'home.tpl' 
    200                                 ) 
    201                 ); 
    202  
    203                 $p->set_block('home_t', 'mobile_footer'); 
    204                 $p->pfp('out', 'mobile_footer'); 
    205  
     27                //TODO: Determinar qual a aplicação móvel preferida e iniciá-la.                         
     28                switch($GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app']){ 
     29                        case mobilemail: 
     30                                $link = "ui_mobilemail.mail_list";               
     31                                break; 
     32                        case mobilecalendar: 
     33                                $link = "ui_mobilecalendar.index"; 
     34                                break; 
     35                        case mobilecc: 
     36                                $link = "ui_mobilecc.contacts_list"; 
     37                                break;           
     38                        default: 
     39                                break;           
     40                }                
     41                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link("index.php?menuaction=mobile.".$link)); 
    20642        } 
    20743?> 
Note: See TracChangeset for help on using the changeset viewer.