-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from fr3nch13/dev
Ok, I think I got the View stuff ironed out.
- Loading branch information
Showing
19 changed files
with
330 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* XlsxView | ||
*/ | ||
|
||
namespace Fr3nch13\Excel\View; | ||
|
||
/** | ||
* Xlsx View | ||
*/ | ||
class XlsxView extends ExcelBaseView | ||
{ | ||
/** | ||
* @var string The path to look for the layout. | ||
*/ | ||
protected $layoutPath = 'xlsx'; | ||
|
||
/** | ||
* @var string The sub directory to look for the template. | ||
*/ | ||
protected $subDir = 'xlsx'; | ||
|
||
/** | ||
* Mime-type this view class renders as. | ||
* | ||
* @return string The JSON content type. | ||
*/ | ||
public static function contentType(): string | ||
{ | ||
return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; | ||
} | ||
|
||
/** | ||
* Initialize method | ||
* | ||
* @return void | ||
*/ | ||
public function initialize(): void | ||
{ | ||
parent::initialize(); | ||
|
||
$this->getResponse()->setTypeMap('xlsx', [$this->contentType()]); | ||
$this->setResponse($this->getResponse()->withType('xlsx')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @var \Fr3nch13\Excel\View\CsvView $this | ||
*/ | ||
|
||
$properties = []; | ||
|
||
if (!$this->fetch('page-title')) { | ||
$this->assign('page-title', __('Tests')); | ||
} | ||
if (!$this->fetch('page-subtitle')) { | ||
$this->assign('page-subtitle', __('All')); | ||
} | ||
|
||
$properties['title'] = __('{0} - {1}', [ | ||
$this->fetch('page-title'), | ||
$this->fetch('page-subtitle'), | ||
]); | ||
|
||
$rows = []; | ||
for ($i = 0; $i++; $i < 10) { | ||
$rows[$i] = [ | ||
$i, | ||
__('Name {0}', [$i]), | ||
__('Desc {0}', [$i]), | ||
]; | ||
} | ||
|
||
$headers = [ | ||
'id' => __('UID'), | ||
'name' => __('Name'), | ||
'slug' => __('Slug'), | ||
'active' => __('Active'), | ||
'created' => __('Created'), | ||
]; | ||
|
||
echo $this->element('Fr3nch13/Excel.csv-index', [ | ||
'options' => [], | ||
'properties' => $properties, | ||
'headers' => $headers, | ||
'rows' => $rows, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @var \Fr3nch13\Excel\View\ExcelBaseView $this | ||
*/ | ||
|
||
$this->extend('/base'); | ||
|
||
if (!$this->fetch('page-title')) { | ||
$this->assign('page-title', __('Phpstans')); | ||
} | ||
if (!$this->fetch('page-subtitle')) { | ||
$this->assign('page-subtitle', __('All')); | ||
} | ||
|
||
$headers = ['ID', 'Name', 'Desc']; | ||
$rows = []; | ||
for ($i = 0; $i++; $i < 10) { | ||
$rows[$i] = [ | ||
$i, | ||
__('Name {0}', [$i]), | ||
__('Desc {0}', [$i]), | ||
]; | ||
} | ||
|
||
$this->start('page-content'); | ||
?> | ||
<section class="page-content"> | ||
<div class="box"> | ||
<!-- /.box-header --> | ||
<div class="box-body"> | ||
<?php | ||
?> | ||
<table> | ||
<?php | ||
echo $this->Html->tableHeaders($headers); | ||
echo $this->Html->tableCells($rows); | ||
?> | ||
</table> | ||
</div> | ||
</div> | ||
</section> | ||
<?php $this->end(); /* page-content */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @var \Fr3nch13\Excel\View\PdfView $this | ||
*/ | ||
|
||
$properties = []; | ||
|
||
if (!$this->fetch('page-title')) { | ||
$this->assign('page-title', __('Tests')); | ||
} | ||
if (!$this->fetch('page-subtitle')) { | ||
$this->assign('page-subtitle', __('All')); | ||
} | ||
|
||
$properties['title'] = __('{0} - {1}', [ | ||
$this->fetch('page-title'), | ||
$this->fetch('page-subtitle'), | ||
]); | ||
|
||
$headers = ['ID', 'Name', 'Desc']; | ||
$rows = []; | ||
for ($i = 0; $i++; $i < 10) { | ||
$rows[$i] = [ | ||
$i, | ||
__('Name {0}', [$i]), | ||
__('Desc {0}', [$i]), | ||
]; | ||
} | ||
|
||
echo $this->element('Fr3nch13/Excel.pdf-index', [ | ||
'options' => [], | ||
'properties' => $properties, | ||
'headers' => $headers, | ||
'rows' => $rows, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @var \Fr3nch13\Excel\View\XlsxView $this | ||
*/ | ||
|
||
$properties = []; | ||
|
||
if (!$this->fetch('page-title')) { | ||
$this->assign('page-title', __('Tests')); | ||
} | ||
if (!$this->fetch('page-subtitle')) { | ||
$this->assign('page-subtitle', __('All')); | ||
} | ||
|
||
$properties['title'] = __('{0} - {1}', [ | ||
$this->fetch('page-title'), | ||
$this->fetch('page-subtitle'), | ||
]); | ||
|
||
$headers = ['ID', 'Name', 'Desc']; | ||
$rows = []; | ||
for ($i = 0; $i++; $i < 10) { | ||
$rows[$i] = [ | ||
$i, | ||
__('Name {0}', [$i]), | ||
__('Desc {0}', [$i]), | ||
]; | ||
} | ||
|
||
echo $this->element('Fr3nch13/Excel.xlsx-index', [ | ||
'options' => [], | ||
'properties' => $properties, | ||
'headers' => $headers, | ||
'rows' => $rows, | ||
]); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.