예제 #1
0
 public function get_search($format = '.html')
 {
     $input = Input::get();
     $years = Year::lists('year', 'id');
     if (array_key_exists('q', $input) && $input['q'] != '') {
         $q = $input['q'];
         $year_id = $input['y'];
         $year = Year::find($year_id)->year;
         if (strlen($q) > 8) {
             $phone_query = $q;
         } else {
             $phone_query = 'NOTAPHONENUMBER';
         }
         if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,})\$/i", $q)) {
             $email_query = $q;
         } else {
             $email_query = 'NOTANEMAILADDRESS';
         }
         $results = User::join('profiles', 'users.id', '=', 'profiles.user_id')->join('user_year', 'users.id', '=', 'user_year.user_id')->where('year_id', '=', $year_id)->where(function ($query) use($q, $email_query, $phone_query) {
             $query->orWhere('full_name', 'LIKE', '%' . $q . '%');
             $query->orWhere('display_name', 'LIKE', '%' . $q . '%');
             $query->orWhere('email', 'LIKE', '%' . $email_query . '%');
             $query->orWhere('phone', 'LIKE', '%' . $phone_query . '%');
         })->get();
     } else {
         $q = '';
         $year = Year::current_year()->year;
         $results = array();
     }
     switch ($format) {
         case '.csv':
             return View::make('users.search_csv')->with('results', $results);
         default:
             return View::make('users.search')->with('query', $q)->with('year', $year)->with('years', $years)->with('results', $results);
     }
 }
예제 #2
0
 public function get_edit($id)
 {
     $years = Year::lists('year', 'id');
     $camp = CampSetting::find($id);
     return View::make('camp.settings.edit')->with('camp', $camp)->with('years', $years);
 }
예제 #3
0
 public function get_remove_from_year($id)
 {
     $sponsor = Sponsor::find($id);
     $years = Year::lists('year', 'id');
     return View::make('sponsors.remove_from_year')->with('sponsor', $sponsor)->with('years', $years);
 }
예제 #4
0
 public function get_edit($id)
 {
     $years = Year::lists('year', 'id');
     $bundle = WellbeingBundle::find($id);
     return View::make('wellbeing.bundles.edit')->with('years', $years)->with('bundle', $bundle);
 }
예제 #5
0
 public function get_edit($id)
 {
     $night = WellbeingNight::find($id);
     $years = Year::lists('year', 'id');
     return View::make('wellbeing.nights.edit')->with('night', $night)->with('years', $years);
 }