<?php
/* +----------------------------------------------------------------------+
|SelectaPix Open Source Gallery |
+----------------------------------------------------------------------+
| Copyright (c) 2004 OutOfTheTrees |
| |
| http://www.outofthetrees.co.uk/index.php |
| |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 of the GPL license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.outofthetrees.co.uk/license/2_0.txt. |
| If you did not receive a copy of the SelectaPix license and are |
| unable to obtain it through the world-wide-web, please send a note |
| to hide@address.com so we can mail you a copy immediately.|
+----------------------------------------------------------------------+ */
if (!defined("ACCESS")) {
die ("Direct request denied");
}
class TopCat extends Page {
function TopCat($f) {
$this->f =& $f;
$this->Page($f);
}
function ShowBody() {
$this->parent_albums = $this->f->conn->query($this->get_parent_albums());
if(count($this->parent_albums) > 0) {
echo "\n<table cellspacing=\"0\">\n<tr>\n\t<th>Category Name & Description</th>\n\t<th>Name Of Sub Category</th>\n\t<th>Description Of Sub Category</th>\n\t<th>Number Of Images</th>\n\t<th>Last Image</th>\n</tr>\n";
for ($n=0; $n<count($this->parent_albums); $n++) {
echo "<tr>\n\t<td><a href=\"view_album.php?albumID=".$this->parent_albums[$n]['albumID']."\" title=\"View ".$this->parent_albums[$n]['album_name']."\">".$this->parent_albums[$n]['album_name']."</a><br />".$this->parent_albums[$n]['album_descr']."</td>\n\t<td class=\"nest\" colspan=\"4\">";
$this->albums = $this->f->conn->query($this->get_albums_by_parentID($this->parent_albums[$n]['albumID']));
echo "\n\t<table cellspacing=\"0\">\n"; // begin nested table
if(count($this->albums)==0) {
echo "\t<tr>\n\t\t<td colspan=\"4\">This category does not contain any Sub Categories or Images</td>\n\t</tr>\n";
}
else {
for ($i=0; $i<count($this->albums); $i++) {
echo "\t<tr>\n\t\t<td><a href=\"view_album.php?albumID=".$this->albums[$i]['albumID']."\" title=\"View ".$this->albums[$i]['album_name']."\">".$this->albums[$i]['album_name']."</a></td>\n\t\t<td class=\"left\">".$this->albums[$i]['album_descr']."</td>\n\t\t";
echo "<td class=\"center\">".$this->albums[$i][3]."</td>\n\t\t";
echo "<td class=\"center\">";
$image = $this->f->conn->query($this->get_latest_image($this->albums[$i]['albumID']));
if(!empty($image)) {
$size = @GetImageSize($this->site_path.$this->img_dir.$image[0]['image_url']);
$width = $size[0];
$height = $size[1];
echo "<a href=\"popup.php?albumID=".$this->albums[$i]['albumID']."&imageID=".$image[0]['imageID']."\" onclick=\"window.open(this.href, '_blank', 'resizable=1, location=0, toolbar=0, scrollbars=0, height=".($height+105).", width=".$width."'); return false;\" title=\"View the latest picture - ".$image[0]['caption']." - in this category (".$this->albums[$i]['album_name'].") in a popup window\">View image</a>";
}
else {
echo "None";
}
echo "</td>\n\t</tr>\n";
}
}
echo "\t</table>\n\n\t</td>\n</tr>\n\n"; //end nested table
}
echo "<tr>\n\t<td colspan=\"5\" style=\"width: 100%; text-align: center; font-weight:bold; color: #ccc;\">Powered by <a style=\"font-weight:bold; color: #ccc;\" href=\"http://www.outofthetrees.co.uk/\" title=\"Powered by SelectaPix\">SelectaPix</a></td>\n</tr>\n";
echo "</table>\n\n"; // end outer table
}
else {
echo "<p>No categories have been created.</p>\n";
}
}
}
?>