getButtonOrImage() public static method

Generate a button or image tag
public static getButtonOrImage ( string $button_name, string $button_class, string $text, string $image, string $value = '' ) : string
$button_name string name of button element
$button_class string class of button or image element
$text string text to display
$image string image to display
$value string value
return string html content
Esempio n. 1
0
 /**
  * Prepare multi field edit/delete links
  *
  * @param integer &$dt_result           the link id associated to the query which
  *                                      results have to be displayed
  * @param array   $analyzed_sql_results analyzed sql results
  * @param string  $del_link             the display element - 'del_link'
  *
  * @return string $links_html html content
  *
  * @access  private
  *
  * @see     getTable()
  */
 private function _getMultiRowOperationLinks(&$dt_result, $analyzed_sql_results, $del_link)
 {
     $links_html = '<div class="print_ignore" >';
     $url_query = $this->__get('url_query');
     $delete_text = $del_link == self::DELETE_ROW ? __('Delete') : __('Kill');
     $links_html .= '<img class="selectallarrow" width="38" height="22"' . ' src="' . $this->__get('pma_theme_image') . 'arrow_' . $this->__get('text_dir') . '.png' . '"' . ' alt="' . __('With selected:') . '" />';
     $links_html .= '<input type="checkbox" ' . 'id="resultsForm_' . $this->__get('unique_id') . '_checkall" ' . 'class="checkall_box" title="' . __('Check all') . '" /> ' . '<label for="resultsForm_' . $this->__get('unique_id') . '_checkall">' . __('Check all') . '</label> ' . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
     $links_html .= Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', __('Edit'), 'b_edit.png', 'edit');
     $links_html .= Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_copy', __('Copy'), 'b_insrow.png', 'copy');
     $links_html .= Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete', $delete_text, 'b_drop.png', 'delete');
     if ($analyzed_sql_results['querytype'] == 'SELECT') {
         $links_html .= Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export');
     }
     $links_html .= "</div>\n";
     $links_html .= '<input type="hidden" name="sql_query"' . ' value="' . htmlspecialchars($this->__get('sql_query')) . '" />' . "\n";
     if (!empty($url_query)) {
         $links_html .= '<input type="hidden" name="url_query"' . ' value="' . $url_query . '" />' . "\n";
     }
     // fetch last row of the result set
     $GLOBALS['dbi']->dataSeek($dt_result, $this->__get('num_rows') - 1);
     $row = $GLOBALS['dbi']->fetchRow($dt_result);
     // $clause_is_unique is needed by getTable() to generate the proper param
     // in the multi-edit and multi-delete form
     list($where_clause, $clause_is_unique, $condition_array) = Util::getUniqueCondition($dt_result, $this->__get('fields_cnt'), $this->__get('fields_meta'), $row, false, false, $analyzed_sql_results);
     unset($where_clause, $condition_array);
     // reset to first row for the loop in _getTableBody()
     $GLOBALS['dbi']->dataSeek($dt_result, 0);
     $links_html .= '<input type="hidden" name="clause_is_unique"' . ' value="' . $clause_is_unique . '" />' . "\n";
     $links_html .= '</form>' . "\n";
     return $links_html;
 }
/**
 * Get HTML for display the users overview
 * (if less than 50 users, display them immediately)
 *
 * @param array  $result        ran sql query
 * @param array  $db_rights     user's database rights array
 * @param string $pmaThemeImage a image source link
 * @param string $text_dir      text directory
 *
 * @return string HTML snippet
 */
function PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir)
{
    while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
        $row['privs'] = PMA_extractPrivInfo($row, true);
        $db_rights[$row['User']][$row['Host']] = $row;
    }
    @$GLOBALS['dbi']->freeResult($result);
    $user_group_count = 0;
    if ($GLOBALS['cfgRelation']['menuswork']) {
        $user_group_count = PMA_getUserGroupCount();
    }
    $html_output = '<form name="usersForm" id="usersForm" action="server_privileges.php" ' . 'method="post">' . "\n" . PMA_URL_getHiddenInputs('', '') . '<table id="tableuserrights" class="data">' . "\n" . '<thead>' . "\n" . '<tr><th></th>' . "\n" . '<th>' . __('User name') . '</th>' . "\n" . '<th>' . __('Host name') . '</th>' . "\n" . '<th>' . __('Password') . '</th>' . "\n" . '<th>' . __('Global privileges') . ' ' . Util::showHint(__('Note: MySQL privilege names are expressed in English.')) . '</th>' . "\n";
    if ($GLOBALS['cfgRelation']['menuswork']) {
        $html_output .= '<th>' . __('User group') . '</th>' . "\n";
    }
    $html_output .= '<th>' . __('Grant') . '</th>' . "\n" . '<th colspan="' . ($user_group_count > 0 ? '3' : '2') . '">' . __('Action') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n";
    $html_output .= '<tbody>' . "\n";
    $html_output .= PMA_getHtmlTableBodyForUserRights($db_rights);
    $html_output .= '</tbody>' . '</table>' . "\n";
    $html_output .= '<div class="floatleft">' . Util::getWithSelected($pmaThemeImage, $text_dir, "usersForm") . "\n";
    $html_output .= Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export');
    $html_output .= '<input type="hidden" name="initial" ' . 'value="' . (isset($_GET['initial']) ? $_GET['initial'] : '') . '" />';
    $html_output .= '</div>' . '<div class="clear_both" style="clear:both"></div>';
    // add/delete user fieldset
    $html_output .= PMA_getFieldsetForAddDeleteUser();
    $html_output .= '</form>' . "\n";
    return $html_output;
}
/**
 * Get HTML for "check all" check box with "with selected" dropdown
 *
 * @param string $pmaThemeImage pma theme image url
 * @param string $text_dir      url for text directory
 *
 * @return string $html_output
 */
function PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir)
{
    $html_output = Util::getWithSelected($pmaThemeImage, $text_dir, "tableslistcontainer");
    $html_output .= Util::getButtonOrImage('edit_central_columns', 'mult_submit change_central_columns', 'submit_mult_change', __('Edit'), 'b_edit.png', 'edit central columns');
    $html_output .= Util::getButtonOrImage('delete_central_columns', 'mult_submit', 'submit_mult_central_columns_remove', __('Delete'), 'b_drop.png', 'remove_from_central_columns');
    return $html_output;
}
 /**
  * Returns the html for Table footer buttons
  *
  * @return string
  */
 private function _getHtmlForTableFooterButtons()
 {
     if (!$GLOBALS['is_superuser'] && !$GLOBALS['cfg']['AllowUserDropDatabase']) {
         return '';
     }
     $html = Util::getWithSelected($GLOBALS['pmaThemeImage'], $GLOBALS['text_dir'], "dbStatsForm");
     $html .= Util::getButtonOrImage('', 'mult_submit' . ' ajax', 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
     return $html;
 }
 /**
  * Returns the html for Table footer buttons
  *
  * @return string
  */
 private function _getHtmlForTableFooterButtons()
 {
     if (!$GLOBALS['is_superuser'] && !$GLOBALS['cfg']['AllowUserDropDatabase']) {
         return '';
     }
     $html = Template::get('select_all')->render(array('pmaThemeImage' => $GLOBALS['pmaThemeImage'], 'text_dir' => $GLOBALS['text_dir'], 'formName' => 'dbStatsForm'));
     $html .= Util::getButtonOrImage('', 'mult_submit' . ' ajax', __('Drop'), 'b_deltbl.png');
     return $html;
 }
/**
 * Get HTML for "check all" check box with "with selected" dropdown
 *
 * @param string $pmaThemeImage pma theme image url
 * @param string $text_dir      url for text directory
 *
 * @return string $html_output
 */
function PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir)
{
    $html_output = PMA\libraries\Template::get('select_all')->render(array('pmaThemeImage' => $pmaThemeImage, 'text_dir' => $text_dir, 'formName' => 'tableslistcontainer'));
    $html_output .= Util::getButtonOrImage('edit_central_columns', 'mult_submit change_central_columns', __('Edit'), 'b_edit.png', 'edit central columns');
    $html_output .= Util::getButtonOrImage('delete_central_columns', 'mult_submit', __('Delete'), 'b_drop.png', 'remove_from_central_columns');
    return $html_output;
}