/*
* Project : Flight Services Version 4
* File : $Id: class.data.php 152 2010-02-04 16:11:43Z Graham $
* Revision : $Revision: 152 $
* Last Update : $Date: 2010-02-04 16:11:43 +0000 (Thu, 04 Feb 2010) $
* Last Edit By : $Author: Graham $
* SVNFile : $HeadURL: file:///G:/SVNRepository/common/class.data.php $
* Copyright : Graham Clarke / Air SeaTac Virtual (www.airseatac.com)
*/
require_once("pfsc.config.php");
// require_once("XPertMailer.php");
require_once("class.database.php");
define("STATUS_ACTIVE", 1);
define("STATUS_ONLEAVE", 2);
define("STATUS_SUSPENDED", 3);
define("STATUS_WITHDRAWN", 4);
define("STATUS_ASSOCIATE", 5);
define("LOOKUP_OPTION_NULL", 0);
define("LOOKUP_OPTION_NONE", 1);
define("LOOKUP_OPTION_ALL", 2);
define("LOOKUP_OPTION_TEXT", 3);
define("CATEGORY_APP_STATUS", 1);
define("CATEGORY_APP_SOURCE", 2);
define("CATEGORY_FAQ", 3);
define("CATEGORY_NEWS", 4);
define("CATEGORY_EVENT", 5);
define("CATEGORY_LINKS", 6);
define("CATEGORY_STATUS", 7);
define("CATEGORY_MEM_STATUS", 8);
define("CATEGORY_CARGO_TYPE", 9);
class data
{
public $dbh;
function __construct()
{
if (DEBUGMODE)
echo "
Constructor::".strtoupper('data')."
";
$db = database::getInstance();
$this->dbh = $db->getConnection();
}
function read_config($name)
{
$sth = $this->dbh->prepare("SELECT value FROM ast_config WHERE name=:name");
$sth->bindValue(":name", $name, PDO::PARAM_STR);
$sth->execute();
$record = $sth->fetch(PDO::FETCH_OBJ);
return $record->value;
}
function update_config($name, $value)
{
$sth = $this->dbh->prepare("update ast_config set value = :value where name = :name");
$sth->bindValue(":name", $name, PDO::PARAM_STR);
$sth->bindValue(":value", $value, PDO::PARAM_STR);
$sth->execute();
}
function banner()
{
$sth = $this->dbh->prepare("SELECT id FROM ast_banners WHERE active");
$sth->execute();
if ($sth->rowCount())
{
$x = rand(0, $sth->rowCount() - 1);
$sth = $this->dbh->prepare("SELECT * FROM ast_banners WHERE active LIMIT $x, 1");
$sth->execute();
$record = $sth->fetch(PDO::FETCH_OBJ);
return $record->image;
}
else
return "/UserFiles/Image/ads/ad-schedule.png";
}
// ------------------------------------------------------
// Create lookup- from array
// ------------------------------------------------------
function lookup_array($a, $control_name, $selected, $submit=FALSE, $option=LOOKUP_OPTION_NULL, $text="")
{
if ($submit)
echo "