TrackManiaControl/application/core/Libs/FML/Script/Features/PagingButton.php

77 lines
1.6 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
/**
* A Button for browsing through Pages
*
2014-05-14 23:24:00 +02:00
* @author steeffeen
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 {
/*
* Protected Properties
*/
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) {
$this->setControl($control);
$this->setBrowseAction($browseAction);
}
/**
* Set the Button Control
*
* @param Control $control Browse Control
* @return \FML\Script\Features\PagingButton
*/
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;
}
/**
* Set the Browse Action
*
* @param int $browseAction Number of browsed Pages per Click
* @return \FML\Script\Features\PagingButton
*/
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;
}
/**
* Get the Browse Action
*
* @return int
*/
public function getBrowseAction() {
return $this->browseAction;
}
}