当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_getMIME函数代码示例

本文整理汇总了PHP中PMA_getMIME函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getMIME函数的具体用法?PHP PMA_getMIME怎么用?PHP PMA_getMIME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_getMIME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_getHtmlForCreateNewColumn

/**
 * get the html of the form to add the new column to given table
 *
 * @param integer $num_fields number of columns to add
 * @param string  $db         current database
 * @param string  $table      current table
 * @param array   $columnMeta array containing default values for the fields
 *
 * @return string HTML
 */
function PMA_getHtmlForCreateNewColumn($num_fields, $db, $table, $columnMeta = array())
{
    $cfgRelation = PMA_getRelationsParam();
    $content_cells = array();
    $available_mime = array();
    $mime_map = array();
    if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
        $mime_map = PMA_getMIME($db, $table);
        $available_mime = PMA_getAvailableMIMEtypes();
    }
    $comments_map = PMA_getComments($db, $table);
    for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
        $content_cells[$columnNumber] = array('columnNumber' => $columnNumber, 'columnMeta' => $columnMeta, 'type_upper' => '', 'length_values_input_size' => 8, 'length' => '', 'extracted_columnspec' => array(), 'submit_attribute' => null, 'comments_map' => $comments_map, 'fields_meta' => null, 'is_backup' => true, 'move_columns' => array(), 'cfgRelation' => $cfgRelation, 'available_mime' => isset($available_mime) ? $available_mime : array(), 'mime_map' => $mime_map);
    }
    return PMA\libraries\Template::get('columns_definitions/table_fields_definitions')->render(array('is_backup' => true, 'fields_meta' => null, 'mimework' => $cfgRelation['mimework'], 'content_cells' => $content_cells));
}
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:26,代码来源:normalization.lib.php

示例2: PMA_getHtmlForCreateNewColumn

/**
 * get the html of the form to add the new column to given table
 *
 * @param integer $num_fields number of columns to add
 * @param string  $db         current database
 * @param string  $table      current table
 * @param array   $columnMeta array containing default values for the fields
 *
 * @return HTML
 */
function PMA_getHtmlForCreateNewColumn($num_fields, $db, $table, $columnMeta = array())
{
    $cfgRelation = PMA_getRelationsParam();
    $content_cells = array();
    $available_mime = array();
    $mime_map = array();
    $header_cells = PMA_getHeaderCells(true, null, $cfgRelation['mimework'], $db, $table);
    if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
        $mime_map = PMA_getMIME($db, $table);
        $available_mime = PMA_getAvailableMIMEtypes();
    }
    $comments_map = PMA_getComments($db, $table);
    for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
        $content_cells[$columnNumber] = PMA_getHtmlForColumnAttributes($columnNumber, $columnMeta, '', 8, '', null, array(), null, null, null, $comments_map, null, true, array(), $cfgRelation, isset($available_mime) ? $available_mime : array(), $mime_map);
    }
    return PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells);
}
开发者ID:graurus,项目名称:testgit_t37,代码行数:27,代码来源:normalization.lib.php

示例3: PMA_exportStructure

 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
 {
     global $cfgRelation;
     /**
      * Get the unique keys in the table
      */
     $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
     $keys_result = PMA_DBI_query($keys_query);
     $unique_keys = array();
     while ($key = PMA_DBI_fetch_assoc($keys_result)) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     PMA_DBI_free_result($keys_result);
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
     $result = PMA_DBI_query($local_query);
     $fields_cnt = PMA_DBI_num_rows($result);
     // Check if we can use Relations (Mike Beck)
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = TRUE;
         } else {
             $have_rel = FALSE;
         }
     } else {
         $have_rel = FALSE;
     }
     // end if
     /**
      * Displays the table structure
      */
     $buffer = $crlf . '%' . $crlf . '% ' . $GLOBALS['strStructure'] . ': ' . $table . $crlf . '%' . $crlf . ' \\begin{longtable}{';
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     $columns_cnt = 4;
     $alignment = '|l|c|c|c|';
     if ($do_relation && $have_rel) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_comments && ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100)) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     $buffer = $alignment . '} ' . $crlf;
     $header = ' \\hline ';
     $header .= '\\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strField'] . '}} & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strType'] . '}} & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strNull'] . '}} & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strDefault'] . '}}';
     if ($do_relation && $have_rel) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strLinksTo'] . '}}';
     }
     if ($do_comments && ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100)) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . $GLOBALS['strComments'] . '}}';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $local_buffer = PMA_texEscape($table);
     // Table caption for first page and label
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_structure_caption']) . '} \\label{' . str_replace('__TABLE__', $table, $GLOBALS['latex_structure_label']) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . str_replace('__TABLE__', PMA_texEscape($table), $GLOBALS['latex_structure_continued_caption']) . '} \\\\ ' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     while ($row = PMA_DBI_fetch_assoc($result)) {
         $type = $row['Type'];
         // reformat mysql query output - staybyte - 9. June 2001
         // loic1: set or enum types: slashes single quotes inside options
         if (eregi('^(set|enum)\\((.+)\\)$', $type, $tmp)) {
             $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
             $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
             $type_nowrap = '';
             $binary = 0;
             $unsigned = 0;
             $zerofill = 0;
         } else {
             $type_nowrap = ' nowrap="nowrap"';
             $type = eregi_replace('BINARY', '', $type);
             $type = eregi_replace('ZEROFILL', '', $type);
//.........这里部分代码省略.........
开发者ID:findlakes,项目名称:XSS-Platform,代码行数:101,代码来源:latex.php

示例4: _setMimeMap

 /**
  * Sets the MIME details of the columns in the results set
  *
  * @return void
  */
 private function _setMimeMap()
 {
     $fields_meta = $this->__get('fields_meta');
     $mimeMap = array();
     $added = array();
     for ($currentColumn = 0; $currentColumn < $this->__get('fields_cnt'); ++$currentColumn) {
         $meta = $fields_meta[$currentColumn];
         $orgFullTableName = $this->__get('db') . '.' . $meta->orgtable;
         if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME'] && !$_SESSION['tmpval']['hide_transformation'] && empty($added[$orgFullTableName])) {
             $mimeMap = array_merge($mimeMap, PMA_getMIME($this->__get('db'), $meta->orgtable, false, true));
             $added[$orgFullTableName] = true;
         }
     }
     // special browser transformation for some SHOW statements
     if ($this->__get('is_show') && !$_SESSION['tmpval']['hide_transformation']) {
         preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?' . 'PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS' . ')@i', $this->__get('sql_query'), $which);
         if (isset($which[1])) {
             $str = ' ' . strtoupper($which[1]);
             $isShowProcessList = strpos($str, 'PROCESSLIST') > 0;
             if ($isShowProcessList) {
                 $mimeMap['..Info'] = array('mimetype' => 'Text_Plain', 'transformation' => 'output/Text_Plain_Sql.class.php');
             }
             $isShowCreateTable = preg_match('@CREATE[[:space:]]+TABLE@i', $this->__get('sql_query'));
             if ($isShowCreateTable) {
                 $mimeMap['..Create Table'] = array('mimetype' => 'Text_Plain', 'transformation' => 'output/Text_Plain_Sql.class.php');
             }
         }
     }
     $this->__set('mime_map', $mimeMap);
 }
开发者ID:nkeat12,项目名称:dv,代码行数:35,代码来源:DisplayResults.class.php

示例5: PMA_displayTableHeaders


//.........这里部分代码省略.........
        }
        // end vertical mode
    } elseif ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
        $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 3 : 0;
        if ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped') {
            ?>
    <td<?php 
            echo $colspan;
            ?>
></td>
            <?php 
        } else {
            $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
        }
        // end vertical mode
    }
    // 2. Displays the fields' name
    // 2.0 If sorting links should be used, checks if the query is a "JOIN"
    //     statement (see 2.1.3)
    // 2.0.1 Prepare Display column comments if enabled ($GLOBALS['cfg']['ShowBrowseComments']).
    //       Do not show comments, if using horizontalflipped mode, because of space usage
    if ($GLOBALS['cfg']['ShowBrowseComments'] && ($GLOBALS['cfgRelation']['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) && $disp_direction != 'horizontalflipped') {
        $comments_map = array();
        if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) {
            foreach ($analyzed_sql[0]['table_ref'] as $tbl) {
                $tb = $tbl['table_true_name'];
                $comments_map[$tb] = PMA_getComments($db, $tb);
                unset($tb);
            }
        }
    }
    if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
        require_once './libraries/transformations.lib.php';
        $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
    }
    if ($is_display['sort_lnk'] == '1') {
        //$is_join = preg_match('@(.*)[[:space:]]+FROM[[:space:]]+.*[[:space:]]+JOIN@im', $sql_query, $select_stt);
        $is_join = isset($analyzed_sql[0]['queryflags']['join']) ? true : false;
        $select_expr = $analyzed_sql[0]['select_expr_clause'];
    } else {
        $is_join = false;
    }
    // garvin: See if we have to highlight any header fields of a WHERE query.
    //  Uses SQL-Parser results.
    $highlight_columns = array();
    if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['where_clause_identifiers'])) {
        $wi = 0;
        if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) {
            foreach ($analyzed_sql[0]['where_clause_identifiers'] as $wci_nr => $wci) {
                $highlight_columns[$wci] = 'true';
            }
        }
    }
    for ($i = 0; $i < $fields_cnt; $i++) {
        // garvin: See if this column should get highlight because it's used in the
        //  where-query.
        if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) {
            $condition_field = true;
        } else {
            $condition_field = false;
        }
        // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled.
        if (isset($comments_map) && isset($comments_map[$fields_meta[$i]->table]) && isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) {
            $comments = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>';
        } else {
            $comments = '';
开发者ID:a195474368,项目名称:ejiawang,代码行数:67,代码来源:display_tbl.lib.php

示例6: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db            the database name
  * @param string $table         the table name
  * @param string $crlf          the end of line sequence
  * @param string $error_url     the url to go back in case of error
  * @param bool   $do_relation   whether to include relation comments
  * @param bool   $do_comments   whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                $this->exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime       whether to include mime comments
  * @param bool   $show_dates    whether to include creation/update/check dates
  * @param bool   $add_semicolon whether to add semicolon and end-of-line
  *                              at the end
  * @param bool   $view          whether we're handling a view
  * @param array  $aliases       Aliases of db/table/columns
  *
  * @return string resulting schema
  */
 public function getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $show_dates = false, $add_semicolon = true, $view = false, $aliases = array())
 {
     global $cfgRelation;
     $text_output = '';
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = $GLOBALS['dbi']->getTableIndexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     $GLOBALS['dbi']->selectDb($db);
     // Check if we can use Relations
     list($res_rel, $have_rel) = PMA_getRelationsAndStatus($do_relation && !empty($cfgRelation['relation']), $db, $table);
     /**
      * Displays the table structure
      */
     $text_output .= "|------\n";
     $text_output .= '|' . __('Column');
     $text_output .= '|' . __('Type');
     $text_output .= '|' . __('Null');
     $text_output .= '|' . __('Default');
     if ($do_relation && $have_rel) {
         $text_output .= '|' . __('Links to');
     }
     if ($do_comments) {
         $text_output .= '|' . __('Comments');
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $text_output .= '|' . htmlspecialchars('MIME');
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $text_output .= "\n|------\n";
     $columns = $GLOBALS['dbi']->getColumns($db, $table);
     foreach ($columns as $column) {
         $col_as = $column['Field'];
         if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
             $col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
         }
         $text_output .= $this->formatOneColumnDefinition($column, $unique_keys, $col_as);
         $field_name = $column['Field'];
         if ($do_relation && $have_rel) {
             $text_output .= '|' . htmlspecialchars($this->getRelationString($res_rel, $field_name, $db, $aliases));
         }
         if ($do_comments && $cfgRelation['commwork']) {
             $text_output .= '|' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '');
         }
         if ($do_mime && $cfgRelation['mimework']) {
             $text_output .= '|' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '');
         }
         $text_output .= "\n";
     }
     // end foreach
     return $text_output;
 }
开发者ID:nobodypb,项目名称:phpmyadmin,代码行数:85,代码来源:ExportTexytext.class.php

示例7: PMA_RT_DOC

function PMA_RT_DOC($alltables)
{
    global $db, $pdf, $orientation;
    //TOC
    $pdf->addpage("P");
    $pdf->Cell(0, 9, $GLOBALS['strTableOfContents'], 1, 0, 'C');
    $pdf->Ln(15);
    $i = 1;
    foreach ($alltables as $table) {
        $pdf->PMA_links['doc'][$table]['-'] = $pdf->AddLink();
        $pdf->SetX(10);
        //$pdf->Ln(1);
        $pdf->Cell(0, 6, $GLOBALS['strPageNumber'] . ' {' . sprintf("%02d", $i) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$table]['-']);
        $pdf->SetX(10);
        $pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
        //$pdf->Ln(1);
        $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
        $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
        while ($row = PMA_mysql_fetch_array($result)) {
            $pdf->SetX(20);
            $field_name = $row['Field'];
            $pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();
            //$pdf->Cell(0,6,$field_name,0,1,'L',0,$pdf->PMA_links['doc'][$table][$field_name]);
        }
        $lasttable = $table;
        $i++;
    }
    $pdf->PMA_links['RT']['-'] = $pdf->AddLink();
    $pdf->SetX(10);
    $pdf->Cell(0, 6, $GLOBALS['strPageNumber'] . ' {00}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$lasttable]['-']);
    $pdf->SetX(10);
    $pdf->Cell(0, 6, $i . ' ' . $GLOBALS['strRelationalSchema'], 0, 1, 'L', 0, $pdf->PMA_links['RT']['-']);
    $z = 0;
    foreach ($alltables as $table) {
        $z++;
        $pdf->addpage($GLOBALS['orientation']);
        $pdf->Bookmark($table);
        $pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo());
        $pdf->PMA_links['RT'][$table]['-'] = $pdf->AddLink();
        $pdf->SetLink($pdf->PMA_links['doc'][$table]['-'], -1);
        $pdf->SetFont('', 'B', 18);
        $pdf->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $pdf->PMA_links['RT'][$table]['-']);
        $pdf->SetFont('', '', 8);
        $pdf->ln();
        $cfgRelation = PMA_getRelationsParam();
        if ($cfgRelation['commwork']) {
            $comments = PMA_getComments($db, $table);
        }
        if ($cfgRelation['mimework']) {
            $mime_map = PMA_getMIME($db, $table, true);
        }
        /**
         * Gets table informations
         */
        $local_query = "SHOW TABLE STATUS LIKE '" . PMA_sqlAddslashes($table, TRUE) . "'";
        $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
        $showtable = PMA_mysql_fetch_array($result);
        $num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
        $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
        $create_time = isset($showtable['Create_time']) ? PMA_localisedDate(strtotime($showtable['Create_time'])) : '';
        $update_time = isset($showtable['Update_time']) ? PMA_localisedDate(strtotime($showtable['Update_time'])) : '';
        $check_time = isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '';
        if ($result) {
            mysql_free_result($result);
        }
        /**
         * Gets table keys and retains them
         */
        $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
        $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
        $primary = '';
        $indexes = array();
        $lastIndex = '';
        $indexes_info = array();
        $indexes_data = array();
        $pk_array = array();
        // will be use to emphasis prim. keys in the table
        // view
        while ($row = PMA_mysql_fetch_array($result)) {
            // Backups the list of primary keys
            if ($row['Key_name'] == 'PRIMARY') {
                $primary .= $row['Column_name'] . ', ';
                $pk_array[$row['Column_name']] = 1;
            }
            // Retains keys informations
            if ($row['Key_name'] != $lastIndex) {
                $indexes[] = $row['Key_name'];
                $lastIndex = $row['Key_name'];
            }
            $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
            $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
            if (isset($row['Cardinality'])) {
                $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
            }
            // I don't know what does following column mean....
            // $indexes_info[$row['Key_name']]['Packed']          = $row['Packed'];
            $indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
            $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
            if (isset($row['Sub_part'])) {
                $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
//.........这里部分代码省略.........
开发者ID:quartemer,项目名称:xoopserver,代码行数:101,代码来源:pdf_schema.php

示例8: PMA_getHtmlForInsertEditRow

/**
 * Function to get html for each insert/edit row
 *
 * @param array  $url_params            url parameters
 * @param array  $table_columns         table columns
 * @param array  $comments_map          comments map
 * @param bool   $timestamp_seen        whether timestamp seen
 * @param array  $current_result        current result
 * @param string $chg_evt_handler       javascript change event handler
 * @param string $jsvkey                javascript validation key
 * @param string $vkey                  validation key
 * @param bool   $insert_mode           whether insert mode
 * @param array  $current_row           current row
 * @param int    &$o_rows               row offset
 * @param int    &$tabindex             tab index
 * @param int    $columns_cnt           columns count
 * @param bool   $is_upload             whether upload
 * @param int    $tabindex_for_function tab index offset for function
 * @param array  $foreigners            foreigners
 * @param int    $tabindex_for_null     tab index offset for null
 * @param int    $tabindex_for_value    tab index offset for value
 * @param string $table                 table
 * @param string $db                    database
 * @param int    $row_id                row id
 * @param array  $titles                titles
 * @param int    $biggest_max_file_size biggest max file size
 * @param string $text_dir              text direction
 * @param array  $repopulate            the data to be repopulated
 * @param array  $where_clause_array    the array of where clauses
 *
 * @return string
 */
function PMA_getHtmlForInsertEditRow($url_params, $table_columns, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, &$o_rows, &$tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $text_dir, $repopulate, $where_clause_array)
{
    $html_output = PMA_getHeadAndFootOfInsertRowTable($url_params) . '<tbody>';
    //store the default value for CharEditing
    $default_char_editing = $GLOBALS['cfg']['CharEditing'];
    $mime_map = PMA_getMIME($db, $table);
    $odd_row = true;
    $where_clause = '';
    if (isset($where_clause_array[$row_id])) {
        $where_clause = $where_clause_array[$row_id];
    }
    for ($column_number = 0; $column_number < $columns_cnt; $column_number++) {
        $table_column = $table_columns[$column_number];
        // skip this column if user does not have necessary column privilges
        if (!PMA_userHasColumnPrivileges($table_column, $insert_mode)) {
            continue;
        }
        $column_mime = array();
        if (isset($mime_map[$table_column['Field']])) {
            $column_mime = $mime_map[$table_column['Field']];
        }
        $html_output .= PMA_getHtmlForInsertEditFormColumn($table_columns, $column_number, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $odd_row, $o_rows, $tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $default_char_editing, $text_dir, $repopulate, $column_mime, $where_clause);
        $odd_row = !$odd_row;
    }
    // end for
    $o_rows++;
    $html_output .= '  </tbody>' . '</table><br />' . '<div class="clearfloat"></div>';
    return $html_output;
}
开发者ID:hewenhao2008,项目名称:phpmyadmin,代码行数:61,代码来源:insert_edit.lib.php

示例9: PMA_exportStructure

 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
 {
     global $cfgRelation;
     /* Heading */
     $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars(__('Table structure for table') . ' ' . $table) . '</text:h>';
     /**
      * Get the unique keys in the table
      */
     $keys_query = 'SHOW KEYS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
     $keys_result = PMA_DBI_query($keys_query);
     $unique_keys = array();
     while ($key = PMA_DBI_fetch_assoc($keys_result)) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     PMA_DBI_free_result($keys_result);
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
     $result = PMA_DBI_query($local_query);
     $fields_cnt = PMA_DBI_num_rows($result);
     // Check if we can use Relations (Mike Beck)
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = TRUE;
         } else {
             $have_rel = FALSE;
         }
     } else {
         $have_rel = FALSE;
     }
     // end if
     /**
      * Displays the table structure
      */
     $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
     /* Header */
     $GLOBALS['odt_buffer'] .= '<table:table-row>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('Column')) . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('Type')) . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('Null')) . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('Default')) . '</text:p>' . '</table:table-cell>';
     if ($do_relation && $have_rel) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('Links to')) . '</text:p>' . '</table:table-cell>';
     }
     if ($do_comments) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('Comments')) . '</text:p>' . '</table:table-cell>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(__('MIME type')) . '</text:p>' . '</table:table-cell>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $GLOBALS['odt_buffer'] .= '</table:table-row>';
     while ($row = PMA_DBI_fetch_assoc($result)) {
         $GLOBALS['odt_buffer'] .= '<table:table-row>';
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($row['Field']) . '</text:p>' . '</table:table-cell>';
         // reformat mysql query output
         // set or enum types: slashes single quotes inside options
         $field_name = $row['Field'];
         $type = $row['Type'];
         if (preg_match('/^(set|enum)\\((.+)\\)$/i', $type, $tmp)) {
             $tmp[2] = substr(preg_replace('/([^,])\'\'/', '\\1\\\'', ',' . $tmp[2]), 1);
             $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
             $type_nowrap = '';
             $binary = 0;
             $unsigned = 0;
             $zerofill = 0;
         } else {
             $type_nowrap = ' nowrap="nowrap"';
             $type = preg_replace('/BINARY/i', '', $type);
             $type = preg_replace('/ZEROFILL/i', '', $type);
             $type = preg_replace('/UNSIGNED/i', '', $type);
             if (empty($type)) {
                 $type = '&nbsp;';
             }
             $binary = preg_match('/BINARY/i', $row['Type']);
             $unsigned = preg_match('/UNSIGNED/i', $row['Type']);
             $zerofill = preg_match('/ZEROFILL/i', $row['Type']);
         }
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($type) . '</text:p>' . '</table:table-cell>';
         if (!isset($row['Default'])) {
             if ($row['Null'] != 'NO') {
//.........这里部分代码省略.........
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:101,代码来源:odt.php

示例10: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db            the database name
  * @param string $table         the table name
  * @param string $crlf          the end of line sequence
  * @param string $error_url     the url to go back in case of error
  * @param bool   $do_relation   whether to include relation comments
  * @param bool   $do_comments   whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  * @param bool   $do_mime       whether to include mime comments
  * @param bool   $show_dates    whether to include creation/update/check dates
  * @param bool   $add_semicolon whether to add semicolon and end-of-line at
  *                              the end
  * @param bool   $view          whether we're handling a view
  *
  * @return bool true
  */
 public function getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $show_dates = false, $add_semicolon = true, $view = false)
 {
     global $cfgRelation;
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // Check if we can use Relations
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = true;
         } else {
             $have_rel = false;
         }
     } else {
         $have_rel = false;
     }
     // end if
     /**
      * Displays the table structure
      */
     $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $GLOBALS['odt_buffer'] .= '<table:table-column' . ' table:number-columns-repeated="' . $columns_cnt . '"/>';
     /* Header */
     $GLOBALS['odt_buffer'] .= '<table:table-row>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Column') . '</text:p>' . '</table:table-cell>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Type') . '</text:p>' . '</table:table-cell>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Null') . '</text:p>' . '</table:table-cell>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Default') . '</text:p>' . '</table:table-cell>';
     if ($do_relation && $have_rel) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Links to') . '</text:p>' . '</table:table-cell>';
     }
     if ($do_comments) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Comments') . '</text:p>' . '</table:table-cell>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('MIME type') . '</text:p>' . '</table:table-cell>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $GLOBALS['odt_buffer'] .= '</table:table-row>';
     $columns = PMA_DBI_get_columns($db, $table);
     foreach ($columns as $column) {
         $field_name = $column['Field'];
         $GLOBALS['odt_buffer'] .= $this->formatOneColumnDefinition($column);
         if ($do_relation && $have_rel) {
             if (isset($res_rel[$field_name])) {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')') . '</text:p>' . '</table:table-cell>';
             }
         }
         if ($do_comments) {
             if (isset($comments[$field_name])) {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($comments[$field_name]) . '</text:p>' . '</table:table-cell>';
             } else {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p></text:p>' . '</table:table-cell>';
             }
         }
         if ($do_mime && $cfgRelation['mimework']) {
             if (isset($mime_map[$field_name])) {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) . '</text:p>' . '</table:table-cell>';
             } else {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p></text:p>' . '</table:table-cell>';
             }
         }
         $GLOBALS['odt_buffer'] .= '</table:table-row>';
     }
     // end foreach
     $GLOBALS['odt_buffer'] .= '</table:table>';
     return true;
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:100,代码来源:ExportOdt.class.php

示例11: displayStructure

 /**
  * Displays the table structure ('show table' works correct since 3.23.03)
  *
  * @param array           $cfgRelation               current relation parameters
  * @param array           $columns_with_unique_index Columns with unique index
  * @param mixed           $url_params                Contains an associative
  *                                                   array with url params
  * @param PMA_Index|false $primary_index             primary index or false if
  *                                                   no one exists
  * @param array           $fields                    Fields
  * @param array           $columns_with_index        Columns with index
  * @param array           $create_table_fields       Fields of the table.
  *
  * @return string
  */
 protected function displayStructure($cfgRelation, $columns_with_unique_index, $url_params, $primary_index, $fields, $columns_with_index, $create_table_fields)
 {
     /* TABLE INFORMATION */
     $HideStructureActions = '';
     if ($GLOBALS['cfg']['HideStructureActions'] === true) {
         $HideStructureActions .= ' HideStructureActions';
     }
     // prepare comments
     $comments_map = array();
     $mime_map = array();
     if ($GLOBALS['cfg']['ShowPropertyComments']) {
         include_once 'libraries/transformations.lib.php';
         $comments_map = PMA_getComments($this->db, $this->table);
         if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
             $mime_map = PMA_getMIME($this->db, $this->table, true);
         }
     }
     include_once 'libraries/central_columns.lib.php';
     $central_list = PMA_getCentralColumnsFromTable($this->db, $this->table);
     $columns_list = array();
     $titles = array('Change' => PMA_Util::getIcon('b_edit.png', __('Change')), 'Drop' => PMA_Util::getIcon('b_drop.png', __('Drop')), 'NoDrop' => PMA_Util::getIcon('b_drop.png', __('Drop')), 'Primary' => PMA_Util::getIcon('b_primary.png', __('Primary')), 'Index' => PMA_Util::getIcon('b_index.png', __('Index')), 'Unique' => PMA_Util::getIcon('b_unique.png', __('Unique')), 'Spatial' => PMA_Util::getIcon('b_spatial.png', __('Spatial')), 'IdxFulltext' => PMA_Util::getIcon('b_ftext.png', __('Fulltext')), 'NoPrimary' => PMA_Util::getIcon('bd_primary.png', __('Primary')), 'NoIndex' => PMA_Util::getIcon('bd_index.png', __('Index')), 'NoUnique' => PMA_Util::getIcon('bd_unique.png', __('Unique')), 'NoSpatial' => PMA_Util::getIcon('bd_spatial.png', __('Spatial')), 'NoIdxFulltext' => PMA_Util::getIcon('bd_ftext.png', __('Fulltext')), 'DistinctValues' => PMA_Util::getIcon('b_browse.png', __('Distinct values')));
     /**
      * Work on the table
      */
     if ($this->_tbl_is_view) {
         $item = $this->dbi->fetchSingleRow(sprintf("SELECT `VIEW_DEFINITION`, `CHECK_OPTION`, `DEFINER`,\n                      `SECURITY_TYPE`\n                    FROM `INFORMATION_SCHEMA`.`VIEWS`\n                    WHERE TABLE_SCHEMA='%s'\n                    AND TABLE_NAME='%s';", PMA_Util::sqlAddSlashes($this->db), PMA_Util::sqlAddSlashes($this->table)));
         $createView = $this->dbi->getTable($this->db, $this->table)->showCreate();
         // get algorithm from $createView of the form
         // CREATE ALGORITHM=<ALGORITHM> DE...
         $parts = explode(" ", substr($createView, 17));
         $item['ALGORITHM'] = $parts[0];
         $view = array('operation' => 'alter', 'definer' => $item['DEFINER'], 'sql_security' => $item['SECURITY_TYPE'], 'name' => $this->table, 'as' => $item['VIEW_DEFINITION'], 'with' => $item['CHECK_OPTION'], 'algorithm' => $item['ALGORITHM']);
         $edit_view_url = 'view_create.php' . PMA_URL_getCommon($url_params) . '&amp;' . implode('&amp;', array_map(function ($key, $val) {
             return 'view[' . urlencode($key) . ']=' . urlencode($val);
         }, array_keys($view), $view));
     }
     /**
      * Displays Space usage and row statistics
      */
     // BEGIN - Calc Table Space
     // Get valid statistics whatever is the table type
     if ($GLOBALS['cfg']['ShowStats']) {
         //get table stats in HTML format
         $tablestats = $this->getTableStats();
         //returning the response in JSON format to be used by Ajax
         $this->response->addJSON('tableStat', $tablestats);
     }
     // END - Calc Table Space
     return Template::get('table/structure/display_structure')->render(array('HideStructureActions' => $HideStructureActions, 'db' => $this->db, 'table' => $this->table, 'db_is_system_schema' => $this->_db_is_system_schema, 'tbl_is_view' => $this->_tbl_is_view, 'mime_map' => $mime_map, 'url_query' => $this->_url_query, 'titles' => $titles, 'tbl_storage_engine' => $this->_tbl_storage_engine, 'primary' => $primary_index, 'columns_with_unique_index' => $columns_with_unique_index, 'edit_view_url' => isset($edit_view_url) ? $edit_view_url : null, 'columns_list' => $columns_list, 'tablestats' => isset($tablestats) ? $tablestats : null, 'fields' => $fields, 'columns_with_index' => $columns_with_index, 'central_list' => $central_list, 'create_table_fields' => $create_table_fields));
 }
开发者ID:rushi963,项目名称:phpmyadmin,代码行数:65,代码来源:TableStructureController.class.php

示例12: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db          the database name
  * @param string $table       the table name
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  *                                at the end
  * @param bool   $view        whether we're handling a view
  * @param array  $aliases     Aliases of db/table/columns
  *
  * @return string resulting schema
  */
 public function getTableDef($db, $table, $do_relation, $do_comments, $do_mime, $view = false, $aliases = array())
 {
     // set $cfgRelation here, because there is a chance that it's modified
     // since the class initialization
     global $cfgRelation;
     $schema_insert = '';
     /**
      * Gets fields properties
      */
     $GLOBALS['dbi']->selectDb($db);
     // Check if we can use Relations
     list($res_rel, $have_rel) = PMA_getRelationsAndStatus($do_relation && !empty($cfgRelation['relation']), $db, $table);
     /**
      * Displays the table structure
      */
     $schema_insert .= '<table class="width100" cellspacing="1">';
     $schema_insert .= '<tr class="print-category">';
     $schema_insert .= '<th class="print">' . __('Column') . '</th>';
     $schema_insert .= '<td class="print"><strong>' . __('Type') . '</strong></td>';
     $schema_insert .= '<td class="print"><strong>' . __('Null') . '</strong></td>';
     $schema_insert .= '<td class="print"><strong>' . __('Default') . '</strong></td>';
     if ($do_relation && $have_rel) {
         $schema_insert .= '<td class="print"><strong>' . __('Links to') . '</strong></td>';
     }
     if ($do_comments) {
         $schema_insert .= '<td class="print"><strong>' . __('Comments') . '</strong></td>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $schema_insert .= '<td class="print"><strong>' . htmlspecialchars('MIME') . '</strong></td>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $schema_insert .= '</tr>';
     $columns = $GLOBALS['dbi']->getColumns($db, $table);
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = $GLOBALS['dbi']->getTableIndexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     foreach ($columns as $column) {
         $col_as = $column['Field'];
         if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
             $col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
         }
         $schema_insert .= $this->formatOneColumnDefinition($column, $unique_keys, $col_as);
         $field_name = $column['Field'];
         if ($do_relation && $have_rel) {
             $schema_insert .= '<td class="print">' . htmlspecialchars($this->getRelationString($res_rel, $field_name, $db, $aliases)) . '</td>';
         }
         if ($do_comments && $cfgRelation['commwork']) {
             $schema_insert .= '<td class="print">' . (isset($comments[$field_name]) ? htmlspecialchars($comments[$field_name]) : '') . '</td>';
         }
         if ($do_mime && $cfgRelation['mimework']) {
             $schema_insert .= '<td class="print">' . (isset($mime_map[$field_name]) ? htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) : '') . '</td>';
         }
         $schema_insert .= '</tr>';
     }
     // end foreach
     $schema_insert .= '</table>';
     return $schema_insert;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:85,代码来源:ExportHtmlword.class.php

示例13: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column comments
  *                            as comments in the structure; this is deprecated
  *                            but the parameter is left here because export.php
  *                            calls PMA_exportStructure() also for other export
  *                            types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  * @param string $export_mode 'create_table', 'triggers', 'create_view', 'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $export_mode, $export_type)
 {
     global $cfgRelation;
     /* We do not export triggers */
     if ($export_mode == 'triggers') {
         return true;
     }
     /* Heading */
     $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
     /**
      * Get the unique keys in the table
      */
     $unique_keys = array();
     $keys = PMA_DBI_get_table_indexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     /**
      * Gets fields properties
      */
     PMA_DBI_select_db($db);
     // Check if we can use Relations
     if ($do_relation && !empty($cfgRelation['relation'])) {
         // Find which tables are related with the current one and write it in
         // an array
         $res_rel = PMA_getForeigners($db, $table);
         if ($res_rel && count($res_rel) > 0) {
             $have_rel = true;
         } else {
             $have_rel = false;
         }
     } else {
         $have_rel = false;
     }
     // end if
     /**
      * Displays the table structure
      */
     $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_data">';
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $columns_cnt . '"/>';
     /* Header */
     $GLOBALS['odt_buffer'] .= '<table:table-row>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Column') . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Type') . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Null') . '</text:p>' . '</table:table-cell>';
     $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Default') . '</text:p>' . '</table:table-cell>';
     if ($do_relation && $have_rel) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Links to') . '</text:p>' . '</table:table-cell>';
     }
     if ($do_comments) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Comments') . '</text:p>' . '</table:table-cell>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('MIME type') . '</text:p>' . '</table:table-cell>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $GLOBALS['odt_buffer'] .= '</table:table-row>';
     $columns = PMA_DBI_get_columns($db, $table);
     foreach ($columns as $column) {
         $field_name = $column['Field'];
         $GLOBALS['odt_buffer'] .= '<table:table-row>';
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($field_name) . '</text:p>' . '</table:table-cell>';
         $extracted_fieldspec = PMA_extractFieldSpec($column['Type']);
         $type = htmlspecialchars($extracted_fieldspec['print_type']);
         if (empty($type)) {
//.........这里部分代码省略.........
开发者ID:ljhchshm,项目名称:weixin,代码行数:101,代码来源:odt.php

示例14: dataDictionaryDoc

 public function dataDictionaryDoc($alltables)
 {
     global $db, $pdf, $orientation, $paper;
     // TOC
     $pdf->addpage($GLOBALS['orientation']);
     $pdf->Cell(0, 9, __('Table of contents'), 1, 0, 'C');
     $pdf->Ln(15);
     $i = 1;
     foreach ($alltables as $table) {
         $pdf->PMA_links['doc'][$table]['-'] = $pdf->AddLink();
         $pdf->SetX(10);
         // $pdf->Ln(1);
         $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$table]['-']);
         $pdf->SetX(10);
         $pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
         // $pdf->Ln(1);
         $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
         while ($row = PMA_DBI_fetch_assoc($result)) {
             $pdf->SetX(20);
             $field_name = $row['Field'];
             $pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();
             // $pdf->Cell(0, 6, $field_name,0,1,'L',0, $pdf->PMA_links['doc'][$table][$field_name]);
         }
         $lasttable = $table;
         $i++;
     }
     $pdf->PMA_links['RT']['-'] = $pdf->AddLink();
     $pdf->SetX(10);
     $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['RT']['-']);
     $pdf->SetX(10);
     $pdf->Cell(0, 6, $i . ' ' . __('Relational schema'), 0, 1, 'L', 0, $pdf->PMA_links['RT']['-']);
     $z = 0;
     foreach ($alltables as $table) {
         $z++;
         $pdf->SetAutoPageBreak(true, 15);
         $pdf->addpage($GLOBALS['orientation']);
         $pdf->Bookmark($table);
         $pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo());
         $pdf->PMA_links['RT'][$table]['-'] = $pdf->AddLink();
         $pdf->SetLink($pdf->PMA_links['doc'][$table]['-'], -1);
         $pdf->SetFont($this->_ff, 'B', 18);
         $pdf->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $pdf->PMA_links['RT'][$table]['-']);
         $pdf->SetFont($this->_ff, '', 8);
         $pdf->ln();
         $cfgRelation = PMA_getRelationsParam();
         $comments = PMA_getComments($db, $table);
         if ($cfgRelation['mimework']) {
             $mime_map = PMA_getMIME($db, $table, true);
         }
         /**
          * Gets table informations
          */
         $showtable = PMA_Table::sGetStatusInfo($db, $table);
         $num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
         $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
         $create_time = isset($showtable['Create_time']) ? PMA_localisedDate(strtotime($showtable['Create_time'])) : '';
         $update_time = isset($showtable['Update_time']) ? PMA_localisedDate(strtotime($showtable['Update_time'])) : '';
         $check_time = isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '';
         /**
          * Gets table keys and retains them
          */
         $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
         $primary = '';
         $indexes = array();
         $lastIndex = '';
         $indexes_info = array();
         $indexes_data = array();
         $pk_array = array();
         // will be use to emphasis prim. keys in the table
         // view
         while ($row = PMA_DBI_fetch_assoc($result)) {
             // Backups the list of primary keys
             if ($row['Key_name'] == 'PRIMARY') {
                 $primary .= $row['Column_name'] . ', ';
                 $pk_array[$row['Column_name']] = 1;
             }
             // Retains keys informations
             if ($row['Key_name'] != $lastIndex) {
                 $indexes[] = $row['Key_name'];
                 $lastIndex = $row['Key_name'];
             }
             $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
             $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
             if (isset($row['Cardinality'])) {
                 $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
             }
             // I don't know what does following column mean....
             // $indexes_info[$row['Key_name']]['Packed']          = $row['Packed'];
             $indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
             $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
             if (isset($row['Sub_part'])) {
                 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
             }
         }
         // end while
         if ($result) {
             PMA_DBI_free_result($result);
         }
         /**
          * Gets fields properties
//.........这里部分代码省略.........
开发者ID:bugyak,项目名称:phporadmin,代码行数:101,代码来源:Pdf_Relation_Schema.class.php

示例15: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db            the database name
  * @param string $table         the table name
  * @param string $crlf          the end of line sequence
  * @param string $error_url     the url to go back in case of error
  * @param bool   $do_relation   whether to include relation comments
  * @param bool   $do_comments   whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  * @param bool   $do_mime       whether to include mime comments
  * @param bool   $show_dates    whether to include creation/update/check dates
  * @param bool   $add_semicolon whether to add semicolon and end-of-line at
  *                              the end
  * @param bool   $view          whether we're handling a view
  * @param array  $aliases       Aliases of db/table/columns
  *
  * @return bool true
  */
 public function getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $show_dates = false, $add_semicolon = true, $view = false, $aliases = array())
 {
     global $cfgRelation;
     $db_alias = $db;
     $table_alias = $table;
     $this->initAlias($aliases, $db_alias, $table_alias);
     /**
      * Gets fields properties
      */
     $GLOBALS['dbi']->selectDb($db);
     // Check if we can use Relations
     list($res_rel, $have_rel) = PMA_getRelationsAndStatus($do_relation && !empty($cfgRelation['relation']), $db, $table);
     /**
      * Displays the table structure
      */
     $GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table_alias) . '_structure">';
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $GLOBALS['odt_buffer'] .= '<table:table-column' . ' table:number-columns-repeated="' . $columns_cnt . '"/>';
     /* Header */
     $GLOBALS['odt_buffer'] .= '<table:table-row>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Column') . '</text:p>' . '</table:table-cell>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Type') . '</text:p>' . '</table:table-cell>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Null') . '</text:p>' . '</table:table-cell>' . '<table:table-cell office:value-type="string">' . '<text:p>' . __('Default') . '</text:p>' . '</table:table-cell>';
     if ($do_relation && $have_rel) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Links to') . '</text:p>' . '</table:table-cell>';
     }
     if ($do_comments) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('Comments') . '</text:p>' . '</table:table-cell>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . __('MIME type') . '</text:p>' . '</table:table-cell>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $GLOBALS['odt_buffer'] .= '</table:table-row>';
     $columns = $GLOBALS['dbi']->getColumns($db, $table);
     foreach ($columns as $column) {
         $col_as = $field_name = $column['Field'];
         if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
             $col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
         }
         $GLOBALS['odt_buffer'] .= $this->formatOneColumnDefinition($column, $col_as);
         if ($do_relation && $have_rel) {
             $foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
             if ($foreigner) {
                 $rtable = $foreigner['foreign_table'];
                 $rfield = $foreigner['foreign_field'];
                 if (!empty($aliases[$db]['tables'][$rtable]['columns'][$rfield])) {
                     $rfield = $aliases[$db]['tables'][$rtable]['columns'][$rfield];
                 }
                 if (!empty($aliases[$db]['tables'][$rtable]['alias'])) {
                     $rtable = $aliases[$db]['tables'][$rtable]['alias'];
                 }
                 $relation = htmlspecialchars($rtable . ' (' . $rfield . ')');
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($relation) . '</text:p>' . '</table:table-cell>';
             }
         }
         if ($do_comments) {
             if (isset($comments[$field_name])) {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($comments[$field_name]) . '</text:p>' . '</table:table-cell>';
             } else {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p></text:p>' . '</table:table-cell>';
             }
         }
         if ($do_mime && $cfgRelation['mimework']) {
             if (isset($mime_map[$field_name])) {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars(str_replace('_', '/', $mime_map[$field_name]['mimetype'])) . '</text:p>' . '</table:table-cell>';
             } else {
                 $GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">' . '<text:p></text:p>' . '</table:table-cell>';
             }
         }
         $GLOBALS['odt_buffer'] .= '</table:table-row>';
//.........这里部分代码省略.........
开发者ID:hewenhao2008,项目名称:phpmyadmin,代码行数:101,代码来源:ExportOdt.class.php


注:本文中的PMA_getMIME函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。