예제 #1
0
 /**
  * Gets the view of the export. This method will first add default export decorators if none were added.
  * @param string $extension extension to get the export from
  * @return zibo\libray\html\table\export\ExportView view for the export
  */
 public function getExportView($extension)
 {
     if ($this->exportColumnDecorators || $this->exportGroupDecorators) {
         return parent::getExportView($extension);
     }
     $meta = $this->model->getMeta();
     $properties = $meta->getProperties();
     foreach ($properties as $fieldName => $property) {
         $type = $property->getType();
         switch ($type) {
             case 'boolean':
                 $decorator = new BooleanDecorator($fieldName);
                 break;
             case 'date':
             case 'datetime':
                 $decorator = new DateDecorator($fieldName);
                 break;
             default:
                 $decorator = new ValueDecorator($fieldName);
                 break;
         }
         $this->addExportDecorator($decorator, new StaticDecorator(ucfirst($fieldName)));
     }
     return parent::getExportView($extension);
 }
 /**
  * Performs an export of the provided table and sets the view of the export to the response
  * @param zibo\library\html\table\ExtendedTable $table Table to get the export of
  * @param string $extension The extension for the export
  * @return null
  */
 protected function performExport(ExtendedTable $table, $extension)
 {
     ini_set('memory_limit', '512M');
     ini_set('max_execution_time', '500');
     ini_set('max_input_time', '500');
     $title = $this->getViewTitle();
     $table->setExportTitle($title);
     $view = $table->getExportView($extension);
     $this->response->setView($view);
 }