/**
  * method: execute
  *
  * execute the application, or process a web service, depending on the type of the route
  *
  * NOTE:
  * 	-	if the route has type='service' we are going to process a webservice
  * 	-	override this default behaviour by overriding this method with a customised version
  */
 public function execute($params = array())
 {
     //	If the url executed belonds to a web service, run the service code
     //	NOTE:	this isService() call, I think is a bit hacky, I would
     //			like to do away with it and have the framework do it
     if (Amslib_Router::isService()) {
         $this->runService();
     }
     //	Get the current route and acquire the api object for the current route and render it
     //	NOTE:	we do this so you can render pages from other plugins or the application based
     //			on what route has been opened, sometimes you want to define webpages in separate
     //			plugins and render them just based on the url and/or route
     $route = Amslib_Router::getRoute();
     if (!$route || !isset($route["group"])) {
         Amslib_Debug::log("ROUTE OR ROUTE/GROUP DOES NOT EXIST", $route);
         return;
     }
     $api = $this->getAPI($route["group"]);
     if (!$api || !method_exists($api, "render")) {
         Amslib_Debug::log("API OR ITS RENDER METHOD DOES NOT EXIST", get_class($api), $route);
         return;
     }
     //	If the url executed belongs to a page, render the default view of the application
     print $api->render("default", $params);
 }
Beispiel #2
0
 /**
  * 	method:	getRoute
  *
  * 	todo: write documentation
  */
 public function getRoute($name = NULL)
 {
     return Amslib_Router::getRoute($name, $this->getName());
 }