public function about()
 {
     $title = trans('default.about');
     $societies = Society::orderBy('position', 'asc')->get();
     $timelines = Timeline::all();
     return view('pages.about', compact('title', 'societies', 'timelines'));
 }
Esempio n. 2
0
 public function addevent()
 {
     $data = Input::all();
     $data['society_id'] = Society::where('username', Session::get('username'))->first()->id;
     $event = Event::createEvent($data);
     Session::put('event_id', $event->id);
     return Redirect::route('add_question')->with('message', 'Event Successfully Created');
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     foreach (Society::all() as $society) {
         Subscription::create(['user_id' => $this->user->id, 'society_id' => $society->id]);
     }
     $this->user->processing = 'no';
     $this->user->save();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param CustomRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(CustomRequest $request, $id)
 {
     $society = Society::findOrFail($id);
     if ($request->hasFile('image') && $request->file('image')->move(base_path() . '/public/images/society', $society->id . '.' . $request->file('image')->getClientOriginalExtension())) {
         $request->merge(['picture' => $society->id . '.' . $request->file('image')->getClientOriginalExtension()]);
     }
     $society->update($request->all());
     return redirect(route('admin.societies.index'))->with('success', 'Le contenu a bien été mis à jour');
 }
Esempio n. 5
0
 /**
  * Gets the events for a society
  * @param  [type] $day [description]
  * @return [type]      [description]
  */
 public function eventsForSociety($society_identifier)
 {
     $society_identifier = str_replace("-", " ", $society_identifier);
     try {
         $society = Society::where('id', $society_identifier)->orWhere('facebook_ref', $society_identifier)->firstOrFail();
     } catch (\Exception $e) {
         abort(404);
     }
     $events = Event::where('time', '>', date('Y-m-d H:i:s', time()))->where('society_id', $society->id)->orderBy('time')->get();
     return ['society' => $society, 'events' => $events];
 }
Esempio n. 6
0
 /**
  * Allows users to update their society subscriptions
  * @return VIEW users.subscriptions
  */
 public function subscriptions()
 {
     if (Auth::user()->processing == 'yes') {
         // If the default list is still being added, show
         // a loading message
         header("Refresh:3");
         return View::make('preparing-account');
     }
     $societies = Society::all();
     $subscriptions = User::find(Auth::user()->id)->subscriptions();
     $subscriptions = $subscriptions->get();
     foreach ($subscriptions as $subscription) {
         // For every subscription a user HAS, mark it as checked
         $societies[$subscription->society_id - 1]->checked = "checked";
     }
     // Get total number of societies
     $numberOfSocieties = Setting::where('name', 'number_of_societies')->first()->setting;
     return View::make('users.subscriptions')->with('societies', $societies)->with('numberOfSocieties', $numberOfSocieties);
 }
Esempio n. 7
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     if ($this->isSeeding) {
         $toTake = 200;
         // 200 societies
         $delay = 0;
         // Immediately
     } else {
         $toTake = 20;
         // 20 societies
         $delay = 600;
         // 10 Minutes
     }
     FacebookSession::setDefaultApplication(getenv('FB_ID'), getenv('FB_SECRET'));
     $session = FacebookSession::newAppSession();
     try {
         $session->validate();
     } catch (FacebookRequestException $ex) {
         // Session not valid, Graph API returned an exception with the reason.
         dd($ex);
     } catch (\Exception $ex) {
         // Graph API returned info, but it may mismatch the current app or have expired.
         dd($ex);
     }
     $store = \App\Setting::where('name', 'next_society')->first();
     $lastUpdated = $store->setting;
     // Get last society ID updated;
     $societies = \App\Society::where('id', '>', $lastUpdated)->take($toTake)->orderBy('id')->get();
     // Get Societies to query
     foreach ($societies as $society) {
         $request = new FacebookRequest($session, 'GET', '/' . $society->facebook_ref . '/events' . '?since=' . time() . '&fields=name,start_time,location,description,cover');
         try {
             $response = $request->execute();
         } catch (\Exception $ex) {
             continue;
             // TODO: Report errors back to us :)
         }
         $graphObject = $response->getGraphObject();
         $events = $graphObject->asArray();
         if (array_key_exists('data', $events)) {
             $events = $events['data'];
             foreach ($events as $fbEvent) {
                 $storedEvent = \App\Event::firstOrNew(['facebook_id' => $fbEvent->id]);
                 $storedEvent->society_id = $society->id;
                 $storedEvent->title = $fbEvent->name;
                 $storedEvent->time = $fbEvent->start_time;
                 if (array_key_exists("description", $fbEvent)) {
                     $storedEvent->description = $fbEvent->description;
                 }
                 if (array_key_exists("location", $fbEvent)) {
                     $storedEvent->location = $fbEvent->location;
                 }
                 if (array_key_exists("cover", $fbEvent)) {
                     $storedEvent->image = $fbEvent->cover->source;
                 }
                 $storedEvent->save();
             }
         }
     }
     if (count($societies) < $toTake) {
         $store->setting = 0;
     } else {
         $store->setting += $toTake;
     }
     $store->save();
     $job = (new \App\Jobs\UpdateEvents())->delay($delay);
     if (!$this->isSeeding) {
         $this->dispatch($job);
     }
 }
Esempio n. 8
0
 public function run()
 {
     DB::table('societies')->delete();
     /*
     |--------------------------------------------------------------------------
     | The following are all of the societies in UCC
     |--------------------------------------------------------------------------
     | To add your own, simply gather the name and facebook
     | vanity URL of the society and put it in the format:
     |
     |   Society::create([
     |       'name' => 'Society Name', 'facebook_ref' => 'societyurl'
     |   ]);
     |
     */
     Society::create(['name' => 'Africa', 'facebook_ref' => 'uccafrica']);
     Society::create(['name' => 'Amnesty', 'facebook_ref' => 'UCCAmnesty']);
     Society::create(['name' => 'Animal Welfare', 'facebook_ref' => 'AniWelUCC']);
     Society::create(['name' => 'CCAE Architecture', 'facebook_ref' => 'ccaearchitecturesociety']);
     Society::create(['name' => 'Art', 'facebook_ref' => 'uccart.soc']);
     Society::create(['name' => 'Barnardos', 'facebook_ref' => 'UCCBarnardos']);
     Society::create(['name' => 'Biology', 'facebook_ref' => 'uccbiosoc']);
     Society::create(['name' => 'Cancer', 'facebook_ref' => 'ucc.cancersociety']);
     Society::create(['name' => 'Chemical', 'facebook_ref' => '236000773224765']);
     Society::create(['name' => 'Chinese', 'facebook_ref' => 'UccChineseSociety']);
     Society::create(['name' => 'Choral', 'facebook_ref' => 'UCCChoral']);
     Society::create(['name' => 'Christian Union', 'facebook_ref' => 'UCCChristianUnionSociety']);
     Society::create(['name' => 'Clinical Therapies', 'facebook_ref' => 'UccClinicalTherapiesSociety']);
     Society::create(['name' => 'Comedy', 'facebook_ref' => 'ucccomedy']);
     Society::create(['name' => 'Commerce', 'facebook_ref' => 'commsoc.ucc']);
     Society::create(['name' => 'Dentist', 'facebook_ref' => 'dentsocucc']);
     Society::create(['name' => 'Disability Activism & Awareness', 'facebook_ref' => 'uccdaasoc']);
     Society::create(['name' => 'DJ', 'facebook_ref' => 'djsocucc']);
     Society::create(['name' => 'Dramat', 'facebook_ref' => 'UCCDramat']);
     // Society::create(['name' => 'Enactus', 'facebook_ref' => '392583690818520']); // doesn't seem to want to load from graph api?!?
     Society::create(['name' => 'Engineers Without Borders', 'facebook_ref' => 'EngineerswithoutbordersUCC']);
     Society::create(['name' => 'Environment', 'facebook_ref' => 'UCCEnvirosoc']);
     Society::create(['name' => 'Europa', 'facebook_ref' => 'ucceuropa']);
     Society::create(['name' => 'Feminist', 'facebook_ref' => 'UCCFemSoc']);
     Society::create(['name' => 'Film', 'facebook_ref' => 'uccfilm']);
     Society::create(['name' => 'French', 'facebook_ref' => 'uccfrenchsoc']);
     Society::create(['name' => 'Friends Of MSF', 'facebook_ref' => 'uccfomsf']);
     Society::create(['name' => 'Gaisce', 'facebook_ref' => 'GaisceUCC']);
     Society::create(['name' => 'Genetics', 'facebook_ref' => 'uccgensoc']);
     Society::create(['name' => 'Hope Foundation', 'facebook_ref' => 'UccHopeFoundation']);
     Society::create(['name' => 'Indian', 'facebook_ref' => 'ucc.indians']);
     Society::create(['name' => 'International Development', 'facebook_ref' => 'UCCIntDevSoc']);
     Society::create(['name' => 'International Relations', 'facebook_ref' => 'uccirsoc']);
     Society::create(['name' => 'International Students', 'facebook_ref' => 'ucc.internationals']);
     Society::create(['name' => 'Traditional Music', 'facebook_ref' => 'ucctradsoc']);
     Society::create(['name' => 'Islamic', 'facebook_ref' => 'UCCIslamicSociety']);
     Society::create(['name' => 'Italian', 'facebook_ref' => 'UCCItalianSociety']);
     Society::create(['name' => 'Japanese', 'facebook_ref' => 'uccjapansoc']);
     Society::create(['name' => 'Journalism', 'facebook_ref' => 'UCCJournalismSociety']);
     Society::create(['name' => 'Korean', 'facebook_ref' => 'ucckoreansociety']);
     Society::create(['name' => 'Labour', 'facebook_ref' => 'ucclabour']);
     Society::create(['name' => 'Law', 'facebook_ref' => 'ucclawsociety']);
     Society::create(['name' => 'LGBT', 'facebook_ref' => 'ucclgbt']);
     // Society::create(['name' => 'Live Music', 'facebook_ref' => 'ucclms']); // closed society
     Society::create(['name' => 'Macra Na Feirme', 'facebook_ref' => 'uccmacra']);
     Society::create(['name' => 'Math', 'facebook_ref' => 'uccmathsoc']);
     Society::create(['name' => 'Medical', 'facebook_ref' => 'ucc.medsoc']);
     Society::create(['name' => 'Medieval And Renaissance', 'facebook_ref' => 'UCCMedRen']);
     Society::create(['name' => 'Musical', 'facebook_ref' => 'uccmusicalsociety']);
     Society::create(['name' => 'Mythology', 'facebook_ref' => 'UccMythology']);
     Society::create(['name' => 'Networking, Gaming and Technology', 'facebook_ref' => 'UCCNetsoc']);
     Society::create(['name' => 'Nursing And Midwifery', 'facebook_ref' => 'UCCnursmidsoc']);
     Society::create(['name' => 'Pharmacy', 'facebook_ref' => 'pharmsoc.ucc']);
     Society::create(['name' => 'Philosophical', 'facebook_ref' => 'uccphilosoph']);
     Society::create(['name' => 'Photography', 'facebook_ref' => 'uccphoto']);
     Society::create(['name' => 'Poker', 'facebook_ref' => 'uccpokersociety']);
     Society::create(['name' => 'Politics', 'facebook_ref' => 'PolSocUCC']);
     Society::create(['name' => 'SAMH', 'facebook_ref' => 'uccsamhsoc']);
     Society::create(['name' => 'Science', 'facebook_ref' => 'uccsciencesociety']);
     Society::create(['name' => 'Scifi', 'facebook_ref' => 'uccscifi']);
     Society::create(['name' => 'Sinn Fein', 'facebook_ref' => 'uccsinnfein']);
     Society::create(['name' => 'Social Science', 'facebook_ref' => 'uccsocsci']);
     Society::create(['name' => 'SSDP', 'facebook_ref' => 'UCCSSDP']);
     Society::create(['name' => 'Surgeon Noonan', 'facebook_ref' => '1650501751859811']);
     Society::create(['name' => 'Surgeon', 'facebook_ref' => 'surgsoc']);
     Society::create(['name' => 'Suas', 'facebook_ref' => 'uccsuas']);
     Society::create(['name' => 'Fine Gael', 'facebook_ref' => 'uccyoungfinegael']);
     Society::create(['name' => 'Accounting And Finance', 'facebook_ref' => 'uccaccfin']);
     Society::create(['name' => 'An Chuallact', 'facebook_ref' => 'anchuallachtucc']);
     Society::create(['name' => 'Archaeological', 'facebook_ref' => 'UCCArchSoc']);
     // Society::create(['name' => 'E&S', 'facebook_ref' => 'uccEandS']); // Not returning from Facebook either - must investigate
     Society::create(['name' => 'Economics', 'facebook_ref' => 'ucceconomics']);
     Society::create(['name' => 'Fashion', 'facebook_ref' => '155068187434']);
     Society::create(['name' => 'Fianna Fail', 'facebook_ref' => 'UccFFSoc']);
     Society::create(['name' => 'Foodies', 'facebook_ref' => '373486662727603']);
     Society::create(['name' => 'German', 'facebook_ref' => 'uccgermansociety']);
     Society::create(['name' => 'Hispanic', 'facebook_ref' => 'UCCHispanicSoc']);
     Society::create(['name' => 'Historical', 'facebook_ref' => '276841219006188']);
     Society::create(['name' => 'Horse Racing', 'facebook_ref' => '281964401864450']);
     Society::create(['name' => 'Hot Beverages', 'facebook_ref' => 'UCCHotBevs']);
     Society::create(['name' => 'Physics And Astronomy', 'facebook_ref' => 'uccphysoc']);
     Society::create(['name' => 'Psychology', 'facebook_ref' => '110003839018417']);
     Society::create(['name' => 'Slainte', 'facebook_ref' => '184958275298']);
     Society::create(['name' => 'An Cumann Drámaíochta', 'facebook_ref' => '292193067563180']);
     Society::create(['name' => 'BIS Society', 'facebook_ref' => 'BisSociety']);
     Society::create(['name' => 'Engineering', 'facebook_ref' => 'UCCEngSoc']);
     Society::create(['name' => 'English', 'facebook_ref' => '1528413287397046']);
     Society::create(['name' => 'FLAC', 'facebook_ref' => '293165574222535']);
     Society::create(['name' => 'Geological', 'facebook_ref' => 'UccGeological']);
     Society::create(['name' => 'Government And Politics', 'facebook_ref' => '216465755054445']);
     Society::create(['name' => 'Greens', 'facebook_ref' => 'ucc.greens']);
     Society::create(['name' => 'Harry Potter', 'facebook_ref' => 'HPSocietyUCC']);
     Society::create(['name' => 'Health', 'facebook_ref' => '466162393565838']);
     Society::create(['name' => 'Knitting', 'facebook_ref' => 'UCCKnitSoc']);
     Society::create(['name' => 'Management And Marketing', 'facebook_ref' => 'MnMSocUCC']);
     Society::create(['name' => 'Mature Students', 'facebook_ref' => 'UCCMSS']);
     Society::create(['name' => 'Orchestra', 'facebook_ref' => 'OrchestraUCC']);
     Society::create(['name' => 'Planning', 'facebook_ref' => 'uccplanning']);
     Society::create(['name' => 'Simon', 'facebook_ref' => 'Uccsimonsociety']);
     Society::create(['name' => 'Socialist', 'facebook_ref' => 'uccsocialistyouth']);
     Society::create(['name' => 'South East Asia', 'facebook_ref' => '526366970861527']);
     Society::create(['name' => 'Sophia', 'facebook_ref' => 'uccsophia']);
     Society::create(['name' => 'St. Vincent De Paul', 'facebook_ref' => 'SVPUCC']);
     Society::create(['name' => 'WARP', 'facebook_ref' => 'ucc.warps']);
     $this->command->info('Societies table seeded!');
 }
Esempio n. 9
0
 public function add_soc()
 {
     $data = Input::all();
     $rules = array('society_name' => 'required', 'username' => 'required|unique:society', 'email' => 'required', 'password' => 'required', 'password_confirmation' => 'required|same:password');
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         return Redirect::route('add_soc_form')->withErrors($validator->errors())->withInput();
     } else {
         $society = new Society();
         $society->soc_name = $data['society_name'];
         $society->username = $data['username'];
         $society->email = $data['email'];
         $society->password = Hash::make($data['password']);
         $society->privilege = 5;
         $society->save();
         return Redirect::route('dashboard')->with('message', 'Society Added Successfully!!!');
     }
 }