本文整理汇总了PHP中HTML::input方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::input方法的具体用法?PHP HTML::input怎么用?PHP HTML::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run($dbi, $argstr, &$request, $basepage)
{
/* plugin not yet has arguments - save for later (copied from UpLoad)
$args = $this->getArgs($argstr, $request);
extract($args);
*/
$form = HTML::form(array('action' => $request->getPostURL(), 'enctype' => 'multipart/form-data', 'method' => 'post'));
$contents = HTML::div(array('class' => 'wikiaction'));
$contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE)));
$contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => '50')));
$contents->pushContent(HTML::raw(" "));
$contents->pushContent(HTML::input(array('value' => _("Convert"), 'type' => 'submit')));
$form->pushContent($contents);
$message = HTML();
$userfile = $request->getUploadedFile('userfile');
if ($userfile) {
$userfile_name = $userfile->getName();
$userfile_name = basename($userfile_name);
$userfile_tmpname = $userfile->getTmpName();
if (!preg_match("/(\\.html|\\.htm)\$/i", $userfile_name)) {
$message->pushContent(_("Only files with extension HTML are allowed"), HTML::br(), HTML::br());
} else {
$message->pushContent(_("Processed {$userfile_name}"), HTML::br(), HTML::br());
$message->pushContent(_("Copy the output below and paste it into your Wiki page."), HTML::br());
$message->pushContent($this->_process($userfile_tmpname));
}
} else {
$message->pushContent(HTML::br(), HTML::br());
}
$result = HTML();
$result->pushContent($form);
$result->pushContent($message);
return $result;
}
示例2: run
function run($dbi, $argstr, &$request, $basepage)
{
$request->setArg('action', false);
$args = $this->getArgs($argstr, $request);
extract($args);
if ($goto = $request->getArg('goto')) {
// The user has pressed 'Go'; process request
$request->setArg('goto', false);
$target = $goto['target'];
if ($dbi->isWikiPage($target)) {
$url = WikiURL($target, 0, 1);
} else {
$url = WikiURL($target, array('action' => 'edit'), 1);
}
$request->redirect($url);
// User should see nothing after redirect
return '';
}
$action = $request->getURLtoSelf();
$form = HTML::form(array('action' => $action, 'method' => 'post'));
$form->pushContent(HiddenInputs($request->getArgs()));
$textfield = HTML::input(array('type' => 'text', 'size' => $size, 'name' => 'goto[target]'));
$button = Button('submit:goto[go]', _("Go"), false);
$form->pushContent($textfield, $button);
return $form;
}
示例3: render
public function render()
{
$this->getAttributes();
$this->attributes->value = $this->label;
$this->attributes->label = '';
$this->code = HTML::input($this->attributes);
return parent::render();
}
示例4: render
public function render()
{
$this->prepareOptions();
$this->value = $this->label;
$this->options->label = '';
$this->code = HTML::input($this->options);
return parent::render();
}
示例5: getFormElements
function getFormElements()
{
$el = array();
if (!$this->request->getSessionVar('captcha_ok')) {
$el['CAPTCHA_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit:captcha_input', 'name' => 'edit[captcha_input]', 'size' => $this->length + 2, 'maxlength' => 256));
$url = WikiURL("", array("action" => "captcha", "id" => time()), false);
$el['CAPTCHA_IMAGE'] = "<img src=\"{$url}\" alt=\"captcha\" />";
$el['CAPTCHA_LABEL'] = '<label for="edit:captcha_input">' . _("Type word above:") . ' </label>';
}
return $el;
}
示例6: doForm
function doForm(&$request, $userid = '', $header = '', $footer = '')
{
$post_args = $request->getArg('admin_reset');
if (!$header) {
$header = HTML::p(_("Reset password of user: "), HTML::Raw(' '), HTML::input(array('type' => 'text', 'name' => "user", 'value' => $userid)));
}
if (!$footer) {
$isadmin = $request->_user->isAdmin();
$footer = HTML::p(Button('submit:admin_reset[reset]', $isadmin ? _("Yes") : _("Send email"), $isadmin ? 'wikiadmin' : 'button'), HTML::Raw(' '), Button('submit:admin_reset[cancel]', _("Cancel"), 'button'));
}
return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, HiddenInputs($request->getArgs(), false, array('admin_reset', 'user')), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $footer);
}
示例7: run
function run($dbi, $argstr, &$request, $basepage)
{
/* ignore fatal on loading */
/*
global $ErrorManager;
$ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler'));
*/
// Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki.
// see doc/README.foaf
if (findFile('XML/FOAF/Parser.php', 'missing_ok')) {
require_once 'XML/FOAF/Parser.php';
}
//$ErrorManager->popErrorHandler();
if (!class_exists('XML_FOAF_Parser')) {
return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path"));
}
extract($this->getArgs($argstr, $request));
// Get our FOAF File from the foaf plugin argument or $_GET['foaf']
if (empty($foaf)) {
$foaf = $request->getArg('foaf');
}
$chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF"))));
if (empty($foaf)) {
return $chooser;
} else {
//Error Checking
if (substr($foaf, 0, 7) != "http://") {
return $this->error(_("foaf must be a URI starting with http://"));
}
// Start of output
if (!empty($original)) {
$request->redirect($foaf);
} else {
$foaffile = url_get_contents($foaf);
if (!$foaffile) {
//TODO: get errormsg
return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!"));
}
// Create new Parser object
$parser = new XML_FOAF_Parser();
// Parser FOAF into $foaffile
$parser->parseFromMem($foaffile);
$a = $parser->toArray();
$html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF"))))));
if (DEBUG) {
$html->pushContent(HTML::hr(), $chooser);
}
return $html;
}
}
}
示例8: showForm
function showForm(&$dbi, &$request, $args, $allrelations)
{
global $WikiTheme;
$action = $request->getPostURL();
$hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's'));
$pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$help = Button('submit:semsearch[help]', "?", false);
$svalues = empty($allrelations) ? "" : join("','", $allrelations);
$reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')");
$querybox = HTML::textarea(array('name' => 's', 'title' => _("Enter a valid query expression"), 'rows' => 4, 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), $args['s']);
$submit = Button('submit:semsearch[relations]', _("Search"), false, array('title' => 'Move to help page. No seperate window'));
$instructions = _("Search in all specified pages for the expression.");
$form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => '0', 'width' => '100%'), HTML::tr(HTML::td(_("Pagename(s): "), $pagefilter), HTML::td(array('align' => 'right'), $help)), HTML::tr(HTML::td(array('colspan' => 2), $querybox))), HTML::br(), HTML::div(array('align' => 'center'), $submit));
return $form;
}
示例9: showForm
function showForm(&$dbi, &$request, $args)
{
$action = $request->getPostURL();
$hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'direction'));
$pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$query = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this link. These are pagenames. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$dirsign_switch = JavaScript("\nfunction dirsign_switch() {\n var d = document.getElementById('dirsign')\n d.innerHTML = (d.innerHTML == ' => ') ? ' <= ' : ' => '\n}\n");
$dirsign = " => ";
$in = $out = array('name' => 'direction', 'type' => 'radio', 'onChange' => 'dirsign_switch()');
$out['value'] = 'out';
$out['id'] = 'dir_out';
if ($args['direction'] == 'out') {
$out['checked'] = 'checked';
}
$in['value'] = 'in';
$in['id'] = 'dir_in';
if ($args['direction'] == 'in') {
$in['checked'] = 'checked';
$dirsign = " <= ";
}
$direction = HTML(HTML::input($out), HTML::label(array('for' => 'dir_out'), _("outgoing")), HTML::input($in), HTML::label(array('for' => 'dir_in'), _("incoming")));
/*
$direction = HTML::select(array('name'=>'direction',
'onChange' => 'dirsign_switch()'));
$out = array('value' => 'out');
if ($args['direction']=='out') $out['selected'] = 'selected';
$in = array('value' => 'in');
if ($args['direction']=='in') {
$in['selected'] = 'selected';
$dirsign = " <= ";
}
$direction->pushContent(HTML::option($out, _("outgoing")));
$direction->pushContent(HTML::option($in, _("incoming")));
*/
$submit = Button('submit:search', _("LinkSearch"), false);
$instructions = _("Search in pages for links with the matching name.");
$form = HTML::form(array('action' => $action, 'method' => 'GET', 'accept-charset' => $GLOBALS['charset']), $dirsign_switch, $hiddenfield, $instructions, HTML::br(), $pagefilter, HTML::strong(HTML::tt(array('id' => 'dirsign'), $dirsign)), $query, HTML::raw(' '), $direction, HTML::raw(' '), $submit);
return $form;
}
示例10: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if (empty($action)) {
return $this->error(fmt("A required argument '%s' is missing.", "action"));
}
$form = HTML::form(array('action' => $request->getPostURL(), 'method' => strtolower($method), 'class' => 'wikiaction', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('action' => $action, 'group_id' => GROUP_ID)));
$nbsp = HTML::Raw(' ');
$already_submit = 0;
foreach ($this->inputbox as $inputbox) {
foreach ($inputbox as $inputtype => $input) {
if ($inputtype == 'radiobutton') {
$inputtype = 'radio';
}
// convert from older versions
$input['type'] = $inputtype;
$text = '';
if ($inputtype != 'submit') {
if (empty($input['name'])) {
return $this->error(fmt("A required argument '%s' is missing.", $inputtype . "[][name]"));
}
if (!isset($input['text'])) {
$input['text'] = gettext($input['name']);
}
$text = $input['text'];
unset($input['text']);
}
switch ($inputtype) {
case 'checkbox':
case 'radio':
if (empty($input['value'])) {
$input['value'] = 1;
}
if (is_array($input['value'])) {
$div = HTML::div(array('class' => $class));
$values = $input['value'];
$name = $input['name'];
$input['name'] = $inputtype == 'checkbox' ? $name . "[]" : $name;
foreach ($values as $val) {
$input['value'] = $val;
if ($request->getArg($name)) {
if ($request->getArg($name) == $val) {
$input['checked'] = 'checked';
} else {
unset($input['checked']);
}
}
$div->pushContent(HTML::input($input), $nbsp, $val, $nbsp, "\n");
if (!$nobr) {
$div->pushContent(HTML::br());
}
}
$form->pushContent($div);
} else {
if (empty($input['checked'])) {
if ($request->getArg($input['name'])) {
$input['checked'] = 'checked';
}
} else {
$input['checked'] = 'checked';
}
if ($nobr) {
$form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
} else {
$form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
}
}
break;
case 'editbox':
$input['type'] = 'text';
if (empty($input['value']) and $s = $request->getArg($input['name'])) {
$input['value'] = $s;
}
if ($nobr) {
$form->pushContent(HTML::input($input), $nbsp, $text, $nbsp);
} else {
$form->pushContent(HTML::div(array('class' => $class), HTML::input($input), $text));
}
break;
case 'combobox':
// TODO: moACDROPDOWN
$values = $input['value'];
unset($input['value']);
$input['type'] = 'text';
if (is_string($values)) {
$values = explode(",", $values);
}
if (empty($values)) {
if ($input['method']) {
$input['value'] = xmlrequest($input['method']);
} elseif ($s = $request->getArg($input['name'])) {
$input['value'] = $s;
}
} elseif (is_array($values)) {
$name = $input['name'];
unset($input['name']);
foreach ($values as $val) {
$input = array('value' => $val);
if ($request->getArg($name)) {
if ($request->getArg($name) == $val) {
//.........这里部分代码省略.........
示例11:
<label class="checkbox"><?php
echo HTML::input($element->options);
?>
<?php
echo $element->text;
?>
</label>
示例12: function
<?php
/*
* Client module for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-client
* @package hipanel-module-client
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
*/
use hipanel\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
$this->title = 'Set language';
$this->params['breadcrumbs'][] = $this->title;
echo Html::beginForm(['set-credit'], 'POST');
if (!Yii::$app->request->isAjax) {
echo Html::submitButton(Yii::t('hipanel', 'Submit'), ['class' => 'btn btn-primary']);
}
if (!Yii::$app->request->isAjax) {
echo Html::submitButton(Yii::t('hipanel', 'Cancel'), ['type' => 'cancel', 'class' => 'btn btn-success', 'onClick' => 'history.back()']);
}
Pjax::begin();
$widgetIndexConfig = ['dataProvider' => $dataProvider, 'columns' => [['label' => Yii::t('hipanel', 'Client'), 'format' => 'raw', 'value' => function ($data) {
return HTML::input('hidden', "ids[{$data->id}][Client][id]", $data->id, ['readonly' => 'readonly']) . HTML::tag('span', $data->login);
}], ['label' => Yii::t('hipanel', 'Language'), 'format' => 'raw', 'value' => function ($data) {
return Html::dropDownList("ids[{$data->id}}][Client][language]", $data->language, \hipanel\models\Ref::getList('type,lang', 'hipanel'));
}]]];
echo GridView::widget($widgetIndexConfig);
Pjax::end();
echo Html::endForm();
示例13: run
function run($dbi, $argstr, &$request, $basepage)
{
//if ($request->getArg('action') != 'browse')
// return $this->disabled("(action != 'browse')");
$args = $this->getArgs($argstr, $request);
$this->_args = $args;
extract($args);
$this->preSelectS($args, $request);
$info = $args['info'];
$this->debug = $args['debug'];
// array_multisort($this->_list, SORT_NUMERIC, SORT_DESC);
$pagename = $request->getArg('pagename');
// GetUrlToSelf() with all given params
//$uri = $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']; // without s would be better.
//$uri = $request->getURLtoSelf();//false, array('verify'));
$form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'POST'));
if ($request->getArg('WikiAdminSelect') == _("Go")) {
$p = false;
} else {
$p = $request->getArg('p');
}
//$p = @$GLOBALS['HTTP_POST_VARS']['p'];
$form->pushContent(HTML::p(array('class' => 'wikitext'), _("Select: "), HTML::input(array('type' => 'text', 'name' => 's', 'value' => $args['s'])), HTML::input(array('type' => 'submit', 'name' => 'WikiAdminSelect', 'value' => _("Go")))));
if ($request->isPost() && !$request->getArg('wikiadmin') && !empty($p)) {
$this->_list = array();
// List all selected pages again.
foreach ($p as $page => $name) {
$this->_list[$name] = 1;
}
} elseif ($request->isPost() and $request->_user->isAdmin() and !empty($p) and $request->getArg('action') == 'WikiAdminSelect' and $request->getArg('wikiadmin')) {
// handle external plugin
$loader = new WikiPluginLoader();
$a = array_keys($request->getArg('wikiadmin'));
$plugin_action = $a[0];
$single_arg_plugins = array("Remove");
if (in_array($plugin_action, $single_arg_plugins)) {
$plugin = $loader->getPlugin($plugin_action);
$ul = HTML::ul();
foreach ($p as $page => $name) {
$plugin_args = "run_page={$name}";
$request->setArg($plugin_action, 1);
$request->setArg('p', array($page => $name));
// if the plugin requires more args than the pagename,
// then this plugin will not return. (Rename, SearchReplace, ...)
$action_result = $plugin->run($dbi, $plugin_args, $request, $basepage);
$ul->pushContent(HTML::li(fmt("Selected page '%s' passed to '%s'.", $name, $select)));
$ul->pushContent(HTML::ul(HTML::li($action_result)));
}
} else {
// redirect to the plugin page.
// in which page is this plugin?
$plugin_action = preg_replace("/^WikiAdmin/", "", $plugin_action);
$args = array();
foreach ($p as $page => $x) {
$args["p[{$page}]"] = 1;
}
header("Location: " . WikiURL(_("PhpWikiAdministration") . "/" . _($plugin_action), $args, 1));
exit;
}
} elseif (empty($args['s'])) {
// List all pages to select from.
$this->_list = $this->collectPages($this->_list, $dbi, $args['sortby'], $args['limit']);
}
$pagelist = new PageList_Selectable($info, $args['exclude'], $args);
$pagelist->addPageList($this->_list);
$form->pushContent($pagelist->getContent());
foreach ($args as $k => $v) {
if (!in_array($k, array('s', 'WikiAdminSelect', 'action', 'verify'))) {
$form->pushContent(HiddenInputs(array($k => $v)));
}
// plugin params
}
/*
foreach ($_GET as $k => $v) {
if (!in_array($k,array('s','WikiAdminSelect','action')))
$form->pushContent(HiddenInputs(array($k => $v))); // debugging params, ...
}
*/
if (!$request->getArg('verify')) {
$form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'verify')));
$form->pushContent(Button('submit:verify', _("Select pages"), 'wikiadmin'), Button('submit:cancel', _("Cancel"), 'button'));
} else {
global $WikiTheme;
$form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'WikiAdminSelect')));
// Add the Buttons for all registered WikiAdmin plugins
$plugin_dir = 'lib/plugin';
if (defined('PHPWIKI_DIR')) {
$plugin_dir = PHPWIKI_DIR . "/{$plugin_dir}";
}
$fs = new fileSet($plugin_dir, 'WikiAdmin*.php');
$actions = $fs->getFiles();
foreach ($actions as $f) {
$f = preg_replace('/.php$/', '', $f);
$s = preg_replace('/^WikiAdmin/', '', $f);
if (!in_array($s, array("Select", "Utils"))) {
// disable Select and Utils
$form->pushContent(Button("submit:wikiadmin[{$f}]", _($s), "wikiadmin"));
$form->pushContent($WikiTheme->getButtonSeparator());
}
}
//.........这里部分代码省略.........
示例14:
_offer">
<td class="offer-v3-name">
<div class="offer-v3-code"><?php
echo $model->tovar_id;
?>
</div>
<h3><a href="<?php
echo url::toRoute(['view', 'id' => $model->tovar_id], true);
?>
"><?php
echo $model->tovarname;
?>
</a></h3>
</td>
<td class="offer-v3-store"><?php
echo HTML::input('number', 'tovar_count', $model->tovar_count, ['size' => '3', 'min' => 1, 'max' => 10, 'id' => $model->tovar_id, 'onchange' => 'count(this)']);
?>
</td>
<!-- <td class="offer-v3-stock">8</td>-->
<td class="offer-v3-price" id="<?php
echo $model->tovar_id;
?>
_price"?><?php
echo $model->tovar_price;
?>
</td>
<td class="offer-v3-price" id="<?php
echo $model->tovar_id;
?>
_summa"?><?php
示例15: doPoll
function doPoll($page, $request, $answers, $readonly = false)
{
$question = $this->_args['question'];
$answer = $this->_args['answer'];
$html = HTML::table(array('cellspacing' => 2));
$init = isset($question[0]) ? 0 : 1;
for ($i = $init; $i <= count($question); $i++) {
if (!isset($question[$i])) {
break;
}
$poll = $page->get('poll');
@$poll['data']['all'][$i]++;
$q = $question[$i];
if (!isset($answer[$i])) {
trigger_error(fmt("Missing %s for %s", "answer" . "[{$i}]", "question" . "[{$i}]"), E_USER_ERROR);
}
if (!$readonly) {
$page->set('poll', $poll);
}
$a = $answer[$i];
$result = isset($answers[$i]) ? $answers[$i] : -1;
if (!is_array($a)) {
$checkbox = HTML::input(array('type' => 'checkbox', 'name' => "answer[{$i}]", 'value' => $a));
if ($result >= 0) {
$checkbox->setAttr('checked', "checked");
}
if (!$readonly) {
list($percent, $count, $all) = $this->storeResult($page, $i, $result ? 1 : 0);
} else {
list($percent, $count, $all) = $this->getResult($page, $i, 1);
}
$print = sprintf(_(" %d%% (%d/%d)"), $percent, $count, $all);
$html->pushContent(HTML::tr(HTML::th(array('colspan' => 4, 'align' => 'left'), $q)));
$html->pushContent(HTML::tr(HTML::td($checkbox), HTML::td($a), HTML::td($this->bar($percent)), HTML::td($print)));
} else {
$html->pushContent(HTML::tr(HTML::th(array('colspan' => 4, 'align' => 'left'), $q)));
$row = HTML();
if (!$readonly) {
$this->storeResult($page, $i, $answers[$i]);
}
for ($j = 0; $j <= count($a); $j++) {
if (isset($a[$j])) {
list($percent, $count, $all) = $this->getResult($page, $i, $j);
$print = sprintf(_(" %d%% (%d/%d)"), $percent, $count, $all);
$radio = HTML::input(array('type' => 'radio', 'name' => "answer[{$i}]", 'value' => $j));
if ($result == $j) {
$radio->setAttr('checked', "checked");
}
$row->pushContent(HTML::tr(HTML::td($radio), HTML::td($a[$j]), HTML::td($this->bar($percent)), HTML::td($print)));
}
}
$html->pushContent($row);
}
}
if (!$readonly) {
return HTML(HTML::h3(_("The result of this poll so far:")), $html, HTML::p(_("Thanks for participating!")));
} else {
return HTML(HTML::h3(_("The result of this poll so far:")), $html);
}
}