Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 1e242e8daf
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (58 sloc) 1.504 kb
<?php
namespace DataGrid\Filters;
use Nette, DataGrid;
/**
* Base class that implements the basic common functionality to data grid column's filters.
*
* @author Roman Sklenář
* @copyright Copyright (c) 2009 Roman Sklenář (http://romansklenar.cz)
* @license New BSD License
* @example http://addons.nette.org/datagrid
* @package Nette\Extras\DataGrid
*/
abstract class ColumnFilter extends Nette\ComponentModel\Component implements IColumnFilter
{
/** @var Nette\Forms\Controls\BaseControl form element */
protected $element;
/** @var string value of filter (if was filtered) */
protected $value;
public function __construct()
{
parent::__construct();
}
/********************* interface DataGrid\Filters\IColumnFilter *********************/
/**
* Returns filter's form element.
* @return Nette\Forms\Controls\BaseControl
*/
public function getFormControl()
{
}
/**
* Gets filter's value, if was filtered.
* @return string
*/
public function getValue()
{
$dataGrid = $this->lookup('DataGrid\DataGrid', TRUE);
// set value if was data grid filtered yet
parse_str($dataGrid->filters, $list);
foreach ($list as $key => $value) {
if ($key == $this->getName()) {
$this->setValue($value);
break;
}
}
return $this->value;
}
/**
* Sets filter's value.
* @param string
* @return void
*/
public function setValue($value)
{
$this->getFormControl()->setDefaultValue($value);
$this->value = $value;
}
}
Jump to Line
Something went wrong with that request. Please try again.