Пример #1
0
 public function showHome()
 {
     $user_id = $_SESSION['user_id'];
     $this->setGroup();
     $user = Volunteer::find($user_id);
     return View::make('home')->with('user', $user);
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('propel_fellow_wingman')->delete();
     DB::table('propel_student_wingman')->delete();
     Subject::truncate();
     DB::table('propel_city_subject')->delete();
     CalendarEvent::truncate();
     CancelledCalendarEvent::truncate();
     WingmanModule::truncate();
     WingmanTime::truncate();
     VolunteerTime::truncate();
     WingmanJournal::truncate();
     $fellow = Fellow::find(1);
     $wingman1 = Wingman::find(2);
     $wingman2 = Wingman::find(3);
     $fellow->wingman()->attach($wingman1);
     $fellow->wingman()->attach($wingman2);
     $student1 = Student::find(3);
     $student2 = Student::find(4);
     $wingman1->student()->attach($student1);
     $wingman1->student()->attach($student2);
     $cEvent1 = new CalendarEvent();
     $cEvent1->type = 'volunteer_time';
     $cEvent1->student()->associate($student1);
     $cEvent1->status = 'created';
     $cEvent1->save();
     $vTime1 = new VolunteerTime();
     $vTime1->calendarEvent()->associate($cEvent1);
     $volunteer1 = Volunteer::find(4);
     $vTime1->volunteer()->associate($volunteer1);
     $subject1 = new Subject();
     $subject1->name = "English";
     $subject1->save();
     $vTime1->subject()->associate($subject1);
     $vTime1->save();
     $cEvent2 = new CalendarEvent();
     $cEvent2->type = 'wingman_time';
     $cEvent2->student()->associate($student1);
     $cEvent2->status = 'created';
     $cEvent2->save();
     $wTime1 = new WingmanTime();
     $wTime1->calendarEvent()->associate($cEvent2);
     $wTime1->wingman()->associate($wingman1);
     $wModule1 = new WingmanModule();
     $wModule1->name = "Programming";
     $wModule1->save();
     $wTime1->wingmanModule()->associate($wModule1);
     $wTime1->save();
     $city1 = City::find(1);
     $subject1->city()->attach($city1);
     $wJournal1 = new WingmanJournal();
     $wJournal1->type = 'formal';
     $wJournal1->title = "Day at Navy Camp";
     $wJournal1->mom = "It was awesome";
     $wJournal1->student()->associate($student1);
     $wJournal1->wingman()->associate($wingman1);
     $wJournal1->save();
 }
Пример #3
0
 public function selectStudents($wingman_id)
 {
     $user_id = $wingman_id;
     $city_id = Volunteer::find($user_id)->city_id;
     $wingman = Wingman::where('id', '=', $user_id)->first();
     $selected_student = DB::table('propel_student_wingman as A')->join('Student as B', 'B.id', '=', 'A.student_id')->join('Center as C', 'C.id', '=', 'B.center_id')->select('A.student_id as id', 'B.name as student_name', 'C.name as center_name')->where('A.wingman_id', '=', $user_id)->get();
     $student_list = DB::table('Student as A')->join('Center as D', 'D.id', '=', 'A.center_id')->join('City as E', 'E.id', '=', 'D.city_id')->select('A.id as id', 'A.name as name', 'D.name as center_name', 'A.description as grade')->distinct()->where('E.id', $city_id)->where('D.status', '=', '1')->orderBy('A.name', 'ASC')->get();
     foreach ($student_list as $student) {
         foreach ($selected_student as $selected) {
             if ($student->id == $selected->id) {
                 $student->grade = "checked";
             }
         }
     }
     return View::make('settings/select-students')->with('selected_student', $selected_student)->with('wingman', $wingman)->with('student_list', $student_list);
 }
Пример #4
0
 public function showList($user_id)
 {
     $entries = WingmanJournal::where('wingman_id', '=', $user_id)->get();
     $session_id = $_SESSION['user_id'];
     $user = Volunteer::find($session_id);
     $groups = $user->group()->get();
     foreach ($groups as $group) {
         if ($group->name == 'Propel Multiplier' || $group->name == 'Propel Fellow') {
             $user_group = 'Propel Fellow';
         } elseif ($group->name == 'Propel Wingman') {
             $user_group = 'Propel Wingman';
         } elseif ($group->name == 'Propel Strat') {
             $user_group = 'Propel Strat';
         } elseif ($group->name == 'Aftercare Wingman') {
             $user_group = 'Aftercare Wingman';
         } elseif ($group->name == 'Program Director, Propel') {
             $user_group = 'Program Director, Propel';
         }
     }
     return View::make('wingman-journal', ['entries' => $entries, 'user_group' => $user_group]);
 }
Пример #5
0
 public function find($id)
 {
     $event = Volunteer::find($id);
     return $event;
 }
Пример #6
0
 public static function setGroup()
 {
     $user_id = $_SESSION['user_id'];
     $user = Volunteer::find($user_id);
     $groups = $user->group()->get();
     $fellow = false;
     $wingman = false;
     foreach ($groups as $group) {
         if ($group->name == 'Propel Multiplier') {
             $fellow = true;
         } elseif ($group->name == 'Propel Wingman') {
             $wingman = true;
         }
     }
     if ($fellow == true) {
         View::share('user_group', 'Propel Multiplier');
     } elseif ($wingman == true) {
         View::share('user_group', 'Propel Wingman');
     }
 }