[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: cdb/inc class.cdb_contact_personal.inc.php,1.3,1
From: |
Patrick Walsh <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: cdb/inc class.cdb_contact_personal.inc.php,1.3,1.4 |
Date: |
Wed, 13 Feb 2002 23:20:41 -0500 |
Update of /cvsroot/phpgroupware/cdb/inc
In directory subversions:/tmp/cvs-serv1808
Modified Files:
class.cdb_contact_personal.inc.php
Log Message:
bjmorel put this class together
Index: class.cdb_contact_personal.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_personal.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.cdb_contact_personal.inc.php 13 Feb 2002 23:37:25 -0000 1.3
--- class.cdb_contact_personal.inc.php 14 Feb 2002 04:20:38 -0000 1.4
***************
*** 1,137 ****
! <?php
! /**************************************************************************\
! * phpGroupWare *
! * http://www.phpgroupware.org/ *
! * This file written by Miles Lott <address@hidden> *
! * ------------------------------------------------------------------------ *
! * Please see the documentation for these classes in the README file in *
! * this directory. *
! * ------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /* This file is to be considered broken and wip */
!
! class cdb_contact_personal extends cdb_generic_class
! {
! function cdb_contact_personal()
! {
! /* add vars that have get/let interface to this array.
*/
! $this->_ = array(
! 'birthday' => 0,
! 'children' => ''
! // one of "unspecified", "male", or "female"
! 'gender' => 'unspecified',
! 'gov_id_num' => '',
! 'hobbies' => '',
! 'language' => 0,
! 'spouse' => '',
! 'anniversary' => 0
! );
! }
!
! function get_birthday()
! {
! return $this->_get('birthday');
! }
!
! function let_birthday($new_birthday)
! {
! return $this->_let('birthday', $new_birthday);
! }
!
! function get_children()
! {
! return $this->_get('children');
! }
!
! function let_children($new_children)
! {
! return $this->_let('children', $new_children);
! }
!
! function get_gender()
! {
! return $this->_get('gender');
! #returns 'unspecified'|'male'|'female'
! }
!
! function let_gender($new_gender)
! {
! switch($new_gender)
! {
! case 'unspecified':
! case 'male':
! case 'female':
! return $this->_let('gender',
$new_gender);
! break;
! case default:
! return FALSE;
! }
! }
!
! function get_gov_id()
! {
! return $this->_get('gov_id_num');
! }
!
! function let_gov_id($new_gov_id)
! {
! return $this->_let('gov_id_num', $new_gov_id);
! }
!
! function get_hobbies()
! {
! return $this->_get('hobbies');
! }
!
! function let_hobbies($new_hobbies)
! {
! return $this->_let('hobbies', $new_hobbies);
! }
!
! function get_language()
! {
! return $this->_get('language');
! }
!
! function let_language($new_language)
! {
! return $this->_let('language', $new_language);
! }
!
! function get_spouse()
! {
! return $this->_get('spouse');
! }
!
! function let_spouse($new_spouse)
! {
! return $this->_let('spouse', $new_spouse);
! }
!
! function get_anniversary()
! {
! return $this->_get('anniversary');
! }
!
! function let_anniversary($new_anniversary)
! {
! return $this->_let('anniversary', $new_anniversary);
! }
!
! function save()
! {
! }
!
! function load($intID)
! {
! }
!
! }
! ?>
--- 1,237 ----
! <?php
! /**************************************************************************\
! * phpGroupWare *
! * http://www.phpgroupware.org/ *
! * This file written by Miles Lott <address@hidden> *
! * With contributions from mr_e and bjmorel *
! * ------------------------------------------------------------------------ *
! * Please see the documentation for these classes in the README file in *
! * this directory. *
! * ------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /* This file is to be considered broken and wip */
!
! class cdb_contact_personal extends cdb_generic_class
! {
! function cdb_contact_personal()
! {
! /* add vars that have get/let interface to this array.
*/
! $this->_db = $GLOBALS['phpgw']->db;
! $this->_ = array(
! 'contact_id' => 0,
! 'birthday' => 0,
! 'children' => '',
! // one of "unspecified", "male", or "female"
! 'gender' => 'unspecified',
! 'gov_id_num' => '',
! 'hobbies' => '',
! 'language' => 0,
! 'spouse' => '',
! 'anniversary' => 0
! );
! }
!
! function get_birthday()
! {
! return $this->_get('birthday');
! }
!
! function let_birthday($new_birthday)
! {
! return $this->_let('birthday', $new_birthday);
! }
!
! function get_children()
! {
! return $this->_get('children');
! }
!
! function let_children($new_children)
! {
! return $this->_let('children', $new_children);
! }
!
! function get_gender()
! {
! return $this->_get('gender');
! #returns 'unspecified'|'male'|'female'
! }
!
! function let_gender($new_gender)
! {
! switch($new_gender)
! {
! case 'unspecified':
! case 'male':
! case 'female':
! return $this->_let('gender',
$new_gender);
! break;
! case default:
! return FALSE;
! }
! }
!
! function get_gov_id()
! {
! return $this->_get('gov_id_num');
! }
!
! function let_gov_id($new_gov_id)
! {
! return $this->_let('gov_id_num', $new_gov_id);
! }
!
! function get_hobbies()
! {
! return $this->_get('hobbies');
! }
!
! function let_hobbies($new_hobbies)
! {
! return $this->_let('hobbies', $new_hobbies);
! }
!
! function get_language()
! {
! return $this->_get('language');
! }
!
! function let_language($new_language)
! {
! return $this->_let('language', $new_language);
! }
!
! function get_spouse()
! {
! return $this->_get('spouse');
! }
!
! function let_spouse($new_spouse)
! {
! return $this->_let('spouse', $new_spouse);
! }
!
! function get_anniversary()
! {
! return $this->_get('anniversary');
! }
!
! function let_anniversary($new_anniversary)
! {
! return $this->_let('anniversary', $new_anniversary);
! }
!
! function save()
! {
! if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
! {
! $sqlp = "UPDATE cdb_contact_personal SET ";
! if ($this->_dirty_vars())
! {
! reset($this->_dirty);
! do
! {
! $key = key($this->_dirty);
! $sql.=$key.'="';
! $sql .= $this->_get($key) . '", ';
! } while (next($this->_dirty));
! if ($sql)
! {
! $sql .= 'contact_id="' .
$this->get_contact_id().'"'.
! ' WHERE
contact_id="'.$this->get_contact_id().'"';
!
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
! }
! }
!
! $this->_dirty = array();
!
! return TRUE;
! }
! else
! {
! //TODO: raise a major error!
! return FALSE;
! }
! }
!
! function load($contact_id)
! {
! if (!$this->contact_exists($contact_id))
! {
! $this->_create($contact_id);
! }
!
! $this->_loaded = FALSE;
!
!
! $sql = 'SELECT * FROM cdb_contact_personal WHERE
contact_id="' .
! $contact_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 contact_exists
! @abstract Checks the existence of contact_id
! @discussion Checks for the existence of contact_id
! */
! function contact_exists($contact_id)
! {
! if (!is_int($contact_id))
! {
! $contact_id = $this->_get('contact_id');
! }
! $sql='SELECT * FROM cdb_contact_personal WHERE contact_id="' .
! $contact_id.'"';
! $this->_db->query($sql,__LINE__,__FILE__);
! if ($this->_db->num_rows() > 0)
! {
! return TRUE;
! }
! else
! {
! return FALSE;
! }
! }
!
! /*!
! @function _create
! @abstract Creates a new record in the cdb_contact_personal DB
! @discussion New with default values
! */
! function _create($contact_id)
! {
! if (!is_int($contact_id))
! {
! $contact_id = $this->_get('contact_id');
! }
!
! $sql='INSERT INTO cdb_contact_personal ("contact_id", ' .
! '"birthday", "children", "gender", "gov_id_num", ' .
! '"hobbies", "language", "spouse", "anniversary" ) ' .
! 'VALUES ("' . $contact_id . '", "0", "", "unspecified", ' .
! '"", "", "0", "", "0")';
! $this->_db->query($sql,__LINE__,__FILE__);
!
! }
!
! }
! ?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: cdb/inc class.cdb_contact_personal.inc.php,1.3,1.4,
Patrick Walsh <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: registration/inc class.soreg.inc.php,1.12,1.13
- Next by Date:
[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
- Previous by thread:
[Phpgroupware-cvs] CVS: registration/inc class.soreg.inc.php,1.12,1.13
- Next by thread:
[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
- Index(es):