Changeset 4033


Ignore:
Timestamp:
04/14/11 17:18:48 (13 years ago)
Author:
niltonneto
Message:

Ticket #1691 - Corrigido problema de lentidão ao listar organizações.

Location:
branches/2.2/reports/inc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/reports/inc/class.functions.inc.php

    r3949 r4033  
    854854                } 
    855855 
     856                function get_count_user_sector($query, $contexts,$sizelimit) 
     857                { 
     858                        $dn                     = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 
     859                        $passwd         = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 
     860                        $ldap_conn      = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 
     861                        ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 
     862                        ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 
     863                        ldap_bind($ldap_conn,$dn,$passwd);                       
     864                        // counting users by sector. 
     865                        foreach ($contexts as $index=>$context) { 
     866                                if($context == $GLOBALS['phpgw_info']['server'] ["ldap_context"]) { 
     867                                        $contexts[$index] = null; 
     868                                        $justthese = array("dn"); 
     869                                        $filter="(objectClass=OrganizationalUnit)"; 
     870                                        $search = ldap_list($ldap_conn, $context, $filter, $justthese); 
     871                                        $entries = ldap_get_entries($ldap_conn, $search); 
     872                                        $contexts = array(); 
     873                                        for ($i=0; $i< $entries['count']; $i++){ 
     874                                                $contexts[] = $entries[$i]['dn']; 
     875                                        } 
     876                                } 
     877                        }        
     878                        $filter="(&(phpgwAccountType=u)(|(uid=*)))"; 
     879                        $justthese = array("uidnumber"); 
     880                        $total_count = 0; 
     881                         
     882                        foreach ($contexts as $index=>$context) {                                
     883                                $search = ldap_search($ldap_conn, $context, $filter, $justthese, 0, $sizelimit); 
     884                                $total_count += ldap_count_entries($ldap_conn, $search);                                                         
     885                        } 
     886                        ldap_close($ldap_conn); 
     887                        return $total_count; 
     888                } 
     889 
    856890                function get_list_user_sector_logon($query, $contexts,$sizelimit,$numacesso) 
    857891                { 
  • branches/2.2/reports/inc/class.uireports_cota.inc.php

    r3949 r4033  
    157157                        { 
    158158                                // Conta a quantidade de Usuario do grupo raiz 
    159                                 $account_user = $this->functions->get_list_user_sector($contextsdn,$contexts,0); 
    160                                 $totaluser = "(".count($account_user).")"; 
     159                                $account_user = $this->functions->get_count_user_sector($contextsdn,$contexts,0); 
     160                                $totaluser = "(".$account_user.")"; 
    161161 
    162162                                $p->set_var('organizacao', $varorganizacao_nome); 
  • branches/2.2/reports/inc/class.uireports_logon.inc.php

    r3903 r4033  
    350350                        { 
    351351                                // Conta a quantidade de Usuario do grupo raiz 
    352                                 $account_user = $this->functions->get_list_user_sector($contextsdn,$contexts,0); 
    353                                 $totaluser = "(".count($account_user).")"; 
     352                                $account_user = $this->functions->get_count_user_sector($contextsdn,$contexts,0); 
     353                                $totaluser = "(".$account_user.")"; 
    354354 
    355355                                $p->set_var('organizacao', $varorganizacao_nome); 
  • branches/2.2/reports/inc/class.uireports_users.inc.php

    r3666 r4033  
    275275                        { 
    276276                                // Conta a quantidade de Usuario do grupo raiz 
    277                                 $account_user = $this->functions->get_list_user_sector($contextsdn,$contexts,0); 
    278                                 $totaluser = "(".count($account_user).")"; 
     277                                $account_user = $this->functions->get_count_user_sector($contextsdn,$contexts,0); 
     278                                $totaluser = "(".$account_user.")"; 
    279279 
    280280                                $p->set_var('organizacao', $varorganizacao_nome); 
Note: See TracChangeset for help on using the changeset viewer.