本文整理汇总了PHP中HTML_QuickForm::applyFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::applyFilter方法的具体用法?PHP HTML_QuickForm::applyFilter怎么用?PHP HTML_QuickForm::applyFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::applyFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute(ActionMapping $map, ActionForm $form, Request $req)
{
global $papyrine;
$papyrine->entries =& $papyrine->getEntries();
// Instantiate the HTML_QuickForm object
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/group.php';
$form = new HTML_QuickForm('create_entry');
$form->addElement('text', 'title', 'Title:');
$form->addElement('text', 'date', 'Date:');
$form->addElement('text', 'status', 'Status:');
// Get the default handler
$form->addElement('text', 'body', 'Body:');
$form->addElement('submit', null, 'Create');
// Define filters and validation rules
$form->applyFilter('name', 'trim');
$form->addRule('name', 'Please enter your name', 'required', null, 'client');
//get classes registered for entry
//call method
$plugin = new PapyrinePlugin(BASE . 'plugins/categories/');
$object = $plugin->getInstance();
$object->recieveNewEntryForm($form);
$plugin = new PapyrinePlugin(BASE . 'plugins/comments/');
$object = $plugin->getInstance();
$object->recieveNewEntryForm($form);
// Output the form
$papyrine->form = $form->toHTML();
header("Content-Type: application/xhtml+xml;charset=UTF-8");
$papyrine->display('admin/header.html');
$papyrine->display($map->getParameter());
$papyrine->display('admin/footer.html');
}
示例2: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('underviser', 'POST', $this->url());
$form->addElement('text', 'navn', 'Navn');
$form->addElement('text', 'email', 'E-mail');
$form->addElement('textarea', 'besked', 'Besked', array('rows' => 12, 'cols' => 30));
$form->addElement('submit', null, 'Send');
$form->addRule('navn', 'Du skal indtaste et navn', 'required');
$form->addRule('email', 'Du skal indtaste en email', 'required');
$form->addRule('email', 'Du skal indtaste en gyldig email', 'email');
$form->addRule('besked', 'Du skal indtaste en gyldig besked', 'required');
$form->applyFilter('__ALL__', 'trim');
$form->applyFilter('__ALL__', 'strip_tags');
$form->applyFilter('__ALL__', 'addslashes');
return $this->form = $form;
}
示例3: _validate
private function _validate()
{
if ($this->action == TIP_FORM_ACTION_DELETE || $this->action == TIP_FORM_ACTION_CUSTOM) {
// Special case: GET driven form
$this->_form->freeze();
return TIP::getGet('process', 'int') == 1;
}
// Add element and form rules
isset($this->validator) && $this->_form->addFormRule($this->validator);
foreach (array_keys($this->fields) as $id) {
if ($this->_form->elementExists($id)) {
$this->_addGuessedRules($id);
$this->_addCustomRules($id);
}
}
$stage_id = $this->id . '.stage';
$last_stage = HTTP_Session2::get($stage_id);
if (!$this->_form->isSubmitted() || isset($last_stage) && $last_stage < $this->_stage) {
HTTP_Session2::set($stage_id, $this->_stage);
$valid = false;
} elseif (is_null($last_stage)) {
// No last stage defined
TIP::notifyError('double');
$valid = null;
} else {
// Validation
$this->_form->applyFilter('__ALL__', array('TIP', 'extendedTrim'));
$valid = $this->_form->validate();
}
// Perform uploads (if needed)
if (is_callable(array('HTML_QuickForm_attachment', 'doUploads'))) {
HTML_QuickForm_attachment::doUploads($this->_form);
}
return $valid;
}
示例4: array
#
## Further informations
#
$form->addElement('hidden', 'report_id');
$form->addElement('hidden', 'id');
$redirect =& $form->addElement('hidden', 'o');
$redirect->setValue($o);
$tab = array();
$tab[] =& HTML_QuickForm::createElement('radio', 'action', null, _("List"), '1');
$tab[] =& HTML_QuickForm::createElement('radio', 'action', null, _("Form"), '0');
$form->addGroup($tab, 'action', _("Post Validation"), ' ');
$form->setDefaults(array('action' => '1'));
#
## Form Rules
#
$form->applyFilter('__ALL__', 'myTrim');
$form->applyFilter('name', 'myReplace');
$form->addRule('name', _("Compulsory Name"), 'required');
$form->addRule('report_description', _("Compulsory decription"), 'required');
$form->addRule('period', _("Compulsory Period"), 'required');
$form->addRule('subject', _("Compulsory Subject"), 'required');
$form->addRule('report_title', _("Compulsory Title"), 'required');
//$form->addRule('report_hgs', _("Compulsory Hostgroup"), 'required');
$form->addRule('report_cgs', _("Compulsory Contactgroup"), 'required');
$form->addRule('retention', _("Compulsory"), 'required');
$form->setRequiredNote("<font style='color: red;'>*</font> " . _("Required fields"));
#
##End of form definition
#
# Smarty template Init
$tpl = new Smarty();
示例5: foreach
foreach ($payment_options as $value) {
$value = str_replace('pay_', '', $value);
$form->addElement('radio', 'payment_method', ucwords(str_replace('_', ' ', $value)) . ':', null, $value);
}
$form->addElement('header', null, 'Additional requirements:');
$form->addElement('textarea', 'requirements', null, array('class' => 'text_area'));
$s = $form->createElement('select', 'terms', 'I agree to the Terms of Service:', null, array('class' => 'selectbox'));
$s_opts = array(2 => 'Select One', 1 => 'Yes', 0 => 'No');
$s->loadArray($s_opts);
$form->addElement($s);
$form->addRule('terms', 'You have to agree to the teams', 'required');
$form->addRule('terms', 'You have to agree to the teams', 'regex', '/^1$/');
$form->addRule('payment_method', 'Please select a payment method', 'required');
if ($form->validate()) {
// Apply form element filters.
$form->applyFilter('__ALL__', 'escape_data');
$form->freeze();
$values = $form->process(array(&$this, 'formValues'), false);
$pay_method = str_replace('_', ' ', $values['payment_method']);
$invoice = $this->ushop->insertOrder($pay_method);
if ($invoice) {
// email order to user and merchant.
// get mail config.
$this->registry->mail_config = new Config($this->registry, array('path' => $this->registry->ini_dir . '/mail.ini.php'));
// get mailer type and call class instance.
$mailer = $this->registry->mail_config->get('type', 'mailer');
$mail = new Mailer($mailer, $this->registry);
$mail->setMailBody($this->ushop->displayInvoice($_SESSION['user_id'], $invoice));
if ($values['requirements']) {
$mail->addMailBody('<p>' . $values['requirements'] . '</p>');
}
示例6: buildWriteForm
function buildWriteForm($options) {
global $fyr_values, $fyr_postcode, $fyr_who, $fyr_type;
global $fyr_representative, $fyr_voting_area, $fyr_date;
global $fyr_postcode_editable, $fyr_group_msg, $fyr_valid_reps;
global $rep_text, $cobrand, $cocode;
$form_action = cobrand_url($cobrand, '/write', $cocode);
$form = new HTML_QuickForm('writeForm', 'post', $form_action);
if ($fyr_voting_area['name']=='United Kingdom')
$fyr_voting_area['name'] = 'House of Lords';
$write_header = '';
if ($options['include_write_header']){
$write_header = "<strong>Now Write Your Message:</strong> <small>(* means required)</small><br><br>";
}
if ($options['include_fao']){
$write_header = '<strong>For the attention of:</strong>';
}
$stuff_on_left = <<<END
<div class="letter-header">
${write_header}
${rep_text}
<span>${fyr_voting_area['name']}</span>
<span>$fyr_date</span>
</div>
END;
// special formatting for letter-like code, TODO: how do this properly with QuickHtml?
if ($options['table_layout']){
$form->addElement("html", "<tr><td valign=\"top\">$stuff_on_left</td><td align=\"right\">\n<table>"); // CSSify
} else {
$form->addElement("html", "<div class=\"highlight\">$stuff_on_left<ul class=\"data-input\">");
}
$form->addElement('text', 'name', "Your name:<sup>*</sup>", array('size' => 20, 'maxlength' => 255));
$form->addRule('name', 'Please enter your name', 'required', null, null);
$form->applyFilter('name', 'trim');
$form->addElement('text', 'writer_address1', "Address 1:<sup>*</sup>", array('size' => 20, 'maxlength' => 255));
$form->addRule('writer_address1', 'Please enter your address', 'required', null, null);
$form->applyFilter('writer_address1', 'trim');
$form->addElement('text', 'writer_address2', "Address 2:", array('size' => 20, 'maxlength' => 255));
$form->applyFilter('writer_address2', 'trim');
$form->addElement('text', 'writer_town', "Town/City:<sup>*</sup>", array('size' => 20, 'maxlength' => 255));
$form->addRule('writer_town', 'Please enter your town/city', 'required', null, null);
$form->applyFilter('writer_town', 'trim');
# Call it state so that Google Toolbar (and presumably others) can auto-fill.
$form->addElement('text', 'state', 'County:', array('size' => 20, 'maxlength' => 255));
$form->applyFilter('state', 'trim');
if ($fyr_postcode_editable) {
// House of Lords
$form->addElement('text', 'pc', "UK postcode:<sup>*</sup>", array('size' => 20, 'maxlength' => 255));
$form->addRule('pc', 'Please enter a UK postcode (<a href="/about-lords#ukpostcode" target="_blank">why?</a>)', 'required', null, null);
$form->addRule('pc', 'Choose a valid UK postcode (<a href="/about-lords#ukpostcode" target="_blank">why?</a>)', new RulePostcode(), null, null);
$form->applyFilter('pc', 'trim');
} else {
// All other representatives (postcode fixed as must be in constituency)
$form->addElement('static', 'staticpc', 'UK postcode:', htmlentities($fyr_postcode));
}
$form->addElement('text', 'writer_email', "Your email:<sup>*</sup>", array('size' => 20, 'maxlength' => 255));
$form->addRule('writer_email', 'Please enter your email address', 'required', null, null);
$invalid_email_message = cobrand_invalid_email_message($cobrand);
if (!$invalid_email_message) {
$invalid_email_message = 'Choose a valid email address';
}
$form->addRule('writer_email', $invalid_email_message, 'email', null, null);
$form->applyFilter('writer_email', 'trim');
$form->addElement('text', 'writer_email2', "Confirm email:<sup>*</sup>", array('size' => 20, 'maxlength' => 255));
$form->addRule('writer_email2', 'Please re-enter your email address', 'required', null, null);
$form->applyFilter('writer_email2', 'trim');
$form->addFormRule('compare_email_addrs');
/* add additional text explaining why we ask for email address twice? */
# $form->addElement("html", "</td><td colspan=2><p style=\"margin-top: 0em; margin-bottom: -0.2em\"><em style=\"font-size: 75%\">Optional, to let your {$fyr_voting_area['rep_name']} contact you more easily:</em>"); // CSSify
$form->addElement('text', 'writer_phone', "Phone:", array('size' => 20, 'maxlength' => 255));
$form->applyFilter('writer_phone', 'trim');
// special formatting for letter-like code, TODO: how do this properly with QuickHtml?
if ($options['table_layout']){
$form->addElement("html", "</table>\n</td></tr>");
} else {
$form->addElement("html", "</ul>");
}
$form->addElement('textarea', 'body', null, array('rows' => 15, 'cols' => 62));
$form->addRule('body', 'Please enter your message', 'required', null, null);
$form->addRule('body', 'Please enter your message', new RuleAlteredBodyText(), null, null);
$form->addRule('body', 'Please sign at the bottom with your name, or alter the "Yours sincerely" signature', new RuleSigned(), null, null);
$form->addRule('body', 'Your message is a bit too long for us to send', 'maxlength', OPTION_MAX_BODY_LENGTH);
if (!$options['table_layout']){
//.........这里部分代码省略.........
示例7: _findForm
/**
* _findForm
*
* Generate find form
*
* @access private
* @return void
*/
private function _findForm()
{
$form = new HTML_QuickForm('formFind', 'post', './?module=Main&class=Find&event=findNow');
$form->addElement('text', 'domain', _('Domain'));
$form->addElement('submit', 'submit', _('Find Domain'));
$form->addRule('domain', _('Please a domain name'), 'required', null, 'client');
$form->applyFilter('__ALL__', 'trim');
return $form;
}
示例8: getForm
public function getForm()
{
if ($this->form) {
return $this->form;
}
$tilmelding = VIH_Model_LangtKursus_Tilmelding::factory($this->context->name());
$tilmelding->loadBetaling();
$form = new HTML_QuickForm('onlinebetaling', 'POST', $this->url());
$form->addElement('header', null, 'Hvilke beløb vil du betale?');
if ($tilmelding->get('skyldig_tilmeldingsgebyr') > 0) {
$options[0] = HTML_QuickForm::createElement('checkbox', 0, null, number_format($tilmelding->get('skyldig_tilmeldingsgebyr'), 0, ',', '.') . ' kroner (DKK) - dækker tilmeldingsgebyret');
$options[0]->updateAttributes(array('value' => $tilmelding->get('skyldig_tilmeldingsgebyr') * 100));
}
$i = 1;
if ($tilmelding->antalRater() > 0) {
foreach ($tilmelding->getRater() as $rate) {
$options[$i] = HTML_QuickForm::createElement('checkbox', $i, null, number_format($rate['beloeb'], 0, ',', '.') . ' kroner (DKK) - forfalder ' . $rate['dk_betalingsdato']);
$options[$i]->updateAttributes(array('value' => $rate['beloeb'] * 100));
$i++;
}
} elseif ($tilmelding->get('skyldig_tilmeldingsgebyr') == 0) {
$options[0] = HTML_QuickForm::createElement('checkbox', $i, null, 'Du kan betale igen, når vi har oprettet dine rater.');
$options[0]->updateAttributes(array('disabled' => 'disabled'));
}
$form->addGroup($options, 'amount', 'Beløb', '<br />');
$form->addElement('header', null, 'Betaling');
$form->addElement('text', 'cardnumber', 'Kortnummer');
$form->addElement('text', 'cvd', 'Sikkerhedsnummer');
$form->addElement('text', 'mm', 'Mdr.');
$form->addElement('text', 'yy', 'År');
$form->addElement('submit', null, 'Betal');
$form->addRule('cardnumber', 'Du skal skrive et kortnummer', 'required');
$form->addRule('cardnumber', 'Du skal skrive et kortnummer', 'numeric');
$form->addRule('cvd', 'Du skal skrive et sikkerhedsnummer', 'required');
$form->addRule('cvd', 'Du skal skrive et sikkerhedsnummer', 'numeric');
$form->addRule('mm', 'Du skal udfylde mdr.', 'required');
$form->addRule('mm', 'Du skal udfylde mdr.', 'numeric');
$form->addRule('yy', 'Du skal udfylde år ', 'required');
$form->addRule('yy', 'Du skal udfylde år', 'numeric');
$form->applyFilter('__ALL__', 'trim');
$form->applyFilter('__ALL__', 'addslashes');
$form->applyFilter('__ALL__', 'strip_tags');
return $this->form = $form;
}
示例9: array
<?php
session_start();
require "db.php";
echo "<h1>Search</h1>";
$searchform = new HTML_QuickForm('searchform', 'get', 'search.php');
$searchform->addElement('text', 'searchterms', 'Search', array('size' => 20, 'maxlength' => 50));
$searchform->addElement('submit', null, 'Search!');
$searchform->applyFilter('name', 'trim');
$searchform->addRule('searchterms', 'Enter a search term', 'required', null, 'client');
$searchform->display();
echo "<table class='visible' width='100%'cellspacing=0 cellpadding=5>";
echo "<tr><th class='visible'>Login details</th></tr>";
echo "<tr><td>";
if ($_SESSION['SESS_USERNAME']) {
echo "Logged in as <strong>" . $_SESSION['SESS_USERNAME'] . "</strong> - <a href='userlogout.php'>Logout</a>";
echo "<p>";
if ($_SESSION['SESS_USERLEVEL'] > 1) {
echo "<a href='addstory.php'>Post a new story</a><br />";
}
if ($_SESSION['SESS_USERLEVEL'] == 10) {
echo "<a href='addcat.php'>Add a new Category</a><br />";
}
echo "<p>";
} else {
echo "<a href='userlogin.php'>Login</a>";
}
echo "</td></tr>";
echo "</table>";
echo "<h1>Topics</h1>";
$sql = "SELECT * FROM categories WHERE parent = 1;";
示例10: 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.
//.........这里部分代码省略.........
示例11: createLoginForm
/**
* createLoginForm
*
* Create HTML_QuickForm object for the login form
*
* @access protected
* @return object HTML_QuickForm object
*/
protected function createLoginForm()
{
$form = new HTML_QuickForm('formLogin', 'post', $_SERVER['REQUEST_URI'] . '&event=loginNow');
$form->addElement('header', 'MyHeader', _('Login'));
$form->addElement('text', 'email', _('Email'));
$form->addElement('password', 'password', _('Password'));
$form->addElement('submit', 'submit', _('Login'));
$form->addRule('email', _('Please enter your email address'), 'required', null, 'client');
$form->addRule('email', _('Please enter a valid email address'), 'email', null, 'client');
$form->addRule('password', _('Please enter your password'), 'required', null, 'client');
$form->applyFilter('__ALL__', 'trim');
return $form;
}
示例12: process_data
}
$form = new HTML_QuickForm('catform');
$catsql = "SELECT id, category FROM categories WHERE parent = 1 ORDER BY category;";
// $catres = mysql_query($catsql);
$catres = $db->query($catsql);
$catarr[0] = "-- No Parent --";
// while($catrow = mysql_fetch_assoc($catres)) {
foreach ($catres as $catrow) {
$catarr[$catrow['id']] = $catrow['category'];
}
$s =& $form->createElement('select', 'cat_id', 'Parent Category ');
$s->loadArray($catarr, 'cat');
$form->addElement($s);
$form->addElement('text', 'category', 'Category', array('size' => 20, 'maxlength' => 100));
$form->addElement('submit', null, 'Add Story!');
$form->applyFilter('name', 'trim');
$form->addRule('category', 'Please enter a category', 'required', null, 'client');
if ($form->validate()) {
$form->freeze();
$form->process("process_data", false);
header("Location: " . $config_basedir);
} else {
require "header.php";
echo "<h1>Add a category</h1>";
echo "<p>Select the parent category that the new category is part of. If you want to create a new parent category, use the <tt>-- No Parent --</tt> option.</p>";
$form->display();
}
function process_data($values)
{
require "db.php";
global $db;
示例13:
$form->addElement('header', null, 'Betaling');
$form->addElement('text', 'cardnumber', 'Kortnummer');
$form->addElement('text', 'cvd', 'Sikkerhedsnummer');
$form->addElement('text', 'mm', 'Mdr.');
$form->addElement('text', 'yy', 'År');
$form->addElement('html', null, 'Vær opmærksom på, at det kan tage helt op til et minut at gennemføre transaktionen hos PBS.');
$form->addElement('submit', null, 'Betal');
$form->addRule('cardnumber', 'Du skal skrive et kortnummer', 'required');
$form->addRule('cardnumber', 'Du skal skrive et kortnummer', 'numeric');
$form->addRule('cvd', 'Du skal skrive et sikkerhedsnummer', 'required');
$form->addRule('cvd', 'Du skal skrive et sikkerhedsnummer', 'numeric');
$form->addRule('mm', 'Du skal udfylde Mdr.', 'required');
$form->addRule('mm', 'Du skal udfylde Mdr.', 'numeric');
$form->addRule('yy', 'Du skal udfylde År ', 'required');
$form->addRule('yy', 'Du skal udfylde År', 'numeric');
$form->applyFilter('trim', '__ALL__');
$form->applyFilter('addslashes', '__ALL__');
$form->applyFilter('strip_tags', '__ALL__');
if ($form->validate()) {
// først skal vi oprette en betaling - som kan fungere som id hos qp
// betalingen skal kobles til den aktuelle tilmelding
// når vi så har haft den omkring pbs skal betalingen opdateres med status for betalingen
// status sættes til 000, hvis den er godkendt hos pbs.
$eval = false;
$betaling = new VIH_Model_Betaling('elevforeningen', $order_id);
$betaling_amount_quickpay = $betaling_amount * 100;
$betaling_id = $betaling->save(array('type' => 'quickpay', 'amount' => $betaling_amount));
if ($betaling_id == 0) {
trigger_error("Kunne ikke oprette betaling", E_USER_ERROR);
}
$onlinebetaling = new VIH_Onlinebetaling('authorize');
示例14: portfolio
include "trader-functions.php";
redirect_login_pf();
draw_trader_header('select');
// Load the HTML_QuickForm module
require 'HTML/QuickForm.php';
global $db_hostname, $db_database, $db_user, $db_password;
$username = $_SESSION['username'];
$uid = $_SESSION['uid'];
$portfolio = new portfolio($_SESSION['pfid']);
$pfid = $portfolio->getID();
$pfname = $portfolio->getName();
$pf_working_date = $portfolio->getWorkingDate();
$pf_exch = $portfolio->getExch()->getID();
$sql_input_form = new HTML_QuickForm('sql_input');
$sql_input_form->applyFilter('__ALL__', 'trim');
$sql_input_form->addElement('header', null, "SQL to select stocks for '{$pfname}' working date {$pf_working_date}");
$sql_input_form->addElement('textarea', 'sql_select', 'select:', 'wrap="soft" rows="3" cols="50"');
$sql_input_form->addRule('sql_select', 'Must select columns', 'required');
$sql_input_form->addElement('textarea', 'sql_from', 'from:', 'wrap="soft" rows="1" cols="50"');
$sql_input_form->addRule('sql_from', 'Must select tables', 'required');
$sql_input_form->addElement('textarea', 'sql_where', 'where:', 'wrap="soft" rows="4" cols="50"');
$sql_input_form->addRule('sql_where', 'Must include where clause', 'required');
$sql_input_form->addElement('textarea', 'sql_order', 'order by:', 'wrap="soft" rows="1" cols="50"');
$sql_input_form->addRule('sql_order', 'Must order the output', 'required');
$direction = $sql_input_form->addElement('select', 'sql_order_dir', 'direction:');
$direction->addOption('ascending', 'asc');
$direction->addOption('descending', 'desc');
$limit = $sql_input_form->addElement('select', 'sql_limit', 'limit:');
$limit->addOption('1', '1');
$limit->addOption('10', '10');
示例15: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$tilmelding = new VIH_Model_KortKursus_Tilmelding($this->context->name());
$deltagere = $tilmelding->getDeltagere();
$form = new HTML_QuickForm(null, 'post', $this->url(), '', null, true);
$form->addElement('header', null, 'Kontaktperson');
$form->addElement('text', 'kontaktnavn', 'Navn');
$form->addElement('text', 'adresse', 'Adresse');
$form->addElement('text', 'postnr', 'Postnummer');
$form->addElement('text', 'postby', 'By');
$form->addElement('text', 'telefonnummer', 'Telefonnummer');
$form->addElement('text', 'arbejdstelefon', 'Arbejdstelefon', 'Telefonnummer hvor du kan træffes mellem 8 og 16');
$form->addElement('text', 'mobil', 'Mobil');
$form->addElement('text', 'email', 'E-mail');
// Confirmation is sent to this e-mail
$form->addElement('header', null, 'Vil du tegne afbestillingsforsikring');
$form->addElement('radio', 'afbestillingsforsikring', 'Afbestillingsforsikring', 'Ja', 'Ja');
$form->addElement('radio', 'afbestillingsforsikring', '', 'Nej', 'Nej');
$form->addElement('text', 'rabat', 'Rabat');
//$form->addRule('kontaktnavn', 'Skriv venligst dit navn', 'required');
//$form->addRule('adresse', 'Skriv venligst din adresse', 'required');
//$form->addRule('postnr', 'Skriv venligst din postnummer', 'required');
//$form->addRule('postby', 'Skriv venligst din postby', 'required');
//$form->addRule('telefon', 'Skriv venligst din telefonnummer', 'required');
//$form->addRule('arbejdstelefon', 'Skriv venligst din arbejdstelefon', 'required');
//$form->addRule('email', 'Den e-mail du har indtastet er ikke gyldig', 'e-mail');
//$form->addRule('afbestillingsforsikring', 'Du skal vælge, om du vil have en afbestillingsforsikring', 'required');
$form->setDefaults(array('kontaktnavn' => $tilmelding->get('navn'), 'adresse' => $tilmelding->get('adresse'), 'postnr' => $tilmelding->get('postnr'), 'postby' => $tilmelding->get('postby'), 'telefonnummer' => $tilmelding->get('telefonnummer'), 'arbejdstelefon' => $tilmelding->get('arbejdstelefon'), 'mobil' => $tilmelding->get('mobil'), 'email' => $tilmelding->get('email'), 'afbestillingsforsikring' => $tilmelding->get('afbestillingsforsikring'), 'besked' => $tilmelding->get('besked'), 'rabat' => $tilmelding->get('rabat')));
$deltager_nummer = 1;
$i = 0;
foreach ($deltagere as $deltager) {
$form->addElement('header', null, 'Deltager ' . $deltager_nummer);
$form->addElement('hidden', 'deltager_id[' . $i . ']');
$form->addElement('text', 'navn[' . $i . ']', 'Navn');
$form->addElement('text', 'cpr[' . $i . ']', 'CPR-nummer', '(ddmmåå-xxxx)', null);
$form->setDefaults(array('deltager_id[' . $i . ']' => $deltager->get('id'), 'navn[' . $i . ']' => $deltager->get('navn'), 'cpr[' . $i . ']' => $deltager->get('cpr')));
if (!$tilmelding->kursus->isFamilyCourse()) {
$indkvartering_headline = 'Indkvartering';
foreach ($tilmelding->kursus->getIndkvartering() as $key => $indkvartering) {
$form->addElement('radio', 'indkvartering_key[' . $i . ']', $indkvartering_headline, $indkvartering['text'], $indkvartering['indkvartering_key'], 'id="værelse_' . $indkvartering['indkvartering_key'] . '"');
$indkvartering_headline = '';
}
if (empty($indkvartering_headline)) {
$form->addElement('text', 'sambo[' . $i . ']', 'Vil gerne dele bad og toilet / værelse med?');
$form->setDefaults(array('indkvartering_key[' . $i . ']' => $deltager->get('indkvartering_key'), 'sambo[' . $i . ']' => $deltager->get('sambo')));
$form->addRule('værelse[' . $i . ']', 'Du skal vælge en indkvarteringsform', 'required');
}
}
switch ($tilmelding->kursus->get('gruppe_id')) {
case 1:
// golf
$form->addElement('text', 'handicap[' . $i . ']', 'Golfhandicap', '(begynder → skriv 99)');
$form->addElement('text', 'klub[' . $i . ']', 'Klub');
$form->addElement('text', 'dgu[' . $i . ']', 'DGU-medlem', null, null, 'ja');
$form->setDefaults(array('handicap[' . $i . ']' => $deltager->get('handicap'), 'klub[' . $i . ']' => $deltager->get('klub'), 'dgu[' . $i . ']' => $deltager->get('dgu')));
break;
case 3:
// bridge
$niveau = array('Begynder' => 'Begynder', 'Let øvet' => 'Let øvet', 'Øvet' => 'Øvet', 'Meget øvet' => 'Meget øvet');
$form->addElement('select', 'niveau[' . $i . ']', 'Bridgeniveau', $niveau);
//$form->addRule('niveau['.$i.']', 'Hvilket bridgeniveau har du?', 'required');
$form->setDefaults(array('niveau[' . $i . ']' => $deltager->get('niveau')));
break;
case 4:
// golf og bridge
$form->addElement('text', 'handicap[' . $i . ']', 'Golfhandicap', '(ingen spillere med handicap større end 50)');
$form->addElement('text', 'klub[' . $i . ']', 'Klub');
$form->addElement('text', 'dgu[' . $i . ']', 'DGU-medlem', 'Du skal være dgu-medlem for at deltage på kurset', null, 'ja');
$niveau = array('Let øvet' => 'Let øvet', 'Øvet' => 'Øvet', 'Meget øvet' => 'Meget øvet');
$form->addElement('select', 'niveau[' . $i . ']', 'Bridgeniveau', $niveau);
//$form->addRule('handicap['.$i.']', 'Du skal v�lge dit handicap', 'required');
//$form->addRule('klub['.$i.']', 'Hvem vil skrive en klub', 'required');
//$form->addRule('niveau['.$i.']', 'Hvilket bridgeniveau har du?', 'required');
$form->setDefaults(array('handicap[' . $i . ']' => $deltager->get('handicap'), 'klub[' . $i . ']' => $deltager->get('klub'), 'dgu[' . $i . ']' => $deltager->get('dgu'), 'niveau[' . $i . ']' => $deltager->get('niveau')));
break;
default:
break;
}
// switch
$deltager_nummer++;
$i++;
}
// foreach
$form->addElement('header', null, 'Øvrige oplysninger');
$form->addElement('textarea', 'besked', 'Besked');
$form->addElement('submit', null, 'Videre >>');
$form->applyFilter('__ALL__', 'trim');
return $this->form = $form;
}