From 3e60989bdb966c591ea5bb0658b645076cc23d10 Mon Sep 17 00:00:00 2001 From: sikofitt Date: Tue, 5 Jul 2016 14:41:50 -0700 Subject: [PATCH] End of Days --- .idea/deployment.xml | 26 +--- .idea/workspace.xml | 151 +++++++++++----------- app/App.php | 109 ++++++++-------- app/config/config.yml | 2 +- app/views/resume.html.twig | 162 ++++++++++++++++-------- composer.json | 6 +- composer.lock | 228 +++++++++++++++++++++++++++++++++- data/resume.json | 224 ++++++++++++++++----------------- dump.php | 12 ++ src/Sikofitt/less/resume.less | 3 +- web/index.php | 74 +++++++---- 11 files changed, 646 insertions(+), 351 deletions(-) create mode 100644 dump.php diff --git a/.idea/deployment.xml b/.idea/deployment.xml index a54d11c..45b2263 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -1,28 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0ba9b69..793a481 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,8 @@ - + - - @@ -18,6 +16,7 @@ + @@ -30,8 +29,8 @@ - - + + @@ -54,10 +53,7 @@ - - - - + @@ -67,9 +63,7 @@ - - - + @@ -79,9 +73,7 @@ - - - + @@ -163,7 +155,7 @@ @@ -192,6 +184,8 @@ + + @@ -316,8 +310,6 @@ - - @@ -342,9 +334,6 @@ - - - @@ -372,19 +361,6 @@ - - project - - - true - - bdd - - DIRECTORY - - false - - - - - + + + + - - - + + + @@ -476,6 +455,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -498,10 +517,7 @@ - - - - + @@ -509,9 +525,7 @@ - - - + @@ -519,9 +533,7 @@ - - - + @@ -571,10 +583,7 @@ - - - - + @@ -582,9 +591,7 @@ - - - + @@ -592,9 +599,7 @@ - - - + @@ -636,10 +641,7 @@ - - - - + @@ -647,9 +649,7 @@ - - - + @@ -731,8 +731,8 @@ - - + + @@ -751,10 +751,7 @@ - - - - + @@ -762,9 +759,7 @@ - - - + @@ -772,9 +767,7 @@ - - - + diff --git a/app/App.php b/app/App.php index 556d4db..1641655 100644 --- a/app/App.php +++ b/app/App.php @@ -9,65 +9,70 @@ require '../vendor/autoload.php'; * Class App */ class App extends Application { - - use ConfigTrait; - public $conf; + use ConfigTrait; + use Application\TwigTrait; + use Application\MonologTrait; + use Application\SwiftmailerTrait; + use Application\TranslationTrait; + use Application\UrlGeneratorTrait; - /** - * Returns the application directory. - * - * @return string - * The main application directory. - */ - public function getAppDirectory() { - $r = new ReflectionClass($this); - return dirname($r->getFileName()); - } + public $conf; - /** - * Returns the root directory of the application. - * - * @return string - * The root directory of the application. - */ - public function getRootDirectory() { - return dirname($this->getAppDirectory()); - } + /** + * Returns the application directory. + * + * @return string + * The main application directory. + */ + public function getAppDirectory() { + $r = new ReflectionClass($this); + return dirname($r->getFileName()); + } - /** - * @return string - */ - public function getConfDirectory() { - return $this->getAppDirectory() . '/config'; - } + /** + * Returns the root directory of the application. + * + * @return string + * The root directory of the application. + */ + public function getRootDirectory() { + return dirname($this->getAppDirectory()); + } - /** - * @return string - */ - public function getDataDirectory() { - return $this->getRootDirectory() . '/data'; - } + /** + * @return string + */ + public function getConfDirectory() { + return $this->getAppDirectory() . '/config'; + } - /** - * @return string - */ - public function getResumeJson() { - return $this->getDataDirectory() . '/resume.json'; - } + /** + * @return string + */ + public function getDataDirectory() { + return $this->getRootDirectory() . '/data'; + } - /** - * @return string - */ - public function getResumeSchema() { - return $this->getDataDirectory() . '/resume.schema.json'; - } + /** + * @return string + */ + public function getResumeJson() { + return $this->getDataDirectory() . '/resume.json'; + } - /** - * @return \Noodlehaus\Config - */ - public function conf2() { - return Noodlehaus\Config::load($this->getConfDirectory()); - } + /** + * @return string + */ + public function getResumeSchema() { + return $this->getDataDirectory() . '/resume.schema.json'; + } + + /** + * @return \Noodlehaus\Config + */ + public function conf2() { + return Noodlehaus\Config::load($this->getConfDirectory()); + } } diff --git a/app/config/config.yml b/app/config/config.yml index af15a37..263a067 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -1,7 +1,7 @@ app: debug: true environment: dev - title: R. Eric Wheeler + title: R. Eric Wheeler | Resume twig: paths: - views diff --git a/app/views/resume.html.twig b/app/views/resume.html.twig index af1d04e..57852cf 100644 --- a/app/views/resume.html.twig +++ b/app/views/resume.html.twig @@ -1,66 +1,118 @@ {% extends app.config.twig.template %} + {% block title %} - {{ app.config.app.title | default('Resume') }} - {% endblock %} + {{ app.config.app.title | default('Resume') }} +{% endblock %} {% block body %} -
-
-

{{ app.config.app.title|default('Resume') }}

-

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut.

+ {{ dump(basics) }} +
+
+

+ {% if basics.name is not empty %} + {{ basics.name }} + {% else %} + {{ app.config.app.title|default('Resume') }} + {% endif %} + {% if basics.label is not empty %} + {{ basics.label }} + {% endif %} +

+
+ {% if basics.summary is not empty %} +

+ + {{ basics.summary }} +

+ {% endif %} +
-
-
-
- -

Get Started

- -

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.

+
+
+ {% set position = work|first %} + {{ dump(position) }} +

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. + Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. + Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. +

+
+
+ +
+ +

Contact

+
    + + {% if basics.email is not empty %} +
  • [Click to view email]
  • + {% endif %} + {% if basics.phone is not empty %} +
  • {{ basics.phone }}
  • + {% endif %} + {% if basics.website is not empty %} +
  • {{ basics.website }}
  • + {% endif %} + {% if basics.location|length > 0 and basics.location is not empty %} +
  • +
    + {% set location = basics.location %} + + {% if location.address is not empty %} + {{ location.address }}
    + {% endif %} + {% if location.city is not empty %} + {{ location.city }} + {% if location.postalCode is not empty %} +  {{ location.postalCode }} + {% endif %} + {% if location.countryCode is not empty %} +  {{ location.countryCode }} + {% endif %}
    + {% endif %} + +
    +
  • + {% endif %} + +
+
+ +
-
- -
- -

Testing This Title

-
-
-
-
-
-
- -
+
+
+
    + {% if basics.email is not empty %} +
  • {{ basics.email }}
  • + {% endif %} + {% if basics.phone is not empty %} +
  • {{ basics.phone }}
  • + {% endif %} + {% if basics.location|length > 0 and basics.location is not empty %} +
    + {% for location in basics.location %} + {% if location.address is not empty %} + {{ location.address }}
    + {% endif %} + {% if location.city is not empty %} + {{ location.city }} + {% if location.postalCode is not empty %} +  {{ location.postalCode }} + {% endif %} + {% if location.countryCode is not empty %} +  {{ location.countryCode }} + {% endif %}
    + {% endif %} + + {% endfor %} + {% endif %} +
    +
+
+ {% endblock %} \ No newline at end of file diff --git a/composer.json b/composer.json index feb2f85..457fedb 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,8 @@ "monolog/monolog": "^1.20", "symfony/monolog-bridge": "^3.1", "google/recaptcha": "^1.1", - "hassankhan/config": "^0.10.0" + "hassankhan/config": "^0.10.0", + "silex/web-profiler": "^2.0" }, "require-dev": { "symfony/debug": "~2.8|^3.0", @@ -46,7 +47,8 @@ "symfony/serializer": "~2.8|^3.0", "symfony/var-dumper": "^3.1", "symfony/console": "^3.1", - "texthtml/whoops-silex": "^1.0" + "texthtml/whoops-silex": "^1.0", + "symfony/debug-bundle": "^3.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 888396e..5cd7005 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "bff507b41d23db26ac64f22c144abe58", - "content-hash": "fca3e43ff787d71afd6f495624a8bf9c", + "hash": "bc85e2d6fdda738f03a5e498d59ff477", + "content-hash": "d0a7cfefe30599f33ddbe16cd3cce33d", "packages": [ { "name": "google/recaptcha", @@ -661,6 +661,62 @@ ], "time": "2016-06-14 09:27:51" }, + { + "name": "silex/web-profiler", + "version": "v2.0.1", + "target-dir": "Silex/Provider", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Silex-WebProfiler.git", + "reference": "605ebe9d16eb9597ab42603d1b4bec595ebf677d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Silex-WebProfiler/zipball/605ebe9d16eb9597ab42603d1b4bec595ebf677d", + "reference": "605ebe9d16eb9597ab42603d1b4bec595ebf677d", + "shasum": "" + }, + "require": { + "silex/silex": "^2.0", + "symfony/stopwatch": "^2.8|^3.0", + "symfony/twig-bridge": "^2.8|^3.0", + "symfony/web-profiler-bundle": "^2.8|^3.0" + }, + "conflict": { + "symfony/web-profiler-bundle": "3.1.0" + }, + "require-dev": { + "symfony/browser-kit": "^2.8|^3.0", + "symfony/css-selector": "^2.8|^3.0", + "symfony/debug-bundle": "^2.8|^3.0", + "symfony/security": "^2.8|^3.0", + "symfony/security-bundle": "^2.8|^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Silex\\Provider\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A WebProfiler for Silex", + "homepage": "http://silex.sensiolabs.org/", + "time": "2016-06-15 07:44:40" + }, { "name": "swiftmailer/swiftmailer", "version": "v5.4.2", @@ -1703,6 +1759,55 @@ ], "time": "2016-06-29 05:41:56" }, + { + "name": "symfony/stopwatch", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/bb42806b12c5f89db4ebf64af6741afe6d8457e1", + "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:41:56" + }, { "name": "symfony/swiftmailer-bridge", "version": "v2.8.8", @@ -1975,6 +2080,64 @@ "homepage": "https://symfony.com", "time": "2016-06-29 05:41:56" }, + { + "name": "symfony/web-profiler-bundle", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-profiler-bundle.git", + "reference": "0043f504e8008542ee56e2fb52292cb6a3918c78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/0043f504e8008542ee56e2fb52292cb6a3918c78", + "reference": "0043f504e8008542ee56e2fb52292cb6a3918c78", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/http-kernel": "~3.1", + "symfony/routing": "~2.8|~3.0", + "symfony/twig-bridge": "~2.8|~3.0" + }, + "require-dev": { + "symfony/config": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\WebProfilerBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony WebProfilerBundle", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:41:56" + }, { "name": "symfony/yaml", "version": "v3.1.2", @@ -2351,6 +2514,67 @@ "homepage": "https://symfony.com", "time": "2016-06-29 07:02:31" }, + { + "name": "symfony/debug-bundle", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug-bundle.git", + "reference": "995b9d7c1f3e1489cfe3379e18276e6032f99aa3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug-bundle/zipball/995b9d7c1f3e1489cfe3379e18276e6032f99aa3", + "reference": "995b9d7c1f3e1489cfe3379e18276e6032f99aa3", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/http-kernel": "~2.8|~3.0", + "symfony/twig-bridge": "~2.8|~3.0", + "symfony/var-dumper": "~2.8|~3.0" + }, + "require-dev": { + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/web-profiler-bundle": "~2.8|~3.0" + }, + "suggest": { + "symfony/config": "For service container configuration", + "symfony/dependency-injection": "For using as a service from the container" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\DebugBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DebugBundle", + "homepage": "https://symfony.com", + "time": "2016-02-13 09:24:02" + }, { "name": "symfony/phpunit-bridge", "version": "v3.1.2", diff --git a/data/resume.json b/data/resume.json index d5fba97..1707ef6 100644 --- a/data/resume.json +++ b/data/resume.json @@ -1,116 +1,116 @@ { - "basics": { - "name": "R. Eric Wheeler", - "label": "Developer / Systems", - "picture": "http://rewiv.com/storage/me.png", - "email": "eric@ericwheeler.net", - "phone": "", - "website": "https://code.reric.me", - "summary": "", - "location": { - "address": "", - "postalCode": "CA 94578", - "city": "San Leandro", - "countryCode": "US", - "region": "California" + "basics": { + "name": "R. Eric Wheeler", + "label": "Developer / Systems", + "picture": "http://rewiv.com/storage/me.png", + "email": "eric@ericwheeler.net", + "phone": "", + "website": "https://code.reric.me", + "summary": "", + "location": { + "address": "", + "postalCode": "CA 94578", + "city": "San Leandro", + "countryCode": "US", + "region": "California" + }, + "profiles": [ + { + "network": "Twitter", + "username": "sikofitt", + "url": "" + }, + { + "network": "Github", + "username": "sikofitt", + "url": "" + }, + { + "network": "Private Git", + "username": "sikofitt", + "url": "https://repos.bgemi.net/u/sikofitt" + }, + { + "network": "linkedin", + "username": "reric", + "url": "https://www.linkedin.com/in/reric" + } + ] }, - "profiles": [ - { - "network": "Twitter", - "username": "sikofitt", - "url": "" - }, - { - "network": "Github", - "username": "sikofitt", - "url": "" - }, - { - "network": "Private Git", - "username": "sikofitt", - "url": "https://repos.bgemi.net/u/sikofitt" - }, - { - "network": "linkedin", - "username": "reric", - "url": "https://www.linkedin.com/in/reric" - } + "work": [ + { + "company": "Stanford University", + "position": "Developer / Systems Administrator", + "website": "https://ee.stanford.edu", + "startDate": "2007-05-27", + "endDate": "2016-07-02", + "summary": "", + "highlights": [ + "Build an algorithm for artist to detect if their music was violating copy right infringement laws", + "Successfully won Techcrunch Disrupt", + "Optimized an algorithm that holds the current world record for Weisman Scores" + ] + }, + { + "company": "Searchathlon INC.", + "position": "Web Developer / Linux System Administration", + "website": "http://searchathlon.com", + "startDate": "2005-01-01", + "endDate": "2006-01-01", + "summary": "", + "highlights": [] + } + ], + "volunteer": [], + "education": [], + "awards": [], + "publications": [], + "skills": [ + { + "name": "Web Development / Design", + "level": "", + "keywords": [ + "HTML5", + "CSS3", + "Javascript", + "jQuery", + "NPM", + "Bower", + "Grunt", + "Let's Encrypt" + ] + }, + { + "name": "PHP", + "level": "", + "keywords": [ + "PHP5", + "PHP7", + "Symfony 2", + "Symfony 3", + "OOP", + "Silex", + "Slim", + "Doctrine", + "Composer" + ] + } + ], + "languages": [], + "interests": [ + { + "name": "Computers", + "keywords": [ + "Hardware", + "Programming", + "Design" + ] + } + ], + "references": [ + { + "name": "Erlich Bachman", + "reference": "It is my pleasure to recommend Richard, his performance working as a consultant for Main St. Company proved that he will be a valuable addition to any company." + } ] - }, - "work": [ - { - "company": "Stanford University", - "position": "Developer / Systems Administrator", - "website": "https://ee.stanford.edu", - "startDate": "2007-05-27", - "endDate": "2016-07-02", - "summary": "", - "highlights": [ - "Build an algorithm for artist to detect if their music was violating copy right infringement laws", - "Successfully won Techcrunch Disrupt", - "Optimized an algorithm that holds the current world record for Weisman Scores" - ] - }, - { - "company": "Searchathlon INC.", - "position": "Web Developer / Linux System Administration", - "website": "http://searchathlon.com", - "startDate": "2005-01-01", - "endDate": "2006-01-01", - "summary": "", - "highlights": [] - } - ], - "volunteer": [], - "education": [], - "awards": [], - "publications": [], - "skills": [ - { - "name": "Web Development / Design", - "level": "", - "keywords": [ - "HTML5", - "CSS3", - "Javascript", - "jQuery", - "NPM", - "Bower", - "Grunt", - "Let's Encrypt" - ] - }, - { - "name": "PHP", - "level": "", - "keywords": [ - "PHP5", - "PHP7", - "Symfony 2", - "Symfony 3", - "OOP", - "Silex", - "Slim", - "Doctrine", - "Composer" - ] - } - ], - "languages": [], - "interests": [ - { - "name": "Computers", - "keywords": [ - "Hardware", - "Programming", - "Design" - ] - } - ], - "references": [ - { - "name": "Erlich Bachman", - "reference": "It is my pleasure to recommend Richard, his performance working as a consultant for Main St. Company proved that he will be a valuable addition to any company." - } - ] } diff --git a/dump.php b/dump.php new file mode 100644 index 0000000..81c0245 --- /dev/null +++ b/dump.php @@ -0,0 +1,12 @@ +decodeFile('data/resume.json'); + +dump($json); + + diff --git a/src/Sikofitt/less/resume.less b/src/Sikofitt/less/resume.less index 7cc4bda..ef0a943 100644 --- a/src/Sikofitt/less/resume.less +++ b/src/Sikofitt/less/resume.less @@ -4,4 +4,5 @@ @base-body-font-family : 'Lato'; @base-body-font-size : 26px; @base-heading-font-family : 'Eczar'; -@base-body-line-height : 1.2em; \ No newline at end of file +@base-body-line-height : 1.2em; +@thumbnail-mini-width : 100px; \ No newline at end of file diff --git a/web/index.php b/web/index.php index d0a0107..631ee64 100644 --- a/web/index.php +++ b/web/index.php @@ -1,38 +1,52 @@ register(new Sikofitt\Config\ConfigServiceProvider(), [ 'config.path' => $app->getConfDirectory(), ]); - $app->register (new TwigServiceProvider(), [ - 'twig.path' => APP_ROOT . 'app/views', + 'twig.path' => [APP_ROOT . 'app/views', APP_ROOT .'vendor/symfony/web-profiler-bundle/Resources/views/Profiler'], ]); -$app['conf'] = function ($app) { - -}; $app->register (new WhoopsServiceProvider()); $app->register (new \Silex\Provider\AssetServiceProvider()); $app->register (new \Silex\Provider\MonologServiceProvider()); -$app->register (new \Silex\Provider\VarDumperServiceProvider()); + $app->register (new \Silex\Provider\HttpKernelServiceProvider()); +$app->register(new \Silex\Provider\AssetServiceProvider()); +$app->register(new \Silex\Provider\FormServiceProvider()); +$app->register(new \Silex\Provider\HttpFragmentServiceProvider()); +$app->register(new \Silex\Provider\ServiceControllerServiceProvider()); +$app->register(new \Silex\Provider\RoutingServiceProvider()); +$app->register (new \Silex\Provider\VarDumperServiceProvider(), array( + 'var_dumper.dump_destination' => new \Symfony\Component\VarDumper\Cloner\VarCloner(), +)); + +$app->register(new \Silex\Provider\MonologServiceProvider(), array( + 'monolog.logfile' => $app->getDataDirectory() . '/logs/' . (null !== $app->config('app.environment') ? $app->config('app.environment') . '.log' : 'dev.log'), +)); + +$app->register(new \Silex\Provider\SessionServiceProvider()); +$app->register(new \Silex\Provider\WebProfilerServiceProvider(), array( + 'profiler.cache_dir' => $app->getDataDirectory() .'/cache/profiler', +)); +$app->extend('twig', function(\Twig_Environment $twig, $app) { +$twig->enableDebug(); +return $twig; +}); $app->error(function (\Exception $e, $code) use($app) { switch ($code) { case 404: @@ -41,7 +55,6 @@ $app->error(function (\Exception $e, $code) use($app) { default: $message = $app['twig']->render('error500.html.twig'); } - return new Response($message, $code); }); $app['json.decoder'] = function ($app) { @@ -54,16 +67,33 @@ $app['json.validator'] = function ($app) { return new Webmozart\Json\JsonValidator(); }; -$app->get ('/', function () use ($app) { - //$snappy = new Pdf($app->getRootDirectory() . '/vendor/bin/wkhtmltopdf-amd64'); - //$snappy->setTemporaryFolder(sys_get_temp_dir() . '/pdf'); - //$snappy->setOption( 'disable-external-links', true); - //$snappy->setOption('toc', false); - //$snappy->setOption('enable-internal-links', false); - //$html = $app['twig']->render('resume.html.twig'); - //$snappy->generateFromHtml($html, $app->getRootDirectory() . '/test3.pdf'); - return $app['twig']->render('resume.html.twig'); +$app->get ('/', function () use ($app) { + $resumeData = $app['json.decoder']->decodeFile($app->getDataDirectory() .'/resume.json', $app->getDataDirectory() . '/resume.schema.json'); + $basics = (isset($resumeData->basics) && count($resumeData->basics) > 0) ? $resumeData->basics : null; + $work = (isset($resumeData->work) && count($resumeData->work) > 0) ? $resumeData->work : null; + $volunteer = (isset($resumeData->volunteer) && count($resumeData->volunteer) > 0) ? $resumeData->volunteer : null; + $education = (isset($resumeData->education) && count($resumeData->education) > 0) ? $resumeData->education : null; + $awards = (isset($resumeData->awards) && count($resumeData->awards) > 0) ? $resumeData->awards : null; + $publications = (isset($resumeData->publications) && count($resumeData->publications) > 0) ? $resumeData->publications : null; + $skills = (isset($resumeData->skills) && count($resumeData->skills) > 0) ? $resumeData->skills : null; + $languages = (isset($resumeData->languages) && count($resumeData->languages) > 0) ? $resumeData->languages : null; + $interests = (isset($resumeData->interests) && count($resumeData->interests) > 0) ? $resumeData->interests : null; + $references = (isset($resumeData->references) && count($resumeData->references) > 0) ? $resumeData->references : null; + + + return $app['twig']->render('resume.html.twig', [ + 'basics' => $basics, + 'work' => $work, + 'volunteer' => $volunteer, + 'education' => $education, + 'awards' => $awards, + 'publications' => $publications, + 'skills' => $skills, + 'languages' => $languages, + 'interests' => $interests, + 'references' => $references, + ]); }); $app->run ();