Ejemplo n.º 1
0
 /**
  * Test for PMA_getPageIdsAndNames()
  *
  * @return void
  */
 public function testGetPageIdsAndNames()
 {
     $db = 'db';
     $this->_mockDatabaseInteraction($db);
     $result = PMA_getPageIdsAndNames($db);
     $this->assertEquals(array('1' => 'page1', '2' => 'page2'), $result);
 }
Ejemplo n.º 2
0
/**
 * Function to get html to display a page selector
 *
 * @param array  $cfgRelation information about the configuration storage
 * @param string $db          database name
 *
 * @return string html content
 */
function PMA_getHtmlForPageSelector($cfgRelation, $db)
{
    $html = '<select name="selected_page" id="selected_page">';
    $html .= '<option value="0">-- ' . __('Select page') . ' --</option>';
    if ($cfgRelation['pdfwork']) {
        $pages = PMA_getPageIdsAndNames($db);
        foreach ($pages as $nr => $desc) {
            $html .= '<option value="' . $nr . '">';
            $html .= htmlspecialchars($desc) . '</option>';
        }
    }
    $html .= '</select>';
    return $html;
}
/**
 * Function to get html for displaying the page save as form
 *
 * @param string $db database name
 *
 * @return string html content
 */
function PMA_getHtmlForPageSaveAs($db)
{
    $cfgRelation = PMA_getRelationsParam();
    $choices = array('same' => __('Save to selected page'), 'new' => __('Create a page and save to it'));
    $html = '<form action="db_designer.php" method="post"' . ' name="save_as_pages" id="save_as_pages" class="ajax">';
    $html .= PMA_URL_getHiddenInputs($db);
    $html .= '<fieldset id="page_save_as_options">';
    $html .= '<table><tbody>';
    $html .= '<tr>';
    $html .= '<td>';
    $html .= '<input type="hidden" name="operation" value="savePage" />';
    $html .= '<select name="selected_page" id="selected_page">';
    $html .= '<option value="0">-- ' . __('Select page') . ' --</option>';
    if ($cfgRelation['pdfwork']) {
        $pages = PMA_getPageIdsAndNames($db);
        foreach ($pages as $nr => $desc) {
            $html .= '<option value="' . $nr . '">';
            $html .= htmlspecialchars($desc) . '</option>';
        }
    }
    $html .= '</select>';
    $html .= '</td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td>';
    $html .= PMA_Util::getRadioFields('save_page', $choices, 'same', true);
    $html .= '</td>';
    $html .= '</tr>';
    $html .= '<tr>';
    $html .= '<td>';
    $html .= '<label for="selected_value">' . __('New page name') . '</label>';
    $html .= '<input type="text" name="selected_value" id="selected_value" />';
    $html .= '</td>';
    $html .= '</tr>';
    $html .= '</tbody></table>';
    $html .= '</fieldset>';
    $html .= '</form>';
    return $html;
}