public function actionIndex()
 {
     $guest = null;
     $guestForm = new GuestLoginForm();
     $cookies = Yii::$app->request->cookies;
     $guest_id = $cookies->getValue('guest_id');
     if (isset($guest_id)) {
         $guest = Guest::find()->where(array('id' => $guest_id))->one();
         if ($guestForm->load(Yii::$app->request->post())) {
             $guest->first_name = $guestForm->first_name;
             $guest->last_name = $guestForm->last_name;
             $guest->phone = $guestForm->phone;
             $guest->email = $guestForm->email;
             $guest->save();
         }
     }
     if (!isset($guest)) {
         if ($guestForm->load(Yii::$app->request->post())) {
             $guest = $guestForm->login();
             Yii::$app->response->cookies->add(new \yii\web\Cookie(['name' => 'guest_id', 'value' => $guest->id]));
             $this->redirect('/');
         }
     }
     if (isset($guest)) {
         $guestForm->first_name = $guest->first_name;
         $guestForm->last_name = $guest->last_name;
         $guestForm->phone = $guest->phone;
         $guestForm->email = $guest->email;
     }
     return $this->render('index', array('guest' => $guest, 'guestForm' => $guestForm));
 }
 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getGuest()
 {
     $create = true;
     if ($this->_guest === false) {
         $this->_guest = Guest::findByName($this->first_name, $this->last_name, $create);
     }
     return $this->_guest;
 }
Example #3
0
 public function driverGuest($email)
 {
     $guest = \App\Models\Guest::where('email', $email)->first();
     if (!$guest) {
         $guest = \App\Models\Guest::create(compact('email'));
     }
     return $guest;
 }
 public function actionDisp()
 {
     if (Yii::$app->request->get('id')) {
         $done = Guest::find()->where(['id' => Yii::$app->request->get('id')])->one();
         $done->done = true;
         $done->save();
     }
     $data = Guest::find()->where(['done' => false])->all();
     return $this->render('disp', ['data' => $data]);
 }
Example #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $guestChunks = Guest::all()->chunk(6, true);
     foreach ($guestChunks as $index => $chunk) {
         $table = Table::find($index + 1);
         foreach ($chunk as $guest) {
             $table->seatGuest($guest);
         }
     }
 }
Example #6
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     foreach (Guest::all() as $guest) {
         $itemChoice = rand(1, 3);
         $guestMenuItem = new GuestMenuItem();
         $guestMenuItem->guest_id = $guest->id;
         $guestMenuItem->menu_item_id = $itemChoice;
         $guestMenuItem->save();
     }
 }
 public function post_teachersignup(TeacherSignupRequest $request)
 {
     $input = $request->except('_token');
     $faker = Faker\Factory::create();
     $transactionid = $faker->md5;
     $guest = Guest::create(['name' => $input['name'], 'email' => $input['email'], 'password' => $input['password'], 'package' => $input['package'], 'transactionid' => $transactionid]);
     if ($guest) {
         return response()->json(['data' => array('registerstatus' => 'failed', 'message' => $guest->name . ' thanks for registering!Check your email for further details')]);
     } else {
         return response()->json(['data' => array('registerstatus' => 'failed', 'message' => 'something went wrong!')]);
     }
 }
Example #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 150) as $index) {
         $guest = new Guest();
         $guest->email = $faker->email;
         $guest->first_name = $faker->firstName;
         $guest->last_name = $faker->lastName;
         $guest->event_id = 1;
         if (Guest::all()->count() > 0) {
             if (is_int($index / 10)) {
                 $guest->plus_one = $index - 1;
             }
         }
         $guest->save();
         if (is_int($index / 30)) {
             $gdr = new GuestDietaryRestriction();
             $gdr->guest_id = $guest->id;
             $gdr->dietary_restriction_id = rand(1, 3);
             $gdr->save();
         }
     }
 }
Example #9
0
 public function search($input)
 {
     $query = Guest::query();
     $columns = Schema::getColumnListing('guests');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Example #10
0
 public function get_guestaccept($id)
 {
     if (Auth::user()->type == 'admin') {
         $faker = Faker\Factory::create();
         $teacher = Guest::where(['id' => $id])->first();
         $success = User::create(['memberid' => $faker->unique()->md5, 'name' => $teacher->name, 'email' => $teacher->email, 'password' => bcrypt($teacher->password), 'type' => 'teacher']);
         if ($success) {
             TeacherInfo::create(['memberid' => $success->memberid, 'package' => $teacher->package]);
             $success = Guest::where(['id' => $id])->delete();
             if ($success) {
                 return response()->json(['stat' => 'success', 'message' => 'Successfully Accepted Guest']);
             } else {
                 Guest::where(['id' => $id])->delete();
                 return response()->json(['stat' => 'success', 'message' => 'Successfully Accepted Guest']);
             }
         } else {
             return response()->json(['stat' => 'failed', 'message' => 'Could not accept Guest']);
         }
     }
 }
Example #11
0
 public function plusOneOf()
 {
     return Guest::where('plus_one', '=', $this->id);
 }
 public function getGuest()
 {
     try {
         $response = [];
         $statusCode = 200;
         $guest = Guest::all();
         foreach ($guest as $a) {
             $response[] = ['id' => $a->id, 'value' => $a->name . ' (' . $a->description . ')'];
         }
     } catch (Exception $e) {
         $statusCode = 404;
     } finally {
         return Response::json($response, $statusCode);
     }
 }
Example #13
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $society = $view->getData()['soc'];
     $data['services'] = Society::with('service')->where('society', '=', $society)->first();
     foreach ($data['services']->service as $service) {
         if ($service['language'] == "English" and $service['description'] == "") {
             $service->description = "Our " . $service->servicetime . " service is led in English by a minister or local preacher and a team of musicians. Everyone is welcome!";
         } elseif ($service['language'] == "isiZulu" and $service['description'] == "") {
             $service->description = "Our " . $service->servicetime . " service is led in isiZulu by a minister or local preacher and uses the liturgy and music of the Methodist Hymn Book. Everyone is welcome!";
         }
         $data['allservices'][] = $service;
     }
     if (!count($data['services'])) {
         return View::make('errors.404');
     }
     if (isset($view->getData()['pagetitle'])) {
         $data['pagetitle'] = $view->getData()['pagetitle'];
     } else {
         $data['pagetitle'] = $society;
     }
     $socid = Society::where('society', '=', $society)->select('id')->first()->id;
     if (Helpers::is_online() and $data['services']->society_calendar != "") {
         $privatecal = new GoogleCalendar();
         $data['cals'] = $privatecal->getTen($data['services']->society_calendar, 8);
     }
     $data['sermon'] = Sermon::with(['series' => function ($query) use($socid) {
         $query->where('society_id', '=', $socid);
     }])->orderBy('servicedate', 'DESC')->first();
     if (!$data['sermon'] or !$data['sermon']->series) {
         $data['sermon'] = "None";
     } else {
         if ($data['sermon']->preachable_type == 'App\\Models\\Minister') {
             $data['preacher'] = Minister::find($data['sermon']->preachable_id);
         } elseif ($data['sermon']->preachable_type == 'App\\Models\\Guest') {
             $data['preacher'] = Guest::find($data['sermon']->preachable_id);
         } else {
             $data['preacher'] = Preacher::find($data['sermon']->preachable_id);
         }
     }
     $data['welcome_page'] = "together a transforming discipleship movement";
     $data['welcome_page_pic'] = "/public/images/715.jpg";
     if ($data['services']->roster) {
         $data['roster'] = $data['services']->roster;
     }
     $data['society'] = Society::where('society', '=', $society)->first();
     if ($data['society']->roster) {
         $data['roster'] = $data['society']->roster;
     }
     $webpage = Webpage::where('society_id', '=', $data['society']->id)->get();
     foreach ($webpage as $pg) {
         $data[$pg->fieldname] = $pg->fieldvalue;
         $data[$pg->fieldname . '_pic'] = $pg->pageimage;
     }
     $data['route'] = Route::getCurrentRoute()->getPath();
     if ($data['route'] != "{society}" and $data['route'] != "/") {
         $linkadd = Helpers::makeUrl(strtolower($society), '');
     } else {
         $linkadd = "";
     }
     $menu['link'] = $linkadd . "#sundays";
     $menu['label'] = "Sundays";
     $menu['longlabel'] = "Sunday services";
     $data['menu'][] = $menu;
     $data['youth'] = Mission::where('society_id', '=', $data['society']->id)->where('category', '=', 'youth')->orderBy('created_at')->take(5)->get();
     if (count($data['youth'])) {
         $menu['link'] = $linkadd . "#youth";
         $menu['label'] = "Youth";
         $menu['longlabel'] = "Children and Youth";
         $data['menu'][] = $menu;
     }
     $data['groups'] = Group::where('society_id', '=', $data['society']->id)->where('publish', '=', 1)->get();
     if (count($data['groups'])) {
         foreach ($data['groups'] as $obj) {
             $dum[0] = $obj->groupname;
             $dum[1] = $obj->latitude;
             $dum[2] = $obj->longitude;
             $dum[3] = Helpers::makeUrl(strtolower($data['services']->society), 'groups/' . $obj->slug);
             $fin[] = $dum;
         }
         $data['fin'] = json_encode($fin);
         $menu['link'] = "#groups";
         $menu['label'] = "Groups";
         $menu['longlabel'] = "Small groups";
         $data['menu'][] = $menu;
     } else {
         $data['fin'] = "";
     }
     $data['missions'] = Mission::where('society_id', '=', $data['society']->id)->where('category', '=', 'project')->take(5)->get();
     if (count($data['missions'])) {
         $menu['link'] = $linkadd . "#projects";
         $menu['label'] = "Projects";
         $menu['longlabel'] = "Mission projects";
         $data['menu'][] = $menu;
     }
     $blogs = Blog::with('individual')->orderBy('created_at', 'desc')->take(10)->get();
     if (count($blogs)) {
         $first = true;
         foreach ($blogs as $blog) {
             $societies = explode(',', $blog->societies);
             if (in_array($data['society']->id, $societies)) {
                 if ($first) {
                     $data['firstblog'] = $blog;
                     $first = false;
                 } else {
                     $data['blogs'][] = $blog;
                 }
             }
         }
         if (isset($data['firstblog'])) {
             $menu['link'] = $linkadd . "#blog";
             $menu['label'] = "Blog";
             $menu['longlabel'] = "Latest blogs";
             $data['menu'][] = $menu;
         }
     }
     $menu['link'] = $linkadd . "#contact";
     $menu['label'] = "Contact";
     $menu['longlabel'] = "Contact us";
     $data['menu'][] = $menu;
     $data['counter'] = 1;
     $view->with('data', $data);
 }
Example #14
0
 public function removeGuest(Request $request, $eventId, $tableId)
 {
     $guest = Guest::find(Input::get('guest_id'));
     if ($guest->table_id !== $tableId) {
         return $this->prepareResponse('error', $guest->getName() . ' not seated at this table');
     }
     $guest->table_id = null;
     $guest->save();
     return $this->prepareResponse('success', $guest->getName() . ' removed from the table');
 }
Example #15
0
 public function guest(Request $request)
 {
     $fn = $request->get('firstname');
     $ln = $request->get('lastname');
     $guest = Guest::firstOrCreate(['firstname' => $fn, 'lastname' => $ln]);
     return response()->json($guest);
 }
Example #16
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($society, $series, $id)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['society'] = $society;
         $data['allseries'] = Series::where('society_id', '=', $society)->lists('series', 'id')->toArray();
         $data['series'] = $series;
         $data['seriesname'] = Series::find($series)->series;
         $data['ministers'] = Minister::has('individual')->get();
         $data['preachers'] = Preacher::has('individual')->get();
         $data['guests'] = Guest::orderBy('surname')->orderBy('firstname')->get();
         $data['sermon'] = Sermon::find($id);
         return view('sermons.edit', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
Example #17
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $guest = Guest::find($id);
     $guest->delete();
     return Redirect::route('guests.index')->with('okmessage', 'Guest preacher has been deleted');
 }
Example #18
0
 public function getTablePopulationAttribute()
 {
     return Guest::where('table_id', '=', $this->id)->count();
 }
Example #19
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($society, $slug)
 {
     $data['soc'] = $society;
     $data['individual'] = Individual::where('slug', '=', $slug)->first();
     if ($data['individual'] and $data['individual']->social) {
         $socials = explode(',', $data['individual']->social);
         foreach ($socials as $social) {
             if (strpos($social, 'twitter')) {
                 $data['socials']['twitter'] = $social;
             } elseif (strpos($social, 'facebook')) {
                 $data['socials']['facebook'] = $social;
             } elseif (strpos($social, 'instagram')) {
                 $data['socials']['instagram'] = $social;
             } elseif (strpos($social, 'youtube')) {
                 $data['socials']['youtube'] = $social;
             }
         }
     }
     if ($data['individual']) {
         $id = $data['individual']->id;
         if (count(Preacher::where('individual_id', '=', $id)->get()) > 0) {
             $data['preacher'] = Preacher::with(array('sermons' => function ($query) {
                 $query->orderBy('created_at', 'DESC');
             }))->where('individual_id', '=', $id)->first();
         } elseif (count(Minister::with('sermons')->where('individual_id', '=', $id)->get()) > 0) {
             $data['preacher'] = Minister::where('individual_id', '=', $id)->first();
         }
         $data['pagetitle'] = $data['individual']->firstname . " " . $data['individual']->surname;
     } else {
         $data['preacher'] = Guest::where('slug', '=', $slug)->first();
         $data['pagetitle'] = $data['preacher']->firstname . " " . $data['preacher']->surname;
         $id = 0;
     }
     if (isset($data['preacher'])) {
         $sermons = $data['preacher']->sermons->lists('id')->all();
         $data['sermons'] = Sermon::wherein('id', $sermons)->orderBy('servicedate', 'DESC')->paginate(5);
     }
     $data['blogs'] = Blog::where('individual_id', '=', $id)->orderBy('created_at', 'DESC')->limit(9)->get();
     return View::make('individuals.show', $data);
 }
Example #20
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Guest::find($id)->Festival()->detach();
     $guest = Guest::find($id);
     $a = Guest::where('id', $id)->delete();
     $response = [];
     $response["name"] = $guest->name;
     if ($a > trashed()) {
         $statusCode = 200;
         $response['result'] = "deleted";
     } else {
         $statusCode = 422;
         $response['result'] = "Cannot delete.";
     }
     return Response::json($response, $statusCode);
 }
Example #21
0
 public static function postAddGuest()
 {
     if (Auth::check()) {
         $validation = \App\Models\Guest::validate(Input::all());
         if ($validation->passes()) {
             if (count(\App\Models\Reservation::checkIfExistsZakaznik(Input::get('guest_id'))) == 0) {
                 /** Here, you have to check if user_id is valid ID number **/
                 DB::insert('INSERT INTO zakaznik (meno, rodnecislo, adresa, datnar, telcis, mail) VALUES (?, ?, ?, ?, ?, ?)', [Input::get('name'), Input::get('guest_id'), Input::get('address'), Input::get('birth_date'), Input::get('telephone'), Input::get('mail')]);
             }
             DB::insert('INSERT INTO obyvana (CisPobytu, IDZak) VALUES (?, ?)', [Input::get('id'), Input::get('guest_id')]);
             return Redirect::route('home')->with('message', 'Guest successfully added!');
         } else {
             return Redirect::route('addguest')->withErrors($validation)->withInput()->with('id', Input::get('id'));
         }
     } else {
         return Redirect::route('home')->with('message', 'You are not logged in!');
     }
 }
Example #22
0
 /**
  * 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);
     }
 }