Ignore:
Timestamp:
10/01/08 16:46:55 (16 years ago)
Author:
niltonneto
Message:

Implementação para trazer os contatos compartilhados.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r418 r503  
    7070                        if($this->page_info['actual_catalog']['class'] == 'bo_group_manager') 
    7171                                $this -> typeContact = 'groups'; 
     72                        else if($this->page_info['actual_catalog']['class'] == 'bo_shared_catalog_manager') 
     73                                $this -> typeContact = 'shared'; 
    7274                        else 
    7375                                $this -> typeContact = 'contacts'; 
     
    147149                         
    148150                        /* Messages */ 
     151                        $GLOBALS['phpgw']->template->set_var('cc_msg_not_allowed',lang('Not Allowed')); 
    149152                        $GLOBALS['phpgw']->template->set_var('cc_msg_no_cards',lang('No Cards')); 
    150153                        $GLOBALS['phpgw']->template->set_var('cc_msg_err_no_room',lang('No Room for Cards! Increase your browser area.')); 
     
    299302                                /* Full Add Methods */ 
    300303                                case 'get_full_data': 
    301                                         return $this->get_full_data($_GET['id']); 
     304                                        return $this->get_full_data($_GET['id'],$_GET['catalog']); 
    302305                                 
    303306                                case 'get_group': 
     
    577580                                unset($ids); 
    578581                                $this->page_info['changed'] = false; 
    579                                   
     582 
    580583                                switch ($this->page_info['actual_catalog']['class']) 
    581584                                { 
     585                                        case 'bo_shared_catalog_manager': 
     586                                                $field_name = 'id_contact'; 
     587 
     588                                                if ($letter !== 'number') 
     589                                                { 
     590                                                        $find_restric[0] = array( 
     591                                                                0 => array( 
     592                                                                        'field' => 'contact.names_ordered', 
     593                                                                        'type'  => 'iLIKE', 
     594                                                                        'value' => $letter !== 'all' ? $letter.'%' : '%' 
     595                                                                ) 
     596                                                        ); 
     597                                                } 
     598                                                else 
     599                                                { 
     600                                                        $find_restric[0] = array( 
     601                                                                0 => array( 
     602                                                                        'type'  => 'branch', 
     603                                                                        'value' => 'OR', 
     604                                                                        'sub_branch' => array( 
     605                                                                                0 => array( 
     606                                                                                        'field' => 'contact.names_ordered', 
     607                                                                                        'type'  => 'LIKE', 
     608                                                                                        'value' => '0%' 
     609                                                                                ), 
     610                                                                                1 => array( 
     611                                                                                        'field' => 'contact.names_ordered', 
     612                                                                                        'type'  => 'LIKE', 
     613                                                                                        'value' => '1%' 
     614                                                                                ), 
     615                                                                                2 => array( 
     616                                                                                        'field' => 'contact.names_ordered', 
     617                                                                                        'type'  => 'LIKE', 
     618                                                                                        'value' => '2%' 
     619                                                                                ), 
     620                                                                                3 => array( 
     621                                                                                        'field' => 'contact.names_ordered', 
     622                                                                                        'type'  => 'LIKE', 
     623                                                                                        'value' => '3%' 
     624                                                                                ), 
     625                                                                                4 => array( 
     626                                                                                        'field' => 'contact.names_ordered', 
     627                                                                                        'type'  => 'LIKE', 
     628                                                                                        'value' => '4%' 
     629                                                                                ), 
     630                                                                                5 => array( 
     631                                                                                        'field' => 'contact.names_ordered', 
     632                                                                                        'type'  => 'LIKE', 
     633                                                                                        'value' => '5%' 
     634                                                                                ), 
     635                                                                                6 => array( 
     636                                                                                        'field' => 'contact.names_ordered', 
     637                                                                                        'type'  => 'LIKE', 
     638                                                                                        'value' => '6%' 
     639                                                                                ), 
     640                                                                                7 => array( 
     641                                                                                        'field' => 'contact.names_ordered', 
     642                                                                                        'type'  => 'LIKE', 
     643                                                                                        'value' => '7%' 
     644                                                                                ), 
     645                                                                                8 => array( 
     646                                                                                        'field' => 'contact.names_ordered', 
     647                                                                                        'type'  => 'LIKE', 
     648                                                                                        'value' => '8%' 
     649                                                                                ), 
     650                                                                                9 => array( 
     651                                                                                        'field' => 'contact.names_ordered', 
     652                                                                                        'type'  => 'LIKE', 
     653                                                                                        'value' => '9%' 
     654                                                                                ) 
     655                                                                        ) 
     656                                                                ) 
     657                                                        ); 
     658                                                } 
     659                                                 
     660                                                $find_field[0] = array('contact.id_contact','contact.names_ordered'); 
     661                                                 
     662                                                $find_other[0] = array( 
     663                                                        'order'  => 'contact.names_ordered' 
     664                                                ); 
     665                                                 
     666                                                break; 
    582667                                        case 'bo_people_catalog': 
    583668                                                $field_name = 'id_contact'; 
     
    9831068                                        foreach ($result as $id => $value) 
    9841069                                        { 
    985                                                 $this->page_info['actual_entries'][] = $value[$field_name]; 
     1070                                                if($this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     1071                                                        $this->page_info['actual_entries'][] = $value[$field_name]; 
     1072                                                else 
     1073                                                        $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms']); 
    9861074                                        }  
    9871075                                        //print_r($this->page_info['actual_entries']); 
     
    10611149                                ///---------------- Correção Temporária PHP5 -----------------------/// 
    10621150                                $ids = array(); 
     1151                                $perms = array(); 
    10631152                                $array_temp = array();                   
    10641153                                                                 
    10651154                                foreach($this->page_info['actual_entries'] as $key=>$tmp){ 
    1066                                         $array_temp[] = $tmp;                            
     1155                                                $array_temp[] = $tmp;                            
    10671156                                }        
    10681157                                 
    10691158                                for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 
    10701159                                { 
    1071                                         $ids[] = $array_temp[$i]; 
     1160                                        if($this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     1161                                                $ids[] = $array_temp[$i]; 
     1162                                        else { 
     1163                                                $ids[] = $array_temp[$i][0]; 
     1164                                                $perms[] = $array_temp[$i][1]; 
     1165                                        } 
     1166                                        //$perms[] = $array_temp[$i]; 
    10721167                                } 
    10731168                                 
     
    11211216                                        return;                                  
    11221217                                } 
     1218                                $final[10] = $this -> typeContact; 
    11231219                                 
    11241220                                $fields['photo'] = true; 
     
    12021298 
    12031299                                        //      If contact is a public list, then load the forwarding addresses. 
    1204                                                 if($contact['account_type'][0] == 'l' || $contact['account_type'][0] == 'i') 
     1300                                                if($contact['account_type'][0] == 'l') 
    12051301                                                        $final[3][$i][7] = array(); 
     1302                                                         
     1303                                                if($this->page_info['actual_catalog']['class']=='bo_shared_catalog_manager') { 
     1304                                                        $final[3][$i][8] = $perms[$i]; 
     1305                                                } 
    12061306 
    12071307                                                $final[4][$i] = $contact['photo'] ? 1  : 0; 
     
    12871387                 
    12881388                */ 
    1289                 function get_full_data($id) 
     1389                function get_full_data($id,$catalog='bo_people_catalog') 
    12901390                { 
    12911391                        $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 
    1292                         $this->bo->catalog = CreateObject('contactcenter.bo_people_catalog');            
     1392                        $this->bo->catalog = CreateObject('contactcenter.'.$catalog);            
    12931393                        $fields = $this->bo->catalog->get_fields(true); 
    12941394                        $fields['photo'] = false; 
     
    22142314                        // Support search parameters with accentuation 
    22152315                        if ($this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 
    2216                                 $this->page_info['actual_catalog']['class'] != 'bo_group_manager') 
     2316                                $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 
     2317                                $this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
    22172318                        { 
    22182319 
     
    22472348 
    22482349                                if (!$external && $this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 
    2249                                         $this->page_info['actual_catalog']['class'] != 'bo_group_manager') 
     2350                                        $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 
     2351                                        $this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
    22502352                                { 
    22512353                                        /* 
     
    22922394 
    22932395                        if ($external || $this->page_info['actual_catalog']['class'] == 'bo_people_catalog' || 
    2294                                 $this->page_info['actual_catalog']['class'] == 'bo_group_manager') 
     2396                                $this->page_info['actual_catalog']['class'] == 'bo_group_manager' || 
     2397                                $this->page_info['actual_catalog']['class'] == 'bo_shared_catalog_manager') 
    22952398                        { 
    22962399                                // Get only this attributes: dn, cn for external catalogs, 
     
    23242427            foreach ($ids as $e_info) 
    23252428            { 
    2326                 $ids_f[] = $e_info[$id_field]; 
     2429                                if($this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     2430                        $ids_f[] = $e_info[$id_field]; 
     2431                else 
     2432                        $ids_f[] = array(0=>$e_info[$id_field],1=>$e_info['perms']); 
    23272433            } 
    23282434 
Note: See TracChangeset for help on using the changeset viewer.