<?php
/*
 * mysql Ajax Table Editor
 *
 * Copyright (c) 2008 Chris Kitchen <info@mysqlajaxtableeditor.com>
 * All rights reserved.
 *
 * See COPYING file for license information.
 *
 * Download the latest version from
 * http://www.mysqlajaxtableeditor.com
 */
 
class Common
{		
	// mysql Variables
	var $mysqlUser = 'root';
	var $mysqlDb = 'workstudy';
	var $mysqlHost = 'uwfinaid.ovid.u.washington.edu';
	var $mysqlPort = 3798;
	var $mysqlDbPass = '03798';
	
	var $langVars;
	var $dbc;

	
	
	
	function mysqlConnect()
	{
		/*try{
			$pdo = new PDO('mysql:dbname=$this->mysqlDb;host=$this->mysqlHost', '$this->mysqlUser', '$this->mysqlDbPass', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
		}
		catch (PDOException $e) {
			echo 'Connection failed: ' . $e->getMessage();
		}
		*/
		
		if($this->dbc = ($GLOBALS["___mysqli_ston"] = mysqli_connect($this->mysqlHost,  $this->mysqlUser,  $this->mysqlDbPass, $this->mysqlDb, $this->mysqlPort))) 
		{	
			if(!((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $this->mysqlDb)))
			{
				$this->logError(sprintf($this->langVars->errNoSelect,$this->mysqlDb),__FILE__, __LINE__);
			}
			else{
				mysqli_set_charset($this->dbc, 'utf-8');
			}
		}
		else
		{
			$this->logError($this->langVars->errNoConnect,__FILE__, __LINE__);
		}
	}
	
	function logError($message, $file, $line)
	{
		$message = sprintf($this->langVars->errInScript,$file,$line,$message);
		var_dump($message);
		die;
	}
	
	function displayHeaderHtml()
	{
		?>
		<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
		"http://www.w3.org/TR/html4/loose.dtd">
		<html>
		<head>
		<title>Jobs Table Editor</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
			<link href="css/table_styles.css" rel="stylesheet" type="text/css" />
			<link href="css/icon_styles.css" rel="stylesheet" type="text/css" />
			<link rel="stylesheet" href="/home/home.css" type="text/css">
			
			<script type="text/javascript" src="js/prototype.js"></script>
			<script type="text/javascript" src="js/scriptaculous-js/scriptaculous.js"></script>
			<script type="text/javascript" src="js/lang/lang_vars-en.js"></script>
			<script type="text/javascript" src="js/ajax_table_editor.js"></script>
			<script type="text/javascript" src="js/email.js"></script>
			
			<!-- jquery file( BL: when this is inserted, entire page doesn't load.
			<script type="text/javascript" src="js/jquery.min.js"></script>  -->
			
			<!-- calendar files -->
			<link rel="stylesheet" type="text/css" media="all" href="js/jscalendar/skins/aqua/theme.css" title="win2k-cold-1" /> 
			<script type="text/javascript" src="js/jscalendar/calendar.js"></script>
			<script type="text/javascript" src="js/jscalendar/lang/calendar-en.js"></script>
			<script type="text/javascript" src="js/jscalendar/calendar-setup.js"></script>

		</head>	
		<body>
		<!--chtml include "//home/incs/stuheader.inc"-->
		<?php
	}
	
	function displayFooterHtml()
	{
		?>
		</body>
		</html>
		<?php
	}	

}
?>
