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