All pastes #284189 Raw Edit

Unnamed

public php v1 · immutable
#284189 ·published 2006-12-18 22:43 UTC
rendered paste body
<?phpclass formatPage {		function formatPage(){		$this->doQuery();		$this->printItem();			}		function doQuery(){		$this->query = "SELECT * FROM dvd_titles ORDER BY title_id DESC LIMIT 5";		$this->printItemQuery = mysql_query($this->query);	}		function movieHeader(){		echo "<div class='bigheader-div'>";				echo "<span class='bigheader-text'>";		echo "<a onClick=\"showHideItems('item" . $this->row_fetch['title_id'] . "')\" onClick=\"showHideItems('item" . $this->row_fetch['title_id'] . "')\">";		echo $this->titleStringLengthYear();		echo "</a></span>";		echo "</div>";				echo "<div class='bigheader-divright'><img src='images/review.gif' /><img src='images/delete.gif' /></div>";	}			function movieMain(){		echo "<div class='text'>";		echo $this->titlePlotLength();		echo $this->titleGenre();		echo $this->titleRuntime();		echo $this->convertTimeStamp();		echo "</div>";	}		function convertTimeStamp(){		$this->converttime = strtotime($this->row_fetch['title_submitted']);		echo "<span class='links'><strong>Entry Submitted:</strong> " . date("d\/m\/Y", $this->converttime) . "</span>";	}		function titlePlotLength(){				$this->row_fetch['title_plot'] = implode(" ", array_slice(explode(" ", $this->row_fetch['title_plot']), 0, 40));		$this->row_fetch['title_plot'] .= "...";		echo "<span><strong>Plot:</strong> " . $this->row_fetch['title_plot'] . "</span><br /><br />";		}		function titleGenre(){						$this->query = "SELECT * FROM dvd_genresdata WHERE title_id = ".$this->row_fetch['title_id']."";		$this->printGenreQuery = mysql_query($this->query);		echo "<span class='links'><strong>Genre(s): </strong>";		while($this->row_fetch = mysql_fetch_array($this->printGenreQuery)){			echo $this->row_fetch['genre_title'] . ", ";		}		echo "</span> || ";	}		function titleRuntime(){				if(!(substr($this->row_fetch['title_runtime'], 0, 5) == "00:00")){			echo "<span class='links'><strong>Runtime (h:m):</strong> " . substr($this->row_fetch['title_runtime'],1,4) . "</span><br />";		}else{			$this->notavail = "N/A";			echo "<span class='links'><strong>Runtime:</strong> " . $this->notavail . "</span><br />";		}	}		function titleStringLengthYear(){		if(strlen($this->row_fetch['title_name']) > 35){			echo substr($this->row_fetch['title_name'],0,35) . ".. (" . $this->row_fetch['title_year'] . ")";		}else{			echo $this->row_fetch['title_name'] . " (". $this->row_fetch['title_year'] .")";		}	}		function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbWidth){		$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");		$origWidth = imagesx($srcImg);		$origHeight = imagesy($srcImg);				$ratio = $origWidth / $thumbWidth;		$thumbHeight = $origHeight * $ratio;				$thumbImg = imagecreate($thumbWidth, $thumbHeight);		imagecopyresized($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imagesx($thumbImg), imagesy($thumbImg));				imagejpeg($thumbImg, "$thumbDirectory/$imageName");	}		function printImage(){		echo "<div class='picture'></div>";	}	function printItem(){					while($this->row_fetch = mysql_fetch_array($this->printItemQuery)){								print '<div class="subcont">';					print '<div class="header">';						echo $this->movieHeader();					print "</div>";										print "<div class='sub' id='item" . $this->row_fetch['title_id'] . "' style='display:none'>";						echo $this->printImage();						echo $this->movieMain();					print "</div>";				print "</div>";			}			}		function moreOptions(){		echo "<div id='archive' class='links'><strong>View Archive | <a href='submit.php'>Submit</a></strong></div>";	}} ?>