1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ntentan\honam\helpers; |
4
|
|
|
|
5
|
|
|
use ntentan\honam\TemplateEngine; |
6
|
|
|
use ntentan\honam\Helper; |
7
|
|
|
|
8
|
|
|
class ListingHelper extends Helper |
9
|
|
|
{ |
10
|
|
|
private $parameters = array( |
11
|
|
|
"headers" => array(), |
12
|
|
|
"data" => array(), |
13
|
|
|
"row_template" => null, |
14
|
|
|
"cell_templates" => null, |
15
|
|
|
"default_cell_template" => null, |
16
|
|
|
"variables" => null |
17
|
|
|
); |
18
|
|
|
|
19
|
1 |
|
public function __construct() |
20
|
|
|
{ |
21
|
1 |
|
TemplateEngine::appendPath( |
22
|
1 |
|
__DIR__ . "/../../templates/lists" |
23
|
|
|
); |
24
|
1 |
|
} |
25
|
|
|
|
26
|
|
|
public function stylesheet() |
27
|
|
|
{ |
28
|
|
|
return __DIR__ . '/../../assets/css/lists/lists.css'; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* array( |
33
|
|
|
* "headers" => $this->headers, |
34
|
|
|
* "data" => $this->data, |
35
|
|
|
* "row_template" => $this->rowTemplate, |
36
|
|
|
* "cell_templates" => $this->cellTemplates, |
37
|
|
|
* "default_cell_template" => $this->defaultCellTemplate, |
38
|
|
|
* "variables" => $this->variables, |
39
|
|
|
* ) |
40
|
|
|
* @param type $arguments |
41
|
|
|
*/ |
42
|
1 |
|
public function help($arguments) |
43
|
|
|
{ |
44
|
1 |
|
$this->parameters = array_merge($this->parameters, $arguments); |
45
|
1 |
|
return $this; |
46
|
|
|
} |
47
|
|
|
|
48
|
1 |
|
public function __toString() |
49
|
|
|
{ |
50
|
1 |
|
$this->parameters['row_template'] = $this->parameters['row_template'] == null ? 'row.tpl.php' : $this->parameters['row_template']; |
51
|
1 |
|
$this->parameters['default_cell_template'] = $this->parameters['default_cell_template'] == null ? 'default_cell.tpl.php' : $this->parameters['default_cell_template']; |
52
|
1 |
|
return TemplateEngine::render('list.tpl.php', $this->parameters); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|