本文整理匯總了PHP中PMA\libraries\URL::getHiddenInputs方法的典型用法代碼示例。如果您正苦於以下問題:PHP URL::getHiddenInputs方法的具體用法?PHP URL::getHiddenInputs怎麽用?PHP URL::getHiddenInputs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PMA\libraries\URL
的用法示例。
在下文中一共展示了URL::getHiddenInputs方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: PMA_getHtmlForSqlQueryForm
/**
* return HTML for the sql query boxes
*
* @param boolean|string $query query to display in the textarea
* or true to display last executed
* @param boolean|string $display_tab sql|full|false
* what part to display
* false if not inside querywindow
* @param string $delimiter delimiter
*
* @return string
*
* @usedby server_sql.php
* @usedby db_sql.php
* @usedby tbl_sql.php
* @usedby tbl_structure.php
* @usedby tbl_tracking.php
*/
function PMA_getHtmlForSqlQueryForm($query = true, $display_tab = false, $delimiter = ';')
{
$html = '';
if (!$display_tab) {
$display_tab = 'full';
}
// query to show
if (true === $query) {
$query = $GLOBALS['sql_query'];
}
// set enctype to multipart for file uploads
if ($GLOBALS['is_upload']) {
$enctype = ' enctype="multipart/form-data"';
} else {
$enctype = '';
}
$table = '';
$db = '';
if (strlen($GLOBALS['db']) === 0) {
// prepare for server related
$goto = empty($GLOBALS['goto']) ? 'server_sql.php' : $GLOBALS['goto'];
} elseif (strlen($GLOBALS['table']) === 0) {
// prepare for db related
$db = $GLOBALS['db'];
$goto = empty($GLOBALS['goto']) ? 'db_sql.php' : $GLOBALS['goto'];
} else {
$table = $GLOBALS['table'];
$db = $GLOBALS['db'];
$goto = empty($GLOBALS['goto']) ? 'tbl_sql.php' : $GLOBALS['goto'];
}
// start output
$html .= '<form method="post" action="import.php" ' . $enctype;
$html .= ' class="ajax lock-page"';
$html .= ' id="sqlqueryform" name="sqlform">' . "\n";
$html .= '<input type="hidden" name="is_js_confirmed" value="0" />' . "\n" . URL::getHiddenInputs($db, $table) . "\n" . '<input type="hidden" name="pos" value="0" />' . "\n" . '<input type="hidden" name="goto" value="' . htmlspecialchars($goto) . '" />' . "\n" . '<input type="hidden" name="message_to_show" value="' . __('Your SQL query has been executed successfully.') . '" />' . "\n" . '<input type="hidden" name="prev_sql_query" value="' . htmlspecialchars($query) . '" />' . "\n";
// display querybox
if ($display_tab === 'full' || $display_tab === 'sql') {
$html .= PMA_getHtmlForSqlQueryFormInsert($query, $delimiter);
}
// Bookmark Support
if ($display_tab === 'full') {
$cfgBookmark = Bookmark::getParams();
if ($cfgBookmark) {
$html .= PMA_getHtmlForSqlQueryFormBookmark();
}
}
// Japanese encoding setting
if (Encoding::canConvertKanji()) {
$html .= Encoding::kanjiEncodingForm();
}
$html .= '</form>' . "\n";
// print an empty div, which will be later filled with
// the sql query results by ajax
$html .= '<div id="sqlqueryresultsouter"></div>';
return $html;
}
示例2: PMA_getHtmlForDisplayIndexes
/**
* Get HTML for display indexes
*
* @return string $html_output
*/
function PMA_getHtmlForDisplayIndexes()
{
$html_output = '<div id="index_div" class="ajax" >';
$html_output .= PMA\libraries\Index::getHtmlForIndexes($GLOBALS['table'], $GLOBALS['db']);
$html_output .= '<fieldset class="tblFooters print_ignore" style="text-align: ' . 'left;"><form action="tbl_indexes.php" method="post">';
$html_output .= URL::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
$html_output .= sprintf(__('Create an index on %s columns'), '<input type="number" name="added_fields" value="1" ' . 'min="1" required="required" />');
$html_output .= '<input type="hidden" name="create_index" value="1" />' . '<input class="add_index ajax"' . ' type="submit" value="' . __('Go') . '" />';
$html_output .= '</form>' . '</fieldset>' . '</div>';
return $html_output;
}
示例3: PMA_getHtmlForHiddenInputs
/**
* Prints Html For Display Import Hidden Input
*
* @param String $import_type Import type: server, database, table
* @param String $db Selected DB
* @param String $table Selected Table
*
* @return string
*/
function PMA_getHtmlForHiddenInputs($import_type, $db, $table)
{
$html = '';
if ($import_type == 'server') {
$html .= URL::getHiddenInputs('', '', 1);
} elseif ($import_type == 'database') {
$html .= URL::getHiddenInputs($db, '', 1);
} else {
$html .= URL::getHiddenInputs($db, $table, 1);
}
$html .= ' <input type="hidden" name="import_type" value="' . $import_type . '" />' . "\n";
return $html;
}
示例4: testPMAGetHtmlForDataDefinitionAndManipulationStatements
/**
* Tests for PMA_getHtmlForDataDefinitionAndManipulationStatements() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForDataDefinitionAndManipulationStatements()
{
$url_query = "url_query";
$last_version = 10;
$html = PMA_getHtmlForDataDefinitionAndManipulationStatements($url_query, $last_version, $GLOBALS['db'], array($GLOBALS['table']));
$this->assertContains('<div id="div_create_version">', $html);
$this->assertContains($url_query, $html);
$this->assertContains(URL::getHiddenInputs($GLOBALS['db']), $html);
$item = sprintf(__('Create version %1$s of %2$s'), $last_version + 1, htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']));
$this->assertContains($item, $html);
$item = '<input type="checkbox" name="delete" value="true"' . ' checked="checked" /> DELETE<br/>';
$this->assertContains($item, $html);
$this->assertContains(__('Create version'), $html);
}
示例5: testPMAGetHtmlForCreateTable
/**
* Test for PMA_getHtmlForCreateTable
*
* @return void
*/
public function testPMAGetHtmlForCreateTable()
{
$db = "pma_db";
//Call the test function
$html = PMA_getHtmlForCreateTable($db);
//getImage
$this->assertContains(PMA\libraries\Util::getImage('b_table_add.png'), $html);
//__('Create table')
$this->assertContains(__('Create table'), $html);
//URL::getHiddenInputs
$this->assertContains(URL::getHiddenInputs($db), $html);
//label
$this->assertContains(__('Name'), $html);
$this->assertContains(__('Number of columns'), $html);
//button
$this->assertContains(__('Go'), $html);
}
示例6: PMA_getHtmlForRelationalFieldSelection
/**
* Function to get html for relational field selection
*
* @param string $db current database
* @param string $table current table
* @param string $field field
* @param array $foreignData foreign column data
* @param string $fieldkey field key
* @param string $current_value current columns's value
*
* @return string
*/
function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData, $fieldkey, $current_value)
{
$gotopage = PMA_getHtmlForGotoPage($foreignData);
$showall = PMA_getHtmlForShowAll($foreignData);
$output = '<form class="ajax" ' . 'id="browse_foreign_form" name="browse_foreign_from" ' . 'action="browse_foreigners.php" method="post">' . '<fieldset>' . URL::getHiddenInputs($db, $table) . '<input type="hidden" name="field" value="' . htmlspecialchars($field) . '" />' . '<input type="hidden" name="fieldkey" value="' . (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
if (isset($_REQUEST['rownumber'])) {
$output .= '<input type="hidden" name="rownumber" value="' . htmlspecialchars($_REQUEST['rownumber']) . '" />';
}
$filter_value = isset($_REQUEST['foreign_filter']) ? htmlspecialchars($_REQUEST['foreign_filter']) : '';
$output .= '<span class="formelement">' . '<label for="input_foreign_filter">' . __('Search:') . '</label>' . '<input type="text" name="foreign_filter" ' . 'id="input_foreign_filter" ' . 'value="' . $filter_value . '" data-old="' . $filter_value . '" ' . '/>' . '<input type="submit" name="submit_foreign_filter" value="' . __('Go') . '" />' . '</span>' . '<span class="formelement">' . $gotopage . '</span>' . '<span class="formelement">' . $showall . '</span>' . '</fieldset>' . '</form>';
$output .= '<table width="100%" id="browse_foreign_table">';
if (!is_array($foreignData['disp_row'])) {
$output .= '</tbody>' . '</table>';
return $output;
}
$header = '<tr>
<th>' . __('Keyname') . '</th>
<th>' . __('Description') . '</th>
<td width="20%"></td>
<th>' . __('Description') . '</th>
<th>' . __('Keyname') . '</th>
</tr>';
$output .= '<thead>' . $header . '</thead>' . "\n" . '<tfoot>' . $header . '</tfoot>' . "\n" . '<tbody>' . "\n";
$descriptions = array();
$keys = array();
foreach ($foreignData['disp_row'] as $relrow) {
if ($foreignData['foreign_display'] != false) {
$descriptions[] = $relrow[$foreignData['foreign_display']];
} else {
$descriptions[] = '';
}
$keys[] = $relrow[$foreignData['foreign_field']];
}
asort($keys);
$horizontal_count = 0;
$odd_row = true;
$indexByDescription = 0;
foreach ($keys as $indexByKeyname => $value) {
list($html, $horizontal_count, $odd_row, $indexByDescription) = PMA_getHtmlForOneKey($horizontal_count, $header, $odd_row, $keys, $indexByKeyname, $descriptions, $indexByDescription, $current_value);
$output .= $html;
}
$output .= '</tbody>' . '</table>';
return $output;
}
示例7: testPMAGetHtmlForChangePassword
/**
* Test for PMA_getHtmlForChangePassword
*
* @return void
*/
public function testPMAGetHtmlForChangePassword()
{
$username = "pma_username";
$hostname = "pma_hostname";
//Call the test function
$html = PMA_getHtmlForChangePassword('change_pw', $username, $hostname);
//PMA_PHP_SELF
$this->assertContains($GLOBALS['PMA_PHP_SELF'], $html);
//URL::getHiddenInputs
$this->assertContains(URL::getHiddenInputs(), $html);
//$username & $hostname
$this->assertContains(htmlspecialchars($username), $html);
$this->assertContains(htmlspecialchars($hostname), $html);
//labels
$this->assertContains(__('Change password'), $html);
$this->assertContains(__('No Password'), $html);
$this->assertContains(__('Password:'), $html);
$this->assertContains(__('Password:'), $html);
}
示例8: PMA_getLanguageSelectorHtml
/**
* Returns HTML code for the language selector
*
* @param boolean $use_fieldset whether to use fieldset for selection
* @param boolean $show_doc whether to show documentation links
*
* @return string
*
* @access public
*/
function PMA_getLanguageSelectorHtml($use_fieldset = false, $show_doc = true)
{
$retval = '';
$available_languages = LanguageManager::getInstance()->sortedLanguages();
// Display language selection only if there
// is more than one language to choose from
if (count($available_languages) > 1) {
$retval .= '<form method="get" action="index.php" class="disableAjax">';
$_form_params = array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
$retval .= URL::getHiddenInputs($_form_params);
// For non-English, display "Language" with emphasis because it's
// not a proper word in the current language; we show it to help
// people recognize the dialog
$language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
if ($show_doc) {
$language_title .= PMA\libraries\Util::showDocu('faq', 'faq7-2');
}
if ($use_fieldset) {
$retval .= '<fieldset><legend lang="en" dir="ltr">' . $language_title . '</legend>';
} else {
$retval .= '<bdo lang="en" dir="ltr"><label for="sel-lang">' . $language_title . ': </label></bdo>';
}
$retval .= '<select name="lang" class="autosubmit" lang="en"' . ' dir="ltr" id="sel-lang">';
foreach ($available_languages as $language) {
//Is current one active?
if ($language->isActive()) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$retval .= '<option value="' . $language->getCode() . '"' . $selected . '>';
$retval .= $language->getName();
$retval .= '</option>';
}
$retval .= '</select>';
if ($use_fieldset) {
$retval .= '</fieldset>';
}
$retval .= '</form>';
}
return $retval;
}
示例9: PMA_displayFormTop
/**
* Displays top part of the form
*
* @param string $action default: $_SERVER['REQUEST_URI']
* @param string $method 'post' or 'get'
* @param array $hidden_fields array of form hidden fields (key: field name)
*
* @return string
*/
function PMA_displayFormTop($action = null, $method = 'post', $hidden_fields = null)
{
static $has_check_page_refresh = false;
if ($action === null) {
$action = $_SERVER['REQUEST_URI'];
}
if ($method != 'post') {
$method = 'get';
}
$htmlOutput = '<form method="' . $method . '" action="' . htmlspecialchars($action) . '" class="config-form disableAjax">';
$htmlOutput .= '<input type="hidden" name="tab_hash" value="" />';
// we do validation on page refresh when browser remembers field values,
// add a field with known value which will be used for checks
if (!$has_check_page_refresh) {
$has_check_page_refresh = true;
$htmlOutput .= '<input type="hidden" name="check_page_refresh" ' . ' id="check_page_refresh" value="" />' . "\n";
}
$htmlOutput .= URL::getHiddenInputs('', '', 0, 'server') . "\n";
$htmlOutput .= URL::getHiddenFields((array) $hidden_fields);
return $htmlOutput;
}
示例10: PMA_getHtmlForChangePassword
/**
* Get HTML for the Change password dialog
*
* @param string $mode where is the function being called?
* values : 'change_pw' or 'edit_other'
* @param string $username username
* @param string $hostname hostname
*
* @return string html snippet
*/
function PMA_getHtmlForChangePassword($mode, $username, $hostname)
{
/**
* autocomplete feature of IE kills the "onchange" event handler and it
* must be replaced by the "onpropertychange" one in this case
*/
$chg_evt_handler = 'onchange';
$is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';
$html = '<form method="post" id="change_password_form" ' . 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" ' . 'name="chgPassword" ' . 'class="' . ($is_privileges ? 'submenu-item' : '') . '">';
$html .= URL::getHiddenInputs();
if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
$html .= '<input type="hidden" name="username" ' . 'value="' . htmlspecialchars($username) . '" />' . '<input type="hidden" name="hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />';
}
$html .= '<fieldset id="fieldset_change_password">' . '<legend' . ($is_privileges ? ' data-submenu-label="' . __('Change password') . '"' : '') . '>' . __('Change password') . '</legend>' . '<table class="data noclick">' . '<tr class="odd">' . '<td colspan="2">' . '<input type="radio" name="nopass" value="1" id="nopass_1" ' . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; ' . 'this.checked = true" />' . '<label for="nopass_1">' . __('No Password') . '</label>' . '</td>' . '</tr>' . '<tr class="even vmiddle">' . '<td>' . '<input type="radio" name="nopass" value="0" id="nopass_0" ' . 'onclick="document.getElementById(\'text_pma_pw\').focus();" ' . 'checked="checked" />' . '<label for="nopass_0">' . __('Password:') . ' </label>' . '</td>' . '<td>' . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . ' ' . __('Re-type:') . ' ' . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '</td>' . '</tr>';
$serverType = PMA\libraries\Util::getServerType();
$orig_auth_plugin = PMA_getCurrentAuthenticationPlugin('change', $username, $hostname);
$is_superuser = $GLOBALS['dbi']->isSuperuser();
if ($serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50507 || $serverType == 'MariaDB' && PMA_MYSQL_INT_VERSION >= 50200) {
// Provide this option only for 5.7.6+
// OR for privileged users in 5.5.7+
if ($serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50706 || $is_superuser && $mode == 'edit_other') {
$auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown($orig_auth_plugin, 'change_pw', 'new');
$html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td><td>';
$html .= $auth_plugin_dropdown;
$html .= '</td></tr>' . '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
$html .= '<div ' . ($orig_auth_plugin != 'sha256_password' ? 'style="display:none"' : '') . ' id="ssl_reqd_warning_cp">' . Message::notice(__('This method requires using an \'<i>SSL connection</i>\' ' . 'or an \'<i>unencrypted connection that encrypts the ' . 'password using RSA</i>\'; while connecting to the server.') . PMA\libraries\Util::showMySQLDocu('sha256-authentication-plugin'))->getDisplay() . '</div>';
} else {
$html .= '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
}
} else {
$auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown($orig_auth_plugin, 'change_pw', 'old');
$html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td><td>';
$html .= $auth_plugin_dropdown . '</td></tr>' . '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
}
$html .= '</fieldset>' . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . '<input type="hidden" name="change_pw" value="1" />' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
return $html;
}
示例11: __
</div>
<br />
<?php
echo '<input type="submit" name="submit_export" value="', __('Go'), '" />';
?>
</form>
</div>
<div class="group">
<h2><?php
echo __('Reset');
?>
</h2>
<form class="group-cnt prefs-form disableAjax" name="prefs_reset"
action="prefs_manage.php" method="post">
<?php
echo URL::getHiddenInputs(), __('You can reset all your settings and restore them to default ' . 'values.');
?>
<br /><br />
<input type="submit" name="submit_clear"
value="<?php
echo __('Reset');
?>
"/>
</form>
</div>
</div>
<br class="clearfloat" />
</div>
<?php
if ($response->isAjax()) {
示例12: array
$response->addJSON('message', PMA\libraries\Util::getMessage(PMA\libraries\Message::success(), $sql_query));
$response->setRequestStatus(true);
}
exit;
}
// prefill values if not already filled from former submission
$view = array('operation' => 'create', 'or_replace' => '', 'algorithm' => '', 'definer' => '', 'sql_security' => '', 'name' => '', 'column_names' => '', 'as' => $sql_query, 'with' => '');
if (PMA_isValid($_REQUEST['view'], 'array')) {
$view = array_merge($view, $_REQUEST['view']);
}
$url_params['db'] = $GLOBALS['db'];
$url_params['reload'] = 1;
/**
* Displays the page
*/
$htmlString = '<!-- CREATE VIEW options -->' . '<div id="div_view_options">' . '<form method="post" action="view_create.php">' . URL::getHiddenInputs($url_params) . '<fieldset>' . '<legend>' . (isset($_REQUEST['ajax_dialog']) ? __('Details') : ($view['operation'] == 'create' ? __('Create view') : __('Edit view'))) . '</legend>' . '<table class="rte_table">';
if ($view['operation'] == 'create') {
$htmlString .= '<tr>' . '<td class="nowrap"><label for="or_replace">OR REPLACE</label></td>' . '<td><input type="checkbox" name="view[or_replace]" id="or_replace"';
if ($view['or_replace']) {
$htmlString .= ' checked="checked"';
}
$htmlString .= ' value="1" /></td></tr>';
}
$htmlString .= '<tr>' . '<td class="nowrap"><label for="algorithm">ALGORITHM</label></td>' . '<td><select name="view[algorithm]" id="algorithm">';
foreach ($view_algorithm_options as $option) {
$htmlString .= '<option value="' . htmlspecialchars($option) . '"';
if ($view['algorithm'] === $option) {
$htmlString .= ' selected="selected"';
}
$htmlString .= '>' . htmlspecialchars($option) . '</option>';
}
示例13: PMA_getHtmlForPartitionMaintenance
/**
* Get HTML snippet for partition maintenance
*
* @param array $partition_names array of partition names for a specific db/table
* @param array $url_params url parameters
*
* @return string $html_output
*/
function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params)
{
$choices = array('ANALYZE' => __('Analyze'), 'CHECK' => __('Check'), 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair'), 'TRUNCATE' => __('Truncate'));
$partition_method = Partition::getPartitionMethod($GLOBALS['db'], $GLOBALS['table']);
// add COALESCE or DROP option to choices array depeding on Partition method
if ($partition_method == 'RANGE' || $partition_method == 'RANGE COLUMNS' || $partition_method == 'LIST' || $partition_method == 'LIST COLUMNS') {
$choices['DROP'] = __('Drop');
} else {
$choices['COALESCE'] = __('Coalesce');
}
$html_output = '<div class="operations_half_width">' . '<form id="partitionsForm" class="ajax" ' . 'method="post" action="tbl_operations.php" >' . URL::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<fieldset>' . '<legend>' . __('Partition maintenance') . Util::showMySQLDocu('partitioning_maintenance') . '</legend>';
$html_select = '<select id="partition_name" name="partition_name[]"' . ' multiple="multiple" required="required">' . "\n";
$first = true;
foreach ($partition_names as $one_partition) {
$one_partition = htmlspecialchars($one_partition);
$html_select .= '<option value="' . $one_partition . '"';
if ($first) {
$html_select .= ' selected="selected"';
$first = false;
}
$html_select .= '>' . $one_partition . '</option>' . "\n";
}
$html_select .= '</select>' . "\n";
$html_output .= sprintf(__('Partition %s'), $html_select);
$html_output .= '<div class="clearfloat" />';
$html_output .= Util::getRadioFields('partition_operation', $choices, 'ANALYZE', false, true, 'floatleft');
$this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . Util::backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;'));
$html_output .= '<div class="clearfloat" /><br />';
$html_output .= '<a href="sql.php' . URL::getCommon($this_url_params) . '">' . __('Remove partitioning') . '</a>';
$html_output .= '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="hidden" name="submit_partition" value="1">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>';
return $html_output;
}
示例14: PMA_userprefsAutoloadGetHeader
/**
* Shows form which allows to quickly load
* settings stored in browser's local storage
*
* @return string
*/
function PMA_userprefsAutoloadGetHeader()
{
if (isset($_REQUEST['prefs_autoload']) && $_REQUEST['prefs_autoload'] == 'hide') {
$_SESSION['userprefs_autoload'] = true;
return '';
}
$script_name = basename(basename($GLOBALS['PMA_PHP_SELF']));
$return_url = htmlspecialchars($script_name . '?' . http_build_query($_GET, '', '&'));
return PMA\libraries\Template::get('prefs_autoload')->render(array('hiddenInputs' => URL::getHiddenInputs(), 'return_url' => $return_url));
}
示例15: PMA_EVN_getEditorForm
/**
* Displays a form used to add/edit an event
*
* @param string $mode If the editor will be used to edit an event
* or add a new one: 'edit' or 'add'.
* @param string $operation If the editor was previously invoked with
* JS turned off, this will hold the name of
* the current operation
* @param array $item Data for the event returned by
* PMA_EVN_getDataFromRequest() or
* PMA_EVN_getDataFromName()
*
* @return string HTML code for the editor.
*/
function PMA_EVN_getEditorForm($mode, $operation, $item)
{
global $db, $table, $event_status, $event_type, $event_interval;
$modeToUpper = mb_strtoupper($mode);
// Escape special characters
$need_escape = array('item_original_name', 'item_name', 'item_type', 'item_execute_at', 'item_interval_value', 'item_starts', 'item_ends', 'item_definition', 'item_definer', 'item_comment');
foreach ($need_escape as $index) {
$item[$index] = htmlentities($item[$index], ENT_QUOTES);
}
$original_data = '';
if ($mode == 'edit') {
$original_data = "<input name='item_original_name' " . "type='hidden' value='{$item['item_original_name']}'/>\n";
}
// Handle some logic first
if ($operation == 'change') {
if ($item['item_type'] == 'RECURRING') {
$item['item_type'] = 'ONE TIME';
$item['item_type_toggle'] = 'RECURRING';
} else {
$item['item_type'] = 'RECURRING';
$item['item_type_toggle'] = 'ONE TIME';
}
}
if ($item['item_type'] == 'ONE TIME') {
$isrecurring_class = ' hide';
$isonetime_class = '';
} else {
$isrecurring_class = '';
$isonetime_class = ' hide';
}
// Create the output
$retval = "";
$retval .= "<!-- START " . $modeToUpper . " EVENT FORM -->\n\n";
$retval .= "<form class='rte_form' action='db_events.php' method='post'>\n";
$retval .= "<input name='{$mode}_item' type='hidden' value='1' />\n";
$retval .= $original_data;
$retval .= URL::getHiddenInputs($db, $table) . "\n";
$retval .= "<fieldset>\n";
$retval .= "<legend>" . __('Details') . "</legend>\n";
$retval .= "<table class='rte_table' style='width: 100%'>\n";
$retval .= "<tr>\n";
$retval .= " <td style='width: 20%;'>" . __('Event name') . "</td>\n";
$retval .= " <td><input type='text' name='item_name' \n";
$retval .= " value='{$item['item_name']}'\n";
$retval .= " maxlength='64' /></td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Status') . "</td>\n";
$retval .= " <td>\n";
$retval .= " <select name='item_status'>\n";
foreach ($event_status['display'] as $key => $value) {
$selected = "";
if (!empty($item['item_status']) && $item['item_status'] == $value) {
$selected = " selected='selected'";
}
$retval .= "<option{$selected}>{$value}</option>";
}
$retval .= " </select>\n";
$retval .= " </td>\n";
$retval .= "</tr>\n";
$retval .= "<tr>\n";
$retval .= " <td>" . __('Event type') . "</td>\n";
$retval .= " <td>\n";
if ($GLOBALS['is_ajax_request']) {
$retval .= " <select name='item_type'>";
foreach ($event_type as $key => $value) {
$selected = "";
if (!empty($item['item_type']) && $item['item_type'] == $value) {
$selected = " selected='selected'";
}
$retval .= "<option{$selected}>{$value}</option>";
}
$retval .= " </select>\n";
} else {
$retval .= " <input name='item_type' type='hidden' \n";
$retval .= " value='{$item['item_type']}' />\n";
$retval .= " <div class='floatleft' style='width: 49%; " . "text-align: center; font-weight: bold;'>\n";
$retval .= " {$item['item_type']}\n";
$retval .= " </div>\n";
$retval .= " <input style='width: 49%;' type='submit'\n";
$retval .= " name='item_changetype'\n";
$retval .= " value='";
$retval .= sprintf(__('Change to %s'), $item['item_type_toggle']);
$retval .= "' />\n";
}
$retval .= " </td>\n";
//.........這裏部分代碼省略.........