コード例 #1
0
 public function create()
 {
     $conditions = array('approved' => 1, 'rejected' => 0);
     $students = Student::select('student_id', 'first_name', 'last_name', 'category', 'roll_num', 'branch', 'year', 'email_id', 'books_issued')->where($conditions)->orderBy('student_id');
     $this->filterQuery($students);
     $students = $students->get();
     return $students;
 }
コード例 #2
0
 public function viewAllStudent()
 {
     $students = Student::select('center.center_name', 'students.id', 'students.name', 'students_details.city as city_name', 'groups.group_name', 'students_details.school', 'students.doe', 'students_details.father', 'students.dob')->join('students_details', 'students.id', '=', 'students_details.student_id')->join('groups', 'students.first_group', '=', 'groups.id')->join('center', 'groups.center_id', '=', 'center.id')->join('city', 'center.city_id', '=', 'city.id')->get();
     $custom_sidebar = Group::group_center_city();
     // return $custom_sidebar->city;
     $this->layout->tab_id = 1;
     $this->layout->sidebar = View::make('admin.sidebar', ["page_id" => 2, "sub_id" => 1, "customSidebar" => $custom_sidebar]);
     $this->layout->main = View::make('admin.browseStudent.view', ["students" => $students]);
 }
コード例 #3
0
 function view($id)
 {
     $model = new Student();
     $act = new Activities_student();
     $student = $model->select($id);
     $act->where("id", $id);
     $activity = $act->query("SELECT point from activitys\n                                 LEFT JOIN activities_students ON activitys.id = activities_students.activity_id\n                                 WHERE student_id = {$id}");
     $this->set('student', $student);
     $this->set('info', $activity);
 }
コード例 #4
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getsheet()
 {
     $inputs = Input::all();
     $input = (object) $inputs;
     $subjects = Subject::select('name')->where('class', $input->class)->orderby('code', 'asc')->get();
     if (count($subjects) < 1) {
         return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "There are not subjects for this class!");
     }
     $students = Student::select('regiNo', 'firstName', 'middleName', 'lastName')->where('class', $input->class)->where('section', $input->section)->where('session', trim($input->session))->where('shift', $input->shift)->get();
     if (count($students) < 1) {
         return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "There are not student for this class!");
     }
     $merit = DB::table('MeritList')->select('regiNo', 'grade', 'point', 'totalNo')->where('exam', $input->exam)->where('class', $input->class)->where('session', trim($input->session))->orderBy('point', 'DESC')->orderBy('totalNo', 'DESC')->get();
     if (count($merit) < 1) {
         return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "Marks not submit or result not generate for this exam!");
     }
     foreach ($students as $student) {
         $marks = Marks::select('written', 'mcq', 'practical', 'ca', 'total', 'grade', 'point')->where('regiNo', $student->regiNo)->where('exam', $input->exam)->orderby('subject', 'asc')->get();
         if (count($marks) < 1) {
             return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "Marks not submited yet!");
         }
         /*$marks = DB::table('Marks')
           ->join('MeritList', 'Marks.regiNo', '=', 'MeritList.regiNo')
           ->select('Marks.written','Marks.mcq', 'Marks.practical', 'Marks.ca', 'Marks.total', 'Marks.grade', 'Marks.point', 'MeritList.totalNo', 'MeritList.grade as tgrade','MeritList.point as tpoint')
           ->where('Marks.regiNo',$student->regiNo)
           ->where('Marks.exam', '=',$input->exam)
           ->orderby('Marks.subject','asc')
           ->get();*/
         $meritdata = new Meritdata();
         $position = 0;
         foreach ($merit as $m) {
             $position++;
             if ($m->regiNo === $student->regiNo) {
                 $meritdata->regiNo = $m->regiNo;
                 $meritdata->point = $m->point;
                 $meritdata->grade = $m->grade;
                 $meritdata->position = $position;
                 $meritdata->totalNo = $m->totalNo;
                 break;
             }
         }
         $student->marks = $marks;
         $student->meritdata = $meritdata;
     }
     $cl = ClassModel::Select('name')->where('code', $input->class)->first();
     $input->class = $cl->name;
     $fileName = $input->class . '-' . $input->section . '-' . $input->session . '-' . $input->exam;
     // return $students;
     Excel::create($fileName, function ($excel) use($input, $subjects, $students) {
         $excel->sheet('New sheet', function ($sheet) use($input, $subjects, $students) {
             $sheet->loadView('app.excel', compact('subjects', 'input', 'students'));
         });
     })->download('xlsx');
 }
コード例 #5
0
 function index()
 {
     $students = new Student();
     $activities = new Activity();
     $result = array();
     $info = $this->loadModel()->selectAll();
     foreach ($info as $key => $item) {
         extract($item["Activities_student"]);
         $st = $students->select($student_id);
         $st2 = array_shift($st);
         $ac = $activities->select($activity_id);
         $ac2 = array_shift($ac);
         $arr = array('student_id' => $st2['first_name'] . " " . $st2['last_name'], 'f_number' => $st2['f_number'], 'activity_id' => $ac2['name'], 'point' => $ac2['point'], 'created_at' => $created_at);
         array_push($result, $arr);
     }
     $this->set('students', $result);
 }
コード例 #6
0
 private function getRegi($class, $session, $section)
 {
     $ses = trim($session);
     $stdcount = Student::select(DB::raw('count(*) as total'))->where('class', '=', $class)->where('session', '=', $ses)->first();
     $stdseccount = Student::select(DB::raw('count(*) as total'))->where('class', '=', $class)->where('session', '=', $ses)->where('section', '=', $section)->first();
     $r = intval($stdcount->total) + 1;
     if (strlen($r) < 2) {
         $r = '0' . $r;
     }
     $c = intval($stdseccount->total) + 1;
     $cl = substr($class, 2);
     $foo = array();
     if (strlen($cl) < 2) {
         $foo[0] = substr($ses, 2) . '0' . $cl . $r;
     } else {
         $foo[0] = substr($ses, 2) . $cl . $r;
     }
     if (strlen($c) < 2) {
         $foo[1] = '0' . $c;
     } else {
         $foo[1] = $c;
     }
     return $foo;
 }
コード例 #7
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getForMarks($class, $section, $shift, $session)
 {
     $students = Student::select('regiNo', 'rollNo', 'firstName', 'middleName', 'lastName')->where('isActive', '=', 'Yes')->where('class', '=', $class)->where('section', '=', $section)->where('shift', '=', $shift)->where('session', '=', $session)->get();
     return $students;
 }
コード例 #8
0
 public function filterMotherOccupation($occupation)
 {
     $occupations = Student::select('mother_occupation')->where('mother_occupation', 'like', "%{$occupation}%")->distinct()->take(5)->get();
     return $occupations->toJson();
 }
コード例 #9
0
ファイル: solutions.php プロジェクト: andrejjursa/list-lms
 private function get_valuation_table_data($course_id, $group_id = NULL, $condensed = FALSE)
 {
     $table_data = array('header' => array(), 'content' => array());
     $course = new Course();
     $course->get_by_id(intval($course_id));
     $group = new Group();
     $group->get_by_id((int) $group_id);
     if ($course->exists()) {
         $students = new Student();
         $students->select('id, fullname, email');
         $students->include_related('participant/group', array('id', 'name'));
         $students->where_related('participant/course', 'id', $course->id);
         $students->where_related('participant', 'allowed', 1);
         $students->order_by_as_fullname('fullname');
         if ($group->exists()) {
             $students->where_related('participant/group', 'id', (int) $group_id);
         }
         $students->get_iterated();
         $task_sets_out_of_group_ids = array(0);
         $task_sets_data = array();
         $task_sets_ids = array();
         $projects_ids = array();
         if ($group->exists()) {
             $students_filter = new Student();
             $students_filter->select('id');
             $students_filter->where_related('participant/course', 'id', $course->id);
             $students_filter->where_related('participant', 'allowed', 1);
             $students_filter->where_related('participant/group', 'id', (int) $group->id);
             $solutions_filter = new Solution();
             $solutions_filter->select('id');
             $solutions_filter->where_in_subquery('student_id', $students_filter);
             $task_sets_out_of_group = new Task_set();
             $task_sets_out_of_group->select('id');
             $task_sets_out_of_group->where_in_subquery('id', $solutions_filter);
             $task_sets_out_of_group->where('published', 1);
             $task_sets_out_of_group->get();
             $task_sets_out_of_group_ids = $task_sets_out_of_group->all_to_single_array('id');
             $task_sets_out_of_group_ids[] = 0;
         }
         $content_type_task_set = new Task_set();
         $content_type_task_set->select('id, name, content_type, group_id, task_set_type_id');
         $content_type_task_set->include_related('task_set_type', 'name');
         $content_type_task_set->include_related('group', 'name');
         $content_type_task_set->where('content_type', 'task_set');
         $content_type_task_set->where('published', 1);
         $content_type_task_set->where_related_course($course);
         $content_type_task_set->order_by_related_with_constant('task_set_type', 'name', 'asc');
         $content_type_task_set->order_by('task_set_type_id', 'asc');
         $content_type_task_set->order_by('publish_start_time', 'asc');
         if ($group->exists()) {
             $content_type_task_set->group_start();
             $content_type_task_set->group_start('', 'OR ');
             $content_type_task_set->group_start();
             $content_type_task_set->or_where('group_id', NULL);
             $content_type_task_set->or_where('group_id', (int) $group_id);
             $content_type_task_set->group_end();
             $content_type_task_set->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
             $content_type_task_set->group_end();
             $content_type_task_set->group_start('', 'OR ');
             $content_type_task_set->where_related('task_set_permission', 'group_id', (int) $group_id);
             $content_type_task_set->where_related('task_set_permission', 'enabled', 1);
             $content_type_task_set->group_end();
             $content_type_task_set->or_where_in('id', $task_sets_out_of_group_ids);
             $content_type_task_set->group_end();
         }
         $content_type_task_set->get();
         $header_items = array();
         if ($content_type_task_set->result_count() > 0) {
             $last_task_set_type_id = NULL;
             foreach ($content_type_task_set->all as $task_set) {
                 $permissions = new Task_set_permission();
                 $permissions->select('id, group_id');
                 $permissions->include_related('group', 'name');
                 $permissions->where_related_task_set($task_set);
                 $permissions->where('enabled', 1);
                 $permissions->get_iterated();
                 if ($permissions->result_count() > 0) {
                     $group_ids = array();
                     $group_names = array();
                     foreach ($permissions as $permission) {
                         $group_ids[] = $permission->group_id;
                         $group_names[] = $this->lang->text($permission->group_name);
                     }
                     $task_sets_data[$task_set->id] = array('group_id' => $group_ids, 'group_name' => $group_names);
                 } else {
                     $task_sets_data[$task_set->id] = array('group_id' => array($task_set->group_id), 'group_name' => $this->lang->text($task_set->group_name));
                 }
                 if ($task_set->task_set_type_id !== $last_task_set_type_id) {
                     $last_task_set_type_id = $task_set->task_set_type_id;
                     $header_items[] = array('type' => 'task_set_type', 'id' => $task_set->task_set_type_id, 'name' => $this->lang->text($task_set->task_set_type_name), 'title' => '');
                 }
                 if (!$condensed) {
                     $header_items[] = array('type' => 'task_set', 'id' => $task_set->id, 'name' => $this->lang->get_overlay_with_default('task_sets', $task_set->id, 'name', $task_set->name), 'title' => is_array($task_sets_data[$task_set->id]['group_name']) ? implode(', ', $task_sets_data[$task_set->id]['group_name']) : $task_sets_data[$task_set->id]['group_name']);
                 }
                 $task_sets_ids[] = $task_set->id;
             }
         }
         $table_data['header']['content_type_task_set'] = array('content_type_name' => $this->lang->line('admin_solutions_valuation_tables_header_content_type_task_sets'), 'items' => $header_items);
         $content_type_project = new Task_set();
         $content_type_project->where('content_type', 'project');
         $content_type_project->where('published', 1);
         $content_type_project->where_related_course($course);
         $content_type_project->order_by_related_with_constant('task_set_type', 'name', 'asc');
         $content_type_project->order_by('publish_start_time', 'asc');
         $content_type_project->get();
         $header_items = array();
         if ($content_type_project->result_count() > 0) {
             foreach ($content_type_project->all as $project) {
                 if (!$condensed) {
                     $header_items[] = array('type' => 'task_set', 'id' => $project->id, 'name' => $this->lang->get_overlay_with_default('task_sets', $project->id, 'name', $project->name), 'title' => '');
                 }
                 $projects_ids[] = $project->id;
             }
         }
         $table_data['header']['content_type_project'] = array('content_type_name' => $this->lang->line('admin_solutions_valuation_tables_header_content_type_project'), 'items' => $header_items);
         foreach ($students as $student) {
             $student_line = array('fullname' => $student->fullname, 'email' => $student->email, 'id' => $student->id, 'total_points' => 0, 'task_sets_points' => array(), 'task_sets_points_total' => 0, 'projects_points' => array(), 'projects_points_total' => 0);
             $solutions_data = array();
             if ($content_type_task_set->result_count() > 0 || $content_type_project->result_count() > 0) {
                 $solutions = new Solution();
                 $solutions->select('task_set_id, points, tests_points, not_considered, revalidate');
                 $solutions->where_related_student($student);
                 $solutions->group_start();
                 if (count($task_sets_ids) > 0) {
                     $solutions->or_where_in('task_set_id', $task_sets_ids);
                 }
                 if (count($projects_ids) > 0) {
                     $solutions->or_where_in('task_set_id', $projects_ids);
                 }
                 $solutions->group_end();
                 $solutions->get_iterated();
                 foreach ($solutions as $solution) {
                     $solutions_data[$solution->task_set_id] = array('points' => is_null($solution->points) && is_null($solution->tests_points) ? NULL : $solution->points + $solution->tests_points, 'not_considered' => $solution->not_considered, 'revalidate' => $solution->revalidate);
                 }
             }
             $task_sets_points_array = array();
             if ($content_type_task_set->result_count() > 0) {
                 $task_sets_points = 0;
                 $last_task_set_type_id = NULL;
                 $last_task_set_type_key = NULL;
                 foreach ($content_type_task_set->all as $task_set) {
                     if ($last_task_set_type_id !== $task_set->task_set_type_id) {
                         $last_task_set_type_id = $task_set->task_set_type_id;
                         $task_sets_points_array[] = array('type' => 'task_set_type', 'points' => 0, 'flag' => 'ok');
                         $last_task_set_type_key = count($task_sets_points_array) - 1;
                     }
                     $points = 0;
                     if (isset($solutions_data[$task_set->id])) {
                         if ($solutions_data[$task_set->id]['not_considered']) {
                             if (!$condensed) {
                                 $task_sets_points_array[] = array('type' => 'task_set', 'points' => '*', 'flag' => 'notConsidered');
                             }
                         } else {
                             if (is_null($solutions_data[$task_set->id]['points'])) {
                                 if (!$condensed) {
                                     $task_sets_points_array[] = array('type' => 'task_set', 'points' => '!', 'flag' => 'revalidate');
                                 }
                             } elseif ($solutions_data[$task_set->id]['revalidate']) {
                                 if (!$condensed) {
                                     $task_sets_points_array[] = array('type' => 'task_set', 'points' => $solutions_data[$task_set->id]['points'], 'flag' => 'revalidate');
                                 }
                                 $points = floatval($solutions_data[$task_set->id]['points']);
                             } else {
                                 if (!$condensed) {
                                     $task_sets_points_array[] = array('type' => 'task_set', 'points' => $solutions_data[$task_set->id]['points'], 'flag' => 'ok');
                                 }
                                 $points = floatval($solutions_data[$task_set->id]['points']);
                             }
                         }
                     } else {
                         if (!$condensed) {
                             if (!is_null($task_sets_data[$task_set->id]['group_id'][0]) && !in_array($student->participant_group_id, $task_sets_data[$task_set->id]['group_id'])) {
                                 $task_sets_points_array[] = array('type' => 'task_set', 'points' => '-', 'flag' => 'notInGroup');
                             } else {
                                 $task_sets_points_array[] = array('type' => 'task_set', 'points' => 'x', 'flag' => 'notSubmitted');
                             }
                         }
                     }
                     $task_sets_points += $points;
                     $task_sets_points_array[$last_task_set_type_key]['points'] += $points;
                     $student_line['total_points'] += $points;
                     $student_line['task_sets_points_total'] = $task_sets_points;
                 }
             }
             $student_line['task_sets_points'] = $task_sets_points_array;
             $task_sets_points_array = array();
             if ($content_type_project->result_count() > 0) {
                 $task_sets_points = 0;
                 foreach ($content_type_project as $task_set) {
                     $points = 0;
                     if (isset($solutions_data[$task_set->id])) {
                         if ($solutions_data[$task_set->id]['not_considered']) {
                             if (!$condensed) {
                                 $task_sets_points_array[] = array('type' => 'task_set', 'points' => '*', 'flag' => 'notConsidered');
                             }
                         } else {
                             if (is_null($solutions_data[$task_set->id]['points'])) {
                                 if (!$condensed) {
                                     $task_sets_points_array[] = array('type' => 'task_set', 'points' => '!', 'flag' => 'revalidate');
                                 }
                             } elseif ($solutions_data[$task_set->id]['revalidate']) {
                                 if (!$condensed) {
                                     $task_sets_points_array[] = array('type' => 'task_set', 'points' => $solutions_data[$task_set->id]['points'], 'flag' => 'revalidate');
                                 }
                                 $points = floatval($solutions_data[$task_set->id]['points']);
                             } else {
                                 if (!$condensed) {
                                     $task_sets_points_array[] = array('type' => 'task_set', 'points' => $solutions_data[$task_set->id]['points'], 'flag' => 'ok');
                                 }
                                 $points = floatval($solutions_data[$task_set->id]['points']);
                             }
                         }
                     } else {
                         if (!$condensed) {
                             $task_sets_points_array[] = array('type' => 'task_set', 'points' => 'x', 'flag' => 'notSubmitted');
                         }
                     }
                     $task_sets_points += $points;
                     $student_line['total_points'] += $points;
                     $student_line['projects_points_total'] = $task_sets_points;
                 }
             }
             $student_line['projects_points'] = $task_sets_points_array;
             $table_data['content'][] = $student_line;
         }
     }
     return $table_data;
 }
コード例 #10
0
 public function postgenerate()
 {
     $rules = ['class' => 'required', 'exam' => 'required', 'session' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/result/generate')->withErrors($validator)->withInput();
     } else {
         $subjects = Subject::select('name', 'code', 'type', 'subgroup')->where('class', '=', Input::get('class'))->get();
         $marksubmit = Marks::select('subject')->where('class', '=', Input::get('class'))->where('session', trim(Input::get('session')))->where('exam', Input::get('exam'))->distinct()->get();
         if (count($subjects) == count($marksubmit)) {
             $fourthsubjectCode = "";
             foreach ($subjects as $subject) {
                 if ($subject->type === "Electives") {
                     $fourthsubjectCode = $subject->code;
                 }
             }
             $students = Student::select('regiNo')->where('class', '=', Input::get('class'))->where('session', '=', trim(Input::get('session')))->get();
             if (count($students) != 0) {
                 $gparules = GPA::select('gpa', 'grade', 'markfrom')->get();
                 $foobar = array();
                 foreach ($students as $student) {
                     $marks = Marks::select('subject', 'grade', 'point', 'total')->where('regiNo', '=', $student->regiNo)->where('exam', '=', Input::get('exam'))->get();
                     if (count($marks) != 0) {
                         $totalpoint = 0;
                         $totalmarks = 0;
                         $subcounter = 0;
                         $banglamark = 0;
                         $englishmark = 0;
                         $isfail = false;
                         foreach ($marks as $mark) {
                             if ($this->getSubGroup($subjects, $mark->subject) === "Bangla") {
                                 $banglamark += $mark->total;
                             } else {
                                 if ($this->getSubGroup($subjects, $mark->subject) === "English") {
                                     $englishmark += $mark->total;
                                 } else {
                                     if ($mark->subject === $fourthsubjectCode) {
                                         if ($mark->point >= 2.0) {
                                             $totalmarks += $mark->total;
                                             $totalpoint += $mark->point - 2;
                                         } else {
                                             $totalmarks += $mark->total;
                                         }
                                         $subcounter--;
                                     } else {
                                         $totalmarks += $mark->total;
                                         $totalpoint += $mark->point;
                                     }
                                 }
                             }
                             $subcounter++;
                             if ($mark->subject !== $fourthsubjectCode && $mark->grade === "F") {
                                 $isfail = true;
                             }
                         }
                         if ($banglamark > 0) {
                             $blmarks = floor($banglamark / 2);
                             $totalmarks += $banglamark;
                             $totalpoint += $this->pointCalculator($blmarks, $gparules);
                             $subcounter--;
                         }
                         if ($englishmark > 0) {
                             $enmarks = floor($englishmark / 2);
                             $totalmarks += $englishmark;
                             $totalpoint += $this->pointCalculator($enmarks, $gparules);
                             $subcounter--;
                         }
                         $grandPoint = $totalpoint / $subcounter;
                         if ($isfail) {
                             $grandGrade = $this->gradnGradeCal(0.0, $gparules);
                         } else {
                             $grandGrade = $this->gradnGradeCal($grandPoint, $gparules);
                         }
                         $merit = new MeritList();
                         $merit->class = Input::get('class');
                         $merit->session = trim(Input::get('session'));
                         $merit->exam = Input::get('exam');
                         $merit->regiNo = $student->regiNo;
                         $merit->totalNo = $totalmarks;
                         $merit->point = $grandPoint;
                         $merit->grade = $grandGrade;
                         $merit->save();
                     } else {
                         return Redirect::to('/result/generate')->withInput()->with("noresult", "This examintaion marks not submited yet!!");
                     }
                 }
             } else {
                 return Redirect::to('/result/generate')->withInput()->with("noresult", "There is no students in this class!!");
             }
             return Redirect::to('/result/generate')->with("success", "Result Generate and Publish Successfull.");
         } else {
             return Redirect::to('/result/generate')->withInput()->with("noresult", "All subjects marks not submited yet!!");
         }
     }
 }