photo/resources/views/video/duplicates.blade.php

101 lines
2.9 KiB
PHP
Raw Normal View History

2016-07-04 06:00:33 +00:00
@extends('layouts.app')
@section('content')
<?php $data = [
'ID'=>'id',
'Video'=>'video',
2016-07-04 06:00:33 +00:00
'Signature'=>'signature',
2018-01-11 12:59:53 +00:00
'File Signature'=>'file_signature',
'Length'=>'length',
2016-07-04 06:00:33 +00:00
'Date Created'=>'datecreated',
'File Created'=>'created',
'File Modified'=>'modified',
'Filename'=>'filepath',
'Filesize'=>'filesize',
'Width'=>'width',
'Height'=>'height',
'Make'=>'make',
'Model'=>'model',
];
$form = [
'duplicate',
'flag',
'remove',
];
function changed($k,$v,$l=0)
{
static $changed = [];
if (! isset($changed[$l][$k]))
$changed[$l][$k] = $v;
return $changed[$l][$k] === $v;
} ?>
@foreach ($videos as $video)
<?php $duplicates = $video->list_duplicate(TRUE); ?>
<div class="container">
<div class="row">
<div class="col-md-11 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
Duplicate Video {{ $video->id }}
</div>
<div class="text-center">{{ $videos->links() }}</div>
<div class="panel-body">
<form action="{{ url('/v/duplicates') }}" method="POST">
<table class="table table-striped table-condensed table-hover">
@foreach ($data as $k=>$v)
<tr>
<th>{{ $k }}</th>
@foreach ($duplicates as $id)
<?php
$o = (new \App\Model\Video())->where('id',$id)->first();
switch ($v) :
case 'id': $x=$id; $y=sprintf('<a href="%s">%s</a>',url('/v/info/'.$o->id),$o->id); break;
case 'video': $x=$o->signature(TRUE);$y=$o->view();; break;
case 'length': $x=$y=$o->length; break;
2016-07-04 06:00:33 +00:00
case 'signature': $x=$y=$o->signature(TRUE); break;
2018-01-11 12:59:53 +00:00
case 'file_signature': $x=$y=$o->file_signature(TRUE); break;
2016-07-04 06:00:33 +00:00
case 'datecreated': $x=$y=$o->date_taken(); break;
case 'created': $x=$y=$o->file_date('c',TRUE); break;
case 'modified': $x=$y=$o->file_date('m',TRUE); break;
case 'filepath': $x=$y=$o->file_path(TRUE); break;
case 'filesize': $x=$y=$o->file_size(); break;
case 'width': $x=$y=$o->width; break;
case 'height': $x=$y=$o->height; break;
case 'make': $x=$y=$o->make; break;
case 'model': $x=$y=$o->model; break;
endswitch ?>
<td class="{{ changed($v,$x) ? '' : 'danger' }}"><?php echo $y; ?></td>
@endforeach {{-- video --}}
</tr>
@endforeach {{-- data --}}
@foreach ($form as $v)
<tr>
<th>{{ $v }}</th>
@foreach ($duplicates as $id)
<?php $o = (new \App\Model\Video())->where('id',$id)->first(); ?>
<td><input type="checkbox" name="{{ sprintf('%s[%s]',$v,$o->id) }}" value="1" {{ $o->$v==1 ? 'checked="checked"' : '' }}></td>
@endforeach {{-- video --}}
</tr>
@endforeach {{-- form --}}
</table>
@foreach ($duplicates as $id)
<input type="hidden" name="video[]" value="{{ $id }}">
@endforeach {{-- video --}}
<input type="hidden" name="page" value="{{ $videos->currentPage() }}">
<button class="btn btn-default">Update</button>
{{ csrf_field() }}
</form>
</div>
</div>
</div>
</div>
</div>
@endforeach
@endsection