function discuss_list($message = '') { pagetop(gTxt('list_discussions'), $message); extract(doSlash(gpsa(array('page', 'crit')))); extract(get_prefs()); $total = safe_count('txp_discuss', "1=1"); $limit = max(@$comment_list_pageby, 25); $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $nav[] = $page > 1 ? PrevNextLink("discuss", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("discuss", $page + 1, gTxt('next'), 'next') : ''; $criteria = $crit ? "message like '%{$crit}%'" : '1=1'; $rs = safe_rows_start("*, unix_timestamp(posted) as uPosted", "txp_discuss", "{$criteria} order by posted desc limit {$offset}, {$limit}"); echo pageby_form('discuss', $comment_list_pageby); if ($rs) { echo '<form action="index.php" method="post" name="longform" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), assHead('date', 'name', 'message', 'parent', ''); while ($a = nextRow($rs)) { extract($a); $dmessage = $visible == SPAM ? short_preview($message) : $message; $date = "" . date("M d, g:ia", $uPosted + tz_offset()) . ""; $editlink = eLink('discuss', 'discuss_edit', 'discussid', $discussid, $date); $cbox = fInput('checkbox', 'selected[]', $discussid); $tq = fetch('Title', 'textpattern', 'ID', $parentid); $parent = !$tq ? gTxt('article_deleted') : $tq; echo assRow(array($editlink => 100, $name => 100, $dmessage => 250, $parent => 100, $cbox => 20), ' class="' . ($visible == VISIBLE ? 'visible' : ($visible == SPAM ? 'spam' : 'moderate')) . '"'); } echo tr(tda(select_buttons() . discuss_multiedit_form(), ' colspan="5" style="text-align:right;border:0px"')); echo endTable() . '</form>'; echo startTable('edit'), tr(td(form(fInput('text', 'crit', '', 'edit') . fInput('submit', 'search', gTxt('search'), 'smallbox') . eInput("discuss") . sInput("list"))) . td(graf(join('', $nav)))) . tr(tda(graf('<a href="index.php?event=discuss' . a . 'step=ipban_list">' . gTxt('list_banned_ips') . '</a>'), ' colspan="2" align="center" valign="middle"')), endTable(); } else { echo graf(gTxt('no_comments_recorded'), ' align="center"'); } }
function log_list() { pagetop(gTxt('visitor_logs')); extract(get_prefs()); safe_delete("txp_log", "`time` < date_sub(now(),interval " . $expire_logs_after . " day)"); safe_optimize("txp_log"); safe_repair("txp_log"); $page = gps('page'); $total = getCount('txp_log', "1"); $limit = 50; $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $nav[] = $page > 1 ? PrevNextLink("log", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("log", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows_start("*, unix_timestamp(time) as stamp", "txp_log", "1 order by time desc limit {$offset},{$limit}"); if ($rs) { echo startTable('list'), assHead('time', 'host', 'page', 'referrer'); $stamp = ''; while ($a = nextRow($rs)) { extract($a); if ($refer) { $referprint = preg_replace("/^www\\./", "", chunk(htmlspecialchars($refer), 50)); $referprint = '<a href="http://' . htmlspecialchars($refer) . '">' . $referprint . '</a>'; } else { $referprint = ' '; } $pageprint = preg_replace('/\\/$/', '', htmlspecialchars(substr($page, 1))); $pageprint = $pageprint == '' ? '' : '<a href="' . htmlspecialchars($page) . '" target="_blank">' . chunk($pageprint, 50) . '</a>'; if ($method == 'POST') { $pageprint = '<b>' . $pageprint . '</b>'; } $fstamp = date("n/j g:i a", $stamp + tz_offset()); $hostprint = chunk($host, 40); echo tr(td($fstamp) . td($hostprint) . td($pageprint) . td($referprint)); unset($refer, $referprint, $page, $pageprint); } echo '<tr><td colspan="4" align="right" style="padding:10px">', join('', $nav), "</td></tr>", endTable(); } else { echo graf(gTxt('no_refers_recorded'), ' align="center"'); } }
function image_list($message = '') { global $txpcfg, $extensions, $path_from_root, $img_dir; $pfr = $path_from_root; extract($txpcfg); extract(get_prefs()); pagetop(gTxt('image'), $message); echo pageby_form('image', $article_list_pageby); echo startTable('list'), tr(tda(upload_form(gTxt('upload_file'), gTxt('upload'), 'image_insert'), ' colspan="4" style="border:0"')), tr(hCell(ucfirst(gTxt('name'))) . hCell(gTxt('image_category')) . hCell(gTxt('tags')) . hCell(gTxt('author')) . hCell(gTxt('thumbnail')) . hCell()); $page = gps('page'); $total = getCount('txp_image', "1"); $limit = 15; $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $nav[] = $page > 1 ? PrevNextLink("image", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("image", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows("*", "txp_image", "1 order by category,name limit {$offset},{$limit}"); if ($rs) { foreach ($rs as $a) { extract($a); $thumbnail = $thumbnail ? '<img src="' . $pfr . $img_dir . '/' . $id . 't' . $ext . '" />' : gTxt('no'); $elink = eLink('image', 'image_edit', 'id', $id, $name); $txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'alt=' . $alt . a . 'h=' . $h . a . 'w=' . $w . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>'; $txplink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>'; $xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=image' . a . 'id=' . $id . a . 'ext=' . $ext . a . 'h=' . $h . a . 'w=' . $w . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>'; $dlink = dLink('image', 'image_delete', 'id', $id); echo tr(td($elink) . td($category) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($author) . td($thumbnail) . td($dlink, 10)); } echo tr(tdcs(graf(join('', $nav)), 4)); } echo endTable(); $imgdir = $doc_root . $path_from_root . $img_dir; if (!is_dir($imgdir) or !is_writeable($imgdir)) { echo graf(str_replace("{imgdir}", $imgdir, gTxt('img_dir_not_writeable')), ' style="text-align:center;color:red"'); } }
function link_list($message = "") { global $step, $link_list_pageby; extract(get_prefs()); $page = gps('page'); $total = getCount('txp_link', "1"); $limit = $link_list_pageby; $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $sort = gps('sort'); $dir = gps('dir'); $sort = $sort ? $sort : 'linksort'; $dir = $dir ? $dir : 'asc'; if ($dir == "desc") { $dir = "asc"; } else { $dir = "desc"; } $nav[] = $page > 1 ? PrevNextLink("link", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("link", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows("*", "txp_link", "1 order by {$sort} {$dir} limit {$offset},{$limit}"); if ($rs) { echo '<form action="index.php" method="post" onsubmit="return verify(\'' . gTxt('are_you_sure') . '\')">', startTable('list'), tr(column_head('link_name', 'linksort', 'link', 1, $dir) . column_head('description', 'description', 'link', 1, $dir) . column_head('link_category', 'category', 'link', 1, $dir) . td()); foreach ($rs as $a) { extract($a); $elink = eLink('link', 'link_edit', 'id', $id, $linkname); $cbox = fInput('checkbox', 'selected[]', $id); echo tr(td($elink) . td($description) . td($category) . td($cbox)); } echo tr(tda(link_multiedit_form(), ' colspan="4" style="border:0px;text-align:right"')); echo endTable(), '</form>'; echo pageby_form('link', $link_list_pageby); echo graf(join('', $nav), ' align="center"'); } }
function nav_form($event, $page, $numPages, $sort, $dir, $crit, $search_method, $total = 0, $limit = 0) { if ($crit && $total > 1) { $out[] = messenger(gTxt('showing_search_results', array('{from}' => ($page - 1) * $limit + 1, '{to}' => min($total, $page * $limit), '{total}' => $total))); } if ($numPages > 1) { $option_list = array(); for ($i = 1; $i <= $numPages; $i++) { if ($i == $page) { $option_list[] = '<option value="' . $i . '" selected="selected">' . "{$i}/{$numPages}" . '</option>'; } else { $option_list[] = '<option value="' . $i . '">' . "{$i}/{$numPages}" . '</option>'; } } $nav = array(); $nav[] = $page > 1 ? PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir, $crit, $search_method) . sp : tag('‹ ' . gTxt('prev'), 'span', ' class="navlink-disabled"') . sp; $nav[] = '<select name="page" class="list" onchange="submit(this.form);">'; $nav[] = n . join(n, $option_list); $nav[] = n . '</select>'; $nav[] = '<noscript> <input type="submit" value="' . gTxt('go') . '" class="smallerbox" /></noscript>'; $nav[] = $page != $numPages ? sp . PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir, $crit, $search_method) : sp . tag(gTxt('next') . ' ›', 'span', ' class="navlink-disabled"'); $out[] = '<form class="prev-next" method="get" action="index.php">' . n . eInput($event) . ($sort ? n . hInput('sort', $sort) . n . hInput('dir', $dir) : '') . ($crit ? n . hInput('crit', $crit) . n . hInput('search_method', $search_method) : '') . join('', $nav) . '</form>'; } else { $out[] = graf($page . '/' . $numPages, ' class="prev-next"'); } return join(n, $out); }
function nav_form($event, $page, $numPages, $sort, $dir, $crit, $search_method) { if ($numPages > 1) { $option_list = array(); for ($i = 1; $i <= $numPages; $i++) { if ($i == $page) { $option_list[] = '<option value="' . $i . '" selected="selected">' . "{$i}/{$numPages}" . '</option>'; } else { $option_list[] = '<option value="' . $i . '">' . "{$i}/{$numPages}" . '</option>'; } } $nav = array(); $nav[] = $page > 1 ? PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir, $crit, $search_method) . sp : tag('‹ ' . gTxt('prev'), 'span', ' class="navlink-disabled"') . sp; $nav[] = '<select name="page" class="list" onchange="submit(this.form);">'; $nav[] = n . join(n, $option_list); $nav[] = n . '</select>'; $nav[] = '<noscript> <input type="submit" value="' . gTxt('go') . '" class="smallerbox" /></noscript>'; $nav[] = $page != $numPages ? sp . PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir, $crit, $search_method) : sp . tag(gTxt('next') . ' ›', 'span', ' class="navlink-disabled"'); return '<div style="text-align: center; margin-top: 1em;"><form class="prev-next" method="get" action="index.php">' . n . eInput($event) . ($sort ? n . hInput('sort', $sort) . n . hInput('dir', $dir) : '') . ($crit ? n . hInput('crit', $crit) . n . hInput('search_method', $search_method) : '') . join('', $nav) . '</form></div>'; } else { return '<div style="text-align: center; margin-top: 1em;">' . graf($page . '/' . $numPages, ' class="prev-next"') . '</div>'; } }
/** * Render a page navigation form. * * @param string $event Event * @param integer $page Current page number * @param integer $numPages Total pages * @param string $sort Sort criterion * @param string $dir Sort direction, either "asc" or "desc" * @param string $crit Search criterion * @param string $search_method Search method * @param integer $total Total search term hit count [0] * @param integer $limit First visible search term hit number [0] * @param string $step Step * @return string HTML */ function nav_form($event, $page, $numPages, $sort, $dir, $crit, $search_method, $total = 0, $limit = 0, $step = 'list') { global $theme; if ($crit != '' && $total > 1) { $out[] = $theme->announce(gTxt('showing_search_results', array('{from}' => ($page - 1) * $limit + 1, '{to}' => min($total, $page * $limit), '{total}' => $total))); } if ($numPages > 1) { $option_list = array(); for ($i = 1; $i <= $numPages; $i++) { if ($i == $page) { $option_list[] = '<option value="' . $i . '" selected="selected">' . "{$i}/{$numPages}" . '</option>'; } else { $option_list[] = '<option value="' . $i . '">' . "{$i}/{$numPages}" . '</option>'; } } $nav = array(); $nav[] = $page > 1 ? PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir, $crit, $search_method, $step) . sp : tag(gTxt('prev'), 'span', ' class="navlink-disabled"') . sp; $nav[] = '<select name="page" onchange="submit(this.form);">'; $nav[] = n . join(n, $option_list); $nav[] = n . '</select>'; $nav[] = $page != $numPages ? sp . PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir, $crit, $search_method, $step) : sp . tag(gTxt('next'), 'span', ' class="navlink-disabled"'); $out[] = '<form class="nav-form" method="get" action="index.php">' . n . eInput($event) . n . sInput($step) . ($sort ? n . hInput('sort', $sort) . n . hInput('dir', $dir) : '') . ($crit != '' ? n . hInput('crit', $crit) . n . hInput('search_method', $search_method) : '') . '<p class="prev-next">' . join('', $nav) . '</p>' . n . tInput() . n . '</form>'; } else { $out[] = graf($page . '/' . $numPages, ' class="prev-next"'); } return join(n, $out); }
function file_list($message = '') { global $txpcfg, $extensions, $file_base_path; extract($txpcfg); extract(get_prefs()); pagetop(gTxt('file'), $message); $page = gps('page'); $total = getCount('txp_file', "1=1"); $limit = max(@$file_list_pageby, 25); $numPages = ceil($total / $limit); $page = !$page ? 1 : $page; $offset = ($page - 1) * $limit; $sort = gps('sort'); $dir = gps('dir'); $sort = $sort ? $sort : 'filename'; $dir = $dir ? $dir : 'desc'; if ($dir == "desc") { $dir = "asc"; } else { $dir = "desc"; } $existing_files = get_filenames(); echo startTable('list'), tr(tda(file_upload_form(gTxt('upload_file'), 'upload', 'file_insert'), ' colspan="4" style="border:0"')), count($existing_files) > 0 ? tr(tda(form(graf(gTxt('existing_file') . sp . selectInput('filename', $existing_files, "", 1) . sp . fInput('submit', '', gTxt('Create'), 'smallerbox') . sp . eInput('file') . sInput('file_create'))), ' colspan="4" style="border:0"')) : '', tr(column_head('Id', 'id', 'file', 1, $dir) . column_head('file_name', 'filename', 'file', 1, $dir) . td(gTxt('status')) . td(gTxt('tags')) . column_head('file_category', 'category', 'file', 1, $dir) . column_head('description', 'description', 'file', 1, $dir) . column_head('downloads', 'downloads', 'file', 1, $dir) . td()); $nav[] = $page > 1 ? PrevNextLink("file", $page - 1, gTxt('prev'), 'prev') : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("file", $page + 1, gTxt('next'), 'next') : ''; $rs = safe_rows_start("*", "txp_file", "1=1 order by {$sort} {$dir} limit {$offset}, {$limit}"); if ($rs) { while ($a = nextRow($rs)) { extract($a); // does the downloads column exist? if (!isset($downloads)) { // nope, add it safe_alter("txp_file", "ADD downloads INT DEFAULT '0' NOT NULL"); $downloads = 0; } else { if (empty($downloads)) { $downloads = '0'; } } $elink = eLink('file', 'file_edit', 'id', $id, $filename); $dlink = dLink('file', 'file_delete', 'id', $id); //Add tags helper $txtilelink = '<a target="_blank" href="?event=tag' . a . 'name=file' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename) . a . 'type=textile" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textile</a>'; $txplink = '<a target="_blank" href="?event=tag' . a . 'name=file' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename) . a . 'type=textpattern" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">Textpattern</a>'; $xhtmlink = '<a target="_blank" href="?event=tag' . a . 'name=file' . a . 'id=' . $id . a . 'description=' . urlencode($description) . a . 'filename=' . urlencode($filename) . a . 'type=xhtml" onclick="window.open(this.href, \'popupwindow\', \'width=400,height=400,scrollbars,resizable\'); return false;">XHTML</a>'; $file_exists = file_exists(build_file_path($file_base_path, $filename)); $missing = '<span style="color:'; $missing .= $file_exists ? 'green' : 'red'; $missing .= '">'; $missing .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing'); $missing .= '</span>'; $downloadlink = $file_exists ? make_download_link($id, $filename, $id) : $id; echo tr(td($downloadlink) . td($elink) . td($missing) . td($txtilelink . ' / ' . $txplink . ' / ' . $xhtmlink) . td($category, 90) . td($description, 150) . td($downloads == '0' ? " 0" : $downloads, 20) . td($dlink, 10)); } echo tr(tdcs(graf(join('', $nav)), 4)); } echo endTable(); echo pageby_form('file', $file_list_pageby); if (!is_dir($file_base_path) or !is_writeable($file_base_path)) { echo graf(str_replace("{filedir}", $file_base_path, gTxt('file_dir_not_writeable')), ' style="text-align:center;color:red"'); } }
function list_nav_form($page, $numPages, $sort, $dir) { $nav[] = $page > 1 ? PrevNextLink("list", $page - 1, gTxt('prev'), 'prev', $sort, $dir) : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink("list", $page + 1, gTxt('next'), 'next', $sort, $dir) : ''; if ($nav) { return graf(join('', $nav), ' align="center"'); } }
/** * Renders a page navigation form. * * @param string $event Event * @param int $page Current page number * @param int $numPages Total pages * @param string $sort Sort criterion * @param string $dir Sort direction, either "asc" or "desc" * @param string $crit Search criterion * @param string $search_method Search method * @param int $total Total search term hit count [0] * @param int $limit First visible search term hit number [0] * @param string $step Step * @param int $list Number of displayed page links discounting jump links, previous and next * @return string HTML */ function nav_form($event, $page, $numPages, $sort = '', $dir = '', $crit = '', $search_method = '', $total = 0, $limit = 0, $step = 'list', $list = 5) { $out = array(); if ($crit != '' && $total > 1) { $out[] = announce(gTxt('showing_search_results', array('{from}' => ($page - 1) * $limit + 1, '{to}' => min($total, $page * $limit), '{total}' => $total)), TEXTPATTERN_ANNOUNCE_REGULAR); } if ($numPages > 1) { $nav = array(); $list--; $page = max(min($page, $numPages), 1); $start = max(1, min($numPages - $list, $page - floor($list / 2))); $end = min($numPages, $start + $list); $parameters = array('event' => $event, 'step' => $step, 'dir' => $dir, 'crit' => $crit, 'search_method' => $search_method); // Previous page. if ($page > 1) { $nav[] = PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir, $crit, $search_method, $step); } else { $nav[] = span(gTxt('prev'), array('class' => 'navlink-disabled', 'aria-disabled' => 'true')); } // Jump to the first page. if ($start > 1) { $nav[] = href(1, $parameters + array('page' => 1), array('class' => 'navlink')); } // Jump to mid. if ($start > 2) { $between = ceil($start / 2); $nav[] = href('…', $parameters + array('page' => $between), array('class' => 'navlink', 'title' => $between)); } // Page links. for ($i = $start; $i <= $end; $i++) { if ($i == $page) { $class = 'navlink-active'; } else { $class = 'navlink'; } $nav[] = href($i, $parameters + array('page' => $i), array('class' => $class)); } // Jump to mid. if ($end < $numPages - 1) { $between = $end + floor(($numPages - $end) / 2); $nav[] = href('…', $parameters + array('page' => $between), array('class' => 'navlink', 'title' => $between)); } // Jump to the last page. if ($end < $numPages) { $nav[] = href($numPages, $parameters + array('page' => $numPages), array('class' => 'navlink')); } // Next page. if ($page < $numPages) { $nav[] = PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir, $crit, $search_method, $step); } else { $nav[] = span(gTxt('next'), array('class' => 'navlink-disabled', 'aria-disabled' => 'true')); } $out[] = n . tag(tag(join(tag_end('li') . tag_start('li'), $nav), 'li'), 'ul', array('class' => 'nav-tertiary prev-next')); } return join('', $out); }
function nav_form($event, $page, $numPages, $sort, $dir, $crit, $method) { if (function_exists('nav_form')) { return nav_form($event, $page, $numPages, $sort, $dir, $crit, $method); } // This is basically stolen from the 4.0.3 version of includes/txp_list.php // - list_nav_form() for 4.0.3 compatibitly $nav[] = $page > 1 ? PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir) : ''; $nav[] = sp . small($page . '/' . $numPages) . sp; $nav[] = $page != $numPages ? PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir) : ''; return $nav ? graf(join('', $nav), ' align="center"') : ''; }
/** * Renders a page navigation form. * * @param string $event Event * @param int $page Current page number * @param int $numPages Total pages * @param string $sort Sort criterion * @param string $dir Sort direction, either "asc" or "desc" * @param string $crit Search criterion * @param string $search_method Search method * @param int $total Total search term hit count [0] * @param int $limit First visible search term hit number [0] * @param string $step Step * @param int $list Number of displayed page links discounting jump links, previous and next * @return string HTML */ function nav_form($event, $page, $numPages, $sort = '', $dir = '', $crit = '', $search_method = '', $total = 0, $limit = 0, $step = 'list', $list = 5) { $out = array(); if ($crit != '' && $total > 1) { $out[] = announce(gTxt('showing_search_results', array('{from}' => ($page - 1) * $limit + 1, '{to}' => min($total, $page * $limit), '{total}' => $total)), TEXTPATTERN_ANNOUNCE_REGULAR); } if ($numPages > 1) { $nav = array(); $list--; $page = max(min($page, $numPages), 1); $start = max(1, min($numPages - $list, $page - floor($list / 2))); $end = min($numPages, $start + $list); $parameters = array('event' => $event, 'step' => $step, 'dir' => $dir, 'crit' => $crit, 'search_method' => $search_method); // Previous page. if ($page > 1) { $nav[] = n . PrevNextLink($event, $page - 1, gTxt('prev'), 'prev', $sort, $dir, $crit, $search_method, $step); } else { $nav[] = n . span(span(gTxt('prev'), array('class' => 'ui-icon ui-icon-arrowthick-1-w')), array('class' => 'disabled', 'aria-disabled' => 'true', 'aria-label' => gTxt('prev'))); } $nav[] = form(n . tag(gTxt('page'), 'label', array('for' => 'current-page')) . n . tag_void('input', array('class' => 'current-page', 'id' => 'current-page', 'name' => 'page', 'type' => 'text', 'size' => INPUT_XSMALL, 'inputmode' => 'numeric', 'pattern' => '[0-9]+', 'value' => $page)) . n . gTxt('of') . n . span($numPages, array('class' => 'total-pages')) . eInput($event) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('crit', $crit) . hInput('search_method', $search_method), '', '', 'get'); // Next page. if ($page < $numPages) { $nav[] = n . PrevNextLink($event, $page + 1, gTxt('next'), 'next', $sort, $dir, $crit, $search_method, $step); } else { $nav[] = n . span(span(gTxt('next'), array('class' => 'ui-icon ui-icon-arrowthick-1-e')), array('class' => 'disabled', 'aria-disabled' => 'true', 'aria-label' => gTxt('next'))); } $out[] = n . tag(join($nav) . n, 'nav', array('class' => 'prev-next')); } return join('', $out); }