Location: PHPKode > scripts > DABAJAX Toolkit > dabajax-toolkit/Controller.php
<?php
   /**
     EXAMPLE OF A CONTROLLER
   **/
	require_once "AjaxControlFiller.class.php";
	require_once "AjaxOptionsValidator.interface.php";
	require_once "BusValidator.example.php";
	
	/* retrieving values from XMLHttpRequest */
	$jsons	= $_POST["jsonstring"];
	$jsons	= str_replace("\\", "", $jsons);	
	$data		= json_decode($jsons);
	$options = $_POST;
	
    // cria a variavel de resolucao do TNS
    $db = "(DESCRIPTION = 
    	(ADDRESS = (PROTOCOL = TCP)
    		(HOST = yourhost)(PORT=1521)) 
    	(SERVICE_NAME = yourSID) 
           (FAILOVER_MODE = 
               (TYPE = SELECT) 
               (METHOD = BASIC) 
               (RETRIES = 180) 
               (DELAY = 5) 
           ) 
    	))";
    
    if (!$conn = @oci_connect("user", "passwd", $db)) {
       echo "could not connect to database";
       exit();
    } else {
    
       // example of a validator 
       $validator = new UserValidator( $conn );
       
       $control = new AjaxControlFiller( $conn );
       $control->setAjaxf( $data );
       $control->setOptions( $options );
       //$control->setOptionValidator( $validator );
       $ret = $control->getResults();
       if (!$ret) {
          echo json_encode( $control->getErrors() );
       }
       echo $ret;
    }
?>
Return current item: DABAJAX Toolkit