Source for file DBKeyRadioGroup.class.php
Documentation is available at DBKeyRadioGroup.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
require_once( CLASSPATH. "forms/items/HTMLRadioGroup.class.php" );
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (C) 2006 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @var array $label_fields
* @author Daniel Plücken <daniel@debakel.net>
* @param string $name The name-attribute this select
* @param string $selectedValue The preselected value this select
* @param object|array$dbt Naturally you have to give the
* reference of an object of a
* database table, how they can be
* found in package databases, as
* You can also give the parameter dbt
* If you use $dbt by array-syntax,
* you have to put the handle of the
* database connection at index zero,
* the source databasetable at index
* one and the database type
* ( e. g. "mysql" ) at index two.
* @param string|array$label_fields You can give one fieldname of the
* databasetable by string type or you
* can give more fieldnames as an
* array that contains them by string
* type. This fieldnames builds the
* labels of the option-tags they will
* be separated by a space.
* @param string $key_field This fieldname should be in best
* case a primary key to identify the
* @param string $where The where-clause of the db-query.
* @param string $onChangeOrder A javascript that should execute
* after changing a value of this
* @param string $preselect_field The dataset in which this field is
* greater than zero will be preselect
* if the parameter $selectedValue is
is_a( $dbt, "ABSTDatabaseTable" )
|| is_a( $dbt, "ABSTView" )
!empty( $preselect_field )
&& empty( $selectedValue )
$resArr = $this->dbt->getDatasetsWithFields( $tmp_arr, $this->where );
for ( $i = 0; $i < count( $resArr ); $i++ )
"!^[-_a-z0-9]*\.[-_a-z0-9]+$!",
$tmp .= ( $k == 0 ? "" : " " )
$tmp .= ( $k == 0 ? "" : " " )
"!^[-_a-z0-9]*\.([-_a-z0-9]+)$!",
$valueArr[] = $resArr[$i][$key_field];
!empty( $preselect_field )
&& !in_array( $selectedValue, $valueArr )
&& $resArr[$i][$preselect_field] > 0
$selectedValue = $resArr[$i][$key_field];
// Use this item in conventional php kind.
$sql = "SELECT ". implode( ", ", $tmp_arr ). " "
$tmp .= ( $k == 0 ? "" : " " )
echo "<b>The given third parameter is not a valid reference to a "
. "databasetable!</b>\r\n";
echo "<b>BACKTRACE DEBUG:</b>\r\n";
* Returns the last stored database query.
* @author Daniel Plücken <daniel@debakel.net>
{ return $this->dbt->getLastQuery(); }
} // end of class DBKeyRadioGroup
|