use Application\Controller\RequestParse;
use Illuminate\Database\Eloquent;
/**
 * Application Routes
 **/
$app::Router()->get('/', function () {
    $home = new HomeController();
    echo $home->index();
});
$app::Router()->get($app->path('homepage'), function () {
    $home = new HomeController();
    echo $home->index();
});
$app::Router()->get($app->path('my_projects'), function () {
    $myproject = new MyProjectController();
    echo $myproject->proyects();
});
$app::Router()->get($app->path('my_tickets'), function () {
    $myticket = new MyTicketController();
    echo $myticket->tickets();
});
$app::Router()->get($app->path('message_confirm'), function (Request $request, Response $response, $args) {
    $dataResponse = [];
    $parse = new RequestParse($request, $args);
    $options = [];
    $options['title'] = $parse->get('title');
    $options['message'] = $parse->get('message');
    $dataResponse['html'] = App::getInstance()->Message()->confirm($options);
    $dataResponse['status'] = true;
    return $response->withJson($dataResponse);
});
Example #2
0
/*
    $app::Router()->get($app->path('profile'), function(Request $request, Response $response, $args){
        $parse = new RequestParse($request, $args);
        $security = new SecurityController();
        echo $security->profile($parse->get('id'));
    });
*/
$app::Router()->get($app->path('profile'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $security = new SecurityController();
    echo $security->profile($parse->get('id'));
});
$app::Router()->get($app->path('login'), function () {
    $security = new SecurityController();
    echo $security->index();
});
$app::Router()->get($app->path('logout'), function (Request $request, Response $response) {
    SecurityController::logout();
    $response = Cookie::deleteCookie($response, 'Rememberme');
    App::Router()->respond($response);
    return $response->withRedirect('/');
});
$app::Router()->post($app->path('auth'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $email = $parse->get('email');
    $password = $parse->get('password');
    $rememberme = $parse->get('rememberme');
    $security = new SecurityController();
    $responseData = $security->authenticate($email, $password, $rememberme);
    return $response->withJson($responseData);
});
    if ($ticket->idItem) {
        $path = App::getInstance()->path('item_detail', ['id' => $ticket->idItem]);
    }
    return $response->withRedirect($path, 301);
});
$app::Router()->get($app->path('new_ticket'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $ticketController = new TicketController();
    $response = $ticketController->createForm($parse->get('id'));
    if (true === $response instanceof \Slim\Http\Response) {
        return $response;
    }
    echo $response;
});
$app::Router()->get($app->path('edit_ticket'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $ticketController = new TicketController();
    $response = $ticketController->editForm($parse->get('id'));
    if (true === $response instanceof \Slim\Http\Response) {
        return $response;
    }
    echo $response;
});
$app::Router()->post($app->path('users_allows_ticket'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $ticketController = new TicketController();
    $response->withJson($ticketController->usersByState($parse->get('id')));
    if (true === $response instanceof \Slim\Http\Response) {
        return $response;
    }
});
Example #4
0
/**
 * Roles Routes
 **/
$app::Router()->get($app->path('roles'), function () {
    $rol = new RolController();
    echo $rol->index();
});
$app::Router()->get($app->path('new_rol'), function () {
    $rol = new RolController();
    echo $rol->addForm();
});
$app::Router()->post($app->path('save_rol'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $params = ['id' => $parse->get('id'), 'nombre' => $parse->get('nombre'), 'descripcion' => $parse->get('descripcion')];
    RolController::Save($params);
    return $response->withRedirect(App::getInstance()->path('roles'), 301);
});
$app::Router()->get($app->path('edit_rol'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $rol = new RolController();
    echo $rol->editForm($parse->get('id'));
});
$app::Router()->post($app->path('delete_rol'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $dataResponse = [];
    if ($id = $parse->get('id')) {
        $rol = new RolController();
        $dataResponse['status'] = (bool) $rol->delete($id);
    }
    return $response->withJson($dataResponse);
});
Example #5
0
    $estado->nombreEstado = $body_params->nombreEstado;
    $estado->tipoItem()->associate($body_params->itemTypeId);
    $estado->tipoEstado = 3;
    EstadoController::saveNew($estado);
    echo json_encode(true);
});
$app::Router()->post($app->path('estado_delete'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $dataResponse = [];
    if ($id = $parse->get('id')) {
        $estadoController = new EstadoController();
        $dataResponse['status'] = (bool) $estadoController->delete($id);
    }
    return $response->withJson($dataResponse);
});
$app::Router()->post($app->path('rename_estado'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request);
    $nombre = $parse->get('nombreEstado');
    $id = $parse->get('idEstado');
    $estadoController = new EstadoController();
    $result = $estadoController->rename($nombre, $id);
    echo json_encode($result);
});
$app::Router()->post($app->path('rename_tipoitem'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request);
    $descripcion = $parse->get('descripcion');
    $id = $parse->get('idTipoItem');
    $tipoItemController = new TipoItemController();
    $result = $tipoItemController->rename($descripcion, $id);
    echo json_encode($result);
});
Example #6
0
$app::Router()->post($app->path('lider_equipo'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $idEquipo = $parse->get('id');
    $idUsuarioRolEquipo = $parse->get('lider');
    // var_dump($params);
    TeamController::updateLiderEquipo($idEquipo, $idUsuarioRolEquipo);
    echo json_encode(true);
});
$app::Router()->post($app->path('usuario_equipo'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $idEquipo = $parse->get('id');
    $body = file_get_contents("php://input");
    $body_params = json_decode($body);
    $items = new Eloquent\Collection();
    foreach ($body_params->usuarios as $usuario) {
        $item = new UsuarioRolEquipo();
        $item->equipo()->associate($idEquipo);
        $item->usuario()->associate($usuario->usuario);
        $item->rol()->associate($usuario->rol);
        $item->esLider = 0;
        $items->add($item);
    }
    $resultado = TeamController::updateUsuariosRolEquipo($idEquipo, $items);
    json_encode(true);
});
$app::Router()->get($app->path('usuario_equipo'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $idEquipo = $parse->get('id');
    $resultado = TeamController::listarUsuariosRolEquipo($idEquipo);
    echo json_encode($resultado);
});
Example #7
0
    echo (new ProjectController())->editTeamForm($parse->get('id'));
});
$app::Router()->post($app->path('delete_project'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $resultado = ProjectController::delete($parse->get("id"));
    http_response_code(200);
    echo json_encode($resultado);
});
$app::Router()->get($app->path('list_project_teams'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $equipos = TeamController::getByProject($parse->get('id'));
    echo json_encode($equipos);
});
$app::Router()->get($app->path('edit_project_item_types'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    echo (new ProjectController())->editItemTypeForm($parse->get('id'));
});
$app::Router()->get($app->path('project_detail'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $proyectController = new ProjectController();
    $response = $proyectController->detalle($parse->get('id'));
    if (true === $response instanceof \Slim\Http\Response) {
        return $response;
    }
    echo $response;
});
$app::Router()->get($app->path('project_stats'), function (Request $request, Response $response, $args) {
    $parse = new RequestParse($request, $args);
    $projectController = new ProjectController();
    echo json_encode($projectController->getProjectStats($parse->get('id')));
});