本文整理匯總了PHP中HTML_QuickForm::addElement方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTML_QuickForm::addElement方法的具體用法?PHP HTML_QuickForm::addElement怎麽用?PHP HTML_QuickForm::addElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::addElement方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
function handle(&$params)
{
if (!@$_REQUEST['email']) {
return PEAR::raiseError("No email address specified");
}
import('HTML/QuickForm.php');
$form = new HTML_QuickForm('opt_out_form', 'post');
$form->addElement('hidden', 'email', $_REQUEST['email']);
$form->addElement('hidden', '-action', 'email_opt_out');
$form->addElement('submit', 'submit', 'Cancel Subscription');
if ($form->validate()) {
$res = mysql_query("replace into dataface__email_blacklist (email) values ('" . addslashes($_REQUEST['email']) . "')", df_db());
if (!$res) {
trigger_error(mysql_error(df_db()), E_USER_ERROR);
}
header('Location: ' . DATAFACE_SITE_HREF . '?--msg=' . urlencode('You have successfully opted out of our mail list. You will no longer receive emails from us.'));
exit;
}
ob_start();
$form->display();
$html = ob_get_contents();
ob_end_clean();
$context = array();
$context['form'] = $html;
df_register_skin('email', DATAFACE_PATH . '/modules/Email/templates');
df_display($context, 'email/opt_out_form.html');
}
示例2: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('venteliste', 'POST', $this->url());
$form->addElement('header', 'null', 'Hvor mange personer vil du sætte på venteliste?');
$form->addElement('select', 'antal', 'Antal deltagere', array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
$form->addElement('header', null, 'Din personlige oplysninger');
$form->addElement('text', 'navn', 'Navn');
/*
$form->addElement('text', 'adresse', 'Adresse');
$form->addElement('text', 'postnr', 'Postnr');
$form->addElement('text', 'postby', 'By');
*/
$form->addElement('text', 'email', 'E-mail');
$form->addElement('text', 'arbejdstelefon', 'Telefon (ml. 8 og 16)');
$form->addElement('text', 'telefonnummer', 'Alternativt telefonnummer');
$form->addElement('textarea', 'besked', 'Besked');
$form->addElement('submit', null, 'Send');
$form->addRule("navn", "Du skal udfylde Navn", "required");
//$form->addRule("adresse", "Du skal udfylde Adresse", "required");
//$form->addRule("postnr", "Du skal udfylde Postnr", "required");
//$form->addRule("postby", "Du skal udfylde By", "required");
$form->addRule("arbejdstelefon", "Du skal udfylde telefon", "required");
if (is_numeric($this->query('antal'))) {
$form->setDefaults(array('antal' => $this->query('antal')));
}
return $this->form = $form;
}
示例3: 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');
}
示例4: renderHtml
function renderHtml()
{
$kursus = new VIH_Model_LangtKursus($this->context->name());
if ($this->query("addrate")) {
if (!$kursus->addRate($this->query("addrate"))) {
throw new Exception('Kunne ikke tilføje rate.', E_USER_ERROR);
}
}
$this->document->setTitle('Opdater rater');
$pris = array('kursus' => $kursus);
if ($kursus->antalRater() == 0) {
$form = new HTML_QuickForm('rater', 'POST', $this->url());
$form->addElement('text', 'antal', 'Antal rater');
$form->addElement('text', 'foerste_rate_dato', 'Første rate dato', 'dd-mm-YYYY');
$form->addElement('submit', 'opret_rater', 'Opret rater');
$form_html = $form->toHTML();
} else {
$data = array('kursus' => $kursus);
$tpl = $this->template->create('langekurser/rater_form');
$form_html = $tpl->render($this, $data);
}
$this->document->setTitle('Rater for betaling ' . $kursus->get('kursusnavn'));
$this->document->addOption('Til kurset', $this->context->url());
$tpl = $this->template->create('langekurser/pris');
return '<p><strong>Periode</strong>: ' . $kursus->getDateStart()->format('%d-%m-%Y') . ' — ' . $kursus->getDateEnd()->format('%d-%m-%Y') . '</p>
' . $tpl->render($this, $pris) . $form_html;
}
示例5: makeExportForm
function makeExportForm($selfurl, $inbox)
{
global $uid;
$form = new HTML_QuickForm('export', 'post', "{$selfurl}&op=export&noheaderfooter=true");
$msg = "<p>You can export this data as a CSV (comma-separated values) file, " . "<br/>which can then be imported into Excel for analysis and graphing." . "</p><br/>";
$form->addElement('header', '', 'Export');
$form->addElement('static', '', '', $msg);
$datatype = $form->addElement('select', 'datatype', "Export What", array(EXPORT_ALLDATA => 'All Data', EXPORT_HISTOGRAM_MSG => 'Histogram by Message', EXPORT_HISTOGRAM_DAY => 'Histogram by Day', EXPORT_HISTOGRAM_MONTH => 'Histogram by Month'));
$form->addElement('submit', 'submit', 'Export');
if ($form->validate()) {
$datatypeval = $datatype->getValue();
switch ($datatypeval[0]) {
case EXPORT_ALLDATA:
exportAllData($inbox);
break;
default:
$uidquery = $uid;
if (isadmin() && !$uid) {
unset($uidquery);
}
if ($inbox) {
$counts = generateHistogramInbox($datatypeval[0], $uid);
} else {
$counts = generateHistogramOutbox($datatypeval[0], $uid);
}
$filename = $inbox ? 'inbox-hist-export.csv' : 'outbox-hist-export.csv';
exportHistogram($counts, $filename);
break;
}
exit;
}
$form->display();
}
示例6: body
public function body()
{
ob_start();
//create default module form
print '<div class="title">Select modules to disable</div>';
print 'Selected modules will be marked as not installed but uninstall methods will not be called. Any database tables and other modifications made by modules\' install methods will not be reverted.<br><br>';
print 'To uninstall module please use Modules Administration in Application.';
print '<hr/><br/>';
$form = new HTML_QuickForm('modulesform', 'post', $_SERVER['PHP_SELF'] . '?' . http_build_query($_GET), '', null, true);
$states = array(ModuleManager::MODULE_ENABLED => 'Active', ModuleManager::MODULE_DISABLED => 'Inactive');
$modules = DB::GetAssoc('SELECT * FROM modules ORDER BY state, name');
foreach ($modules as $m) {
$name = $m['name'];
$state = isset($m['state']) ? $m['state'] : ModuleManager::MODULE_ENABLED;
if ($state == ModuleManager::MODULE_NOT_FOUND) {
$state = ModuleManager::MODULE_DISABLED;
}
$form->addElement('select', $name, $name, $states);
$form->setDefaults(array($name => $state));
}
$form->addElement('button', 'submit_button', 'Save', array('class' => 'button', 'onclick' => 'if(confirm("Are you sure?")) document.modulesform.submit();'));
//validation or display
if ($form->validate()) {
//uninstall
$vals = $form->exportValues();
foreach ($vals as $k => $v) {
if (isset($modules[$k]['state']) && $modules[$k]['state'] != $v) {
ModuleManager::set_module_state($k, $v);
}
}
}
$form->display();
return ob_get_clean();
}
示例7: renderHtml
function renderHtml()
{
$type_key = $this->context->getTypeKeys();
if (is_numeric($this->query('sletbillede'))) {
$fields = array('date_updated', 'pic_id');
$values = array('NOW()', 0);
$sth = $this->db->autoPrepare('langtkursus_tilmelding', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $this->query('id'));
$res = $this->db->execute($sth, $values);
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
}
}
$form = new HTML_QuickForm();
$form->addElement('hidden', 'id', $this->name());
$form->addElement('file', 'userfile', 'Fil');
$form->addElement('submit', null, 'Upload');
if ($form->validate()) {
$file = new VIH_FileHandler();
if ($file->upload('userfile')) {
$fields = array('date_updated', 'pic_id');
$values = array('NOW()', $file->get('id'));
$sth = $this->db->autoPrepare('langtkursus_tilmelding', $fields, DB_AUTOQUERY_UPDATE, 'id = ' . $form->exportValue('id'));
$res = $this->db->execute($sth, $values);
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
}
return new k_SeeOther($this->url('./'));
}
}
$tilmelding = new VIH_Model_LangtKursus_Tilmelding($this->name());
if ($tilmelding->get('id') == 0) {
throw new k_http_Response(404);
}
$file = new VIH_FileHandler($tilmelding->get('pic_id'));
$file->loadInstance('small');
$extra_html = $file->getImageHtml($tilmelding->get('name'), 'width="100""');
$file->loadInstance('medium');
$stor = $file->get('file_uri');
if (empty($extra_html)) {
$extra_html = $form->toHTML();
} else {
$extra_html .= ' <br /><a href="' . $stor . '">stor</a> <a href="' . url('./') . '?sletbillede=' . $this->name() . '" onclick="return confirm(\'Er du sikker\');">slet billede</a>';
}
$res = $this->db->query('SELECT *, DATE_FORMAT(date_start, "%d-%m %H:%i") AS date_start_dk, DATE_FORMAT(date_end, "%d-%m %H:%i") AS date_end_dk FROM langtkursus_tilmelding_protokol_item WHERE tilmelding_id = ' . (int) $this->name() . ' ORDER BY date_start DESC, date_end DESC');
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
}
$data = array('items' => $res, 'type_key' => $type_key, 'vis_navn' => false);
$this->document->setTitle($tilmelding->get('navn'));
$this->document->addOption('Ret', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id')));
$this->document->addOption('Indtast', $this->url('indtast'));
$this->document->addOption('Tilmelding', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id')));
$this->document->addOption('Fag', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id') . '/fag'));
$this->document->addOption('Holdliste', $this->context->url());
$this->document->addOption('Diplom', $this->url('../../../langekurser/tilmeldinger/' . $tilmelding->get('id') . '/diplom'));
$tpl = $this->template->create('protokol/liste');
return '<div style="border: 1px solid #ccc; padding: 0.5em; float: right;">' . $extra_html . '</div>
' . $tpl->render($this, $data);
}
示例8: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('search', 'GET', $this->url());
$form->addElement('text', 'search');
$form->addElement('submit', null, 'Søg efter bundtnummer');
return $this->form = $form;
}
示例9: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('faciliteter', 'POST', $this->url());
$form->addElement('file', 'userfile', 'Fil');
$form->addElement('submit', null, 'Upload');
return $this->form = $form;
}
示例10: handle
function handle(&$params)
{
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$this->table =& Dataface_Table::loadTable($query['-table']);
$translations =& $this->table->getTranslations();
foreach (array_keys($translations) as $trans) {
$this->table->getTranslation($trans);
}
//print_r($translations);
if (!isset($translations) || count($translations) < 2) {
// there are no translations to be made
trigger_error('Attempt to translate a record in a table "' . $this->table->tablename . '" that contains no translations.', E_USER_ERROR);
}
$this->translatableLanguages = array_keys($translations);
$translatableLanguages =& $this->translatableLanguages;
$this->languageCodes = new I18Nv2_Language($app->_conf['lang']);
$languageCodes =& $this->languageCodes;
$currentLanguage = $languageCodes->getName($app->_conf['lang']);
if (count($translatableLanguages) < 2) {
return PEAR::raiseError(df_translate('Not enough languages to translate', 'There aren\'t enough languages available to translate.'), DATAFACE_E_ERROR);
}
//$defaultSource = $translatableLanguages[0];
//$defaultDest = $translatableLanguages[1];
$options = array();
foreach ($translatableLanguages as $lang) {
$options[$lang] = $languageCodes->getName($lang);
}
unset($options[$app->_conf['default_language']]);
$tt = new Dataface_TranslationTool();
$form = new HTML_QuickForm('StatusForm', 'POST');
$form->addElement('select', '--language', 'Translation', $options);
$form->addElement('select', '--status', 'Status', $tt->translation_status_codes);
//$form->setDefaults( array('-sourceLanguage'=>$defaultSource, '-destinationLanguage'=>$defaultDest));
$form->addElement('submit', '--set_status', 'Set Status');
foreach ($query as $key => $value) {
$form->addElement('hidden', $key);
$form->setDefaults(array($key => $value));
}
if ($form->validate()) {
$res = $form->process(array(&$this, 'processForm'));
if (PEAR::isError($res)) {
return $res;
} else {
header('Location: ' . $app->url('-action=list&-sourceLanguage=&-destinationLanguage=&-translate=') . '&--msg=' . urlencode('Translation status successfully set.'));
exit;
}
}
ob_start();
$form->display();
$out = ob_get_contents();
ob_end_clean();
$records =& $this->getRecords();
df_display(array('form' => $out, 'translationTool' => &$tt, 'records' => &$records, 'translations' => &$options, 'context' => &$this), 'Dataface_set_translation_status.html');
}
示例11: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$date_options = array('minYear' => date('Y') - 10, 'maxYear' => date('Y') + 5);
$form = new HTML_QuickForm('holdliste', 'GET', $this->url() . '.txt');
$form->addElement('date', 'date', 'date', $date_options);
$form->addElement('submit', null, 'Hent');
return $this->form = $form;
}
示例12: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('fotogalleri', 'POST', $this->url());
$form->addElement('hidden', 'id');
$form->addElement('text', 'description', 'Beskrivelse');
$form->addElement('checkbox', 'active', '', 'Aktiv');
$form->addElement('submit', null, 'Gem og tilføj billeder');
return $this->form = $form;
}
示例13: display
function display($self_link)
{
$form = new HTML_QuickForm('adminConfigInfoForm', 'get', $self_link);
$consts = get_defined_constants();
$form->addElement('header', '', 'Configuration Settings (from conf/general)');
foreach ($consts as $const => $value) {
if (preg_match("/^OPTION_/", $const)) {
$form->addElement('static', "static{$const}", null, "{$const} = {$value}");
}
}
admin_render_form($form);
}
示例14: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('confirm', 'POST', $this->url());
$form->addElement('header', null, 'Accepterer du betingelserne?');
$form->addElement('checkbox', 'confirm', null, 'Ja, jeg accepterer betingelserne', 'id="confirm"');
$form->addElement('submit', null, 'Send');
$form->addRule('confirm', 'Du skal acceptere betingelserne', 'required');
return $this->form = $form;
}
示例15: display
function display($self_link)
{
$form = new HTML_QuickForm('adminServerInfoForm', 'get', $self_link);
$form->addElement('header', '', 'System Name');
$form->addElement('html', $this->run("uname -a | fmt"));
$form->addElement('header', '', 'Time, Uptime, Logins and Load (over last 1, 5, 15 mins)');
$form->addElement('html', $this->run("uptime"));
$form->addElement('header', '', 'Disk Space');
$form->addElement('html', $this->run("df -h"));
$form->addElement('header', '', 'Recent Logins');
$form->addElement('html', $this->run("who"));
$form->addElement('header', '', 'Network Interfaces');
$form->addElement('html', $this->run("/sbin/ifconfig"));
admin_render_form($form);
}