Beispiel #1
0
/**
 * Get HTML snippet for Actions in table structure
 *
 * @param string         $type                      column type
 * @param string         $tbl_storage_engine        table storage engine
 * @param object|boolean $primary                   primary if set,
 *                                                  false otherwise
 * @param string         $field_name                column name
 * @param string         $url_query                 url query
 * @param array          $titles                    titles array
 * @param array          $row                       current row
 * @param string         $rownum                    row number
 * @param array          $columns_with_unique_index columns with unique index
 * @param boolean        $isInCentralColumns        set if column in central
 *                                                  columns list
 *
 * @return string $html_output;
 */
function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, $primary, $field_name, $url_query, $titles, $row, $rownum, $columns_with_unique_index, $isInCentralColumns)
{
    $html_output = '<td><ul class="table-structure-actions resizable-menu">';
    $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'primary nowrap', $primary && $primary->hasColumn($field_name), true, $url_query, $primary, 'ADD PRIMARY KEY', __('A primary key has been added on %s.'), 'Primary', $titles, $row, true);
    $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'add_unique unique nowrap', isset($columns_with_unique_index[$field_name]), false, $url_query, $primary, 'ADD UNIQUE', __('An index has been added on %s.'), 'Unique', $titles, $row, false);
    $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'add_index nowrap', false, false, $url_query, $primary, 'ADD INDEX', __('An index has been added on %s.'), 'Index', $titles, $row, false);
    if (!PMA_DRIZZLE) {
        $spatial_types = array('geometry', 'point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon', 'geomtrycollection');
        $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'spatial nowrap', !in_array($type, $spatial_types) || 'MYISAM' != $tbl_storage_engine, false, $url_query, $primary, 'ADD SPATIAL', __('An index has been added on %s.'), 'Spatial', $titles, $row, false);
        // FULLTEXT is possible on TEXT, CHAR and VARCHAR
        $html_output .= PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query, $row, $titles);
    }
    $html_output .= PMA_getHtmlForDistinctValueAction($url_query, $row, $titles);
    if (isset($GLOBALS['cfgRelation']['central_columnswork']) && $GLOBALS['cfgRelation']['central_columnswork']) {
        $html_output .= '<li class="browse nowrap">';
        if ($isInCentralColumns) {
            $html_output .= '<a href="#" onclick=$("input:checkbox").prop("checked",false);' . '$("#checkbox_row_' . $rownum . '").prop("checked",true);' . '$("button[value=remove_from_central_columns]").click();>' . PMA_Util::getIcon('centralColumns_delete.png', __('Remove from central columns')) . '</a>';
        } else {
            $html_output .= '<a href="#" onclick=$("input:checkbox").prop("checked",false);' . '$("#checkbox_row_' . $rownum . '").prop("checked",true);' . '$("button[value=add_to_central_columns]").click();>' . PMA_Util::getIcon('centralColumns_add.png', __('Add to central columns')) . '</a>';
        }
        $html_output .= '</li>';
    }
    $html_output .= '</ul></td>';
    return $html_output;
}
/**
 * Get HTML snippet for Actions in table structure
 *
 * @param string  $type                      column type
 * @param string  $tbl_storage_engine        table storage engine
 * @param boolean $primary                   primary if set, false otherwise
 * @param string  $field_name                column name
 * @param string  $url_query                 url query
 * @param array   $titles                    titles array
 * @param array   $row                       current row
 * @param string  $rownum                    row number
 * @param array   $hidden_titles             hidden titles
 * @param array   $columns_with_unique_index columns with unique index
 *
 * @return string $html_output;
 */
function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, $primary, $field_name, $url_query, $titles, $row, $rownum, $hidden_titles, $columns_with_unique_index)
{
    $html_output = '<td><ul class="table-structure-actions resizable-menu">';
    $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'primary nowrap', $primary && $primary->hasColumn($field_name), true, $url_query, $primary, 'ADD PRIMARY KEY', __('A primary key has been added on %s.'), 'Primary', $titles, $row, true);
    $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'add_unique unique nowrap', isset($columns_with_unique_index[$field_name]), false, $url_query, $primary, 'ADD UNIQUE', __('An index has been added on %s.'), 'Unique', $titles, $row, false);
    $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'add_index nowrap', false, false, $url_query, $primary, 'ADD INDEX', __('An index has been added on %s.'), 'Index', $titles, $row, false);
    if (!PMA_DRIZZLE) {
        $spatial_types = array('geometry', 'point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon', 'geomtrycollection');
        $html_output .= PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'spatial nowrap', !in_array($type, $spatial_types) || 'MYISAM' != $tbl_storage_engine, false, $url_query, $primary, 'ADD SPATIAL', __('An index has been added on %s.'), 'Spatial', $titles, $row, false);
        // FULLTEXT is possible on TEXT, CHAR and VARCHAR
        $html_output .= PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query, $row, $titles);
    }
    $html_output .= PMA_getHtmlForDistinctValueAction($url_query, $row, $titles);
    $html_output .= '<div class="clearfloat"></div></ul></td>';
    return $html_output;
}
Beispiel #3
0
/**
 * Get HTML snippet for Actions in table structure
 *
 * @param string  $type                      column type
 * @param string  $tbl_storage_engine        table storage engine
 * @param boolean $primary                   primary if set, false otherwise
 * @param string  $field_name                column name
 * @param string  $url_query                 url query
 * @param array   $titles                    titles array
 * @param array   $row                       current row
 * @param string  $rownum                    row number
 * @param array   $hidden_titles             hedden titles
 * @param array   $columns_with_unique_index columns with unique index
 *
 * @return string $html_output;
 */
function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, $primary, $field_name, $url_query, $titles, $row, $rownum, $hidden_titles, $columns_with_unique_index)
{
    $html_output = '';
    list($primary, $primary_enabled) = PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'primary replaced_by_more center', $primary && $primary->hasColumn($field_name), true, $url_query, $primary, 'ADD PRIMARY KEY', __('A primary key has been added on %s'), 'Primary', $titles, $row, true);
    $html_output .= $primary;
    list($unique, $unique_enabled) = PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'unique replaced_by_more center', isset($columns_with_unique_index[$field_name]), false, $url_query, $primary, 'ADD UNIQUE', __('An index has been added on %s'), 'Unique', $titles, $row, false);
    $html_output .= $unique;
    list($index, $index_enabled) = PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'index replaced_by_more center', false, false, $url_query, $primary, 'ADD INDEX', __('An index has been added on %s'), 'Index', $titles, $row, false);
    $html_output .= $index;
    if (!PMA_DRIZZLE) {
        $spatial_types = array('geometry', 'point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon', 'geomtrycollection');
        list($spatial, $spatial_enabled) = PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, 'spatial replaced_by_more center', !in_array($type, $spatial_types) || 'MYISAM' != $tbl_storage_engine, false, $url_query, $primary, 'ADD SPATIAL', __('An index has been added on %s'), 'Spatial', $titles, $row, false);
        $html_output .= $spatial;
        // FULLTEXT is possible on TEXT, CHAR and VARCHAR
        list($fulltext, $fulltext_enabled) = PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query, $row, $titles);
        $html_output .= $fulltext;
    }
    $html_output .= PMA_getHtmlForDistinctValueAction($url_query, $row, $titles);
    if ($GLOBALS['cfg']['PropertiesIconic'] !== true && $GLOBALS['cfg']['HideStructureActions'] === true) {
        $html_output .= PMA_getHtmlForMoreOptionInTableStructure($rownum, $primary_enabled, $url_query, $row, $hidden_titles, $unique_enabled, $index_enabled, $fulltext_enabled, $spatial_enabled, $primary);
    }
    return $html_output;
}