|
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 CallableTable extends AbstractTable |
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
protected $config = array( |
|
17
|
|
|
'name' => 'Callable', |
|
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
|
|
|
'callableColumn' => array('title' => 'Closure' ,'sortable' => false), |
|
29
|
|
|
'name' => array('title' => 'Name' , 'separatable' => true), |
|
30
|
|
|
'surname' => array('title' => 'Surname' ), |
|
31
|
|
|
'street' => array('title' => 'Street'), |
|
32
|
|
|
'city' => array('title' => 'City' , 'separatable' => true), |
|
33
|
|
|
'active' => array('title' => 'Active' , 'width' => 100 ), |
|
34
|
|
|
); |
|
35
|
|
|
|
|
36
|
|
|
public function init() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->getHeader('callableColumn')->getCell()->addDecorator('callable', array( |
|
39
|
|
|
'callable' => function ($context, $record) { |
|
40
|
|
|
return ' Imię : ' . $record['name'] . ', Nazwisko: '. $record['surname']; |
|
41
|
|
|
} |
|
42
|
|
|
)); |
|
43
|
|
|
} |
|
44
|
|
|
} |
|
45
|
|
|
|