本文整理汇总了PHP中addSubmit函数的典型用法代码示例。如果您正苦于以下问题:PHP addSubmit函数的具体用法?PHP addSubmit怎么用?PHP addSubmit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addSubmit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: address_form
/**
* Output form to add and modify address data
*/
function address_form($name, $submittext, $values = array())
{
global $color, $squirrelmail_language;
if ($squirrelmail_language == 'ja_JP') {
echo html_tag('table', addressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values, ' <small>' . _("Must be unique") . '</small>') . addressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') . addressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') . addressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') . addressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') . list_writable_backends($name) . html_tag('tr', html_tag('td', addSubmit($submittext, $name . '[SUBMIT]'), 'center', $color[4], 'colspan="2"')), 'center', '', 'border="0" cellpadding="1" width="90%"') . "\n";
} else {
echo html_tag('table', addressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values, ' <small>' . _("Must be unique") . '</small>') . addressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') . addressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') . addressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') . addressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') . list_writable_backends($name) . html_tag('tr', html_tag('td', addSubmit($submittext, $name . '[SUBMIT]'), 'center', $color[4], 'colspan="2"')), 'center', '', 'border="0" cellpadding="1" width="90%"') . "\n";
}
}
示例2: put_print_form
function put_print_form()
{
global $DB, $pagename;
$langs = $DB->q('KEYTABLE SELECT langid AS ARRAYKEY, name, extensions FROM language
WHERE allow_submit = 1 ORDER BY name');
echo "<script type=\"text/javascript\">\n<!--\n";
echo "function detectLanguage(filename)\n\t{\n\t\tvar parts = filename.toLowerCase().split('.').reverse();\n\t\tif ( parts.length < 2 ) return;\n\n\t\t// language ID\n\n\t\tvar elt=document.getElementById('langid');\n\t\t// the 'autodetect' option has empty value\n\t\tif ( elt.value != '' ) return;\n\n\t\tvar langid = getMainExtension(parts[0]);\n\t\tfor (i=0;i<elt.length;i++) {\n\t\t\tif ( elt.options[i].value == langid ) {\n\t\t\t\telt.selectedIndex = i;\n\t\t\t}\n\t\t}\n\n\t}\n";
putgetMainExtension($langs);
echo "// -->\n</script>\n";
echo addForm($pagename, 'post', null, 'multipart/form-data');
?>
<table>
<tr><td><label for="code">File</label>:</td>
<td><input type="file" name="code" id="code" size="40" required onChange='detectLanguage(document.getElementById("code").value);' /></td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr><td><label for="langid">Language</label>:</td>
<td><?php
$langlist = array();
foreach ($langs as $langid => $langdata) {
$langlist[$langid] = $langdata['name'];
}
$langlist[''] = 'plain text';
echo addSelect('langid', $langlist, '', true);
?>
</td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr><td></td>
<td><?php
echo addSubmit('Print code', 'submit');
?>
</td>
</tr>
</table>
<?php
echo addEndForm();
}
示例3: dj_setcookie
$viewall = $_COOKIE['domjudge_balloonviewall'];
}
// Did someone press the view button?
if (isset($_REQUEST['viewall'])) {
$viewall = $_REQUEST['viewall'];
}
dj_setcookie('domjudge_balloonviewall', $viewall);
$refresh = array('after' => 15, 'url' => 'balloons.php');
require LIBWWWDIR . '/header.php';
echo "<h1>Balloon Status</h1>\n\n";
foreach ($cdatas as $cdata) {
if (isset($cdata['freezetime']) && difftime($cdata['freezetime'], now()) <= 0) {
echo "<h4>Scoreboard of c{$cdata['cid']} ({$cdata['shortname']}) is now frozen.</h4>\n\n";
}
}
echo addForm($pagename, 'get') . "<p>\n" . addHidden('viewall', $viewall ? 0 : 1) . addSubmit($viewall ? 'view unsent only' : 'view all') . "</p>\n" . addEndForm();
$contestids = $cids;
if ($cid !== null) {
$contestids = array($cid);
}
// Problem metadata: colours and names.
if (empty($cids)) {
$probs_data = array();
} else {
$probs_data = $DB->q('KEYTABLE SELECT probid AS ARRAYKEY,name,color,cid
FROM problem
INNER JOIN contestproblem USING (probid)
WHERE cid IN (%Ai)', $contestids);
}
$freezecond = array();
if (!dbconfig_get('show_balloons_postfreeze', 0)) {
示例4: dbconfig_get
// only if this is a valid judging, otherwise irrelevant
if ($jud['valid'] || isset($jud['rejudgingid']) && $jud['rvalid']) {
$verification_required = dbconfig_get('verification_required', 0);
if (!($verification_required && $jud['verified'])) {
$val = !$jud['verified'];
echo addForm('verify.php') . addHidden('id', $jud['judgingid']) . addHidden('val', $val) . addHidden('redirect', @$_SERVER['HTTP_REFERER']);
}
echo "<p>Verified: " . "<strong>" . printyn($jud['verified']) . "</strong>";
if ($jud['verified'] && !empty($jud['jury_member'])) {
echo ", by " . specialchars($jud['jury_member']);
if (!empty($jud['verify_comment'])) {
echo ' with comment "' . specialchars($jud['verify_comment']) . '"';
}
}
if (!($verification_required && $jud['verified'])) {
echo '; ' . addSubmit(($val ? '' : 'un') . 'mark verified', 'verify');
if ($val) {
echo ' with comment ' . addInput('comment', '', 25);
}
echo "</p>" . addEndForm();
} else {
echo "</p>\n";
}
}
} else {
// judging not ended yet
echo "<p><b>Judging is not finished yet!</b></p>\n";
}
?>
<script type="text/javascript">
<!--
示例5: sprintf
} else {
if ($reltime < dbconfig_get('judgehost_critical', 120)) {
echo "judgehost-warn";
} else {
echo "judgehost-crit";
}
}
echo "\" title =\"last checked in {$reltime} seconds ago\">";
}
echo $link . CIRCLE_SYM . "</a></td>";
echo "<td>" . $link . (is_null($row['name']) ? '<i>none</i>' : $row['name']) . '</a></td>';
echo "<td title=\"load during the last 2 and 10 minutes and the whole contest\">" . $link . sprintf('%.2f %.2f %.2f', @$work2min[$row['hostname']] / (2 * 60), @$work10min[$row['hostname']] / (10 * 60), @$workcontest[$row['hostname']] / $clen) . "</a></td>";
if (IS_ADMIN) {
if ($row['active']) {
$activepicto = "pause";
$activecmd = "deactivate";
} else {
$activepicto = "play";
$activecmd = "activate";
}
echo "<td><a href=\"judgehost.php?id=" . $row['hostname'] . "&cmd=" . $activecmd . "\"><img class=\"picto\" alt=\"" . $activecmd . "\" title=\"" . $activecmd . " judgehost\" " . "src=\"../images/" . $activepicto . ".png\" /></a></td>";
echo "<td>" . delLink('judgehost', 'hostname', $row['hostname']) . "</td>";
}
echo "</tr>\n";
}
echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
echo addForm($pagename) . "<p>" . addSubmit('Start all judgehosts', 'cmd-activate') . addSubmit('Stop all judgehosts', 'cmd-deactivate') . "<br /><br />\n\n" . addLink('judgehosts', true) . "\n" . editLink('judgehosts', null, true) . "</p>\n" . addEndForm();
}
require LIBWWWDIR . '/footer.php';
示例6: addForm
$restrictions['judged'] = 0;
}
if ($viewtypes[$view] == 'diff') {
$restrictions['rejudgingdiff'] = 1;
}
if (isset($_REQUEST['old_verdict']) && $_REQUEST['old_verdict'] != 'all') {
$restrictions['old_result'] = $_REQUEST['old_verdict'];
}
if (isset($_REQUEST['new_verdict']) && $_REQUEST['new_verdict'] != 'all') {
$restrictions['result'] = $_REQUEST['new_verdict'];
}
echo "<p>Show submissions:</p>\n" . addForm($pagename, 'get') . addHidden('id', $id);
for ($i = 0; $i < count($viewtypes); ++$i) {
echo addSubmit($viewtypes[$i], 'view[' . $i . ']', null, $view != $i);
}
if (isset($_REQUEST['old_verdict'])) {
echo addHidden('old_verdict', $_REQUEST['old_verdict']);
}
if (isset($_REQUEST['new_verdict'])) {
echo addHidden('new_verdict', $_REQUEST['new_verdict']);
}
echo addEndForm() . "<br />\n";
echo addForm($pagename, 'get') . addHidden('id', $id) . addHidden("view[{$view}]", $viewtypes[$view]);
$verdicts = array_keys($verdicts);
array_unshift($verdicts, 'all');
echo "old verdict: " . addSelect('old_verdict', $verdicts, isset($_REQUEST['old_verdict']) ? $_REQUEST['old_verdict'] : 'all');
echo ", new verdict: " . addSelect('new_verdict', $verdicts, isset($_REQUEST['new_verdict']) ? $_REQUEST['new_verdict'] : 'all');
echo addSubmit('filter') . addEndForm();
echo addForm($pagename, 'get') . addHidden('id', $id) . addHidden("view[{$view}]", $viewtypes[$view]) . addSubmit('clear') . addEndForm() . "<br /><br />\n";
putSubmissions($cdatas, $restrictions);
require LIBWWWDIR . '/footer.php';
示例7: addInput
echo addInput('data[0][special_compare_args]', @$row['special_compare_args'], 30, 255);
?>
</td></tr>
</table>
<?php
echo addHidden('cmd', $cmd) . addHidden('table', 'problem') . addHidden('referrer', @$_GET['referrer']) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . addEndForm();
if (class_exists("ZipArchive")) {
$selected_cid = $cid === null ? -1 : $cid;
$contests = $DB->q("KEYVALUETABLE SELECT cid, CONCAT('c', cid, ': ' , shortname, ' - ', name) FROM contest");
$values = array(-1 => 'Do not add / update contest data');
foreach ($contests as $cid => $contest) {
$values[$cid] = $contest;
}
echo "<br /><em>or</em><br /><br />\n" . addForm($pagename, 'post', null, 'multipart/form-data') . addHidden('id', @$row['probid']) . 'Contest: ' . addSelect('contest', $values, $selected_cid, true) . '<label for="problem_archive__">Upload problem archive:</label>' . addFileField('problem_archive[]') . addSubmit('Upload', 'upload') . addEndForm();
}
require LIBWWWDIR . '/footer.php';
exit;
}
$data = $DB->q('TUPLE SELECT p.probid,p.name,
p.timelimit,p.memlimit,p.outputlimit,
p.special_run,p.special_compare,p.special_compare_args,
p.problemtext_type, count(rank) AS ntestcases
FROM problem p
LEFT JOIN testcase USING (probid)
WHERE probid = %i GROUP BY probid', $id);
if (!$data) {
error("Missing or invalid problem id");
}
if (!isset($data['memlimit'])) {
示例8: error
break;
case 'NOCONSTRAINT':
break;
default:
error("{$t}.{$key} is referenced in {$table} with unknown action '{$action}'.");
}
}
}
}
if (isset($_POST['confirm'])) {
// LIMIT 1 is a security measure to prevent our bugs from
// wiping a table by accident.
$DB->q("DELETE FROM {$t} WHERE %SS LIMIT 1", $k);
auditlog($t, implode(', ', $k), 'deleted');
echo "<p>" . ucfirst($t) . " <strong>" . specialchars(implode(", ", $k)) . "</strong> has been deleted.</p>\n\n";
if (!empty($referrer)) {
echo "<p><a href=\"" . $referrer . "\">back to overview</a></p>";
} else {
// one table falls outside the predictable filenames
$tablemulti = $t == 'team_category' ? 'team_categories' : $t . 's';
echo "<p><a href=\"" . $tablemulti . ".php\">back to {$tablemulti}</a></p>";
}
} else {
echo addForm($pagename) . addHidden('table', $t);
foreach ($k as $key => $val) {
echo addHidden($key, $val);
}
echo msgbox("Really delete?", "You're about to delete {$t} <strong>" . specialchars(join(", ", array_values($k))) . (empty($desc) ? '' : ' "' . specialchars($desc) . '"') . "</strong>.<br />\n" . (count($warnings) > 0 ? "<br /><strong>Warning, this will:</strong><br />" . implode('<br />', $warnings) : '') . "<br /><br />\n" . "Are you sure?<br /><br />\n\n" . (empty($referrer) ? '' : addHidden('referrer', $referrer)) . addSubmit(" Never mind... ", 'cancel') . addSubmit(" Yes I'm sure! ", 'confirm'));
echo addEndForm();
}
require LIBWWWDIR . '/footer.php';
示例9: header
// Our color field can be both a HTML color name and an RGB value,
// so we output it only in the human-readable field "color" and
// leave the field "rgb" unset.
$problem['color'] = $prob['color'];
$contest_data['problems'][] = $problem;
}
}
$yaml = Spyc::YAMLDump($contest_data);
echo $yaml;
header('Content-type: text/x-yaml');
header('Content-Disposition: attachment; filename="contest.yaml"');
exit;
}
$title = "Import / export configuration";
require LIBWWWDIR . '/header.php';
echo "<h1>Import / export configuration</h1>\n\n";
if (isset($_GET['import-ok'])) {
echo msgbox("Import successful!", "The file " . specialchars(@$_GET['file']) . " is successfully imported.");
}
echo "<h2>Import from YAML</h2>\n\n";
echo addForm('impexp_contestyaml.php', 'post', null, 'multipart/form-data');
echo msgbox("Please note!", "Importing a contest.yaml may overwrite some settings " . "(e.g. penalty time, clarification categories, clarification answers, etc.)." . "This action can not be undone!");
echo addFileField('import_config');
echo addSubmit('Import', 'import') . addEndForm();
echo "<h2>Export to YAML</h2>\n\n";
echo addForm('impexp_contestyaml.php');
echo '<label for="contest">Select contest: </label>';
$contests = $DB->q("KEYVALUETABLE SELECT cid, name FROM contest");
echo addSelect('contest', $contests, null, true);
echo addSubmit('Export', 'export') . addEndForm();
require LIBWWWDIR . '/footer.php';
示例10: foreach
$editfield = '';
$i = 0;
foreach ($data['value'] as $k => $v) {
if ($data['type'] == 'array_keyval') {
$editfield .= addInput("config_{$key}[{$i}][key]", $k, 0, 0, $extra);
$editfield .= addInput("config_{$key}[{$i}][val]", $v, 0, 0, $extra);
} else {
$editfield .= addInput("config_{$key}[{$i}]", $v, 0, 0, $extra);
}
$editfield .= "<br />";
$i++;
}
if ($data['type'] == 'array_keyval') {
$editfield .= addInput("config_{$key}[{$i}][key]", '', 0, 0, $extra);
$editfield .= addInput("config_{$key}[{$i}][val]", '', 0, 0, $extra);
} else {
$editfield .= addInput("config_{$key}[{$i}]", '', 0, 0, $extra);
}
break;
default:
$editfield = '';
break;
}
// Ignore unknown datatypes
if (empty($editfield)) {
continue;
}
echo "<tr><td>" . htmlspecialchars(ucfirst(strtr($key, '_', ' '))) . "</td><td style=\"white-space: nowrap;\">" . $editfield . "</td><td>" . htmlspecialchars($data['desc']) . "</td></tr>\n";
}
echo "</tbody>\n</table>\n<p>" . addSubmit('Save', 'save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate') . "</p>" . addEndForm();
require LIBWWWDIR . '/footer.php';
示例11: addHidden
?>
<label for="data_0__visible_0">no</label></td></tr>
</table>
<?php
echo addHidden('cmd', $cmd) . addHidden('table', 'team_category') . addHidden('referrer', @$_GET['referrer'] . ($cmd == 'edit' ? strstr(@$_GET['referrer'], '?') === FALSE ? '?edited=1' : '&edited=1' : '')) . addSubmit('Save') . addSubmit('Cancel', 'cancel', null, true, 'formnovalidate' . (isset($_GET['referrer']) ? ' formaction="' . specialchars($_GET['referrer']) . '"' : '')) . addEndForm();
require LIBWWWDIR . '/footer.php';
exit;
}
$data = $DB->q('TUPLE SELECT * FROM team_category WHERE categoryid = %i', $id);
if (!$data) {
error("Missing or invalid category id");
}
if (isset($_GET['edited'])) {
echo addForm('refresh_cache.php') . msgbox("Warning: Refresh scoreboard cache", "If the category sort order was changed, it may be necessary to " . "recalculate any cached scoreboards.<br /><br />" . addSubmit('recalculate caches now', 'refresh')) . addHidden('cid', $id) . addEndForm();
}
echo "<h1>Category: " . specialchars($data['name']) . "</h1>\n\n";
echo "<table>\n";
echo '<tr><td>ID:</td><td>' . specialchars($data['categoryid']) . "</td></tr>\n";
echo '<tr><td>Name:</td><td>' . specialchars($data['name']) . "</td></tr>\n";
echo '<tr><td>Sortorder:</td><td>' . specialchars($data['sortorder']) . "</td></tr>\n";
if (isset($data['color'])) {
echo '<tr><td>Colour: </td><td style="background: ' . specialchars($data['color']) . ';">' . specialchars($data['color']) . "</td></tr>\n";
}
echo '<tr><td>Visible:</td><td>' . printyn($data['visible']) . "</td></tr>\n";
echo "</table>\n\n";
if (IS_ADMIN) {
echo "<p>" . editLink('team_category', $data['categoryid']) . "\n" . delLink('team_category', 'categoryid', $data['categoryid'], $data['name']) . "</p>\n\n";
}
echo "<h2>Teams in " . specialchars($data['name']) . "</h2>\n\n";
示例12: data
<li><a href="impexp_contestyaml.php">Contest data (contest.yaml)</a></li>
<li><a href="problems.php">Problem archive</a></li>
<li>Tab separated, export:
<a href="impexp_tsv.php?act=ex&fmt=groups">groups.tsv</a>,
<a href="impexp_tsv.php?act=ex&fmt=teams">teams.tsv</a>,
<a href="impexp_tsv.php?act=ex&fmt=scoreboard">scoreboard.tsv</a>,
<a href="impexp_tsv.php?act=ex&fmt=results">results.tsv</a>
<li>
<?php
echo addForm('impexp_tsv.php', 'post', null, 'multipart/form-data') . 'Tab separated, import: ' . '<label for="fmt">type:</label> ' . addSelect('fmt', array('groups', 'teams', 'accounts')) . ', <label for="tsv">file:</label>' . addFileField('tsv') . addHidden('act', 'im') . addSubmit('import') . addEndForm();
?>
</li>
</ul>
<h2>Import teams / Upload standings from / to icpc.baylor.edu</h2>
<p>
Create a "Web Services Token" with appropriate rights in the "Export" section
for your contest at <a
href="https://icpc.baylor.edu/login">https://icpc.baylor.edu/login</a>. You can
find the Contest ID (e.g. <code>Southwestern-Europe-2014</code>) in the URL.
</p>
<?php
echo addForm("impexp_baylor.php");
echo "<table>\n";
echo "<tr><td><label for=\"contest\">Contest ID:</label></td>" . "<td>" . addInput('contest', @$contest, null, null, 'required') . "</td></tr>\n";
echo "<tr><td><label for=\"token\">Access token:</label></td>" . "<td>" . addInput('token', @$token, null, null, 'required') . "</td></tr>\n";
echo "</table>\n";
echo addSubmit('Fetch teams', 'fetch') . addSubmit('Upload standings', 'upload') . addEndForm();
require LIBWWWDIR . '/footer.php';
示例13: elseif
// display checkmark when done or ellipsis when next up
if (empty($row[$time . 'time'])) {
// don't display anything before an empty row
} elseif ($haspassed) {
echo "<img src=\"../images/s_success.png\" alt=\"✓\" class=\"picto\" />\n";
$prevchecked = true;
} elseif ($prevchecked) {
echo "…";
$prevchecked = false;
}
echo "</td><td>" . ucfirst($time) . " time:</td><td>" . printtime($row[$time . 'time'], '%Y-%m-%d %H:%M (%Z)') . "</td><td>";
// Show a button for setting the time to now(), only when that
// makes sense. E.g. only for end contest when contest has started.
// No button for 'activate', because when shown by definition always already active
if (IS_ADMIN && ($time == 'start' && !$hasstarted || $time == 'end' && $hasstarted && !$hasended && (empty($row['freezetime']) || $hasfrozen) || $time == 'deactivate' && $hasended && (empty($row['unfreezetime']) || $hasunfrozen) || $time == 'freeze' && $hasstarted && !$hasended && !$hasfrozen || $time == 'unfreeze' && $hasfrozen && !$hasunfrozen && $hasended)) {
echo addSubmit("{$time} now", "donow[{$time}]");
}
echo "</td></tr>";
}
echo "</table>\n";
echo "</fieldset>\n</form>\n\n";
}
}
echo "</fieldset>\n\n";
// Get data. Starttime seems most logical sort criterion.
$res = $DB->q('TABLE SELECT contest.*, COUNT(teamid) AS numteams
FROM contest
LEFT JOIN contestteam USING (cid)
GROUP BY cid ORDER BY starttime DESC');
$numprobs = $DB->q('KEYVALUETABLE SELECT cid, COUNT(probid) FROM contest LEFT JOIN contestproblem USING(cid) GROUP BY cid');
if (count($res) == 0) {
示例14: ON
LEFT JOIN team t ON (t.teamid = c.recipient)
LEFT JOIN team f ON (f.teamid = c.sender)
WHERE c.cid = %i AND c.sender = %i
ORDER BY submittime DESC, clarid DESC', $cid, $teamid);
$clarifications = $DB->q('SELECT c.*, cp.shortname, t.name AS toname, f.name AS fromname,
u.mesgid AS unread
FROM clarification c
LEFT JOIN problem p USING (probid)
LEFT JOIN contestproblem cp USING (probid, cid)
LEFT JOIN team t ON (t.teamid = c.recipient)
LEFT JOIN team f ON (f.teamid = c.sender)
LEFT JOIN team_unread u ON (c.clarid=u.mesgid AND u.teamid = %i)
WHERE c.cid = %i AND c.sender IS NULL
AND ( c.recipient IS NULL OR c.recipient = %i )
ORDER BY c.submittime DESC, c.clarid DESC', $teamid, $cid, $teamid);
echo "<h3 class=\"teamoverview\">Clarifications</h3>\n";
# FIXME: column width and wrapping/shortening of clarification text
if ($clarifications->count() == 0) {
echo "<p class=\"nodata\">No clarifications.</p>\n\n";
} else {
putClarificationList($clarifications, $teamid);
}
echo "<h3 class=\"teamoverview\">Clarification Requests</h3>\n";
if ($requests->count() == 0) {
echo "<p class=\"nodata\">No clarification requests.</p>\n\n";
} else {
putClarificationList($requests, $teamid);
}
echo addForm('clarification.php', 'get') . "<p>" . addSubmit('request clarification') . "</p>" . addEndForm();
echo "</div>\n";
require LIBWWWDIR . '/footer.php';
示例15: get_compact_paginator_str
//.........这里部分代码省略.........
{
static $accesskeys_constructed = FALSE;
/* This will be used as a space. */
global $oTemplate, $nbsp;
// keeps count of how many times
// the paginator is used, avoids
// duplicate naming of <select>
// and GO button
static $display_iterations = 0;
$display_iterations++;
sqgetGlobalVar('PHP_SELF', $php_self, SQ_SERVER);
/* Initialize paginator string chunks. */
$prv_str = '';
$nxt_str = '';
$pg_str = '';
$all_str = '';
$box = urlencode($box);
/* Create simple strings that will be creating the paginator. */
/* This will be used as a seperator. */
$sep = '|';
/* Make sure that our start message number is not too big. */
$iOffset = min($iOffset, $iTotal);
/* Compute the starting message of the previous and next page group. */
$next_grp = $iOffset + $iLimit;
$prev_grp = $iOffset - $iLimit;
if (!$bShowAll) {
/* Compute the basic previous and next strings. */
global $accesskey_mailbox_previous, $accesskey_mailbox_next;
if ($next_grp <= $iTotal && $prev_grp >= 0) {
$prv_str = get_paginator_link($box, $prev_grp, '<', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_previous);
$nxt_str = get_paginator_link($box, $next_grp, '>', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_next);
} else {
if ($next_grp > $iTotal && $prev_grp >= 0) {
$prv_str = get_paginator_link($box, $prev_grp, '<', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_previous);
$nxt_str = '>';
} else {
if ($next_grp <= $iTotal && $prev_grp < 0) {
$prv_str = '<';
$nxt_str = get_paginator_link($box, $next_grp, '>', $accesskeys_constructed ? 'NONE' : $accesskey_mailbox_next);
}
}
}
/* Page selector block. Following code computes page links. */
if ($iLimit != 0 && $page_selector && $iTotal > $iLimit) {
/* Most importantly, what is the current page!!! */
$cur_pg = intval($iOffset / $iLimit) + 1;
/* Compute total # of pages and # of paginator page links. */
$tot_pgs = ceil($iTotal / $iLimit);
/* Total number of Pages */
$last_grp = ($tot_pgs - 1) * $iLimit + 1;
}
} else {
global $accesskey_mailbox_all_paginate;
$pg_str = create_hyperlink("{$php_self}?showall=0&startMessage=1&mailbox={$box}" . (strpos($php_self, 'src/search.php') ? '&smtoken=' . sm_generate_security_token() : ''), _("Paginate"), '', '', '', '', '', $accesskeys_constructed ? array() : array('accesskey' => $accesskey_mailbox_all_paginate));
}
/* Put all the pieces of the paginator string together. */
/**
* Hairy code... But let's leave it like it is since I am not certain
* a different approach would be any easier to read. ;)
*/
$result = '';
if ($prv_str || $nxt_str) {
/* Compute the 'show all' string. */
global $accesskey_mailbox_all_paginate;
$all_str = create_hyperlink("{$php_self}?showall=1&startMessage=1&mailbox={$box}" . (strpos($php_self, 'src/search.php') ? '&smtoken=' . sm_generate_security_token() : ''), _("Show All"), '', '', '', '', '', $accesskeys_constructed ? array() : array('accesskey' => $accesskey_mailbox_all_paginate));
$result .= '[' . get_paginator_link($box, 1, '<<') . ']';
$result .= '[' . $prv_str . ']';
$pg_url = $php_self . '?mailbox=' . $box . (strpos($php_self, 'src/search.php') ? '&smtoken=' . sm_generate_security_token() : '');
$result .= '[' . $nxt_str . ']';
$result .= '[' . get_paginator_link($box, $last_grp, '>>') . ']';
if ($page_selector) {
$options = array();
for ($p = 0; $p < $tot_pgs; $p++) {
$options[$p * $iLimit + 1 . '_' . $box] = $p + 1 . "/{$tot_pgs}";
}
$result .= $nbsp . addSelect('startMessage_' . $display_iterations, $options, ($cur_pg - 1) * $iLimit + 1, TRUE, $javascript_on ? array('onchange' => 'JavaScript:SubmitOnSelect(this, \'' . $pg_url . '&startMessage=\')') : array());
if ($javascript_on) {
//FIXME: What in the world? Two issues here: for one, $javascript_on is supposed
// to have already detected whether or not JavaScript is available and enabled.
// Secondly, we need to rid ourselves of any HTML output in the core. This
// is being removed (but left in case the original author points out why it
// should not be) and we'll trust $javascript_on to do the right thing.
// $result .= '<noscript language="JavaScript">'
// . addSubmit(_("Go"), 'paginator_submit_' . $display_iterations)
// . '</noscript>';
} else {
$result .= addSubmit(_("Go"), 'paginator_submit_' . $display_iterations);
}
}
}
$result .= $pg_str != '' ? '[' . $pg_str . ']' . $nbsp : '';
$result .= $all_str != '' ? $nbsp . '[' . $all_str . ']' . $nbsp . $nbsp : '';
/* If the resulting string is blank, return a non-breaking space. */
if ($result == '') {
$result = ' ';
}
$accesskeys_constructed = TRUE;
/* Return our final magical paginator string. */
return $result;
}