public function get_admin($current = 'current')
 {
     if ($current == 'current') {
         $year = Year::current_year();
     } else {
         $year = Year::find($current);
     }
     if ($year) {
         $nights = WellbeingNight::current_nights()->get();
         $orders = WellbeingOrder::current_orders()->get();
         return View::make('wellbeing.orders.admin')->with('nights', $nights)->with('year', $year)->with('orders', $orders);
     } else {
         return "Invalid ID";
     }
 }
Example #2
0
 public function get_admin($current = 'current')
 {
     if ($current == 'current') {
         $year = Year::current_year();
     } else {
         $year = Year::find($current);
     }
     if ($year) {
         $orders = MerchOrder::where('year_id', '=', $year->id)->get();
         $items = MerchItem::current_merch();
         $sizes = array('8' => '8', '10' => '10', '12' => '12', '14' => '14', 'XS' => 'XS', 'S' => 'S', 'M' => 'M', 'L' => 'L', 'XL' => 'XL', 'XXL' => 'XXL');
         return View::make('merch.orders.admin')->with('orders', $orders)->with('items', $items)->with('sizes', $sizes)->with('year', $year);
     } else {
         return "Invalid ID";
     }
 }
Example #3
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);
     }
 }
                 $message = '資料寫入錯誤';
             }
             Classes::syncTeacher();
             return Redirect::to('/class_year/view_year/' . $yearId)->with('message', $message);
         }
     });
     // 執行刪除班級
     Route::get('/delete_classes/{classesId}/{yearId}', function ($classesId, $yearId) {
         $classes = Classes::find($classesId);
         $message = '刪除《' . $classes->classes_name . '》完成';
         $classes->delete();
         return Redirect::to('/class_year/view_year/' . $yearId)->with('message', $message);
     });
     // 執行刪除年級
     Route::get('/delete_year/{yearId}', function ($yearId) {
         $year = Year::find($yearId);
         $message = '刪除《' . $year->year_name . '》完成';
         $year->delete();
         return Redirect::to('/class_year')->with('message', $message);
     });
 });
 /**
  * 課程管理
  */
 Route::group(array('prefix' => 'course', 'before' => 'auth'), function () {
     // 顯示課程名稱
     Route::get('/', function () {
         $courseList = Course::orderBy('course_name')->get();
         return View::make('course')->with(array('courseList' => $courseList));
     });
     // 執行新增課程
Example #5
0
 public function get_delete($id)
 {
     $year = Year::find($id)->delete();
     return Redirect::to('rms/years')->with('success', 'Successfully Removed Year');
 }