HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/mvc/controllers/c_product.php
<?php

$page = URL_PAGE;

if(defined('URL_SUB2') && URL_SUB2 != '')
{
    $sub2 = URL_SUB2;
}
else
{
    $sub2 = 'general';
}
/*
 * Category Id has been set by category controller
 */
$catId = $this->getData('catId',FALSE); // categoryId in database
$catTablename = $this->getData('catTablename',FALSE);
$catLabel = $this->getData('catLabel',FALSE);
$tableName = 'page_'.$catTablename.'_items';

/*
 * What fields should we get from the database.
 */
$basic = array('id'=>'', 'productStatus'=>1,'newStatus'=>1,
    'productCode'=>'', 'title'=>'', 'catId'=>'',
    'stock'=>NULL,
    'itemOrder'=>NULL,
    'comment1'=>'','comment2'=>'',
    'unitWeight'=>NULL,'unitDimensionL'=>NULL,'unitDimensionB'=>NULL,'unitDimensionH'=>NULL,
    'packageWeight'=>NULL,'packageDimensionL'=>NULL,'packageDimensionB'=>NULL,'packageDimensionH'=>NULL,
    'masterCarton'=>NULL,'masterCartonDimensionL'=>NULL,'masterCartonDimensionB'=>NULL,'masterCartonDimensionH'=>NULL,
    'quantity'=>NULL,
    'MSRPEuro'=>NULL,'MSRPDollar'=>NULL,'EANCode'=>'',
    'releaseDate'=>NULL,
    'marketingText'=>'','shortSpecs'=>'',
    'thumb'=>0,'timest'=>'');

switch($page)
{
    case 'pc-accessories':
        $specs = array('category'=>'','subCategory'=>'Subcategory','accessories'=>'','adjustment'=>'','airFlow'=>'Air Flow (CFM)','application'=>'','audioDevice'=>'','bearingType'=>'Bearing Type',
            'cableLength'=>'Cable Length','connectorCableType'=>'Connector Cable Type','color'=>'','connectors'=>'','cooling'=>'','dataTransfer'=>'Data Transfer','distortion'=>'', 'fanSizeL'=>'combine_3_xFan Size (cm)', 'fanSizeB'=>'Fan Size (cm)','fanSizeH'=>'Fan Size (cm)','fanType'=>'Fan Type',
            'features'=>'', 'housing'=>'','input'=>'','inputSensitivity'=>'Input Sensitivity','interface'=>'','integratedUsbHub'=>'Integrated USB Hub','lifeHours'=>'Life Hours', 'material'=>'','materialThickness'=>'Material Thickness (mm)',
            'maximumPower'=>'Maximum Power','maximumProtection'=>'Maximum Protection','minimumProtection'=>'Minimum Protection','lifeExpectancy'=>'Life Expectancy',
            'noiseLevel'=>'Noise Level(dBA)','nominalPower'=>'Nominal Power', 'operatingTemperature'=>'Operating Temperature (&deg;C)','operatingVoltageRange'=>'Operating Voltage Range','options'=>'','otherModels'=>'Other Models','output'=>'','packagingIncludes'=>'Packaging Includes','packaging'=>'','packagingType'=>'Packaging Type',
            'power'=>'','powerConsumption'=>'Power Consumption','protectionFeatures'=>'Protection Features','ratedCurrent'=>'Rated Current (A)','ratedPower'=>'Rated Power (W)','ratedSpeed'=>'Rated Speed (RPM) +/- 10%','remark'=>'','sn'=>'S:N (Signal to Noise Ratio)','safetyApprovals'=>'Safety Approvals','specifications'=>'','staticPressure'=>'Static Pressure mmH2O','storageTemperature'=>'Storage Temperature (&deg;C)',
            'supports'=>'', 'thermalInterfaceMaterial'=>'Thermal Interface Material','thermalResistance'=>'Thermal Resistance','thermalType'=>'Thermal Type','totalOutputPower'=>'Total Output Power / RMS (W)','voltage'=>'','warranty'=>'','wiring'=>'',
            'subCategoryStorageInternal'=>'','subCategoryStorageExternal'=>'','subCategoryStorageUsb2'=>'','subCategoryStorageUsb3'=>'');
        break;
    case 'computer-cases':
        $specs = array('accessories'=>'','topPanelConnectionsAudio'=>'Front Panel Connections | Audio','application'=>'',
            'budget'=>'', 'certification'=>'','color'=>'','connectors'=>'', 'cooling'=>'',
            'driveBaysInternal'=>'Drive Bays 2.5"','driveBaysExternal'=>'Drive Bays 3.5"','driveBaysEnternal'=>'Drive Bays 5.25"',
            'expansionSlots'=>'Expansion Slots (rear)', 'fanSizeL'=>'combine_3_xFan Size (cm)','fanSizeB'=>'Fan Size (cm)','fanSizeH'=>'Fan Size (cm)','fanType'=>'Fan Type','features'=>'',
            'formFactor'=>'Form Factor','highAirFlow'=>'High Air Flow','housing'=>'','input'=>'','interface'=>'',
            'invertedStructure'=>'Inverted Structure','lifeExpectancy'=>'Life Expectancy','mainBoardSupport'=>'Main Board Support',
            'mainStream'=>'Mainstream','material'=>'','materialThickness'=>'Material Thickness (mm)','operatingTemperature'=>'Operating Temperature (&deg;C)','options'=>'','packagingIncludes'=>'Packaging Includes','packaging'=>'','packagingType'=>'PackagingType',
            'powerSupplyIncluded'=>'Power Supply Included','powerSupplyWattage'=>'Power Supply Wattage','protectionFeatures'=>'Protection Features','safetyApprovals'=>'Safety Approvals','specifications'=>'', 'storageTemperature'=>'Storage Temperature (&deg;C)', 'supports'=>'',
            'topPanelConnectionsUsb2'=>'Front Panel Connections | USB 2.0','topPanelConnectionsUsb3'=>'Front Panel Connections | USB 3.0','topPanelConnectionsHDD'=>'Front Panel Connections | HDD DOCK','totalOutputPower'=>'Total Output Power / RMS (W)','voltageAc'=>'Voltage AC (INPUT)','voltageDc'=>'Voltage DC (INPUT)','warranty'=>'',
            'windowSidePanel'=>'Window Side Panel');
        break;
    case 'cpu-coolers':
        $specs = array('accessories'=>'','airFlow'=>'Air Flow (CFM)','application'=>'','bearingType'=>'Bearing Type',
            'cableLength'=>'Cable Length','cableType'=>'Cable Type','certification'=>'','color'=>'','connectors'=>'', 'fanSizeL'=>'combine_3_xFan Size (cm)', 'fanSizeB'=>'Fan Size (cm)','fanSizeH'=>'Fan Size (cm)','fanType'=>'Fan Type',

            'fitsSocketTypes'=>'Fits Socket Types','fitsSocketTypesIntel'=>'Intel','fitsSocketTypesAmd'=>'AMD',

            'lifeExpectancy'=>'Life Expectancy (HRS)',
            'mainBoardSupport'=>'Mainboard Support','material'=>'',
            'noiseLevel1'=>'combine_2_~Noise Level (dBA)','noiseLevel2'=>'Noise Level (dBA)',
            'numberOfFans'=>'Number Of Fans (Pre-Installed)','operatingTemperature1'=>'Operating Temperature (&deg;C) From','operatingTemperature2'=>'Operating Temperature (&deg;C) To',
            'options'=>'','otherModels'=>'Other Models','packagingIncludes'=>'Packaging Includes','packagingType'=>'Packaging Type',
            'ratedCurrent'=>'Rated Current (A)','ratedPower'=>'Rated Power (W)',
            'ratedSpeed1'=>'combine_2_~Rated Speed (RPM) +/- 10%','ratedSpeed2'=>'Rated Speed (RPM) +/- 10%','remark'=>'','safetyApprovals'=>'Safety Approvals','specifications'=>'','staticPressure'=>'Static Pressure mmH2O','storageTemperature1'=>'Storage Temperature (&deg;C) From','storageTemperature2'=>'Storage Temperature (&deg;C) To','supports'=>'',
            'thermalDesignPower'=>'Thermal Design Power (W)','thermalInterfaceMaterial'=>'Thermal Interface Material','thermalResistance'=>'Thermal Resistance','thermalType'=>'Thermal Type','voltageDc'=>'Voltage DC (INPUT)','warranty'=>'');
        break;
    case 'mobile-accessories':
        $specs = array('category'=>'','subCategory'=>'','typeSize'=>'Size','accessories'=>'','adjustment'=>'','airFlow'=>'Air Flow (CFM)','application'=>'','bearingType'=>'Bearing Flow',
            'cableLength'=>'Cable Length','cableType'=>'Cable Type','certification'=>'','color'=>'','connectors'=>'','cooling'=>'','dataTransfer'=>'Data Transfer','distortion'=>'', 'fanSizeL'=>'combine_3_xFan Size (cm)', 'fanSizeB'=>'Fan Size (cm)','fanSizeH'=>'Fan Size (cm)','fanType'=>'Fan Type',
            'features'=>'', 'frequency'=>'', 'holdUpTime'=>'Hold Up Time','housing'=>'','input'=>'','inputSensitivity'=>'Input Sensitivity','interface'=>'','integratedUsbHub'=>'Integrated USB Hub','lifeExpectancy'=>'Life Expectancy (HRS)', 'material'=>'','materialThickness'=>'Material Thickness (mm)',
            'maximumPower'=>'Maximum Power','maximumProtection'=>'Maximum Protection','minimumProtection'=>'Minimum Protection',
            'noiseLevel'=>'Noise Level (dBA)','nominalPower'=>'Nominal Power ', 'operatingTemperature'=>'Operating Temperature (&deg;C)','operatingVoltageRange'=>'Operating Voltage Range','options'=>'','otherModels'=>'Other Models','output'=>'','packagingIncludes'=>'Packaging Includes','packaging'=>'','packagingType'=>'Packaging Type',
            'power'=>'','powerConsumption'=>'Power Consumption','protectionFeatures'=>'Protection Features','pgSignal'=>'P.G. Signal','ratedCurrent'=>'Rated Current (A)','ratedPower'=>'Rated Power (W)','ratedSpeed'=>'Rated Speed (RPM) +/- 10%','remark'=>'',
            'sn'=>'S:N (Signal to noise ratio)','safetyApprovals'=>'Safety Approvals','specifications'=>'','staticPressure'=>'Static Pressure mmH20','storageTemperature'=>'Storage Temperature (&deg;C)',
            'supportsNotebookSize'=>'Supports Notebook Size (inch)', 'thermalInterfaceMaterial'=>'Thermal Interface Material','thermalResistance'=>'Thermal Resistance','thermalType'=>'Thermal Type','totalOutputPower'=>'Total Output Power / RMS (W)',
            'voltageAcInput'=>'Voltage AC (INPUT)','voltageDcInput'=>'Voltage DC (INPUT)','voltageAcOutput'=>'Voltage AC (OUTPUT)','voltageDcOutput'=>'Voltage DC (OUTPUT)','voltageProtection'=>'Voltage Protection',
            'warranty'=>'','wiring'=>'');
        break;
    case 'power-supplies':
        $specs = array('formFactorType'=>'Form Factor Type','accessories'=>'',
            'autoFanSpeed'=>'Auto Fan Speed','bearingType'=>'Bearing Type',
            'budget'=>'','cableLength'=>'Cable Length', 'cableType'=>'Cable Type', 'certification'=>'',
            'color'=>'','connectors'=>'','cooling'=>'', 'dualRail'=>'Dual Rail 12V','efficiency'=>'', 'fanSizeL'=>'combine_3_xFan Size (cm)', 'fanSizeB'=>'Fan Size (cm)','fanSizeH'=>'Fan Size (cm)','fanType'=>'Fan Type',
            'features'=>'', 'frequency'=>'', 'gaming'=>'','holdUpTime'=>'Hold Up Time','housing'=>'',
            'ledFan'=>'LED Fan', 'lifeExpectancy'=>'Life Expectancy (HRS)', 'material'=>'', 'materialThickness'=>'Material Thickness (mm)',
            'modularCables'=>'Modular Cables','noiseLevel'=>'Noise Level (dBA)',
            'nominalPower'=>'Nominal Power (w)','operatingTemperature'=>'Operating Temperature (&deg;C)', 'packagingIncludes'=>'Packaging Includes', 'packaging'=>'','packagingType'=>'Packaging Type', 'pgSignal'=>'P.G. Signal','ratedCurrent'=>'Rated Current (A)','remark'=>'',
            'silent'=>'','specifications'=>'','storageTemperature'=>'Storage Temperature (&deg;C)','totalOutputPower'=>'Total Output Power / RMS (W)',
            'voltageAcInput1'=>'combine_2_~Voltage AC (INPUT) ','voltageAcInput2'=>'Voltage AC (INPUT) ','voltageDcInput1'=>'combine_2_~Voltage DC (INPUT)','voltageDcInput2'=>'Voltage DC (INPUT)','voltageProtection'=>'Voltage Protection','warranty'=>'','voltageImageLarge'=>'');
        break;
    case 'system-cooling':
        $specs = array('accessories'=>'','airFlow'=>'AirFlow (CFM)','application'=>'','bearingType'=>'Bearing Type',
            'certification'=>'','color'=>'','connectors'=>'',
            'fanSizeL'=>'combine_3_xFan Size (cm)','fanSizeB'=>'Fan Size B (cm)','fanSizeH'=>'Fan Size H (cm)','fanType'=>'Fan Type','features'=>'',
            'ledColor'=>'LED Color','lifeExpectancy'=>'Life Expectancy (HRS)','material'=>'',
            'noiseLevel1'=>'combine_2_~Noise Level (dBA)','noiseLevel2'=>'Noise Level (dBA)','operatingTemperature'=>'Operating Temperature (&deg;C)','packagingIncludes'=>'Packaging Includes','packagingType'=>'Packaging Type',
            'pwm'=>'PWM(Pulse Width Modification)','ratedCurrent'=>'Rated Current (A)','ratedPower'=>'Rated Power (W)','ratedSpeed1'=>'combine_2_~Rated Speed (RPM) +/- 10%','ratedSpeed2'=>'Rated Speed (RPM) +/- 10%',
            'remark'=>'','specifications'=>'','staticPressure'=>'Static Pressure mmH2O', 'storageTemperature'=>'Storage Temperature (&deg;C)',
            'voltageAc'=>'Voltage AC (INPUT)','voltageDc'=>'Voltage DC (INPUT)','warranty'=>'Warranty');
        break;
    case 'tablet-pc':
        $specs = array('features'=>'','gpu'=>'GPU','processor'=>'','touchControl'=>'Touch Control','resolution'=>'','display'=>'Display (inch)','wifi'=>'','3g'=>'3G','workingTime'=>'Working Time','videoPlayer'=>'Video Player','imageViewer'=>'Image Viewer','nandFlash'=>'Nand Flash','expansionMemory'=>'Expansion Memory','gSensor'=>'G-Sensor','packagingIncludes'=>'','ram'=>'RAM','camera'=>'','audioPlayer'=>'Audio Player','batteryCapacity'=>'Battery Capacity','cpu'=>'CPU','dimensions'=>'','ratedVoltage'=>'Rated Voltage','colors'=>'','osSupport'=>'OS Support','output'=>'','interface'=>'');
        break;
// Rolf wilde op het laatste moment vertalingen van de columnnamen, om tijd en budget is gekozen de database kolommen hetzelfde te houden en simpelweg een andere display te tonen.
    case 'ergonomics':
        $specs = array('features'=>'','gpu'=>'Type','processor'=>'Accessoires','touchControl'=>'Adjustment','resolution'=>'Application','display'=>'Display (inch)','wifi'=>'Version','3g'=>'Housing','workingTime'=>'Shape','videoPlayer'=>'Material','imageViewer'=>'Life expectancy','nandFlash'=>'Operating temperature','expansionMemory'=>'Packaging','gSensor'=>'Packaging type','packagingIncludes'=>'','ram'=>'Adjustable','camera'=>'Assembly','audioPlayer'=>'Capacity','batteryCapacity'=>'Clamp','cpu'=>'Angle','dimensions'=>'','ratedVoltage'=>'Connection','colors'=>'','osSupport'=>'OS Support','output'=>'Warranty','interface'=>'');
        break;
    case 'led':
        $specs = array('features'=>'','type'=>'','accessories'=>'','adjustment'=>'','application'=>'','solarPanel'=>'','beamAngle'=>'','bodyType'=>'','luminousFlux'=>'','luminousEfficiency'=>'','ledQuantity'=>'LED quantity','ledModule'=>'LED module','ledModulePower'=>'LED module power','housing'=>'','battery'=>'','material'=>'','lifeExpectancy'=>'','lifetimeHours'=>'','operatingHumidity'=>'','operatingTemperature'=>'','storageTemperature'=>'','power'=>'Power (W)','current'=>'Current (A)','packaging'=>'','packagingType'=>'','packagingIncludes'=>'','chargingTime'=>'','lightingTime'=>'','waterproofGrade'=>'','dimensions'=>'','connection'=>'','colourTemperature'=>'','lumen'=>'','voltage'=>'','certifications'=>'','pf'=>'','cri'=>'','version'=>'','warranty'=>'','lightingModel'=>'','remark'=>'');
        break;
}

$fields = array_merge($basic,$specs);

/*
 * Get the id of the current product by comparing the GET-variable Sub2 in the link with the Database.
 * The link is build like this: title-productCode
 */
$Dbh = new DatabaseHandler();
$Dbh->setTableName($tableName);
$Dbh->setData($fields);
$Dbh->setActiveOnly(TRUE,$catId);
X2 ? $Dbh->addRule('x2','1') : $Dbh->addRule('x2','1','AND NOT');
$data = $Dbh->select();

/*
 * Correct if $Dbh->select() returns one item
 */
if(!empty($data))
{
    if(!is_array($data[key($data)])) $data = array($data);
    /*
     * Check what item is equal to current Item
     */
    $currentLinkTitle = '';
    $maxItemOrder = '';
    $currentItemOrder = '';
    $activeKey = 0;
    $numProductsAfterActive = 0;
    $found = false;
    if(defined('URL_SUB') && URL_SUB != '')
    {
        foreach($data as $key => $info)
        {
            // if set active Key
            if($activeKey != 0)
            {
                $numProductsAfterActive++;
            }
            $currentLinkTitle = URL_SUB;
            $thisLinkTitle = $this->encodeUrl($info['title']).'-'.$this->encodeUrl($info['productCode']);

            $maxItemOrder = $info['itemOrder'];
            if($thisLinkTitle == $currentLinkTitle)
            {
                $found = true;
                $activeKey = $key+1;
                /*
                 * Set data for each field
                 */
                $currentItemOrder = $info['itemOrder'];
                foreach($info as $field => $value)
                {
                    $this->setData('pd'.ucfirst($field), $value); //pd = productDetail
                }
            }
        }
        $activeKey--;
    }

    if( ! $found)
    {
        $this->notFound();
    }


    $itemId = $this->getData('pdId',FALSE);

    /*
     * Get Images
     */
    $ImageDbh = new DatabaseHandler();
    $ImageDbh->setTableName('page_'.$catTablename.'_images');
    $ImageDbh->setData(array('kms_thumb'=>'','filename_original'=>''));
    $ImageDbh->setOrder('imageOrder','DESC');
    $ImageDbh->addRule('itemId',$itemId);
    $imageData = $ImageDbh->select();
    if(!is_array($imageData[key($imageData)])) $imageData = array($imageData);

    $title = $this->getData('pdTitle',FALSE);
    $thumbOutput = '';
    $sliderOutput = '';
    foreach($imageData as $key => $image)
    {
        $thumbOutput .= '<li id="counter'.($key+1).'"><img src="'.IMAGE_ROOT.'uploads/'.$image['kms_thumb'].'" alt="'.$catLabel.' | '.$title.'" /></li>';
        $sliderOutput .= '<li><img src="'.IMAGE_ROOT.'uploads/'.$image['filename_original'].'" alt="'.$catLabel.' | '.$title.'" /></li>';
    }
    $this->setData('imageThumbList', $thumbOutput);
    $this->setData('imageSliderList', $sliderOutput);

    /*
        * Get Downloads
    */
    $downloadOutput = '';
    $hasDownloads = FALSE;
    $DocDbh = new DatabaseHandler();
    $DocDbh->setTableName('page_'.$catTablename.'_docs');
    $DocDbh->setData(array('title'=>'','filename'=>''));
    $DocDbh->addRule('itemId',$itemId);
    $docData = $DocDbh->select();
    if(!empty($docData))
    {
        if(!is_array($docData[key($docData)])) $docData = array($docData);
        foreach($docData as $key => $doc)
        {
            if(!empty($doc))
            {
                if(empty($doc['title'])) $doc['title'] = $doc['filename'];
                $downloadOutput .= '<h3>'.$doc['title'].'</h3>';
                $downloadOutput .= '<a class="ctaButton" href="'.IMAGE_ROOT.'uploads/'.$doc['filename'].'" target="_blank"><span class="text">Download</span><span class="left"><span class="up"></span><span class="hover"></span></span><span class="right"><span class="up"></span><span class="hover"></span></span></a><br />';
                $downloadOutput .= '<div class="clear_both"></div><br /><br />';
                $hasDownloads =TRUE;
            }
        }
    }

    /*
     * Product Info ( General / Specs / Downloads )
     */
    $prodInfoOutput = '';

    switch($sub2)
    {
        case 'general':
            $prodInfoOutput .= '<div class="marketingText">
                            <h3>'.$this->getData('pdTitle',FALSE).'</h3>
                            '.$this->getData('pdMarketingText',FALSE).'<br /><br />
                            <a class="ctaButton wtbPopUp" href="/mvc/views/v_wtb_pop_up.php?id='. $this->getData('pdId',FALSE) . '&catId='. $catId . '" title="Where to buy"><span class="text">Where to buy</span><span class="left"><span class="up"></span><span class="hover"></span></span><span class="right"><span class="up"></span><span class="hover"></span></span></a>
                        </div>
                        <div class="shortSpecifications">';
                        $shortSpecs = $this->getData('pdShortSpecs',FALSE);
                        $checkShortSpecs = strip_tags($shortSpecs);
                        $checkShortSpecs = trim($checkShortSpecs);
                        if(!empty($checkShortSpecs))
                        {
                            $prodInfoOutput .= '<h3>Short specifications</h3>';
                            $prodInfoOutput .= $shortSpecs;
                        }
                        $prodInfoOutput .= '</div>';
            break;
        case 'specs':
            $prodInfoOutput .= '<table cellpadding="5" cellspacing="0">';
            $i = 0;

            $addToSpecs = array(
                'EANCode'=>'EAN','MSRPEuro'=>'MSRP (Euro, in VAT)','MSRPDollar'=>'MSRP (Dollar, in VAT)',
                'masterCarton'=>'Master Carton','masterCartonDimensionL'=>'combine_3_xMaster Carton Dimension (cm)','masterCartonDimensionB'=>NULL,'masterCartonDimensionH'=>NULL,
                'packageWeight'=>'Package Weight','packageDimensionL'=>'combine_3_xPackage Dimension (cm)','packageDimensionB'=>NULL,'packageDimensionH'=>NULL,
                'quantity'=>'Quantity (PCS) / Block Pallet',
                'releaseDate'=>'Release Date','unitWeight'=>'Unit Weight','unitDimensionL'=>'combine_3_xUnit Dimension (cm)','unitDimensionB'=>NULL,'unitDimensionH'=>NULL);

            $specs = array_merge($addToSpecs,$specs);

            foreach($specs as $fields => $label)
            {
                $value = $this->getData('pd'.ucfirst($fields),FALSE);

                /* Catch 1 / 0  ->  Yes / No Conversion */
                $convertFields = array('highAirFlow','windowSidePanel','budget','mainStream','invertedStructure','powerSupplyIncluded','topPanelConnectionsHDD','autoFanSpeed','dualRail','gaming','ledFan','modularCables','silent','pwm', 'cameraFront', 'cameraBack');
                if(in_array($fields,$convertFields))
                {
                    if ( $value == '1' )
                    {
                        $value = 'Yes';
                    }
                    else
                    {
                        $value = 'No';
                    }
                }

                /* Convert none */
                $convertNone = array('efficiency');
                if(in_array($fields,$convertNone))
                {
                    if(strtolower($value) == 'none') $value = null;
                }

                /* Convert dates */
                $convertDates = array('releaseDate');
                if(in_array($fields,$convertDates))
                {
                    $timest = (int)$value;
                    $value = date('m / d / Y',$timest);
                }

                /* Dollar & Euro */
                if($fields == 'MSRPDollar')
                {
                    $value = '&#36; ' . $value;
                }
                if($fields == 'MSRPEuro')
                {
                    $value = '&euro; ' . $value;
                }

                if(!empty($value) && $fields != 'voltageImageLarge')
                {

                    /* Catch combined fields */
                    if(substr($label,0,7) == 'combine')
                    {
                        $howMany = substr($label,8,1);
                        $combiner = substr($label,10,1);
                        $_SESSION['combine']['label'] = substr($label,11);
                        $_SESSION['combine']['toGo'] = $howMany;
                        $_SESSION['combine']['combiner'] = $combiner;
                        $_SESSION['combine']['value'] = $value;
                        $_SESSION['combine']['first'] = true;
                    }

                    if( ! isset($_SESSION['combine']))
                    {
                        if(empty($label)) $label = ucfirst($fields);

                        $prodInfoOutput .= '<tr';
                        if($i%2==0)  $prodInfoOutput .= ' class="alt"';
                        $prodInfoOutput .= '><td class="spec_label">'.$label.'</td><td class="spec_value">'.$value.'</td>';
                        $i++;
                    }
                    else
                    {
                        if($_SESSION['combine']['toGo'] == 1)
                        {
                            if($_SESSION['combine']['first'])
                            {
                                $_SESSION['combine']['first'] = false;
                            }
                            else
                            {
                                $_SESSION['combine']['value'] .= ' ' . $_SESSION['combine']['combiner'] . ' ' . $value;
                            }

                            //display combined value
                            $prodInfoOutput .= '<tr';
                            if($i%2==0)  $prodInfoOutput .= ' class="alt"';
                            $prodInfoOutput .= '><td class="spec_label">'.$_SESSION['combine']['label'].'</td><td class="spec_value">'.$_SESSION['combine']['value'].'</td>';
                            $i++;
                            unset($_SESSION['combine']);
                        }
                        else
                        {
                            if($_SESSION['combine']['first'])
                            {
                                $_SESSION['combine']['first'] = false;
                            }
                            else
                            {
                                $_SESSION['combine']['value'] .= ' ' . $_SESSION['combine']['combiner'] . ' ' . $value;
                            }
                            $_SESSION['combine']['toGo']--;
                        }
                    }
                }
            }
            $prodInfoOutput .= '</table>';

            $image = $this->getData('pdVoltageImageLarge',FALSE);
            if( ! empty($image))
            {
                $prodInfoOutput .= '<br /><img src="'. IMAGE_ROOT . 'uploads/' . $image . '" alt="Voltage Table"/><br />
                                    Voltage table';
            }

            break;
        case 'downloads':
              $prodInfoOutput .= $downloadOutput;
            break;
    }
    $this->setData('productInfo',$prodInfoOutput);
    $this->setData('hasDownloads',$hasDownloads);

    /*
     * Set Breadcrump
     */
    $bc = new Breadcrump();
    $bc->add('home',SITE_ROOT);
    $bc->add('products',SITE_ROOT.'products/');
    $bc->add($catLabel,SITE_ROOT.URL_PAGE.'/');
    $bc->add($this->getData('pdProductCode',FALSE),SITE_ROOT.URL_PAGE.'/'.$currentLinkTitle.'/');
    $output = $bc->get();
    $this->setData('breadcrump', $output);

    /*
     * Set Inner Breadcrump
     */
    $innerBc = new Breadcrump();
    $innerBc->add('categories',SITE_ROOT.'products/');
    $innerBc->add($catLabel,SITE_ROOT.URL_PAGE.'/');
    $innerBc->add($this->getData('pdTitle',FALSE),SITE_ROOT.URL_PAGE.'/'.$currentLinkTitle.'/');
    $output = $innerBc->getH1();
    $this->setData('inner_breadcrump', $output);

    /*
     * Set Page META data
     */
    $this->setData('page_title', $this->getData('pdTitle',FALSE).' | ' . $catLabel . ' | Products | '.SITE_NAME);

    $desc = strip_tags($this->getData('pdMarketingText',FALSE));
    $desc = substr($desc,0,250) . '&hellip;';
    $this->setData('page_desc', $desc) ;
}

/*

    RELATED PRODUCTS

*/
// Get total products
$totalProducs = count($data);
if(count($data) > 7)
{
    $numRelated = 6;
}
else
{
    $numRelated = count($data)-1;
}

$numProductsLeftOver = $numRelated - $numProductsAfterActive;
// add related keys to array
$relatedKeys = array();
for($i=($activeKey+1); $i<(($activeKey+1)+$numProductsAfterActive);$i++)
{
    $relatedKeys[] = $i;
}

if($numProductsLeftOver > 0)
{
    for($i=0; $i< $numProductsLeftOver;$i++)
    {
        $relatedKeys[] = $i;
    }
}

$relatedList = '';
foreach($relatedKeys as $key)
{
    $ImageDbh = new DatabaseHandler();
    $ImageDbh->setTableName('page_'.$catTablename.'_images');
    $ImageDbh->setData(array('filename_thumb'=>''));
    $ImageDbh->setOrder('imageOrder','DESC');
    $ImageDbh->addRule('id',$data[$key]['thumb']);
    $imageData = $ImageDbh->select();
    if(isset($imageData['filename_thumb']))
    {
    $imageData['filename_thumb'] = IMAGE_ROOT.'uploads/'.$imageData['filename_thumb'];

    $linkTitle = $this->encodeUrl($data[$key]['title']).'-'.$this->encodeUrl($data[$key]['productCode']);
    $relatedList .= '<li>
                       <a href="'.SITE_ROOT.URL_PAGE.'/'.$linkTitle.'/" title="'.$data[$key]['title'].'" class="image" style="background-image:url('.$imageData['filename_thumb'].')"><div class="shadow"></div><div class="labelDown"></div></a>
                        <div class="content">
                            <a class="main" href="'.SITE_ROOT.URL_PAGE.'/'.$linkTitle.'/">'.$data[$key]['title'].'<br /><span>'.$data[$key]['productCode'].'</span></a>
                            <p>'.$data[$key]['comment1'].'<br />'.$data[$key]['comment2'].'</p>
                        </div>
                    </li>';
    }
}
if(!empty($relatedList))
{
    $relatedOutput = '
    <h2>Related products</h2>

    <div id="relatedProducts">
        <div id="relatedProductsFrame">
            <ul id="blockItemList" class="withCodeAndDescription">
                '.$relatedList.'
            </ul>
            </div>';
    if(count($relatedKeys) > 3) $relatedOutput .= '<div class="arrowLeft"></div>';
    if(count($relatedKeys) > 3) $relatedOutput .= ' <div class="arrowRight"></div>';
    $relatedOutput .= '<div class="clickLeft" id="relatedPrev"></div>
            <div class="clickRight" id="relatedNext"></div>
            </div>';
    $this->setData('relatedProducts',$relatedOutput);
}
/*
    GET AWARDS
*/

/*
 * Get last awards from database
 */
//convert pageId naar catId
$convert = array('11'=>'1','10'=>'2','9'=>'3','12'=>'6','8'=>'7','7'=>'8','16'=>'9','18'=>'10','19'=>'11');

$AwardDbh = new DatabaseHandler();
$AwardDbh->setTableName('page_awards_items');
$AwardDbh->setData(array('id'=>'','title'=>'','description'=>'','timest'=>'','link'=>''));
$AwardDbh->addRule('categoryId',$convert[$catId]);
$AwardDbh->addRule('productId',$this->getData('pdId',FALSE));
$AwardDbh->setActiveOnly(TRUE,2);
$awardData = $AwardDbh->select();
//correct if one

unset($_SESSION['popup_awards']);

if(! empty($awardData))
{
    $firstKey = key($awardData);
    if(!is_array($awardData[$firstKey])) $awardData = array($awardData);
    $awardList = '';

    $_SESSION['popup_awards'] = array();

    foreach($awardData as $key => $data)
    {
        /*
         * Get thumbnail
         */
        $ImageDbh = new DatabaseHandler();
        $ImageDbh->setTableName('page_awards_images');
        $ImageDbh->setData(array('filename_thumb'=>''));
        $ImageDbh->setOrder('imageOrder','DESC');
        $ImageDbh->addRule('itemId',$data['id']);
        $awardImageData = $ImageDbh->select();

        /*
         * Manipulate data
         */
        $linkTitle = $this->encodeUrl($data['title']);

        setlocale(LC_ALL, 'nl_NL');
        $date = strftime("%B %Y", $data['timest']);

        // needed for popup
        $popup = array();
        $popup['title'] = $data['title'];
        $popup['description'] = $data['description'];
        $popup['link'] = $data['link'];
        $popup['thumb'] = $awardImageData['filename_thumb'];
        $_SESSION['popup_awards'][$data['id']] = $popup;

        $awardImageData['filename_thumb'] = '<a href="/mvc/views/v_award_pop_up.php?id='. $data['id'].'" title="'.$data['title'].'" class="adwardPopUp"><img src="'.IMAGE_ROOT.'uploads/'.$awardImageData['filename_thumb'].'" alt="'.$data['title'].'" /></a>';
        $awardList .= '<li><div class="image"><div class="shadow"></div>'.$awardImageData['filename_thumb'].'</div><div class="labelDownRight"></div></li>';
    }
}




/*
 * Set Javascript actions
 */
$jsOutput = '';
$jsOutput .= '<script type="text/javascript" src="/js/GridSlider.js"></script>
              <script type="text/javascript" src="/js/VerticalGridSlider.js"></script>
              <script type="text/javascript">
                    /*
                     * Initialize Slider
                     */
                    var gridSlider = new GridSlider(\'#blockItemList\');
                    gridSlider.init();

                    var awardGridSlider = new VerticalGridSlider(\'#awardItemList\');
                    awardGridSlider.init();';

// if isset session, set gridslider
if(isset($_SESSION['gridSlider']))
{
    $jsOutput .=  '$(document).scrollTop('.$_SESSION['gridSlider']['top'].');';
    $jsOutput .=  'gridSlider.set('.$_SESSION['gridSlider']['index'].','.$_SESSION['gridSlider']['hiddenLeft'].','.$_SESSION['gridSlider']['hiddenRight'].');';
    $jsOutput .=  'gridSlider.slide('.$_SESSION['gridSlider']['index'].');';
    unset($_SESSION['gridSlider']);
}
$jsOutput .= '</script>';
$this->setData('jsOutput',$jsOutput);

/*
 * Set Data
 */
if($awardData)
{
$awardOutput = '<div id="productAwards">
                    <span class="title">Awards</span>
                    <div class="clear_both"></div>
                    <div class="scrollUp" id="scrollUp"><div class="shadow"></div><div class="arrow"></div></div>
                    <div class="clear_both"></div>
                    <div id="awardListHolder">
                        <ul id="awardItemList" class="disableSelection">' . $awardList . '</ul>
                    </div>
                    <div class="scrollDown" id="scrollDown"><div class="shadow"></div><div class="arrow"></div></div>
                </div>';

$this->setData('award_list', $awardOutput);
}

/*
 * Set Content View Path
 */
$this->setData('content_view_path', 'mvc/views/v_product.php');