File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/mvc/controllers/c_cpu_coolers.php
<?php
/**
* c_cpu_coolers.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 2/18/13
*/
/*
* Create category subMenu and blocks
*/
$this->load('/mvc/controllers/c_categories.php');
if(defined('URL_SUB') && URL_SUB != '' && URL_SUB != 'search') $sub = URL_SUB;
// Get Cat Label
$CatDbh = new DatabaseHandler();
$CatDbh->setTableName('page_categorieen_items');
$CatDbh->setData(array('id'=>'','title'=>'','description'=>'','x2_title'=>'','x2_description'=>''));
$CatDbh->setActiveOnly(TRUE,3);
$CatDbh->addRule('id',3);
$CatDbh->setScope(0,1);
if(X2)
{
$CatDbh->addRule('x2',1);
$CatDbh->setOrder('x2_title','ASC');
}
else
{
$CatDbh->setOrder('title','ASC');
}
$catData = $CatDbh->select();
// Catch x2 title
if(X2)
{
$catData['title'] = $catData['x2_title'];
}
if(isset($sub))
{
/*
Load Product Detail
*/
$this->setData('catId',9); // categoryId in database
$this->setData('catLabel',$catData['title']);
$this->setData('catTablename','cpucoolers');
$this->load('mvc/controllers/c_product.php');
}
else if(!defined('URL_SUB') || ( defined('URL_SUB') && URL_SUB == 'search') ) {
/*
Load Dashboard
*/
/*
* Set Filter-slider min and max settings.
* (No user-input, so we can use a regular mysql query)
*/
global $pdo;
$query = 'SELECT MIN(thermalDesignPower),MAX(thermalDesignPower),MIN(noiseLevel1),MAX(noiseLevel2),MIN(ratedSpeed1),MAX(ratedSpeed2)
FROM page_cpucoolers_items AS p, kms_active AS a
WHERE a.active = 1
AND a.pageId = 9
LIMIT 1';
$st = $pdo->prepare($query);
$st->execute();
$result = $st->fetch(PDO::FETCH_ASSOC);
$this->setData('min_wattage', $result['MIN(thermalDesignPower)']);
$this->setData('max_wattage', $result['MAX(thermalDesignPower)']);
$this->setData('min_sound', $result['MIN(noiseLevel1)']);
$this->setData('max_sound', $result['MAX(noiseLevel2)']);
$this->setData('min_speed', $result['MIN(ratedSpeed1)']);
$this->setData('max_speed', $result['MAX(ratedSpeed2)']);
/*
* Set Page Title
*/
$this->setData('page_title', $catData['title'] . ' | Products | '.SITE_NAME);
/*
* Set Breadcrump
*/
$bc = new Breadcrump();
$bc->add('home',SITE_ROOT);
$bc->add('products',SITE_ROOT.'products/');
$bc->add($catData['title'],SITE_ROOT.'cpu-coolers/');
$output = $bc->get();
$this->setData('breadcrump', $output);
/*
* Set Inner Breadcrump
*/
$innerBc = new Breadcrump();
$innerBc->add('categories',SITE_ROOT.'products/');
$innerBc->add($catData['title'],SITE_ROOT.'cpu-coolers/');
$output = $innerBc->getH1();
$this->setData('inner_breadcrump', $output);
/*
* Set Content View Path
*/
$this->setData('content_view_path', 'mvc/views/products/v_cpu_coolers.php');
/*
* Set Javascript Filter.js
*/
$filterOutput = '<script type="text/javascript" src="/js/filter.js"></script>';
$filterOutput .= '<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script>!window.jQuery.ui && document.write(unescape(\'%3Cscript src="/js/jquery-ui.custom.min.js"%3E%3C/script%3E\'))</script>';
$this->setData('jsFilterOutput',$filterOutput);
$this->setData('defaultSearch','search');
if(defined('URL_SUB') && URL_SUB == 'search')
{
if(defined('URL_SUB2'))
{
$searchWord = str_replace('-',' ',URL_SUB2);
$this->setData('defaultSearch',$searchWord);
}
}
}