View file FFDB/category.php

File size: 3.58Kb
<?php
// +----------------------------------------------------------------------+
// |                      Fantastic File Database                         |
// +----------------------------------------------------------------------+
// |                          By Tony Baird                               |
// |                  Copyright (c) 2003 Fantastic Scripts                |
// |                          http://fscripts.com                         |
// +----------------------------------------------------------------------+
// | Fantastic File Database Can be modified freely as long as copyright  | 
// | is intact and this is left at the top of every source file           |
// +----------------------------------------------------------------------+
// | category.php                                                         |
// | Date Started: February 18, 2003                                      |
// | Last Modified: February 18, 2003                                     |
// +----------------------------------------------------------------------+
Class Category {
	function Category() {
		global $tpl,$mysql,$online,$ffdb;
		switch ($_REQUEST['action']) {
			case "delete_category":
				$this->DeleteCategory();
				break;
			case "edit_category":
				$this->EditCategory();
				break;
			default:
				$this->DisplayCategory();
				break;
		}

	}
	//*************************************************/
	// Delete Category Confirm, then delete
	//*************************************************/
	function DeleteCategory() {
	}
	//*************************************************/
	// Edit Category Form
	//*************************************************/
	function EditCategory() {
	}
	//*************************************************/
	// Displays a Category
	//*************************************************/
	function DisplayCategory() {
		global $mysql,$tpl,$ffdb,$online,$online;
		if (!$_REQUEST['id']) {
			$ffdb->Error("You did not select a category");
		}
		$mysql->Query("SELECT * FROM ffdb_sub_categorys WHERE category_id=".$_REQUEST['id']." AND active='Yes' ORDER BY display_order ASC");
		
		
		// Loading Our Templates
		$tpl->LoadTemplate("sub_category_list","templates/$online->skin/sub_category_list.tpl");
		$tpl->LoadTemplate("sub_category_list_top","templates/$online->skin/sub_category_list_top.tpl");
		$tpl->LoadTemplate("sub_category_list_bottom","templates/$online->skin/sub_category_list_bottom.tpl");

		// Setting up the Sub Category List
		while ($show_sub_category=mysql_fetch_array($mysql->result_id)) {
			$ffdb->strip_array($show_sub_category);
			$sub_category_list_array = array(
				'sub_category_name'=> $show_sub_category[sub_category_name],
				'sub_category_description'=> $show_sub_category[sub_category_description],
				'num_files'=> $show_sub_category[num_files],
				'sub_category_id'=> $show_sub_category[sub_category_id]
			);
			$tpl->ParseTemplate("sub_category_list",$sub_category_list_array,"Yes");
			$hasdata="Yes";
		}
		if ($hasdata=="Yes") {
			$tpl->ParseTemplate("sub_category_list_top",$sub_category_list_array_top,"Yes");
			$tpl->ParseTemplate("sub_category_list_bottom",$sub_category_list_array_bottom,"Yes");
			$tpl->ParseTemplate("sub_category_list_top",$sub_category_list_array_top,"Yes");
			$tpl->PrintTemplate("sub_category_list_top");
			$tpl->PrintTemplate("sub_category_list");
			$tpl->PrintTemplate("sub_category_list_bottom");
			$online->CurrentlyBrowsing("Category");
		} else {
			$ffdb->Error("There are currently no sub categorys in this category");
		}
	}
}


?>