The client side version in JavaScript is here
This is the server side version of my control module. How does the structure look.
PostScript
Because this is a small prototype/app I have preferences or things I will consider when I will have a working prototype, they are - testing, try/catch/throw handling of errors, advanced abstractions / design patterns, defensive coding against programmer error / malicious users. Auto-Loading, optimization Will add these later if the project matures.
<?php
function __autoload( $class_name ) { include 'class.' . $class_name . '.php'; }
$object_c = new CMachine();
$object_c->invoke();
class CMachine
{
public function invoke()
{
$pipe = $this->getPipe();
switch( $pipe['model'] )
{
case 'MUserNew': case 'MUserExist':
$model_object = new $pipe['model']( new SDB(), new SUniversals() , new SText( $pipe['page'] ), new SMessage() );
$this->send( $model_object->invoke( $pipe['args'] ) );
break;
case 'MUserTry':
$model_object = new $pipe['model']( new SDB(), new SText( $pipe['page'] ) );
$test = $model_object->invoke( $pipe['args'] );
$this->send( $test );
break;
case 'MUserAny': case 'MOrb':
$model_object = new $pipe['model']( new SDB() );
$this->send( $model_object->invoke( $pipe['args'] ) );
break;
default:
echo " -> Undefined Module Requested";
}
}
private function send( $string_send )
{
echo "|A|" . $string_send;
}
private function getPipe()
{
return json_decode( $_POST['pipe'], true );
}
}