Hinzugefügt
- Berechtigungen für Kurzmitteilungen - Adminscript für Modelle ohne Veröffentlichungen angepasst
This commit is contained in:
parent
f4ba271c91
commit
369e9fb0af
@ -298,17 +298,41 @@ class DashboardController extends ExtendedController
|
||||
->get();
|
||||
|
||||
$statistics = array();
|
||||
$totals = (object)[];
|
||||
$totals->totalOverall = 0;
|
||||
$totals->totalLastHour = 0;
|
||||
$totals->totalToday = 0;
|
||||
$totals->totalToday = 0;
|
||||
$totals->totalSevenDays = 0;
|
||||
// Zähle alle Datenbankeinträge nach Orten
|
||||
foreach($cities as $city)
|
||||
{
|
||||
$obj = (object)[];
|
||||
$obj->city = $city->city;
|
||||
$obj->subscriptions = SubscribeChild::where('city', $city->city)->count();
|
||||
$totals->totalOverall += $obj->subscriptions;
|
||||
|
||||
$obj->lastHour = SubscribeChild::where('city', $city->city)
|
||||
->where('created_at', '>', Carbon::now()->subHours(1)->toDateTimeString())
|
||||
->count();
|
||||
$totals->totalLastHour += $obj->lastHour;
|
||||
|
||||
$obj->today = SubscribeChild::where('city', $city->city)
|
||||
->where('created_at', '>', Carbon::today()->toDateTimeString())
|
||||
->count();
|
||||
$totals->totalToday += $obj->today;
|
||||
|
||||
$obj->sevenDays = SubscribeChild::where('city', $city->city)
|
||||
->where('created_at', '>', Carbon::today()->subDays(7)->toDateTimeString())
|
||||
->count();
|
||||
$totals->totalSevenDays += $obj->sevenDays;
|
||||
|
||||
$obj->duplicates = SubscribeChild::where('city', $city->city)
|
||||
->groupBy('lastnameParent', 'firstnameParent', 'firstnameChild', 'city')
|
||||
->orderBy('lastnameParent', 'firstnameParent', 'firstnameChild')
|
||||
->havingRaw('COUNT(*) > 1')
|
||||
->get();
|
||||
|
||||
$statistics[] = $obj;
|
||||
}
|
||||
|
||||
@ -321,7 +345,7 @@ class DashboardController extends ExtendedController
|
||||
$view->with('title', __('admin.subscriptions'));
|
||||
$view->with('type', 'subscriptions');
|
||||
$view->with('statistics', $statistics);
|
||||
$view->with('total', $count);
|
||||
$view->with('totals', $totals);
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
@ -430,7 +430,14 @@ class ExtendedController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
$model = $this->newModel()->create();
|
||||
if($this->modelClass == Post::class)
|
||||
{
|
||||
$model = $this->newModel()->create();
|
||||
}
|
||||
else
|
||||
{
|
||||
$model = $this->newModel();
|
||||
}
|
||||
$model->save();
|
||||
$model = $this->prepareModel($model);
|
||||
$this->hook_after_action_create($model);
|
||||
@ -949,7 +956,14 @@ class ExtendedController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$model->fill($request->all());
|
||||
foreach($request->all() as $key => $value)
|
||||
{
|
||||
if(Schema::hasColumn($model->getTable(), $key))
|
||||
{
|
||||
$model->$key = $value;
|
||||
}
|
||||
}
|
||||
// $model->fill($request->all());
|
||||
// $model->fill($request->only($fields));
|
||||
if($this->modelClass == Post::class || $this->modelClass == Tag::class)
|
||||
{
|
||||
|
||||
@ -292,35 +292,38 @@ class PostController extends ExtendedController
|
||||
// Vorberechnungen zum Veröffentlichungsdatum
|
||||
$daysToPublishBefore = -999999;
|
||||
$publishDate = Carbon::now()->startOfDay();
|
||||
if(key_exists('date', $this->publishOptions))
|
||||
if(is_array($this->publishOptions))
|
||||
{
|
||||
$publishDateString = strtolower($this->publishOptions['date']);
|
||||
if($publishDateString == 'now')
|
||||
if(key_exists('date', $this->publishOptions))
|
||||
{
|
||||
if($import)
|
||||
$publishDateString = strtolower($this->publishOptions['date']);
|
||||
if($publishDateString == 'now')
|
||||
{
|
||||
$daysToPublishBefore = 0;
|
||||
if($import)
|
||||
{
|
||||
$daysToPublishBefore = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$daysToPublishBefore = Carbon::now()->diffInDays(Carbon::parse($model->datetime));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$daysToPublishBefore = Carbon::now()->diffInDays(Carbon::parse($model->datetime));
|
||||
$daysToPublishBefore = preg_replace('/[^0-9]/', '', $publishDateString);
|
||||
if(substr($publishDateString, -1) == "w")
|
||||
{
|
||||
// Umrechnung von Wochen in Tage
|
||||
$daysToPublishBefore *= 7;
|
||||
}
|
||||
if(substr($publishDateString, 0, 1) == "-")
|
||||
{
|
||||
$daysToPublishBefore *= -1;
|
||||
}
|
||||
}
|
||||
// Berechne das Datum, an dem der Post veröffentlicht werden soll
|
||||
$publishDate = Carbon::parse($model->datetime)->addDays($daysToPublishBefore)->startOfDay();
|
||||
}
|
||||
else
|
||||
{
|
||||
$daysToPublishBefore = preg_replace('/[^0-9]/', '', $publishDateString);
|
||||
if(substr($publishDateString, -1) == "w")
|
||||
{
|
||||
// Umrechnung von Wochen in Tage
|
||||
$daysToPublishBefore *= 7;
|
||||
}
|
||||
if(substr($publishDateString, 0, 1) == "-")
|
||||
{
|
||||
$daysToPublishBefore *= -1;
|
||||
}
|
||||
}
|
||||
// Berechne das Datum, an dem der Post veröffentlicht werden soll
|
||||
$publishDate = Carbon::parse($model->datetime)->addDays($daysToPublishBefore)->startOfDay();
|
||||
}
|
||||
|
||||
return $publishDate;
|
||||
|
||||
@ -355,9 +355,16 @@ $(document).ready(function () {
|
||||
$('.nav-tabs a[href="#files-details"]').tab('show'); // Nur benötigte Schaltflächen anzeigen
|
||||
|
||||
$('.btn.wizard_step_back').show();
|
||||
$('.btn.wizard_step_forward').show();
|
||||
$('.btn.save').hide();
|
||||
wizardState = wizardStates.STEP_FILES;
|
||||
|
||||
if ($(".nav-item a[href='#files-details']").length) {
|
||||
$('.btn.wizard_step_forward').show();
|
||||
$('.btn.save').hide();
|
||||
wizardState = wizardStates.STEP_FILES;
|
||||
} else {
|
||||
wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
|
||||
updateWizardForm(null);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case wizardStates.BACK_TO_STEP_FORM:
|
||||
@ -382,6 +389,11 @@ $(document).ready(function () {
|
||||
wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
|
||||
updateWizardForm(null);
|
||||
break;
|
||||
|
||||
case wizardButtonStates.BUTTON_SAVE:
|
||||
wizardState = wizardStates.SAVE;
|
||||
updateWizardForm(null);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -271,9 +271,17 @@ $(document).ready(function (){
|
||||
|
||||
// Nur benötigte Schaltflächen anzeigen
|
||||
$('.btn.wizard_step_back').show();
|
||||
$('.btn.wizard_step_forward').show();
|
||||
$('.btn.save').hide();
|
||||
wizardState = wizardStates.STEP_FILES;
|
||||
if($(".nav-item a[href='#files-details']").length)
|
||||
{
|
||||
$('.btn.wizard_step_forward').show();
|
||||
$('.btn.save').hide();
|
||||
wizardState = wizardStates.STEP_FILES;
|
||||
}
|
||||
else
|
||||
{
|
||||
wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
|
||||
updateWizardForm(null);
|
||||
}
|
||||
break;
|
||||
|
||||
case wizardStates.BACK_TO_STEP_FORM:
|
||||
@ -300,6 +308,11 @@ $(document).ready(function (){
|
||||
wizardState = wizardStates.FORWARD_TO_STEP_PUBLISH;
|
||||
updateWizardForm(null);
|
||||
break;
|
||||
|
||||
case wizardButtonStates.BUTTON_SAVE:
|
||||
wizardState = wizardStates.SAVE;
|
||||
updateWizardForm(null);
|
||||
break;
|
||||
}
|
||||
break; break;
|
||||
|
||||
|
||||
@ -108,13 +108,15 @@
|
||||
{{ Form::open(array('id' => 'formPublish')) }}
|
||||
{{ Form::checkbox('publish_website', 'true', ($model->published == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_website')) }}
|
||||
{{ Form::label('publish_website', 'Internetseite') }}<br>
|
||||
@if($model->hasPublications)
|
||||
{{ Form::checkbox('publish_facebook', 'true', ($model->publication('facebook')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_facebook', ($model->publication('facebook')->isPublished() ? 'disabled' : ''))) }}
|
||||
{{ Form::label('publish_facebook', 'Facebook '.($model->publication('facebook')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('facebook')->date_to_publish).')')) }}<br>
|
||||
{{ Form::checkbox('publish_twitter', 'true', ($model->publication('twitter')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_twitter', ($model->publication('twitter')->isPublished() ? 'disabled' : ''))) }}
|
||||
{{ Form::label('publish_twitter', 'Twitter '.($model->publication('twitter')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('twitter')->date_to_publish).')')) }}<br>
|
||||
{{ Form::checkbox('publish_stadtanzeiger', 'true', ($model->publication('stadtanzeiger')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_stadtanzeiger', ($model->publication('stadtanzeiger')->isPublished() ? 'disabled' : ''))) }}
|
||||
{{ Form::label('publish_stadtanzeiger', 'Stadtanzeiger '.($model->publication('stadtanzeiger')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('stadtanzeiger')->date_to_publish).')')) }}<br>
|
||||
@if($model->hasGetMutator('HasPublications'))
|
||||
@if($model->hasPublications)
|
||||
{{ Form::checkbox('publish_facebook', 'true', ($model->publication('facebook')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_facebook', ($model->publication('facebook')->isPublished() ? 'disabled' : ''))) }}
|
||||
{{ Form::label('publish_facebook', 'Facebook '.($model->publication('facebook')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('facebook')->date_to_publish).')')) }}<br>
|
||||
{{ Form::checkbox('publish_twitter', 'true', ($model->publication('twitter')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_twitter', ($model->publication('twitter')->isPublished() ? 'disabled' : ''))) }}
|
||||
{{ Form::label('publish_twitter', 'Twitter '.($model->publication('twitter')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('twitter')->date_to_publish).')')) }}<br>
|
||||
{{ Form::checkbox('publish_stadtanzeiger', 'true', ($model->publication('stadtanzeiger')->state == "" ? ($wizard ? true : false) : true), array('class' => 'form-check-input', 'id' => 'publish_stadtanzeiger', ($model->publication('stadtanzeiger')->isPublished() ? 'disabled' : ''))) }}
|
||||
{{ Form::label('publish_stadtanzeiger', 'Stadtanzeiger '.($model->publication('stadtanzeiger')->date_to_publish <= \Carbon\Carbon::now() ? '('.__("general.immediately").')' : '('.Date::daysToPublicationString($model->publication('stadtanzeiger')->date_to_publish).')')) }}<br>
|
||||
@endif
|
||||
@endif
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
|
||||
@ -9,27 +9,36 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Ort</th>
|
||||
<th scope="col">Anmeldungen</th>
|
||||
<th scope="col">Gesamt</th>
|
||||
<th scope="col">Letzte Stunde</th>
|
||||
<th scope="col">Heute</th>
|
||||
<th scope="col">Letzte 7 Tage</th>
|
||||
<th scope="col">Doppelte Anmeldungen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($statistics as $s)
|
||||
<tr>
|
||||
<td scope="row">{{ $s->city }}</td>
|
||||
<td>{{ $s->subscriptions }}</td>
|
||||
<td data-toggle="tooltip" title="
|
||||
<tr scope="row">
|
||||
<td scope="col">{{ $s->city }}</td>
|
||||
<td scope="col">{{ $s->subscriptions }}</td>
|
||||
<td scope="col">{{ $s->lastHour }}</td>
|
||||
<td scope="col">{{ $s->today }}</td>
|
||||
<td scope="col">{{ $s->sevenDays }}</td>
|
||||
<td scope="col" data-toggle="tooltip" title="
|
||||
@foreach($s->duplicates as $d)
|
||||
{{ $d->id }}, {{ $d->lastnameParent }}, {{ $d->firstnameParent }}, {{ $d->firstnameChild }}
|
||||
@endforeach
|
||||
">{{ $s->duplicates->count() }}</td>
|
||||
{{ $d->id }}, {{ $d->lastnameParent }}, {{ $d->firstnameParent }}, {{ $d->firstnameChild }}
|
||||
@endforeach
|
||||
">{{ $s->duplicates->count() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th scope="col">Gesamt</th>
|
||||
<th scope="col">{{ $total }}</th>
|
||||
<th scope="col">{{ $totals->totalOverall }}</th>
|
||||
<th scope="col">{{ $totals->totalLastHour }}</th>
|
||||
<th scope="col">{{ $totals->totalToday }}</th>
|
||||
<th scope="col">{{ $totals->totalSevenDays }}</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user