Display tags in task list view
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace Kanboard\Core;
|
||||
|
||||
use Kanboard\Core\Filter\FormatterInterface;
|
||||
use Pimple\Container;
|
||||
use PicoDb\Table;
|
||||
|
||||
/**
|
||||
* Paginator helper
|
||||
* Paginator Helper
|
||||
*
|
||||
* @package core
|
||||
* @package Kanboard\Core
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class Paginator
|
||||
@@ -109,6 +110,11 @@ class Paginator
|
||||
*/
|
||||
private $params = array();
|
||||
|
||||
/**
|
||||
* @var FormatterInterface
|
||||
*/
|
||||
protected $formatter = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -125,7 +131,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param \PicoDb\Table
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setQuery(Table $query)
|
||||
{
|
||||
@@ -134,6 +140,18 @@ class Paginator
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Formatter
|
||||
*
|
||||
* @param FormatterInterface $formatter
|
||||
* @return $this
|
||||
*/
|
||||
public function setFormatter(FormatterInterface $formatter)
|
||||
{
|
||||
$this->formatter = $formatter;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a PicoDb query
|
||||
*
|
||||
@@ -143,11 +161,16 @@ class Paginator
|
||||
public function executeQuery()
|
||||
{
|
||||
if ($this->query !== null) {
|
||||
return $this->query
|
||||
->offset($this->offset)
|
||||
->limit($this->limit)
|
||||
->orderBy($this->order, $this->direction)
|
||||
->findAll();
|
||||
$this->query
|
||||
->offset($this->offset)
|
||||
->limit($this->limit)
|
||||
->orderBy($this->order, $this->direction);
|
||||
|
||||
if ($this->formatter !== null) {
|
||||
return $this->formatter->withQuery($this->query)->format();
|
||||
} else {
|
||||
return $this->query->findAll();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
@@ -160,7 +183,7 @@ class Paginator
|
||||
* @param string $controller
|
||||
* @param string $action
|
||||
* @param array $params
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl($controller, $action, array $params = array())
|
||||
{
|
||||
@@ -175,7 +198,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param array $items
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setCollection(array $items)
|
||||
{
|
||||
@@ -199,7 +222,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param integer $total
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setTotal($total)
|
||||
{
|
||||
@@ -223,7 +246,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param integer $page
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setPage($page)
|
||||
{
|
||||
@@ -247,7 +270,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param string $order
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
@@ -260,7 +283,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param string $direction
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setDirection($direction)
|
||||
{
|
||||
@@ -273,7 +296,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param integer $limit
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function setMax($limit)
|
||||
{
|
||||
@@ -307,7 +330,7 @@ class Paginator
|
||||
*
|
||||
* @access public
|
||||
* @param boolean $condition
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function calculateOnlyIf($condition)
|
||||
{
|
||||
@@ -322,7 +345,7 @@ class Paginator
|
||||
* Calculate the offset value accoring to url params and the page number
|
||||
*
|
||||
* @access public
|
||||
* @return Paginator
|
||||
* @return $this
|
||||
*/
|
||||
public function calculate()
|
||||
{
|
||||
@@ -421,7 +444,7 @@ class Paginator
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function generatPageShowing()
|
||||
public function generatePageShowing()
|
||||
{
|
||||
return '<span class="pagination-showing">'.t('Showing %d-%d of %d', (($this->getPage() - 1) * $this->getMax() + 1), min($this->getTotal(), $this->getPage() * $this->getMax()), $this->getTotal()).'</span>';
|
||||
}
|
||||
@@ -432,7 +455,7 @@ class Paginator
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasNothingtoShow()
|
||||
public function hasNothingToShow()
|
||||
{
|
||||
return $this->offset === 0 && ($this->total - $this->offset) <= $this->limit;
|
||||
}
|
||||
@@ -447,9 +470,9 @@ class Paginator
|
||||
{
|
||||
$html = '';
|
||||
|
||||
if (! $this->hasNothingtoShow()) {
|
||||
if (! $this->hasNothingToShow()) {
|
||||
$html .= '<div class="pagination">';
|
||||
$html .= $this->generatPageShowing();
|
||||
$html .= $this->generatePageShowing();
|
||||
$html .= $this->generatePreviousLink();
|
||||
$html .= $this->generateNextLink();
|
||||
$html .= '</div>';
|
||||
|
||||
Reference in New Issue
Block a user