- Timestamp:
- 04/20/11 12:14:17 (13 years ago)
- Location:
- trunk/mobile
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mobile/inc/class.ui_home.inc.php
r4002 r4094 1 1 <?php 2 class ui_home { 3 var $imap_functions; 4 var $db; 5 var $bocalendar; 6 var $bo_mobilemail; 7 var $common; 8 var $template; 2 class ui_home 3 { 4 var $imap_functions; 5 var $db; 6 var $bocalendar; 7 var $bo_mobilemail; 8 var $common; 9 var $template; 9 10 10 var $public_functions = array( 11 'index' => true, 12 'search' => true, 13 'change_template' => true 14 ); 15 16 function ui_home() { 17 $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 18 $this->common = CreateObject('mobile.common_functions'); 19 $this->imap_functions = CreateObject('expressoMail1_2.imap_functions'); 20 $this->db = CreateObject('phpgwapi.db'); 21 $this->bocalendar = CreateObject('calendar.bocalendar'); 22 $this->bo_mobilemail = CreateObject('mobile.bo_mobilemail'); 11 var $public_functions = array( 12 'dicas' => true, 13 'index' => true, 14 'search' => true, 15 'change_template' => true 16 ); 17 18 function ui_home() 19 { 20 $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']); 21 $this->common = CreateObject('mobile.common_functions'); 22 $this->imap_functions = CreateObject('expressoMail1_2.imap_functions'); 23 $this->db = CreateObject('phpgwapi.db'); 24 $this->bocalendar = CreateObject('calendar.bocalendar'); 25 $this->bo_mobilemail = CreateObject('mobile.bo_mobilemail'); 26 } 27 28 function change_template($params) 29 { 30 $GLOBALS['phpgw']->session->appsession('mobile.layout','mobile',$params['template']); 31 header("location: index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0"); 32 } 33 34 function dicas() 35 { 36 $this->template->set_file(array('dicas' => 'dicas.tpl')); 37 $this->template->set_block('dicas','page'); 38 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 39 } 40 41 function index($params) 42 { 43 $this->template->set_file(array('home_index' => 'home_index.tpl')); 44 $this->template->set_file(array('home_search_bar' => 'search_bar.tpl')); 45 46 $this->template->set_block('home_index','page'); 47 $this->template->set_block('home_index','folder_block'); 48 $this->template->set_block('home_index','commitment_block'); 49 $this->template->set_block('home_search_bar','search_bar'); 50 51 //langs 52 $this->template->set_var('lang_context_email', lang("context email")); 53 $this->template->set_var('lang_context_contact', lang("context contact")); 54 $this->template->set_var('lang_context_commitment', lang("context commitment")); 55 $this->template->set_var('lang_search', lang("search")); 56 $this->template->set_var('lang_my_mail', lang("my mail")); 57 $this->template->set_var('lang_my_folders', lang("my folders")); 58 $this->template->set_var('lang_my_commitments', lang("my commitments")); 59 $this->template->set_var('lang_my_contacts', lang("my contacts")); 60 $this->template->set_var('lang_new_mail', lang("new mail")); 61 $this->template->set_var('lang_mark_as_read', lang("mark as read")); 62 $this->template->set_var('lang_selected', lang("selected")); 63 64 $accountId = $GLOBALS['phpgw_info']['user']['account_id']; 65 66 //pegando as pastas 67 $default_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'default', 'noQuotaInfo' => true)); 68 $total_quota = $this->imap_functions->get_quota(array()); 69 70 $this->set_folder_block($default_folders, "default_folders_box"); 71 72 $personal_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'personal', 'noQuotaInfo' => true)); 73 $this->set_folder_block($personal_folders, "personal_folders_box", sizeof($default_folders)); 74 75 $this->template->set_var('quota_percent', $total_quota["quota_percent"]); 76 $this->template->set_var('quota_used', $this->common->borkb($total_quota["quota_used"]*1024)); 77 $this->template->set_var('quota_limit', $this->common->borkb($total_quota["quota_limit"]*1024)); 78 79 //pegando os eventos do dia atual 80 $year = $this->bocalendar->year; 81 $month = $this->bocalendar->month; 82 $day = $this->bocalendar->day; 83 84 $tstart = mktime(0,0,0,$month,$day,$year); 85 86 $tstop = $tstart + 86400; //(24horas*60min*60seg*1dia) 87 $this->bocalendar->so->owner = $accountId; 88 $this->bocalendar->so->open_box($accountId); 89 $this->bocalendar->store_to_cache( array( 90 'owner' => $accountId, 91 'syear' => date('Y',$tstart), 92 'smonth' => date('m',$tstart), 93 'sday' => date('d',$tstart), 94 'eyear' => date('Y',$tstop), 95 'emonth' => date('m',$tstop), 96 'eday' => date('d',$tstop) 97 ) ); 98 99 $events = $this->bocalendar->cached_events; 100 101 foreach($events[$year.$this->common->complete_string($month,2,"R","0").$this->common->complete_string($day,2,"R","0")] as $index=>$event) 102 { 103 $this->template->set_var('commitment_class', (($index%2==0) ? "fundo-azul-alinha" : "fundo-branco-alinha") ); 104 $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") ); 105 $this->template->set_var('commitment_title', $event["title"] ); 106 107 $this->template->parse('commitments_box', 'commitment_block' ,true); 23 108 } 24 109 25 function change_template($params) { 26 $GLOBALS['phpgw']->session->appsession('mobile.layout','mobile',$params['template']); 27 header("location: index.php?menuaction=mobile.ui_mobilemail.change_folder&folder=0"); 110 111 112 if($GLOBALS['phpgw']->session->appsession('mobile.layout','mobile')=="mini_desktop") { 113 $GLOBALS['phpgw_info']['mobiletemplate']->set_home($this->template->fp('out', 'page')); 114 } else { 115 $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]); 116 $GLOBALS['phpgw_info']['mobiletemplate']->set_success_msg($params["success_message"]); 117 $this->template->set_var('search',$this->template->fp('out','search_bar')); 118 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 28 119 } 29 30 function index($params) { 31 $this->template->set_file(array('home_index' => 'home_index.tpl')); 32 $this->template->set_file(array('home_search_bar' => 'search_bar.tpl')); 33 34 $this->template->set_block('home_index','page'); 35 $this->template->set_block('home_index','folder_block'); 36 $this->template->set_block('home_index','commitment_block'); 37 $this->template->set_block('home_search_bar','search_bar'); 38 39 //langs 40 $this->template->set_var('lang_context_email', lang("context email")); 41 $this->template->set_var('lang_context_contact', lang("context contact")); 42 $this->template->set_var('lang_context_commitment', lang("context commitment")); 43 $this->template->set_var('lang_search', lang("search")); 44 $this->template->set_var('lang_my_mail', lang("my mail")); 45 $this->template->set_var('lang_my_folders', lang("my folders")); 46 $this->template->set_var('lang_my_commitments', lang("my commitments")); 47 $this->template->set_var('lang_my_contacts', lang("my contacts")); 48 $this->template->set_var('lang_new_mail', lang("new mail")); 49 $this->template->set_var('lang_mark_as_read', lang("mark as read")); 50 $this->template->set_var('lang_selected', lang("selected")); 51 52 $accountId = $GLOBALS['phpgw_info']['user']['account_id']; 53 54 //pegando as pastas 55 $default_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'default', 'noQuotaInfo' => true)); 56 $total_quota = $this->imap_functions->get_quota(array()); 57 58 $this->set_folder_block($default_folders, "default_folders_box"); 59 60 $personal_folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true, 'folderType' => 'personal', 'noQuotaInfo' => true)); 61 $this->set_folder_block($personal_folders, "personal_folders_box", sizeof($default_folders)); 62 63 $this->template->set_var('quota_percent', $total_quota["quota_percent"]); 64 $this->template->set_var('quota_used', $this->common->borkb($total_quota["quota_used"]*1024)); 65 $this->template->set_var('quota_limit', $this->common->borkb($total_quota["quota_limit"]*1024)); 66 67 //pegando os eventos do dia atual 68 $year = $this->bocalendar->year; 69 $month = $this->bocalendar->month; 70 $day = $this->bocalendar->day; 71 72 $tstart = mktime(0,0,0,$month,$day,$year); 73 74 $tstop = $tstart + 86400; //(24horas*60min*60seg*1dia) 75 $this->bocalendar->so->owner = $accountId; 76 $this->bocalendar->so->open_box($accountId); 77 $this->bocalendar->store_to_cache( array( 78 'owner' => $accountId, 79 'syear' => date('Y',$tstart), 80 'smonth' => date('m',$tstart), 81 'sday' => date('d',$tstart), 82 'eyear' => date('Y',$tstop), 83 'emonth' => date('m',$tstop), 84 'eday' => date('d',$tstop) 85 ) ); 86 87 $events = $this->bocalendar->cached_events; 88 89 foreach($events[$year.$this->common->complete_string($month,2,"R","0").$this->common->complete_string($day,2,"R","0")] as $index=>$event) 90 { 91 $this->template->set_var('commitment_class', (($index%2==0) ? "fundo-azul-alinha" : "fundo-branco-alinha") ); 92 $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") ); 93 $this->template->set_var('commitment_title', $event["title"] ); 94 95 $this->template->parse('commitments_box', 'commitment_block' ,true); 96 } 97 98 99 100 if($GLOBALS['phpgw']->session->appsession('mobile.layout','mobile')=="mini_desktop") { 101 $GLOBALS['phpgw_info']['mobiletemplate']->set_home($this->template->fp('out', 'page')); 102 } else { 103 $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]); 104 $GLOBALS['phpgw_info']['mobiletemplate']->set_success_msg($params["success_message"]); 105 $this->template->set_var('search',$this->template->fp('out','search_bar')); 106 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 107 } 120 } 121 122 /** 123 * 124 * 125 * $index_increment utilizado para quando passar o array das pastas pessoais somar com a quantidade de pastas default. 126 */ 127 function set_folder_block($folders, $box_target, $index_increment = 0) { 128 foreach($folders as $index=>$folder) 129 { 130 $this->template->set_var('folder_class', (($index%2==0) ? "par" : "par1") ); 131 $this->template->set_var('folder_id', $index + $index_increment ); 132 133 $translated_folder_name = $this->bo_mobilemail->get_translate_default_folder_name_from_id($folder["folder_id"]); 134 135 $this->template->set_var('folder_name', (($translated_folder_name == "") ? $folder["folder_name"] : $translated_folder_name) ); 136 $this->template->set_var('folder_unseen', $folder["folder_unseen"] ); 137 138 $this->imap_functions->open_mbox($folder["folder_id"],true); 139 $this->template->set_var('folder_total_msg', $this->imap_functions->get_num_msgs(array('folder' => $folder["folder_id"] ) ) ); 140 141 $this->template->parse($box_target, 'folder_block' ,true); 108 142 } 109 110 /** 111 * 112 * 113 * $index_increment utilizado para quando passar o array das pastas pessoais somar com a quantidade de pastas default. 114 */ 115 function set_folder_block($folders, $box_target, $index_increment = 0) { 116 foreach($folders as $index=>$folder) 117 { 118 $this->template->set_var('folder_class', (($index%2==0) ? "par" : "par1") ); 119 $this->template->set_var('folder_id', $index + $index_increment ); 120 121 $translated_folder_name = $this->bo_mobilemail->get_translate_default_folder_name_from_id($folder["folder_id"]); 122 123 $this->template->set_var('folder_name', (($translated_folder_name == "") ? $folder["folder_name"] : $translated_folder_name) ); 124 $this->template->set_var('folder_unseen', $folder["folder_unseen"] ); 125 126 $this->imap_functions->open_mbox($folder["folder_id"],true); 127 $this->template->set_var('folder_total_msg', $this->imap_functions->get_num_msgs(array('folder' => $folder["folder_id"] ) ) ); 128 129 $this->template->parse($box_target, 'folder_block' ,true); 130 } 131 } 143 } 132 144 133 145 function search($params) { -
trunk/mobile/mobile_header.inc.php
r3990 r4094 33 33 function start_prefered_app(){ 34 34 //TODO: Determinar qual a aplicaᅵᅵo mᅵvel preferida e iniciᅵ-la. 35 switch($GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app']){ 35 36 switch($GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app']) 37 { 36 38 case home: 37 39 $link = "ui_home.index"; -
trunk/mobile/templates/default/template.tpl
r3996 r4094 10 10 </head> 11 11 <body> 12 <div class="topo"> 13 <h1><a href="index.php?menuaction=mobile.ui_home.index" class="title">{global_title}</a></h1> 12 <div class="topo" style="height:20pt;"> 13 <div style="position:absolute; float:left; width:50%;"> 14 <div style="position:relative; float:left;"> 15 <h1 onclick="window.location='index.php?menuaction=mobile.ui_home.index'">{global_title}</h1> 16 </div> 17 </div> 18 19 <div style="position:relative; float:right; width:50%;"> 20 <div style="position:absolute; float: left;"> 21 <h1 onclick="window.location='index.php?menuaction=mobile.ui_home.dicas'">Dicas</h1> 22 </div> 23 24 <div style="position:relative; float: right;"> 25 <h1 onclick="window.location='{href_logout}'">{lang_logout}</h1> 26 </div> 27 </div> 28 29 <!-- 30 <h1 style="text-align:left !important;"><a href="index.php?menuaction=mobile.ui_home.index" class="title">{global_title}</a></h1> 31 <h1 style="text-align:center !important;"><a href="index.php?menuaction=mobile.ui_home.dicas" class="title"> - Dicas </a></h1> 14 32 <span><a href="{href_logout}">{lang_logout}</a></span> 33 --> 34 15 35 </div> 16 36
Note: See TracChangeset
for help on using the changeset viewer.