Example #1
0
 public function test_action_residence_page()
 {
     $url = "http://localhost/land/ES/sted/Costa%20Blanca/bolig/3-roms-leilighet";
     $action = new DF_Web_Action('Residences', 'handle_show', array());
     $actions = $this->routing->find_actions_by_url($url);
     if ($actions) {
         $this->pass("Found some actions");
         $this->assertEqual($action->toString(), $actions[count($actions) - 1]->toString());
     } else {
         $this->fail("No actions found");
     }
 }
Example #2
0
 /**
  * 
  * @param DF_Web_Action $action
  */
 public function execute_action($action)
 {
     if (!$action instanceof DF_Web_Action) {
         throw new DF_Error_InvalidArgumentException("action", $action, "DF_Web_Action");
     }
     $class = $action->get_controller();
     $controller = $this->controller($class);
     // Add the action to the stack
     $this->stack[] = $action;
     $ret = $action->execute($controller, $this);
     // Removing the last action from the stack after it returns
     array_pop($this->stack);
     return $ret;
 }
Example #3
0
        $method_path = $this->get_method_private_path();
        return "{$controller_path}/{$method_path}";
    }
    protected function get_method_private_path()
    {
        $path = preg_replace('|^handle_(.+)$|', '$1', $this->get_method());
        return $path;
    }
    protected function get_controller_private_path()
    {
        $path = strtolower($this->get_controller());
        $path = preg_replace('#_#', '/', $path);
        return $path;
    }
    public function toString()
    {
        $args = "";
        if ($this->arguments) {
            $args = DF_Web_Utils_Arguments::flatten_arguments_list($this->arguments);
        }
        $ctrl = $this->controller;
        $method = $this->method;
        return "{$ctrl}->{$method}({$args})";
    }
    public function __toString()
    {
        return $this->toString();
    }
}
DF_Web_Action::$LOGGER = DF_Web_Logger::logger('DF_Web_Action');