|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* ZfTable ( Module for Zend Framework 2) |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2013 Piotr Duda [email protected] |
|
6
|
|
|
* @license MIT License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace ZfTable\Example\TableExample; |
|
10
|
|
|
|
|
11
|
|
|
use ZfTable\AbstractTable; |
|
12
|
|
|
|
|
13
|
|
|
class NewPluginCondition extends AbstractTable |
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
protected $config = array( |
|
17
|
|
|
'name' => 'New condition plugin (Between, GreaterThan, LesserThan )', |
|
18
|
|
|
'showPagination' => true, |
|
19
|
|
|
'showQuickSearch' => false, |
|
20
|
|
|
'showItemPerPage' => true, |
|
21
|
|
|
); |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var array Definition of headers |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $headers = array( |
|
27
|
|
|
'idcustomer' => array('title' => 'Id', 'width' => '50') , |
|
28
|
|
|
'name' => array('title' => 'Name' ), |
|
29
|
|
|
'surname' => array('title' => 'Surname' ), |
|
30
|
|
|
'street' => array('title' => 'Street'), |
|
31
|
|
|
'city' => array('title' => 'City' ), |
|
32
|
|
|
'age' => array('title' => 'Age' ), |
|
33
|
|
|
'active' => array('title' => 'Active' , 'width' => 100 ), |
|
34
|
|
|
); |
|
35
|
|
|
|
|
36
|
|
|
public function init() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->getHeader('age')->getCell()->addDecorator('varattr', array('style' => 'color: blue')) |
|
39
|
|
|
->addCondition('between', array('column' => 'age' , 'min' => 10, 'max' => 30)); |
|
40
|
|
|
|
|
41
|
|
|
$this->getHeader('age')->getCell()->addDecorator('varattr', array('style' => 'rgb(255, 0, 245)')) |
|
42
|
|
|
->addCondition('lesserthan', array('column' => 'age' , 'value' => 10)); |
|
43
|
|
|
|
|
44
|
|
|
$this->getHeader('age')->getCell()->addDecorator('varattr', array('style' => 'color: red')) |
|
45
|
|
|
->addCondition('greaterthan', array('column' => 'age' , 'value' => 30)); |
|
46
|
|
|
} |
|
47
|
|
|
protected function initFilters($query) |
|
48
|
|
|
{ |
|
49
|
|
|
|
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|