1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<?php
// File jsrs/table_column_request.php / ibWebAdmin
// Purpose return a selectlist with the columns of a table as options
// Author Lutz Brueckner <irie@gmx.de>
// Copyright (c) 2000, 2001, 2002, 2003, 2004 by Lutz Brueckner,
// published under the terms of the GNU General Public Licence v.2,
// see file LICENCE for details
// Created <24/08/03 14:33:21 lb>
//
// $Id: table_columns_request.php,v 1.3 2004/03/28 11:29:00 lbrueckner Exp $
require('../inc/configuration.inc.php');
require('../inc/session.inc.php');
require('../inc/functions.inc.php');
require('../inc/panel_elements.inc.php');
require('jsrsServer.php.inc');
if (DEBUG === TRUE) {
include('../inc/debug_funcs.inc.php');
}
session_start();
localize_session_vars();
// answer to the request with the result of get_fk_values()
jsrsDispatch('table_columns_selectlist');
// build the answer for the jsrs request
function table_columns_selectlist($table, $target, $restriction){
$columns = array();
foreach ($GLOBALS['s_fields'] as $field) {
if ($field['table'] <> $table ) {
continue;
}
if ($restriction == 'fk'
&& !isset($field['primary']) && !isset($field['unique'])) {
continue;
}
$columns[] = $field['name'];
}
if (count($columns) > 0) {
$html = get_selectlist($target, $columns, NULL, TRUE);
}
else {
$html = get_textfield($target, 20, 31);
}
return jsrsArrayToString(array($target, $html), $delim='~');
}
?>
|