当前位置: 首页>>代码示例>>PHP>>正文


PHP CGridView::run方法代码示例

本文整理汇总了PHP中CGridView::run方法的典型用法代码示例。如果您正苦于以下问题:PHP CGridView::run方法的具体用法?PHP CGridView::run怎么用?PHP CGridView::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGridView的用法示例。


在下文中一共展示了CGridView::run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 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 {
             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();
     }
 }
开发者ID:cicb,项目名称:tpc,代码行数:33,代码来源:EExcelView.php

示例2: run

 public function run()
 {
     if ($this->grid_mode == 'export') {
         if ($this->company) {
             self::$activeSheet->setCellValue('A' . (string) ($this->offset - 2), $this->company, true);
         }
         if ($this->rate_line) {
             self::$activeSheet->setCellValue('A' . (string) ($this->offset - 1), $this->rate_line, true);
         }
         $this->renderHeader();
         $row = $this->renderBody();
         $this->renderFooter($row);
         //set auto width
         if ($this->autoWidth) {
             foreach ($this->columns as $n => $column) {
                 $cell = self::$activeSheet->getColumnDimension($this->columnName($n + 1))->setAutoSize(true);
             }
         }
         // Set some additional properties
         self::$activeSheet->setTitle($this->sheetTitle)->getSheetView()->setZoomScale($this->zoomScale);
         self::$activeSheet->getHeaderFooter()->setOddHeader('&C' . $this->sheetTitle)->setOddFooter('&L&B' . self::$objPHPExcel->getProperties()->getTitle() . $this->pageFooterText);
         self::$activeSheet->getPageSetup()->setPrintArea('A1:' . $this->columnName(count($this->columns)) . ($this->offset + $row + 2))->setFitToWidth();
         //create writer for saving
         $objWriter = PHPExcel_IOFactory::createWriter(self::$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();
     }
 }
开发者ID:dbrisinajumi,项目名称:tlbexcelview,代码行数:44,代码来源:tlbExcelView.php

示例3: run

 public function run()
 {
     if (Yii::app()->getRequest()->getIsAjaxRequest()) {
         $this->runAjax();
     } else {
         parent::run();
     }
 }
开发者ID:sam-it,项目名称:yii1-datatables,代码行数:8,代码来源:DataTable.php

示例4: run

 public function run()
 {
     return parent::run();
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:4,代码来源:GridView.php

示例5: run

 /**
  *
  */
 public function run()
 {
     if ($this->export) {
         ob_end_clean();
         // any output before should be ignored
         ob_start();
         $this->renderContent();
         $data = ob_get_contents();
         ob_end_clean();
         $filename = Yii::app()->params['tmpDirPath'] . "/export" . str_replace(" ", "_", $this->title) . "_" . date("dmY") . ".csv";
         /** @var $file CFile */
         $file = Yii::app()->file->set($filename);
         $file->create();
         $file->setMimeType("application/vnd.ms-excel");
         $file->setContents(print_r($data, true))->download();
         Yii::app()->end();
     } else {
         if ($this->newLayout) {
         } else {
         }
         echo '<fieldset class="white bordered">';
         $this->renderTitle();
         $this->renderActions();
         parent::run();
         echo '</fieldset>';
     }
     $session = Yii::app()->session;
     $sorter = $this->dataProvider->getSort();
     $key = $this->getId() . "_" . $sorter->sortVar;
     if (isset($_GET[$sorter->sortVar])) {
         $session->add($key, serialize($sorter));
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:36,代码来源:AdminGridView.php

示例6: run

 public function run()
 {
     if ($this->grid_mode == 'export') {
         if ($this->exportType == "PDF") {
             $this->pdf->addPage();
             // TITLE
             $this->pdf->SetFont('helvetica', 'B', 16);
             $this->pdf->Write(0, $this->title, '', 0, 'L', true, 0, false, false, 0);
             $this->pdf->Ln(3);
             $this->renderBody();
             $this->pdf->Output();
         } else {
             if ($this->exportType == "WORD") {
                 $this->TBS->NoErr = true;
                 $this->renderHeader();
                 $this->renderBody();
                 $this->TBS->Show(OPENTBS_DOWNLOAD, 'template.docx');
             } else {
                 $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 {
                     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();
     }
 }
开发者ID:azizbekvahidov,项目名称:foods,代码行数:50,代码来源:EHeartExport.php


注:本文中的CGridView::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。