Skip to content

Commit

Permalink
Adding twig support for templating
Browse files Browse the repository at this point in the history
  • Loading branch information
Ítalo Lelis de Vietro committed Jan 21, 2015
1 parent dcdf12e commit cd60c2b
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 237 deletions.
61 changes: 31 additions & 30 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
{
"name": "umbrella/simpletablereport",
"description": "PHP Simple Table Report. Export data as tables to PDF, CSV, Excel, etc...",
"license": "MIT",
"authors": [
{
"name": "kelsoncm",
"email": "[email protected]"
},
{
"name": "Ítalo Lelis",
"email": "[email protected]"
},
{
"name": "Ayrton Ricardo",
"email": "[email protected]"
}
],
"require": {
"easyframework/collections": "~3.1"
"name": "umbrella/simpletablereport",
"description": "PHP Simple Table Report. Export data as tables to PDF, CSV, Excel, etc...",
"license": "MIT",
"authors": [
{
"name": "kelsoncm",
"email": "[email protected]"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
{
"name": "Ítalo Lelis",
"email": "[email protected]"
},
"autoload": {
"psr-4": {
"Umbrella\\SimpleReport\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Umbrella\\Tests\\SimpleReport\\": "tests/"
}
{
"name": "Ayrton Ricardo",
"email": "[email protected]"
}
],
"require": {
"twig/twig": "~1.17",
"easyframework/collections": "~3.1"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"autoload": {
"psr-4": {
"Umbrella\\SimpleReport\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Umbrella\\Tests\\SimpleReport\\": "tests/"
}
}
}
Binary file removed sample.excel.zip
Binary file not shown.
23 changes: 17 additions & 6 deletions src/BaseRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
*/
namespace Umbrella\SimpleReport;

use Easy\Collections\Dictionary;
use Umbrella\SimpleReport\Api\FieldDefinition;
use Umbrella\SimpleReport\Api\DatasourceInterface;
use Umbrella\SimpleReport\Api\FieldSet;
use Umbrella\SimpleReport\Api\RendererInterface;
use Umbrella\SimpleReport\Api\TemplateInterface;

/**
* Description of BaseRenderer
Expand All @@ -33,19 +34,29 @@ abstract class BaseRenderer implements RendererInterface
protected $configuration;

/**
* @var DatasourceInterface
* @var DatasourceInterface
*/
protected $datasource;

/**
* @var TemplateInterface
* @var FieldSet
*/
protected $template;
protected $fieldset;

public function __construct(DatasourceInterface $datasource, TemplateInterface $template)
/**
* @var Dictionary
*/
protected $options;

public function __construct(DatasourceInterface $datasource, FieldSet $fieldset, Dictionary $options = null)
{
$this->datasource = $datasource;
$this->template = $template;
$this->fieldset = $fieldset;
$this->options = new Dictionary();
if ($options) {
$this->options->concat($options);
}

$configurationLoader = ConfigurationLoader::getInstance();
$this->configuration = $configurationLoader->getConfiguration();
}
Expand Down
8 changes: 4 additions & 4 deletions src/ConfigurationLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ConfigurationLoader
private $configuration;

/**
*
*
* @return ConfigurationLoader
*/
public static function getInstance()
Expand All @@ -43,7 +43,7 @@ public static function getInstance()
}

/**
*
*
* @return ConfigurationInterface
*/
public function getConfiguration()
Expand All @@ -53,12 +53,12 @@ public function getConfiguration()

public function getRootDir()
{
return filter_input(INPUT_SERVER, 'DOCUMENT_ROOT') ? : getcwd();
return filter_input(INPUT_SERVER, 'DOCUMENT_ROOT') ?: getcwd();
}

protected function load()
{
$configFile = __DIR__ . "/../config.ini";
$configFile = __DIR__ . "/Resources/config/config.ini";
$ini_array = parse_ini_file($configFile);
$configurationClassName = $ini_array['simpletablereport.configurationClassName'];
$this->configuration = new $configurationClassName($ini_array);
Expand Down
86 changes: 0 additions & 86 deletions src/Parser/TemplateParser.php

This file was deleted.

74 changes: 0 additions & 74 deletions src/Renderer/GroupHtmlRenderer.php

This file was deleted.

Loading

0 comments on commit cd60c2b

Please sign in to comment.