phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: cdb/inc class.bo.inc.php,NONE,1.1 class.so.inc.p


From: Patrick Walsh <address@hidden>
Subject: [Phpgroupware-cvs] CVS: cdb/inc class.bo.inc.php,NONE,1.1 class.so.inc.php,NONE,1.1 class.ui.inc.php,NONE,1.1 class.cdb_contact.inc.php,1.4,1.5 class.cdb_contact_phone.inc.php,1.2,1.3 class.cdb_entity.inc.php,1.3,1.4 class.cdb_generic.inc.php,1.2,1.3 class.cdb_phone.inc.php,1.2,1.3
Date: Wed, 13 Feb 2002 23:25:46 -0500

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

Modified Files:
        class.cdb_contact.inc.php class.cdb_contact_phone.inc.php 
        class.cdb_entity.inc.php class.cdb_generic.inc.php 
        class.cdb_phone.inc.php 
Added Files:
        class.bo.inc.php class.so.inc.php class.ui.inc.php 
Log Message:
Got the phone stuff going, I think


--- NEW FILE ---
//business objects

--- NEW FILE ---
// Storage Objects

--- NEW FILE ---
//user interface

Index: class.cdb_contact.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.cdb_contact.inc.php   13 Feb 2002 22:35:02 -0000      1.4
--- class.cdb_contact.inc.php   14 Feb 2002 04:25:42 -0000      1.5
***************
*** 323,326 ****
--- 323,327 ----
  
                        $this->_loaded = TRUE;
+                       $this->_dirty = array();
                        return TRUE;
  

Index: class.cdb_contact_phone.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_phone.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.cdb_contact_phone.inc.php     13 Feb 2002 22:35:02 -0000      1.2
--- class.cdb_contact_phone.inc.php     14 Feb 2002 04:25:42 -0000      1.3
***************
*** 19,22 ****
--- 19,23 ----
        {
                var $_phone_list;
+               var $_db;
  
                function cdb_contact_phone()
***************
*** 30,45 ****
                function save()
                {
                }
  
!               function load($contact_id)
                {
!                       //do sql, then set id
!                       $sql = 'SELECT * FROM cdb_contact_phone WHERE 
contact_id="' . 
!                               $contact_id . '"';
                        $this->_db->query($sql,__LINE__,__FILE__);
                }
  
                function get_phone_list()
                {
                }
        }
--- 31,66 ----
                function save()
                {
+                       reset $this->_phone_list;
+                       $retval = FALSE;
+                       while (list($key,$value) = $this->_phone_list)
+                       {
+                               if ($value->save())
+                               {
+                                       $retval = TRUE;
+                               }
+                       }
+                       return $retval;
                }
  
!               function load($entity_id)
                {
!                       $this->_phone_list = array();
!                       $this->_id = $entity_id;
!                       $this->_loaded = TRUE;
!                       $sql = 'SELECT contact_phone_id FROM cdb_contact_phone 
WHERE ' .
!                               'entity_id="' . $entity_id . '"';
                        $this->_db->query($sql,__LINE__,__FILE__);
+             while ($this->_db->next_record())
+             {
+                               $this->_phone_list[] = 
CreateObject('cdb.cdb_phone');
+                               $x = $this->_db->f('contact_phone_id');
+                               $this->_phone_list[$x]->load($x);
+                       }
+                       return TRUE;
                }
  
                function get_phone_list()
                {
+                       return $this->_phone_list;
                }
        }

Index: class.cdb_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_entity.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.cdb_entity.inc.php    4 Feb 2002 18:55:22 -0000       1.3
--- class.cdb_entity.inc.php    14 Feb 2002 04:25:42 -0000      1.4
***************
*** 251,263 ****
  
                /*!
-               @function get_loaded
-               @abstract Returns true if a entity is loaded in memory
-               */
-               function get_loaded()
-               {
-                       return $this->_get('loaded');
-               }
- 
-               /*!
                @function get_org_data
                @abstract Returns the loaded org class, if one exists
--- 251,254 ----
***************
*** 265,269 ****
                function get_org_data
                {
!                       if ($this->get_loaded() && 
$this->get_type()=='organization') 
                        {
                                return $_org;
--- 256,260 ----
                function get_org_data
                {
!                       if ($this->loaded() && 
$this->get_type()=='organization') 
                        {
                                return $_org;
***************
*** 281,285 ****
                function get_contact_data()
                {
!                       if ($this->get_loaded() && $this->get_type()=='contact')
                        {
                                return $_contact;
--- 272,276 ----
                function get_contact_data()
                {
!                       if ($this->loaded() && $this->get_type()=='contact')
                        {
                                return $_contact;

Index: class.cdb_generic.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_generic.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.cdb_generic.inc.php   13 Feb 2002 22:35:02 -0000      1.2
--- class.cdb_generic.inc.php   14 Feb 2002 04:25:42 -0000      1.3
***************
*** 118,122 ****
        function id() 
        {
!               return $this->_id;
        }
  
--- 118,136 ----
        function id() 
        {
!               return (int)$this->_id;
!       }
! 
!       function get_entity_id_from_contact($contact_id)
!       {
!               $tmpdb = $GLOBALS['phpgw']->db;
!               $sql = 'SELECT * FROM cdb_entity_id WHERE contact_id="' .
!                       $contact_id . '"';
!               $tmpdb->query($sql,__LINE__,__FILE__);
!               return $tmpdb->f('entity_id');
!       }
!       
!       function get_entity_id_from_org($org_id)
!       {
!       // TODO
        }
  

Index: class.cdb_phone.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_phone.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.cdb_phone.inc.php     13 Feb 2002 22:35:02 -0000      1.2
--- class.cdb_phone.inc.php     14 Feb 2002 04:25:42 -0000      1.3
***************
*** 20,28 ****
                function cdb_phone()
                {
                        /* add vars that have get/let interface to this array. 
*/
                        $this->_ = array(
!                               'id'     => '',
!                               'type'   => 0,
!                               'number' => ''
                        );
                }
--- 20,29 ----
                function cdb_phone()
                {
+                       $this->_db = $GLOBALS['phpgw']->db;
                        /* add vars that have get/let interface to this array. 
*/
                        $this->_ = array(
!                               'contact_phone_id'      => '',
!                               'phone_category_id'     => 0,
!                               'number'                        => ''
                        );
                }
***************
*** 30,72 ****
                function save()
                {
!               }
  
!               function load($phone_id, $type_id, $number)
!               {
!                       $this->create($phone_id, $type_id, $number);
!               }
! 
!               function create($phone_id, $type_id, $number)
!               {
                }
  
                function get_phone_id()
                {
!                       return $this->get('id');
                }
  
                function get_type_name()
                {
!                       //look up category id and return name
                }
  
                function get_type()
                {
!                       return $this->get('type');
                }
  
                function let_type($new_type)
                {
!                       return $this->let('type', $new_type);
                }
  
                function get_number()
                {
!                       return $this->get('number');
                }
  
                function let_number($new_number)
                {
!                       return $this->let('number', $new_number);
                }
        }
--- 31,126 ----
                function save()
                {
!                       // Build update query
!                       $sqlp = "UPDATE cdb_contact_phone SET ";
!                       if ($this->_dirty_vars())
!                       {
!                               reset($this->_dirty);
!                               do
!                                       $key = key($this->_dirty);
!                                       $sql.=$key.'="';
!                               while (next($this->_dirty));
!                               $sql .= $this->_get($key) . '", ';
!                               if ($sql)
!                               {
!                                       $sql .= 'entity_id="' . $this->id().'"'.
!                                               ' WHERE 
phone_category_id="'.$this->get_phone_id().'"';
!                                       
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
!                               }
!                               return TRUE;
!                       }
!                       else
!                       {
!                               return FALSE;
!                       }
!               }
! 
!               function load($phone_id)
!               {
!                       $sql = 'SELECT * FROM cdb_contact_phone WHERE 
contact_phone_id="' .
!                               $phone_id . '"';
!                       $this->_db->query($sql,__LINE__,__FILE__);
! 
!                       reset($this->_);
!                       do
!                               $key = key($this->_);
!                               $this->_let($key,$this->_db->f($key));
!             while(next($this->_));
! 
!                       $this->_id = (int)$this->_db->f('entity_id');
! 
!                       $this->_loaded = TRUE;
!                       $this->_dirty = array();
!       
!                       return (int)$this->id();
!               }
! 
!               function create($entity_id, $type_id, $number)
!               {
!                       $this->_loaded = TRUE;
!                       $this->_dirty = array();
!             $sql = 'INSERT INTO cdb_contact_phone ("entity_id",' .
!                                       '"phone_category_id", "number") VALUES 
' .
!                     '("'.$entity_id.'","'.$type_id.'","'.$number.'")';
!             $this->_db->query($sql,__LINE__,__FILE__);
!                       $this->_id = $entity_id;
!             $this->_let('phone_category_id',
!                     $this->_db->get_last_insert_id('cdb_contact_phone',
!                     'contact_phone_id'));
  
!                       return $this->_db->query($sql,__LINE__,__FILE__);
                }
  
                function get_phone_id()
                {
!                       return (int)$this->_get('contact_phone_id');
                }
  
                function get_type_name()
                {
!                       $sql = 'SELECT phone_category_name FROM 
cdb_contact_phone_category'.
!                               ' WHERE 
phone_category_id="'.$this->_get('phone_category_id').
!                               '"';
!                       $this->_db->query($sql,__LINE__,__FILE__);
!                       return $this->_db->f('phone_category_name');
                }
  
                function get_type()
                {
!                       return (int)$this->_get('phone_category_id');
                }
  
                function let_type($new_type)
                {
!                       return $this->_let('phone_category_id', (int)$new_type);
                }
  
                function get_number()
                {
!                       return $this->_get('number');
                }
  
                function let_number($new_number)
                {
!                       return $this->_let('number', $new_number);
                }
        }




reply via email to

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