v1.5.18 Multiple events works, only admin pages is missing some pdf, view user and jpg functions
This commit is contained in:
@@ -98,17 +98,17 @@ class MultipleEventsController extends Controller
|
||||
$multiEvents = MultipleEventsParent::query()->get();
|
||||
if($request->newsoption == true){
|
||||
$news = new News();
|
||||
$news->name = "Nye ugenlig aktivitet";
|
||||
$news->name = "Nye ugentlig aktivitets";
|
||||
$news->subname = $event->week;
|
||||
$news->arrangement_id = $multipleParent->id;
|
||||
$news->type_id = '5';
|
||||
$news->content = "Den ugenlige aktivitets plan er landet";
|
||||
$news->content = "Den ugentlige aktivitets plan er landet";
|
||||
$news->resource_id = $event->resource_id;
|
||||
NewsController::storeAndGet($news);
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('multiple-events.index', ['multiEvents' => $multiEvents]);
|
||||
return redirect()->route('events.index', ['multiEvents' => $multiEvents]);
|
||||
|
||||
}
|
||||
|
||||
@@ -146,6 +146,18 @@ class MultipleEventsController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
public function accountsignups(Request $request)
|
||||
{
|
||||
// Find every event you have clicked on. And find all users to that event, and the event name itself.
|
||||
$multiEvents = UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->join('multiple_events', 'multiple_events.id', '=', 'user_events.multiple_event_id')->where('multiple_event_id', $request->multiEvent)->get();
|
||||
|
||||
if (count($multiEvents) == 0)
|
||||
$multiEvents = Event::where('id', $request->event)->get();
|
||||
|
||||
return Response::detect("multiple-events.signups", [ "multiEvent" => $multiEvents ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\UserEvent;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
@@ -129,7 +130,45 @@ class UserEventController extends Controller
|
||||
}
|
||||
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
$UserEvent = new UserEvent($data);
|
||||
$UserEvent = new UserEvent();
|
||||
$UserEvent->event_id = $request->event_id;
|
||||
$UserEvent->user_id = auth()->user()->id;
|
||||
$UserEvent->save();
|
||||
|
||||
if (request()->cookie('languagesSetting') == "dk")
|
||||
return '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>';
|
||||
if (request()->cookie('languagesSetting') == "en")
|
||||
return '<p class="text-center"><b>You are now participating in this event!</b></p>';
|
||||
|
||||
return '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>';
|
||||
}
|
||||
|
||||
|
||||
//Signs a user up to a multiple event via ajax
|
||||
public function createmultiajax(Request $request)
|
||||
{
|
||||
// Get written data from events.index
|
||||
$data = $request->validate([
|
||||
"multiple_event_id" => "required|max:255"
|
||||
]);
|
||||
|
||||
// Check the UserEvent table if there is a row that has the user_id AND the event_id
|
||||
$getTableInfo = UserEvent::where('user_id', auth()->user()->id)
|
||||
->where('multiple_event_id', $request->multiple_events_id)->get();
|
||||
|
||||
// If the row has both, then go back and show an error - Cause you're not allowed to be on the same event twice.
|
||||
if (count($getTableInfo) > 0) {
|
||||
if (request()->cookie('languagesSetting') == "dk")
|
||||
return '<p class="text-center"><b>Du har allerede tilmeldt dig denne Aktivitet!</b></p>';
|
||||
if (request()->cookie('languagesSetting') == "en")
|
||||
return '<p class="text-center"><b>You are already participating in this event!</b></p>';
|
||||
|
||||
return '<p class="text-center"><b>Du har allerede tilmeldt dig denne Aktivitet!</b></p>';
|
||||
}
|
||||
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
$UserEvent = new UserEvent();
|
||||
$UserEvent->multiple_event_id = $request->multiple_event_id;
|
||||
$UserEvent->user_id = auth()->user()->id;
|
||||
$UserEvent->save();
|
||||
|
||||
@@ -149,6 +188,28 @@ class UserEventController extends Controller
|
||||
->where('event_id', $request->event_id);
|
||||
|
||||
|
||||
// If you are in the Event, then remove yourself.
|
||||
if (count($UserEvent->get()) > 0) {
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
$UserEvent->delete();
|
||||
|
||||
if (request()->cookie('languagesSetting') == "dk")
|
||||
return '<p class="text-center"><b>Du er hermed afmeldt aktiviteten!</b></p>';
|
||||
if (request()->cookie('languagesSetting') == "en")
|
||||
return '<p class="text-center"><b>You are no longer participating in this event!</b></p>';
|
||||
|
||||
return '<p class="text-center"><b>Du er hermed afmeldt aktiviteten!</b></p>';
|
||||
}
|
||||
}
|
||||
|
||||
//Removes a users participation in an event via ajax
|
||||
public function createmultiajaxcancel(Request $request)
|
||||
{
|
||||
// Check the UserEvent table if there is a row that has the user_id AND the event_id
|
||||
$UserEvent = UserEvent::where('user_id', auth()->user()->id)
|
||||
->where('multiple_event_id', $request->multiple_event_id);
|
||||
|
||||
|
||||
// If you are in the Event, then remove yourself.
|
||||
if (count($UserEvent->get()) > 0) {
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
|
||||
Reference in New Issue
Block a user