File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/mvc/controllers/c_main.php
<?php
/**
* Template
* Main Controller. Provide information we need everywhere.
*
* Created By: Komma Mediadesign
* Author: Mike van der Sanden
* January 2013
*
*/
/* Get latest newsItem for news links */
/*
* Get all newsItems from database
*/
$NewsDbh = new DatabaseHandler();
$NewsDbh->setTableName('page_nieuws_items');
$NewsDbh->setData(array('title'=>''));
$NewsDbh->setActiveOnly(TRUE,1);
$NewsDbh->setScope(0,1);
X2 ? $NewsDbh->addRule('x2',1) : $NewsDbh->addRule('x2',1, 'AND NOT') ;
$newsData = $NewsDbh->select();
$linkTitle = $this->encodeUrl($newsData['title']);
define('LATEST_NEWSITEM',$linkTitle);
include DOCUMENT_ROOT.'mvc/models/m_navigation.php';
/*
* Create Navigation (Main menu)
*/
$Nav = new Navigation();
$Nav->addLine('Home','_root');
$Nav->addLine('Company');
$Nav->addLine('Products');
$Nav->addLine('Media','media/news/' . LATEST_NEWSITEM );
$Nav->addLine('Support','support/product-registration');
if(X2)
{
$Nav->addLine('Marketing','reseller/marketing-tools');
}
else
{
$Nav->addLine('Reseller');
}
$Nav->addLine('Contact');
$output = $Nav->display(FALSE);
$this->setData('main_nav',$output);
/*
* Create Navigation (Disclaimer)
*/
$Nav = new Navigation();
$Nav->addLine('sitemap');
$Nav->addLine('privacy policy');
$Nav->addLine('conditions','terms-and-conditions');
$output = $Nav->display(FALSE);
$this->setData('footer_sub_nav',$output);
/*
* Footer
*/
$footerCat = '';
$CatDbh = new DatabaseHandler();
$CatDbh->setTableName('page_categorieen_items');
$CatDbh->setData(array('id'=>'','title'=>'','description'=>'','x2_title'=>'','x2_description'=>''));
$CatDbh->setActiveOnly(TRUE,3);
$CatDbh->setScope(0,8);
if(X2)
{
$CatDbh->addRule('x2',1);
$CatDbh->setOrder('x2_title','ASC');
}
else
{
$CatDbh->setOrder('title','ASC');
}
if($catData = $CatDbh->select())
{
if ( ! is_array($catData[key($catData)])) $catData = array($catData);
foreach($catData as $key => $data)
{
$linkTitle = $this->encodeUrl($data['title']);
// Catch x2 title
if(X2)
{
$data['title'] = $data['x2_title'];
}
$footerCat .= '<li><a href="/' . $linkTitle . '/">' . $data['title'] . '</a></li>';
}
}
$this->setData('footer_cat_nav',$footerCat);