Skip to content

Commit 2b84405

Browse files
committed
[Software maintenance - Perfective]
* Upload file * Template Twig * Group routes * Custom assets
1 parent 3899cc0 commit 2b84405

File tree

607 files changed

+151398
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

607 files changed

+151398
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ forked by https://github.com/akrabat/slim3-skeleton
3838
* `app/routes.php`: All application routes are here
3939
* `app/src/Action/HomeAction.php`: Action class for the home page
4040
* `app/templates/home.twig`: Twig template file for the home page
41+
42+
https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

app/routes.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
<?php
22
// Routes
33

4-
$app->get('/', App\Action\HomeAction::class)
5-
->setName('homepage');
4+
//
5+
6+
$app->group('/painel', function() use ($app) {
7+
$app->get('',App\Action\CMSAction::class . ':page')->setName('homepage');
8+
$app->get('/menu',App\Action\CMSAction::class . ':page');
9+
$app->get('/page',App\Action\CMSAction::class . ':page');
10+
$app->get('/page-details',App\Action\CMSAction::class . ':page');
11+
$app->get('/img-video',App\Action\CMSAction::class . ':page');
12+
$app->get('/tag',App\Action\CMSAction::class . ':page');
13+
$app->get('/tag-values',App\Action\CMSAction::class . ':page');
14+
$app->get('/banner',App\Action\CMSAction::class . ':page');
15+
$app->get('/tariff',App\Action\CMSAction::class . ':page');
16+
$app->get('/hotel',App\Action\CMSAction::class . ':page');
17+
$app->get('/room',App\Action\CMSAction::class . ':page');
18+
$app->get('/room-values',App\Action\CMSAction::class . ':page');
19+
$app->post('/upload',App\Action\CMSAction::class . ':upload');
20+
21+
});
22+
23+
$app->get('/', App\Action\HomeAction::class)->setName('homepage');

app/settings.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
'settings' => [
44
// Slim Settings
55
'determineRouteBeforeAppMiddleware' => false,
6-
'displayErrorDetails' => false,
6+
'displayErrorDetails' => true,
77

88
// View settings
99
'view' => [
10-
'template_path' => __DIR__ . '/templates',
10+
'template_path' => array(
11+
__DIR__ . '/templates/admin-cms/default',
12+
__DIR__ . '/templates/admin-cms/partials',
13+
__DIR__ . '/templates/admin-cms/partials/head',
14+
__DIR__ . '/templates/admin-cms/partials/script'),
1115
'twig' => [
1216
'cache' => __DIR__ . '/../cache/twig',
1317
'debug' => true,

app/src/Action/CMSAction.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,37 @@ public function __invoke(Request $request, Response $response, $args) {
2727
}
2828

2929
public function page(Request $request, Response $response, $args) {
30-
// TODO: Implement page() method.
30+
$this->logger->info("Page action dispatched");
31+
$page = $request->getUri()->getPath() == '/painel' ? explode("/", $request->getUri()->getPath())[1] : explode("/", $request->getUri()->getPath())[2];
32+
$this->view->render($response, $page.'.twig', array("partials" => $page));
33+
return $response;
34+
}
35+
36+
public function upload(Request $request, Response $response) {
37+
38+
$errors = [];
39+
40+
$files = $request->getUploadedFiles();
41+
42+
foreach ($files as $data) {
43+
try {
44+
if (empty($data->file)) {
45+
throw new Exception('Expected a newfile');
46+
}
47+
48+
if ($data->getError() === UPLOAD_ERR_OK) {
49+
$uploadFileName = $data->getClientFilename();
50+
$token = md5(uniqid(rand(), true));
51+
$data->moveTo("/tmp/$token.".pathinfo($data->getClientFilename(), PATHINFO_EXTENSION));
52+
}
53+
} catch (\Exception $e) {
54+
array_push($errors, 'Failed to upload '. $data->getClientFilename());
55+
}
56+
}
57+
return $response->withJson(['errors' => $errors], 200, JSON_PRETTY_PRINT);
58+
59+
60+
61+
return $response;
3162
}
3263
}

app/src/Action/DefaultAction.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
class DefaultAction {
88

9+
public function getPage(Request $request){
10+
return $request->getUri()->getPath() == '/painel' ? explode("/", $request->getUri()->getPath())[1] : explode("/", $request->getUri()->getPath())[2];
11+
}
12+
913
public function isAuthorized(Request $request){
1014
if($request->getHeader('Authorization')!=null && count($request->getHeader('Authorization')[0])){
1115
$autorization = $request->getHeader('Authorization')[0];

app/src/Action/HomeAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __invoke(Request $request, Response $response, $args)
2121
{
2222
$this->logger->info("Home page action dispatched");
2323

24-
$this->view->render($response, 'home.twig');
24+
$this->view->render($response, 'home-1.twig');
2525
return $response;
2626
}
2727
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!-- header section start-->
2+
<div class="header-section">
3+
4+
<!--logo and logo icon start-->
5+
<div class="logo dark-logo-bg hidden-xs hidden-sm">
6+
<a href="/">
7+
<img src="/cms/img/logo.png" alt="">
8+
<!--<i class="fa fa-maxcdn"></i>-->
9+
</a>
10+
</div>
11+
12+
<div class="icon-logo dark-logo-bg hidden-xs hidden-sm">
13+
<a href="/">
14+
<img src="/cms/img/logo-icon.png" alt="">
15+
<!--<i class="fa fa-maxcdn"></i>-->
16+
</a>
17+
</div>
18+
<!--logo and logo icon end-->
19+
20+
<!--toggle button start-->
21+
<a class="toggle-btn"><i class="fa fa-outdent"></i></a>
22+
<!--toggle button end-->
23+
24+
25+
<div class="notification-wrap">
26+
27+
28+
29+
<!--right notification start-->
30+
<div class="right-notification">
31+
<ul class="notification-menu">
32+
<li>
33+
<form class="search-content" action="/" method="post">
34+
<input type="text" class="form-control" name="keyword" placeholder="Buscar...">
35+
</form>
36+
</li>
37+
38+
<li>
39+
<a href="javascript:;" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
40+
<img src="/cms/img/avatar-mini.jpg" alt="">Jonh Doe
41+
<span class=" fa fa-angle-down"></span>
42+
</a>
43+
<ul class="dropdown-menu dropdown-usermenu purple pull-right">
44+
45+
<li>
46+
<a href="http://" target="_blank">
47+
AJUDA
48+
</a>
49+
</li>
50+
51+
<li>
52+
<a href="alterar_senha.html">
53+
ALTERAR SENHA
54+
</a>
55+
</li>
56+
57+
<li><a href="login.html"><i class="fa fa-sign-out pull-right"></i> SAIR</a></li>
58+
</ul>
59+
</li>
60+
61+
62+
</ul>
63+
</div>
64+
<!--right notification end-->
65+
</div>
66+
67+
</div>
68+
<!-- header section end-->
69+
70+
<!-- page head start-->
71+
<div class="page-head">
72+
<h3 class="m-b-less">HOME</h3>
73+
<!--<span class="sub-title">Welcome to Static Table</span>-->
74+
<div class="state-information">
75+
<ol class="breadcrumb m-b-less bg-less">
76+
<li><a href="#">Home</a></li>
77+
<!--<li class="active"> Notícias </li>-->
78+
</ol>
79+
</div>
80+
81+
</div>
82+
<!-- page head end-->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!--footer section start-->
2+
<footer>
3+
2015 &copy; SlickLab by VectorLab.
4+
</footer>
5+
<!--footer section end-->
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<head>
2+
<meta charset="utf-8">
3+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
4+
<meta name="author" content="Mosaddek" />
5+
<meta name="keyword" content="slick, flat, dashboard, bootstrap, admin, template, theme, responsive, fluid, retina" />
6+
<meta name="description" content="" />
7+
<link rel="shortcut icon" href="javascript:;" type="image/png">
8+
9+
<title>{{ title }}</title>
10+
11+
{% include partials ~ '-head.twig' %}
12+
</head>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!--[if lt IE 7]>
2+
<p class="browsehappy">Você está usando um navegador <strong>desatualizado</strong>. Por favor, <a href="/http://browsehappy.com/">atualize seu navegador</a>.</p>
3+
<![endif]-->
4+
<!-- sidebar left start-->
5+
<div class="sidebar-left sticky-sidebar">
6+
<!--responsive view logo start-->
7+
<div class="logo dark-logo-bg visible-xs-* visible-sm-*">
8+
<a href="/">
9+
<img src="/cms/img/logo.png" alt="">
10+
<!--<i class="fa fa-maxcdn"></i>-->
11+
<!--<span class="brand-name">SlickLab</span>-->
12+
</a>
13+
</div>
14+
<!--responsive view logo end-->
15+
16+
<div class="sidebar-left-info">
17+
<!-- visible small devices start-->
18+
<div class=" search-field"> </div>
19+
<!-- visible small devices end-->
20+
21+
<!--sidebar nav start-->
22+
<ul class="nav nav-pills nav-stacked side-navigation">
23+
<li>
24+
<h3 align="center" class="navigation-title">ADMIN</h3>
25+
</li>
26+
<li><a href="/painel/menu"><i class="fa icon-home"></i> <span>MENU</span></a></li>
27+
<li class="menu-list">
28+
<a href=""><i class="fa icon-layers"></i><span>P&Aacute;GINAS</span></a>
29+
<ul class="child-list">
30+
<li><a href="/painel/page">P&Aacute;GINA</a></li>
31+
<li><a href="/painel/page-details">SE&Ccedil;&Atilde;O DA P&Aacute;GINA</a></li>
32+
<li><a href="/painel/img-video">GALERIA DE IMAGENS/V&Iacute;DEOS</a></li>
33+
</ul>
34+
</li>
35+
<li><a href="/painel/tag"><i class="fa icon-notebook"></i> <span>GOOGLE (S.E.O)</span></a></li>
36+
<li><a href="/painel/banner"><i class="fa icon-settings"></i> <span>BANNERS</span></a></li>
37+
<li><a href="/painel/schedule"><i class="fa icon-cup"></i> <span>EVENTOS</span></a></li>
38+
<li class="menu-list">
39+
<a href=""><i class="fa icon-layers"></i> <span>TARIFÁRIO</span></a>
40+
<ul class="child-list">
41+
<li><a href="/painel/tariff">VIGÊNCIA</a></li>
42+
<li><a href="/painel/tariff/hotel">HOTEL</a></li>
43+
<li><a href="/painel/tariff/hotel/room">QUARTO</a></li>
44+
</ul>
45+
</li>
46+
47+
</ul>
48+
<!--sidebar nav end-->
49+
50+
</div>
51+
</div>
52+
<!-- sidebar left end-->

0 commit comments

Comments
 (0)