Refactoring pagination class.
This commit is contained in:
parent
218783ecee
commit
2cdee7aff1
|
@ -50,6 +50,7 @@ public function __construct($results, $total, $per_page)
|
||||||
$this->per_page = $per_page;
|
$this->per_page = $per_page;
|
||||||
$this->results = $results;
|
$this->results = $results;
|
||||||
$this->total = $total;
|
$this->total = $total;
|
||||||
|
|
||||||
$this->page = static::page($this->last_page());
|
$this->page = static::page($this->last_page());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,33 +137,37 @@ protected function slider($adjacent)
|
||||||
/**
|
/**
|
||||||
* Generate the "previous" HTML link.
|
* Generate the "previous" HTML link.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $language
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function previous($value = '« Previous')
|
public function previous($language = null)
|
||||||
{
|
{
|
||||||
|
$text = Lang::line('pagination.previous')->get($language);
|
||||||
|
|
||||||
if ($this->page > 1)
|
if ($this->page > 1)
|
||||||
{
|
{
|
||||||
return HTML::link(Request::uri().'?page='.($this->page - 1), $value, array('class' => 'prev_page')).' ';
|
return HTML::link(Request::uri().'?page='.($this->page - 1), $text, array('class' => 'prev_page')).' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return HTML::span($value, array('class' => 'disabled prev_page')).' ';
|
return HTML::span($text, array('class' => 'disabled prev_page')).' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the "next" HTML link.
|
* Generate the "next" HTML link.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $language
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function next($value = 'Next »')
|
public function next($language = null)
|
||||||
{
|
{
|
||||||
|
$text = Lang::line('pagination.next')->get($language);
|
||||||
|
|
||||||
if ($this->page < $this->last_page())
|
if ($this->page < $this->last_page())
|
||||||
{
|
{
|
||||||
return HTML::link(Request::uri().'?page='.($this->page + 1), $value, array('class' => 'next_page'));
|
return HTML::link(Request::uri().'?page='.($this->page + 1), $text, array('class' => 'next_page'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return HTML::span($value, array('class' => 'disabled next_page'));
|
return HTML::span($text, array('class' => 'disabled next_page'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue