File: D:/HostingSpaces/SBogers10/spire.komma-mediadesign.nl/wwwroot/kms/client/models/products/m_led.php
<?php
/*
*
* Class for products in this category.
* It is included in the corresponding controller.
*
*/
class LedModel extends Product
{
public function __construct()
{
$this->tableName = 'page_led_items';
$this->dbh = new DatabaseHandler();
$this->dbh->setTableName($this->tableName);
$fields = array('features','type','accessories','adjustment','application','solarPanel','beamAngle','bodyType','luminousFlux','luminousEfficiency','ledQuantity','ledModule','ledModulePower','housing','battery','material','lifeExpectancy','lifetimeHours','operatingHumidity','operatingTemperature','storageTemperature','power','current','packaging','packagingType','packagingIncludes','chargingTime','lightingTime','waterproofGrade','dimensions','connection','colourTemperature','lumen','voltage','certifications','pf','cri','version','warranty','lightingModel','remark');
$this->specs = array_fill_keys($fields,'');
$this->dataSession = new DataSession('specs_to_store',$this->specs);
global $template;
$this->lang = $template->lang;
}
/**
* This function validates the specifications of this class.
* Check for values that should be numeric.
*/
public function validateSpecs()
{
// save values
$this->dataSession->savePost();
$specsValid = FALSE;
/*
* Check if all required fields are filled.
*/
/*$required = array();
foreach($required as $field => $value)
{
$value = trim($_POST[$field]);
if(empty($value))
{
$errors[] = str_replace('[field]',$field,$this->lang['products_please_fill_field']);
}
}*/
if(isset($errors))
{
$this->errors = $errors;
}
else {
$specsValid = TRUE;
}
return $specsValid;
}
/*
* Set specs
* This function is called after specs are set in subclass.
*/
public function setStorageSpecs($id)
{
if( ! empty($id) && is_numeric($id))
{
$tempData = $this->get(array($id),$this->specs);
$data = $tempData[0];
foreach(array_keys($_SESSION['specs_to_store']) as $key)
{
if(isset($data[$key]))
{
$_SESSION['specs_to_store'][$key] = $data[$key];
}
}
}
}
}