Location: PHPKode > projects > Content*Builder > modules/sitemap/sitemap.inc.php
<?php
	/* 
	* Sitemap Modul
	* Modul für die Ausgabe einer SiteMap 
	*
	* @version $Id: sitemap.inc.php,v 1.1 2003/09/17 23:46:57 cb_fog Exp $
	* @copyright 2003 cb_FoG, Jörg Stöber
	*/
	include($path["cb"]."lib/CB_tree.class.php");
	class CMTree extends CB_Tree {
		var $startLevel = 0;
		var $folderLevel	 = array();
		var $folderStatus	= array();
		var $folderID		 = array();
		var $folderIDSet	 = array();
		var $folderSpace	 = array();
		var $folderSort	  = array();
		var $folderExtra	 = array();
		var $folderLoadURL  = array();
		var $lastSubElement = array();
		var $lastLevel = 1;
				
		function getOpenFolders($openfolder, $limitStructure = 1) {
			$this->limitStructure = $limitStructure;
			$this->openThisFolder[$openfolder] = "1";
			$thisLevel  = $this->flatStructure[$openfolder];
			$thisMother = $this->parentStructure[$openfolder];
			if(empty($this->COLUMN_restriction)) {
				if($thisLevel == 1) {
					$this->rootNode = $openfolder;
				}
				if(($thisLevel - 1) > 0) {
					$this->getOpenFolders($thisMother);
				}
			} else {
				if($thisLevel - $this->COLUMN_restrictStatus == 1) {
					$this->rootNode = $openfolder;
				}
				if(($thisLevel - $this->COLUMN_restrictStatus) > 1) {
					$this->getOpenFolders($thisMother, $limitStructure);
				}
			}
		}
		
		function setOpenFolder($openfolder) {
			$this->openfolder = $openfolder;
		}
		
		function setStartLevel($level) {
			$this->startLevel = $level;
		}
		
		function getRootName() {
			$key = $this->rootNode;
			return $this->folder['1'][$key]['fname'];
		}
		
		function printMenu($fid, $fname, $level) {
			if($this->folder[$level][$fid]['writestatus'] != "c") {
				$this->folderName[]	 = $fname;
				
				if($this->folder[$level][$fid]['loadurl'] != "") {
					if(!ereg("^http://", $this->folder[$level][$fid]['loadurl'])) {
						$this->folderID[] = $fid."&load=".$this->folder[$level][$fid]['loadurl'];
						$this->folderIDSet[] = "1";
					} else {
						$this->folderID[] = $this->folder[$level][$fid]['loadurl'];
						$this->folderIDSet[] = "0";
					}
				} else {
					$this->folderID[] = $fid;
					$this->folderIDSet[] = "1";
				}
				
				$this->folderTrueID[]= $fid;
				$this->folderSpace[] = (($level - $this->startLevel) * 10) - 10;
				$this->folderLevel[] = $level;
				$this->folderSort[]	 = $this->nodes[$level][$fid]['sort'];
			}
		}
	
	}
	
	$nav = new CMTree(TABLE."_columns");
	$nav->addFields(
		array ( "parent"      => "mfolder as parent",
				"nodeID"      => "fid as nodeID",
				"name"        => "fname as name",
				"writestatus" => "writestatus",
				"status"      => "SUBSTRING(status,5) as status",
				"sort"        => "SUBSTRING(status,2,3) as sort",
				"loadurl"     => "loadurl",
				"usersallowed"=> "usersallowed",
				"groupsAllowed"=> "groupsAllowed"
		)
	);
	
	$nav->setOrder("ORDER BY status, sort ASC");
	$nav->getData();
	$nav->getTree();
	
	$tpl->assign("MODULE_IMG_DIR", $location."templates/images/");
	
	$tpl->assign("navFolderData", array ( 
		"DEEPNESS"	  => $nav->folderSpace,
		"NAV_FOLDER"  => $nav->folderName,
		"NAV_URL"     => $nav->folderID,
		"NAV_FID"     => $nav->folderTrueID,
		"NAV_FID_SET" => $nav->folderIDSet,
		"FOLDER_ART"  => $nav->folderArtPrint,
		"LASTSUB"	  => $nav->lastSubElement,
		"LEVEL"		  => $nav->folderLevel,
		"STATUS"      => $nav->folderStatus
	));
	
	$articleData = array();
	/* get every article, cause we display the hole site */
	$articleQuery = mysql_query("SELECT ide, title, folder FROM ".TABLE."_article WHERE stage = '3' ORDER BY datum DESC");
	while($articleRow = mysql_fetch_object($articleQuery)) {
		$articleData[$articleRow->folder][title][] = $articleRow->title;
		$articleData[$articleRow->folder][ide][]   = $articleRow->ide;
	}
	$tpl->clear_assign("articleData");
	$tpl->assign("articleData", $articleData);
	
	$tpl->display("sitemap.template");
?>
Return current item: Content*Builder