File: D:/HostingSpaces/SBogers10/ilysium.komma.pro/wwwroot/lib/general/menu.class.php
<?php
/**
* menu.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 12/02/14
*/
class Menu
{
private $_pages = array();
// Language
private $_lang = array();
private $_urls = array();
public function __construct()
{
// Set language and url for conversion
$Translator = new Translator(URL_LANG);
$this->_lang = $Translator->get();
$this->_urls = $Translator->getUrls();
// Get all the pages
$this->_pages = array('about','private_sauna','sauna_treatment','me_time','skin_care','gallery','gift_card','contact');
}
/*
* Create Main Menu
*/
public function createMain()
{
// Start output with home
$output = '<li';
if( ! defined('URL_PAGE')) $output .= ' class="active"';
$output .= '><a class="title" href="/">Home</a></li>';
// Generate output for pages
foreach($this->_pages as $page)
{
// Get Label
$label = ucfirst($page);
if(isset($this->_lang[$page])) $label = $this->_lang[$page];
// Get Url
$url = $page;
// Search in URLS
if(isset($this->_urls[$page]))
{
$url = $this->_urls[$page];
}
// Search in LANG
else if(isset($this->_lang[$page]))
{
$label = $this->_lang[$page];
$url = Fn::encodeUrl($label);
}
// Add to output
$output .= '<li';
if( defined('URL_PAGE') && URL_PAGE == $url) $output .= ' class="active"';
$output .= '><a class="title" href="' . LANG_ROOT . $url . '" >' . $label . '</a>';
// SUB PRIVE
if(defined('URL_PAGE') && URL_PAGE == 'prive-sauna' && $page == 'private_sauna')
{
$output .= '<ul class="sub">';
$output .= '<li'; if(! defined('URL_SUB')) $output .= ' class="active"'; $output .= '><a href="/prive-sauna">Privé sauna</a></li>';
$output .= '<li'; if(defined('URL_SUB') && URL_SUB == 'massages') $output .= ' class="active"'; $output .= '><a href="/prive-sauna/massages">Massages</a></li>';
$output .= '</ul>';
}
$output .= '</li>';
}
return $output;
}
}