// Adding compare options

This commit is contained in:
Jerome Nadaud
2013-10-16 19:07:23 +02:00
parent 6a7990869a
commit a85b931765
6 changed files with 63 additions and 38 deletions
+21 -5
View File
@@ -32,6 +32,7 @@ class HelperCalendarCore extends Helper
private $_compare_actions;
private $_compare_date_from;
private $_compare_date_to;
private $_compare_date_option;
private $_date_format;
private $_date_from;
private $_date_to;
@@ -84,7 +85,7 @@ class HelperCalendarCore extends Helper
$value = date('Y-m-d', strtotime("-31 days"));
if (!is_string($value))
throw new PrestaShopException('Date must be string');
throw new PrestaShopException('Date must be a string');
$this->_compare_date_from = $value;
return $this;
@@ -104,7 +105,7 @@ class HelperCalendarCore extends Helper
$value = date('Y-m-d');
if (!is_string($value))
throw new PrestaShopException('Date must be string');
throw new PrestaShopException('Date must be a string');
$this->_compare_date_to = $value;
return $this;
@@ -118,10 +119,24 @@ class HelperCalendarCore extends Helper
return $this->_compare_date_to;
}
public function setCompareOption($value)
{
$this->_compare_date_option = (int)$value;
return $this;
}
public function getCompareOption()
{
if (!isset($this->_compare_date_option))
$this->_compare_date_option = self::DEFAULT_COMPARE_OPTION;
return $this->_compare_date_option;
}
public function setDateFormat($value)
{
if (!is_string($value))
throw new PrestaShopException('Date format must be string');
throw new PrestaShopException('Date format must be a string');
$this->_date_format = $value;
return $this;
@@ -141,7 +156,7 @@ class HelperCalendarCore extends Helper
$value = date('Y-m-d', strtotime("-31 days"));
if (!is_string($value))
throw new PrestaShopException('Date must be string');
throw new PrestaShopException('Date must be a string');
$this->_date_from = $value;
return $this;
@@ -161,7 +176,7 @@ class HelperCalendarCore extends Helper
$value = date('Y-m-d');
if (!is_string($value))
throw new PrestaShopException('Date must be string');
throw new PrestaShopException('Date must be a string');
$this->_date_to = $value;
return $this;
@@ -232,6 +247,7 @@ class HelperCalendarCore extends Helper
'compare_date_to' => $this->getCompareDateTo(),
'actions' => $this->getActions(),
'compare_actions' => $this->getCompareActions(),
'compare_option' => $this->getCompareOption(),
'is_rtl' => $this->isRTL()
));