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 57 58 59 60 61 62 63 64 65 66 67
| // ==============================================================================================================================
class IOdispatch // extends Member
{ public $RC ;
private $obj, $IOenv ;
private $instantiated = array ( "MEMBER" => NULL ,
"SCREEN" => NULL
) ;
function __construct($IOenv, $table, $id = "default")
{ global $in ;
$this->IOenv = $IOenv ;
switch($table)
{ case "Member" : $in[$id] = $this->obj = new Member($IOenv) ;
break ;
case "Screen" : $in[$id] = $this->obj = new Screen($IOenv) ;
break ;
default: user_error("Table not yet defined[". $table ."] => fatal error !" , E_USER_ERROR) ;
}
return($this->obj) ;
}
function __call($method, $args)
{ //$this->obj = new Member($this->IOenv) ;
if ($this->obj == NULL) echo "null" ; echo NULL
return( call_user_func_array( array( $this->obj , $method) , $args ) ) ;
}
}
// ==============================================================================================================================
class Environ extends IOdispatch
{ public $RC ;
public $IOenv = array ( HOST => "jecrapahute" ,
USER => "root" ,
PASS => "********" ,
BASE => "jecrapah"
) ;
function __construct($table)
{
// user_error("Environ instantiated" , E_USER_NOTICE) ;
echo "Environ OK - " . crlf() ;
return( new IOdispatch($this->IOenv, $table) ) ;
}
}
// ==============================================================================================================================
class Skeleton extends Environ
{ public $RC ;
function __construct()
{
// user_error("Skeleton instantiated" , E_USER_NOTICE) ;
echo "Skeleton OK - " . crlf() ;
return( new Environ("Member") ) ;
}
}
$skelt = new Skeleton() ;
// $obj = $this->RC[MEMBER] ;
$skelt->open( "skelt" ) ; |
Partager