Ignore:
Timestamp:
12/06/10 16:09:43 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1404 - Criada a tela inicial do Expresso Mini.

Location:
branches/2.2/mobile/inc
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/mobile/inc/class.common_functions.inc.php

    r3559 r3564  
    2525         
    2626                        if ($size < 1024) 
    27                                 $rstring = $left . $size . 'B' . $right; 
     27                                $rstring = $left . $size . ' B' . $right; 
    2828                        else if ($size < 1048576) 
    29                                 $rstring = $left . round($size/1024) . 'KB' . $right; 
     29                                $rstring = $left . round($size/1024) . ' KB' . $right; 
    3030                        else if ($size < 1073741824) 
    31                                 $rstring = $left . round($size/1024/1024) . 'MB' . $right; 
     31                                $rstring = $left . round($size/1024/1024) . ' MB' . $right; 
    3232                        else 
    33                                 $rstring = $left . round($size/1024/1024/1024) . 'GB' . $right; 
     33                                $rstring = $left . round($size/1024/1024/1024) . ' GB' . $right; 
    3434         
    3535                        return $rstring; 
    3636                } 
    37         } //end common class     
     37                 
     38                function complete_string($str = "", $length = 10, $align = "R", $char = " ") { 
     39                        if( $str == null ) 
     40                                $str = ""; 
     41                        else  
     42                                if( strlen($str) > $length ) { 
     43                                        return substr($str, 0, $length); 
     44                                } else if( strlen($str) == $length ) { 
     45                                        return $str; 
     46                                }                        
     47         
     48                        $char = substr($char, 0, 1); 
     49                        $complete_str = ""; 
     50         
     51                while( strlen($str) + strlen($complete_str) < $length  ) 
     52                    $complete_str .= $char; 
     53         
     54                if( $align == "L" ) 
     55                        return $str . $complete_str; 
     56                else 
     57                        return $complete_str . $str; 
     58                }                
     59                 
     60        } //end common class 
     61         
    3862 
    3963?> 
  • branches/2.2/mobile/inc/class.mobiletemplate.inc.php

    r3554 r3564  
    4747                */ 
    4848                private function print_navbar(){ 
    49                          
     49                        $ui_mobilemail = CreateObject('mobile.ui_mobilemail'); 
    5050                        $obj = createobject("expressoMail1_2.functions"); 
    5151            // setting timezone preference 
     
    6262                        $this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0"); 
    6363                        $this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index"); 
    64                         $this-> template->set_var('href_home', "..."); 
     64                        $this-> template->set_var('href_home', "index.php?menuaction=mobile.ui_home.index"); 
    6565 
    6666                } 
  • branches/2.2/mobile/inc/class.ui_home.inc.php

    r3556 r3564  
    11<?php 
    22    class ui_home { 
     3                var $imap_functions;     
     4                var $db; 
     5                var $bocalendar; 
     6                var $common; 
     7                var $template; 
    38         
    4          
    5         var $public_functions = array( 
     9                var $public_functions = array( 
     10                        'index' => true, 
    611                        'search' => true 
    712                ); 
    813                 
    914                function ui_home() { 
    10  
     15                        $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 
     16                        $this->common   = CreateObject('mobile.common_functions'); 
     17                        $this->imap_functions   = CreateObject('expressoMail1_2.imap_functions'); 
     18                        $this->db       = CreateObject('phpgwapi.db'); 
     19                        $this->bocalendar = CreateObject('calendar.bocalendar'); 
    1120                } 
    1221                 
    13                 function search($params) { 
     22                function index($params) {                        
     23                        $this->template->set_file(Array('home_index' => 'home_index.tpl')); 
     24                        $this->template->set_block('home_index','page');         
     25                        $this->template->set_block('home_index','folder_block'); 
     26                        $this->template->set_block('home_index','commitment_block'); 
     27                         
     28                        //langs 
     29                        $this->template->set_var('lang_context_email', lang("context email")); 
     30                        $this->template->set_var('lang_context_contact', lang("context contact")); 
     31                        $this->template->set_var('lang_context_commitment', lang("context commitment")); 
     32                        $this->template->set_var('lang_search', lang("search")); 
     33                        $this->template->set_var('lang_my_mail', lang("my mail")); 
     34                        $this->template->set_var('lang_my_folders', lang("my folders")); 
     35                        $this->template->set_var('lang_my_commitments', lang("my commitments")); 
     36                        $this->template->set_var('lang_new_mail', lang("new mail")); 
     37                        $this->template->set_var('lang_mark_as_read', lang("mark as read")); 
     38                        $this->template->set_var('lang_selected', lang("selected")); 
     39                         
     40                        $accountId = $GLOBALS['phpgw_info']['user']['account_id']; 
     41                         
     42                        //pegando as pastas 
     43                        $default_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'default', 'noQuotaInfo' => true)); 
     44                        $total_quota = $this->imap_functions->get_quota(array());                
     45                                         
     46                        $this->set_folder_block($default_folders, "default_folders_box"); 
     47                         
     48                        if(isset($params["expand_folders"]) && $params["expand_folders"] == 1)  
     49                        { 
     50                                $personal_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'personal', 'noQuotaInfo' => true)); 
     51                                $this->set_folder_block($personal_folders, "personal_folders_box", sizeof($default_folders)); 
     52                                $this->template->set_var('expand_folders', 0);                   
     53                        } else { 
     54                                $this->template->set_var('expand_folders', 1); 
     55                        } 
     56                         
     57                        $this->template->set_var('quota_percent', $total_quota["quota_percent"]); 
     58                        $this->template->set_var('quota_used', $this->common->borkb($total_quota["quota_used"]*1024)); 
     59                        $this->template->set_var('quota_limit', $this->common->borkb($total_quota["quota_limit"]*1024)); 
     60                         
     61                        //pegando os eventos do dia atual 
     62                        $year = $this->bocalendar->year; 
     63                        $month = $this->bocalendar->month; 
     64                        $day = $this->bocalendar->day; 
     65                         
     66                        $tstart = mktime(0,0,0,$month,$day,$year); 
     67                        //$tstart = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, $day); 
     68                         
     69                        $tstop = $tstart + 86400; //(24horas*60min*60seg*1dia)                   
     70                        $this->bocalendar->so->owner = $accountId; 
     71                        $this->bocalendar->so->open_box($accountId); 
     72                        $this->bocalendar->store_to_cache( array( 
     73                                'owner' => $accountId, 
     74                                'syear'  => date('Y',$tstart), 
     75                                'smonth' => date('m',$tstart), 
     76                                'sday'   => date('d',$tstart), 
     77                                'eyear'  => date('Y',$tstop), 
     78                                'emonth' => date('m',$tstop), 
     79                                'eday'   => date('d',$tstop) 
     80                        ) ); 
     81                         
     82                        $events  = $this->bocalendar->cached_events; 
     83                         
     84                        foreach($events[$year.$this->common->complete_string($month,2,"R","0").$this->common->complete_string($day,2,"R","0")] as $index=>$event)  
     85                        { 
     86                                $this->template->set_var('dd_class', (($index%2==0) ? "par" : "") ); 
     87                                $this->template->set_var('commitment_time', $this->common->complete_string($event["start"]["hour"],2,"R","0") .":". $this->common->complete_string($event["start"]["min"],2,"R","0") ); 
     88                                $this->template->set_var('commitment_title', $event["title"] ); 
     89                                 
     90                                $this->template->parse('commitments_box', 'commitment_block' ,True); 
     91                        }                        
     92                         
     93                        $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 
     94                } 
     95                 
     96                /** 
     97                 *  
     98                 * 
     99                 * $index_increment utilizado para quando passar o array das pastas pessoais somar com a quantidade de pastas default. 
     100                 */ 
     101                function set_folder_block($folders, $box_target, $index_increment = 0) { 
     102                        foreach($folders as $index=>$folder)  
     103                        { 
     104                                $this->template->set_var('dd_class', (($index%2==0) ? "par" : "") ); 
     105                                $this->template->set_var('folder_id', $index + $index_increment ); 
     106                                $this->template->set_var('folder_name', $folder["folder_name"] ); 
     107                                $this->template->set_var('folder_unseen', $folder["folder_unseen"] ); 
     108                                 
     109                                $this->imap_functions->open_mbox($folder["folder_id"],true); 
     110                                $this->template->set_var('folder_total_msg', $this->imap_functions->get_num_msgs(array('folder' => $folder["folder_id"] ) ) ); 
     111                                 
     112                                $this->template->parse($box_target, 'folder_block' ,True); 
     113                        } 
     114                } 
     115                 
     116        function search($params) { 
    14117                        $params['name'] = 'teste'; 
    15118                        $params['default_folders'] = 1; 
     
    64167                 
    65168                        } 
    66                          
     169                } 
    67170 
     171                /* TODO Temporário esse método */ 
     172                function debug($var) { 
     173                        echo "<pre>"; 
     174                        print_r($var); 
     175                        echo "</pre>";                   
    68176                } 
    69     } 
     177                 
     178        } 
    70179?> 
Note: See TracChangeset for help on using the changeset viewer.