本文整理汇总了PHP中PMA_RTN_getEditorForm函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_RTN_getEditorForm函数的具体用法?PHP PMA_RTN_getEditorForm怎么用?PHP PMA_RTN_getEditorForm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_RTN_getEditorForm函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_RTN_handleEditor
/**
* Handles editor requests for adding or editing an item
*
* @return void
*/
function PMA_RTN_handleEditor()
{
global $_GET, $_POST, $_REQUEST, $GLOBALS, $db, $errors;
$errors = PMA_RTN_handleRequestCreateOrEdit($errors, $db);
/**
* Display a form used to add/edit a routine, if necessary
*/
// FIXME: this must be simpler than that
if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
if (!empty($_REQUEST['routine_changetype'])) {
$operation = 'change';
}
}
}
// Get the data for the form (if any)
if (!empty($_REQUEST['add_item'])) {
$title = PMA_RTE_getWord('add');
$routine = PMA_RTN_getDataFromRequest();
$mode = 'add';
} else {
if (!empty($_REQUEST['edit_item'])) {
$title = __("Edit routine");
if (!$operation && !empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit'])) {
$routine = PMA_RTN_getDataFromName($_REQUEST['item_name'], $_REQUEST['item_type']);
if ($routine !== false) {
$routine['item_original_name'] = $routine['item_name'];
$routine['item_original_type'] = $routine['item_type'];
}
} else {
$routine = PMA_RTN_getDataFromRequest();
}
$mode = 'edit';
}
}
if ($routine !== false) {
// Show form
$editor = PMA_RTN_getEditorForm($mode, $operation, $routine);
if ($GLOBALS['is_ajax_request']) {
$response = PMA\libraries\Response::getInstance();
$response->addJSON('message', $editor);
$response->addJSON('title', $title);
$response->addJSON('param_template', PMA_RTN_getParameterRow());
$response->addJSON('type', $routine['item_type']);
} else {
echo "\n\n<h2>{$title}</h2>\n\n{$editor}";
}
exit;
} else {
$message = __('Error in processing request:') . ' ';
$message .= sprintf(PMA_RTE_getWord('no_edit'), htmlspecialchars(PMA\libraries\Util::backquote($_REQUEST['item_name'])), htmlspecialchars(PMA\libraries\Util::backquote($db)));
$message = Message::error($message);
if ($GLOBALS['is_ajax_request']) {
$response = PMA\libraries\Response::getInstance();
$response->setRequestStatus(false);
$response->addJSON('message', $message);
exit;
} else {
$message->display();
}
}
}
}
示例2: PMA_RTN_handleEditor
//.........这里部分代码省略.........
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . PMA_DBI_getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA_Message::error(__('<b>One or more errors have occured while processing your request:</b>'));
$message->addString('<ul>');
foreach ($errors as $string) {
$message->addString('<li>' . $string . '</li>');
}
$message->addString('</ul>');
}
$output = PMA_Util::getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
if ($message->isSuccess()) {
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, `DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
$where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "' " . "AND ROUTINE_NAME='" . PMA_Util::sqlAddSlashes($_REQUEST['item_name']) . "'" . "AND ROUTINE_TYPE='" . PMA_Util::sqlAddSlashes($_REQUEST['item_type']) . "'";
$routine = PMA_DBI_fetch_single_row("SELECT {$columns} FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE {$where};");
$response->addJSON('name', htmlspecialchars(strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
} else {
$response->isSuccess(false);
$response->addJSON('message', $output);
}
exit;
}
}
/**
* Display a form used to add/edit a routine, if necessary
*/
if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
if (!empty($_REQUEST['routine_changetype'])) {
$operation = 'change';
}
}
}
// Get the data for the form (if any)
if (!empty($_REQUEST['add_item'])) {
$title = PMA_RTE_getWord('add');
$routine = PMA_RTN_getDataFromRequest();
$mode = 'add';
} else {
if (!empty($_REQUEST['edit_item'])) {
$title = __("Edit routine");
if (!$operation && !empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit'])) {
$routine = PMA_RTN_getDataFromName($_REQUEST['item_name'], $_REQUEST['item_type']);
if ($routine !== false) {
$routine['item_original_name'] = $routine['item_name'];
$routine['item_original_type'] = $routine['item_type'];
}
} else {
$routine = PMA_RTN_getDataFromRequest();
}
$mode = 'edit';
}
}
if ($routine !== false) {
// Show form
$editor = PMA_RTN_getEditorForm($mode, $operation, $routine);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
$response->addJSON('message', $editor);
$response->addJSON('title', $title);
$response->addJSON('param_template', PMA_RTN_getParameterRow());
$response->addJSON('type', $routine['item_type']);
} else {
echo "\n\n<h2>{$title}</h2>\n\n{$editor}";
}
exit;
} else {
$message = __('Error in processing request') . ' : ';
$message .= sprintf(PMA_RTE_getWord('not_found'), htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), htmlspecialchars(PMA_Util::backquote($db)));
$message = PMA_message::error($message);
if ($GLOBALS['is_ajax_request']) {
$response->isSuccess(false);
$response->addJSON('message', $message);
exit;
} else {
$message->display();
}
}
}
}
示例3: PMA_RTN_handleEditor
//.........这里部分代码省略.........
if (!$result) {
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA_Message::error(__('One or more errors have occurred while' . ' processing your request:'));
$message->addString('<ul>');
foreach ($errors as $string) {
$message->addString('<li>' . $string . '</li>');
}
$message->addString('</ul>');
}
$output = PMA_Util::getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
if ($message->isSuccess()) {
$routines = $GLOBALS['dbi']->getRoutines($db, $_REQUEST['item_type'], $_REQUEST['item_name']);
$routine = $routines[0];
$response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
} else {
$response->isSuccess(false);
$response->addJSON('message', $output);
}
exit;
}
}
/**
* Display a form used to add/edit a routine, if necessary
*/
// FIXME: this must be simpler than that
if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
if (!empty($_REQUEST['routine_changetype'])) {
$operation = 'change';
}
}
}
// Get the data for the form (if any)
if (!empty($_REQUEST['add_item'])) {
$title = PMA_RTE_getWord('add');
$routine = PMA_RTN_getDataFromRequest();
$mode = 'add';
} else {
if (!empty($_REQUEST['edit_item'])) {
$title = __("Edit routine");
if (!$operation && !empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit'])) {
$routine = PMA_RTN_getDataFromName($_REQUEST['item_name'], $_REQUEST['item_type']);
if ($routine !== false) {
$routine['item_original_name'] = $routine['item_name'];
$routine['item_original_type'] = $routine['item_type'];
}
} else {
$routine = PMA_RTN_getDataFromRequest();
}
$mode = 'edit';
}
}
if ($routine !== false) {
// Show form
$editor = PMA_RTN_getEditorForm($mode, $operation, $routine);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
$response->addJSON('message', $editor);
$response->addJSON('title', $title);
$response->addJSON('param_template', PMA_RTN_getParameterRow());
$response->addJSON('type', $routine['item_type']);
} else {
echo "\n\n<h2>{$title}</h2>\n\n{$editor}";
}
exit;
} else {
$message = __('Error in processing request:') . ' ';
$message .= sprintf(PMA_RTE_getWord('not_found'), htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), htmlspecialchars(PMA_Util::backquote($db)));
$message = PMA_message::error($message);
if ($GLOBALS['is_ajax_request']) {
$response->isSuccess(false);
$response->addJSON('message', $message);
exit;
} else {
$message->display();
}
}
}
}
示例4: testgetEditorForm_4
/**
* @depends testgetParameterRow_ajax
* @dataProvider provider_editor_4
*/
public function testgetEditorForm_4($data, $matcher)
{
$GLOBALS['is_ajax_request'] = false;
PMA_RTN_setGlobals();
$this->assertTag($matcher, PMA_RTN_getEditorForm('edit', 'change', $data), false);
}
示例5: testgetEditorForm4
/**
* Test for PMA_RTN_getEditorForm
*
* @param array $data Data for routine
* @param array $matcher Matcher
*
* @return void
*
* @depends testgetParameterRowAjax
* @dataProvider providerEditor4
*/
public function testgetEditorForm4($data, $matcher)
{
PMA_RTN_setGlobals();
$this->assertContains(
$matcher,
PMA_RTN_getEditorForm('edit', 'change', $data)
);
}
示例6: PMA_RTN_handleEditor
//.........这里部分代码省略.........
$errors[] = sprintf(__('The following query has failed: "%s"'), htmlspecialchars($routine_query)) . '<br /><br />' . __('MySQL said: ') . $GLOBALS['dbi']->getError(null);
} else {
$message = PMA_Message::success(__('Routine %1$s has been created.'));
$message->addParam(PMA_Util::backquote($_REQUEST['item_name']));
$sql_query = $routine_query;
}
}
}
if (count($errors)) {
$message = PMA_Message::error(__('One or more errors have occurred while' . ' processing your request:'));
$message->addString('<ul>');
foreach ($errors as $string) {
$message->addString('<li>' . $string . '</li>');
}
$message->addString('</ul>');
}
$output = PMA_Util::getMessage($message, $sql_query);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
if ($message->isSuccess()) {
$routines = $GLOBALS['dbi']->getRoutines($db, $_REQUEST['item_type'], $_REQUEST['item_name']);
$routine = $routines[0];
$response->addJSON('name', htmlspecialchars(mb_strtoupper($_REQUEST['item_name'])));
$response->addJSON('new_row', PMA_RTN_getRowForList($routine));
$response->addJSON('insert', !empty($routine));
$response->addJSON('message', $output);
} else {
$response->isSuccess(false);
$response->addJSON('message', $output);
}
exit;
}
}
/**
* Display a form used to add/edit a routine, if necessary
*/
// FIXME: this must be simpler than that
if (count($errors) || empty($_REQUEST['editor_process_add']) && empty($_REQUEST['editor_process_edit']) && (!empty($_REQUEST['add_item']) || !empty($_REQUEST['edit_item']) || !empty($_REQUEST['routine_addparameter']) || !empty($_REQUEST['routine_removeparameter']) || !empty($_REQUEST['routine_changetype']))) {
// Handle requests to add/remove parameters and changing routine type
// This is necessary when JS is disabled
$operation = '';
if (!empty($_REQUEST['routine_addparameter'])) {
$operation = 'add';
} else {
if (!empty($_REQUEST['routine_removeparameter'])) {
$operation = 'remove';
} else {
if (!empty($_REQUEST['routine_changetype'])) {
$operation = 'change';
}
}
}
// Get the data for the form (if any)
if (!empty($_REQUEST['add_item'])) {
$title = PMA_RTE_getWord('add');
$routine = PMA_RTN_getDataFromRequest();
$mode = 'add';
} else {
if (!empty($_REQUEST['edit_item'])) {
$title = __("Edit routine");
if (!$operation && !empty($_REQUEST['item_name']) && empty($_REQUEST['editor_process_edit'])) {
$routine = PMA_RTN_getDataFromName($_REQUEST['item_name'], $_REQUEST['item_type']);
if ($routine !== false) {
$routine['item_original_name'] = $routine['item_name'];
$routine['item_original_type'] = $routine['item_type'];
}
} else {
$routine = PMA_RTN_getDataFromRequest();
}
$mode = 'edit';
}
}
if ($routine !== false) {
// Show form
$editor = PMA_RTN_getEditorForm($mode, $operation, $routine);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
$response->addJSON('message', $editor);
$response->addJSON('title', $title);
$response->addJSON('param_template', PMA_RTN_getParameterRow());
$response->addJSON('type', $routine['item_type']);
} else {
echo "\n\n<h2>{$title}</h2>\n\n{$editor}";
}
exit;
} else {
$message = __('Error in processing request:') . ' ';
$message .= sprintf(PMA_RTE_getWord('not_found'), htmlspecialchars(PMA_Util::backquote($_REQUEST['item_name'])), htmlspecialchars(PMA_Util::backquote($db)));
$message = PMA_message::error($message);
if ($GLOBALS['is_ajax_request']) {
$response = PMA_Response::getInstance();
$response->isSuccess(false);
$response->addJSON('message', $message);
exit;
} else {
$message->display();
}
}
}
}