Location: PHPKode > projects > Content*Builder > modules/menu2/preload.php
<?php
	/* Menu Preloader
	*  Dieses Modul stellt das Tree Objekt zur Verf├╝gung, welches von 
	*  verschiedenen Menus benutzt werden kann
	*/
	
	include($path["cb"]."system/ctree.class.php");
	class MyTree extends FolderTree {
		var $startLevel = 0;
		var $lastSubElement = array();
		var $folderLevel	 = array();
		var $folderStatus	= array();
		var $folderIDSet	 = array();
		var $lastLevel = 1;
		
		function getOpenFolders($openfolder) {
			$this->limitStructure = 1;
			$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);
				}
			}
		}
		
		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") {
				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";
					
					/*
					* Alternative: Unterrubrik nich anklickbar, wenn keine Artikel drin sind
					$articleQuery = mysql_fetch_array(mysql_query("SELECT folder FROM ".TABLE."_article WHERE folder = '$fid' LIMIT 1"));
					$this->folderID[] = $fid;
					if($articleQuery[folder] == $fid) {
						$this->folderIDSet[] = "1";
					} else {
						$this->folderIDSet[] = "2";
					}
					*/
				}
				
				if($fid == $this->openfolder) {
					$this->openfolderName   = $fname;
					$this->folderArtPrint[] = "1";
					$this->folderMatchSpace = ($level * 10) + 4;
					$this->folderMatch = true;
				} else {
					$this->folderArtPrint[]= "0";
				}
				$this->folderName[]  = $fname;
				$this->folderTrueID[]= $fid;
				$this->folderSpace[] = (($level - $this->startLevel) * 10) - 10;
				$this->folderLevel[] = $level;
				
				
				if($this->lastLevel > 1 && $level == 1) {
					$this->lastSubElement[] = 1;
				} else { 
					$this->lastSubElement[] = 1; 
				}
				
				if($this->openThisFolder[$fid] == 1) {
					$this->folderStatus[] = 1;
				} else { 
					$this->folderStatus[] = 0; 
				}
				
				$this->lastLevel = $level;
			}
		}
	}
?>
Return current item: Content*Builder