Location: PHPKode > projects > Echelon - A Writing Center Portal > echelon-1.0.0/include/globalconfig.php
<?php
/* globalconfig.php -- Defines the DO_GlobalConfig 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_GLOBALCONFIG_TABLE', $DATABASE['prefix'] . 'globalconfig');

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

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

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

	public $name;
	public $institution_name;
	public $echelon_url;
	public $admin_email_address;
	public $current_schedule_id;
	public $upcoming_events;

	/* END data member declarations */

	function __construct($arg_name = null, $arg_institution = null, $arg_url = null, $arg_admin_email = null, $create_new = false)
	{
		if (func_num_args() != 0)
		{
			$this->name = $arg_name;
			$this->institution_name = $arg_institution;
			$this->echelon_url = $arg_url;
			$this->admin_email_address = $arg_admin_email;
		}

		if ($create_new)
		{
			$this->insert();
		}
	}

	/* BEGIN functions required by DB_DataObject */

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

	// Returns an array with the table structure
	function table()
	{
		return array (
			'id' => DB_DATAOBJECT_INT,
			'name' => DB_DATAOBJECT_STR,
			'institution_name' => DB_DATAOBJECT_STR,
			'echelon_url' => DB_DATAOBJECT_STR,
			'admin_email_address' => DB_DATAOBJECT_STR,
			'current_schedule_id' => DB_DATAOBJECT_INT,
			'upcoming_events' => DB_DATAOBJECT_STR + DB_DATAOBJECT_TXT
		);
	}

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

	/* END functions required by DB_DataObject */

	/* BEGIN data member set functions */

	function set_upcoming_events($newevents)
	{
		$this->upcoming_events = $newevents;
		$this->update();
	}

	function set_current_schedule_id($newid)
	{
		$this->current_schedule_id = (int) $newid;
		$this->update();
	}

	function set_admin_email_address($newemail)
	{
		$this->admin_email_address = $newemail;
		$this->update();
	}
	
	function set_echelon_url($newurl)
	{
		$this->echelon_url = $newurl;
		$this->update();
	}
	
	function set_institution_name($newname)
	{
		$this->institution_name = $newname;
		$this->update();
	}

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

	/* BEGIN data return functions */

	function get_upcoming_events()
	{
		return trim($this->upcoming_events);
	}
	
	function get_current_schedule_id()
	{
		return $this->current_schedule_id;
	}

	function get_echelon_url()
	{
		return preg_replace('/\/$/i', '', $this->echelon_url);
	}
	
	function get_admin_email_address()
	{
		return $this->admin_email_address;
	}
	
	function get_institution_name()
	{
		return $this->institution_name;
	}

	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