File: D:/HostingSpaces/SBogers10/tops.komma.pro/wwwroot/app/controllers/c_basic_page.class.php
<?php
/**
* c_basic_page.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 11/02/14
*/
require_once DOCUMENT_ROOT . 'lib/content/content_generator.class.php';
require_once DOCUMENT_ROOT . 'lib/general/submenu_tracker.class.php';
class Basic_Page extends Controller
{
/*
* Content Object
*/
private $_Content;
/*
* Name of the page
*/
private $_name;
/*
* Constructor
*/
public function __construct()
{
parent::__construct();
// Get Page name
$Translator = new Translator(URL_LANG);
$this->_name = $Translator->convert(URL_PAGE);
// Create content object
$this->_Content = new Content_Generator($this->_name);
}
/*
* Load the requested page
*/
public function index()
{
// Title
$title = $this->Model->getPageTitle();
$this->View->setData('page_title', $title);
// Breadcrump
$bc = $this->Model->getBreadcrumb();
$this->View->setData('breadcrumb', $bc);
// Javascript
$js = '<script type="text/javascript" src="/public/js/tops_slider_template.js"></script>';
$js .= '<script type="text/javascript" src="/public/js/tops_template.js"></script>';
// Generate output
if($data = $this->_Content->generate())
{
foreach($data as $key => $value)
{
// Set data for the view
$this->View->setData($key, $value);
}
}
// What to do with the submenu
$Tracker = new Submenu_Tracker();
$class = $Tracker->getClass();
if( ! $Tracker->checkNew())
{
$js .= '<script type="text/javascript">setTimeout(function(){$(\'#main\').removeClass(\'open_submenu\');},100);</script>';
}
else
{
$js .= '<script type="text/javascript">setTimeout(function(){$(\'#main\').addClass(\'open_submenu\');},100);</script>';
}
// Set javascript for the view
$this->View->setData('js_output', $js);
// Get file for submenu
$file = $Tracker->getFile();
// Set submenu data
$this->View->setData('submenu_class', $class);
$this->View->setData('submenu_file', $file);
// Render template view
$this->View->render('v_template');
}
}