source: trunk/instant_messenger/inc/class.contacts_im.inc.php @ 20

Revision 20, 1.7 KB checked in by niltonneto, 17 years ago (diff)

Inclusão do módulo Mensageiro Instantâneo no CVS.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2
3require_once "class.ldap_im.inc.php";
4require_once "class.db_im.inc.php";
5
6class contacts_im
7{
8        private $ldap_users;
9        private $db_user;
10       
11        function __construct()
12        {
13                $this->ldap_users = new ldap_im();
14                $this->db_user = new db_im();           
15        }
16               
17        function list_contacts($param)
18        {
19                $org_ldap = $param['ou'];
20                $array_db = $this->db_user->get_accounts_acl();
21                $array_groups_ldap = array();
22                $j = 0;
23
24                for($i=0 ; $i < count($array_db); $i++)
25                        $array_1[] = $this->ldap_users->list_users_ldap($org_ldap,"uidNumber", $array_db[$i]['acl_account']);
26       
27                for($i=0; $i < count($array_1); $i++){
28                        if(array_key_exists("count",$array_1[$i])){
29                                $array_groups_ldap[] = $array_1[$i]['uidnumber'];
30                        }               
31                }
32       
33                for($i=0; $i < count($array_groups_ldap); $i++)
34                        $array_2[]['members'] = $this->ldap_users->list_groups_ldap($org_ldap,$array_groups_ldap[$i]);
35       
36                foreach($array_2 as $tmp){
37                        if($tmp['members'] > 0){
38                                foreach($tmp['members'] as $tmp1)       
39                                        $array_3[] = $tmp1;
40                        }
41                }
42               
43                for($i=0; $i < count($array_1); $i++)
44                        if($array_1[$i]['uid'] != "")
45                                $array_3[] = $array_1[$i]['uid'];
46       
47                @natsort($array_3);
48                $array_4 = @array_values(@array_unique($array_3));
49               
50                for($i=0; $i < count($array_4); $i++)
51                        $array_5[] = $this->ldap_users->list_users_ldap($org_ldap,"uid", $array_4[$i]);
52
53                for($i=0 ; $i < count($array_5); $i++){
54                        if($array_5[$i]['phpgwAccountVisible'] != "-1"){
55                                $array_6[] = $array_5[$i]['cn'] . ";" . $array_5[$i]['mail'];
56                        }
57                }
58               
59                sort($array_6);
60
61                for($i=0; $i < count($array_6); $i++){
62                        $aux = explode(";", $array_6[$i]);
63                        $array_7[$j]['cn'] = $aux[0];
64                        $array_7[$j]['mail'] = $aux[1];                 
65                        $j++;
66                }
67               
68                if(count($array_7) > 0)
69                        return $array_7;
70                else
71                        return false;
72        }
73}
74?>
Note: See TracBrowser for help on using the repository browser.