mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
3.2.5
This commit is contained in:
@@ -36,4 +36,10 @@ class AdminController extends Controller
|
||||
return view('admin.update');
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
$alerts = \App\Event::checkForError();
|
||||
return view('admin.status.index',['alerts' => $alerts]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,13 +137,33 @@ class ConfigController extends Controller
|
||||
|
||||
public function editfilesConfig()
|
||||
{
|
||||
$config = \App\Config::all()->where('name','cadet_list')->first();
|
||||
$configList = [
|
||||
'cadet_list'
|
||||
];
|
||||
|
||||
$config->data = [\request('cadet_list')];
|
||||
$configListEncrypt = [
|
||||
'GOOGLE_DRIVE_CLIENT_ID',
|
||||
'GOOGLE_DRIVE_CLIENT_SECRET',
|
||||
'GOOGLE_DRIVE_REFRESH_TOKEN',
|
||||
'GOOGLE_DRIVE_FOLDER_ID'
|
||||
];
|
||||
|
||||
$config->save();
|
||||
|
||||
clog('edit','success','a modifié la configuration');
|
||||
foreach ($configList as $configName)
|
||||
{
|
||||
$config = \App\Config::find($configName);
|
||||
$config->data = [\request($configName)];
|
||||
$config->save();
|
||||
}
|
||||
|
||||
foreach ($configListEncrypt as $configName)
|
||||
{
|
||||
$config = \App\Config::find($configName);
|
||||
$config->data = [\Crypt::encryptString(\request($configName))];
|
||||
$config->save();
|
||||
}
|
||||
|
||||
clog('edit','success','a modifié la configuration des fichiers');
|
||||
return redirect('/admin/config/files')->with('success','Modification sauvegarder avec succès !');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ class EventController extends Controller
|
||||
{
|
||||
$event = new Event();
|
||||
|
||||
|
||||
|
||||
$event->name = request('name');
|
||||
$event->date_begin = request('begin_time');
|
||||
$event->date_end = request('end_time');
|
||||
@@ -51,7 +53,7 @@ class EventController extends Controller
|
||||
$event->is_mandatory = 0;
|
||||
}
|
||||
|
||||
$event->desc = '';
|
||||
$event->desc = \request('admin_desc');
|
||||
|
||||
if(\request("use_weekly_msg"))
|
||||
{
|
||||
@@ -95,10 +97,10 @@ class EventController extends Controller
|
||||
]);
|
||||
$nbPeriode++;
|
||||
}
|
||||
|
||||
$event->schedule = [
|
||||
'periodes' => $periodes,
|
||||
'niveaux' => $niveaux
|
||||
'niveaux' => $niveaux,
|
||||
'courses' => []
|
||||
];
|
||||
|
||||
$event->save();
|
||||
@@ -106,7 +108,7 @@ class EventController extends Controller
|
||||
if ($event->use_schedule) {
|
||||
for ($l=1; $l < $nbLevel; $l++) {
|
||||
for ($p=1; $p < $nbPeriode; $p++) {
|
||||
|
||||
|
||||
$course = new \App\Course();
|
||||
|
||||
$users = \App\User::all();
|
||||
@@ -119,16 +121,26 @@ class EventController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$course->name = request('name_n'.$l.'_p'.$p);
|
||||
$course->user_id = $instructor;
|
||||
$course->ocom = request('ocom_n'.$l.'_p'.$p);
|
||||
$course->location = request('location_n'.$l.'_p'.$p);
|
||||
$course->periode = $p;
|
||||
$course->level = $l;
|
||||
|
||||
$course->comment = "";
|
||||
$course->event_id = $event->id;
|
||||
|
||||
if(\request("use_course_n".$l."_p".$p) == 'on')
|
||||
{
|
||||
$course->name = request('name_n'.$l.'_p'.$p);
|
||||
$course->ocom = request('ocom_n'.$l.'_p'.$p);
|
||||
$course->comment = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$course->name = "";
|
||||
$course->ocom = "";
|
||||
$course->comment = request('desc_n'.$l.'_p'.$p);
|
||||
}
|
||||
|
||||
$course->save();
|
||||
}
|
||||
}
|
||||
@@ -253,4 +265,9 @@ class EventController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function checkEvent()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
117
app/Http/Controllers/GoogleDriveController.php
Normal file
117
app/Http/Controllers/GoogleDriveController.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class GoogleDriveController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param string $dir
|
||||
* @param bool $recursive
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index($dir = '/',$recursive = true)
|
||||
{
|
||||
$contents = collect(Storage::cloud()->listContents($dir, $recursive));
|
||||
|
||||
return $contents->where('type', '=', 'file'); // files
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$path = Storage::cloud()->makeDirectory('Test Dir');
|
||||
dd($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param $filename
|
||||
* @return \Illuminate\Http\Response
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
$filename = \request('file');
|
||||
$recursive = false; // Get subdirectories also?
|
||||
$contents = collect(Storage::cloud()->listContents('/1nEe35-GvLX598RketTI-UoaOxIMNxfka', true));
|
||||
|
||||
$file = $contents
|
||||
->where('type', '=', 'file')
|
||||
->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME))
|
||||
->where('extension', '=', pathinfo($filename, PATHINFO_EXTENSION))
|
||||
->first(); // there can be duplicate file names!
|
||||
|
||||
//return $file; // array with file info
|
||||
|
||||
$rawData = Storage::cloud()->get($file['path']);
|
||||
|
||||
return response($rawData, 200)
|
||||
->header('ContentType', $file['mimetype'])
|
||||
->header('Content-Disposition', "attachment; filename='$filename'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$dir = '/';
|
||||
$recursive = false; // Get subdirectories also?
|
||||
$contents = collect(Storage::cloud()->listContents($dir, $recursive));
|
||||
|
||||
return view('admin.files.Google Drive.index',['directories' => $contents->where('type', '=', 'dir'), 'files' => $contents->where('type', '=', 'file')]);
|
||||
//return $contents->where('type', '=', 'file'); // files
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user