phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: cdb/inc class.cdb_organization_location.inc.php,


From: Brian Morel <address@hidden>
Subject: [Phpgroupware-cvs] CVS: cdb/inc class.cdb_organization_location.inc.php,1.1,1.2
Date: Sun, 17 Feb 2002 23:52:41 -0500

Update of /cvsroot/phpgroupware/cdb/inc
In directory subversions:/tmp/cvs-serv3678

Modified Files:
        class.cdb_organization_location.inc.php 
Log Message:
first version

Index: class.cdb_organization_location.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/cdb/inc/class.cdb_organization_location.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.cdb_organization_location.inc.php     11 Nov 2001 15:43:42 -0000      
1.1
--- class.cdb_organization_location.inc.php     18 Feb 2002 04:52:38 -0000      
1.2
***************
*** 3,7 ****
    * phpGroupWare                                                             *
    * http://www.phpgroupware.org/                                             *
!   * This file written by Patrick Walsh <address@hidden>            *
    * ------------------------------------------------------------------------ *
    * Please see the documentation for these classes in the README file in     *
--- 3,7 ----
    * phpGroupWare                                                             *
    * http://www.phpgroupware.org/                                             *
!   * This file written by Brian Morel < brianmorel AT yahoo DOT com >         *
    * ------------------------------------------------------------------------ *
    * Please see the documentation for these classes in the README file in     *
***************
*** 21,46 ****
                {
                        $this->_ = array(
!                               'name'         => '',     //Name of the 
organization
!                               'locations'    => array(),//Array of location 
id/location name pairs
!                               'gov_id',                 //federal id number
!                               'categories'   => array(),//array of strings, 
one cat. per element
!                               'note'         => '',     //
!                               'home_page'    => '',     //org's web page
!                               'network_name' => ''      //this is for outlook 
compat.
!                       );
                }
  
!               function get_zzz()
                {
!                       return $this->_['zzz'];
                }
  
!               function let_zzz($new_zzz)
                {
!                       if ($new_zzz <> $this->_['zzz'])
                        {
!                               $this->dirty('zzz');
                        }
-                       $this->_['zzz'] = $new_zzz;
                }
        }
--- 21,203 ----
                {
                        $this->_ = array(
!                               'location_id'           => 0,
!                               'organization_id'       => 0, 
!                               'location'              => '',
!                               'address_street'        => '',
!                               'address_city'          => '',
!                               'address_country'       => '',
!                               'postal_code'           => '',
!                               'number'                => ''
!                               );
                }
  
!               function get_location_id()
                {
!                       return $this->_get('location_id');
                }
  
!               function get_organization_id()
                {
!                       return $this->_get('organization_id');
!               }
!               
!               function let_organization_id($new_organization_id)
!               {
!                       return $this->_let('location', $new_organization_id);
!               }
! 
!               function get_location()
!               {
!                       return $this->_get('location');
!               }
! 
!               function let_location($new_location)
!               {
!                       return $this->_let('location', $new_location);
!               }
! 
!               function get_street()
!               {
!                       return $this->_get('address_street');
!               }
! 
!               function let_street($new_street)
!               {
!                       return $this->_let('address_street', $new_street);
!               }
! 
!               function get_city()
!               {
!                       return $this->_get('address_city');
!               }
! 
!               function let_city($new_city)
!               {
!                       return $this->_let('address_city', $new_city);
!               }
! 
!               function get_country()
!               {
!                       return $this->_get('address_country');
!               }
! 
!               function let_country($new_country)
!               {
!                       return $this->_let('address_country', $new_country);
!               }
! 
!               function get_postal_code()
!               {
!                       return $this->_get('postal_code');
!               }
! 
!               function let_postal_code($new_postal_code)
!               {
!                       return $this->_let('postal_code', $new_postal_code);
!               }
! 
!               function get_number()
!               {
!                       return $this->_get('number');
!               }
! 
!               function let_number($new_number)
!               {
!                       return $this->_let('number', $new_number);
!               }
! 
!               function save()
!               {
!                       if($this->id() && 
$this->location_exists($this->get_organization_id()) && $this->can_write())
!                       {
!                               $sqlp = "UPDATE cdb_organization_location SET ";
!                               if ($this->_dirty_vars())
!                               {
!                               reset($this->_dirty);
!                                       do
!                                               $key = key($this->_dirty);
!                                               switch($key)
!                                               {
!                                                       case 'location_id' :
!                                                               break;
!                                                       default:
!                                                               $sql.=$key.'="';
!                                                               $sql .= 
$this->_get($key) . '", ';
!                                               }
!                                       while (next($this->_dirty));
!                                       
!                                       if ($sql)
!                                       {
!                                               $sql .= 'location_id="' . 
$this->get_location_id().'"'.
!                                                       ' WHERE 
location_id="'.$this->get_location_id().'"';
!                                               
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
!                                       }
!                               }
! 
!                       $this->_dirty = array();
! 
!                               return TRUE;
!                       }
!                       else
!                       {
!                               //TODO: raise a major error!
!                               return FALSE;
!                       }
!               }
! 
!               function load($location_id)
!               {
!                       $this->_loaded = FALSE;
! 
!                       $sql = 'SELECT * FROM cdb_organization_location WHERE 
location_id="' .
!                       $location_id.'"';
!                       $this->_db->query($sql,__LINE__,__FILE__);
! 
!                       reset($this->_);
!                       do
!                               $key = key($this->_);
!                               $this->_let($key,$this->_db->f($key));
!                       while(next($this->_));
! 
!                       $this->_dirty = array();
!                       $this->_loaded = TRUE;
!                       return TRUE;
! 
!               }
! 
!               function create()
!               {
!                       $sql='INSERT INTO cdb_organization_location( ' .
!                               '"organization_id", ' .
!                               '"location", ' .
!                               '"address_street", ' .
!                               '"address_city", ' .
!                               '"address_country", ' .
!                               '"postal_code", ' .
!                               '"number" ) ' .
!                               'VALUES ("0", "", "", "", "", "", "", "")';
!                       $this->_db->query($sql,__LINE__,__FILE__);
!                       return 
$this->_db->get_last_insert_id('cdb_organization_location',
!                               'location_id'));
!              
!               }
! 
!               function location_exists($location_id)
!               {
!                       if (!is_int($location_id))
!                       {
!                               $location_id = $this->_get('location_id');
!                       }
!                       $sql='SELECT * FROM cdb_organization_location WHERE 
location_id="' .
!                               $location_id.'"';
!                       $this->_db->query($sql,__LINE__,__FILE__);
!                       if ($this->_db->num_rows() > 0)
!                       {
!                               return TRUE;
!                       }
!                       else
                        {
!                               return FALSE;
                        }
                }
        }




reply via email to

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