PMA\libraries\Util::getButtonOrImage PHP Method

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
    public static function getButtonOrImage($button_name, $button_class, $text, $image, $value = '')
    {
        if ($value == '') {
            $value = $text;
        }
        if ($GLOBALS['cfg']['ActionLinksMode'] == 'text') {
            return ' <input type="submit" name="' . $button_name . '"' . ' value="' . htmlspecialchars($value) . '"' . ' title="' . htmlspecialchars($text) . '" />' . "\n";
        }
        return '<button class="' . $button_class . '" type="submit"' . ' name="' . $button_name . '" value="' . htmlspecialchars($value) . '" title="' . htmlspecialchars($text) . '">' . "\n" . self::getIcon($image, $text) . '</button>' . "\n";
    }

Usage Example

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;
 }
All Usage Examples Of PMA\libraries\Util::getButtonOrImage
Util