当前位置: 首页>>代码示例>>PHP>>正文


PHP Subject::select方法代码示例

本文整理汇总了PHP中Subject::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::select方法的具体用法?PHP Subject::select怎么用?PHP Subject::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subject的用法示例。


在下文中一共展示了Subject::select方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getsheet

 /**
  * 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');
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:59,代码来源:tabulationController.php

示例2: agregarGrupos

 public function agregarGrupos()
 {
     $data = Input::all();
     //Se revisa si había registros antes
     $temp = Plantilla::select('id_plan', 'grupo')->where('id_plan', $data['plan'])->where('grupo', $data['group'])->get();
     //Se obtienen los ID de las materias del semestre y plan seleccionados
     $materias = Subject::select('id')->where('semestre', '=', Input::get('semester'))->where('id_plan', '=', Input::get('plan'))->get();
     //Se eliminan las comas en caso de haber múltiples grupos
     $data['group'] = str_replace(" ", "", $data['group']);
     $data['group'] = strtoupper($data['group']);
     $grupos = explode(',', $data['group']);
     //Se añade cada uno de los grupos con sus respectivas materias a la base de datos
     foreach ($grupos as $grupo) {
         foreach ($materias as $materia) {
             $plantilla = new Plantilla();
             $plantilla->grupo = $grupo;
             $plantilla->id_plan = $data['plan'];
             $plantilla->id_subject = $materia['id'];
             $plantilla->id_proyecto = $data['idProyecto'];
             $plantilla->save();
         }
     }
     return Redirect::to('proyectos/editar-proyecto?p=' . $data['idProyecto']);
 }
开发者ID:Thekami,项目名称:sistema-horarios,代码行数:24,代码来源:ProyectosController.php

示例3: printlist

 public function printlist($class, $section, $shift, $session, $subject, $date)
 {
     if ($class != "" && $section != "" && $shift != "" && $subject != "" && $date) {
         $className = ClassModel::select('name')->where('code', $class)->first();
         $subjectName = Subject::select('name')->where('code', $subject)->first();
         $attendance = DB::table('Attendance')->join('Student', 'Attendance.regiNo', '=', 'Student.regiNo')->select('Attendance.id', 'Attendance.regiNo', 'Student.rollNo', 'Student.firstName', 'Student.middleName', 'Student.lastName', 'Attendance.status')->where('Attendance.class', '=', $class)->where('Attendance.section', '=', $section)->Where('Attendance.shift', '=', $shift)->where('Attendance.session', '=', trim($session))->where('Attendance.subject', '=', $subject)->where('Attendance.date', '=', $this->parseAppDate($date))->get();
         $input = array($className->name, $section, $shift, $session, $subjectName->name, $date);
         $fileName = $className->name . '-' . $section . '-' . $shift . '-' . $section . '-' . $subjectName->name . '-' . $date;
         Excel::create($fileName, function ($excel) use($input, $attendance) {
             $excel->sheet('New sheet', function ($sheet) use($input, $attendance) {
                 $sheet->loadView('app.attendanceExcel', compact('attendance', 'input'));
             });
         })->download('xlsx');
         // return "true";
     } else {
         return "Please fill up form correctly!";
     }
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:18,代码来源:attendanceController.php

示例4: exportData

 public function exportData($id_course)
 {
     $listSubject = Subject::select('id', 'name', 'id_course', 'mean', 'total', 'num_word', 'time_date')->where('id_course', $id_course)->get();
     $size = count($listSubject);
     for ($i = 0; $i < $size; $i++) {
         $subject = $listSubject[$i];
         $count = Word::where('id_subject', $subject->id)->count();
         Subject::where('id', $subject->id)->update(array('total' => $count));
     }
     try {
         $course_name = $this->convertNameCourse($id_course);
         $strListSubject = json_encode(Subject::select('id', 'name', 'id_course', 'mean', 'total', 'num_word', 'time_date')->where('id_course', $id_course)->get());
         $strListWord = json_encode(Word::select('id_word', 'id_subject', 'id_course', 'word', 'mean', 'example', 'example_mean', 'num_ef', 'time_date', 'next_time', 'num_n', 'num_i', 'max_q', 'phonetic', 'des')->where('id_course', $id_course)->get());
         $filePathSubject = public_path() . '/AllData/' . $course_name . '/' . $id_course . '/json/';
         $filePathWord = public_path() . '/AllData/' . $course_name . '/' . $id_course . '/json/';
         $this->createFolder($filePathSubject);
         $this->createFolder($filePathWord);
         $fileNameSubject = $filePathSubject . 'subject.json';
         $fileNameWord = $filePathWord . 'words.json';
         $fileSubject = fopen($fileNameSubject, "w");
         $fileWord = fopen($fileNameWord, "w");
         if (fwrite($fileSubject, $strListSubject) && fwrite($fileWord, $strListWord)) {
             fclose($fileSubject);
             fclose($fileWord);
             return true;
         } else {
             fclose($fileSubject);
             fclose($fileWord);
             return false;
         }
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:nguyensonghao,项目名称:api,代码行数:34,代码来源:WordController.php

示例5: getSubjects

 public function getSubjects($class)
 {
     $subjects = Subject::select('name', 'code')->where('class', $class)->orderby('code', 'asc')->get();
     return $subjects;
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:5,代码来源:classController.php

示例6: getmarks

 public function getmarks($subject)
 {
     $subject = Subject::select('totalfull', 'totalpass', 'wfull', 'wpass', 'mfull', 'mpass', 'sfull', 'spass', 'pfull', 'ppass')->where('code', '=', $subject)->get();
     return $subject;
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:5,代码来源:subjectController.php

示例7: postgenerate

 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!!");
         }
     }
 }
开发者ID:hrshadhin,项目名称:school-management-system,代码行数:95,代码来源:gradesheetController.php


注:本文中的Subject::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。