本文整理汇总了PHP中HTML_QuickForm::getSubmitValue方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::getSubmitValue方法的具体用法?PHP HTML_QuickForm::getSubmitValue怎么用?PHP HTML_QuickForm::getSubmitValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::getSubmitValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSubmitValue
/**
*
* @param type $elem
* @return string
*/
public function getSubmitValue($elem = null)
{
if (!isset($elem)) {
return $this->formProcessor->getSubmitValue();
} else {
return $this->formProcessor->getSubmitValue($elem);
}
}
示例2: 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&task=edit_user&id={$row['user_id']}\">edit</a>" . ", <a href=\"index.php?view=admin&task=del_user&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']);
//.........这里部分代码省略.........
示例3: updateRefreshOption
$redirect =& $form->addElement('hidden', 'o');
$redirect->setValue($o);
/*
* Form Rules
*/
$form->applyFilter('_ALL_', 'trim');
$form->addRule('refresh_monitoring', _("Required Field"), 'required');
$form->addRule('refresh_filters', _("Required Field"), 'required');
if (isset($cfg_syslog)) {
$form->setDefaults($cfg_syslog);
} else {
$form->setDefaults(array("refresh_monitoring " => '10', "refresh_filters" => '240'));
}
#End of form definition
if ($form->validate()) {
if ($form->getSubmitValue("submitC")) {
updateRefreshOption();
}
}
/*
* Smarty template Init
*/
$tpl = new Smarty();
$tpl = initSmartyTpl($syslog_mod_path . "include/administration", $tpl);
/*
* Add buttons
*/
if ($o == "m") {
$subC =& $form->addElement('submit', 'submitC', _("Save"));
$res =& $form->addElement('reset', 'reset', _("Reset"));
$redirect->setValue("f");
示例4: 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&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&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.
//.........这里部分代码省略.........
示例5: rtrim
if ($elem) {
return rtrim($elem, "/") . "/";
}
}
$form->addRule('height', _("You need to fix a map height"), 'required', '', 'client');
$form->setJsWarnings(_("Input Error"), "");
$form->applyFilter('_ALL_', 'trim');
$form->setDefaults($sopt);
$form->addElement('submit', 'submitC', _("Save"));
/*
* Smarty template Init
*/
$tpl = new Smarty();
$tpl = initSmartyTpl($path, $tpl);
if ($form->validate()) {
updateGmapCFG($form->getSubmitValue("id"));
$o = "w";
$valid = true;
$sopt = readConfigOptions($pearDB, $oreon);
}
/*
* Apply a template definition
*/
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($tpl);
$form->accept($renderer);
$tpl->assign('form', $renderer->toArray());
$tpl->assign('o', $o);
$tpl->assign('valid', $valid);
$tpl->assign("gmap_lat", $sopt['lat']);
$tpl->assign("gmap_lng", $sopt['lng']);
$tpl->assign("gmap_zoom", $sopt['zoomLevel']);
示例6: getSubmitValue
function getSubmitValue($name)
{
return addslashes(parent::getSubmitValue($name));
}
示例7: spc_like_form
function spc_like_form()
{
global $spcIn, $post, $wpdb, $spc, $errors, $recaptcha_opt, $spc_captcha_activated, $spc_mcsp;
//spc_dg($spcin->get('gil'));
// Instantiate the HTML_QuickForm object
$form = new HTML_QuickForm('likeForm', 'POST', $post->guid . "#like");
$spc_mcsp->GenerateValues();
$form->setDefaults(array('mcsp_result' => $spc_mcsp->info['result']));
// Add some elements to the form
$form->addElement('header', 'notification', '');
$form->addElement('hidden', 'post_id', $post->ID);
$form->addElement('hidden', 'comment_id');
$form->addElement('hidden', 'spcform', 'likeform');
$form->addElement('text', 'ln', 'Name:', array('size' => 50, 'maxlength' => 255));
$form->addElement('text', 'le', 'Email:', array('size' => 50, 'maxlength' => 255));
$form->addElement('header', 'captcha_notification', '');
$form->addElement('text', 'human_result', $spc_mcsp->info['operand1'] . ' + ' . $spc_mcsp->info['operand2'] . ' = ', array('size' => 2, 'maxlength' => 2));
$form->addElement('hidden', 'mcsp_result');
$form->addElement('submit', null, 'VOTE');
// Define filters and validation rules
$form->addRule('ln', 'Please enter Your Name', 'required');
$form->addRule('le', 'Please enter Your Email', 'required');
$form->addRule('comment_id', 'Sorry Failed, Refresh your browser', 'required');
$form->registerRule('mcsp_check', 'callback', 'validateMCSP');
$form->addRule('human_result', 'Wrong Sum', 'mcsp_check', TRUE);
if ($form->getSubmitValue('spcform') == 'likeform') {
// Try to validate a form
if ($form->validate()) {
$values = $form->exportValues();
/**/
$post_id = $values['post_id'];
$comment_id = $values['comment_id'];
$participant_vote = $wpdb->get_var("SELECT participant_vote FROM " . $wpdb->spc_participant . " WHERE participant_commentID = " . $comment_id);
unset($values['post_id'], $values['comment_id'], $values['MAX_FILE_SIZE'], $values['mcsp_result'], $values['human_result']);
$temp = array();
$temp = unserialize($participant_vote);
$temp[] = $values;
$update_values = array('participant_vote' => serialize($temp));
if ($wpdb->update($wpdb->spc_participant, $update_values, array('participant_commentID' => $comment_id))) {
$form->setDefaults(array('notification' => '<div style="width:100%; background-color:white;">Vote Submitted</div>'));
}
/**/
}
//END form validation
}
// Output the form
$form->display();
}
示例8: updateReportInDB
} else {
if ($o == "c") {
$subC =& $form->addElement('submit', 'submitC', _("Save"));
$res =& $form->addElement('reset', 'reset', _("Reset"));
$form->setDefaults($report);
} else {
if ($o == "a") {
$subA =& $form->addElement('submit', 'submitA', _("Save"));
$res =& $form->addElement('reset', 'reset', _("Reset"));
}
}
}
$valid = false;
if ($form->validate()) {
$reportObj =& $form->getElement('report_id');
if ($form->getSubmitValue("submitA")) {
$reportObj->setValue(insertReportInDB());
} else {
if ($form->getSubmitValue("submitC")) {
updateReportInDB($reportObj->getValue());
}
}
$o = NULL;
$form->addElement("button", "change", _("Modify"), array("onClick" => "javascript:window.location.href='?p=" . $p . "&o=c&report_id=" . $reportObj->getValue() . "'"));
$form->freeze();
$valid = true;
}
$action =& $form->getSubmitValue("action");
if ($valid && $action["action"]["action"]) {
require_once $path . "listReport.php";
} else {