public function get_index()
 {
     $calendar = new GoogleCalendar();
     $calendarId = "*****@*****.**";
     $results = $calendar->get_time_available($calendarId);
     foreach ($results as $timesheet) {
         //var_dump($timesheet);
         echo date("d-m-Y", strtotime($timesheet->start->dateTime)) . " - " . date("d-m-Y", strtotime($timesheet->end->dateTime)) . "<br />";
     }
 }
Esempio n. 2
0
 public function welcome()
 {
     if (!Schema::hasTable('settings')) {
         $data['firsttime'] = "yes";
         return view('firsttime', $data)->with('okmessage', 'Please create a user before you can use Connexion');
     }
     $user = Auth::user();
     if ($user and $user->individual_id) {
         $today = date('d-m-Y');
         $data['tasks'] = Task::where('donedate', '=', '')->where('project_id', '<>', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['personal'] = Task::where('donedate', '=', '')->where('project_id', '=', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['individuals'] = Individual::orderBy('surname')->get();
         $data['projects'] = Project::with('undonetask')->where('individual_id', $user->individual_id)->orderBy('project')->get();
         $data['projectselect'] = Project::orderBy('project')->lists('project', 'id');
         $data['page_title'] = Helpers::getSetting('circuit_name') . " Circuit";
         $data['page_description'] = "Administrator home page";
         $socs = Permission::where('user_id', '=', $user->id)->select('society_id')->get();
         foreach ($socs as $soc) {
             $thissoc = Society::where('id', '=', $soc->society_id)->get();
             $dum['googleCalendarId'] = $thissoc[0]->society_calendar;
             $dum['color'] = $thissoc[0]->calendar_colour;
             $data['cals'][] = $dum;
         }
         $dum['googleCalendarId'] = Helpers::getSetting('circuit_calendar');
         $dum['color'] = 'black';
         $data['cals'][] = $dum;
         if (Helpers::is_online() and $user->googlecalendar != "") {
             $privatecal = new GoogleCalendar();
             $pcals = $privatecal->getTen($user->googlecalendar);
             foreach ($pcals as $pcal) {
                 $pcal['color'] = $user->calendar_colour;
                 $data['pcals'][] = $pcal;
             }
         } else {
             $data['pcals'] = array();
         }
         if (!count($socs)) {
             $soc = strtolower($user->individual->household->society->society);
             return redirect()->action('SocietiesController@show', $soc);
         } else {
             return view('home', $data);
         }
     } elseif ($user) {
         return view('shared.registered');
     } else {
         return view('landingwebpage');
     }
 }
Esempio n. 3
0
 private function prepareSchedule()
 {
     $users = User::all();
     foreach ($users as $user) {
         if (!$user->is_team) {
             continue;
         }
         $this->schedules[$user->id] = [];
         $calendar = new GoogleCalendar();
         $calendarId = "*****@*****.**";
         $this->userGoogleTimesheets[$user->id] = $calendar->get_time_available($user->google_calendar_id);
         $this->addDayToSchedule($user->id);
     }
     $this->todo_list = $this->prepareTodos();
     $this->setUserTasks();
 }
Esempio n. 4
0
 public function circuit($society)
 {
     $data['soc'] = $society;
     $data['pagetitle'] = Helpers::getSetting('circuit_name') . " Circuit";
     $cministers = Minister::with('individual')->get();
     if (Helpers::is_online() and Helpers::getSetting('circuit_calendar') != "") {
         $privatecal = new GoogleCalendar();
         $data['cals'] = $privatecal->getTen(Helpers::getSetting('circuit_calendar'), 8);
     }
     foreach ($cministers as $cm) {
         $dum['name'] = "<strong>" . $cm->individual->title . " " . $cm->individual->firstname . " " . $cm->individual->surname . "</strong>";
         $dum['contact'] = $cm->individual->cellphone;
         if ($cm->individual->id == Helpers::getSetting('superintendent')) {
             $dum['contact'] = "(Superintendent Minister)<br>" . $dum['contact'];
         }
         $dum['sort'] = $cm->individual->surname . $cm->individual->firstname;
         $dum['bio'] = $cm->individual->notes;
         $dum['photo'] = $cm->individual->photo;
         $dum['slug'] = $cm->individual->slug;
         $socs = Society::wherein('id', explode(',', $cm->societies))->get();
         $societies = "";
         foreach ($socs as $soc) {
             $societies .= "<a href=\"" . Helpers::makeUrl(strtolower($soc->society), '') . "\">" . $soc->society . "</a>, ";
         }
         $dum['societies'] = substr($societies, 0, -2);
         $data['ministers'][$dum['sort']] = $dum;
     }
     ksort($data['ministers']);
     $data['allsocieties'] = Society::orderBy('society')->get();
     if (count($data['allsocieties'])) {
         foreach ($data['allsocieties'] as $obj) {
             $dum1[0] = $obj->society;
             $dum1[1] = $obj->latitude;
             $dum1[2] = $obj->longitude;
             $dum1[3] = Helpers::makeUrl(strtolower($obj->society), '');
             $fin[] = $dum1;
         }
         $data['fin'] = json_encode($fin);
     } else {
         $data['fin'] = "";
     }
     $data['stewards'] = Individual::wherein('id', explode(',', Helpers::getSetting('circuit_stewards')))->get();
     $data['secretary'] = Individual::find(Helpers::getSetting('circuit_secretary'));
     $data['treasurer'] = Individual::find(Helpers::getSetting('treasurer'));
     return view('societies.circuit', $data);
 }
 /**
  * Syncs the local database with the current Google Directory
  * of all Denver skaters
  *
  * @param App\Services\GoogleCalendar   $calendar
  * @return Response array
  */
 public function upcomingEvents(GoogleCalendar $calendar)
 {
     $eventList = $mergedList = [];
     $events = $calendar->getMergedEvents();
     if (!empty($events)) {
         $formatted = $calendar->formatEventData($events);
         $startDates = $formatted['dates'];
         $events = $formatted['events'];
         $mergedList = $events;
         array_multisort($startDates, SORT_DESC, $mergedList);
         //dd($mergedList);
     }
     foreach ($mergedList as $key => $e) {
         $eventList[$e['group']][] = array('display' => $e['display'], 'date' => $e['group']);
     }
     return $eventList;
 }
Esempio n. 6
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);
 }
Esempio n. 7
0
 public function getGoogleCalendarItems(GoogleCalendar $calendar)
 {
     $result = $calendar->get('*****@*****.**');
     dd($result);
 }
 public function calendar(GoogleCalendar $calendar)
 {
     $calendarId = '*****@*****.**';
     $result = $calendar->get($calendarId);
     return view('calendar')->with(compact('result'));
 }