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

75 lines
1.4 KiB
PHP
Raw Normal View History

2014-04-27 14:44:40 +02:00
<?php
namespace FML\Script\Features;
use FML\Controls\Control;
/**
2014-06-21 03:18:21 +02:00
* Paging Page
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-18 19:45:50 +02:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
2014-04-27 14:44:40 +02:00
*/
class PagingPage {
/*
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 $number = null;
/**
* Construct a new Paging Page
*
2014-05-18 19:45:50 +02:00
* @param Control $control (optional) Page Control
* @param int $pageNumber (optional) Number of the Page
2014-04-27 14:44:40 +02:00
*/
public function __construct(Control $control = null, $pageNumber = 1) {
2014-06-21 03:18:21 +02:00
if (!is_null($control)) {
$this->setControl($control);
}
2014-04-27 14:44:40 +02:00
$this->setPageNumber($pageNumber);
}
/**
* Set the Page Control
*
* @param Control $control Page Control
2014-07-03 22:34:47 +02:00
* @return static
2014-04-27 14:44:40 +02:00
*/
public function setControl(Control $control) {
2014-06-21 03:18:21 +02:00
$this->control = $control->checkId();
2014-04-27 14:44:40 +02:00
return $this;
}
/**
* Get the Page Control
*
* @return \FML\Controls\Control
*/
public function getControl() {
return $this->control;
}
/**
2014-06-21 03:18:21 +02:00
* Set the Page number
2014-04-27 14:44:40 +02:00
*
* @param int $pageNumber Number of the Page
2014-07-03 22:34:47 +02:00
* @return static
2014-04-27 14:44:40 +02:00
*/
public function setPageNumber($pageNumber) {
2014-05-18 19:45:50 +02:00
$this->number = (int)$pageNumber;
2014-04-27 14:44:40 +02:00
return $this;
}
/**
2014-06-21 03:18:21 +02:00
* Get the Page number
2014-04-27 14:44:40 +02:00
*
* @return int
*/
public function getPageNumber() {
return $this->number;
}
}