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 "
"; echo ""; echo "row_fetch['title_id'] . "')\" onClick=\"showHideItems('item" . $this->row_fetch['title_id'] . "')\">"; echo $this->titleStringLengthYear(); echo ""; echo "
"; echo "
"; } function movieMain(){ echo "
"; echo $this->titlePlotLength(); echo $this->titleGenre(); echo $this->titleRuntime(); echo $this->convertTimeStamp(); echo "
"; } function convertTimeStamp(){ $this->converttime = strtotime($this->row_fetch['title_submitted']); echo "Entry Submitted: " . date("d\/m\/Y", $this->converttime) . ""; } function titlePlotLength(){ $this->row_fetch['title_plot'] = implode(" ", array_slice(explode(" ", $this->row_fetch['title_plot']), 0, 40)); $this->row_fetch['title_plot'] .= "..."; echo "Plot: " . $this->row_fetch['title_plot'] . "

"; } function titleGenre(){ $this->query = "SELECT * FROM dvd_genresdata WHERE title_id = ".$this->row_fetch['title_id'].""; $this->printGenreQuery = mysql_query($this->query); echo "Genre(s): "; while($this->row_fetch = mysql_fetch_array($this->printGenreQuery)){ echo $this->row_fetch['genre_title'] . ", "; } echo " || "; } function titleRuntime(){ if(!(substr($this->row_fetch['title_runtime'], 0, 5) == "00:00")){ echo "Runtime (h:m): " . substr($this->row_fetch['title_runtime'],1,4) . "
"; }else{ $this->notavail = "N/A"; echo "Runtime: " . $this->notavail . "
"; } } 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 "
"; } function printItem(){ while($this->row_fetch = mysql_fetch_array($this->printItemQuery)){ print '
'; print '
'; echo $this->movieHeader(); print "
"; print ""; print "
"; } } function moreOptions(){ echo ""; } } ?>