当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_QuickForm::getSubmitValues方法代码示例

本文整理汇总了PHP中HTML_QuickForm::getSubmitValues方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::getSubmitValues方法的具体用法?PHP HTML_QuickForm::getSubmitValues怎么用?PHP HTML_QuickForm::getSubmitValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML_QuickForm的用法示例。


在下文中一共展示了HTML_QuickForm::getSubmitValues方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin_display

function admin_display($task)
{
    global $db, $cfg;
    if ($task == NULL) {
        $task = 'contests';
    }
    switch ($task) {
        case 'users':
            $table = new HTML_Table();
            $res =& db_query('users_list');
            $res->fetchInto($row);
            // add users table headers
            $headers = array_keys($row);
            array_push($headers, 'groups');
            array_push($headers, 'actions');
            $table->addRow($headers, null, 'TH');
            // add user records
            while ($row) {
                $res2 =& db_query('groups_by_user_id', $row['user_id']);
                // get list of gourps for this user
                $groups = '';
                $res2->fetchInto($row2);
                while ($row2) {
                    $groups .= $row2['name'];
                    if ($res2->fetchInto($row2)) {
                        $groups .= ', ';
                    }
                }
                $res2->free();
                array_push($row, $groups);
                // actions
                array_push($row, "<a href=\"index.php?view=admin&amp;task=edit_user&amp;id={$row['user_id']}\">edit</a>" . ", <a href=\"index.php?view=admin&amp;task=del_user&amp;id={$row['user_id']}\">delete</a>");
                $table->addRow(array_values($row));
                $res->fetchInto($row);
            }
            $res->free();
            $table->altRowAttributes(1, null, array("class" => "altrow"));
            echo '<div class="overflow">' . $table->toHtml() . '</div>';
            break;
        case 'del_user':
            db_query('del_user_by_id', $_GET['id']);
            db_query('del_user_perms_by_id', $_GET['id']);
            redirect('index.php?view=admin&task=users');
            break;
        case 'edit_user':
            // user id to edit given as arg
            $res =& db_query('groups_by_user_id', $_GET['id']);
            // get list of all groups for this user
            $user_groups = array();
            while ($res->fetchInto($row)) {
                array_push($user_groups, $row['group_id']);
            }
            $res->free();
            // get hanndle of user
            $res =& db_query('user_by_id', $_GET['id']);
            $res->fetchInto($row);
            $handle = $row['handle'];
            $res->free();
            $form = new HTML_QuickForm('userForm', 'post', 'index.php?view=admin&task=edit_user&id=' . $_GET['id']);
            $form->addElement('header', null, 'Groups for user ' . $handle . ' (id: ' . $_GET['id'] . ')');
            // get list of all available groups
            $res =& db_query('groups_list');
            // add checkbox for each group
            $groups = array();
            while ($res->fetchInto($row)) {
                $elem =& $form->addElement('checkbox', $row['group_id'], $row['name']);
                if (in_array($row['group_id'], $user_groups)) {
                    $elem->setChecked(true);
                }
                $groups[$row['group_id']] = $row['name'];
            }
            $res->free();
            $form->addElement('submit', 'submit', 'Apply Changes');
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                foreach ($groups as $gid => $name) {
                    $elem =& $form->getElement($gid);
                    if ($data[$gid] == 1) {
                        auth_set_perm($_GET['id'], $gid);
                        $elem->setChecked(true);
                    } else {
                        auth_clear_perm($_GET['id'], $gid);
                        $elem->setChecked(false);
                    }
                }
            }
            $form->display();
            break;
        case 'groups':
            $table = new HTML_Table();
            $res =& db_query('groups_list');
            $res->fetchInto($row);
            // add groups table header
            $headers = array_keys($row);
            array_push($headers, 'views');
            array_push($headers, 'actions');
            $table->addRow($headers, null, 'TH');
            // add group records
            while ($row) {
                $res2 =& db_query('views_by_group_id', $row['group_id']);
//.........这里部分代码省略.........
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:101,代码来源:admin.php

示例2: manage_display


//.........这里部分代码省略.........
                    $table->addRow(array_values($row));
                    $res->fetchInto($row);
                }
                $res->free();
                // display tables
                $table->altRowAttributes(1, null, array("class" => "altrow"));
                echo '<div class="overflow">' . $table->toHtml() . '</div>';
            }
            echo "<hr />";
            // form for adding a problem
            $form = new HTML_QuickForm('problemAddForm', 'post', selflink());
            $form->addElement('header', null, 'Add a problem');
            $form->addElement('text', 'prob_id', 'Name (one word ID): ');
            $form->addElement('text', 'summary', 'Summary: ');
            $form->addElement('text', 'weight', 'Points weightage: ');
            $form->addElement('text', 'time_limit', 'Time limit: ');
            $form->addElement('text', 'mem_limit', 'Memory limit: ');
            $elem =& $form->addElement('textarea', 'content', 'Problem content (XML): ');
            $elem->setRows(10);
            $elem->setCols(80);
            $form->addElement('submit', null, 'Submit');
            $form->applyFilter('prob_id', 'trim');
            $form->applyFilter('summary', 'trim');
            $form->applyFilter('weight', 'trim');
            $form->applyFilter('time_limit', 'trim');
            $form->applyFilter('mem_limit', 'trim');
            $form->addRule('prob_id', 'Problem ID is required', 'required', null, 'client');
            $form->addRule('summary', 'Problem summary is required', 'required', null, 'client');
            $form->addRule('weight', 'Points weightage is required', 'required', null, 'client');
            $form->addRule('time_limit', 'Time limit is required', 'required', null, 'client');
            $form->addRule('mem_limit', 'Memory limit is required', 'required', null, 'client');
            $form->addRule('content', 'Problem content in XML is required', 'required', null, 'client');
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                $errs = problem_check($data['content']);
                if ($errs == null) {
                    $data['contest_id'] = $_GET['id'];
                    $res =& $db->autoExecute('problems', $data, DB_AUTOQUERY_INSERT);
                    if (PEAR::isError($res)) {
                        error($res->toString());
                    }
                    $cache->remove(problem_cache_id($_GET['id'], $data['prob_id']) . '.htm');
                    $cache->remove(problem_cache_id($_GET['id'], $data['prob_id']) . '.prob');
                    redirect('index.php?view=manage&task=problems&id=' . $_GET['id']);
                } else {
                    ?>
<p><b>Error:</b> The problem could not be added due to the following errors encountered while
parsing the problem XML file. Please fix them and try submitting again.</p>
				<?php 
                    echo "<ol class=\"errors\">\n";
                    foreach ($errs as $line) {
                        echo "<li>{$line}</li>\n";
                    }
                    echo "</ol>\n<hr />\n";
                }
            }
            $form->display();
            break;
        case 'del_problem':
            db_query('del_problem_by_id', array($_GET['prob_id'], $_GET['id']));
            redirect('index.php?view=manage&task=problems&id=' . $_GET['id']);
            break;
        case 'edit_problem':
            $res =& db_query('problem_by_id', array($_GET['prob_id'], $_GET['id']));
            $res->fetchInto($row);
            $res->free();
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:67,代码来源:manage.php

示例3: array

$_flexy_options =& PEAR5::getStaticProperty('HTML_Template_Flexy', 'options');
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ImageCache2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy();
$flexy->setData('php_self', $_SERVER['SCRIPT_NAME']);
$flexy->setData('p2vid', P2_VERSION_ID);
$flexy->setData('skin', $skin_en);
$flexy->setData('isPopUp', $isPopUp);
$flexy->setData('pc', !$_conf['ktai']);
$flexy->setData('iphone', $_conf['iphone']);
$flexy->setData('doctype', $_conf['doctype']);
$flexy->setData('extra_headers', $_conf['extra_headers_ht']);
$flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
// }}}
// {{{ validate
$execDL = false;
if ($qf->validate() && ($params = $qf->getSubmitValues()) && isset($params['uri']) && isset($params['download'])) {
    $execDL = true;
    $params = array_map('trim', $params);
    // URLを検証
    $purl = @parse_url($params['uri']);
    if (!$purl || !preg_match('/^(https?)$/', $purl['scheme']) || empty($purl['host']) || empty($purl['path'])) {
        P2Util::pushInfoHtml('<p>エラー: 不正なURL</p>');
        $execDL = false;
        $isError = true;
    }
    // プレビューの大きさ
    if (isset($params['preview_size']) && in_array($params['preview_size'], array_keys($_preview_size))) {
        $thumb_type = (int) $params['preview_size'];
    } else {
        $thumb_type = 1;
    }
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:ic2_getter.php

示例4: array

<table{class}>
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
<tr>
  <td valign="top">{unselected}</td>
  <td align="center">{add}{remove}</td>
  <td valign="top">{selected}</td>
</tr>
</table>
';
$ams->setElementTemplate($template);
if (isset($_POST['fruit'])) {
    $form->setDefaults(array('fruit' => $_POST['fruit']));
}
$form->addElement('submit', 'send', 'Send', array('class' => 'inputCommand'));
$form->addRule('name', 'Your name is required', 'required');
$form->addGroupRule('fruit', 'At least one fruit is required', 'required', null, 1);
$form->applyFilter('__ALL__', 'trim');
$form->applyFilter('__ALL__', 'strip_tags');
$valid = $form->validate();
$tpl = new HTML_Template_Sigma('.');
$tpl->loadTemplateFile('itdynamic.html');
$tpl->setVariable('ams_javascript', $ams->getElementJs(false));
$renderer = new HTML_QuickForm_Renderer_ITDynamic($tpl);
$form->accept($renderer);
if ($valid) {
    $clean = $form->getSubmitValues();
    $msg = sprintf("<p>Welcome <b>%s</b> you've selected these fruits:<br />%s</p>", $clean['name'], implode(', ', $clean['fruit']));
    $tpl->setVariable('message_form_validate', $msg);
}
$tpl->show();
开发者ID:swat30,项目名称:safeballot,代码行数:31,代码来源:qfams_template_1.php

示例5: Smarty

##End of form definition
#
$form->addElement('hidden', 'gopt_id');
$redirect =& $form->addElement('hidden', 'o');
$redirect->setValue($o);
# Smarty template Init
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
$form->setDefaults($oreon->optGen);
$subC =& $form->addElement('submit', 'submitC', _("Save"));
$DBRESULT =& $form->addElement('reset', 'reset', _("Reset"));
$valid = false;
if ($form->validate()) {
    # Update in DB
    $ret = array();
    $ret = $form->getSubmitValues();
    updateOption($pearDB, "pdfreports_smtp_server_address", isset($ret["pdfreports_smtp_server_address"]) && $ret["pdfreports_smtp_server_address"] != NULL ? $ret["pdfreports_smtp_server_address"] : "127.0.0.1");
    updateOption($pearDB, "pdfreports_email_sender", isset($ret["pdfreports_email_sender"]) && $ret["pdfreports_email_sender"] != NULL ? $ret["pdfreports_email_sender"] : "pdfreports@local.loc");
    updateOption($pearDB, "pdfreports_report_author", isset($ret["pdfreports_report_author"]) && $ret["pdfreports_report_author"] != NULL ? $ret["pdfreports_report_author"] : "");
    updateOption($pearDB, "pdfreports_report_header_logo", isset($ret["pdfreports_report_header_logo"]) && $ret["pdfreports_report_header_logo"] != NULL ? $ret["pdfreports_report_header_logo"] : "");
    updateOption($pearDB, "pdfreports_path_gen", isset($ret["pdfreports_path_gen"]) && $ret["pdfreports_path_gen"] != NULL ? $ret["pdfreports_path_gen"] : "/usr/local/centreon/www/modules/pdfreports/generatedFiles/");
    # Update in Oreon Object
    $oreon->initOptGen($pearDB);
    $o = NULL;
    $valid = true;
    $form->freeze();
}
if (!$form->validate() && isset($_POST["gopt_id"])) {
    print "<div class='msg' align='center'>" . _("Impossible to validate, one or more field is incorrect") . "</div>";
}
$form->addElement("button", "change", _("Modify"), array("onClick" => "javascript:window.location.href='?p=" . $p . "&o=pdfreports'"));
开发者ID:hagen3000,项目名称:centreon-pdf-reports,代码行数:31,代码来源:formPdfreports.php

示例6: array

$form->addElement('header', 'information2', _('Nagvis authentication'));
$form->addElement('text', 'centreon_nagvis_uri', _('Nagvis URI'), $attrsTextLong);
$form->addElement('text', 'centreon_nagvis_path', _('Nagvis Path'), $attrsTextLong);
$form->addElement('select', 'centreon_nagvis_auth', _("Single NagVis user auth or Centreon user auth ? "), array("single" => "Single User", "centreon" => "Centreon User"));
$form->addElement('text', 'centreon_nagvis_single_user', _('Nagvis user name'), $attrsTextLong);
$form->addRule('centreon_nagvis_uri', _('Compulsory field'), 'required');
$form->addRule('centreon_nagvis_path', _('Compulsory field'), 'required');
$form->addRule('centreon_nagvis_auth', _('Compulsory field'), 'required');
$form->addRule('centreon_nagvis_single_user', _('Compulsory field'), 'required');
$form->registerRule('exist', 'callback', 'nagvisInstall');
$form->addRule('centreon_nagvis_path', _('Directory does not exist'), 'exist');
$form->setRequiredNote("<font style='color: red;'>*</font>" . _(" Required fields"));
$form->addElement('submit', 'submitC', _("Save"));
$form->addElement('reset', 'reset', _("Reset"));
if ($form->validate()) {
    $values = $form->getSubmitValues();
    $queryInsert = 'UPDATE `options` SET `value` = "%s" WHERE `key` = "%s"';
    $pearDB->query(sprintf($queryInsert, $pearDB->escape($values['centreon_nagvis_uri']), 'centreon_nagvis_uri'));
    $pearDB->query(sprintf($queryInsert, $pearDB->escape($values['centreon_nagvis_path']), 'centreon_nagvis_path'));
    $pearDB->query(sprintf($queryInsert, $pearDB->escape($values['centreon_nagvis_auth']), 'centreon_nagvis_auth'));
    $pearDB->query(sprintf($queryInsert, $pearDB->escape($values['centreon_nagvis_single_user']), 'centreon_nagvis_single_user'));
}
/*
 * Get options
 */
if (!isset($values)) {
    $values = array();
    $query = 'SELECT `key`, `value` FROM `options` WHERE `key` IN ("centreon_nagvis_uri", "centreon_nagvis_path", "centreon_nagvis_auth", "centreon_nagvis_single_user")';
    $res = $pearDB->query($query);
    if (!PEAR::isError($res)) {
        while ($row = $res->fetchRow()) {
开发者ID:chinaares,项目名称:centreon-nagvis,代码行数:31,代码来源:nagvis-config.php

示例7: array

    $flexy->setData('k_color', array('c_bgcolor' => !empty($_conf['mobile.background_color']) ? $_conf['mobile.background_color'] : '#ffffff', 'c_text' => !empty($_conf['mobile.text_color']) ? $_conf['mobile.text_color'] : '#000000', 'c_link' => !empty($_conf['mobile.link_color']) ? $_conf['mobile.link_color'] : '#0000ff', 'c_vlink' => !empty($_conf['mobile.vlink_color']) ? $_conf['mobile.vlink_color'] : '#9900ff'));
    $flexy->setData('top_url', dirname($_SERVER['SCRIPT_NAME']) . '/index.php');
    $flexy->setData('accesskey', $_conf['accesskey']);
} else {
    $flexy->setData('skin', str_replace('&amp;', '&', $skin_en));
}
$flexy->setData('pc', !$_conf['ktai']);
$flexy->setData('iphone', $_conf['iphone']);
$flexy->setData('doctype', $_conf['doctype']);
$flexy->setData('extra_headers', $_conf['extra_headers_ht']);
$flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
// }}}
// {{{ validate
// 検証
$qf->validate();
$sv = $qf->getSubmitValues();
$page = ImageCache2_ParameterUtility::getValidValue('page', $_defaults['page'], 'intval');
$cols = ImageCache2_ParameterUtility::getValidValue('cols', $_defaults['cols'], 'intval');
$rows = ImageCache2_ParameterUtility::getValidValue('rows', $_defaults['rows'], 'intval');
$order = ImageCache2_ParameterUtility::getValidValue('order', $_defaults['order']);
$sort = ImageCache2_ParameterUtility::getValidValue('sort', $_defaults['sort']);
$field = ImageCache2_ParameterUtility::getValidValue('field', $_defaults['field']);
$keyword = ImageCache2_ParameterUtility::getValidValue('keyword', $_defaults['keyword']);
$threshold = ImageCache2_ParameterUtility::getValidValue('threshold', $_defaults['threshold'], 'intval');
$compare = ImageCache2_ParameterUtility::getValidValue('compare', $_defaults['compare']);
$mode = ImageCache2_ParameterUtility::getValidValue('mode', $_defaults['mode'], 'intval');
$thumbtype = ImageCache2_ParameterUtility::getValidValue('thumbtype', $_defaults['thumbtype'], 'intval');
// サムネイル作成クラス
$thumbsize = $thumbtype;
if (!empty($_SESSION['device_pixel_ratio'])) {
    $dpr = $_SESSION['device_pixel_ratio'];
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:iv2.php

示例8: login_display

function login_display($task)
{
    global $db, $cfg;
    if ($task == NULL) {
        if (auth_logged_in()) {
            $task = 'profile';
        } else {
            $task = 'login';
        }
    }
    switch ($task) {
        case "register":
            $form = new HTML_QuickForm('regForm', 'post', 'index.php?view=login&task=register');
            $form->addElement('header', null, 'Register');
            $form->addElement('text', 'handle', 'Handle:');
            $form->addElement('password', 'password', 'Password:');
            $form->addElement('password', 'password2', 'Retype Password:');
            $form->addElement('text', 'email', 'Email:');
            $form->addElement('header', null, 'Personal Information');
            $form->addElement('text', 'first_name', 'First Name:');
            $form->addElement('text', 'last_name', 'Last Name:');
            $date = getdate();
            $form->addElement('date', 'birth_date', 'Date of Birth:', array('minYear' => $date['year'] - 100, 'maxYear' => $date['year']));
            $form->addElement('text', 'address', 'Street Address:');
            $form->addElement('text', 'city', 'City:');
            $form->addElement('text', 'state', 'State:');
            $form->addElement('text', 'zip', 'Zip:');
            $form->addElement('select', 'division', 'Division:', $cfg["tcl"]["divisions"]);
            $form->addElement('text', 'phone', 'Phone:');
            $form->addElement('textarea', 'quote', 'Quote:', array('rows' => 3));
            $form->addElement('header', null, 'For Password Recovery');
            $form->addElement('text', 'question', 'Secret Question:');
            $form->addElement('text', 'secret', 'Secret Answer:');
            $form->addElement('submit', null, 'Submit');
            $form->applyFilter('handle', 'trim');
            $form->applyFilter('handle', 'strtolower');
            $form->applyFilter('email', 'trim');
            $form->applyFilter('first_name', 'trim');
            $form->applyFilter('last_name', 'trim');
            $form->applyFilter('address', 'trim');
            $form->applyFilter('state', 'trim');
            $form->applyFilter('city', 'trim');
            $form->applyFilter('zip', 'trim');
            $form->applyFilter('phone', 'trim');
            $form->applyFilter('question', 'trim');
            $form->applyFilter('secret', 'trim');
            $form->addRule('handle', 'Handle is required.', 'required', null, 'client');
            $form->addRule('handle', 'Handle can only contain alphabets, numbers. and/or undescores.', 'alphanumericscore', null, 'client');
            $form->addRule('password', 'Password is required.', 'required', null, 'client');
            $form->addRule('password2', 'Retyped password is required.', 'required', null, 'client');
            $form->addRule('email', 'Email is required.', 'required', null, 'client');
            $form->addRule('division', 'Division is required.', 'required', null, 'client');
            $form->addRule('first_name', 'First name is required.', 'required', null, 'client');
            $form->addRule('last_name', 'Last name is required.', 'required', null, 'client');
            $form->addRule('question', 'Secret question is required.', 'required', null, 'client');
            $form->addRule('secret', 'Secret answer is required.', 'required', null, 'client');
            $form->addRule('handle', 'Login handle must be between 4 and 15 characters.', 'rangelength', array(4, 15), 'client');
            $form->addRule('password', 'Password must be between 6 and 15 characters.', 'rangelength', array(4, 15), 'client');
            $form->addRule('email', 'Email is invalid.', 'email', null, 'client');
            $form->addRule(array('password', 'password2'), 'Passwords much match.', 'compare', null, 'client');
            $show_form = true;
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                unset($data['password2']);
                // Verify that email is unique
                $res =& db_query('user_by_email', $data['email']);
                if ($res->numRows() != 0) {
                    $res->fetchInto($user);
                    $res->free();
                    ?>
				<p><b>Email already registered to an existing user!</b><br />
				User <?php 
                    echo '<b>' . $user['handle'] . '</b>';
                    ?>
 owns that email address. Maybe you've already registered and forgotten about it?
				Try <a href="index.php?view=login&amp;task=login">logging in</a> if that is the case.</p>
				<?php 
                } else {
                    // Format the birth date correctly
                    $data['birth_date'] = form2sql_date($data['birth_date']);
                    $user = auth_register($data);
                    if ($user == null) {
                        $show_form = false;
                        ?>
	<p><strong>Thanks for registering!</strong><br /> Please proceed to <a href="index.php?view=login&amp;task=login">login</a> into your new account.</p>
	<?php 
                    } else {
                        ?>
	<p><b>That user-handle has already been taken!</b><br/> It belongs to an user registered with the name <?php 
                        echo $user['first_name'] . ' ' . $user['last_name'];
                        ?>
. Please try again with another handle.</p>
	<?php 
                    }
                }
            }
            if ($show_form) {
                ?>
<p><strong>Please fill in your details below.</strong><br /> 
Please choose your <strong>handle</strong> and <strong>division</strong> carefully. Once chosen, they cannot be changed. Moreover, choosing an inappropriate division will lead to disqualification.
//.........这里部分代码省略.........
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:101,代码来源:login.php

示例9: bulletin_display

function bulletin_display($task)
{
    global $db;
    switch ($task) {
        case 'announce':
            bulletin_tabulate(0);
            break;
        case 'show':
            $res =& db_query('bulletin_by_id', array($_GET['id']));
            $res->fetchInto($row);
            $res =& db_query('user_by_id', array($row['poster_id']));
            $res->fetchInto($user);
            echo "<h1>{$row['subject']}</h1>";
            //        $table->addRow(array('Subject: <b>'.$row['subject'].'</b>', 'Posted by: <b>'.user_handle($row['handle']).'</b>'.$action));
            if ($row['addbreaks'] == 1) {
                echo '<div class="message">' . preg_replace('/\\n/', '<br />', $row['message']) . '</div>' . '<i>The above message was posted by <b>' . user_handle($user['handle']) . '</b> on ' . $row['posted'] . '.</i>';
            } else {
                echo '<div class="message">' . $row['message'] . '</div>' . '<i>The above message was posted by <b>' . user_handle($user['handle']) . '</b> on ' . $row['posted'] . '.</i>';
            }
            break;
        case 'analysis':
            bulletin_tabulate(1);
            break;
        case 'admin':
            bulletin_tabulate(2);
            break;
        case 'public':
            bulletin_tabulate(3);
            break;
        case 'edit':
            $form = new HTML_QuickForm('shoutForm', 'post', selflink());
            $form->addElement('header', null, 'Post your message here:');
            $form->addElement('text', 'subject', 'Subject: ');
            $elem =& $form->addElement('checkbox', 'addbreaks', null);
            $elem->setChecked(false);
            $elem->setText('Allow HTML formatting tags. Makes line-break tags necessary.');
            $elem =& $form->addElement('textarea', 'message', 'Shout Message: ');
            $elem->setRows(20);
            $elem->setCols(60);
            $form->addElement('submit', null, 'Post');
            $form->addRule('subject', 'Subject must be maximum 100 characters.', 'maxlength', 100, 'client');
            $res =& db_query('bulletin_by_id', array($_GET['id']));
            $res->fetchInto($row);
            if ($row['addbreaks'] == 1) {
                unset($row['addbreaks']);
            } else {
                $row['addbreaks'] = 1;
            }
            $form->setDefaults($row);
            $res->free();
            if ($form->validate()) {
                $data = $form->getSubmitValues();
                if (!isset($data['addbreaks'])) {
                    $data['addbreaks'] = 1;
                    $data['message'] = htmlentities($data['message']);
                } else {
                    $data['addbreaks'] = 0;
                }
                $res =& $db->autoExecute('bulletin', $data, DB_AUTOQUERY_UPDATE, 'post_id=' . $_GET['id']);
                if (PEAR::isError($res)) {
                    error($res->toString());
                }
                redirect('index.php?view=bulletin&task=' . $_GET['prev']);
            } else {
                $form->display();
            }
            break;
        case 'delete':
            db_query('delete_bulletin_by_id', array($_GET['id']));
            redirect('index.php?view=bulletin&task=' . $_GET['prev']);
            break;
    }
}
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:73,代码来源:bulletin.php

示例10: removeSpaces

 /**
  * 
  * @param type $field Specific rules
  * @return type
  */
 private function removeSpaces($field)
 {
     $ret = $this->formProcessor->getSubmitValues();
     return str_replace(" ", "_", $ret[$field]);
 }
开发者ID:rk4an,项目名称:centreon,代码行数:10,代码来源:Form.php

示例11: submit_field

function submit_field($contest_id, $team_id, &$problem, $practiceMode = false)
{
    global $cfg;
    if ($practiceMode == true) {
        // Check for running contests in practice mode
        $res =& db_query('count_running_contests');
        $res->fetchInto($count);
        if ($count['count'] > 0) {
            ?>
            <p class="system_info"><b>Sorry, solution form is disabled in practice mode.</b><br />
            This is to preserve server resources for the running contest. Practice submissions will be re-enabled when that contest is over.</p>
            <?php 
            return;
        }
    }
    html_include_js($cfg['dir']['scripts'] . '/editor.js');
    $langs = language_list();
    $languages = array();
    foreach ($langs as $lang) {
        require_once $cfg['dir']['languages'] . '/' . $lang . '.php';
        $func = 'lang_' . $lang . '_description';
        $languages[$lang] = $func();
    }
    $lang = $langs[0];
    $source = '';
    $res =& db_query('draft_by_user', array($_SESSION['user_id']));
    if ($res->fetchInto($draft)) {
        if ($draft['contest_id'] == $contest_id && $draft['prob_id'] == $problem['prob_id']) {
            $lang = $draft['language'];
            $source = $draft['source'];
        }
    }
    // Code editing form
    $form = new HTML_QuickForm('submitForm', 'post', selflink() . '#results');
    $e =& $form->addElement('select', 'language', 'Language: ', $languages);
    if (!isset($_POST['language'])) {
        $e->setValue($lang);
    }
    $e =& $form->addElement('textarea', 'source', 'Code: ', array('rows' => 12, 'class' => 'editor'));
    if (!isset($_POST['source'])) {
        $e->setValue($source);
    }
    $form->addElement('html', "\n" . '<tr><td align="right" valign="top"><div id="custom_input1" style="display:none"><b>Custom<br/>Input: </b></div></td>
    		<td><div id="custom_input2" style="display:none"><textarea rows="4" class="editor" name="custom">' . $_POST['custom'] . '</textarea></div></td></tr>' . "\n");
    $form->addElement('html', "\n" . '<tr><td align="right" valign="top"></td><td valign="top" align="left"><input name="test" value="Compile and Test" type="submit"/>
    		<input onclick="handleTestButton()" id="custom_button" name="customb" value="Test with custom input" type="button" />' . "\n");
    if ($practiceMode == false) {
        $form->addElement('html', ' <input name="submitit" value="Submit" type="submit" /></td></tr>');
    } else {
        $form->addElement('html', '</td></tr>');
    }
    $form->applyFilter('source', 'trim');
    //$form->addRule('source', 'Source code area is blank! Refusing to accept.', 'required', null, 'client');
    // Display some text & the form
    ?>
<div class="mimic_para">
<a id="shortcuts_link" onclick="toggleShowShortcuts()" href="#solution">[+] Useful Editor Shortcuts:</a>
<div id="shortcuts"></div>
</div>
<?php 
    html_javascript_check();
    html_rounded_box_open();
    $form->display();
    echo '<div id="edit_status"></div>';
    html_rounded_box_close();
    if ($form->validate()) {
        echo "<a name=\"results\"></a>";
        ?>
<p class="lower"><b>Tester:</b><br /> Please be patient while your code is being compiled and tested.
Results will be displayed in the frame below.</p>
<?php 
        $solution =& $form->getSubmitValues();
        $mode = "";
        if ($practiceMode) {
            $mode = "practice";
        } else {
            if (isset($solution['submitit'])) {
                $mode = "submit";
            }
        }
        if ($id = submit_record($contest_id, $problem['prob_id'], $solution, $mode)) {
            html_rounded_box_open();
            ?>
<iframe width="90%" height="300" scrolling="yes" src="<?php 
            echo "progress.php?id={$id}";
            ?>
">
<!-- Following gets displayed if IFRAME is not supported -->
<b>Your browser is not supported!</b><br />
Please upgrade your browser, as it lacks basic support for inline-frames,
which is necessary for this feature. Recommended browsers are 
<a href="http://www.getfirefox.com">Mozilla/Firefox</a>,
Internet Explorer 5.0+ and Opera 7.0+.
</iframe>
            <?php 
            html_rounded_box_close();
        }
    }
}
开发者ID:reddragon,项目名称:Online-Grading-System,代码行数:99,代码来源:submit.php


注:本文中的HTML_QuickForm::getSubmitValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。