/** * Display the specified resource. * * @param int $id * @param MeetingTransformer $transformer * @return \Illuminate\Http\Response */ public function show($id, MeetingTransformer $transformer) { $meeting = Meeting::find($id); if (!$meeting) { return $this->respondNotFound('Meeting does not exist'); } return $this->respond(['data' => $transformer->transform($meeting->toArray())]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($yy, $qq, $aa) { $fin = array(); $fm = Helpers::getSetting('first_month'); $m1 = $qq * 3 - 3 + $fm; $y1 = $yy; $m2 = $qq * 3 - 2 + $fm; $y2 = $yy; $m3 = $qq * 3 - 1 + $fm; $y3 = $yy; if ($m2 > 12) { $m2 = $m2 - 12; $y2 = $y2 + 1; } if ($m3 > 12) { $m3 = $m3 - 12; $y3 = $y3 + 1; } if ($aa == "edit") { $perms = Permission::where('user_id', '=', Auth::user()->id)->get(); foreach ($perms as $perm) { if ($perm->preaching or $perm->admin) { $data['authsoc'][] = $perm['society_id']; } } if (!isset($data['authsoc'])) { $aa = "view"; } } $firstDateTime = mktime(0, 0, 0, $m1, 1, $y1); $firstDay = date("N", $firstDateTime); $firstSunday = date("d M Y", mktime(0, 0, 0, $m1, 8 - $firstDay, $y1)); $lastSunday = strtotime($firstSunday); $lastDay = mktime(23, 59, 59, $m3, cal_days_in_month(CAL_GREGORIAN, $m3, $y3), $y3); $extras = Weekday::where('servicedate', '>=', $firstDateTime)->where('servicedate', '<=', $lastDay)->orderBy('servicedate')->get()->toArray(); $data['meetings'] = Meeting::where('meetingdatetime', '<', $lastDay)->where('meetingdatetime', '>', $firstDateTime)->orderBy('meetingdatetime')->get(); $dum['dt'] = $lastSunday; $dum['yy'] = intval(date("Y", $lastSunday)); $dum['mm'] = intval(date("n", $lastSunday)); $dum['dd'] = intval(date("j", $lastSunday)); $sundays[] = $dum; $data['societies'] = Society::orderBy('society')->with('service')->get(); $data['ministers'] = Minister::has('individual')->get(); $data['preachers'] = Preacher::has('individual')->get(); $data['guests'] = Guest::where('active', '=', 1)->get(); while (date($lastSunday + 604800 <= $lastDay)) { $lastSunday = $lastSunday + 604800; $dum['dt'] = $lastSunday; $dum['yy'] = intval(date("Y", $lastSunday)); $dum['mm'] = intval(date("n", $lastSunday)); $dum['dd'] = intval(date("j", $lastSunday)); $sundays[] = $dum; } if (count($extras)) { $xco = 0; for ($q = 0; $q < count($sundays); $q++) { if ($xco < count($extras) and $extras[$xco]['servicedate'] < $sundays[$q]['dt']) { $dum['dt'] = $extras[$xco]['servicedate']; $dum['yy'] = intval(date("Y", $extras[$xco]['servicedate'])); $dum['mm'] = intval(date("n", $extras[$xco]['servicedate'])); $dum['dd'] = intval(date("j", $extras[$xco]['servicedate'])); $data['sundays'][] = $dum; $xco++; $q = $q - 1; } else { $data['sundays'][] = $sundays[$q]; } } } else { $data['sundays'] = $sundays; } $pm1 = Plan::where('planyear', '=', $y1)->where('planmonth', '=', $m1)->get(); foreach ($pm1 as $p1) { $soc = Society::find($p1->society_id)->society; $ser = Service::find($p1->service_id)->servicetime; if ($p1->preachable) { @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['preacher'] = substr($p1->preachable_type, 11, 1) . "_" . $p1->preachable->id); if ($p1->preachable_type == "App\\Models\\Guest") { @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['pname'] = substr($p1->preachable->firstname, 0, 1) . " " . $p1->preachable->surname); } else { @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['pname'] = substr($p1->preachable->individual->firstname, 0, 1) . " " . $p1->preachable->individual->surname); } } else { @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['preacher'] = ""); } if ($p1->tag_id) { @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['tag'] = $p1->tag_id); @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['tname'] = Tag::find($p1->tag_id)->abbr); } else { @($data['fin'][$soc][$p1->planyear][$p1->planmonth][$p1->planday][$ser]['tag'] = ""); } } $pm2 = Plan::where('planyear', '=', $y2)->where('planmonth', '=', $m2)->get(); foreach ($pm2 as $p2) { $soc = Society::find($p2->society_id)->society; $ser = Service::find($p2->service_id)->servicetime; if ($p2->preachable) { @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['preacher'] = substr($p2->preachable_type, 11, 1) . "_" . $p2->preachable->id); if ($p2->preachable_type == "App\\Models\\Guest") { @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['pname'] = substr($p2->preachable->firstname, 0, 1) . " " . $p2->preachable->surname); } else { @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['pname'] = substr($p2->preachable->individual->firstname, 0, 1) . " " . $p2->preachable->individual->surname); } } else { @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['preacher'] = ""); } if ($p2->tag_id) { @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['tag'] = $p2->tag_id); @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['tname'] = Tag::find($p2->tag_id)->abbr); } else { @($data['fin'][$soc][$p2->planyear][$p2->planmonth][$p2->planday][$ser]['tag'] = ""); } } $pm3 = Plan::where('planyear', '=', $y3)->where('planmonth', '=', $m3)->get(); foreach ($pm3 as $p3) { $soc = Society::find($p3->society_id)->society; $ser = Service::find($p3->service_id)->servicetime; if ($p3->preachable) { @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['preacher'] = substr($p3->preachable_type, 11, 1) . "_" . $p3->preachable->id); if ($p3->preachable_type == "App\\Models\\Guest") { @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['pname'] = substr($p3->preachable->firstname, 0, 1) . " " . $p3->preachable->surname); } else { @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['pname'] = substr($p3->preachable->individual->firstname, 0, 1) . " " . $p3->preachable->individual->surname); } } else { @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['preacher'] = ""); } if ($p3->tag_id) { @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['tag'] = $p3->tag_id); @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['tname'] = Tag::find($p3->tag_id)->abbr); } else { @($data['fin'][$soc][$p3->planyear][$p3->planmonth][$p3->planday][$ser]['tag'] = ""); } } $data['tags'] = Tag::orderBy('abbr')->get(); if ($qq == 1) { $data['prev'] = "plan/" . strval($yy - 1) . "/4"; } else { $data['prev'] = "plan/{$yy}/" . strval($qq - 1); } if ($qq == 4) { $data['next'] = "plan/" . strval($yy + 1) . "/1"; } else { $data['next'] = "plan/{$yy}/" . strval($qq + 1); } if ($aa == "edit") { return View::make('plans.edit', $data); } else { $data['pb'] = Helpers::getSetting('presiding_bishop'); if (!$data['pb']) { return view('errors.errors')->with('errormessage', 'Before you can view the plan, please enter the name of the Presiding Bishop'); } $data['gs'] = Helpers::getSetting('general_secretary'); if (!$data['gs']) { return view('errors.errors')->with('errormessage', 'Before you can view the plan, please enter the name of the General Secretary'); } $data['db'] = Helpers::getSetting('district_bishop'); if (!$data['db']) { return view('errors.errors')->with('errormessage', 'Before you can view the plan, please enter the name of the District Bishop'); } $data['super'] = Individual::find(Helpers::getSetting('superintendent')); if (!$data['super']) { return view('errors.errors')->with('errormessage', 'Before you can view the plan, please specify who the Circuit Superintendent is'); } $this->report($data); } }
public function getNewApp() { $interviews = Interview::all(); $mentors = Mentor::orderBy('name')->get(); $languages = Language::all(); $interests = Interest::all(); $meetings = Meeting::all(); $itemCount = 0; foreach ($interviews as $interview) { $numApps = count($interview->applications); if ($numApps == 0 || $numApps > 5) { unset($interviews[$itemCount]); } $itemCount++; } $application = new Application(); $application->id = "new"; $application->name = "new"; $application->facebook = "http://www.facebook.com/"; return view('pages.application', compact('interviews', 'mentors', 'languages', 'interests', 'meetings', 'application')); }
Route::get('news', 'Admin\\CronController@news'); Route::get('renewal/{renewalTime}', 'Admin\\CronController@renewal'); }); /** * PDFs */ Route::get('pdf/meetings/fellowship/{fellowship}', function ($fellowship) { $meetings = Meeting::leftJoin('fellowships', 'fellowships.id', '=', 'meetings.fellowship_id')->where('abbreviation', $fellowship)->where('meetings.active', 1)->orderBy('day_index')->orderBy('meeting_time')->get(); $fs = Fellowship::where('abbreviation', $fellowship)->first(); $html = view('pdfs.meetings-by-fellowship', array('meetings' => $meetings, 'fellowship' => $fs))->render(); $pdf = App::make('dompdf.wrapper'); return $pdf->loadHtml($html)->download('lambda-' . strtolower($fellowship) . '-schedule.pdf'); }); Route::get('pdf/meetings/day/{day}', function ($day) { $days = array('mon' => 1, 'tue' => 2, 'wed' => 3, 'thu' => 4, 'fri' => 5, 'sat' => 6, 'sun' => 7); $meetings = Meeting::leftJoin('fellowships', 'fellowships.id', '=', 'meetings.fellowship_id')->where('day_index', $days[$day])->where('meetings.active', 1)->orderBy('meeting_time')->get(); $html = view('pdfs.meetings-by-day', array('meetings' => $meetings, 'day' => $day))->render(); $pdf = App::make('dompdf.wrapper'); return $pdf->loadHtml($html)->setPaper('A4', 'portrait')->download('lambda-' . strtolower($day) . '-schedule.pdf'); }); }); /** * API */ Route::group(['prefix' => 'api/v1', 'middleware' => ['api']], function () { Route::resource('meetings', 'Api\\MeetingsController'); Route::get('fellowships/{id}/meetings', 'Api\\FellowshipsController@index'); Route::resource('fellowships', 'Api\\FellowshipsController'); Route::resource('articles', 'Api\\ArticleController'); Route::resource('resource-categories', 'Api\\ResourceCategoriesController'); Route::resource('resources', 'Api\\ResourcesController');
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(MeetingsRequest $request, $id) { $meeting = Meeting::find($id); $meeting = $meeting->fill($request->except('meetingdatetime')); $meeting->meetingdatetime = strtotime($request->input('meetingdatetime')); $meeting->save(); return Redirect::route('meetings.index')->with('okmessage', 'Data updated'); }
public function getCalendar($year, $month) { $template = ' {table_open}<table class="calendar" border="0" cellpadding="0" cellspacing="0">{/table_open} {heading_row_start}<tr class="calendar-header">{/heading_row_start} {heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell} {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell} {heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell} {heading_row_end}</tr>{/heading_row_end} {week_row_start}<tr>{/week_row_start} {week_day_cell}<td>{week_day}</td>{/week_day_cell} {week_row_end}</tr>{/week_row_end} {cal_row_start}<tr>{/cal_row_start} {cal_cell_start}<td class="day">{/cal_cell_start} {cal_cell_content}<div class="date">{day}</div><div>{content}</div>{/cal_cell_content} {cal_cell_content_today}<div class="highlight date">{day}</div><div>{content}</div>{/cal_cell_content_today} {cal_cell_no_content}{day}{/cal_cell_no_content} {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today} {cal_cell_blank} {/cal_cell_blank} {cal_cell_end}</td>{/cal_cell_end} {cal_row_end}</tr>{/cal_row_end} {table_close}</table>{/table_close} '; $config = array('month_type' => 'long', 'day_type' => 'long', 'template' => $template); Calendar::initialize($config); $array = array(); foreach (range(1, 31) as $day) { $dateN = date('N', strtotime($year . '-' . $month . '-' . str_pad($day, 2, 0, STR_PAD_LEFT))); $meetings = Meeting::where('day_index', $dateN)->where('active', 1)->orderBy('meeting_time', 'ASC')->get(); $meetingString = '<h4>Meetings</h4>'; if (count($meetings)) { foreach ($meetings as $meeting) { $meetingString .= '<p>' . date('g:i a', strtotime($meeting->meeting_time)) . '<br/>' . $meeting->meeting . '</p>'; } } else { $meetingString = '<p>No meetings are scehduled for this day.</p>'; } $eventString = '<h4>Events</h4>'; $events = Event::where('datetime', date('Y-m-d', strtotime($year . '-' . $month . '-' . str_pad($day, 2, 0, STR_PAD_LEFT))))->get(); if (count($events)) { foreach ($events as $event) { $eventString .= '<p>' . $event->description; } } else { $eventString .= '<p>No events are scheduled for this day.</p>'; } $array[$day] = $meetingString . $eventString; } return $array; }