home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / pdf_pages.php < prev    next >
PHP Script  |  2008-06-23  |  27KB  |  572 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  *
  5.  * @version $Id: pdf_pages.php 10241 2007-04-01 11:13:46Z cybot_tm $
  6.  */
  7.  
  8. /**
  9.  * Gets some core libraries
  10.  */
  11. require_once './libraries/common.inc.php';
  12. require_once './libraries/db_common.inc.php';
  13.  
  14.  
  15. /**
  16.  * Settings for relation stuff
  17.  */
  18. require_once './libraries/relation.lib.php';
  19. $cfgRelation = PMA_getRelationsParam();
  20.  
  21. // This is to avoid "Command out of sync" errors. Before switching this to
  22. // a value of 0 (for MYSQLI_USE_RESULT), please check the logic
  23. // to free results wherever needed.
  24. $query_default_option = PMA_DBI_QUERY_STORE;
  25.  
  26. /**
  27.  * Now in ./libraries/relation.lib.php we check for all tables
  28.  * that we need, but if we don't find them we are quiet about it
  29.  * so people can work without.
  30.  * This page is absolutely useless if you didn't set up your tables
  31.  * correctly, so it is a good place to see which tables we can and
  32.  * complain ;-)
  33.  */
  34. if (!$cfgRelation['relwork']) {
  35.     echo sprintf($strNotSet, 'relation', 'config.inc.php') . '<br />' . "\n"
  36.          . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
  37.     require_once './libraries/footer.inc.php';
  38. }
  39.  
  40. if (!$cfgRelation['displaywork']) {
  41.     echo sprintf($strNotSet, 'table_info', 'config.inc.php') . '<br />' . "\n"
  42.          . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
  43.     require_once './libraries/footer.inc.php';
  44. }
  45.  
  46. if (!isset($cfgRelation['table_coords'])){
  47.     echo sprintf($strNotSet, 'table_coords', 'config.inc.php') . '<br />' . "\n"
  48.          . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
  49.     exit();
  50. }
  51. if (!isset($cfgRelation['pdf_pages'])) {
  52.     echo sprintf($strNotSet, 'pdf_page', 'config.inc.php') . '<br />' . "\n"
  53.          . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
  54.     exit();
  55. }
  56.  
  57. if ($cfgRelation['pdfwork']) {
  58.     // Now is the time to work on all changes
  59.     if (isset($do)) {
  60.         switch ($do) {
  61.             case 'choosepage':
  62.                 if ($action_choose=="1") {
  63.                     $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  64.                               .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  65.                               .   ' AND   pdf_page_number = ' . $chpage;
  66.                     PMA_query_as_cu($ch_query, FALSE, $query_default_option);
  67.  
  68.                     $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
  69.                               .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  70.                               .   ' AND   page_nr = ' . $chpage;
  71.                     PMA_query_as_cu($ch_query, FALSE, $query_default_option);
  72.  
  73.                     unset($chpage);
  74.                 }
  75.                 break;
  76.             case 'createpage':
  77.                 if (!isset($newpage) || $newpage == '') {
  78.                     $newpage = $strNoDescription;
  79.                 }
  80.                 $ins_query   = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
  81.                              . ' (db_name, page_descr)'
  82.                              . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
  83.                 PMA_query_as_cu($ins_query, FALSE, $query_default_option);
  84.                 $pdf_page_number = PMA_DBI_insert_id(isset($controllink) ? $controllink : '');
  85.  
  86.                 // A u t o m a t i c    l a y o u t
  87.                 // ================================
  88.                 if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
  89.                     $all_tables = array();
  90.                 }
  91.  
  92.                 if (isset($auto_layout_innodb)) {
  93.                     // get the tables list
  94.                     $tables = PMA_DBI_get_tables_full($db);
  95.                     // find the InnoDB ones
  96.                     $innodb_tables = array();
  97.                     foreach($tables as $table_name => $table_properties) {
  98.                         if ($table_properties['ENGINE'] == 'InnoDB') {
  99.                             $innodb_tables[] = $table_name;
  100.                         }
  101.                     }
  102.                     $all_tables = $innodb_tables;
  103.                     // could be improved by finding the tables which have the
  104.                     // most references keys and place them at the beginning
  105.                     // of the array (so that they are all center of schema)
  106.                     unset($tables, $innodb_tables);
  107.                 } // endif auto_layout_innodb
  108.  
  109.                 if (isset($auto_layout_internal)) {
  110.                     // get the tables that have relations, by descending
  111.                     // number of links
  112.                     $master_tables = 'SELECT COUNT(master_table), master_table'
  113.                                 . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
  114.                                 . ' WHERE master_db = \'' . $db . '\''
  115.                                 . ' GROUP BY master_table'
  116.                                 . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
  117.                     $master_tables_rs = PMA_query_as_cu($master_tables, FALSE, $query_default_option);
  118.                     if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
  119.                         // first put all the master tables at beginning
  120.                         // of the list, so they are near the center of
  121.                         // the schema
  122.                         while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
  123.                             $all_tables[] = $master_table;
  124.                         }
  125.  
  126.                         // then for each master, add its foreigns into an array
  127.                         // of foreign tables, if not already there
  128.                         // (a foreign might be foreign for more than
  129.                         // one table, and might be a master itself)
  130.  
  131.                         $foreign_tables = array();
  132.                         foreach ($all_tables AS $master_table) {
  133.                             $foreigners = PMA_getForeigners($db, $master_table);
  134.                             foreach ($foreigners AS $foreigner) {
  135.                                 if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
  136.                                     $foreign_tables[] = $foreigner['foreign_table'];
  137.                                 }
  138.                             }
  139.                         }
  140.  
  141.                         // then merge the arrays
  142.                         foreach ($foreign_tables AS $foreign_table) {
  143.                             if (!in_array($foreign_table, $all_tables)) {
  144.                                 $all_tables[] = $foreign_table;
  145.                             }
  146.                         }
  147.                     } // endif there are master tables
  148.                 } // endif auto_layout_internal
  149.  
  150.                 if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
  151.                     // now generate the coordinates for the schema,
  152.                     // in a clockwise spiral
  153.  
  154.                     $pos_x = 300;
  155.                     $pos_y = 300;
  156.                     $delta = 110;
  157.                     $delta_mult = 1.10;
  158.                     $direction = "right";
  159.                     foreach ($all_tables AS $current_table) {
  160.  
  161.                         // save current table's coordinates
  162.                         $insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
  163.                                       . '(db_name, table_name, pdf_page_number, x, y) '
  164.                                       . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
  165.                         PMA_query_as_cu($insert_query, FALSE, $query_default_option);
  166.  
  167.                         // compute for the next table
  168.                         switch ($direction) {
  169.                             case 'right':
  170.                                 $pos_x += $delta;
  171.                                 $direction = "down";
  172.                                 $delta *= $delta_mult;
  173.                                 break;
  174.                             case 'down':
  175.                                 $pos_y += $delta;
  176.                                 $direction = "left";
  177.                                 $delta *= $delta_mult;
  178.                                 break;
  179.                             case 'left':
  180.                                 $pos_x -= $delta;
  181.                                 $direction = "up";
  182.                                 $delta *= $delta_mult;
  183.                                 break;
  184.                             case 'up':
  185.                                 $pos_y -= $delta;
  186.                                 $direction = "right";
  187.                                 $delta *= $delta_mult;
  188.                                 break;
  189.                         } // end switch
  190.                     } // end foreach
  191.                 } // end if some auto-layout to do
  192.  
  193.                 $chpage = $pdf_page_number;
  194.  
  195.                 break;
  196.  
  197.             case 'edcoord':
  198.                 for ($i = 0; $i < $c_table_rows; $i++) {
  199.                     $arrvalue = 'c_table_' . $i;
  200.                     $arrvalue = $$arrvalue;
  201.                     if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
  202.                         $arrvalue['x'] = 0;
  203.                     }
  204.                     if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
  205.                         $arrvalue['y'] = 0;
  206.                     }
  207.                     if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
  208.                         $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  209.                                     .   ' WHERE db_name = \'' .  PMA_sqlAddslashes($db) . '\''
  210.                                     .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  211.                                     .   ' AND   pdf_page_number = ' . $chpage;
  212.                         $test_rs    = PMA_query_as_cu($test_query, FALSE, $query_default_option);
  213.                         if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
  214.                             if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
  215.                                 $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  216.                                           .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  217.                                           .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  218.                                           .   ' AND   pdf_page_number = ' . $chpage;
  219.                             } else {
  220.                                 $ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
  221.                                           . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
  222.                                           .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  223.                                           .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  224.                                           .   ' AND   pdf_page_number = ' . $chpage;
  225.                             }
  226.                         } else {
  227.                             $ch_query     = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
  228.                                           . '(db_name, table_name, pdf_page_number, x, y) '
  229.                                           . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
  230.                         }
  231.                         PMA_query_as_cu($ch_query, FALSE, $query_default_option);
  232.                     } // end if
  233.                 } // end for
  234.                 break;
  235.             case 'deleteCrap':
  236.                 foreach ($delrow AS $current_row) {
  237.                     $d_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
  238.                              .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
  239.                              .   ' AND   table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
  240.                              .   ' AND   pdf_page_number = ' . $chpage;
  241.                     PMA_query_as_cu($d_query, FALSE, $query_default_option);
  242.                 }
  243.                 break;
  244.         } // end switch
  245.     } // end if (isset($do))
  246.  
  247.     // We will need an array of all tables in this db
  248.     $selectboxall = array('--');
  249.     $alltab_rs    = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
  250.     while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
  251.         $selectboxall[] = $val[0];
  252.     }
  253.  
  254.     // Now first show some possibility to choose a page for the pdf
  255.     $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
  256.                 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
  257.     $page_rs    = PMA_query_as_cu($page_query, FALSE, $query_default_option);
  258.  
  259.     if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
  260.         ?>
  261. <form method="get" action="pdf_pages.php" name="selpage">
  262.     <fieldset>
  263.      <legend>
  264.     <?php echo $strChoosePage . "\n"; ?>
  265.      </legend>
  266.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  267.     <input type="hidden" name="do" value="choosepage" />
  268.     <select name="chpage" onchange="this.form.submit()">
  269.         <?php
  270.         while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
  271.             echo "\n" . '        '
  272.                  . '<option value="' . $curr_page['page_nr'] . '"';
  273.             if (isset($chpage) && $chpage == $curr_page['page_nr']) {
  274.                 echo ' selected="selected"';
  275.             }
  276.             echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
  277.         } // end while
  278.         echo "\n";
  279.         ?>
  280.     </select>
  281.     <input type="radio" name="action_choose" value="0" id="radio_choose0" checked="checked" style="vertical-align: middle" /><label for="radio_choose0">
  282. <?php echo $strEdit; ?> </label>
  283.     <input type="radio" name="action_choose" value="1" id="radio_choose1"  style="vertical-align: middle" /><label for="radio_choose1">
  284. <?php echo $strDelete; ?> </label>
  285.        <input type="submit" value="<?php echo $strGo; ?>" /><br />
  286.     </fieldset>
  287. </form>
  288.         <?php
  289.     }
  290.     echo "\n";
  291.  
  292.     // Possibility to create a new page:
  293.     ?>
  294. <form method="post" action="pdf_pages.php" name="crpage">
  295.     <fieldset>
  296.      <legend>
  297.     <?php echo $strCreatePage . "\n"; ?>
  298.      </legend>
  299.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  300.     <input type="hidden" name="do" value="createpage" />
  301.     <input type="text" name="newpage" size="20" maxlength="50" />
  302.        <input type="checkbox" name="auto_layout_internal" />
  303.    <?php echo '(' . $strAutomaticLayout . ' / ' . $strInternalRelations . ')' . "\n"; ?>
  304.         <input type="checkbox" name="auto_layout_innodb" />
  305.     <?php echo '(' . $strAutomaticLayout . ' / InnoDB)' . "\n"; ?>
  306.         <input type="submit" value="<?php echo $strGo; ?>" />
  307.     </fieldset>
  308. </form>
  309.     <?php
  310.     // Now if we already have chosen a page number then we should show the
  311.     // tables involved
  312.     if (isset($chpage) && $chpage > 0) {
  313.         echo "\n";
  314.         ?>
  315. <hr />
  316.  
  317. <h2><?php echo $strSelectTables ;?></h2>
  318.  
  319. <?php
  320. $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
  321.             . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  322.             . ' AND pdf_page_number = ' . $chpage;
  323. $page_rs    = PMA_query_as_cu($page_query, FALSE, $query_default_option);
  324. $array_sh_page = array();
  325. $draginit = '';
  326. $reset_draginit = '';
  327. $i = 0;
  328. while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
  329.     $array_sh_page[] = $temp_sh_page;
  330. }
  331.  
  332. // garvin: Display WYSIWYG-PDF parts?
  333. if ($cfg['WYSIWYG-PDF']) {
  334.     if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
  335.         $with_field_names = TRUE;
  336.     }
  337. ?>
  338. <script type="text/javascript" src="./js/dom-drag.js"></script>
  339. <form method="post" action="pdf_pages.php" name="dragdrop">
  340. <input type="button" name="dragdrop" value="<?php echo $strToggleScratchboard; ?>" onclick="ToggleDragDrop('pdflayout');" />
  341.  <input type="button" name="dragdropreset" value="<?php echo $strReset; ?>" onclick="resetDrag();" />
  342. </form>
  343. <div id="pdflayout" class="pdflayout" style="visibility: hidden;">
  344. <?php
  345. foreach ($array_sh_page AS $key => $temp_sh_page) {
  346.     $drag_x = $temp_sh_page['x'];
  347.     $drag_y = $temp_sh_page['y'];
  348.  
  349.     $draginit       .= '    Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
  350.     $draginit       .= '    getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
  351.     $draginit       .= '    getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
  352.     $draginit       .= '    getElement("table_' . $i . '").style.top  = "' . $drag_y . 'px";' . "\n";
  353.     $reset_draginit .= '    getElement("table_' . $i . '").style.left = "2px";' . "\n";
  354.     $reset_draginit .= '    getElement("table_' . $i . '").style.top  = "' . (15 * $i) . 'px";' . "\n";
  355.     $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
  356.     $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
  357.  
  358.     $local_query = 'SHOW FIELDS FROM '
  359.                  .  PMA_backquote($temp_sh_page['table_name'])
  360.                 . ' FROM ' . PMA_backquote($db);
  361.     $fields_rs = PMA_DBI_query($local_query);
  362.     unset($local_query);
  363.     $fields_cnt = PMA_DBI_num_rows($fields_rs);
  364.  
  365.     echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
  366.     if (isset($with_field_names)) {
  367.         while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
  368.             echo '<br />' . htmlspecialchars($row['Field']) . "\n";
  369.         }
  370.     }
  371.     echo '</div>' . "\n";
  372.     PMA_DBI_free_result($fields_rs);
  373.     unset($fields_rs);
  374.  
  375.     $i++;
  376. }
  377. ?>
  378. </div>
  379. <script type="text/javascript">
  380. //<![CDATA[
  381. function init() {
  382.     refreshLayout();
  383.     myid = getElement('pdflayout');
  384.     <?php echo $draginit; ?>
  385. }
  386.  
  387. function resetDrag() {
  388.     <?php echo $reset_draginit; ?>
  389. }
  390. //]]>
  391. </script>
  392. <?php
  393. } // end if WYSIWYG-PDF
  394. ?>
  395.  
  396. <form method="post" action="pdf_pages.php" name="edcoord">
  397.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  398.     <input type="hidden" name="chpage" value="<?php echo $chpage; ?>" />
  399.     <input type="hidden" name="do" value="edcoord" />
  400.     <table border="0">
  401.     <tr>
  402.         <th><?php echo $strTable; ?></th>
  403.         <th><?php echo $strDelete; ?></th>
  404.         <th>X</th>
  405.         <th>Y</th>
  406.     </tr>
  407.         <?php
  408.         if (isset($ctable)) {
  409.             unset($ctable);
  410.         }
  411.  
  412.  
  413.         $i = 0;
  414.         $odd_row = true;
  415.         foreach ($array_sh_page AS $dummy_sh_page => $sh_page) {
  416.             $_mtab       = $sh_page['table_name'];
  417.             $tabExist[$_mtab] = FALSE;
  418.             echo "\n" . '    <tr class="';
  419.             if ($odd_row) {
  420.                 echo 'odd';
  421.             } else {
  422.                 echo 'even';
  423.             }
  424.             echo '">';
  425.             $odd_row != $odd_row;
  426.             echo "\n" . '        <td>'
  427.                  . "\n" . '            <select name="c_table_' . $i . '[name]">';
  428.             foreach ($selectboxall AS $key => $value) {
  429.                 echo "\n" . '                <option value="' . $value . '"';
  430.                 if ($value == $sh_page['table_name']) {
  431.                     echo ' selected="selected"';
  432.                     $tabExist[$_mtab] = TRUE;
  433.                 }
  434.                 echo '>' . $value . '</option>';
  435.             } // end while
  436.             echo "\n" . '            </select>'
  437.                  . "\n" . '        </td>';
  438.             echo "\n" . '        <td>'
  439.                  . "\n" . '            <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
  440.             echo "\n" . '        </td>';
  441.             echo "\n" . '        <td>'
  442.                  . "\n" . '            <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
  443.             echo "\n" . '        </td>';
  444.             echo "\n" . '        <td>'
  445.                  . "\n" . '            <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
  446.             echo "\n" . '        </td>';
  447.             echo "\n" . '    </tr>';
  448.             $i++;
  449.         } // end while
  450.         // Do one more empty row
  451.         echo "\n" . '    <tr class="';
  452.         if ($odd_row) {
  453.             echo 'odd';
  454.         } else {
  455.             echo 'even';
  456.         }
  457.         $odd_row != $odd_row;
  458.         echo '">';
  459.         echo "\n" . '        <td>'
  460.              . "\n" . '            <select name="c_table_' . $i . '[name]">';
  461.         foreach ($selectboxall AS $key => $value) {
  462.             echo "\n" . '                <option value="' . $value . '">' . $value . '</option>';
  463.         }
  464.         echo "\n" . '            </select>'
  465.              . "\n" . '        </td>';
  466.         echo "\n" . '        <td>'
  467.              . "\n" . '            <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
  468.         echo "\n" . '        </td>';
  469.         echo "\n" . '        <td>'
  470.              . "\n" . '            <input type="text" name="c_table_' . $i . '[x]" value="' . (isset($sh_page['x'])?$sh_page['x']:'') . '" />';
  471.         echo "\n" . '        </td>';
  472.         echo "\n" . '        <td>'
  473.              . "\n" . '            <input type="text" name="c_table_' . $i . '[y]" value="' . (isset($sh_page['y'])?$sh_page['y']:'') . '" />';
  474.         echo "\n" . '        </td>';
  475.         echo "\n" . '    </tr>';
  476.         echo "\n" . '    </table>' . "\n";
  477.  
  478.         echo "\n" . '    <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
  479.         echo ($cfg['WYSIWYG-PDF'] ? "\n" . '    <input type="hidden" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
  480.         echo "\n" . '    <input type="checkbox" name="with_field_names" ' . (isset($with_field_names) ? 'checked="checked"' : ''). ' />' . $strColumnNames . '<br />';
  481.         echo "\n" . '    <input type="submit" value="' . $strSave . '" />';
  482.         echo "\n" . '</form>' . "\n\n";
  483.     } // end if
  484.  
  485.     //  Check if there are tables that need to be deleted,
  486.     //  if there are, ask the user for allowance
  487.     $_strtrans  = '';
  488.     $_strname   = '';
  489.     $shoot      = FALSE;
  490.     if (!empty($tabExist) && is_array($tabExist)) {
  491.         foreach ($tabExist AS $key => $value) {
  492.             if (!$value) {
  493.                 $_strtrans  .= '<input type="hidden" name="delrow[]" value="' . $key . '" />' . "\n";
  494.                 $_strname   .= '<li>' . $key . '</li>' . "\n";
  495.                 $shoot       = TRUE;
  496.             }
  497.         }
  498.         if ($shoot) {
  499.             echo '<form action="pdf_pages.php" method="post">' . "\n"
  500.                . PMA_generate_common_hidden_inputs($db, $table)
  501.                . '<input type="hidden" name="do" value="deleteCrap" />' . "\n"
  502.                . '<input type="hidden" name="chpage" value="' . $chpage . '" />' . "\n"
  503.                . $strDelOld
  504.                . '<ul>' . "\n"
  505.                . $_strname
  506.                . '</ul>' . "\n"
  507.                . $_strtrans
  508.                . '<input type="submit" value="' . $strGo . '" />' . "\n"
  509.                . '</form>';
  510.         }
  511.     }
  512.     //    ------------------------------------
  513.     //    d i s p l a y   p d f    s c h e m a
  514.     //    ------------------------------------
  515.  
  516.     if (isset($do)
  517.     && ($do == 'edcoord'
  518.        || ($do == 'choosepage' && isset($chpage))
  519.        || ($do == 'createpage' && isset($chpage)))) {
  520.         ?>
  521. <form method="post" action="pdf_schema.php" name="pdfoptions">
  522.     <?php echo PMA_generate_common_hidden_inputs($db); ?>
  523.     <input type="hidden" name="pdf_page_number" value="<?php echo $chpage; ?>" />
  524.  
  525.     <?php echo '<br /><b>' . $strDisplayPDF . '</b>'; ?>: <br />
  526.     <input type="checkbox" name="show_grid" id="show_grid_opt" /><label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
  527.     <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /><label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
  528.     <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" /><label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
  529.     <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" /><label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label><br />
  530.     <input type="checkbox" name="with_doc" id="with_doc" checked="checked" /><label for="with_doc"><?php echo $strDataDict; ?></label>
  531.     <br />
  532.     <label for="orientation_opt"><?php echo $strShowDatadictAs; ?></label>
  533.     <select id="orientation_opt" name="orientation" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
  534.         <option value="L"><?php echo $strLandscape;?></option>
  535.         <option value="P"><?php echo $strPortrait;?></option>
  536.     </select><br />
  537.  
  538.     <label for="paper_opt"><?php echo $strPaperSize; ?></label>
  539.     <select id="paper_opt" name="paper" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
  540. <?php
  541.         foreach ($cfg['PDFPageSizes'] AS $key => $val) {
  542.             echo '<option value="' . $val . '"';
  543.             if ($val == $cfg['PDFDefaultPageSize']) {
  544.                 echo ' selected="selected"';
  545.             }
  546.             echo ' >' . $val . '</option>' . "\n";
  547.         }
  548. ?>
  549.     </select><br />
  550.       <input type="submit" value="<?php echo $strGo; ?>" />
  551. </form>
  552. <?php
  553.         if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
  554. ?>
  555. <script type="text/javascript">
  556. //<![CDATA[
  557. ToggleDragDrop('pdflayout');
  558. //]]>
  559. </script>
  560. <?php
  561.         }
  562.     } // end if
  563. } // end if ($cfgRelation['pdfwork'])
  564.  
  565.  
  566. /**
  567.  * Displays the footer
  568.  */
  569. echo "\n";
  570. require_once './libraries/footer.inc.php';
  571. ?>
  572.