Xataface 2.0
Xataface Application Framework
HTML/QuickForm/related_select.php
Go to the documentation of this file.
00001 <?php
00011 require_once 'HTML/QuickForm/select.php';
00012 require_once 'Dataface/Relationship.php';
00013 require_once 'Dataface/QueryTool.php';
00014 require_once 'Dataface/DB.php';
00015 class HTML_QuickForm_related_select extends HTML_QuickForm_select {
00016         
00017         function HTML_QuickForm_related_select( &$relationship ){
00018                 $sql = $relationship->getDomainSQL();
00019                         // The sql query to return all candidate rows of relationship
00020                 $fkeys = $relationship->getForeignKeyValues();
00021                         // Values of foreign keys (fields involved in where and join clauses)
00022                 $table = $relationship->getDomainTable();
00023                 if ( isset( $fkeys[$table] ) ){
00024                         $query = $fkeys[$table];
00025                         foreach ($query as $key=>$val){
00026                                 if ( strpos($val,'$')===0 or $val == '__'.$table.'__auto_increment__'){
00027                                         unset($query[$key]);
00028                                 }
00029                         }
00030                 } else {
00031                         $query = array();
00032                 }
00033                 $qt = new Dataface_QueryTool($table, $relationship->_sourceTable->db, $query);
00034                 $options = $qt->getTitles();
00035                 //print_r($options);
00036                 
00037                 $this->HTML_QuickForm_select('test','test',$options);
00038                 
00039                 echo $this->toHtml();
00040                 
00041         
00042         }
00043 
00044 
00045 }
00046 
00047 
 All Data Structures Namespaces Files Functions Variables Enumerations