Issues (26)

php-src/nette/Helper.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace kalanis\kw_table\nette;
4
5
6
use kalanis\kw_address_handler\Handler;
7
use kalanis\kw_address_handler\HandlerException;
8
use kalanis\kw_address_handler\Sources;
9
use kalanis\kw_pager\BasicPager;
10
use kalanis\kw_paging\Positions;
11
use kalanis\kw_paging\Render;
12
use kalanis\kw_table\core\Connector\PageLink;
13
use kalanis\kw_table\core\Table;
14
use kalanis\kw_table\core\Table\Order;
15
use kalanis\kw_table\form_nette\NetteFilter;
16
use kalanis\kw_table\output_latte\LatteRenderer;
17
use Nette\Application\UI\Form;
0 ignored issues
show
The type Nette\Application\UI\Form was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Nette\ComponentModel\IContainer;
19
20
21
/**
22
 * Class Helper
23
 * @package kalanis\kw_table\nette
24
 * Helper with table initialization
25
 */
26
class Helper
27
{
28
    protected Table $table;
29
30
    public function __construct()
31
    {
32
        $this->table = new Table();
33
    }
34
35
    /**
36
     * @param IContainer $container
37
     * @param string $alias
38
     * @throws HandlerException
39
     * @return $this
40
     */
41
    public function fillNetteTable(IContainer $container, string $alias = 'filter'): self
42
    {
43
        // filter form
44
        $form = new Form($container, $alias);
45
        $this->table->addHeaderFilter(new NetteFilter($form));
46
47
        // order links
48
        $this->table->addOrder(new Order(new Handler(new Sources\ServerRequest())));
49
50
        // pager
51
        $pager = new BasicPager();
52
        $pageLink = new PageLink(new Handler(new Sources\ServerRequest()), $pager);
53
        $pager->setActualPage($pageLink->getPageNumber());
54
        $this->table->addPager(new Render\SimplifiedPager(new Positions($pager), $pageLink));
55
56
        // output
57
        $this->table->setOutput(new LatteRenderer($this->table));
58
59
        return $this;
60
    }
61
62
    public function getTable(): Table
63
    {
64
        return $this->table;
65
    }
66
}
67