Commit d8ff02b7 authored by Fedrico Otaran's avatar Fedrico Otaran

Se elimina composer, se refactorizan modelos

parent 1cb7901e
{
"require": {
"twig/twig": "1.*"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "ec6122536d2fd287fbfed1e23ebb8601",
"packages": [
{
"name": "twig/twig",
"version": "v1.16.0",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
"reference": "8ce37115802e257a984a82d38254884085060024"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Twig/zipball/8ce37115802e257a984a82d38254884085060024",
"reference": "8ce37115802e257a984a82d38254884085060024",
"shasum": ""
},
"require": {
"php": ">=5.2.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.16-dev"
}
},
"autoload": {
"psr-0": {
"Twig_": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
},
{
"name": "Twig Team",
"homepage": "https://github.com/fabpot/Twig/graphs/contributors",
"role": "Contributors"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "http://twig.sensiolabs.org",
"keywords": [
"templating"
],
"time": "2014-07-05 12:19:05"
}
],
"packages-dev": [
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": [
],
"prefer-stable": false,
"platform": [
],
"platform-dev": [
]
}
<?php
/**
* Description of ResourceController
*
* @author fede
*/
class ResourceController {
private static $instance;
public static function getInstance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct() {
public function __construct()
{
$this->resourceRepository = new ResourceRepository;
}
public function listResources(){
$resources = ResourceRepository::getInstance()->listAll();
public function listResources()
{
$resources = $this->resourceRepository->listAll();
$view = new SimpleResourceList();
$view->show($resources);
}
public function home(){
public function home()
{
$view = new Home();
$view->show();
}
}
......@@ -12,9 +12,8 @@ require_once('view/SimpleResourceList.php');
require_once('view/Home.php');
if(isset($_GET["action"]) && $_GET["action"] == 'listResources'){
ResourceController::getInstance()->listResources();
}else{
ResourceController::getInstance()->home();
if (isset($_GET["action"]) && $_GET["action"] == 'users'){
(new ResourceController)->listResources();
} else {
(new ResourceController)->home();
}