コード例 #1
0
 public function preExecute()
 {
     afOutput::closeSessionWriteLock();
     sfConfig::set('sf_web_debug', false);
     $this->setLayout(false);
     $max_age = sfConfig::get('app_sfCombinePlugin_client_cache_max_age', false);
     if ($max_age !== false) {
         $lifetime = $max_age * 86400000;
         // 24*60*60*1000
         $this->getResponse()->addCacheControlHttpHeader('max-age', $lifetime);
         $this->getResponse()->setHttpHeader('Pragma', null, false);
         $this->getResponse()->setHttpHeader('Expires', null, false);
     }
 }
コード例 #2
0
 /**
  * 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);
 }