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


PHP Util::extractColumnSpec方法代码示例

本文整理汇总了PHP中PMA\libraries\Util::extractColumnSpec方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::extractColumnSpec方法的具体用法?PHP Util::extractColumnSpec怎么用?PHP Util::extractColumnSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA\libraries\Util的用法示例。


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

示例1: PMA_getHtmlForColumnsList

/**
 * build the html for columns of $colTypeCategory category
 * in form of given $listType in a table
 *
 * @param string $db              current database
 * @param string $table           current table
 * @param string $colTypeCategory supported all|Numeric|String|Spatial
 *                                |Date and time using the _pgettext() format
 * @param string $listType        type of list to build, supported dropdown|checkbox
 *
 * @return string HTML for list of columns in form of given list types
 */
function PMA_getHtmlForColumnsList($db, $table, $colTypeCategory = 'all', $listType = 'dropdown')
{
    $columnTypeList = array();
    if ($colTypeCategory != 'all') {
        $types = $GLOBALS['PMA_Types']->getColumns();
        $columnTypeList = $types[$colTypeCategory];
    }
    $GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
    $columns = $GLOBALS['dbi']->getColumns($db, $table, null, true, $GLOBALS['userlink']);
    $type = "";
    $selectColHtml = "";
    foreach ($columns as $column => $def) {
        if (isset($def['Type'])) {
            $extracted_columnspec = Util::extractColumnSpec($def['Type']);
            $type = $extracted_columnspec['type'];
        }
        if (empty($columnTypeList) || in_array(mb_strtoupper($type), $columnTypeList)) {
            if ($listType == 'checkbox') {
                $selectColHtml .= '<input type="checkbox" value="' . htmlspecialchars($column) . '"/>' . htmlspecialchars($column) . ' [ ' . htmlspecialchars($def['Type']) . ' ]</br>';
            } else {
                $selectColHtml .= '<option value="' . htmlspecialchars($column) . '' . '">' . htmlspecialchars($column) . ' [ ' . htmlspecialchars($def['Type']) . ' ]' . '</option>';
            }
        }
    }
    return $selectColHtml;
}
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:38,代码来源:normalization.lib.php

示例2: PMA_getInsertQuery

/**
 * build the insert query for central columns list given PMA storage
 * db, central_columns table, column name and corresponding definition to be added
 *
 * @param string $column             column to add into central list
 * @param array  $def                list of attributes of the column being added
 * @param string $db                 PMA configuration storage database name
 * @param string $central_list_table central columns configuration storage table name
 *
 * @return string query string to insert the given column
 * with definition into central list
 */
function PMA_getInsertQuery($column, $def, $db, $central_list_table)
{
    $type = "";
    $length = 0;
    $attribute = "";
    if (isset($def['Type'])) {
        $extracted_columnspec = Util::extractColumnSpec($def['Type']);
        $attribute = trim($extracted_columnspec['attribute']);
        $type = $extracted_columnspec['type'];
        $length = $extracted_columnspec['spec_in_brackets'];
    }
    if (isset($def['Attribute'])) {
        $attribute = $def['Attribute'];
    }
    $collation = isset($def['Collation']) ? $def['Collation'] : "";
    $isNull = $def['Null'] == "NO" ? 0 : 1;
    $extra = isset($def['Extra']) ? $def['Extra'] : "";
    $default = isset($def['Default']) ? $def['Default'] : "";
    $insQuery = 'INSERT INTO ' . Util::backquote($central_list_table) . ' ' . 'VALUES ( \'' . Util::sqlAddSlashes($db) . '\' ,' . '\'' . Util::sqlAddSlashes($column) . '\',\'' . Util::sqlAddSlashes($type) . '\',' . '\'' . Util::sqlAddSlashes($length) . '\',\'' . Util::sqlAddSlashes($collation) . '\',' . '\'' . Util::sqlAddSlashes($isNull) . '\',' . '\'' . implode(',', array($extra, $attribute)) . '\',\'' . Util::sqlAddSlashes($default) . '\');';
    return $insQuery;
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:33,代码来源:central_columns.lib.php

示例3: moveColumns

 /**
  * Moves columns in the table's structure based on $_REQUEST
  *
  * @return void
  */
 protected function moveColumns()
 {
     $this->dbi->selectDb($this->db);
     /*
      * load the definitions for all columns
      */
     $columns = $this->dbi->getColumnsFull($this->db, $this->table);
     $column_names = array_keys($columns);
     $changes = array();
     // move columns from first to last
     for ($i = 0, $l = count($_REQUEST['move_columns']); $i < $l; $i++) {
         $column = $_REQUEST['move_columns'][$i];
         // is this column already correctly placed?
         if ($column_names[$i] == $column) {
             continue;
         }
         // it is not, let's move it to index $i
         $data = $columns[$column];
         $extracted_columnspec = Util::extractColumnSpec($data['Type']);
         if (isset($data['Extra']) && $data['Extra'] == 'on update CURRENT_TIMESTAMP') {
             $extracted_columnspec['attribute'] = $data['Extra'];
             unset($data['Extra']);
         }
         $current_timestamp = ($data['Type'] == 'timestamp' || $data['Type'] == 'datetime') && $data['Default'] == 'CURRENT_TIMESTAMP';
         if ($data['Null'] === 'YES' && $data['Default'] === null) {
             $default_type = 'NULL';
         } elseif ($current_timestamp) {
             $default_type = 'CURRENT_TIMESTAMP';
         } elseif ($data['Default'] === null) {
             $default_type = 'NONE';
         } else {
             $default_type = 'USER_DEFINED';
         }
         $virtual = array('VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED');
         $data['Virtuality'] = '';
         $data['Expression'] = '';
         if (isset($data['Extra']) && in_array($data['Extra'], $virtual)) {
             $data['Virtuality'] = str_replace(' GENERATED', '', $data['Extra']);
             $expressions = $this->table->getColumnGenerationExpression($column);
             $data['Expression'] = $expressions[$column];
         }
         $changes[] = 'CHANGE ' . Table::generateAlter($column, $column, mb_strtoupper($extracted_columnspec['type']), $extracted_columnspec['spec_in_brackets'], $extracted_columnspec['attribute'], isset($data['Collation']) ? $data['Collation'] : '', $data['Null'] === 'YES' ? 'NULL' : 'NOT NULL', $default_type, $current_timestamp ? '' : $data['Default'], isset($data['Extra']) && $data['Extra'] !== '' ? $data['Extra'] : false, isset($data['COLUMN_COMMENT']) && $data['COLUMN_COMMENT'] !== '' ? $data['COLUMN_COMMENT'] : false, $data['Virtuality'], $data['Expression'], $i === 0 ? '-first' : $column_names[$i - 1]);
         // update current column_names array, first delete old position
         for ($j = 0, $ll = count($column_names); $j < $ll; $j++) {
             if ($column_names[$j] == $column) {
                 unset($column_names[$j]);
             }
         }
         // insert moved column
         array_splice($column_names, $i, 0, $column);
     }
     if (empty($changes)) {
         // should never happen
         $this->response->setRequestStatus(false);
         return;
     }
     // move columns
     $this->dbi->tryQuery(sprintf('ALTER TABLE %s %s', Util::backquote($this->table), implode(', ', $changes)));
     $tmp_error = $this->dbi->getError();
     if ($tmp_error) {
         $this->response->setRequestStatus(false);
         $this->response->addJSON('message', Message::error($tmp_error));
     } else {
         $message = Message::success(__('The columns have been moved successfully.'));
         $this->response->addJSON('message', $message);
         $this->response->addJSON('columns', $column_names);
     }
 }
开发者ID:Gemorroj,项目名称:phpmyadmin,代码行数:73,代码来源:TableStructureController.php

示例4: _getTableDefForView

 /**
  * Returns CREATE definition that matches $view's structure
  *
  * @param string $db            the database name
  * @param string $view          the view name
  * @param string $crlf          the end of line sequence
  * @param bool   $add_semicolon whether to add semicolon and end-of-line at
  *                              the end
  * @param array  $aliases       Aliases of db/table/columns
  *
  * @return string resulting schema
  */
 private function _getTableDefForView($db, $view, $crlf, $add_semicolon = true, $aliases = array())
 {
     $db_alias = $db;
     $view_alias = $view;
     $this->initAlias($aliases, $db_alias, $view_alias);
     $create_query = "CREATE TABLE";
     if (isset($GLOBALS['sql_if_not_exists'])) {
         $create_query .= " IF NOT EXISTS ";
     }
     $create_query .= Util::backquote($view_alias) . "(" . $crlf;
     $columns = $GLOBALS['dbi']->getColumns($db, $view, null, true);
     $firstCol = true;
     foreach ($columns as $column) {
         $col_alias = $column['Field'];
         if (!empty($aliases[$db]['tables'][$view]['columns'][$col_alias])) {
             $col_alias = $aliases[$db]['tables'][$view]['columns'][$col_alias];
         }
         $extracted_columnspec = Util::extractColumnSpec($column['Type']);
         if (!$firstCol) {
             $create_query .= "," . $crlf;
         }
         $create_query .= "    " . Util::backquote($col_alias);
         $create_query .= " " . $column['Type'];
         if ($extracted_columnspec['can_contain_collation'] && !empty($column['Collation'])) {
             $create_query .= " COLLATE " . $column['Collation'];
         }
         if ($column['Null'] == 'NO') {
             $create_query .= " NOT NULL";
         }
         if (isset($column['Default'])) {
             $create_query .= " DEFAULT '" . Util::sqlAddSlashes($column['Default']) . "'";
         } else {
             if ($column['Null'] == 'YES') {
                 $create_query .= " DEFAULT NULL";
             }
         }
         if (!empty($column['Comment'])) {
             $create_query .= " COMMENT '" . Util::sqlAddSlashes($column['Comment']) . "'";
         }
         $firstCol = false;
     }
     $create_query .= $crlf . ")" . ($add_semicolon ? ';' : '') . $crlf;
     if (isset($GLOBALS['sql_compatibility'])) {
         $compat = $GLOBALS['sql_compatibility'];
     } else {
         $compat = 'NONE';
     }
     if ($compat == 'MSSQL') {
         $create_query = $this->_makeCreateTableMSSQLCompatible($create_query);
     }
     return $create_query;
 }
开发者ID:ryanfmurphy,项目名称:phpmyadmin,代码行数:64,代码来源:ExportSql.php

示例5: 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 string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @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
  *                            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 array  $aliases     Aliases of db/table/columns
  *
  * @return bool Whether it succeeded
  */
 public function exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $aliases = array())
 {
     $db_alias = $db;
     $table_alias = $table;
     $this->initAlias($aliases, $db_alias, $table_alias);
     global $cfgRelation;
     /* We do not export triggers */
     if ($export_mode == 'triggers') {
         return true;
     }
     /**
      * 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
      */
     $buffer = $crlf . '%' . $crlf . '% ' . __('Structure:') . ' ' . $table_alias . $crlf . '%' . $crlf . ' \\begin{longtable}{';
     if (!PMA_exportOutputHandler($buffer)) {
         return false;
     }
     $alignment = '|l|c|c|c|';
     if ($do_relation && $have_rel) {
         $alignment .= 'l|';
     }
     if ($do_comments) {
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $alignment .= 'l|';
     }
     $buffer = $alignment . '} ' . $crlf;
     $header = ' \\hline ';
     $header .= '\\multicolumn{1}{|c|}{\\textbf{' . __('Column') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Type') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Null') . '}} & \\multicolumn{1}{|c|}{\\textbf{' . __('Default') . '}}';
     if ($do_relation && $have_rel) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Links to') . '}}';
     }
     if ($do_comments) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     // Table caption for first page and label
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . Util::expandUserString($GLOBALS['latex_structure_caption'], array('texEscape', get_class($this)), array('table' => $table_alias, 'database' => $db_alias)) . '} \\label{' . Util::expandUserString($GLOBALS['latex_structure_label'], null, array('table' => $table_alias, 'database' => $db_alias)) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . Util::expandUserString($GLOBALS['latex_structure_continued_caption'], array('texEscape', get_class($this)), array('table' => $table_alias, 'database' => $db_alias)) . '} \\\\ ' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
     if (!PMA_exportOutputHandler($buffer)) {
         return false;
     }
     $fields = $GLOBALS['dbi']->getColumns($db, $table);
     foreach ($fields as $row) {
         $extracted_columnspec = Util::extractColumnSpec($row['Type']);
         $type = $extracted_columnspec['print_type'];
         if (empty($type)) {
             $type = ' ';
         }
//.........这里部分代码省略.........
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:101,代码来源:ExportLatex.php

示例6: formatOneColumnDefinition

 /**
  * Formats the definition for one column
  *
  * @param array  $column      info about this column
  * @param array  $unique_keys unique keys of the table
  * @param string $col_alias   Column Alias
  *
  * @return string Formatted column definition
  */
 protected function formatOneColumnDefinition($column, $unique_keys, $col_alias = '')
 {
     if (empty($col_alias)) {
         $col_alias = $column['Field'];
     }
     $definition = '<tr class="print-category">';
     $extracted_columnspec = Util::extractColumnSpec($column['Type']);
     $type = htmlspecialchars($extracted_columnspec['print_type']);
     if (empty($type)) {
         $type = '&nbsp;';
     }
     if (!isset($column['Default'])) {
         if ($column['Null'] != 'NO') {
             $column['Default'] = 'NULL';
         }
     }
     $fmt_pre = '';
     $fmt_post = '';
     if (in_array($column['Field'], $unique_keys)) {
         $fmt_pre = '<strong>' . $fmt_pre;
         $fmt_post = $fmt_post . '</strong>';
     }
     if ($column['Key'] == 'PRI') {
         $fmt_pre = '<em>' . $fmt_pre;
         $fmt_post = $fmt_post . '</em>';
     }
     $definition .= '<td class="print">' . $fmt_pre . htmlspecialchars($col_alias) . $fmt_post . '</td>';
     $definition .= '<td class="print">' . htmlspecialchars($type) . '</td>';
     $definition .= '<td class="print">' . ($column['Null'] == '' || $column['Null'] == 'NO' ? __('No') : __('Yes')) . '</td>';
     $definition .= '<td class="print">' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '') . '</td>';
     return $definition;
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:41,代码来源:ExportHtmlword.php

示例7: formatOneColumnDefinition

 /**
  * Formats the definition for one column
  *
  * @param array  $column      info about this column
  * @param array  $unique_keys unique keys for this table
  * @param string $col_alias   Column Alias
  *
  * @return string Formatted column definition
  */
 public function formatOneColumnDefinition($column, $unique_keys, $col_alias = '')
 {
     if (empty($col_alias)) {
         $col_alias = $column['Field'];
     }
     $extracted_columnspec = Util::extractColumnSpec($column['Type']);
     $type = $extracted_columnspec['print_type'];
     if (empty($type)) {
         $type = '&nbsp;';
     }
     if (!isset($column['Default'])) {
         if ($column['Null'] != 'NO') {
             $column['Default'] = 'NULL';
         }
     }
     $fmt_pre = '';
     $fmt_post = '';
     if (in_array($column['Field'], $unique_keys)) {
         $fmt_pre = '**' . $fmt_pre;
         $fmt_post = $fmt_post . '**';
     }
     if ($column['Key'] == 'PRI') {
         $fmt_pre = '//' . $fmt_pre;
         $fmt_post = $fmt_post . '//';
     }
     $definition = '|' . $fmt_pre . htmlspecialchars($col_alias) . $fmt_post;
     $definition .= '|' . htmlspecialchars($type);
     $definition .= '|' . ($column['Null'] == '' || $column['Null'] == 'NO' ? __('No') : __('Yes'));
     $definition .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
     return $definition;
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:40,代码来源:ExportTexytext.php

示例8: getTableDef


//.........这里部分代码省略.........
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $columns = $GLOBALS['dbi']->getColumns($db, $table);
     /**
      * Get the unique keys in the table.
      * Presently, this information is not used. We will have to find out
      * way of displaying it.
      */
     $unique_keys = array();
     $keys = $GLOBALS['dbi']->getTableIndexes($db, $table);
     foreach ($keys as $key) {
         if ($key['Non_unique'] == 0) {
             $unique_keys[] = $key['Column_name'];
         }
     }
     // some things to set and 'remember'
     $l = $this->lMargin;
     $startheight = $h = $this->dataY;
     $startpage = $currpage = $this->page;
     // calculate the whole width
     $fullwidth = 0;
     foreach ($this->tablewidths as $width) {
         $fullwidth += $width;
     }
     $row = 0;
     $tmpheight = array();
     $maxpage = $this->page;
     $data = array();
     // fun begin
     foreach ($columns as $column) {
         $extracted_columnspec = Util::extractColumnSpec($column['Type']);
         $type = $extracted_columnspec['print_type'];
         if (empty($type)) {
             $type = ' ';
         }
         if (!isset($column['Default'])) {
             if ($column['Null'] != 'NO') {
                 $column['Default'] = 'NULL';
             }
         }
         $data[] = $column['Field'];
         $data[] = $type;
         $data[] = $column['Null'] == '' || $column['Null'] == 'NO' ? 'No' : 'Yes';
         $data[] = isset($column['Default']) ? $column['Default'] : '';
         $field_name = $column['Field'];
         if ($do_relation && $have_rel) {
             $data[] = isset($res_rel[$field_name]) ? $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')' : '';
         }
         if ($do_comments) {
             $data[] = isset($comments[$field_name]) ? $comments[$field_name] : '';
         }
         if ($do_mime) {
             $data[] = isset($mime_map[$field_name]) ? $mime_map[$field_name]['mimetype'] : '';
         }
         $this->page = $currpage;
         // write the horizontal borders
         $this->Line($l, $h, $fullwidth + $l, $h);
         // write the content and remember the height of the highest col
         foreach ($data as $col => $txt) {
             $this->page = $currpage;
             $this->SetXY($l, $h);
             if ($this->tablewidths[$col] > 0) {
                 $this->MultiCell($this->tablewidths[$col], $this->FontSizePt, $txt, 0, $this->colAlign[$col]);
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:67,代码来源:PMA_ExportPdf.php

示例9: dataDictionaryDoc


//.........这里部分代码省略.........
          * Displays the comments of the table if MySQL >= 3.23
          */
         $break = false;
         if (!empty($show_comment)) {
             $this->diagram->Cell(0, 3, __('Table comments:') . ' ' . $show_comment, 0, 1);
             $break = true;
         }
         if (!empty($create_time)) {
             $this->diagram->Cell(0, 3, __('Creation:') . ' ' . $create_time, 0, 1);
             $break = true;
         }
         if (!empty($update_time)) {
             $this->diagram->Cell(0, 3, __('Last update:') . ' ' . $update_time, 0, 1);
             $break = true;
         }
         if (!empty($check_time)) {
             $this->diagram->Cell(0, 3, __('Last check:') . ' ' . $check_time, 0, 1);
             $break = true;
         }
         if ($break == true) {
             $this->diagram->Cell(0, 3, '', 0, 1);
             $this->diagram->Ln();
         }
         $this->diagram->SetFont($this->_ff, 'B');
         if (isset($this->orientation) && $this->orientation == 'L') {
             $this->diagram->Cell(25, 8, __('Column'), 1, 0, 'C');
             $this->diagram->Cell(20, 8, __('Type'), 1, 0, 'C');
             $this->diagram->Cell(20, 8, __('Attributes'), 1, 0, 'C');
             $this->diagram->Cell(10, 8, __('Null'), 1, 0, 'C');
             $this->diagram->Cell(20, 8, __('Default'), 1, 0, 'C');
             $this->diagram->Cell(25, 8, __('Extra'), 1, 0, 'C');
             $this->diagram->Cell(45, 8, __('Links to'), 1, 0, 'C');
             if ($this->paper == 'A4') {
                 $comments_width = 67;
             } else {
                 // this is really intended for 'letter'
                 /**
                  * @todo find optimal width for all formats
                  */
                 $comments_width = 50;
             }
             $this->diagram->Cell($comments_width, 8, __('Comments'), 1, 0, 'C');
             $this->diagram->Cell(45, 8, 'MIME', 1, 1, 'C');
             $this->diagram->SetWidths(array(25, 20, 20, 10, 20, 25, 45, $comments_width, 45));
         } else {
             $this->diagram->Cell(20, 8, __('Column'), 1, 0, 'C');
             $this->diagram->Cell(20, 8, __('Type'), 1, 0, 'C');
             $this->diagram->Cell(20, 8, __('Attributes'), 1, 0, 'C');
             $this->diagram->Cell(10, 8, __('Null'), 1, 0, 'C');
             $this->diagram->Cell(15, 8, __('Default'), 1, 0, 'C');
             $this->diagram->Cell(15, 8, __('Extra'), 1, 0, 'C');
             $this->diagram->Cell(30, 8, __('Links to'), 1, 0, 'C');
             $this->diagram->Cell(30, 8, __('Comments'), 1, 0, 'C');
             $this->diagram->Cell(30, 8, 'MIME', 1, 1, 'C');
             $this->diagram->SetWidths(array(20, 20, 20, 10, 15, 15, 30, 30, 30));
         }
         $this->diagram->SetFont($this->_ff, '');
         foreach ($columns as $row) {
             $extracted_columnspec = Util::extractColumnSpec($row['Type']);
             $type = $extracted_columnspec['print_type'];
             $attribute = $extracted_columnspec['attribute'];
             if (!isset($row['Default'])) {
                 if ($row['Null'] != '' && $row['Null'] != 'NO') {
                     $row['Default'] = 'NULL';
                 }
             }
             $field_name = $row['Field'];
             // $this->diagram->Ln();
             $this->diagram->PMA_links['RT'][$table][$field_name] = $this->diagram->AddLink();
             $this->diagram->Bookmark($field_name, 1, -1);
             $this->diagram->SetLink($this->diagram->PMA_links['doc'][$table][$field_name], -1);
             $foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
             $linksTo = '';
             if ($foreigner) {
                 $linksTo = '-> ';
                 if ($foreigner['foreign_db'] != $this->db) {
                     $linksTo .= $foreigner['foreign_db'] . '.';
                 }
                 $linksTo .= $foreigner['foreign_table'] . '.' . $foreigner['foreign_field'];
                 if (isset($foreigner['on_update'])) {
                     // not set for internal
                     $linksTo .= "\n" . 'ON UPDATE ' . $foreigner['on_update'];
                     $linksTo .= "\n" . 'ON DELETE ' . $foreigner['on_delete'];
                 }
             }
             $this->diagram_row = array($field_name, $type, $attribute, $row['Null'] == '' || $row['Null'] == 'NO' ? __('No') : __('Yes'), isset($row['Default']) ? $row['Default'] : '', $row['Extra'], $linksTo, isset($comments[$field_name]) ? $comments[$field_name] : '', isset($mime_map) && isset($mime_map[$field_name]) ? str_replace('_', '/', $mime_map[$field_name]['mimetype']) : '');
             $links = array();
             $links[0] = $this->diagram->PMA_links['RT'][$table][$field_name];
             if ($foreigner && isset($this->diagram->PMA_links['doc'][$foreigner['foreign_table']][$foreigner['foreign_field']])) {
                 $links[6] = $this->diagram->PMA_links['doc'][$foreigner['foreign_table']][$foreigner['foreign_field']];
             } else {
                 unset($links[6]);
             }
             $this->diagram->Row($this->diagram_row, $links);
         }
         // end foreach
         $this->diagram->SetFont($this->_ff, '', 14);
     }
     //end each
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:101,代码来源:PdfRelationSchema.php

示例10: formatOneColumnDefinition

 /**
  * Formats the definition for one column
  *
  * @param array  $column info about this column
  * @param string $col_as column alias
  *
  * @return string Formatted column definition
  */
 protected function formatOneColumnDefinition($column, $col_as = '')
 {
     if (empty($col_as)) {
         $col_as = $column['Field'];
     }
     $definition = '<table:table-row>';
     $definition .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($col_as) . '</text:p>' . '</table:table-cell>';
     $extracted_columnspec = Util::extractColumnSpec($column['Type']);
     $type = htmlspecialchars($extracted_columnspec['print_type']);
     if (empty($type)) {
         $type = '&nbsp;';
     }
     $definition .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($type) . '</text:p>' . '</table:table-cell>';
     if (!isset($column['Default'])) {
         if ($column['Null'] != 'NO') {
             $column['Default'] = 'NULL';
         } else {
             $column['Default'] = '';
         }
     }
     $definition .= '<table:table-cell office:value-type="string">' . '<text:p>' . ($column['Null'] == '' || $column['Null'] == 'NO' ? __('No') : __('Yes')) . '</text:p>' . '</table:table-cell>';
     $definition .= '<table:table-cell office:value-type="string">' . '<text:p>' . htmlspecialchars($column['Default']) . '</text:p>' . '</table:table-cell>';
     return $definition;
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:32,代码来源:ExportOdt.php


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