Location: PHPKode > projects > SystemTracker > serialtracker/include/theme.class.inc
<?
class theme
{
	var $theme_key             = " ";
	var $theme_name            = " ";
	var $theme_logo            = "na";
	var $bg_color_or_img       = " ";
	var $bg_color              = " ";
	var $bg_image              = " ";
	var $fg_color              = " ";
	var $fg_error              = " ";
	var $link_color            = " ";
	var $active_link_color     = " ";
	var $used_link_color       = " ";
	var $shaded_area           = " ";
	var $table_bg              = " ";
	var $table_title_bg        = " ";
	var $table_header_bg       = " ";
	var $table_guide_bg        = " ";
	var $table_guide_frequency = " ";
	var $table_border          = "0";

	function get_theme ($theme_key)
	{
		$gt = mysql_query("select * from theme where theme_pri_key=\"" . $theme_key . "\"");
		while($row = mysql_fetch_row($gt))
		{
			$this->theme_key 		= $row[0];
        		$this->theme_name		= $row[1];
        		$this->theme_logo		= $row[2];
        		$this->bg_color_or_img		= $row[3];
        		$this->bg_color			= $row[4];
        		$this->bg_image			= $row[5];
        		$this->fg_color			= $row[6];
			$this->fg_error			= $row[7];
        		$this->link_color		= $row[8];
			$this->active_link_color	= $row[9];
        		$this->used_link_color		= $row[10];
        		$this->shaded_area		= $row[11];
        		$this->table_bg			= $row[12];
        		$this->table_title_bg		= $row[13];
        		$this->table_header_bg		= $row[14];
        		$this->table_guide_bg		= $row[15];
        		$this->table_guide_frequency	= $row[16];
			$this->table_border		= $row[17];
		}
	}

	function insert_theme ()
	{
		// print "*** " . $this->theme_name . " ***"; debug
		$theme_dip = "insert into theme (
			theme_name, theme_logo,     bg_color_or_img, bg_color,
			bg_image,   fg_color,       fg_error,        link_color,
			active_link_color,          used_link_color, shaded_area,
			table_bg,   table_title_bg, table_header_bg, table_guide_bg,
			table_guide_frequency,      table_border)
			values (
			'$this->theme_name',      '$this->theme_logo',
			'$this->bg_color_or_img', '$this->bg_color',
			'$this->bg_image',        '$this->fg_color',          '$this->fg_error',
			'$this->link_color',      '$this->active_link_color', '$this->used_link_color',
			'$this->shaded_area',     '$this->table_bg',
			'$this->table_title_bg',  '$this->table_header_bg',
			'$this->table_guide_bg',  '$this->table_guide_frequency', '$this->table_border'
			)";
		mysql_query($theme_dip);
		// print $theme_dip;  debug
	}

	function update_theme()
	{
		$theme_change = "update theme set
			theme_name='$this->theme_name',
			theme_logo='$this->theme_logo',
			bg_color_or_img='$this->bg_color_or_img',
			bg_color='$this->bg_color',
			bg_image='$this->bg_image',
			fg_color='$this->fg_color',
			fg_error='$this->fg_error',
			link_color='$this->link_color',
			active_link_color='$this->active_link_color',
			used_link_color='$this->used_link_color',
			shaded_area='$this->shaded_area',
			table_bg='$this->table_bg',
			table_title_bg='$this->table_title_bg',
			table_header_bg='$this->table_header_bg',
			table_guide_bg='$this->table_guide_bg',
			table_guide_frequency='$this->table_guide_frequency',
			table_border='$this->table_border',
			where theme_pri_key='$this->theme_key'";
		mysql_query($theme_change);
	}

	function delete_theme($key)
	{
		mysql_query("delete from theme where theme_pri_key='$key'");
	}

	function build_html_header()
	{
		if($this->bg_color_or_img == 0)
		{
			$bg = "BGCOLOR=\"#$this->bg_color\"";
		}
		else if($this->bg_color_or_img == 1)
		{
			$bg = "BACKGROUND=\"$this->bg_image\"";
		}
		else
		{
			$bg = "BGCOLOR=\"#FFFFFF\"";
		}

		print "<BODY LINK=\"#$this->link_color\" ALINK=\"$this->active_link_color\" ";
		print "VLINK=\"#$this->used_link_color\" $bg>\n";
		print "<FONT COLOR=\"#$this->fg_color\">";
	}

	function build_table_header($key)
	{

	}
}
?>
Return current item: SystemTracker