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


PHP HTML_QuickForm::display方法代码示例

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


在下文中一共展示了HTML_QuickForm::display方法的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');
 }
开发者ID:promoso,项目名称:HVAC,代码行数:27,代码来源:email_opt_out.php

示例2: drawLogin

 /**
  * function_description
  *
  * @author	John.meng
  * @since    version - Jan 5, 2006
  * @param	datatype paramname description
  * @return   datatype description
  */
 function drawLogin()
 {
     global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty;
     include_once PEAR_DIR . 'HTML/QuickForm.php';
     $form = new HTML_QuickForm('firstForm');
     $replace_str = "../";
     $html_code = str_replace(ROOT_DIR, $replace_str, THEMES_DIR);
     echo "<link href='" . $html_code . "style.css' rel='stylesheet' type='text/css'>";
     $renderer =& $form->defaultRenderer();
     $renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" class=\"log_table\" align=\"center\">\n{content}\n</table>\n</form>");
     $renderer->setHeaderTemplate("\n\t<tr>\n\t\t<td class=\"log_table_head\" align=\"left\" valign=\"top\" colspan=\"2\" ><b>{header}</b></td>\n\t</tr>");
     $form->addElement('header', null, "<img src=\"" . $html_code . "images/logo.gif\" border=\"0\" >");
     $form->addElement('text', 'user_name', $__Lang__['langMenuUser'] . $__Lang__['langGeneralName'] . ' : ');
     $form->addElement('password', 'user_passwd', $__Lang__['langMenuUser'] . $__Lang__['langGeneralPassword'] . ' : ');
     $form->addRule('user_name', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langMenuUser'] . " " . $__Lang__['langGeneralName'], 'required');
     $form->addRule('user_passwd', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langMenuUser'] . " " . $__Lang__['langGeneralPassword'], 'required');
     $form->addElement('hidden', 'Action', 'LOGON');
     $form->setDefaults(array('user_name' => $_COOKIE['UserName']));
     $form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
     $form->addElement('static', 'login_message');
     if ($form->validate() && $_POST['Action'] == 'LOGON') {
         $user_name = $_POST['user_name'];
         $user_password = md5($_POST['user_passwd']);
         $this->checkAuth($user_name, $user_password);
     }
     $form->display();
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:36,代码来源:Auth.class.php

示例3: 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();
}
开发者ID:laiello,项目名称:ya-playsms,代码行数:33,代码来源:inboxoutbox_importexport.php

示例4: 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();
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:34,代码来源:Modules.php

示例5: 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');
 }
开发者ID:promoso,项目名称:HVAC,代码行数:55,代码来源:set_translation_status.php

示例6: queries

            tr_warn('queries.php:' . $query . ':' . $e->getMessage());
            return false;
        }
        $query = "insert into queries (qid, uid, name, sql_select, sql_from, sql_where, sql_order, sql_order_dir, sql_limit, chart_period, active) values ({$next_qid}, {$uid}, '{$sql_name}', '{$sql_select}', '{$sql_from}', '{$sql_where}', '{$sql_order}', '{$sql_order_dir}', '{$sql_limit}', '{$chart_period}', TRUE);";
        try {
            $pdo->exec($query);
            $_SESSION['qid'] = $next_qid;
        } catch (PDOException $e) {
            tr_warn("html/queries.php: {$query} " . ':' . $e->getMessage());
        }
        // changed both forms, so reload them
        $select_query_form = new HTML_QuickForm('select_query');
        create_select_query_form();
        $sql_input_form = new HTML_QuickForm('sql_input');
        create_sql_input_form();
    }
}
if (isset($_POST['del_sql'])) {
    $query = "update queries set active = FALSE where qid = {$q_id};";
    $pdo->exec($query);
    $select_query_form = new HTML_QuickForm('select_query');
    create_select_query_form();
}
print '<table border="1" cellpadding="5" cellspacing="0" align="center">';
print '<tr><td>';
$select_query_form->display();
print "</td></tr>\n";
print '<tr><td>';
$sql_input_form->display();
print '</td></tr>';
print '</table>';
开发者ID:kombat003,项目名称:trader-dss,代码行数:31,代码来源:queries.php

示例7: display

 /**
  * Displays the form as html.
  */
 function display()
 {
     if (!$this->_built) {
         $this->_build();
     }
     parent::display();
 }
开发者ID:promoso,项目名称:HVAC,代码行数:10,代码来源:ExistingRelatedRecordForm.php

示例8: importAutoreply

function importAutoreply($selfurl)
{
    $form = new HTML_QuickForm('autoreply_import', 'post', "{$selfurl}&op=import");
    $msg = "<p>This will import your autoreplies.</p><br/>";
    $form->addElement('header', '', 'Autoreply Import');
    $form->addElement('static', '', '', $msg);
    $fileupload =& $form->addElement('file', 'importfile', 'Autoreply file');
    $form->addElement('submit', 'submit', 'Import');
    if ($form->validate()) {
        if ($fileupload->isUploadedFile()) {
            $fileinfo = $fileupload->getValue();
            $importfile = $fileinfo['tmp_name'];
            doAutoreplyImport($importfile);
            unlink($importfile);
        }
        exit;
    }
    $form->display();
}
开发者ID:laiello,项目名称:ya-playsms,代码行数:19,代码来源:sms_autoreply.php

示例9: array

if (isset($_SESSION['loginname'])) {
    $default_username = $_SESSION['loginname'];
}
# create the form and validation rules
$login_form = new HTML_QuickForm('login');
$login_form->applyFilter('__ALL__', 'trim');
$login_form->addElement('header', null, 'Login to the <a href="http://code.google.com/p/trader-dss/">Trader DSS</a>. Authorised users only');
$login_form->addElement('text', 'username', 'Username:', array('size' => 30, 'maxlength' => 100));
$login_form->addRule('username', 'Please enter your username', 'required');
$login_form->addElement('password', 'passwd', 'Password:', array('size' => 10, 'maxlength' => 100));
$login_form->addRule(array('username', 'passwd'), 'Account details incorrect', 'callback', 'check_account');
$login_form->addRule('passwd', 'Must enter a password', 'required');
$login_form->addElement('submit', 'login', 'Login');
if (isset($default_username)) {
    $login_form->setDefaults(array('username' => $default_username));
}
$g_username = '';
# global to hold the username
$g_uid = '';
# global to hold the uid
if ($login_form->validate()) {
    $_SESSION['username'] = $g_username;
    $_SESSION['uid'] = $g_uid;
    unset($_SESSION['pfid']);
    redirect_login_pf();
} else {
    draw_trader_header('login', false);
    print '<table border="1" cellpadding="5" cellspacing="0" align="center"><tr><td>';
    $login_form->display();
    print '</td></tr></table>';
}
开发者ID:kombat003,项目名称:trader-dss,代码行数:31,代码来源:login.php

示例10: display

 function display()
 {
     $this->_build();
     if ($this->_step == 2) {
         require_once 'Dataface/RecordGrid.php';
         $records = $this->loadImportTable();
         $grid = new Dataface_RecordGrid($records);
         $grid->id = "import-records-preview";
         df_display(array('preview_data' => $grid->toHTML(), 'num_records' => count($records)), 'ImportForm_step2.html');
     }
     $res = parent::display();
     return $res;
 }
开发者ID:promoso,项目名称:HVAC,代码行数:13,代码来源:ImportForm.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

示例12: 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;";
开发者ID:webguyca,项目名称:PHP-news-website,代码行数:31,代码来源:bar.php

示例13: 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

示例14: display_form

function display_form() {

	// ////////////////////////////////////////
	// Instantiate the HTML_QuickForm object
	$form = new HTML_QuickForm( 'firstForm', 'get' );



      $languages_suggs = array( "eng" => "eng",
			   "deu" => "deu",
			   "fra" => "fra",
			   "ita" => "ita",
			   "nld" => "nld"
			   );

	$collections = array(
		'376317' => 'One laptop per child basic vocabulary',
		'376322' => 'Destinazione Italia' );

	// Set defaults for the form elements
	$form->setDefaults( array(
	    'name' => 'From'
	) );

	// Add some elements to the form
	$form->addElement( 'header', null, '' );
	$form->addElement( 'hidden', 'ow', '1' );
	$form->addElement( 'select', 'mode', 'voc browser mode:', array( 'browser' => 'lookup dictionary', 'trainer' => 'vocabulary training' ) );
	if ( $_REQUEST['mode'] == 'trainer' ) {

		$form->addElement( 'select', 'wdcollection', 'Collection to choose vocabulary from:', $collections );
		$form->addElement( 'select', 'wdlanguages_1', 'target language you want to train:', $languages_suggs );
	} else {
		$form->addElement( 'select', 'wdlanguages_1', 'first output language:', $languages_suggs );
	}
	if ( $_REQUEST['settings'] == 1 ) {
		$form->addElement( 'text', 'wdlanguages_2', 'second output language:', array( 'value' => '', 'size' => 6, 'maxlength' => 6 ) );
		$form->addElement( 'text', 'wdlanguages_3', 'third output language:', array( 'size' => 6, 'maxlength' => 6 ) );
		$form->addElement( 'text', 'wdlanguages_4', 'fourth output language:', array( 'size' => 6, 'maxlength' => 6 ) );
		$link = build_get_uri_2( 'settings', '0', '' );
		echo '<a href="' . $link . '">hide settings and languages</a>';
	} elseif ( $_REQUEST['mode'] == 'trainer' && ( $_REQUEST['trainer_step'] == 0 ) ) {
		$form->addElement( 'text', 'wdlanguages_2', 'first language you can understand:', array( 'size' => 6, 'maxlength' => 6 ) );
		$form->addElement( 'text', 'wdlanguages_3', 'second language you can understand:', array( 'size' => 6, 'maxlength' => 6 ) );
		$form->addElement( 'text', 'wdlanguages_4', 'third language you can understand:', array( 'size' => 6, 'maxlength' => 6 ) );

	} else {
		$form->addElement( 'hidden', 'wdlanguages_2', '', array( 'size' => 6, 'maxlength' => 6 ) );
		$form->addElement( 'hidden', 'wdlanguages_3', '', array( 'size' => 6, 'maxlength' => 6 ) );
		$form->addElement( 'hidden', 'wdlanguages_4', '', array( 'size' => 6, 'maxlength' => 6 ) );
		$link = build_get_uri_2( 'settings', '1', '' );
		echo '<a href="' . $link . '">edit settings and languages</a>';
	}


	if ( $_REQUEST['definedmeaning'] ) {
		$expression_group[] = &HTML_QuickForm::createElement( 'text', 'expression', 'search expression:', array( 'value' => '' , 'size' => 20, 'maxlength' => 256 ) );
		$form->updateElementAttr( 'expression', array( 'value' => '' ) );
		$expression_group[] = &HTML_QuickForm::createElement( 'text', 'wdexplanguage', 'source language of an expression <br />(leave blank to search all languages)', array( 'size' => 20, 'maxlength' => 256 ) );
	} else {
		$expression_group[] = &HTML_QuickForm::createElement( 'text', 'expression', 'search expression:', array( 'size' => 20, 'maxlength' => 256 ) );
		$expression_group[] = &HTML_QuickForm::createElement( 'text', 'wdexplanguage', 'source language of an expression <br />(leave blank to search all languages)', array( 'size' => 4, 'maxlength' => 256 ) );
	}


	$form->addGroup( $expression_group, 'Expression', 'Search Expression:', '&#160; only in this language:', 0 );

	if ( $_REQUEST['settings'] == 1 ) {
		$form->addElement( 'text', 'definedmeaning', 'definedmeaning (word-id):', array( 'value' => '', 'size' => 15 ) );
	}

	$form->addElement( 'submit', null, 'set / update' );

	// Output the form
	$form->display();
	//
	// ////////////////////////////////////////
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:78,代码来源:functions.php

示例15: where

$checkbox =& $sql_input_form->addElement('checkbox', 'chart', 'Draw Charts');
if (isset($_SESSION['chart'])) {
    $checkbox->setChecked(true);
} else {
    $checkbox->setChecked(false);
}
$sql_input_form->addElement('submit', 'execute_sql', 'Run Query');
if (isset($_SESSION['sql_select'])) {
    $sql_input_form->setDefaults(array('sql_select' => $_SESSION['sql_select'], 'sql_from' => $_SESSION['sql_from'], 'sql_where' => $_SESSION['sql_where'], 'sql_order' => $_SESSION['sql_order'], 'sql_order_dir' => $_SESSION['sql_order_dir'], 'sql_limit' => $_SESSION['sql_limit'], 'chart_period' => $_SESSION['chart_period']));
} else {
    $sql_input_form->setDefaults(array('sql_limit' => 10, 'sql_order_dir' => 'desc', 'chart_period' => 180));
}
if (isset($_POST['execute_sql'])) {
    if ($sql_input_form->validate()) {
        print '<table border="1" cellpadding="5" cellspacing="0" align="center"><tr><td align="center">';
        $sql_input_form->display();
        print '</td></tr>';
        // run the sql and return the results
        $data = $sql_input_form->exportValues();
        $_SESSION['sql_select'] = $sql_select = $data['sql_select'];
        $_SESSION['sql_from'] = $sql_from = $data['sql_from'];
        $_SESSION['sql_where'] = $sql_where = $data['sql_where'];
        $_SESSION['sql_order'] = $sql_order = $data['sql_order'];
        $_SESSION['sql_order_dir'] = $sql_order_dir = $data['sql_order_dir'];
        $_SESSION['sql_limit'] = $sql_limit = $data['sql_limit'];
        $_SESSION['chart_period'] = $chart_period = $data['chart_period'];
        $query = "select {$sql_select} from {$sql_from} where ({$sql_where}) and (quotes.date = '{$pf_working_date}' and quotes.exch = '{$pf_exch}') order by {$sql_order} {$sql_order_dir} limit {$sql_limit};";
        try {
            $pdo = new PDO("pgsql:host={$db_hostname};dbname={$db_database}", $db_user, $db_password);
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        } catch (PDOException $e) {
开发者ID:kombat003,项目名称:trader-dss,代码行数:31,代码来源:select.php


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