/**
  * Show university home
  * 
  * @return View
  */
 public function showHome()
 {
     return View::make('university.home')->with(array('subjects' => SubjectController::getSubjects(), 'teachers' => TeacherController::getTeachers()));
 }
 public function getFarmReport()
 {
     $group_id = Input::get('group_id');
     $group = Group::where('_id', new MongoId($group_id))->first();
     $students = Student::whereIn('_id', $group->students_id)->get();
     $total_assignments = Assignment::where('group_id', new MongoId($group_id))->count();
     $total_completed = Assignment::where('group_id', new MongoId($group_id))->where('state', 'c')->count();
     $total_incompleted = Assignment::where('group_id', new MongoId($group_id))->whereIn('state', array('n', 'nc'))->count();
     $total_pending = Assignment::where('group_id', new MongoId($group_id))->whereIn('state', array('a', 'r', 'p'))->count();
     $student_task = TeacherController::getStatStudents($group->students_id, $group_id);
     $assignments = Assignment::where('group_id', new MongoId($group_id))->get();
     return View::make('teacher.farm_report')->with(array('students' => $students, 'total_assignments' => $total_assignments, 'total_completed' => $total_completed, 'total_incompleted' => $total_incompleted, 'total_pending' => $total_pending, 'student_task' => $student_task, 'colors' => $this->colors, 'assignments' => $assignments, 'group' => $group));
 }
 /**
  *	Show all assigments view
  * 
  * @return View
  */
 public function showAllAssignmentsView()
 {
     return View::make('university.show_all_enrollment')->with(array('teachers' => TeacherController::getTeachers(), 'stats' => MessageController::getStats()));
 }
 public static function getStatGroupByTags($arrayGroups, $arrayTags, $subject = null, $sectionCode = null, $attach = null)
 {
     $array = array();
     foreach ($arrayGroups as $group) {
         foreach ($arrayTags as $tag) {
             $arrayAux = array();
             $arrayAux['group_name'] = $group->name;
             $arrayAux['project_name'] = $group->project_name;
             $arrayAux['tag'] = $tag;
             if (!is_null($subject)) {
                 $arrayAux['subject'] = $subject;
             }
             if (!is_null($sectionCode)) {
                 $arrayAux['sectionCode'] = $sectionCode;
             }
             $total_task = Assignment::where('group_id', new MongoId($group->_id))->whereIn('tags', array($tag));
             $total_task_pending = Assignment::where('group_id', new MongoId($group->_id))->where('state', 'p')->whereIn('tags', array($tag));
             $total_task_current = Assignment::where('group_id', new MongoId($group->_id))->whereIn('state', array('a', 'r'))->whereIn('tags', array($tag));
             $total_task_not_completed = Assignment::where('group_id', new MongoId($group->_id))->whereIn('state', array('n', 'nc'))->whereIn('tags', array($tag));
             $total_task_completed = Assignment::where('group_id', new MongoId($group->_id))->where('state', 'c')->whereIn('tags', array($tag));
             $total_score = Assignment::where('group_id', new MongoId($group->_id))->whereIn('tags', array($tag));
             $total_rated = Assignment::where('group_id', new MongoId($group->_id))->whereIn('tags', array($tag));
             $arrayValidate = TeacherController::validateAttach($attach, $total_task, $total_task_pending, $total_task_current, $total_task_not_completed, $total_task_completed, $total_score, $total_rated);
             if (!is_null($arrayValidate)) {
                 $arrayAux['total_task'] = $arrayValidate['total_task'];
                 $arrayAux['total_task_pending'] = $arrayValidate['total_task_pending'];
                 $arrayAux['total_task_current'] = $arrayValidate['total_task_current'];
                 $arrayAux['total_task_not_completed'] = $arrayValidate['total_task_not_completed'];
                 $arrayAux['total_task_completed'] = $arrayValidate['total_task_completed'];
                 $arrayAux['total_score'] = $arrayValidate['total_score'];
                 $arrayAux['total_rated'] = $arrayValidate['total_rated'];
                 array_push($array, $arrayAux);
             }
         }
     }
     return $array;
 }