Ejemplo n.º 1
0
 function save_instructor(Request $request)
 {
     $acam = Session::get('phaseterm');
     $instructor = $request->instructor;
     $class_id = $request->cl_id;
     // no point if the instructor = 0
     if ($instructor != 0) {
         $time = Time::getPeriod($class_id);
         $day = Day::getShortDay($class_id);
         $conflict = Api::checkInstructor($instructor, $time, $day);
         if ($conflict == false) {
             $class = Classallocation::find($class_id);
             $class->instructor = $instructor;
             $class->save();
             if ($request->ajax == 0) {
                 Session::flashdata('message', htmlAlert('Successfully Assigned', 'success'));
                 return back();
             }
         } else {
             if ($request->ajax == 0) {
                 Session::flashdata('message', htmlAlert('Conflict'));
                 return back();
             } else {
                 echo 'conflict';
             }
         }
     } else {
         if ($request->ajax == 0) {
             Session::flashdata('message', htmlAlert('Please Select a instructor'));
             return back();
         } else {
             echo 'no';
         }
     }
 }
Ejemplo n.º 2
0
 function show($id)
 {
     $class = Classallocation::findOrFail($id);
     $data['students'] = DB::table('view_class_list')->where('classallocation', $class->id)->orderBy('lastname')->orderBy('firstname')->get();
     $data['grades'] = DB::table('tbl_grade')->get();
     return view('instructor.class_student', $data);
 }
Ejemplo n.º 3
0
 public static function getInstructorsSched($id)
 {
     $sy = Session::get('phaseterm');
     $classes = Classallocation::where('academicterm', $sy)->where('instructor', $id)->get();
     $data = [];
     foreach ($classes as $class) {
         $d = self::where('classallocation', $class->id)->get();
         foreach ($d as $dd) {
             $data[] = $dd;
         }
     }
     return $data;
 }
Ejemplo n.º 4
0
 public function getSchedRoom($room, $system)
 {
     $classes = Classallocation::where('academicterm', $system->phaseterm)->get();
     foreach ($classes as $class) {
         if ($this->ctr > count($this->color) - 1) {
             $this->ctr = 0;
         }
         $dayperiods = Day_period::where('classallocation', $class->id)->where('classroom', $room)->get();
         $this->getSched($dayperiods, $class);
         $this->ctr++;
     }
     return $this->returnCollection();
 }
Ejemplo n.º 5
0
 function init()
 {
     $data['val'] = '';
     if ($this->system->phaseterm == env('FIN')) {
         $stat = $this->system->classallocationstatus;
         if ($stat == 2 or $stat == 1) {
             $c = DB::table('tbl_completion')->where('stage', 2)->where('academicterm', $system->phaseterm)->where('status', 'O');
             if ($c == env('COLLEGE_COUNT')) {
                 // update the systemvalues
                 DB::table('tbl_systemvalues')->update(['classallocationstatus' => 3]);
                 // delete classallocation for this phaseterm
                 Classallocation::where('academicterm', $system->phaseterm)->delete();
                 $sec = DB::table('out_section')->get();
                 foreach ($sec as $section) {
                     // if the section is zero it will not satisfy this condition
                     for ($i = 1; $i <= $section->section; $i++) {
                         $class = new Classallocation();
                         $class->academicterm = $section->academicterm;
                         $class->coursemajor = $section->coursemajor;
                         $class->subject = $section->subject;
                         $class->instructor = 0;
                         $class->reserved = 0;
                         $class->enrolled = 0;
                         $class->save();
                     }
                 }
                 $data['val'] = 'OK';
             } else {
                 $data['val'] = 'college count';
             }
         } else {
             $data['val'] = 'cannot run';
         }
     } else {
         $data['val'] = 'cannot run in this phase';
     }
     return view('edp.initClass', $data);
 }
Ejemplo n.º 6
0
 public function show($id)
 {
     $inst = Party::find($id);
     if ($inst instanceof ModelNotFoundException) {
         return view('errors.404');
     }
     $data['instructor'] = $inst;
     $data['classes'] = Classallocation::where('academicterm', $this->system->phaseterm)->where('instructor', $id);
     $data['days'] = Day::where('id', '!=', 8)->get();
     $data['times'] = Time::all();
     $schedCollection = new SchedCollection();
     $data['table_day'] = $schedCollection->getSchedInstructor($id, $this->system);
     return view('instructor.sched', $data);
 }
Ejemplo n.º 7
0
 function add_day_period(Request $request, $id)
 {
     if ($request->has('day')) {
         $valid = $this->assign($request);
         if ($valid) {
             return redirect('add_day_period/' . $id);
         }
     } elseif ($request->has('submit')) {
         $this->error = htmlAlert('Please select a day');
     }
     $data['cid'] = $id;
     $data['error'] = $this->error;
     $data['cl'] = Classallocation::find($id);
     $data['days'] = Day::where('id', '!=', 8)->get();
     $data['times'] = Time::where('id', '!=', 12)->get();
     return view('dean.assigned_subj', $data);
 }
Ejemplo n.º 8
0
 public function index()
 {
     $status = $this->system->classallocationstatus;
     $data['system'] = $this->system;
     if ($status == 4) {
         $c = DB::table('tbl_completion')->where('academicterm', $this->system->phaseterm)->where('stage', 4)->where('status', 'O')->count();
         if ($c == env('COLLEGE_COUNT')) {
             $data['val'] = 'ok';
             $data['class'] = Classallocation::where('academicterm', $this->system->phaseterm)->get();
         } else {
             $data['colleges'] = DB::table('tbl_college')->where('id', '!=', 6)->get();
             $data['val'] = 'you cannot continue';
         }
     } elseif ($status == 3) {
         $data['colleges'] = DB::table('tbl_college')->where('id', '!=', 6)->get();
         $data['val'] = 'you cannot continue';
     } else {
         $data['colleges'] = DB::table('tbl_college')->where('id', '!=', 6)->get();
         $data['val'] = 'not yet';
     }
     return view(Api::getView(), $data);
 }