Documentation TYPO3 par Ameos

tbl_relation.php

00001 <?php
00002 /* $Id: tbl_relation.php,v 2.22.2.1 2005/09/12 17:12:42 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00008 require_once('./libraries/grab_globals.lib.php');
00009 require_once('./libraries/common.lib.php');
00010 require_once('./tbl_properties_common.php');
00011 $url_query .= '&amp;goto=tbl_properties.php';
00012 
00013 
00017 require('./tbl_properties_table_info.php');
00018 
00019 // Note: in tbl_properties_links.php we get and display the table comment.
00020 // For InnoDB, this comment contains the REFER information but any update
00021 // has not been done yet (will be done in tbl_relation.php later).
00022 $avoid_show_comment = TRUE;
00023 
00027 require('./tbl_properties_links.php');
00028 
00029 require_once('./libraries/relation.lib.php');
00030 
00031 $options_array = array('CASCADE' => 'CASCADE', 'SET_NULL' => 'SET NULL', 'NO_ACTION' => 'NO ACTION', 'RESTRICT' => 'RESTRICT');
00032 
00043 function PMA_generate_dropdown($dropdown_question,$radio_name,$choices,$selected_value) {
00044     global $font_smallest;
00045 
00046     echo $dropdown_question . '&nbsp;&nbsp;';
00047 
00048     //echo '<select name="' . $radio_name . '" style="font-size: ' . $font_smallest . '">' . "\n";
00049     //echo '<option value="nix" style="font-size: ' . $font_smallest . '" >--</option>' . "\n";
00050     echo '<select name="' . $radio_name . '">' . "\n";
00051     echo '<option value="nix">--</option>' . "\n";
00052 
00053     foreach ($choices AS $one_value => $one_label) {
00054         echo '<option value="' . $one_value . '"';
00055         if ($selected_value == $one_value) {
00056             echo ' selected="selected" ';
00057         }
00058         //echo ' style="font-size: ' . $font_smallest . '">'
00059         echo '>' . $one_label . '</option>' . "\n";
00060     }
00061     echo '</select>' . "\n";
00062     echo "\n";
00063 }
00064 
00065 
00069 $cfgRelation = PMA_getRelationsParam();
00070 
00071 
00076 // ensure we are positionned to our current db (since the previous reading
00077 // of relations makes pmadb the current one, maybe depending on the MySQL version)
00078 PMA_DBI_select_db($db);
00079 
00080 if ($cfgRelation['relwork']) {
00081     $existrel = PMA_getForeigners($db, $table, '', 'internal');
00082 }
00083 if ($tbl_type=='INNODB') {
00084     $existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
00085 }
00086 if ($cfgRelation['displaywork']) {
00087     $disp     = PMA_getDisplayField($db, $table);
00088 }
00089 
00090 // u p d a t e s   f o r   I n t e r n a l    r e l a t i o n s
00091 if (isset($destination) && $cfgRelation['relwork']) {
00092 
00093     foreach ($destination AS $master_field => $foreign_string) {
00094         if ($foreign_string != 'nix') {
00095             list($foreign_db, $foreign_table, $foreign_field) = explode('.', $foreign_string);
00096             if (!isset($existrel[$master_field])) {
00097                 $upd_query  = 'INSERT INTO ' . PMA_backquote($cfgRelation['relation'])
00098                             . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)'
00099                             . ' values('
00100                             . '\'' . PMA_sqlAddslashes($db) . '\', '
00101                             . '\'' . PMA_sqlAddslashes($table) . '\', '
00102                             . '\'' . PMA_sqlAddslashes($master_field) . '\', '
00103                             . '\'' . PMA_sqlAddslashes($foreign_db) . '\', '
00104                             . '\'' . PMA_sqlAddslashes($foreign_table) . '\','
00105                             . '\'' . PMA_sqlAddslashes($foreign_field) . '\')';
00106             } else if ($existrel[$master_field]['foreign_db'] . '.' .$existrel[$master_field]['foreign_table'] . '.' . $existrel[$master_field]['foreign_field'] != $foreign_string) {
00107                 $upd_query  = 'UPDATE ' . PMA_backquote($cfgRelation['relation']) . ' SET'
00108                             . ' foreign_db       = \'' . PMA_sqlAddslashes($foreign_db) . '\', '
00109                             . ' foreign_table    = \'' . PMA_sqlAddslashes($foreign_table) . '\', '
00110                             . ' foreign_field    = \'' . PMA_sqlAddslashes($foreign_field) . '\' '
00111                             . ' WHERE master_db  = \'' . PMA_sqlAddslashes($db) . '\''
00112                             . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
00113                             . ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\'';
00114             } // end if... else....
00115         } else if (isset($existrel[$master_field])) {
00116             $upd_query      = 'DELETE FROM ' . PMA_backquote($cfgRelation['relation'])
00117                             . ' WHERE master_db  = \'' . PMA_sqlAddslashes($db) . '\''
00118                             . ' AND master_table = \'' . PMA_sqlAddslashes($table) . '\''
00119                             . ' AND master_field = \'' . PMA_sqlAddslashes($master_field) . '\'';
00120         } // end if... else....
00121         if (isset($upd_query)) {
00122             $upd_rs         = PMA_query_as_cu($upd_query);
00123             unset($upd_query);
00124         }
00125     } // end while
00126 } // end if (updates for internal relations)
00127 
00128 // u p d a t e s   f o r   I n n o D B
00129 // ( for now, one index name only; we keep the definitions if the
00130 // foreign db is not the same)
00131 if (isset($destination_innodb)) {
00132     foreach ($destination_innodb AS $master_field => $foreign_string) {
00133         if ($foreign_string != 'nix') {
00134             list($foreign_db, $foreign_table, $foreign_field) = explode('.', $foreign_string);
00135             if (!isset($existrel_innodb[$master_field])) {
00136                 // no key defined for this field
00137 
00138                 // The next few lines are repeated below, so they
00139                 // could be put in an include file
00140                 // Note: I tried to enclose the db and table name with
00141                 // backquotes but MySQL 4.0.16 did not like the syntax
00142                 // (for example: `base2`.`table1` )
00143 
00144                 $upd_query  = 'ALTER TABLE ' . PMA_backquote($table)
00145                             . ' ADD FOREIGN KEY ('
00146                             . PMA_backquote(PMA_sqlAddslashes($master_field)) . ')'
00147                             . ' REFERENCES '
00148                             . PMA_backquote(PMA_sqlAddslashes($foreign_db) . '.'
00149                             . PMA_sqlAddslashes($foreign_table)) . '('
00150                             . PMA_backquote(PMA_sqlAddslashes($foreign_field)) . ')';
00151 
00152                 if (${$master_field . '_on_delete'} != 'nix') {
00153                     $upd_query   .= ' ON DELETE ' . $options_array[${$master_field . '_on_delete'}];
00154                 }
00155                 if (${$master_field . '_on_update'} != 'nix') {
00156                     $upd_query   .= ' ON UPDATE ' . $options_array[${$master_field . '_on_update'}];
00157                 }
00158 
00159                 // end repeated code
00160 
00161             } else if (($existrel_innodb[$master_field]['foreign_db'] . '.' .$existrel_innodb[$master_field]['foreign_table'] . '.' . $existrel_innodb[$master_field]['foreign_field'] != $foreign_string)
00162               || ( ${$master_field . '_on_delete'} != (!empty($existrel_innodb[$master_field]['on_delete']) ? $existrel_innodb[$master_field]['on_delete'] : ''))
00163               || ( ${$master_field . '_on_update'} != (!empty($existrel_innodb[$master_field]['on_update']) ? $existrel_innodb[$master_field]['on_update'] : ''))
00164                    ) {
00165                 // another foreign key is already defined for this field
00166                 // or
00167                 // an option has been changed for ON DELETE or ON UPDATE
00168 
00169                 // remove existing key
00170                 if (PMA_MYSQL_INT_VERSION >= 40013) {
00171                     $upd_query  = 'ALTER TABLE ' . PMA_backquote($table)
00172                                 . ' DROP FOREIGN KEY '
00173                                 . PMA_backquote($existrel_innodb[$master_field]['constraint']);
00174 
00175                     // I tried to send both in one query but it failed
00176                     $upd_rs     = PMA_DBI_query($upd_query);
00177                 }
00178 
00179                 // add another
00180                 $upd_query  = 'ALTER TABLE ' . PMA_backquote($table)
00181                             . ' ADD FOREIGN KEY ('
00182                             . PMA_backquote(PMA_sqlAddslashes($master_field)) . ')'
00183                             . ' REFERENCES '
00184                             . PMA_backquote(PMA_sqlAddslashes($foreign_db) . '.'
00185                             . PMA_sqlAddslashes($foreign_table)) . '('
00186                             . PMA_backquote(PMA_sqlAddslashes($foreign_field)) . ')';
00187 
00188                 if (${$master_field . '_on_delete'} != 'nix') {
00189                     $upd_query   .= ' ON DELETE ' . $options_array[${$master_field . '_on_delete'}];
00190                 }
00191                 if (${$master_field . '_on_update'} != 'nix') {
00192                     $upd_query   .= ' ON UPDATE ' . $options_array[${$master_field . '_on_update'}];
00193                 }
00194 
00195             } // end if... else....
00196         } else if (isset($existrel_innodb[$master_field])) {
00197                 if (PMA_MYSQL_INT_VERSION >= 40013) {
00198                     $upd_query  = 'ALTER TABLE ' . PMA_backquote($table)
00199                             . ' DROP FOREIGN KEY '
00200                             . PMA_backquote($existrel_innodb[$master_field]['constraint']);
00201                 }
00202         } // end if... else....
00203 
00204         if (isset($upd_query)) {
00205             $upd_rs    = PMA_DBI_try_query($upd_query);
00206             $tmp_error = PMA_DBI_getError();
00207             if (substr($tmp_error, 1, 4) == '1216') {
00208                 PMA_mysqlDie($tmp_error, $upd_query, FALSE, '', FALSE);
00209                 echo PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
00210             }
00211             if (substr($tmp_error, 1, 4) == '1005') {
00212                 echo '<p class="warning">' . $strNoIndex . ' (' . $master_field .')</p>'  . PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
00213             }
00214             unset($upd_query);
00215             unset($tmp_error);
00216         }
00217     } // end while
00218 } // end if isset($destination_innodb)
00219 
00220 
00221 // U p d a t e s   f o r   d i s p l a y   f i e l d
00222 
00223 if ($cfgRelation['displaywork']
00224     && isset($display_field)) {
00225 
00226     if ($disp) {
00227         if ($display_field != '') {
00228             $upd_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_info'])
00229                        . ' SET display_field = \'' . PMA_sqlAddslashes($display_field) . '\''
00230                        . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\''
00231                        . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
00232         } else {
00233             $upd_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_info'])
00234                        . ' WHERE db_name  = \'' . PMA_sqlAddslashes($db) . '\''
00235                        . ' AND table_name = \'' . PMA_sqlAddslashes($table) . '\'';
00236         }
00237     } elseif ($display_field != '') {
00238         $upd_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_info'])
00239                    . '(db_name, table_name, display_field) '
00240                    . ' VALUES('
00241                    . '\'' . PMA_sqlAddslashes($db) . '\','
00242                    . '\'' . PMA_sqlAddslashes($table) . '\','
00243                    . '\'' . PMA_sqlAddslashes($display_field) . '\')';
00244     }
00245 
00246     if (isset($upd_query)) {
00247         $upd_rs    = PMA_query_as_cu($upd_query);
00248     }
00249 } // end if
00250 
00251 // If we did an update, refresh our data
00252 if (isset($destination) && $cfgRelation['relwork']) {
00253     $existrel = PMA_getForeigners($db, $table, '', 'internal');
00254 }
00255 if (isset($destination_innodb) && $tbl_type=='INNODB') {
00256     $existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
00257 }
00258 
00259 if ($cfgRelation['displaywork']) {
00260     $disp     = PMA_getDisplayField($db, $table);
00261 }
00262 
00263 
00268 // common form
00269 echo '<form method="post" action="tbl_relation.php">' . "\n";
00270 echo PMA_generate_common_hidden_inputs($db, $table);
00271 
00272 
00273 // relations
00274 
00275 if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
00276     // To choose relations we first need all tables names in current db
00277     // and if PMA version permits and the main table is innodb,
00278     // we use SHOW TABLE STATUS because we need to find other InnoDB tables
00279 
00280     if ($tbl_type=='INNODB') {
00281         $tab_query           = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
00282     // [0] of the row is the name
00283     // [1] is the type
00284     } else {
00285         $tab_query           = 'SHOW TABLES FROM ' . PMA_backquote($db);
00286     }
00287     // [0] of the row is the name
00288 
00289     $tab_rs              = PMA_DBI_query($tab_query, NULL, PMA_DBI_QUERY_STORE);
00290     $selectboxall['nix'] = '--';
00291     $selectboxall_innodb['nix'] = '--';
00292 
00293     while ($curr_table = @PMA_DBI_fetch_row($tab_rs)) {
00294         if (($curr_table[0] != $table) && ($curr_table[0] != $cfg['Server']['relation'])) {
00295             PMA_DBI_select_db($db);
00296 
00297             // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
00298             $fi_rs    = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($curr_table[0]) . ';', NULL, PMA_DBI_QUERY_STORE);
00299             if ($fi_rs && PMA_DBI_num_rows($fi_rs) > 0) {
00300                 $seen_a_primary = FALSE;
00301                 while ($curr_field = PMA_DBI_fetch_assoc($fi_rs)) {
00302                     if (isset($curr_field['Key_name']) && $curr_field['Key_name'] == 'PRIMARY') {
00303                         $seen_a_primary = TRUE;
00304                         $field_full = $db . '.' .$curr_field['Table'] . '.' . $curr_field['Column_name'];
00305                         $field_v    = $curr_field['Table'] . '->' . $curr_field['Column_name'];
00306                         $selectboxall[$field_full] =  $field_v;
00307                         // there could be more than one segment of the primary
00308                         // so do not break
00309 
00310                         // Please watch here, tbl_type is INNODB but the
00311                         // resulting value of SHOW KEYS is InnoDB
00312 
00313                         if ($tbl_type=='INNODB' && isset($curr_table[1]) && $curr_table[1]=='InnoDB') {
00314                             $selectboxall_innodb[$field_full] =  $field_v;
00315                         }
00316 
00317                     } else if (isset($curr_field['Non_unique']) && $curr_field['Non_unique'] == 0 && $seen_a_primary==FALSE) {
00318                         // if we can't find a primary key we take any unique one
00319                         // (in fact, we show all segments of unique keys
00320                         //  and all unique keys)
00321                         $field_full = $db . '.' . $curr_field['Table'] . '.' . $curr_field['Column_name'];
00322                         $field_v    = $curr_field['Table'] . '->' . $curr_field['Column_name'];
00323                         $selectboxall[$field_full] =  $field_v;
00324                         if ($tbl_type=='INNODB' && isset($curr_table[1]) && $curr_table[1]=='InnoDB') {
00325                             $selectboxall_innodb[$field_full] =  $field_v;
00326                         }
00327 
00328                     // for InnoDB, any index is allowed
00329                     } else if ($tbl_type=='INNODB' && isset($curr_table[1]) && $curr_table[1]=='InnoDB') {
00330                         $field_full = $db . '.' . $curr_field['Table'] . '.' . $curr_field['Column_name'];
00331                         $field_v    = $curr_field['Table'] . '->' . $curr_field['Column_name'];
00332                         $selectboxall_innodb[$field_full] =  $field_v;
00333 
00334                     } // end if
00335                 } // end while over keys
00336             } // end if (PMA_DBI_num_rows)
00337             PMA_DBI_free_result($fi_rs);
00338             unset($fi_rs);
00339         // Mike Beck - 24.07.02: i've been asked to add all keys of the
00340         // current table (see bug report #574851)
00341         }
00342         else if ($curr_table[0] == $table) {
00343             PMA_DBI_select_db($db);
00344 
00345             // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
00346             $fi_rs    = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($curr_table[0]) . ';', NULL, PMA_DBI_QUERY_STORE);
00347             if ($fi_rs && PMA_DBI_num_rows($fi_rs) > 0) {
00348                 while ($curr_field = PMA_DBI_fetch_assoc($fi_rs)) {
00349                     $field_full = $db . '.' . $curr_field['Table'] . '.' . $curr_field['Column_name'];
00350                     $field_v    = $curr_field['Table'] . '->' . $curr_field['Column_name'];
00351                     $selectboxall[$field_full] =  $field_v;
00352                     if ($tbl_type=='INNODB' && isset($curr_table[1]) && $curr_table[1]=='InnoDB') {
00353                         $selectboxall_innodb[$field_full] =  $field_v;
00354                     }
00355                 } // end while
00356             } // end if (PMA_DBI_num_rows)
00357             PMA_DBI_free_result($fi_rs);
00358             unset($fi_rs);
00359         }
00360     } // end while over tables
00361 
00362 } // end if
00363 
00364 
00365 // Now find out the columns of our $table
00366 // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
00367 $col_rs    = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
00368 
00369 if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
00370     while ($row = PMA_DBI_fetch_assoc($col_rs)) {
00371         $save_row[] = $row;
00372     }
00373     $saved_row_cnt  = count($save_row);
00374     echo $tbl_type=='INNODB' ? '' : '<table border="0" cellpadding="0" cellspacing="0">' . "\n"
00375                                   . '    <tr><td valign="top">' . "\n\n";
00376 ?>
00377 
00378     <table cellpadding="2" cellspacing="1">
00379     <tr>
00380         <th colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblHeaders"><b><?php echo $strLinksTo; ?></b></th>
00381     </tr>
00382     <tr>
00383         <th></th>
00384         <?php
00385         if ($cfgRelation['relwork']) {
00386             echo '        <th><b>' .$strInternalRelations;
00387             if ($tbl_type=='INNODB') {
00388                 echo '&nbsp;' . PMA_showHint($strInternalNotNecessary);
00389             }
00390             echo '</b></th>';
00391         }
00392         if ($tbl_type=='INNODB') {
00393             echo '<th colspan="2">InnoDB';
00394             if (PMA_MYSQL_INT_VERSION < 40013) {
00395                 echo '&nbsp;(**)';
00396             }
00397             echo '</th>';
00398         }
00399         ?>
00400     </tr>
00401     <?php
00402     for ($i = 0; $i < $saved_row_cnt; $i++) {
00403         $myfield = $save_row[$i]['Field'];
00404         echo "\n";
00405         ?>
00406     <tr>
00407         <td align="center" bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>"><b><?php echo $save_row[$i]['Field']; ?></b></td>
00408         <?php
00409         if ($cfgRelation['relwork']) { 
00410         ?>
00411         <td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
00412             <select name="destination[<?php echo htmlspecialchars($save_row[$i]['Field']); ?>]">
00413             <?php
00414             echo "\n";
00415 
00416             // PMA internal relations
00417             if (isset($existrel[$myfield])) {
00418                 $foreign_field    = $existrel[$myfield]['foreign_db'] . '.'
00419                          . $existrel[$myfield]['foreign_table'] . '.'
00420                          . $existrel[$myfield]['foreign_field'];
00421             } else {
00422                 $foreign_field    = FALSE;
00423             }
00424             $seen_key = FALSE;
00425             foreach ($selectboxall AS $key => $value) {
00426                 echo '                '
00427                      . '<option value="' . htmlspecialchars($key) . '"';
00428                 if ($foreign_field && $key == $foreign_field) {
00429                     echo ' selected="selected"';
00430                     $seen_key = TRUE;
00431                 }
00432                 echo '>' . $value . '</option>'. "\n";
00433             } // end while
00434 
00435         // if the link defined in relationtable points to a foreign field
00436         // that is not a key in the foreign table, we show the link
00437         // (will not be shown with an arrow)
00438             if ($foreign_field && !$seen_key) {
00439                 echo '                '
00440                      . '<option value="' . htmlspecialchars($foreign_field) . '"';
00441                 echo ' selected="selected"';
00442                 echo '>' . $foreign_field . '</option>'. "\n";
00443             }
00444         ?>
00445             </select>
00446         </td>
00447         <?php
00448         } // end if (internal relations)
00449 
00450         if ($tbl_type=='INNODB') {
00451             if (!empty($save_row[$i]['Key'])) {
00452         ?>
00453         <td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
00454             <select name="destination_innodb[<?php echo htmlspecialchars($save_row[$i]['Field']); ?>]">
00455         <?php
00456                 if (isset($existrel_innodb[$myfield])) {
00457                     $foreign_field    = $existrel_innodb[$myfield]['foreign_db'] . '.'
00458                              . $existrel_innodb[$myfield]['foreign_table'] . '.'
00459                              . $existrel_innodb[$myfield]['foreign_field'];
00460                 } else {
00461                     $foreign_field    = FALSE;
00462                 }
00463 
00464                 $found_foreign_field = FALSE;
00465                 foreach ($selectboxall_innodb AS $key => $value) {
00466                     echo '                '
00467                          . '<option value="' . htmlspecialchars($key) . '"';
00468                     if ($foreign_field && $key == $foreign_field) {
00469                         echo ' selected="selected"';
00470                         $found_foreign_field = TRUE;
00471                     }
00472                     echo '>' . $value . '</option>'. "\n";
00473                 } // end while
00474 
00475             // we did not find the foreign field in the tables of current db,
00476             // must be defined in another db so show it to avoid erasing it
00477                 if (!$found_foreign_field && $foreign_field) {
00478                     echo '                '
00479                          . '<option value="' . htmlspecialchars($foreign_field) . '"';
00480                     echo ' selected="selected"';
00481                     echo '>' . $foreign_field . '</option>'. "\n";
00482                 }
00483 
00484         ?>
00485                 </select>
00486         </td>
00487         <td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
00488         <?php
00489                   PMA_generate_dropdown('ON DELETE',
00490                       htmlspecialchars($save_row[$i]['Field']) . '_on_delete',
00491                       $options_array,
00492                       (isset($existrel_innodb[$myfield]['on_delete']) ? $existrel_innodb[$myfield]['on_delete']: '') );
00493 
00494                   echo '&nbsp;&nbsp;&nbsp;';
00495 
00496                   PMA_generate_dropdown('ON UPDATE',
00497                       htmlspecialchars($save_row[$i]['Field']) . '_on_update',
00498                       $options_array,
00499                       (isset($existrel_innodb[$myfield]['on_update']) ? $existrel_innodb[$myfield]['on_update']: '') );
00500 
00501                 } else {
00502                     echo '<td>' . PMA_showHint($strNoIndex) . '</td>';
00503                 } // end if (a key exists)
00504             } // end if (InnoDB)
00505         ?>
00506         </td>
00507     </tr>
00508         <?php
00509     } // end for
00510 
00511     echo "\n";
00512     if ($tbl_type=='INNODB') {
00513         if (PMA_MYSQL_INT_VERSION < 40013) {
00514             echo '** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') . '<br />';
00515         }
00516     }
00517 
00518     echo $tbl_type=='INNODB' ? '' : "\n\n" . '    </td>' . "\n";
00519     if ($cfgRelation['displaywork']) {
00520         // Get "display_field" infos
00521         $disp = PMA_getDisplayField($db, $table);
00522 
00523         ?>
00524 
00525     <tr>
00526         <td height="5"></td>
00527     </tr>
00528     <tr>
00529         <td class="tblHeaders">
00530             <b><?php echo $strChangeDisplay . ': '; ?></b>
00531         </td>
00532     </tr>
00533     <tr>
00534         <td>
00535             <select name="display_field" style="vertical-align: middle">
00536                 <option value="">---</option>
00537         <?php
00538         foreach ($save_row AS $row) {
00539             echo '                <option value="' . htmlspecialchars($row['Field']) . '"';
00540             if (isset($disp) && $row['Field'] == $disp) {
00541                 echo ' selected="selected"';
00542             }
00543             echo '>' . htmlspecialchars($row['Field']) . '</option>'. "\n";
00544         } // end while
00545         ?>
00546             </select>
00547         </td>
00548     </tr>
00549         <?php
00550     } // end if (displayworks)
00551 ?>
00552     <tr>
00553         <td colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblFooters">
00554             <input type="submit" value="<?php echo '  ' . $strSave . '  '; ?>" />
00555         </td>
00556     </tr>
00557     </table>
00558 </form>
00559 
00560 <?php
00561 } // end if (we have columns in this table)
00562 
00563 
00567 require_once('./footer.inc.php');
00568 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6