TrackManiaControl/libs/FML/Script/Features/PagingButton.php

98 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2014-04-27 14:44:40 +02:00
<?php
namespace FML\Script\Features;
use FML\Controls\Control;
2014-05-14 23:24:00 +02:00
use FML\Types\Scriptable;
2014-04-27 14:44:40 +02:00
/**
2014-06-21 03:18:21 +02:00
* Paging Button for browsing through Pages
2014-04-27 14:44:40 +02:00
*
2014-05-20 15:44:45 +02:00
* @author steeffeen <mail@steeffeen.com>
2017-03-25 18:40:15 +01:00
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
2014-05-14 23:24:00 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-04-27 14:44:40 +02:00
*/
2017-03-25 18:40:15 +01:00
class PagingButton
{
2014-04-27 14:44:40 +02:00
2017-03-25 18:40:15 +01:00
/**
* @var Control $control Paging Control
*/
protected $control = null;
2014-04-27 14:44:40 +02:00
2017-03-25 18:40:15 +01:00
/**
* @var int Paging count
*/
protected $pagingCount = 1;
2014-04-27 14:44:40 +02:00
2017-03-25 18:40:15 +01:00
/**
* Construct a new Paging Button
*
* @api
* @param Control $control (optional) Paging Control
* @param int $pagingCount (optional) Number of browsed pages per click
*/
public function __construct(Control $control = null, $pagingCount = 1)
{
if ($control) {
$this->setControl($control);
}
if ($pagingCount) {
$this->setPagingCount($pagingCount);
}
}
2014-04-27 14:44:40 +02:00
2017-03-25 18:40:15 +01:00
/**
* Get the paging Control
*
* @api
* @return Control
*/
public function getControl()
{
return $this->control;
}
/**
* Set the paging Control
*
* @api
* @param Control $control Paging Control
* @return static
*/
public function setControl(Control $control)
{
$control->checkId();
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
$this->control = $control;
return $this;
}
/**
* Get the paging count
*
* @api
* @return int
*/
public function getPagingCount()
{
return $this->pagingCount;
}
/**
* Set the paging count
*
* @api
* @param int $pagingCount Number of browsed pages per click
* @return static
*/
public function setPagingCount($pagingCount)
{
$this->pagingCount = (int)$pagingCount;
return $this;
}
2014-04-27 14:44:40 +02:00
}