本文整理汇总了PHP中HTML_QuickForm类的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm类的具体用法?PHP HTML_QuickForm怎么用?PHP HTML_QuickForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML_QuickForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct('authorize_new_users');
if ($this->loginError) {
return;
}
$this->loadHttpVars(true, true);
$this->users = pdUserList::getNotVerified($this->db);
echo '<h2>Users Requiring Authentication</h2>';
if ($this->users == null || count($this->users) == 0) {
echo 'All users authorized.';
return;
}
$form = new HTML_QuickForm('authorizeUsers', 'post');
foreach ($this->users as $user) {
$form->addGroup(array(HTML_QuickForm::createElement('advcheckbox', "submit[auth][{$user->login}]", null, null, null, array('no', 'yes')), HTML_QuickForm::createElement('select', "submit[access][{$user->login}]", null, AccessLevel::getAccessLevels()), HTML_QuickForm::createElement('static', null, null, $user->login), HTML_QuickForm::createElement('static', null, null, $user->name), HTML_QuickForm::createElement('static', null, null, $user->email)), 'all', null, '</td><td class="stats_odd">', false);
}
$form->addElement('submit', null, 'Submit');
$this->form =& $form;
if ($form->validate()) {
$this->processForm();
} else {
$this->renderForm();
}
}
示例2: __construct
public function __construct()
{
parent::__construct('aicml_stats');
if ($this->loginError) {
return;
}
$this->loadHttpVars(true, false);
if (isset($this->csv_output)) {
assert('isset($_SESSION["aicml_stats"])');
$this->stats =& $_SESSION['aicml_stats'];
return;
}
$pubs =& $this->getMachineLearningPapers();
// populate $this->aicml_pi_authors
$this->getPiAuthors();
// populate $this->aicml_pdf_students_staff_authors
$this->getPdfStudentsAndStaffAuthors();
$this->collectStats($pubs);
$_SESSION['aicml_stats'] =& $this->stats;
$form = new HTML_QuickForm('aicml_stats', 'get', 'aicml_stats.php');
$form->addElement('submit', 'csv_output', 'Export to CSV');
// create a new renderer because $form->defaultRenderer() creates
// a single copy
$renderer = new HTML_QuickForm_Renderer_Default();
$form->accept($renderer);
echo $renderer->toHtml();
echo $this->allPiPublicationTable();
echo $this->fiscalYearTotalsTable('pi', 'PI Fiscal Year Totals');
foreach ($this->aicml_pi_authors as $pi_author) {
echo $this->piPublicationsTable($pi_author);
}
echo $this->staffPublicationsTable();
echo $this->fiscalYearTotalsTable('staff', 'Staff Fiscal Year Totals');
echo $this->studentTotalsTable();
}
示例3: array
/**
* Defines how a radio button widget should be built.
*
* @param Dataface_Record $record The Dataface_Record that is being edited.
* @param array &$field The field configuration data structure that the widget is being generated for.
* @param HTML_QuickForm The form to which the field is to be added.
* @param string $formFieldName The name of the field in the form.
* @param boolean $new Whether this widget is being built for a new record form.
* @return HTML_QuickForm_element The element that can be added to a form.
*
*/
function &buildWidget(&$record, &$field, &$form, $formFieldName, $new = false)
{
$widget =& $field['widget'];
if (!@$widget['separator']) {
$widget['separator'] = '<br />';
}
if (isset($field['vocabulary']) and $field['vocabulary']) {
$radios = array();
$dummyForm = new HTML_QuickForm();
$options =& Dataface_FormTool::getVocabulary($record, $field);
$options__classes = Dataface_FormTool::getVocabularyClasses($record, $field);
// CSS classes
foreach ($options as $opt_val => $opt_text) {
if ($opt_val === '') {
continue;
}
$radios[] =& $dummyForm->createElement('radio', null, null, $opt_text, $opt_val, array('class' => 'radio-of-' . $field['name'] . ' ' . @$options__classes[$opt_val]));
}
$factory =& Dataface_FormTool::factory();
$el =& $factory->addGroup($radios, $field['name'], $widget['label']);
} else {
error_log("Your field {$formFieldName} is missing the vocabulary directive.");
throw new Exception("Your field {$formFieldName} is missing the vocabulary directive.");
}
return $el;
}
示例4: factory
/**
* factory
*
* Factory method
*
* @param mixed $name name of the form
* @param mixed $url action url
*
* @static
* @access public
* @return Object HTML_QuickForm Object
*/
static function factory($name, $url)
{
$form = new HTML_QuickForm($name, 'post', $url);
$star = '<span style="color: #ff0000">*</span> ';
$form->setRequiredNote($star . _('denotes required field'));
return $form;
}
示例5: 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;
}
示例6: 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;
}
示例7: otherFormatForm
/**
*
*/
public function otherFormatForm($result_pubs)
{
if ($result_pubs == null) {
return;
}
$form = new HTML_QuickForm('otherFormatForm');
$form->addElement('hidden', 'pub_ids', implode(",", $result_pubs));
$form->addGroup(array(HTML_QuickForm::createElement('submit', 'cv_format', 'Show results in CV format'), HTML_QuickForm::createElement('submit', 'bibtex_format', 'Show results in BibTex format')), null, null, ' ');
return $form;
}
示例8: getForm
function getForm()
{
if ($this->form) {
return $this->form;
}
$form = new HTML_QuickForm('holdliste', 'GET', $this->url());
$form->addElement('date', 'date', 'date');
$form->addElement('submit', null, 'Hent');
return $this->form = $form;
}
示例9: 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');
}
示例10: dirname
/**
* Renvoit l'instance d'un formulaire
*
* Un formulaire est instancié, configuré puis renvoyé
*
* @param string $url URL pour l'attribut "action" du formulaire
* @param string $nom Nom du formulaire
* @return object
*/
function &instancierFormulaire($url = null, $nom = 'formulaire')
{
if (is_null($url)) {
$url = $_SERVER['REQUEST_URI'];
}
require_once dirname(__FILE__) . '/../../dependencies/PEAR/HTML/QuickForm.php';
require_once dirname(__FILE__) . '/../../dependencies/PEAR/HTML/QuickForm/altselect.php';
$formulaire = new HTML_QuickForm($nom, 'post', $url);
$formulaire->removeAttribute('name');
return $formulaire;
}
示例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: 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);
}
示例13: 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;
}
示例14: 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;
}
示例15: 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');
}