Display mmc from FS
This commit is contained in:
@@ -127,6 +127,62 @@ class MMCController extends Controller
|
||||
{
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$project = Project::find($project_id);
|
||||
return view('mmc.scan', ['project' => $project]);
|
||||
|
||||
|
||||
$MMC = array();
|
||||
$total_size = 0;
|
||||
$total_count = 0;
|
||||
$MMC_PATH = $project->mmc_path;
|
||||
$mmc_dir = scandir($MMC_PATH);
|
||||
|
||||
|
||||
foreach ($mmc_dir as $entry) {
|
||||
$course_path = $MMC_PATH . '/' . $entry;
|
||||
if (is_dir($course_path)) {
|
||||
if (intval($entry) > 0 && intval($entry) < 99) {
|
||||
// $MMC[] = $entry;
|
||||
// echo ($entry . "\n");
|
||||
$mmc_course_dir = scandir($course_path);
|
||||
foreach ($mmc_course_dir as $course_entry) {
|
||||
// VVV Images VVV
|
||||
if (strcasecmp($course_entry, 'images') == 0) {
|
||||
$course_image_path = $course_path . '/' . $course_entry;
|
||||
if (is_dir($course_image_path)) {
|
||||
// echo ($course_image_path . "\n");
|
||||
$MMC[$entry]['image_dir'] = $course_entry;
|
||||
$course_images = scandir($course_image_path);
|
||||
foreach ($course_images as $image) {
|
||||
$image_file_path = $course_image_path . '/' . $image;
|
||||
if (is_file($image_file_path)) {
|
||||
if (strncmp($entry, $image, 2) == 0) {
|
||||
if (
|
||||
strcasecmp(substr($image, -3, 3), 'jpg') == 0 ||
|
||||
strcasecmp(substr($image, -3, 3), 'svg') == 0 ||
|
||||
strcasecmp(substr($image, -3, 3), 'swf') == 0
|
||||
) {
|
||||
// $MMC[$entry][] = $image;
|
||||
$tmp_array = array();
|
||||
$tmp_array['file'] = $image;
|
||||
$tmp_array['size'] = filesize($image_file_path);
|
||||
$tmp_array['mtime'] = filemtime($image_file_path);
|
||||
$tmp_array['atime'] = fileatime($image_file_path);
|
||||
|
||||
$MMC[$entry]['images'][] = $tmp_array;
|
||||
|
||||
$total_size += $tmp_array['size'];
|
||||
$total_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// ^^^ Images ^^^
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('mmc.scan', ['project' => $project,'MMC' => $MMC]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,6 +827,9 @@ select {
|
||||
.max-w-6xl {
|
||||
max-width: 72rem;
|
||||
}
|
||||
.max-w-xl {
|
||||
max-width: 36rem;
|
||||
}
|
||||
.flex-1 {
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
@@ -936,6 +939,9 @@ select {
|
||||
.border-l-4 {
|
||||
border-left-width: 4px;
|
||||
}
|
||||
.border-r {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
.border-gray-300 {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
||||
@@ -955,6 +961,10 @@ select {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(129 140 248 / var(--tw-border-opacity));
|
||||
}
|
||||
.border-gray-400 {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(156 163 175 / var(--tw-border-opacity));
|
||||
}
|
||||
.bg-white {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||
@@ -1110,6 +1120,9 @@ select {
|
||||
.tracking-widest {
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.tracking-wider {
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.text-gray-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ $project->name }}: {{ __('Create MMC') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||
<div class="p-6 bg-white border-b border-gray-200">
|
||||
<div class="w-96 mx-auto">
|
||||
MMC create form here
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -1,7 +1,7 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Scan MMC') }}
|
||||
{{ $project->name }}: {{ __('Scan MMC') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
@@ -10,6 +10,44 @@
|
||||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||
<div class="p-6 bg-white border-b border-gray-200">
|
||||
<div class="w-96 mx-auto">
|
||||
@foreach ($MMC as $key => $value)
|
||||
<h3 class="font-bold text-l text-gray-800 leading-tight">АУК {{ $key }}</h3>
|
||||
<table class="table table-sm border-b border-gray-200">
|
||||
<tr class="border border-gray-200">
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('File') }}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('Size') }}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('MTime') }}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('ATime') }}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('Actions') }}
|
||||
</th>
|
||||
</tr>
|
||||
@forelse ($value['images'] as $image)
|
||||
<tr class="border border-gray-200">
|
||||
<td class="p-2 border border-gray-200">{{ $image['file'] }}</td>
|
||||
<td class="p-2 border border-gray-200">{{ $image['size'] }}</td>
|
||||
<td class="p-2 border border-gray-200">{{ $image['mtime'] }}</td>
|
||||
<td class="p-2 border border-gray-200">{{ $image['atime'] }}</td>
|
||||
<td class="p-2 border border-gray-200"> </td>
|
||||
</tr>
|
||||
|
||||
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="p-2 border border-gray-200 text-center">No Documents!
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</table>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@ Route::prefix('admin')->middleware(['admin'])->group(function () {
|
||||
Route::resource('/projects', ProjectController::class)->middleware(['auth']);
|
||||
Route::post('/project/{project}/select',SelectProjectController::class)->middleware(['auth'])->name('project.select');
|
||||
|
||||
Route::resource('/mmc', MMCController::class)->middleware(['auth']);
|
||||
Route::resource('/mmc', MMCController::class)->middleware(['auth'])->only(['index','create']);
|
||||
Route::get('/mmc/scan', [MMCController::class, 'scan'])->middleware(['auth'])->name('mmc.scan');
|
||||
Route::resource('/documents', DocumentController::class)->except('show')->middleware(['auth']);
|
||||
Route::resource('/auks', AUKController::class)->except('show')->middleware(['auth']);
|
||||
|
||||
Reference in New Issue
Block a user