Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Update libs/NiftyGrid/GridPaginator.php (~based on: #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions libs/NiftyGrid/GridPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ class GridPaginator extends \Nette\Application\UI\Control
/** @persistent int */
public $page = 1;

/**
* @var Paginator
*/
/** @var Paginator */
public $paginator;

public function __construct()
/** @var string */
protected $templatePath = null;


public function __construct($templatePath = null)
{
parent::__construct();
$this->paginator = new Paginator;
$this->setTemplate($templatePath);
}

public function render()
{
$this->template->paginator = $this->paginator;
$this->template->setFile(__DIR__ . '/../../templates/paginator.latte');
$this->template->setFile(!empty($this->templatePath) ? $this->templatePath : __DIR__ . '/../../templates/paginator.latte');
$this->template->render();
}

Expand All @@ -42,4 +45,13 @@ public function loadState(array $params)
parent::loadState($params);
$this->paginator->page = $this->page;
}
}

/**
* @param string $templatePath
*/
public function setTemplate($templatePath)
{
$this->templatePath = $templatePath;
}

}