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

82 lines
1.7 KiB
PHP
Raw 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>
2014-04-27 14:44:40 +02:00
* @copyright FancyManiaLinks Copyright © 2014 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
*/
class PagingButton {
/*
2014-06-21 03:18:21 +02:00
* Protected properties
2014-04-27 14:44:40 +02:00
*/
2014-06-21 03:18:21 +02:00
/** @var Control $control */
2014-04-27 14:44:40 +02:00
protected $control = null;
protected $browseAction = null;
/**
* Construct a new Paging Button
*
2014-05-14 23:24:00 +02:00
* @param Control $control (optional) Browse Control
* @param int $browseAction (optional) Number of browsed Pages per Click
2014-04-27 14:44:40 +02:00
*/
public function __construct(Control $control = null, $browseAction = null) {
2014-08-11 23:15:53 +02:00
if ($control !== null) {
2014-06-21 03:18:21 +02:00
$this->setControl($control);
}
2014-08-11 23:15:53 +02:00
if ($browseAction !== null) {
2014-06-21 03:18:21 +02:00
$this->setBrowseAction($browseAction);
}
2014-04-27 14:44:40 +02:00
}
/**
* Set the Button Control
*
* @param Control $control Browse Control
2014-07-03 22:34:47 +02:00
* @return static
2014-04-27 14:44:40 +02:00
*/
public function setControl(Control $control) {
$control->checkId();
2014-05-14 23:24:00 +02:00
if ($control instanceof Scriptable) {
$control->setScriptEvents(true);
}
2014-04-27 14:44:40 +02:00
$this->control = $control;
return $this;
}
/**
* Get the Button Control
*
* @return \FML\Controls\Control
*/
public function getControl() {
return $this->control;
}
/**
2014-06-21 03:18:21 +02:00
* Set the browse action
2014-04-27 14:44:40 +02:00
*
2014-06-21 03:18:21 +02:00
* @param int $browseAction Number of browsed Pages per click
2014-07-03 22:34:47 +02:00
* @return static
2014-04-27 14:44:40 +02:00
*/
public function setBrowseAction($browseAction) {
2014-05-14 23:24:00 +02:00
$this->browseAction = (int)$browseAction;
2014-04-27 14:44:40 +02:00
return $this;
}
/**
2014-06-21 03:18:21 +02:00
* Get the browse action
2014-04-27 14:44:40 +02:00
*
* @return int
*/
public function getBrowseAction() {
return $this->browseAction;
}
}