Location: PHPKode > projects > Echelon - A Writing Center Portal > echelon-1.0.0/include/department.php
<?php
/* department.php -- Defines the DO_Department type */

define('DB_DATAOBJECT_NO_OVERLOAD',true);

require_once("config.php");
require_once("DataObjectInclude/DataObject.php");
require_once("util.php");

/* Parse configuration data for DB_DataObject */
$config = parse_ini_file('DO_config.ini.php',TRUE);
foreach($config as $class=>$values)
{
    $options = &PEAR::getStaticProperty($class,'options');
    $options = $values;
}

// DB_DataObject::DebugLevel(5);	// Uncomment for debugging purposes

global $DATABASE;
define ('DO_DEPARTMENT_TABLE', $DATABASE['prefix'] . 'departments');

class DO_Department extends DB_DataObject
{	
	/* BEGIN data member declarations */

	/* Database and table config */
	var $_database_dsn = CONFIG_DSN_STR;
	var $__table = DO_DEPARTMENT_TABLE;
	
	/* The "actual" class member variables */

	// Auto-set by the the database
	public $id;

	public $name;
	public $goaltemplate_id;

	/* END data member declarations */

	function __construct($arg_name = null, $arg_goaltempid = null, $create_new = false)
	{
		$this->name = $arg_name;
		$this->goaltemplate_id = $arg_goaltempid;

		if ($create_new)
		{
			$this->insert();
		}
	}
	
	/* BEGIN functions required by DB_DataObject */

	function staticGet($k, $v = NULL)
	{
		return DB_DataObject::staticGet('DO_Department',$k,$v);
	} 

	// Returns an array with the table structure
	function table()
	{
		return array (
			'id' => DB_DATAOBJECT_INT,
			'name' => DB_DATAOBJECT_STR,
			'goaltemplate_id' => DB_DATAOBJECT_INT
		);
	}

	function id()
	{
		return array('id');
	}

	/* END functions required by DB_DataObject */

	/* BEGIN data member set functions */
	
	function set_goaltemplate_id($argid)
	{
		$this->goaltemplate_id = (int) $argid;
		$this->update();
	}

	function set_name($newname)
	{
		$this->name = $newname;
		$this->update();
	}
	
	/* END data member set functions */

	/* BEGIN data return functions */

	function get_goaltemplate_id()
	{
		return $this->goaltemplate_id;
	}

	function get_name()
	{
		return $this->name;
	}

	function get_id()
	{
		return $this->id;
	}
	/* END data member return functions */
}
?>
Return current item: Echelon - A Writing Center Portal