TableBase::templatePath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace kalanis\kw_table\output_kw\Html;
4
5
6
use kalanis\kw_templates\ATemplate;
7
use kalanis\kw_templates\Template\TFile;
8
9
10
class TableBase extends ATemplate
11
{
12
    use TFile;
13
14
    protected function templatePath(): string
15
    {
16
        return __DIR__ . '/../../shared-templates/table-base.html';
17
    }
18
19
    protected function fillInputs(): void
20
    {
21
        $this->addInput('{TABLE_PAGER_HEAD}');
22
        $this->addInput('{TABLE_PAGER_FOOT}');
23
        $this->addInput('{TABLE_SORTER_FILTER}');
24
        $this->addInput('{TABLE_HEAD_FILTER}');
25
        $this->addInput('{TABLE_CELLS}');
26
        $this->addInput('{TABLE_FOOTER_FILTER}');
27
        $this->addInput('{TABLE_SCRIPT}');
28
        $this->addInput('{FILTER_START}');
29
        $this->addInput('{FILTER_END}');
30
        $this->addInput('{CLASSES_IN_STRING}');
31
    }
32
33
    public function addPagerHead(string $pager): self
34
    {
35
        $this->updateItem('{TABLE_PAGER_HEAD}', $pager);
36
        return $this;
37
    }
38
39
    public function addPagerFoot(string $pager): self
40
    {
41
        $this->updateItem('{TABLE_PAGER_FOOT}', $pager);
42
        return $this;
43
    }
44
45
    public function addFilter(string $filterStart, string $filterEnd): self
46
    {
47
        $this->updateItem('{FILTER_START}', $filterStart);
48
        $this->updateItem('{FILTER_END}', $filterEnd);
49
        return $this;
50
    }
51
52
    public function addScript(string $script): self
53
    {
54
        $this->updateItem('{TABLE_SCRIPT}', $script);
55
        return $this;
56
    }
57
58
    public function setData(string $cells, string $header = '', string $headFilter = '', string $footerFilter = '', string $classes = ''): self
59
    {
60
        $this->updateItem('{TABLE_CELLS}', $cells);
61
        $this->updateItem('{TABLE_SORTER_FILTER}', $header);
62
        $this->updateItem('{TABLE_HEAD_FILTER}', $headFilter);
63
        $this->updateItem('{TABLE_FOOTER_FILTER}', $footerFilter);
64
        $this->updateItem('{CLASSES_IN_STRING}', $classes);
65
        return $this;
66
    }
67
}
68