mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
ALPHA 3.0.1d
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Log;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
@@ -23,11 +24,16 @@ class AdminController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
Log::saveLog('Affichage du tableau de bord');
|
||||
|
||||
return view('admin.dashboard');
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
Log::saveLog('Affichage des notes de mise a jour');
|
||||
|
||||
return view('admin.update');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
75
app/Http/Controllers/CalendarController.php
Normal file
75
app/Http/Controllers/CalendarController.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Log;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth', ['except' => ['generate']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
Log::saveLog("Affichage de l'horaire");
|
||||
|
||||
return view('admin.calendar');
|
||||
}
|
||||
|
||||
public function generate()
|
||||
{
|
||||
|
||||
setlocale(LC_ALL, "fr");
|
||||
$month = request('month');
|
||||
$year = request('year');
|
||||
|
||||
$calendar = array();
|
||||
|
||||
$dayinmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
|
||||
|
||||
$firstdaymonth = date("w", strtotime("01-".$month."-".$year));
|
||||
|
||||
$addingday = 0;
|
||||
|
||||
for ($i=$firstdaymonth ; $addingday < $dayinmonth ; $i++) {
|
||||
$addingday = $addingday + 1;
|
||||
$calendar[$i] = $addingday;
|
||||
}
|
||||
|
||||
echo '<table class="table calendar">';
|
||||
echo '<thead class="thead-dark">';
|
||||
echo '<td colspan="7">'.strftime("%B", strtotime("01-".$month."-".$year)).'</td>';
|
||||
echo '</thead>';
|
||||
for ($i=0; $i < 6 ; $i++)
|
||||
{
|
||||
echo '<tr>';
|
||||
for ($a=0; $a < 7 ; $a++)
|
||||
{
|
||||
if (isset($calendar[(($i*7) + $a)]))
|
||||
{
|
||||
echo '<td class="calendar-container">';
|
||||
$today = date("Y-m-d", strtotime($year."-".$month."-".$calendar[(($i*7) + $a)]));
|
||||
echo date("j", strtotime($today));
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
26
public/assets/admin/assets/scss/style.css
vendored
26
public/assets/admin/assets/scss/style.css
vendored
@@ -2238,3 +2238,29 @@ header .form-inline {
|
||||
padding: 5px; } }
|
||||
|
||||
/*# sourceMappingURL=style.css.map */
|
||||
|
||||
.calendar{
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.calendar-body-column {
|
||||
display: flex;
|
||||
}
|
||||
.calendar-container{
|
||||
height: 7.5rem;
|
||||
text-align: center;
|
||||
vertical-align: middle !important;
|
||||
border: none !important;
|
||||
}
|
||||
.btn-calendar{
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
border-radius: 50%;
|
||||
background-color: #949CA0;
|
||||
}
|
||||
.thead-dark {
|
||||
color: #fff;
|
||||
background-color: #212529;
|
||||
border-color: #32383e;
|
||||
text-align: center;
|
||||
}
|
||||
111
public/assets/js/calendar/calendar.js
vendored
Normal file
111
public/assets/js/calendar/calendar.js
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
init();
|
||||
|
||||
function init() {
|
||||
|
||||
var lastid = 99;
|
||||
|
||||
(function($) {
|
||||
$( document ).ajaxError(function() {
|
||||
$( ".log" ).text( "Triggered ajaxError handler." );
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
(function($) {
|
||||
var mycalendar = $('.calendar');
|
||||
|
||||
$.post('/api/calendar/generate', { month: "7", year: "2018" } , function(data) {
|
||||
mycalendar.replaceWith(data);
|
||||
|
||||
console.log('Calendar Initialised');
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function calsetactive(myid) {
|
||||
if (lastid != 99) {
|
||||
document.getElementById(lastid).classList.toggle("calendar-btn-active");
|
||||
}
|
||||
var myDate = document.getElementById(myid);
|
||||
myDate.classList.toggle("calendar-btn-active");
|
||||
lastid = myid;
|
||||
|
||||
if (myDate.classList.contains("calendar-nothing")) {
|
||||
calendarEmptyDay(myid);
|
||||
} else {
|
||||
calendarOpen(myid);
|
||||
}
|
||||
}
|
||||
|
||||
function calendarOpen(myid) {
|
||||
var mydate = document.getElementById(myid).name;
|
||||
$(function() {
|
||||
var loadingDiv = $('#calendarmodalload');
|
||||
$.get('/adminV2/assets/lib/calendar/calendarmodal.php?date='+mydate, function(data) {
|
||||
loadingDiv.replaceWith(data);
|
||||
console.log("Loading day: "+mydate);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function calendarEmptyDay(myid) {
|
||||
var mydate = document.getElementById(myid).name;
|
||||
$(function() {
|
||||
var loadingDiv = $('#calendarmodalload');
|
||||
$.get('/adminV2/assets/lib/calendar/calendarEmptyDay.php?date='+mydate, function(data) {
|
||||
loadingDiv.replaceWith(data);
|
||||
console.log("Loading empty day: "+mydate);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Modal Calendar
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
function calendarmodalClose() {
|
||||
document.getElementById('calendar-modal').style.display = "none";
|
||||
}
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = function(event) {
|
||||
if (event.target == document.getElementById('calendar-modal')) {
|
||||
document.getElementById('calendar-modal').style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// Boutton Back and Next on calendar Head
|
||||
function calendarback() {
|
||||
console.log("click detect");
|
||||
lastid = 99;
|
||||
$(function() {
|
||||
var mycalendar = $('.calendar');
|
||||
varmonth = varmonth - 1;
|
||||
if (varmonth < 1) {
|
||||
varyear = varyear - 1;
|
||||
varmonth = 12;
|
||||
}
|
||||
$.get('/adminV2/assets/lib/calendar/calendar.php?month='+varmonth+'&year='+varyear, function(data) {
|
||||
mycalendar.replaceWith(data);
|
||||
console.log("Going next");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function calendarnext(){
|
||||
console.log("click detect");
|
||||
lastid = 99;
|
||||
$(function() {
|
||||
var mycalendar = $('.calendar');
|
||||
varmonth = varmonth + 1;
|
||||
if (varmonth > 12) {
|
||||
varyear = varyear + 1;
|
||||
varmonth = 1;
|
||||
}
|
||||
$.get('/adminV2/assets/lib/calendar/calendar.php?month='+varmonth+'&year='+varyear, function(data) {
|
||||
mycalendar.replaceWith(data);
|
||||
console.log("Going next");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -27,6 +27,7 @@ return [
|
||||
'public_page_edit_article' => "Modifier un article",
|
||||
'public_page_delete_article' => "Supprimer un article",
|
||||
'calendar_title' => "Horaire",
|
||||
'calendar_display' => "Afficher l'horaire",
|
||||
'services_title' => "Services",
|
||||
'stats_title' => "Statistiques",
|
||||
'users_title' => "Utilisateurs",
|
||||
|
||||
50
resources/views/admin/calendar.blade.php
Normal file
50
resources/views/admin/calendar.blade.php
Normal file
@@ -0,0 +1,50 @@
|
||||
@extends('layouts.admin.main')
|
||||
|
||||
@section('content')
|
||||
<div class="col-sm-12 col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body pb-0">
|
||||
<div class="dropdown float-right">
|
||||
<button class="btn bg-transparent dropdown-toggle theme-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fa fa-cog"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<div class="dropdown-menu-content">
|
||||
<a class="dropdown-item" href="#">Action</a>
|
||||
<a class="dropdown-item" href="#">Another action</a>
|
||||
<a class="dropdown-item" href="#">Something else here</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="calendar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
<div class="breadcrumbs">
|
||||
<div class="col-sm-4">
|
||||
<div class="page-header float-left">
|
||||
<div class="page-title">
|
||||
<h1>{{ trans('admin/dashboard.page_title')}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="page-header float-right">
|
||||
<div class="page-title">
|
||||
<ol class="breadcrumb text-right">
|
||||
<li class="active">{{ trans('admin/dashboard.breadcrumb')}}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('custom_scripts')
|
||||
<script src="/assets/js/calendar/calendar.js"></script>
|
||||
<div class="log"></div>
|
||||
@endsection
|
||||
@@ -1,6 +1,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<?php setlocale( LC_ALL, str_replace('_', '-', app()->getLocale())) ?>
|
||||
<title>C-CMS - Espace Administration</title>
|
||||
<meta name="description" content="Sufee Admin - HTML5 Admin Template">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
@@ -40,8 +40,8 @@ foreach (Auth::user()->unreadNotifications as $notification) {
|
||||
|
||||
<div class="col-sm-5">
|
||||
<div class="user-area dropdown float-right">
|
||||
<a class="btn">{{ Auth::User()->lastname }} {{ Auth::User()->firstname }}</a>
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
|
||||
<div class="btn">{{ Auth::User()->lastname }} {{ Auth::User()->firstname }}</div>
|
||||
<img class="user-avatar rounded-circle" src="/assets/admin/images/avatar/user-{{ Auth::User()->avatar }}.jpg" alt="User Avatar">
|
||||
</a>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script src="/assets/admin/assets/js/vendor/jquery-2.1.4.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
|
||||
<script src="/assets/admin/assets/js/plugins.js"></script>
|
||||
<script src="/assets/admin/assets/js/main.js"></script>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<li class="menu-item-has-children dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="menu-icon fa fa-calendar"></i>{{ trans('admin/sidebar.calendar_title')}}</a>
|
||||
<ul class="sub-menu children dropdown-menu">
|
||||
<li><i class="menu-icon fa fa-list"></i><a href="#">{{ trans('admin/sidebar.public_page_see')}}</a></li>
|
||||
<li><i class="menu-icon fa fa-list"></i><a href="/admin/calendar">{{ trans('admin/sidebar.calendar_display')}}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="menu-item-has-children dropdown">
|
||||
|
||||
@@ -16,3 +16,6 @@ use Illuminate\Http\Request;
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
/* Calendar Route */
|
||||
Route::post('/calendar/generate', 'CalendarController@generate');
|
||||
@@ -22,6 +22,8 @@ Route::get('/', function () {
|
||||
Route::get('/admin', 'AdminController@index')->name('admin');
|
||||
Route::get('/admin/update', 'AdminController@update');
|
||||
|
||||
Route::get('/admin/calendar', 'CalendarController@index');
|
||||
|
||||
/* Other Route */
|
||||
Route::get('/test', function () {
|
||||
|
||||
@@ -29,3 +31,4 @@ Route::get('/test', function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Illuminate\Foundation\Auth;
|
||||
|
||||
use \App\Log;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
@@ -103,6 +104,8 @@ trait AuthenticatesUsers
|
||||
|
||||
$this->clearLoginAttempts($request);
|
||||
|
||||
Log::saveLog("c'est connecté");
|
||||
|
||||
return $this->authenticated($request, $this->guard()->user())
|
||||
?: redirect()->intended($this->redirectPath());
|
||||
}
|
||||
@@ -152,6 +155,8 @@ trait AuthenticatesUsers
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Log::saveLog("C'est déconnecté");
|
||||
|
||||
$this->guard()->logout();
|
||||
|
||||
$request->session()->invalidate();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Illuminate\Routing;
|
||||
|
||||
use \App\Log;
|
||||
use Closure;
|
||||
use ArrayObject;
|
||||
use JsonSerializable;
|
||||
|
||||
Reference in New Issue
Block a user