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


PHP PMA_exportOutputHandler函数代码示例

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


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

示例1: PMA_exportFooter

 /**
  * Outputs export footer
  *
  * @return  bool        Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportFooter()
 {
     global $workbook;
     global $tmp_filename;
     $tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xlsx_');
     $workbookWriter = new PHPExcel_Writer_Excel2007($workbook);
     $workbookWriter->save($tmp_filename);
     if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
         return FALSE;
     }
     unlink($tmp_filename);
     unset($GLOBALS['workbook']);
     unset($GLOBALS['sheet_index']);
     return TRUE;
 }
开发者ID:hackdracko,项目名称:envasadoras,代码行数:22,代码来源:xlsx.php

示例2: PMA_exportFooter

 /**
  * Outputs export footer
  *
  * @return  bool        Whether it succeeded
  *
  * @access  public
  */
 function PMA_exportFooter()
 {
     $GLOBALS['ods_buffer'] .= '</office:spreadsheet>' . '</office:body>' . '</office:document-content>';
     if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.spreadsheet', $GLOBALS['ods_buffer']))) {
         return false;
     }
     return true;
 }
开发者ID:AmberWish,项目名称:laba_web,代码行数:15,代码来源:ods.php

示例3: PMA_exportFooter

 /**
  * Outputs export footer
  *
  * @return  bool        Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportFooter()
 {
     $GLOBALS['odt_buffer'] .= '</office:text>' . '</office:body>' . '</office:document-content>';
     if (!PMA_exportOutputHandler(PMA_createOpenDocument('application/vnd.oasis.opendocument.text', $GLOBALS['odt_buffer']))) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:15,代码来源:odt.php

示例4: PMA_exportFooter

 /**
  * Outputs export footer
  *
  * @return  bool        Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportFooter()
 {
     global $workbook;
     global $tmp_filename;
     $res = $workbook->close();
     if (PEAR::isError($res)) {
         echo $res->getMessage();
         return FALSE;
     }
     if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
         return FALSE;
     }
     unlink($tmp_filename);
     return TRUE;
 }
开发者ID:BGCX261,项目名称:zhss-svn-to-git,代码行数:22,代码来源:xls.php

示例5: exportFooter

 /**
  * Outputs export footer
  *
  * @return bool Whether it succeeded
  */
 public function exportFooter()
 {
     $pdf = $this->_getPdf();
     // instead of $pdf->Output():
     if (!PMA_exportOutputHandler($pdf->getPDFData())) {
         return false;
     }
     return true;
 }
开发者ID:yxwzaxns,项目名称:sakura,代码行数:14,代码来源:ExportPdf.class.php

示例6: exportData

 /**
  * Outputs the content of a table in XML format
  *
  * @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 $sql_query SQL query for obtaining data
  *
  * @return bool Whether it succeeded
  */
 public function exportData($db, $table, $crlf, $error_url, $sql_query)
 {
     if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
         $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
         $columns_cnt = PMA_DBI_num_fields($result);
         $columns = array();
         for ($i = 0; $i < $columns_cnt; $i++) {
             $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
         }
         unset($i);
         $buffer = '        <!-- ' . __('Table') . ' ' . $table . ' -->' . $crlf;
         if (!PMA_exportOutputHandler($buffer)) {
             return false;
         }
         while ($record = PMA_DBI_fetch_row($result)) {
             $buffer = '        <table name="' . htmlspecialchars($table) . '">' . $crlf;
             for ($i = 0; $i < $columns_cnt; $i++) {
                 // If a cell is NULL, still export it to preserve
                 // the XML structure
                 if (!isset($record[$i]) || is_null($record[$i])) {
                     $record[$i] = 'NULL';
                 }
                 $buffer .= '            <column name="' . htmlspecialchars($columns[$i]) . '">' . htmlspecialchars((string) $record[$i]) . '</column>' . $crlf;
             }
             $buffer .= '        </table>' . $crlf;
             if (!PMA_exportOutputHandler($buffer)) {
                 return false;
             }
         }
         PMA_DBI_free_result($result);
     }
     return true;
 }
开发者ID:yxwzaxns,项目名称:sakura,代码行数:44,代码来源:ExportXml.class.php

示例7: PMA_exportStructure

 function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false, $dummy)
 {
     global $cfgRelation;
     if (!PMA_exportOutputHandler('<h2>' . $GLOBALS['strTableStructure'] . ' ' . $table . '</h2>')) {
         return FALSE;
     }
     /**
      * 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
      */
     if (!PMA_exportOutputHandler('<table class="width100" cellspacing="1">')) {
         return FALSE;
     }
     $columns_cnt = 4;
     if ($do_relation && $have_rel) {
         $columns_cnt++;
     }
     if ($do_comments && $cfgRelation['commwork']) {
         $columns_cnt++;
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
     }
     $schema_insert = '<tr class="print-category">';
     $schema_insert .= '<th class="print">' . htmlspecialchars($GLOBALS['strField']) . '</th>';
     $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strType']) . '</b></td>';
     $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strNull']) . '</b></td>';
     $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strDefault']) . '</b></td>';
     if ($do_relation && $have_rel) {
         $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strLinksTo']) . '</b></td>';
     }
     if ($do_comments) {
         $schema_insert .= '<td class="print"><b>' . htmlspecialchars($GLOBALS['strComments']) . '</b></td>';
         $comments = PMA_getComments($db, $table);
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $schema_insert .= '<td class="print"><b>' . htmlspecialchars('MIME') . '</b></td>';
         $mime_map = PMA_getMIME($db, $table, true);
     }
     $schema_insert .= '</tr>';
     if (!PMA_exportOutputHandler($schema_insert)) {
         return FALSE;
     }
     while ($row = PMA_DBI_fetch_assoc($result)) {
         $schema_insert = '<tr class="print-category">';
         $type = $row['Type'];
         // reformat mysql query output - staybyte - 9. June 2001
         // loic1: set or enum types: slashes single quotes inside options
         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']);
         }
         $strAttribute = '&nbsp;';
//.........这里部分代码省略.........
开发者ID:gerrywastaken,项目名称:phpmyadmin-GitHubed,代码行数:101,代码来源:htmlword.php

示例8: PMA_exportData

 /**
  * Outputs the content of a table in YAML format
  *
  * @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  $sql_query  SQL query for obtaining data
  * @return  bool        Whether it succeeded
  *
  * @access  public
  */
 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
 {
     $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
     $columns_cnt = PMA_DBI_num_fields($result);
     for ($i = 0; $i < $columns_cnt; $i++) {
         $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
     }
     unset($i);
     $buffer = '';
     $record_cnt = 0;
     while ($record = PMA_DBI_fetch_row($result)) {
         $record_cnt++;
         // Output table name as comment if this is the first record of the table
         if ($record_cnt == 1) {
             $buffer = '# ' . $db . '.' . $table . $crlf;
             $buffer .= '-' . $crlf;
         } else {
             $buffer = '-' . $crlf;
         }
         for ($i = 0; $i < $columns_cnt; $i++) {
             if (!isset($record[$i])) {
                 continue;
             }
             $column = $columns[$i];
             if (is_null($record[$i])) {
                 $buffer .= '  ' . $column . ': null' . $crlf;
                 continue;
             }
             if (is_numeric($record[$i])) {
                 $buffer .= '  ' . $column . ': ' . $record[$i] . $crlf;
                 continue;
             }
             $record[$i] = str_replace(array('\\', '"', "\n", "\r"), array('\\\\', '\\"', '\\n', '\\r'), $record[$i]);
             $buffer .= '  ' . $column . ': "' . $record[$i] . '"' . $crlf;
         }
         if (!PMA_exportOutputHandler($buffer)) {
             return false;
         }
     }
     PMA_DBI_free_result($result);
     return true;
 }
开发者ID:kirhgoph,项目名称:VMWare-Workstation-web-interface,代码行数:54,代码来源:yaml.php

示例9: exportData

 /**
  * Outputs the content of a table in MediaWiki format
  *
  * @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 $sql_query SQL query for obtaining data
  * @param array  $aliases   Aliases of db/table/columns
  *
  * @return bool             Whether it succeeded
  */
 public function exportData($db, $table, $crlf, $error_url, $sql_query, $aliases = array())
 {
     $db_alias = $db;
     $table_alias = $table;
     $this->initAlias($aliases, $db_alias, $table_alias);
     // Print data comment
     $output = $this->_exportComment("Table data for " . PMA\libraries\Util::backquote($table_alias));
     // Begin the table construction
     // Use the "wikitable" class for style
     // Use the "sortable"  class for allowing tables to be sorted by column
     $output .= "{| class=\"wikitable sortable\" style=\"text-align:center;\"" . $this->_exportCRLF();
     // Add the table name
     if (isset($GLOBALS['mediawiki_caption'])) {
         $output .= "|+'''" . $table_alias . "'''" . $this->_exportCRLF();
     }
     // Add the table headers
     if (isset($GLOBALS['mediawiki_headers'])) {
         // Get column names
         $column_names = $GLOBALS['dbi']->getColumnNames($db, $table);
         // Add column names as table headers
         if (!is_null($column_names)) {
             // Use '|-' for separating rows
             $output .= "|-" . $this->_exportCRLF();
             // Use '!' for separating table headers
             foreach ($column_names as $column) {
                 if (!empty($aliases[$db]['tables'][$table]['columns'][$column])) {
                     $column = $aliases[$db]['tables'][$table]['columns'][$column];
                 }
                 $output .= " ! " . $column . "" . $this->_exportCRLF();
             }
         }
     }
     // Get the table data from the database
     $result = $GLOBALS['dbi']->query($sql_query, null, PMA\libraries\DatabaseInterface::QUERY_UNBUFFERED);
     $fields_cnt = $GLOBALS['dbi']->numFields($result);
     while ($row = $GLOBALS['dbi']->fetchRow($result)) {
         $output .= "|-" . $this->_exportCRLF();
         // Use '|' for separating table columns
         for ($i = 0; $i < $fields_cnt; ++$i) {
             $output .= " | " . $row[$i] . "" . $this->_exportCRLF();
         }
     }
     // End table construction
     $output .= "|}" . str_repeat($this->_exportCRLF(), 2);
     return PMA_exportOutputHandler($output);
 }
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:58,代码来源:ExportMediawiki.php

示例10: exportData

 /**
  * Outputs the content of a table in CSV format
  *
  * @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 $sql_query SQL query for obtaining data
  * @param array  $aliases   Aliases of db/table/columns
  *
  * @return bool Whether it succeeded
  */
 public function exportData($db, $table, $crlf, $error_url, $sql_query, $aliases = array())
 {
     global $what, $csv_terminated, $csv_separator, $csv_enclosed, $csv_escaped;
     $db_alias = $db;
     $table_alias = $table;
     $this->initAlias($aliases, $db_alias, $table_alias);
     // Gets the data from the database
     $result = $GLOBALS['dbi']->query($sql_query, null, PMA_DatabaseInterface::QUERY_UNBUFFERED);
     $fields_cnt = $GLOBALS['dbi']->numFields($result);
     // If required, get fields name at the first line
     if (isset($GLOBALS['csv_columns'])) {
         $schema_insert = '';
         for ($i = 0; $i < $fields_cnt; $i++) {
             $col_as = $GLOBALS['dbi']->fieldName($result, $i);
             if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
                 $col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
             }
             $col_as = stripslashes($col_as);
             if ($csv_enclosed == '') {
                 $schema_insert .= $col_as;
             } else {
                 $schema_insert .= $csv_enclosed . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $col_as) . $csv_enclosed;
             }
             $schema_insert .= $csv_separator;
         }
         // end for
         $schema_insert = trim(mb_substr($schema_insert, 0, -1));
         if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
             return false;
         }
     }
     // end if
     // Format the data
     while ($row = $GLOBALS['dbi']->fetchRow($result)) {
         $schema_insert = '';
         for ($j = 0; $j < $fields_cnt; $j++) {
             if (!isset($row[$j]) || is_null($row[$j])) {
                 $schema_insert .= $GLOBALS[$what . '_null'];
             } elseif ($row[$j] == '0' || $row[$j] != '') {
                 // always enclose fields
                 if ($what == 'excel') {
                     $row[$j] = preg_replace("/\r(\n)?/", "\n", $row[$j]);
                 }
                 // remove CRLF characters within field
                 if (isset($GLOBALS[$what . '_removeCRLF']) && $GLOBALS[$what . '_removeCRLF']) {
                     $row[$j] = str_replace("\n", "", str_replace("\r", "", $row[$j]));
                 }
                 if ($csv_enclosed == '') {
                     $schema_insert .= $row[$j];
                 } else {
                     // also double the escape string if found in the data
                     if ($csv_escaped != $csv_enclosed) {
                         $schema_insert .= $csv_enclosed . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, str_replace($csv_escaped, $csv_escaped . $csv_escaped, $row[$j])) . $csv_enclosed;
                     } else {
                         // avoid a problem when escape string equals enclose
                         $schema_insert .= $csv_enclosed . str_replace($csv_enclosed, $csv_escaped . $csv_enclosed, $row[$j]) . $csv_enclosed;
                     }
                 }
             } else {
                 $schema_insert .= '';
             }
             if ($j < $fields_cnt - 1) {
                 $schema_insert .= $csv_separator;
             }
         }
         // end for
         if (!PMA_exportOutputHandler($schema_insert . $csv_terminated)) {
             return false;
         }
     }
     // end while
     $GLOBALS['dbi']->freeResult($result);
     return true;
 }
开发者ID:mercysmart,项目名称:naikelas,代码行数:86,代码来源:ExportCsv.class.php

示例11: 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
  *                                $this->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);
     $dump = '';
     switch ($export_mode) {
         case 'create_table':
             $dump .= '== ' . __('Table structure for table') . ' ' . $table_alias . "\n\n";
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, false, $aliases);
             break;
         case 'triggers':
             $dump = '';
             $triggers = $GLOBALS['dbi']->getTriggers($db, $table);
             if ($triggers) {
                 $dump .= '== ' . __('Triggers') . ' ' . $table_alias . "\n\n";
                 $dump .= $this->getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $dump .= '== ' . __('Structure for view') . ' ' . $table_alias . "\n\n";
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true, $aliases);
             break;
         case 'stand_in':
             $dump .= '== ' . __('Stand-in structure for view') . ' ' . $table . "\n\n";
             // export a stand-in definition to resolve view dependencies
             $dump .= $this->getTableDefStandIn($db, $table, $crlf, $aliases);
     }
     // end switch
     return PMA_exportOutputHandler($dump);
 }
开发者ID:nobodypb,项目名称:phpmyadmin,代码行数:54,代码来源:ExportTexytext.class.php

示例12: 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
  *                                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
  *
  * @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)
 {
     $dump = '';
     switch ($export_mode) {
         case 'create_table':
             $dump .= '<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $dump = '';
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= '<h2>' . __('Triggers') . ' ' . htmlspecialchars($table) . '</h2>';
                 $dump .= $this->getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $dump .= '<h2>' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= $this->getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $dump .= '<h2>' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             // export a stand-in definition to resolve view dependencies
             $dump .= $this->getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return PMA_exportOutputHandler($dump);
 }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:50,代码来源:ExportHtmlword.class.php

示例13: PMA_exportData

 /**
  * Outputs the content of a table in YAML format
  *
  * @param   string      the database name
  * @param   string      the table name
  * @param   string      the end of line sequence
  * @param   string      the url to go back in case of error
  * @param   string      SQL query for obtaining data
  *
  * @return  bool        Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
 {
     $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED);
     $columns_cnt = PMA_DBI_num_fields($result);
     for ($i = 0; $i < $columns_cnt; $i++) {
         $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
     }
     unset($i);
     $buffer = '';
     $record_cnt = 0;
     while ($record = PMA_DBI_fetch_row($result)) {
         $record_cnt++;
         // Output table name as comment if this is the first record of the table
         if ($record_cnt == 1) {
             $buffer .= $crlf . '// ' . $db . '.' . $table . $crlf;
             $buffer .= '$' . $table . ' = array(' . $crlf;
             $buffer .= '  array(';
         } else {
             $buffer .= ',' . $crlf . '  array(';
         }
         for ($i = 0; $i < $columns_cnt; $i++) {
             $buffer .= "'" . $columns[$i] . "'=>" . var_export($record[$i], true) . ($i + 1 >= $columns_cnt ? '' : ',');
         }
         $buffer .= ')';
     }
     $buffer .= $crlf . ');' . $crlf;
     if (!PMA_exportOutputHandler($buffer)) {
         return FALSE;
     }
     PMA_DBI_free_result($result);
     return true;
 }
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:45,代码来源:php_array.php

示例14: PMA_exportData

 /**
  * Outputs the content of a table in MediaWiki format
  *
  * @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  $sql_query  SQL query for obtaining data
  * @return  bool        Whether it succeeded
  *
  * @access  public
  */
 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
 {
     $columns = PMA_DBI_get_columns($db, $table);
     $columns = array_values($columns);
     $row_cnt = count($columns);
     $output = "{| cellpadding=\"10\" cellspacing=\"0\" border=\"1\" style=\"text-align:center;\"\n";
     $output .= "|+'''" . $table . "'''\n";
     $output .= "|- style=\"background:#ffdead;\"\n";
     $output .= "! style=\"background:#ffffff\" | \n";
     for ($i = 0; $i < $row_cnt; ++$i) {
         $output .= " | " . $columns[$i]['Field'];
         if ($i + 1 != $row_cnt) {
             $output .= "\n";
         }
     }
     $output .= "\n";
     $output .= "|- style=\"background:#f9f9f9;\"\n";
     $output .= "! style=\"background:#f2f2f2\" | Type\n";
     for ($i = 0; $i < $row_cnt; ++$i) {
         $output .= " | " . $columns[$i]['Type'];
         if ($i + 1 != $row_cnt) {
             $output .= "\n";
         }
     }
     $output .= "\n";
     $output .= "|- style=\"background:#f9f9f9;\"\n";
     $output .= "! style=\"background:#f2f2f2\" | Null\n";
     for ($i = 0; $i < $row_cnt; ++$i) {
         $output .= " | " . $columns[$i]['Null'];
         if ($i + 1 != $row_cnt) {
             $output .= "\n";
         }
     }
     $output .= "\n";
     $output .= "|- style=\"background:#f9f9f9;\"\n";
     $output .= "! style=\"background:#f2f2f2\" | Default\n";
     for ($i = 0; $i < $row_cnt; ++$i) {
         $output .= " | " . $columns[$i]['Default'];
         if ($i + 1 != $row_cnt) {
             $output .= "\n";
         }
     }
     $output .= "\n";
     $output .= "|- style=\"background:#f9f9f9;\"\n";
     $output .= "! style=\"background:#f2f2f2\" | Extra\n";
     for ($i = 0; $i < $row_cnt; ++$i) {
         $output .= " | " . $columns[$i]['Extra'];
         if ($i + 1 != $row_cnt) {
             $output .= "\n";
         }
     }
     $output .= "\n";
     $output .= "|}\n\n\n\n";
     return PMA_exportOutputHandler($output);
 }
开发者ID:AmberWish,项目名称:laba_web,代码行数:67,代码来源:mediawiki.php

示例15: 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;
     }
     /**
      * 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
      */
     $buffer = $crlf . '%' . $crlf . '% ' . __('Structure') . ': ' . $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) {
         $columns_cnt++;
         $alignment .= 'l|';
     }
     if ($do_mime && $cfgRelation['mimework']) {
         $columns_cnt++;
         $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{' . PMA_expandUserString($GLOBALS['latex_structure_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\label{' . PMA_expandUserString($GLOBALS['latex_structure_label'], null, array('table' => $table, 'database' => $db)) . '} \\\\' . $crlf;
     }
     $buffer .= $header . ' \\\\ \\hline \\hline' . $crlf . '\\endfirsthead' . $crlf;
     // Table caption on next pages
     if (isset($GLOBALS['latex_caption'])) {
         $buffer .= ' \\caption{' . PMA_expandUserString($GLOBALS['latex_structure_continued_caption'], 'PMA_texEscape', array('table' => $table, 'database' => $db)) . '} \\\\ ' . $crlf;
//.........这里部分代码省略.........
开发者ID:ljhchshm,项目名称:weixin,代码行数:101,代码来源:latex.php


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