*/
class Bvb_Grid_Filters_Render_Table_Date extends Bvb_Grid_Filters_Render_RenderAbstract
{
/**
* @see library/Bvb/Grid/Filters/Render/Bvb_Grid_Filters_Render_RenderAbstract::getChilds()
*/
public function getChilds ()
{
return array('from', 'to');
}
/**
* @see library/Bvb/Grid/Filters/Render/Bvb_Grid_Filters_Render_RenderAbstract::normalize()
*/
public function normalize ($value, $part = '')
{
return date('Y-m-d', strtotime($value));
}
/**
* Retuns current conditions
*
* @return array
*/
public function getConditions ()
{
return array('from' => '>=', 'to' => '<=');
}
/**
* @see library/Bvb/Grid/Filters/Render/Bvb_Grid_Filters_Render_RenderInterface::render()
*/
public function render ()
{
$this->removeAttribute('id');
if ( ! $this->hasAttribute('style') ) $this->setAttribute('style', 'width:50px !important;');
return '' . $this->__('From:') . "" . $this->getView()
->formText($this->getFieldName() . '[from]',
$this->getDefaultValue('from'),
array_merge($this->getAttributes(),
array('id' => 'filter_' . $this->getFieldName() . '_from')))
. "
" . $this->__('To:') . "" .
$this->getView()->formText($this->getFieldName() . '[to]',
$this->getDefaultValue('to'),
array_merge($this->getAttributes(),
array('id' => 'filter_' . $this->getFieldName() . '_to')));
}
}