Skip to content
Snippets Groups Projects
  • Eric Laufer's avatar
    Version 0.0.6 · 470c25c8
    Eric Laufer authored
    - Paid4 Bereich Update
    - Administration Update
    - Login
    - Mneüanzeige (kein Adminbereich)
    - Install update
    - Chat bearbeitet
    - und vieles kleines mehr
    - Bug #10
    470c25c8
menue.class.php 2.11 KiB
<?php
/*
 * Copyright vms1-Scripte
 * $au = Autentifikation (Admin oder User)
 * $sicht = Standartmäßig auf 1 somit wird alles angezeigt
 * $sicht = 2 = nur für Gäste (nicht eingeloggt)
 * 
 * function lkt_rally() muss nichts geändert werden
 * 
 */
class MENUE{
	private $db;
	private $num = 1;
	
	function __construct(){
		global $datenbank;
		$this->db = $datenbank;
	}
	
	function menue_box($au,$sicht = 1){
		if($au == 'Admin'){ $box = B_AD;}elseif($au == 'User'){ $box = B_US;}else{$box = '';}
		$bo = $this->db->get_results("SELECT id,name FROM ".PREFIX . $box ." WHERE sichtbar = '$sicht' ORDER BY ordnung ASC",true);
		foreach($bo AS $b){
			head($b->name);
				$this->menue_punkt($b->id,$au);
			foot();
		}
	}
	
	private function unterpunkte($id,$me){
		$result = $this->db->get_results("SELECT link,name,id FROM ". PREFIX . $me ." WHERE uid = '$id' ");
		$aus = '';
		foreach($result AS $res){
			for($i = 0; $i <= $this->num; $i++){
				$aus .= '&nbsp;&nbsp;&nbsp;';
			}
			$aus .= '<a href="?page=/'. $res->link .'">'. nl2br($res->name) .'</a><br>';
			if($this->db->num_rows("SELECT id FROM ". PREFIX . $me ." WHERE uid = $res->id") != 0){$this->num++; $aus .= $this->unterpunkte($res->id,$me);}
		}
		return $aus;
	}
	
	public function menue_punkt($box,$au){
		if($au == 'Admin'){ $me = M_AD;}elseif($au == 'User'){ $me = M_US;}else{ $au = '';}
		$men = $this->db->get_results("SELECT link,name,id FROM ".PREFIX . $me ." WHERE box = '$box' AND uid = '0' ORDER BY ordnung ASC",true);
		foreach($men AS $m){
			echo '<a href="?page=/'. $m->link .'">'. nl2br($m->name) .'</a><br>';
			if($this->db->num_rows("SELECT id FROM ". PREFIX . $me ." WHERE uid = $m->id") != 0){ $this->num = 1; echo $this->unterpunkte($m->id,$me);}
		}
	}
	
	function lkt_rally(){
		head('LKT-Rallysystem');
			echo '&raquo;&nbsp;<a href="?page=/LKT_Rallysystem"><strong>Rally / Positionen</strong></a><br>';
			$rally = $this->db->get_results("SELECT id,name FROM ".PREFIX . RALLY ."",true);
			foreach($rally AS $r){
				echo '&nbsp;&nbsp;&nbsp;&nbsp;&#8627;&nbsp;<a href="?page=/LKT_Rallysystem&rally= '. $r->id .'">'. $r->name .'></a><br>';
			}
		foot();
	}
}

?>