//**************************************************************************************
// Class: DataManager
// Description: The DataManager class will act as a proxy to the database, and will
// contain basic APIs for the application to use.
//**************************************************************************************
class DataManager {
//*******************************
// class variables
//*******************************
private $dbhost = '';
private $dbuser = '';
private $dbpass = '';
private $dbname = '';
private $connection = "";
private $lastInsertedId = 0;
//*******************************
// constructor
//*******************************
function __construct() {
try {
//Load all of the variable data from the config file
require($_SERVER['DOCUMENT_ROOT'] . '/includes/config_db.php');
$this->dbhost = $dbConfig['dbhost'];
$this->dbuser = $dbConfig['dbuser'];
$this->dbpass = $dbConfig['dbpass'];
$this->dbname = $dbConfig['dbname'];
$this->connection = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass);
if ($this->connection == false){
throw new Exception("Class: DataManager - Method: __construct - mysql_connect failed.");
}
if (mysql_select_db($this->dbname) == false){
throw new Exception("Class: DataManager - Method: __construct - mysql_select_db failed.");
}
}
catch(Exception $e) {
// CATCH EXCEPTION HERE -- DISPLAY ERROR MESSAGE & EMAIL ADMINISTRATOR
include_once($_SERVER['DOCUMENT_ROOT'] . '/classes/class_ErrorHandler.php');
$errorVar = new ErrorHandler();
$errorVar->notifyAdminException($e);
exit;
}
}
//*******************************
// Methods/Functions
//*******************************
public function queryRecords($sql) {
try {
$result = mysql_query($sql,$this->connection);
return $result;
}
catch(Exception $e) {
//throw new Exception('Class: DataManager - Method: queryRecords - File: ' . $e->getFile() . 'Line: ' . $e->getLine() . 'Reason: '. $e->getMessage());
// CATCH EXCEPTION HERE -- DISPLAY ERROR MESSAGE & EMAIL ADMINISTRATOR
include_once($_SERVER['DOCUMENT_ROOT'] . '/classes/class_ErrorHandler.php');
$errorVar = new ErrorHandler();
$errorVar->notifyAdminException($e);
exit;
}
}
public function updateRecords($sql) {
try {
$result = mysql_query($sql,$this->connection);
// check for a successful update - if successful return true, otherwise return false
if($result != false) {
return true;
}
return false;
}
catch(Exception $e) {
//throw new Exception('Class: DataManager - Method: updateRecords - File: ' . $e->getFile() . 'Line: ' . $e->getLine() . 'Reason: '. $e->getMessage());
// CATCH EXCEPTION HERE -- DISPLAY ERROR MESSAGE & EMAIL ADMINISTRATOR
include_once($_SERVER['DOCUMENT_ROOT'] . '/classes/class_ErrorHandler.php');
$errorVar = new ErrorHandler();
$errorVar->notifyAdminException($e);
exit;
}
}
public function getConnection() {
//Function is used by the record pager at least temporarily until rewritten
return $this->connection;
}
public function getLastInsertedId() {
return mysql_insert_id($this->connection);
}
}
?>
Fatal error: Uncaught Error: Class 'DataManager' not found in /hermes/walnacweb03/walnacweb03ab/b1116/pow.nrsc/htdocs/calendar/classes/class_calendar_day.php:81
Stack trace:
#0 /hermes/walnacweb03/walnacweb03ab/b1116/pow.nrsc/htdocs/calendar/classes/class_calendar_day.php(28): CalendarDay->populateEvents()
#1 /hermes/walnacweb03/walnacweb03ab/b1116/pow.nrsc/htdocs/calendar/classes/class_calendar.php(230): CalendarDay->__construct(1759276800)
#2 /hermes/walnacweb03/walnacweb03ab/b1116/pow.nrsc/htdocs/calendar/classes/class_calendar.php(39): Calendar->populateDays()
#3 /hermes/walnacweb03/walnacweb03ab/b1116/pow.nrsc/htdocs/upcoming-events.php(4): Calendar->__construct()
#4 {main}
thrown in /hermes/walnacweb03/walnacweb03ab/b1116/pow.nrsc/htdocs/calendar/classes/class_calendar_day.php on line 81