Documentation TYPO3 par Ameos

get_foreign.lib.php

00001 <?php
00002 /* $Id: get_foreign.lib.php,v 2.2 2003/11/26 22:52:23 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00012 // lem9: we always show the foreign field in the drop-down; if a display
00013 // field is defined, we show it besides the foreign field
00014 $foreign_link = false;
00015 if ($foreigners && isset($foreigners[$field])) {
00016     $foreigner       = $foreigners[$field];
00017     $foreign_db      = $foreigner['foreign_db'];
00018     $foreign_table   = $foreigner['foreign_table'];
00019     $foreign_field   = $foreigner['foreign_field'];
00020 
00021     // Count number of rows in the foreign table. Currently we do
00022     // not use a drop-down if more than 200 rows in the foreign table,
00023     // for speed reasons and because we need a better interface for this.
00024     //
00025     // We could also do the SELECT anyway, with a LIMIT, and ensure that
00026     // the current value of the field is one of the choices.
00027 
00028     $the_total   = PMA_countRecords($foreign_db, $foreign_table, TRUE);
00029 
00030     if ((isset($override_total) && $override_total == true) || $the_total < 200) {
00031         // foreign_display can be FALSE if no display field defined:
00032 
00033         $foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
00034         $dispsql         = 'SELECT ' . PMA_backquote($foreign_field)
00035                          . (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display))
00036                          . ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table)
00037                          . (($foreign_display == FALSE) ? '' :' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display))
00038                          . (isset($foreign_limit) ? $foreign_limit : '');
00039         $disp            = PMA_mysql_query($dispsql);
00040     }
00041     else {
00042         unset($disp);
00043         $foreign_link = true;
00044     }
00045 } // end if $foreigners
00046 
00047 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6