예제 #1
0
 function init()
 {
     try {
         foreach ($this->_server->controller_params as $i => $value) {
             switch ($i) {
                 case 0:
                     $this->_processClass = $value;
                     require_once 'Oops/Process/Helper.php';
                     $this->_processClassHelper = Oops_Process_Helper::getInstance($this->_processClass);
                     break;
                 case 1:
                     $this->_processId = $value;
                     require_once 'Oops/Process/Factory.php';
                     $this->_processObject = Oops_Process_Factory::getProcess($this->_processId);
                     if (strtolower(get_class($this->_processObject)) != $this->_processClass) {
                         require_once 'Oops/Process/Exception.php';
                         throw new Oops_Process_Exception("Process with id {$this->_processId} can't be invoked under {$this->_processClass} controller", OOPS_PROCESS_EXCEPTION_INVALID_CLASS);
                     }
                     break;
                 default:
                     /**
                      * More than 2 params, do something special?
                      */
             }
         }
     } catch (Oops_Process_Exception $e) {
         /**
          * Init error - invalid class, invalid process id, invalid process data
          * TODO workout th exception
          */
     }
 }
예제 #2
0
 /**
  * Instantiate process storage object, singleton pattern implemented.
  * 
  * @return Oops_Process_Storage
  */
 public static function getStorage()
 {
     if (!is_object(self::$_storage)) {
         // @todo Use config
         self::$_storage = new Oops_Process_Storage();
     }
     return self::$_storage;
 }
예제 #3
0
 /**
  * Stores this process
  * 
  * @return bool True on success
  */
 protected final function _store($ticket)
 {
     $data = array('class' => get_class($this), 'currentState' => $this->_currentState, 'ticket' => $ticket, 'variables' => array());
     foreach ($this->_variables as $name => $access) {
         $data['variables'][$name] = $this->{'_' . $name};
     }
     /**
      * 
      * @var Oops_Process_Storage $storage
      */
     $storage = Oops_Process_Factory::getStorage();
     return $storage->set($this->_pid, $data);
 }