Xataface 2.0
Xataface Application Framework
Dataface/RelationshipTool.php
Go to the documentation of this file.
00001 <?php
00002 /*-------------------------------------------------------------------------------
00003  * Xataface Web Application Framework
00004  * Copyright (C) 2005-2008 Web Lite Solutions Corp (shannah@sfu.ca)
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *-------------------------------------------------------------------------------
00020  */
00030 require_once 'SQL/Parser.php';
00031 
00032 class Dataface_RelationshipTool {
00033 
00034 
00035         var $_table;
00036         var $_parser;
00037         
00038         function Dataface_RelationshipTool($tablename){
00039                 $this->_table =& Dataface_Table::loadTable($tablename);
00040                 $this->_parser = new Sql_parser();
00041         }
00042         
00043         
00044         public static function getInstance($tablename){
00045                 static $instances = array();
00046                 if (!isset($instances[$tablename]) ){
00047                         $instances[$tablename] = new Dataface_RelationshipTool($tablename);
00048                 }
00049                 return $instances[$tablename];
00050         }
00051         
00052         
00053 
00054         function isRemoveable($relationship_name){}
00055         function isLinkable($relationship_name){}
00056         function isUnlinkable($relationship_name){}
00057         
00058         function isAddable($relationship_name){
00059                 $r =& $this->_table->getRelationship($relationship_name);
00060                 $sql = $this->_table->parseString($r['sql']);
00061                 echo $sql;
00062                 $struct = $this->_parser->parse($sql);
00063                 print_r($struct);
00064                 
00065                 $where_clause = $struct['where_clause'];
00066                 
00067                 
00068         }
00069                         
00070                         
00071                         
00072                 
00073 
00074 
00075 
00076 }
 All Data Structures Namespaces Files Functions Variables Enumerations