/** * Gets and renders the rows for the given module/action. * The output is written directly to the response. * * It serves three types of requests: * 1) It serves JSON data for a ExtJs store. * 2) It serves CSV export of the data when af_format=csv. * 3) It serves CVS export of a selection when * af_format=csv and selections=[row,...]. */ public static function renderList($request, $module, $action, afDomAccess $view) { $selections = $request->getParameter('selections'); if ($selections) { $source = new afSelectionSource(json_decode($selections, true)); } else { $source = afDataFacade::getDataSource($view, $request->getParameterHolder()->getAll()); } // For backward compatibility, the session is not closed // before calling a static datasource. if ($source instanceof afPropelSource) { afOutput::closeSessionWriteLock(); } $format = $request->getParameter('af_format'); if ($format === 'csv') { return self::renderCsv($action, $source); } else { if ($format === 'pdf') { return self::renderPdf($view, $source); } } return self::renderJson($view, $source); }
public static function fetchDataInstance($view) { list($callback, $params) = afDataFacade::getDataSourceCallback($view); return afCall::funcArray($callback, $params); }