id = $id;
}
/**
* Get revisions, and set correct pagenation parameters (first, hasNext)
*
* @param int $first
* @param bool $hasNext
* @return array revisions to be shown in a pagenated list
* @see also https://www.dokuwiki.org/devel:changelog
*/
abstract protected function getRevisions(&$first, &$hasNext);
/**
* Navigation buttons for Pagenation (prev/next)
*
* @param int $first
* @param bool $hasNext
* @param callable $callback returns array of hidden fields for the form button
* @return array html
*/
protected function navigation($first, $hasNext, $callback)
{
global $conf;
$html = '
';
$last = $first + $conf['recent'];
if ($first > 0) {
$first = max($first - $conf['recent'], 0);
$html.= '
';
$html.= html_btn('newer', $this->id, "p", $callback($first));
$html.= '
';
}
if ($hasNext) {
$html.= '
';
$html.= html_btn('older', $this->id, "n", $callback($last));
$html.= '
';
}
$html.= '
';
return $html;
}
/**
* Returns instance of objRevInfo
*
* @param array $info Revision info structure of a page or media file
* @return objRevInfo object (anonymous class)
*/
protected function getObjRevInfo(array $info)
{
return new class ($info) // anonymous class (objRevInfo)
{
protected $info;
public function __construct(array $info)
{
$this->info = $info;
}
// current indicator
public function currentIndicator()
{
global $lang;
return ($this->info['current']) ? '('.$lang['current'].')' : '';
}
// edit date and time of the page or media file
public function editDate()
{
return '