source: branches/2.2/mobile/inc/class.ui_home.inc.php @ 3556

Revision 3556, 1.6 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1406 - Envio da classe necessária para atividades no home

Line 
1<?php
2    class ui_home {
3       
4       
5        var $public_functions = array(
6                        'search' => true
7                );
8               
9                function ui_home() {
10
11                }
12               
13                function search($params) {
14                        $params['name'] = 'teste';
15                        $params['default_folders'] = 1;
16
17                        //Contacts                     
18                        $bo_cc =  CreateObject('mobile.bo_mobilecc');
19                       
20                        $catalogs = $bo_cc->get_all_catalogs();
21
22                        $contacts_result = array();
23                        foreach($catalogs as $catalog) {
24                                $bo_cc->set_catalog($catalog['catalog']);
25                                $partial_result = $bo_cc->search($params['name']);
26                                $contacts_result = array_merge($contacts_result,$partial_result);
27                        }
28//                      print_r($contacts_result);
29
30                        //E-mails
31                        $no_mail_search=false;
32                        $imap_functions = CreateObject('expressoMail1_2.imap_functions');
33                        $mail_params = array('filter' => $params["name"]);
34                        if(isset($params['default_folders'])) {
35                                if(!isset($params['personal_folders']))
36                                        $mail_params['folderType'] = 'default';                 
37                        }
38                        else {
39                                if(isset($params['personal_folders']))
40                                        $mail_params['folderType'] = 'personal';
41                                else
42                                        $no_mail_search = true;
43                        }
44                       
45                        if(!$no_mail_search)
46                                $messages = $imap_functions->mobile_search($mail_params);
47                       
48//                      print_r($messages);
49
50                        //calendar
51                        ini_set('display_errors','1');
52                        $bo_calendar = CreateObject('calendar.bocalendar',1);
53                        $event_ids = $bo_calendar->search_keywords($params['name']);
54                        foreach($event_ids as $key => $id)
55                        {
56                                $event = $bo_calendar->read_entry($id);
57
58                                if(!$bo_calendar->check_perms(PHPGW_ACL_READ,$event))
59                                {
60                                        continue;
61                                }
62
63                                //TODO Montar as linhas com os eventos
64               
65                        }
66                       
67
68                }
69    }
70?>
Note: See TracBrowser for help on using the repository browser.