phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [19107] Use autoloaded contacts from phpgw instead of


From: Caeies
Subject: [Phpgroupware-cvs] [19107] Use autoloaded contacts from phpgw instead of creating one for our own private use
Date: Wed, 11 Mar 2009 16:10:31 +0000

Revision: 19107
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19107
Author:   Caeies
Date:     2009-03-11 16:10:18 +0000 (Wed, 11 Mar 2009)
Log Message:
-----------
Use autoloaded contacts from phpgw instead of creating one for our own private 
use

Modified Paths:
--------------
    core/trunk/calendar/inc/class.bocalendar.inc.php
    core/trunk/calendar/inc/class.uicalendar.inc.php

Modified: core/trunk/calendar/inc/class.bocalendar.inc.php
===================================================================
--- core/trunk/calendar/inc/class.bocalendar.inc.php    2009-03-11 16:06:55 UTC 
(rev 19106)
+++ core/trunk/calendar/inc/class.bocalendar.inc.php    2009-03-11 16:10:18 UTC 
(rev 19107)
@@ -113,7 +113,6 @@
 //             var $debug = True;
 
                var $so;
-               var $contacts;
 
                var $cached_events;
                var $repeating_events;
@@ -158,7 +157,6 @@
                public function __construct($session = false)
                {
                        $this->cat = CreateObject('phpgwapi.categories');
-                       $this->contacts = createObject('phpgwapi.contacts');
                        $this->grants = 
$GLOBALS['phpgw']->acl->get_grants('calendar','.');
 
                        if(DEBUG_APP)
@@ -192,7 +190,7 @@
                        $owner = phpgw::get_var('owner', 'int');
                        if ( !$owner )
                        {       
-                               $owner = 
$this->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']);
+                               $owner = 
$GLOBALS['phpgw']->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']);
                        }
 //_debug_array($owner);
                        $referer = isset($_SERVER['HTTP_REFERER']) ? 
$_SERVER['HTTP_REFERER'] : '';
@@ -238,7 +236,7 @@
                        }
                        elseif(!isset($this->owner) || !$this->owner)
                        {
-                               $this->owner = 
$this->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']);
+                               $this->owner = 
$GLOBALS['phpgw']->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']);
                        }
 
                        $this->prefs['common'] = 
$GLOBALS['phpgw_info']['user']['preferences']['common'];
@@ -481,7 +479,7 @@
                        {
                                foreach ( $group_owners as $group_info )
                                {
-                                       if($account_id = 
$this->contacts->is_contact($group_info['account_id']))
+                                       if($account_id = 
$GLOBALS['phpgw']->contacts->is_contact($group_info['account_id']))
                                        {
                                                $this->g_owner[] = $account_id;
                                        }
@@ -497,7 +495,7 @@
                        $group_owners = 
$GLOBALS['phpgw']->accounts->membership();
                        while($group_owners && list($index,$group_info) = 
each($group_owners))
                        {
-                               if($this->owner == 
$this->contacts->is_contact($group_info['account_id']) )
+                               if($this->owner == 
$GLOBALS['phpgw']->contacts->is_contact($group_info['account_id']) )
                                {
                                        return True;
                                }
@@ -669,7 +667,7 @@
                {
                        if($GLOBALS['phpgw_info']['user']['apps']['admin'])
                        {
-                               
$this->so->delete_calendar($this->contacts->is_contact($owner));
+                               
$this->so->delete_calendar($GLOBALS['phpgw']->contacts->is_contact($owner));
                        }
                }
 
@@ -679,8 +677,8 @@
                        {
                                if(is_array($params))
                                {
-                                       
$this->so->change_owner($this->contacts->is_contact($params['old_owner']),
-                                                               
$this->contacts->is_contact($params['new_owner']));
+                                       
$this->so->change_owner($GLOBALS['phpgw']->contacts->is_contact($params['old_owner']),
+                                                               
$GLOBALS['phpgw']->contacts->is_contact($params['new_owner']));
                                }
                        }
                }
@@ -907,7 +905,7 @@
                                                        {
                                                                foreach ( 
$members as $member )
                                                                {
-                                                                       
$participant = intval($this->contacts->is_contact($member['account_id']) );
+                                                                       
$participant = 
intval($GLOBALS['phpgw']->contacts->is_contact($member['account_id']) );
                                                                        if ( 
$participant )
                                                                        {
                                                                                
$this->so->add_attribute('participants', $accept_type, $participant);
@@ -1602,7 +1600,7 @@
                        {
                                if ( $rights & PHPGW_ACL_READ )
                                {
-                                       $person_id = 
$this->contacts->is_contact($acct_id);
+                                       $person_id = 
$GLOBALS['phpgw']->contacts->is_contact($acct_id);
                                        if ( $person_id ) 
                                        {
                                                $can_read[] = $person_id;
@@ -2970,8 +2968,8 @@
                        else
                        {
                                $arr = &$users;
-                               $value = $this->contacts->is_contact($id);
-                               $name = 
$this->contacts->get_name_of_person_id($value);
+                               $value = 
$GLOBALS['phpgw']->contacts->is_contact($id);
+                               $name = 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($value);
                        }
                        $arr[$name] = array(
                                'grantor'       => $id,
@@ -2991,11 +2989,6 @@
                {
                        $user_timezone = phpgwapi_datetime::user_timezone();
 
-                       if ( !is_object($GLOBALS['phpgw']->contacts) )
-                       {
-                               $GLOBALS['phpgw']->contacts = 
createObject('phpgwapi.contacts');
-                       }
-                       
                        $var['title'] = array(
                                'field'         => lang('Title'),
                                'data'          => $event['title']
@@ -3276,7 +3269,7 @@
                        $criteria_search[] = 
phpgwapi_sql_criteria::token_begin('org_name', $lookup);
 
                        $criteria[] = 
phpgwapi_sql_criteria::_append_or($criteria_search);
-                       $criteria[] = 
$this->contacts->criteria_for_index($GLOBALS['phpgw_info']['user']['account_id']);
+                       $criteria[] = 
$GLOBALS['phpgw']->contacts->criteria_for_index($GLOBALS['phpgw_info']['user']['account_id']);
 
                        if ( $cat_id )
                        {
@@ -3284,7 +3277,7 @@
                        }
 
                        $criteria_token = 
phpgwapi_sql_criteria::_append_and($criteria);
-                       return $this->contacts->get_orgs($fields, 0, 0, 
'org_name', 'ASC', '', $criteria_token);
+                       return $GLOBALS['phpgw']->contacts->get_orgs($fields, 
0, 0, 'org_name', 'ASC', '', $criteria_token);
                }
 
                /**
@@ -3304,7 +3297,7 @@
                        $criteria_search[] = 
phpgwapi_sql_criteria::token_begin('per_last_name', $lookup);
 
                        $criteria[] = 
phpgwapi_sql_criteria::_append_or($criteria_search);
-                       $criteria[] = $this->contacts->criteria_for_index((int) 
$GLOBALS['phpgw_info']['user']['account_id']);
+                       $criteria[] = 
$GLOBALS['phpgw']->contacts->criteria_for_index((int) 
$GLOBALS['phpgw_info']['user']['account_id']);
 
                        if ( $cat_id )
                        {
@@ -3312,7 +3305,7 @@
                        }
 
                        $criteria_token = 
phpgwapi_sql_criteria::_append_and($criteria);
-                       return $this->contacts->get_persons($fields, 0, 0, 
'per_first_name, per_last_name', 'ASC', '', $criteria_token);
+                       return 
$GLOBALS['phpgw']->contacts->get_persons($fields, 0, 0, 'per_first_name, 
per_last_name', 'ASC', '', $criteria_token);
                }
 
                /**

Modified: core/trunk/calendar/inc/class.uicalendar.inc.php
===================================================================
--- core/trunk/calendar/inc/class.uicalendar.inc.php    2009-03-11 16:06:55 UTC 
(rev 19106)
+++ core/trunk/calendar/inc/class.uicalendar.inc.php    2009-03-11 16:10:18 UTC 
(rev 19107)
@@ -381,7 +381,7 @@
                                'month_identifier'              => 
lang(strftime("%B",$m)).' '.$this->bo->year,
                                'username'                              => ( 
$this->bo->is_group
                                                                                
        ? $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)
-                                                                               
        : $this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
+                                                                               
        : $GLOBALS['phpgw']->contacts->get_name_of_person_id($this->bo->owner) 
),
                                'small_calendar_next'   => $minical_next,
                                'large_month'                   => 
$this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner),
                        );
@@ -458,7 +458,7 @@
                                'next_week_link'                => 
$next_week_link,
                                'username'                              => ( 
$this->bo->is_group
                                                                                
        ? $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)
-                                                                               
        : $this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
+                                                                               
        : $GLOBALS['phpgw']->contacts->get_name_of_person_id($this->bo->owner) 
),
                                'small_calendar_next'   => $minical_next,
                                'week_display'                  => 
$this->display_weekly(
                                        array(
@@ -1133,7 +1133,7 @@
                                                                )),
                                'small_calendar'        => $minical,
                                'date'                  => 
$this->bo->long_date($now),
-                               'username'              => ( 
$this->bo->is_group ? 
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner) : 
$this->bo->contacts->get_name_of_person_id($this->bo->owner) ),
+                               'username'              => ( 
$this->bo->is_group ? 
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner) : 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($this->bo->owner) ),
                        );
 
                        if ( $this->bo->debug )
@@ -1255,14 +1255,14 @@
                                {
                                        if 
($this->bo->check_perms(PHPGW_ACL_READ,0,$id))
                                        {
-                                               
$this->planner_group_members[$this->bo->contacts->get_name_of_person_id($id)] = 
$id;
+                                               
$this->planner_group_members[$GLOBALS['phpgw']->contacts->get_name_of_person_id($id)]
 = $id;
                                        }
                                }
                                ksort($this->planner_group_members);
                        }
                        else
                        {
-                               
$this->planner_group_members[$this->bo->contacts->get_name_of_person_id($this->bo->owner)]
 = $this->bo->owner;
+                               
$this->planner_group_members[$GLOBALS['phpgw']->contacts->get_name_of_person_id($this->bo->owner)]
 = $this->bo->owner;
                        }
                }
 
@@ -1357,11 +1357,11 @@
                                        && 
!$this->bo->check_perms(PHPGW_ACL_ADD) 
                                        || 
!$this->bo->check_perms(PHPGW_ACL_ADD,0,(isset($this->bo->save_owner)?$this->bo->save_owner:'')))
                                {
-                                       $add_owner = array('owner' => 
$this->bo->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']));
+                                       $add_owner = array('owner' => 
$GLOBALS['phpgw']->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']));
                                }
                                else
                                {
-                                       $add_owner = array('owner' => 
(isset($this->bo->save_owner)&& 
$this->bo->save_owner?$this->bo->save_owner:$this->bo->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id'])));
+                                       $add_owner = array('owner' => 
(isset($this->bo->save_owner)&& 
$this->bo->save_owner?$this->bo->save_owner:$GLOBALS['phpgw']->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id'])));
                                }
                                
                                for ($d=1; $d<=$days; $d++)
@@ -1884,10 +1884,10 @@
                                                {
                                                        foreach ( 
$group_members as $member )
                                                        {
-                                                               $person_id = 
intval($this->bo->contacts->is_contact($member));
+                                                               $person_id = 
intval($GLOBALS['phpgw']->contacts->is_contact($member));
                                                                if ( $person_id 
> 0  && !isset($users[$person_id]) )
                                                                {
-                                                                       
$users[$person_id] = $this->bo->contacts->get_name_of_person_id($person_id);
+                                                                       
$users[$person_id] = 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($person_id);
                                                                }
                                                        }
                                                }
@@ -1895,10 +1895,10 @@
                                }
                                else
                                {
-                                       $person_id = 
intval($this->bo->contacts->is_contact($user));
+                                       $person_id = 
intval($GLOBALS['phpgw']->contacts->is_contact($user));
                                        if ( $person_id > 0 && 
!isset($users[$person_id]) )
                                        {
-                                               $users[$person_id] = 
$this->bo->contacts->get_name_of_person_id($person_id);
+                                               $users[$person_id] = 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($person_id);
                                        }
                                }
                                echo '<br />';
@@ -1978,7 +1978,7 @@
                                                        {
                                                                
foreach($members as $member)
                                                                {
-                                                                       
$person_id = $this->bo->contacts->is_contact($member['account_id']);
+                                                                       
$person_id = $GLOBALS['phpgw']->contacts->is_contact($member['account_id']);
                                                                        if ( 
$this->bo->check_perms(PHPGW_ACL_READ, 0, $person_id) )
                                                                        {
                                                                                
$parts[$person_id] = True;
@@ -1988,7 +1988,7 @@
                                                        
                                                        break;
                                                default:
-                                                       
if($this->bo->check_perms(PHPGW_ACL_READ, 0, 
$this->bo->contacts->is_contact($participant) ) )
+                                                       
if($this->bo->check_perms(PHPGW_ACL_READ, 0, 
$GLOBALS['phpgw']->contacts->is_contact($participant) ) )
                                                        {
                                                                
$parts[$participant] = True;
                                                        }
@@ -2576,7 +2576,7 @@
                        {
                                foreach ($event['participants'] as $participant 
=> $accept)
                                {
-                                       $participants[] = 
$this->bo->contacts->get_name_of_person_id($participant);
+                                       $participants[] = 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($participant);
                                }
                                $str_participants = implode(', ',$participants);
                        }
@@ -2617,7 +2617,7 @@
                                                {
                                                        
if($GLOBALS['phpgw']->accounts->exists($user))
                                                        {
-                                                               $participants 
.= $this->bo->contacts->get_name_of_person_id($user).' 
('.$this->bo->get_long_status($short_status).')<br>';
+                                                               $participants 
.= $GLOBALS['phpgw']->contacts->get_name_of_person_id($user).' 
('.$this->bo->get_long_status($short_status).')<br>';
                                                        }
                                                }
                                        }
@@ -2814,14 +2814,14 @@
                                $overlapped_event = 
$this->bo->read_entry($overlapping_events[$i]);
                                if ( is_array($overlapped_event) )
                                {
-                                       $overlap .= '<li> 
['.$this->bo->contacts->get_name_of_person_id($overlapped_event['owner']).'] ' 
. $this->link_to_entry($overlapped_event,$month,$mday,$year) . "</li>\n";
+                                       $overlap .= '<li> 
['.$GLOBALS['phpgw']->contacts->get_name_of_person_id($overlapped_event['owner']).']
 ' . $this->link_to_entry($overlapped_event,$month,$mday,$year) . "</li>\n";
                                }
                                else //must be private
                                {
                                        // this is a hack to get around the 
limitations of the current code
                                        // FIXME remove the need for such a 
nasty hack by adding a better arg to bocal::read_entry
                                        $overlapped_event = 
$this->bo->so->read_entry($overlapping_events[$i]);
-                                       $overlap .= '<li> 
['.$this->bo->contacts->get_name_of_person_id($overlapped_event['owner']).'] '. 
lang('private') . "</li>\n";
+                                       $overlap .= '<li> 
['.$GLOBALS['phpgw']->contacts->get_name_of_person_id($overlapped_event['owner']).']
 '. lang('private') . "</li>\n";
                                }
                        }
 
@@ -2885,7 +2885,7 @@
                                
                                if ( ! isset($id2lid[$id]) )
                                {
-                                       $id2lid[$id] = 
$this->bo->contacts->get_name_of_person_id($id);
+                                       $id2lid[$id] = 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($id);
                                }
                                
                                if (strlen($names))
@@ -2998,7 +2998,7 @@
 
                        if($display_name)
                        {
-                               $p->set_var('column_data', 
$this->bo->contacts->get_name_of_person_id($owner));
+                               $p->set_var('column_data', 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($owner));
                                $p->parse('column_header','month_column',True);
                        }
 
@@ -3529,7 +3529,7 @@
                        $participants = $param['participants'];
                        foreach($participants as $part => $nul)
                        {
-                               $participants[$part] = 
$this->bo->contacts->get_name_of_person_id($part);
+                               $participants[$part] = 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($part);
                        }
                        uasort($participants,'strnatcasecmp');  // sort them 
after their fullname
 
@@ -3998,7 +3998,7 @@
                                if($id != intval($event['owner']))
                                {
                                        $str .= '<option value="' . $id . 
$status . '" selected="selected">'
-                                                       . 
$this->bo->contacts->get_name_of_person_id($id) . '</option>' . "\n"; 
+                                                       . 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($id) . '</option>' . "\n"; 
                                }
                        }
                        $var['participants'] = array
@@ -4019,7 +4019,7 @@
                                $checked = '';
                        }
                        $var['owner'] = array(
-                               'field' => lang('%1 participates', 
$this->bo->contacts->get_name_of_person_id($event['owner']) ),
+                               'field' => lang('%1 participates', 
$GLOBALS['phpgw']->contacts->get_name_of_person_id($event['owner']) ),
                                'data'  => '<input type="checkbox" 
name="participants[]" value="'.$event['owner'].'A"'.$checked.'>'
                        );
 // Reminder





reply via email to

[Prev in Thread] Current Thread [Next in Thread]