本文整理汇总了PHP中addSelect函数的典型用法代码示例。如果您正苦于以下问题:PHP addSelect函数的具体用法?PHP addSelect怎么用?PHP addSelect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addSelect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdvertWithCategories
public function getAdvertWithCategories(array $categoryNames)
{
$qb = $this->createQueryBuilder('a');
$qb->join('a.categories', 'c') - addSelect('c');
$qb->where($qb->expr()->in('c.name', $categoryNames));
return $qb->getQuery()->getResult();
}
示例2: addMultiplicationForm
function addMultiplicationForm()
{
echo '<div class="controls">';
echo '<h3 class="light">Please select the dimensions for your multiplication table below:</h3><br>';
echo '<div class="form_div"><form action="" method="post">';
addSelect('x');
echo 'by';
addSelect('y');
echo '<br><br><input class="btn btn-default btn-submit" type="submit" value="Refresh"></input></form></div></div><br>';
}
示例3: 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();
}
示例4: addSelect
<td>
<?php
echo addSelect("data[{id}][restrictionid]", $restrictions, null, true);
?>
</td>
</tr>
</script>
<?php
echo "\n<table id=\"judgehosts\">\n" . "<tr><th>Hostname</th><th>Active</th><th>Restrictions</th></tr>\n";
if ($cmd == 'add') {
// Nothing, added by javascript in addAddRowButton
} else {
$res = $DB->q('SELECT * FROM judgehost ORDER BY hostname');
$i = 0;
while ($row = $res->next()) {
echo "<tr><td>" . addHidden("keydata[{$i}][hostname]", $row['hostname']) . printhost($row['hostname']) . "</td><td>" . addSelect("data[{$i}][active]", array(1 => 'yes', 0 => 'no'), $row['active'], true) . "</td><td>" . addSelect("data[{$i}][restrictionid]", $restrictions, $row['restrictionid'], true) . "</td></tr>\n";
++$i;
}
}
echo "</table>\n\n<br /><br />\n";
echo addHidden('cmd', $cmd) . ($cmd == 'add' ? addHidden('skipwhenempty', 'hostname') : '') . addHidden('table', 'judgehost') . ($cmd == 'add' ? addAddRowButton('judgehost_template', 'judgehosts') : '') . addSubmit('Save Judgehosts') . addEndForm();
require LIBWWWDIR . '/footer.php';
exit;
}
$res = $DB->q('SELECT judgehost.*, judgehost_restriction.name
FROM judgehost
LEFT JOIN judgehost_restriction USING (restrictionid)
ORDER BY hostname');
$now = now();
$query = 'KEYVALUETABLE SELECT judgehost,
SUM(IF(endtime,endtime,%i) - GREATEST(%i,starttime))
示例5: 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'])) {
示例6: 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';
示例7: addSelect
<tr><td><label for="data_0__categoryid_">Category:</label></td>
<td><?php
$cmap = $DB->q("KEYVALUETABLE SELECT categoryid,name FROM team_category ORDER BY categoryid");
echo addSelect('data[0][categoryid]', $cmap, @$row['categoryid'], true);
?>
</td></tr>
<tr><td><label for="data_0__members_">Members:</label></td>
<td><?php
echo addTextArea('data[0][members]', @$row['members'], 40, 3);
?>
</td></tr>
<tr><td><label for="data_0__affilid_">Affiliation:</label></td>
<td><?php
$amap = $DB->q("KEYVALUETABLE SELECT affilid,name FROM team_affiliation ORDER BY name");
$amap[''] = 'none';
echo addSelect('data[0][affilid]', $amap, @$row['affilid'], true);
?>
</td></tr>
<tr><td><label for="data_0__penalty_">Penalty time:</label></td>
<td><?php
echo addInput('data[0][penalty]', isset($row['penalty']) ? $row['penalty'] : 0, 10, 15, 'required');
?>
</td></tr>
<tr><td><label for="data_0__room_">Location:</label></td>
<td><?php
echo addInput('data[0][room]', @$row['room'], 10, 15);
?>
</td></tr>
<tr><td><label for="data_0__comments_">Comments:</label></td>
<td><?php
echo addTextArea('data[0][comments]', @$row['comments']);
示例8: sm_encode_html_special_chars
for ($i = 0; $i < $mailfetch_server_number; $i++) {
echo "<option value=\"{$i}\">" . sm_encode_html_special_chars($mailfetch_alias_[$i] == '' ? $mailfetch_server_[$i] : $mailfetch_alias_[$i]) . "</option>";
}
echo '</select>' . ' <input type="submit" name="mf_action_mod" value="' . _("Modify") . '" />' . ' <input type="submit" name="mf_action_del" value="' . _("Delete") . '" />' . '</form>';
} else {
echo _("No servers known.");
}
echo '</td></tr></table>';
break;
case 'Delete':
//erase confirmation about a server
echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Confirm Deletion of a Server") . '</b>', 'center', $color[9])) . html_tag('tr', html_tag('td', "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_delete" />' . '<br />' . _("Selected Server:") . " <b>" . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . "</b><br />" . _("Confirm delete of selected server?") . '<br /><br />' . '<input type="submit" name="submit_mailfetch" value="' . _("Confirm Delete") . '" />' . '<br /></form>', 'center', $color[9])), 'center', '', 'width="70%" cellpadding="5" cellspacing="1"');
break;
//modify a server
//modify a server
case 'Modify':
echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"') . html_tag('tr', html_tag('td', '<b>' . _("Modify Server") . '</b>', 'center', $color[9])) . html_tag('tr') . html_tag('td', '', 'center', $color[0]) . "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_modify" />' . html_tag('table') . html_tag('tr', html_tag('th', _("Server:"), 'right') . html_tag('td', '<input type="text" name="mf_server" value="' . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Port:"), 'right') . html_tag('td', '<input type="text" name="mf_port" value="' . sm_encode_html_special_chars($mailfetch_port_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Alias:"), 'right') . html_tag('td', '<input type="text" name="mf_alias" value="' . sm_encode_html_special_chars($mailfetch_alias_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Username:"), 'right') . html_tag('td', '<input type="text" name="mf_user" value="' . sm_encode_html_special_chars($mailfetch_user_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Password:"), 'right') . html_tag('td', '<input type="password" name="mf_pass" value="' . sm_encode_html_special_chars($mailfetch_pass_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Authentication type:"), 'right') . html_tag('td', addSelect('mf_auth', array(MAIL_FETCH_AUTH_USER => _("USER"), MAIL_FETCH_AUTH_APOP => _("APOP"), MAIL_FETCH_AUTH_RFC1939 => _("APOP or USER")), $mailfetch_auth_[$mf_sn], true), 'left')) . html_tag('tr', html_tag('th', _("Connection type:"), 'right') . html_tag('td', addSelect('mf_type', array(MAIL_FETCH_USE_PLAIN => _("Plain text"), MAIL_FETCH_USE_TLS => _("Use TLS"), MAIL_FETCH_USE_STLS => _("Use StartTLS")), $mailfetch_type_[$mf_sn], true), 'left')) . html_tag('tr') . html_tag('th', _("Store in Folder:"), 'right') . html_tag('td', '', 'left');
$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
$boxes = sqimap_mailbox_list($imapConnection);
echo '<select name="mf_subfolder">';
$selected = 0;
if (isset($mailfetch_subfolder_[$mf_sn])) {
$selected = array(strtolower($mailfetch_subfolder_[$mf_sn]));
}
echo sqimap_mailbox_option_list($imapConnection, $selected) . '</select></td></tr>' . html_tag('tr', html_tag('th', ' ', 'right') . html_tag('td', '<input type="checkbox" name="mf_lmos" ' . ($mailfetch_lmos_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Leave Mail on Server"), 'left')) . html_tag('tr', html_tag('th', ' ', 'right') . html_tag('td', '<input type="checkbox" name="mf_login" ' . ($mailfetch_login_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at login"), 'left')) . html_tag('tr', html_tag('th', ' ', 'right') . html_tag('td', '<input type="checkbox" name="mf_fref" ' . ($mailfetch_fref_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at folder refresh"), 'left')) . html_tag('tr', html_tag('td', '<input type="submit" name="submit_mailfetch" value="' . _("Modify Server") . '" />', 'center', '', 'colspan="2"')) . '</table></form></td></tr></table>';
break;
default:
//unsupported action
echo '</form>' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Undefined Function") . '</b>', 'center', $color[9]) . html_tag('td', '<b>' . _("The function you requested is unknown.") . '</b>', 'center', $color[0])), 'center', '', 'width="70%"');
}
$oTemplate->display('footer.tpl');
示例9: OCTET_LENGTH
* under the GNU GPL. See README and COPYING for details.
*/
require 'init.php';
$title = 'Executables';
require LIBWWWDIR . '/header.php';
echo "<h1>Executables</h1>\n\n";
// Select all data, sort problems from the current contest on top.
$res = $DB->q('SELECT execid, description, md5sum, type, OCTET_LENGTH(zipfile) AS size
FROM executable ORDER BY execid');
if ($res->count() == 0) {
echo "<p class=\"nodata\">No executables defined</p>\n\n";
} else {
echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">type</th>" . "<th scope=\"col\">description</th>" . "<th scope=\"col\">size</th><th scope=\"col\">md5</th>" . "<th></th><th></th></tr></thead>\n<tbody>\n";
$lastcid = -1;
while ($row = $res->next()) {
$link = '<a href="executable.php?id=' . urlencode($row['execid']) . '">';
echo "<tr><td class=\"execid\">" . $link . htmlspecialchars($row['execid']) . "</a>" . "</td><td>" . $link . htmlspecialchars($row['type']) . "</a>" . "</td><td>" . $link . htmlspecialchars(str_cut($row['description'], 40)) . "</a>" . "</td><td class=\"size\">" . $link . printsize($row['size']) . "</a>" . "</td><td class=\"md5\">" . $link . htmlspecialchars($row['md5sum']) . "</a>" . "</td>";
if (IS_ADMIN) {
echo '<td title="export executable as zip-file"><a href="executable.php?fetch&id=' . urlencode($row['execid']) . '"><img src="../images/b_save.png" alt="export" /></a></td>' . "<td class=\"editdel\">" . editLink('executable', $row['execid']) . " " . delLink('executable', 'execid', $row['execid']) . "</td>";
}
echo "</tr>\n";
}
echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
echo "<p>" . addLink('executable') . "</p>\n\n";
if (class_exists("ZipArchive")) {
echo "\n" . addForm('executable.php', 'post', null, 'multipart/form-data') . 'Executable archive(s): ' . addSelect('type', $executable_types) . addFileField('executable_archive[]', null, ' required multiple accept="application/zip"') . addSubmit('Upload', 'upload') . addEndForm() . "\n";
}
}
require LIBWWWDIR . '/footer.php';
示例10: putClarificationForm
/**
* Output a form to send a new clarification.
* Set respid to a clarid, to make only responses to same
* sender(s)/recipient(s) or ALL selectable.
*/
function putClarificationForm($action, $respid = NULL, $onlycontest = NULL)
{
$cdatas = getCurContests(TRUE);
if (isset($onlycontest)) {
$cdatas = array($onlycontest => $cdatas[$onlycontest]);
}
$cids = array_keys($cdatas);
if (empty($cids)) {
echo '<p class="nodata">No active contests</p>';
return;
}
require_once 'forms.php';
global $DB;
?>
<script type="text/javascript">
<!--
function confirmClar() {
<?php
if (IS_JURY) {
?>
var sendto_field = document.forms['sendclar'].sendto;
var sendto = sendto_field.value;
var sendto_text = sendto_field.options[sendto_field.selectedIndex].text;
if ( sendto=='domjudge-must-select' ) {
alert('You must select a recipient for this clarification.');
return false;
}
return confirm("Send clarification to " + sendto_text + "?");
<?php
} else {
?>
return confirm("Send clarification request to Jury?");
<?php
}
?>
}
// -->
</script>
<?php
echo addForm($action, 'post', 'sendclar');
echo "<table>\n";
if ($respid) {
$clar = $DB->q('MAYBETUPLE SELECT c.*, t.name AS toname, f.name AS fromname
FROM clarification c
LEFT JOIN team t ON (t.teamid = c.recipient)
LEFT JOIN team f ON (f.teamid = c.sender)
WHERE c.clarid = %i', $respid);
}
if (IS_JURY) {
// list all possible recipients in the "sendto" box
echo "<tr><td><b><label for=\"sendto\">Send to</label>:</b></td><td>\n";
if (!empty($respid)) {
echo addHidden('id', $respid);
}
$options = array('domjudge-must-select' => '(select...)', '' => 'ALL');
if (!$respid) {
$teams = $DB->q('KEYVALUETABLE SELECT teamid, name
FROM team
ORDER BY categoryid ASC, team.name COLLATE utf8_general_ci ASC');
$options += $teams;
} else {
if ($clar['sender']) {
$options[$clar['sender']] = $clar['fromname'] . ' (t' . $clar['sender'] . ')';
} else {
if ($clar['recipient']) {
$options[$clar['recipient']] = $clar['toname'] . ' (t' . $clar['recipient'] . ')';
}
}
}
echo addSelect('sendto', $options, 'domjudge-must-select', true);
echo "</td></tr>\n";
} else {
echo "<tr><td><b>To:</b></td><td>Jury</td></tr>\n";
}
// Select box for a specific problem (only when the contest
// has started) or general issue.
$options = array();
foreach ($cdatas as $cid => $cdata) {
$row = $DB->q('TUPLE SELECT CONCAT(cid, "-general") AS c
FROM contest WHERE cid = %i', $cid);
if (IS_JURY && count($cdatas) > 1) {
$options[$row['c']] = "{$cdata['shortname']} - General issue";
} else {
$options[$row['c']] = "General issue";
}
if (difftime($cdata['starttime'], now()) <= 0) {
$problem_options = $DB->q('KEYVALUETABLE SELECT CONCAT(cid, "-", probid),
CONCAT(shortname, ": ", name) as name
FROM problem
INNER JOIN contestproblem USING (probid)
WHERE cid = %i AND allow_submit = 1
ORDER BY shortname ASC', $cid);
//.........这里部分代码省略.........
示例11: _
}
if (isset($vcard_nice['tel;fax'])) {
$opts[$vcard_nice['tel;fax']] = _("Fax");
}
if (isset($vcard_nice['note'])) {
$opts[$vcard_nice['note']] = _("Note");
}
/*
* If the vcard comes with nothing but name and e-mail address, the user gets
* the chance to type some additional info. If there's more info in the card,
* the user gets to choose what will be added as additional info.
*/
if (count($opts) == 0) {
echo addInput('addaddr[label]', '', '20');
} else {
echo addSelect('addaddr[label]', $opts, '', TRUE);
}
?>
</td></tr>
<tr><td colspan="2" align="center"><br />
<?php
echo addHidden('addaddr[firstname]', $vcard_safe['firstname']) . addHidden('addaddr[lastname]', $vcard_safe['lastname']) . addSubmit(_("Add to Address Book"), 'addaddr[SUBMIT]');
?>
</td></tr>
</table>
</form>
</td></tr>
<tr><td align="center">
<?php
echo '<a href="../src/download.php?absolute_dl=true&passed_id=' . urlencode($passed_id) . '&mailbox=' . urlencode($mailbox) . '&ent_id=' . urlencode($ent_id) . '">' . _("Download this as a file") . '</a>';
?>
示例12: showComposeButtonRow
function showComposeButtonRow()
{
global $use_javascript_addr_book, $save_as_draft, $default_use_priority, $mailprio, $default_use_mdn, $request_mdn, $request_dr, $data_dir, $username;
echo ' <tr>' . "\n" . ' <td></td>' . "\n" . ' <td>' . "\n";
if ($default_use_priority) {
if (!isset($mailprio)) {
$mailprio = '3';
}
echo ' ' . _("Priority") . addSelect('mailprio', array('1' => _("High"), '3' => _("Normal"), '5' => _("Low")), $mailprio, TRUE);
}
$mdn_user_support = getPref($data_dir, $username, 'mdn_user_support', $default_use_mdn);
if ($default_use_mdn) {
if ($mdn_user_support) {
echo ' ' . _("Receipt") . ': ' . addCheckBox('request_mdn', $request_mdn == '1', '1') . _("On Read") . addCheckBox('request_dr', $request_dr == '1', '1') . _("On Delivery");
}
}
echo ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td></td>' . "\n" . ' <td>' . "\n" . ' <input type="submit" name="sigappend" value="' . _("Signature") . '" />' . "\n";
if ($use_javascript_addr_book) {
echo " <script language=\"JavaScript\"><!--\n document.write(\"" . " <input type=button value=\\\"" . _("Addresses") . "\\\" onclick=\\\"javascript:open_abook();\\\" />\");" . " // --></script><noscript>\n" . ' <input type="submit" name="html_addr_search" value="' . _("Addresses") . '" />' . " </noscript>\n";
} else {
echo ' <input type="submit" name="html_addr_search" value="' . _("Addresses") . '" />' . "\n";
}
if ($save_as_draft) {
echo ' <input type="submit" name ="draft" value="' . _("Save Draft") . "\" />\n";
}
echo ' <input type="submit" name="send" value="' . _("Send") . '" />' . "\n";
do_hook('compose_button_row');
echo ' </td>' . "\n" . ' </tr>' . "\n\n";
}
示例13: addressbook_init
}
/* Initialize addressbook */
$abook = addressbook_init();
/* Create search form */
if ($show == 'form' && empty($listall)) {
echo '<form name="sform" target="abookres" action="addrbook_search.php' . '" method="post">' . "\n" . html_tag('table', '', '', '', 'border="0" width="100%" height="100%"') . html_tag('tr') . html_tag('td', ' <strong>' . _("Search for") . "</strong>\n", 'left', '', 'nowrap valign="middle" width="10%"') . html_tag('td', '', 'left', '', '') . addInput('query', $query, 28);
/* List all backends to allow the user to choose where to search */
if ($abook->numbackends > 1) {
echo '<strong>' . _("in") . '</strong> ' . "\n";
$selopts = array();
$selopts['-1'] = _("All address books");
$ret = $abook->get_backend_list();
while (list($undef, $v) = each($ret)) {
$selopts[$v->bnum] = $v->sname;
}
echo addSelect('backend', $selopts, '-1', TRUE);
} else {
echo addHidden('backend', '-1');
}
echo '</td></tr>' . html_tag('tr', html_tag('td', '', 'left') . html_tag('td', '<input type="submit" value="' . _("Search") . '" name="show" />' . ' | <input type="submit" value="' . _("List all") . '" name="listall" />' . "\n" . ' | <input type="button" value="' . _("Close") . '" onclick="parent.close();" />' . "\n", 'left')) . '</table></form>' . "\n";
} else {
/* Show personal addressbook */
if ($show == 'blank' && empty($listall)) {
if ($backend != -1 || $show == 'blank') {
if ($show == 'blank') {
$backend = $abook->localbackend;
}
$res = $abook->list_addr($backend);
if (is_array($res)) {
usort($res, 'alistcmp');
display_result($res, false);
示例14: putClock
/**
* Output clock
*/
function putClock()
{
global $cdata, $username;
echo '<div id="clock">';
// timediff to end of contest
if (difftime(now(), $cdata['starttime']) >= 0 && difftime(now(), $cdata['endtime']) < 0) {
$left = "time left: " . printtimediff(now(), $cdata['endtime']);
} else {
if (difftime(now(), $cdata['activatetime']) >= 0 && difftime(now(), $cdata['starttime']) < 0) {
$left = "time to start: " . printtimediff(now(), $cdata['starttime']);
} else {
$left = "";
}
}
echo "<span id=\"timeleft\">" . $left . "</span>";
global $cid, $cdatas;
// Show a contest selection form, if there are contests
if (IS_JURY || count($cdatas) > 1) {
echo "<div id=\"selectcontest\">\n";
echo addForm('change_contest.php', 'get', 'selectcontestform');
$contests = array_map(function ($c) {
return $c['shortname'];
}, $cdatas);
if (IS_JURY) {
$values = array(-1 => '- No contest');
}
foreach ($contests as $contestid => $name) {
$values[$contestid] = $name;
}
echo 'contest: ' . addSelect('cid', $values, $cid, true);
echo addEndForm();
echo "<script type=\"text/javascript\">\n\t\t document.getElementById('cid').addEventListener('change', function() {\n\t\t document.getElementById('selectcontestform').submit();\n\t});\n</script>\n";
echo "</div>\n";
}
if (logged_in()) {
echo "<div id=\"username\">logged in as " . $username . (have_logout() ? " <a href=\"../auth/logout.php\">×</a>" : "") . "</div>";
}
echo "</div>";
echo "<script type=\"text/javascript\">\n\tvar initial = " . time() . ";\n\tvar activatetime = " . (isset($cdata['activatetime']) ? $cdata['activatetime'] : -1) . ";\n\tvar starttime = " . (isset($cdata['starttime']) ? $cdata['starttime'] : -1) . ";\n\tvar endtime = " . (isset($cdata['endtime']) ? $cdata['endtime'] : -1) . ";\n\tvar offset = 0;\n\tvar date = new Date(initial*1000);\n\tvar timeleftelt = document.getElementById(\"timeleft\");\n\n\tsetInterval(function(){updateClock();},1000);\n\tupdateClock();\n</script>\n";
}
示例15: addressbook_inp_field
/**
* Make an input field
* @param string $label
* @param string $field
* @param string $name
* @param string $size
* @param array $values
* @param string $add
*/
function addressbook_inp_field($label, $field, $name, $size, $values, $add = '')
{
global $color;
$value = isset($values[$field]) ? $values[$field] : '';
if (is_array($value)) {
$td_str = addSelect($name . '[' . $field . ']', $value);
} else {
$td_str = addInput($name . '[' . $field . ']', $value, $size);
}
$td_str .= $add;
return html_tag('tr', html_tag('td', $label . ':', 'right', $color[4]) . html_tag('td', $td_str, 'left', $color[4])) . "\n";
}