PMA\libraries\Util::getDbLink PHP Method

    public static function getDbLink($database = null)
    {
        if (strlen($database) === 0) {
            if (strlen($GLOBALS['db']) === 0) {
                return '';
            }
            $database = $GLOBALS['db'];
        } else {
            $database = self::unescapeMysqlWildcards($database);
        }
        return '<a href="' . Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . URL::getCommon(array('db' => $database)) . '" title="' . htmlspecialchars(sprintf(__('Jump to database "%s".'), $database)) . '">' . htmlspecialchars($database) . '</a>';
    }

Usage Example

Example #1
0
 /**
  * Provides the generated QBE form
  *
  * @return string QBE form
  */
 public function getSelectionForm()
 {
     $html_output = '<form action="db_qbe.php" method="post" id="formQBE" ' . 'class="lock-page">';
     $html_output .= '<fieldset>';
     if ($GLOBALS['cfgRelation']['savedsearcheswork']) {
         $html_output .= $this->_getSavedSearchesField();
     }
     $html_output .= '<table class="data" style="width: 100%;">';
     // Get table's <tr> elements
     $html_output .= $this->_getColumnNamesRow();
     $html_output .= $this->_getColumnAliasRow();
     $html_output .= $this->_getShowRow();
     $html_output .= $this->_getSortRow();
     $html_output .= $this->_getSortOrder();
     $html_output .= $this->_getCriteriaInputboxRow();
     $html_output .= $this->_getInsDelAndOrCriteriaRows();
     $html_output .= $this->_getModifyColumnsRow();
     $html_output .= '</table>';
     $this->_new_row_count--;
     $url_params = array();
     $url_params['db'] = $this->_db;
     $url_params['criteriaColumnCount'] = $this->_new_column_count;
     $url_params['rows'] = $this->_new_row_count;
     $html_output .= URL::getHiddenInputs($url_params);
     $html_output .= '</fieldset>';
     // get footers
     $html_output .= $this->_getTableFooters();
     // get tables select list
     $html_output .= $this->_getTablesList();
     $html_output .= '</form>';
     $html_output .= '<form action="db_qbe.php" method="post" class="lock-page">';
     $html_output .= URL::getHiddenInputs(array('db' => $this->_db));
     // get SQL query
     $html_output .= '<div class="floatleft" style="width:50%">';
     $html_output .= '<fieldset>';
     $html_output .= '<legend>' . sprintf(__('SQL query on database <b>%s</b>:'), Util::getDbLink($this->_db));
     $html_output .= '</legend>';
     $text_dir = 'ltr';
     $html_output .= '<textarea cols="80" name="sql_query" id="textSqlquery"' . ' rows="' . (count($this->_criteriaTables) > 30 ? '15' : '7') . '"' . ' dir="' . $text_dir . '">';
     if (empty($this->_formColumns)) {
         $this->_formColumns = array();
     }
     $html_output .= $this->_getSQLQuery($this->_formColumns);
     $html_output .= '</textarea>';
     $html_output .= '</fieldset>';
     // displays form's footers
     $html_output .= '<fieldset class="tblFooters">';
     $html_output .= '<input type="hidden" name="submit_sql" value="1" />';
     $html_output .= '<input type="submit" value="' . __('Submit Query') . '" />';
     $html_output .= '</fieldset>';
     $html_output .= '</div>';
     $html_output .= '</form>';
     return $html_output;
 }
Util