<?php
  /**************************************************************************\
  * phpGroupWare                                                             *
  * http://www.phpgroupware.org/                                             *
  * This file written by Patrick Walsh <patrick@phpgroupware.org>            *
  * ------------------------------------------------------------------------ *
  * 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: generic.class.php,v 1.3 2000/11/30 23:17:35 pjw Exp $ */


/* This class is extended by all cdb classes */
class cdb_generic_class {

  /////////////////////////////////////////////////
 ////////////// Public Variables /////////////////
/////////////////////////////////////////////////
/* These vars are declared like: 'var $varname;' */

  /////////////////////////////////////////////////
 /////////////// Local Variables /////////////////
/////////////////////////////////////////////////
/* PHP does not support local vars.  Use         */
/* 'var $_varname;' to signify local vars.       */
	
	var $_ = array();
	var $_dirty = array();
	var $_id = 0;
	
  /////////////////////////////////////////////////
 ////////////// Public Functions /////////////////
/////////////////////////////////////////////////
	function let($var, $val) {
		if ($this->get($var) != $val) {
			// new value, so make it dirty
			$this->_dirty[$var] = 1;
			$this->_[$var] = $val;

			return TRUE; //signal that a change was made
		}
		return FALSE; //signal that no change was made
	}

	function get($var) {
		return $this->_[$var];
	}

	function dirty($dirty_prop) {
		$this->_dirty[$dirty_prop]=1;
	}

	function id() {
		return $this->_id;
	}

	function exists($id) {
		//TODO: check for existence of id
	}

	function can_read($id) {
		//TODO: check for read permissions
          $myReply = TRUE;
          if(is_int($intID))
          {
            // do stuff
          }
	  return $myReply;
	}
	
	function can_write($id) {
		//TODO: check for write permissions
          $myReply = TRUE;
          if(is_int($intID))
          {
            // do stuff
          }
	  return $myReply;
	}
	
}
?>
