public static function initialize($action)
 {
     $widgetLoadJson = $action->hasRequestParameter("widget_load_json") ? $action->getRequestParameter("widget_load_json") : "true";
     if (!in_array($widgetLoadJson, array("true", "false"))) {
         $widgetLoadJson = "true";
     }
     //Check for the widget load request
     if ($action->getRequestParameter("widget_load") && $action->getRequestParameter("widget_load") != "false") {
         if (!$action->isPageComponent) {
             $context = sfContext::getInstance();
             $profiler = $context->has('profiler') ? $context->get('profiler') : null;
             if ($profiler) {
                 $profiler->sendHeaders();
             }
             sfConfig::set('app_parser_panels', array());
             sfConfig::set('app_parser_skip_toolbar', true);
             $w = new afExtjsAjaxLoadWidgets();
             echo $widgetLoadJson == 'true' ? json_encode($w->getSourceForCenterLoad()) : print_r($w->getSourceForCenterLoad());
             if ($profiler) {
                 $profiler->collectFromContext();
             }
             exit;
         }
     } elseif ($action->getRequestParameter("widget_popup_request")) {
         if (!$action->isPageComponent) {
             $context = sfContext::getInstance();
             $profiler = $context->has('profiler') ? $context->get('profiler') : null;
             if ($profiler) {
                 $profiler->sendHeaders();
             }
             sfConfig::set('app_parser_panels', array());
             sfConfig::set('app_parser_skip_toolbar', true);
             $w = new afExtjsAjaxLoadWidgets();
             echo $widgetLoadJson == 'true' ? json_encode($w->getSourceForPopupLoad()) : print_r($w->getSourceForPopupLoad());
             if ($profiler) {
                 $profiler->collectFromContext();
             }
             exit;
         }
     }
     return false;
     /*************************************************************/
 }
 /**
  * All AppFlower actions should be rendered by AJAX widget load.
  * Otherwise, it is assumed that it is a request for
  * the first page with menu and toolbar.
  *
  * Bookmarks /#/module/action use the first page.
  * The browser isn't sending the fragment to the server.
  * So the first page is rendered instead.
  */
 protected function isFirstPageRequest($actionInstance)
 {
     return $actionInstance->getRequest()->isMethod('GET') && !$actionInstance->getRequest()->isXmlHttpRequest() && !afExtjsAjaxLoadWidgets::isWidgetRequest() && $this->isWidgetAction($actionInstance);
 }
 public static function layoutExt($actionInstance)
 {
     if ($actionInstance->isPageComponent) {
         return sfView::SUCCESS;
     }
     //used in ajax loading widgets
     afExtjsAjaxLoadWidgets::initialize($actionInstance);
     sfApplicationConfiguration::getActive()->loadHelpers("Helper");
     $parser = new XmlParser();
     $actionInstance->layout = $parser->getLayout();
     self::setLayoutAppFlower($actionInstance);
     self::setTemplateAppFlower($actionInstance);
     return sfView::SUCCESS;
 }