/**
  * Prepares the controller
  * @param Controller $controller The controller to prepare
  * @param Request $request The request for the controller
  * @param Response $response The response for the controller
  * @param string $actionName The method which will be invoked
  * @param array $parameters The parameters for that method
  * @return null
  */
 protected function prepareController(Controller $controller, Request $request, Response $response, $actionName, array $parameters)
 {
     if (!$this->passRequestParameters) {
         $request = new Request($request->getBaseUrl(), $request->getBasePath(), $request->getControllerName(), Dispatcher::ACTION_INDEX);
     }
     $this->widget->setRequest($request);
     $this->widget->setResponse($response);
 }
Example #2
0
 /**
  * Compares the names 2 widgets
  * @return integer 0 when the widgets have the same name, -1 when $widgetA comes before $widgetB and 1 otherwise
  */
 public function widgetCompare(Widget $widgetA, Widget $widgetB)
 {
     $a = $widgetA->getName();
     $b = $widgetB->getName();
     if ($a == $b) {
         return 0;
     }
     return $a < $b ? -1 : 1;
 }
 /**
  * Dispatch a widget
  * @param zibo\core\Request $request
  * @param zibo\core\Response $response
  * @param int $widgetId id of the widget
  * @param zibo\library\widget\controller\Widget $widget instance of the widget
  * @return null
  */
 private function dispatchWidget(Request $request, Response $response, $widgetId, Widget $widget)
 {
     $widgetSettings = new WidgetSettings($widgetId, $this->node->settings);
     $widget->setIdentifier($widgetId);
     $widget->setProperties($widgetSettings);
     $widget->setLocale($this->node->dataLocale);
     $this->widgetDispatcher->setWidget($widget);
     $this->widgetDispatcher->dispatch($request, $response);
 }