예제 #1
0
 /**
  * @desc show list of terms per year
  * @param Year $year int to load terms
  * @param Department $department fro breadcrumbs
  **/
 public function index(Year $year, Department $department, Faculty $faculty)
 {
     $year->load('terms');
     $terms = Term::where('year_id', $year->id)->select('academystructure_terms.*')->selectRaw('COUNT(sh.id) as total_students')->leftJoin('academystructure_departments as acadep', 'acadep.term_id', '=', 'academystructure_terms.id')->Leftjoin('student_histories as sh', 'sh.academystructure_department_id', '=', 'acadep.id')->groupBy('academystructure_terms.id')->get();
     $breadcrumbs = $faculty->breadcrumbs()->where('ay.id', '=', $year->id)->first();
     return view('academystructure::terms.index', compact('terms', 'year', 'breadcrumbs'));
 }
예제 #2
0
 /**
  * @desc show list of terms per year
  * @param Year $year int to load terms 
  * @param Department $department fro breadcrumbs
  **/
 public function index(Year $year, Department $department, Faculty $faculty)
 {
     $year->load('terms');
     $terms = $year->terms;
     $breadcrumbs = $faculty->breadcrumbs()->where('ay.id', '=', $year->id)->first();
     //dd($breadcrumbs);
     return view('academystructure::terms.index', compact('terms', 'year', 'breadcrumbs'));
 }
예제 #3
0
 /**
  * @desc show list of department and its parent sequence and subject per year
  * @param Term $term int to load terms 
  * @param Department $department to load parent_deparment_sequence	
  * @param Department $department to load list of subject append them to its department object
  * @param Faculty $faculty for breadcrumbs
  **/
 public function index(Term $term, Department $department, Faculty $faculty, Subject $subject)
 {
     $departments = $department->menu()->with('parent_department')->where('term_id', '=', $term->id)->get();
     $subjects = $subject->all();
     foreach ($departments as &$department) {
         $department->subjects = $subjects->filter(function ($subject) use($department) {
             return in_array($subject->id, json_decode($department->subject_ids, TRUE));
         });
     }
     $breadcrumbs = $faculty->breadcrumbs()->where('at.id', '=', $term->id)->first();
     return view('academystructure::departments.index', compact('departments', 'term', 'breadcrumbs'));
 }
예제 #4
0
 /**
  * @desc show list of department and its parent sequence and subject per year
  * @param Term $term int to load terms
  * @param Department $department to load parent_deparment_sequence
  * @param Department $department to load list of subject append them to its department object
  * @param Faculty $faculty for breadcrumbs
  **/
 public function index(Term $term, Department $department, Faculty $faculty, Subject $subject)
 {
     $departments = $department->menu()->selectRaw('COUNT(sh.id) as total_students')->Leftjoin('student_histories as sh', 'sh.academystructure_department_id', '=', 'academystructure_departments.id')->with('parent_department')->where('term_id', '=', $term->id)->groupBy('sid')->get();
     $subjects = $subject->all();
     foreach ($departments as &$department) {
         $department->subjects = $subjects->filter(function ($subject) use($department) {
             $subject_ids = json_decode($department->subject_ids, TRUE);
             return is_array($subject_ids) and in_array($subject->id, $subject_ids);
         });
     }
     $breadcrumbs = $faculty->breadcrumbs()->where('at.id', '=', $term->id)->first()->toArray();
     return view('academystructure::departments.index', compact('departments', 'term', 'breadcrumbs'));
 }