private function dispatchColumns(Request $request, Response $response, WidgetDispatcher $dispatcher)
 {
     $locale = I18n::getInstance()->getLocale();
     $locale = $locale->getCode();
     $widgetModel = WidgetModel::getInstance();
     $views = array();
     foreach ($this->order as $columnNumber => $widgetIds) {
         $views[$columnNumber] = array();
         foreach ($widgetIds as $widgetId) {
             $widget = $this->getWidget($widgetId);
             $instance = $widgetModel->getWidget($widget->getNamespace(), $widget->getName());
             $instance->setIdentifier($widgetId);
             $instance->setProperties($widget->getWidgetProperties());
             $instance->setLocale($locale);
             $widget->setTitle($instance->getName());
             $widget->setHasProperties($instance->hasProperties());
             $dispatcher->setWidget($instance);
             $dispatcher->dispatch($request, $response);
             if ($response->willRedirect()) {
                 break 2;
             }
             $view = $response->getView();
             $response->setView(null);
             if ($view instanceof FileView) {
                 return $view;
             }
             $views[$columnNumber][$widgetId] = $view;
         }
     }
     return $views;
 }
 /**
  * Action to dispatch to the properties of a widget
  * @param string $id id of the widget
  * @return null
  */
 public function propertiesAction($id)
 {
     $widgetSettings = new WidgetSettings($id, $this->node->settings);
     $widget = $this->models['Widget']->getWidget($id);
     $widget->setProperties($widgetSettings);
     $widget->setLocale(LocalizeController::getLocale());
     $baseUrl = $this->request->getBasePath();
     $basePath = $baseUrl . '/properties/' . $id;
     $controller = get_class($widget);
     $action = Widget::METHOD_PROPERTIES;
     $parameters = func_get_args();
     array_shift($parameters);
     $request = new Request($baseUrl, $basePath, $controller, $action, $parameters);
     $widgetDispatcher = new WidgetDispatcher();
     $widgetDispatcher->setWidget($widget);
     if ($widgetDispatcher->dispatch($request, $this->response, false)) {
         $this->models['NodeSetting']->setNodeSettings($widgetSettings);
         $this->clearCache();
     }
     $propertiesView = $this->response->getView();
     $view = new WidgetPropertiesView($this->getSiteSelectForm(), $this->site, $this->node, $widget, $propertiesView);
     $this->response->setView($view);
 }
 /**
  * Action to edit the properties of a widget
  * @param string $widgetId Id of the widget
  * @return null
  */
 public function propertiesAction($widgetId)
 {
     $locale = I18n::getInstance()->getLocale();
     $locale = $locale->getCode();
     $widgetModel = WidgetModel::getInstance();
     $widget = $this->dashboard->getWidget($widgetId);
     $instance = $widgetModel->getWidget($widget->getNamespace(), $widget->getName());
     $instance->setProperties($widget->getWidgetProperties());
     $instance->setLocale($locale);
     $baseUrl = $this->request->getBasePath();
     $basePath = $this->request->getBasePath() . '/properties/' . $widgetId;
     $controller = get_class($instance);
     $action = Widget::METHOD_PROPERTIES;
     $parameters = array_slice(func_get_args(), 2);
     $request = new Request($baseUrl, $basePath, $controller, $action, $parameters);
     $widgetDispatcher = new WidgetDispatcher();
     $widgetDispatcher->setWidget($instance);
     $widgetDispatcher->dispatch($request, $this->response, false);
     if ($this->response->willRedirect()) {
         $this->response->setView(null);
         return;
     }
     $propertiesView = $this->response->getView();
     $view = new WidgetPropertiesView($instance->getName(), $propertiesView);
     $this->response->setView($view);
 }