本文整理汇总了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();
}
}
示例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();
}
}
示例3: run
public function run()
{
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
$this->runAjax();
} else {
parent::run();
}
}
示例4: run
public function run()
{
return parent::run();
}
示例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));
}
}
示例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();
}
}