Ejemplo n.º 1
0
 /**
  * Renders the view.
  * This is the main entry of the whole view rendering.
  * Child classes should mainly override {@link renderContent} method.
  */
 public function run()
 {
     if (!$this->json) {
         parent::run();
     } else {
         $this->registerClientScript();
         $this->renderContent();
     }
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public function run()
 {
     if ($this->multiActions || $this->gridActions || $this->gridButtons) {
         echo CHtml::openTag('div', array('id' => $this->id . '-multi-checkbox', 'class' => 'multi-checkbox-table')) . "\n";
         echo CHtml::beginForm('', 'POST', array('id' => $this->id . '-form'));
         echo CHtml::hiddenField('returnUrl', Yii::app()->returnUrl->getFormValue(true));
     }
     parent::run();
     if ($this->multiActions || $this->gridActions || $this->gridButtons) {
         echo CHtml::endForm();
         echo CHtml::closeTag('div');
     }
 }
Ejemplo n.º 3
0
 public function run()
 {
     if ($this->grid_mode == 'export') {
         $this->renderHeader();
         $row = $this->renderBody();
         $this->renderFooter($row);
         //set auto width
         if ($this->autoWidth) {
             foreach ($this->columns as $n => $column) {
                 $this->objPHPExcel->getActiveSheet()->getColumnDimension($this->columnName($n + 1))->setAutoSize(true);
             }
         }
         //create writer for saving
         $objWriter = PHPExcel_IOFactory::createWriter($this->objPHPExcel, $this->exportType);
         if (!$this->stream) {
             $objWriter->save($this->filename);
         } else {
             //output to browser
             if (!$this->filename) {
                 $this->filename = $this->title;
             }
             $this->cleanOutput();
             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
             header('Pragma: public');
             header('Content-type: ' . $this->mimeTypes[$this->exportType]['Content-type']);
             header('Content-Disposition: attachment; filename="' . $this->filename . '.' . $this->mimeTypes[$this->exportType]['extension'] . '"');
             header('Cache-Control: max-age=0');
             $objWriter->save('php://output');
             Yii::app()->end();
         }
     } else {
         parent::run();
     }
 }