$collection->attachRoute(new Route('/listRevenueByYear/:year', array('_controller' => 'PaymentController::listRevenueByYearView', 'methods' => 'GET')));
$collection->attachRoute(new Route('/listRevenueByYearAction', array('_controller' => 'PaymentController::listRevenueByYearAction', 'methods' => 'POST')));
$collection->attachRoute(new Route('/listCollectorPaymentRevenue', array('_controller' => 'PaymentController::listCollectorPaymentRevenueView', 'methods' => 'GET')));
$collection->attachRoute(new Route('/openMaps', array('_controller' => 'MapsController::openMapsView', 'methods' => 'GET')));
$collection->attachRoute(new Route('/listTotalRevenue', array('_controller' => 'PaymentController::listTotalRevenueView', 'methods' => 'GET')));
$collection->attachRoute(new Route('/calendar', array('_controller' => 'PaymentController::listPaymentsOnCalendarView', 'methods' => 'GET')));
$collection->attachRoute(new Route('/calendar/:dni/:year', array('_controller' => 'PaymentController::listPaymentsOnCalendarView', 'methods' => 'GET')));
$collection->attachRoute(new Route('/calendarAction', array('_controller' => 'PaymentController::listPaymentsOnCalendarAction', 'methods' => 'POST')));
$router = new Router($collection);
$router->setBasePath('/');
$route = $router->matchCurrentRequest();
// Vamos a usar el PHPRouter para todas las rutas relacionadas a la pagina de la escuela,
// y Slim para todas las rutas de la api REST.
// Asique si al llegar una ruta vemos que no pertenece al mapeo de PHPRouter, usamos slim.
if ($route) {
    AuthController::checkPermission($route->getAction());
    $route->dispatch();
} else {
    $slimApp = new \Slim\Slim();
    // Retorna un arreglo asociativo con las claves "por_pagar" y "pagas".
    // Cada arreglo dentro de esas 2 cosas contiene los datos de un alumno
    // http://localhost/cuotasImpagasYPorPagarDe/21/year/2016   << este tiene datos cargados para ver
    $slimApp->get('/cuotasImpagasYPorPagarDe/:studentID/year/:year', function ($studentID, $year) {
        FeeService::listPaidAndToBePaidFeesOfStudentInYear($studentID, $year);
    });
    // Devuelve un arreglo de 12 posiciones, cada posicion representa un mes, y contiene la cantidad de ingresos
    // en ese mes.
    $slimApp->get('/ingresosTotalesEn/:year', function ($year) {
        RevenueService::totalRevenueByMonthInYear($year);
    });
    $slimApp->get('/getUsersPosition', function () {