🏡 index : ~doyle/zpan.git

author Jordan Doyle <jordan@doyle.wf> 2016-06-19 14:30:14.0 +01:00:00
committer Jordan Doyle <jordan@doyle.wf> 2016-06-19 14:30:14.0 +01:00:00
commit
6c36768efb6678ca6d84bf298102781d6108cd05 [patch]
tree
60f8d3792a58d9b4d1c62e6b128f7a95cc8212c3
parent
992921f0d8482bd8c90781943e212bdfb5253f40
download
6c36768efb6678ca6d84bf298102781d6108cd05.tar.gz

Return the user's name raw on timetables



Diff

 app/Http/Controllers/DJ/TimetableController.php    |  8 +++++++-
 app/Http/Controllers/Event/TimetableController.php | 11 ++++++++++-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/app/Http/Controllers/DJ/TimetableController.php b/app/Http/Controllers/DJ/TimetableController.php
index 114660b..7346f69 100644
--- a/app/Http/Controllers/DJ/TimetableController.php
+++ a/app/Http/Controllers/DJ/TimetableController.php
@@ -21,7 +21,7 @@
     */
    public function getTimetable()
    {
        return view('dj.timetable', ['timetable' => $this->getJSONTimetable()]);
        return view('dj.timetable', ['timetable' => $this->getJSONTimetable(false)]);
    }

    /**
@@ -131,9 +131,10 @@
    /**
     * Get the booked slots for this week in JSON format.
     *
     * @param bool $raw should we return raw html
     * @return array
     */
    public function getJSONTimetable()
    public function getJSONTimetable($raw = true)
    {
        $week = Timetable::where('week', Carbon::now()->weekOfYear)->where('year', Carbon::now()->year)->get();

@@ -148,7 +149,8 @@
        ];

        foreach ($week as $slot) {
            $timetable[$slot->day][$slot->hour] = $slot->user->getDisplayName();
            $timetable[$slot->day][$slot->hour] = $raw ? $slot->user->getDisplayName()->toHtml() :
                $slot->user->getDisplayName();
        }

        return $timetable;
diff --git a/app/Http/Controllers/Event/TimetableController.php b/app/Http/Controllers/Event/TimetableController.php
index 7bf62e4..1b96fe1 100644
--- a/app/Http/Controllers/Event/TimetableController.php
+++ a/app/Http/Controllers/Event/TimetableController.php
@@ -22,7 +22,7 @@
     */
    public function getTimetable()
    {
        return view('events.timetable', ['timetable' => $this->getJSONTimetable()]);
        return view('events.timetable', ['timetable' => $this->getJSONTimetable(false)]);
    }

    /**
@@ -181,9 +181,10 @@
    /**
     * Get the booked slots for this week in JSON format.
     *
     * @param bool $raw should we return the user's name in raw html
     * @return array
     */
    public function getJSONTimetable()
    public function getJSONTimetable($raw = true)
    {
        $week = Event::where('week', Carbon::now()->weekOfYear)
            ->where('year', Carbon::now()->year)
@@ -203,7 +204,11 @@
        foreach ($week as $slot) {
            $type = $slot->type->name;

            $timetable[$slot->day][$slot->hour] = $slot->user()->first()->getDisplayName() . " ({$type})";
            $timetable[$slot->day][$slot->hour] = [
                'name' => $raw ? $slot->user()->first()->getDisplayName()->toHtml() :
                    $slot->user()->first()->getDisplayName(),
                'type' => $type
            ];
        }

        return $timetable;