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


PHP semester函数代码示例

本文整理汇总了PHP中semester函数的典型用法代码示例。如果您正苦于以下问题:PHP semester函数的具体用法?PHP semester怎么用?PHP semester使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: createFromExcel

 private function createFromExcel()
 {
     $semester_id = semester()->id;
     $results = Excel::load($this->filename)->get()->all();
     // dd(get_class_methods($results));
     $subjects_codes = [];
     $teachers_usernames = [];
     $classrooms_codes = [];
     foreach ($results as $sheet) {
         $item = $sheet->all();
         if (empty($item[1]) || empty($item[2]) || empty($item[3])) {
             continue;
         }
         $teachers_usernames[] = $item[2];
         $subjects_codes[] = $item[1];
         $classrooms_codes[] = $item[3];
     }
     $teachers = Teacher::whereIn('username', $teachers_usernames)->pluck('id', 'username')->toArray();
     $subjects = Subject::whereIn('code', $subjects_codes)->pluck('id', 'code')->toArray();
     $classrooms = Classroom::whereIn('code', $classrooms_codes)->inCurrentSemester()->pluck('id', 'code')->toArray();
     $new_classrooms = [];
     foreach ($results as $sheet) {
         $item = $sheet->all();
         if (empty($item[1]) || empty($item[2]) || empty($item[3])) {
             continue;
         }
         if (!isset($classrooms[$item[3]]) && isset($teachers[$item[2]]) && isset($subjects[$item[1]]) && in_array($item[5], ['m', 'f', 'b'])) {
             $new_classrooms[] = ['code' => $item[3], 'day' => $item[4] - 1, 'gender' => $item[5], 'teacher_id' => $teachers[$item[2]], 'subject_subject_id' => $subjects[$item[1]], 'semester_id' => $semester_id, 'attendees_limit' => 100, 'created_at' => new DateTime(), 'updated_at' => new DateTime()];
         }
     }
     if (!empty($new_classrooms)) {
         Classroom::insert($new_classrooms);
     }
     event(new CreateClassroomsFromExcelFinished());
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:35,代码来源:CreateClassroomsFromExcelJob.php

示例2: active

 public function active()
 {
     $subjects = [];
     $fields = [];
     if (FinancialException::whereSemesterId(semester()->id)->whereStudentId($this->student->id)->whereActive(1)->count()) {
         return response()->json(false, 200, [], JSON_NUMERIC_CHECK);
     }
     $this->student->load('registration', 'registration.contactcountry', 'registration.contactcity');
     $subjects = Subject::join('student_subjects as ss', function ($j) {
         $j->on('ss.subject_id', '=', 'subject_subjects.id')->where('student_id', '=', $this->student->id)->where('state', '=', 'study')->where('semester_id', '=', $this->semester->id)->where('payed', '=', 0);
     })->get()->toArray();
     // if() {
     $study_fee = FinancialInvoiceItem::where('slug', 'study_fee')->first();
     $study_fee = $study_fee ? $study_fee->amount : 0;
     // } else {
     // $study_fee = 6;
     // }
     $total_fee = 0;
     foreach ($subjects as &$subject) {
         $subject['fee'] = !$subject['is_quran'] ? $subject['hour'] * $study_fee : $subject['hour'] * 7.5;
         $total_fee += $subject['fee'];
     }
     if ($total_fee > 0) {
         if (!$this->student->registration) {
             return response()->json(false, 200, [], JSON_NUMERIC_CHECK);
         }
         $data = ['key' => 'student', 'value' => $this->student->username, 'transaction_id' => time(), 'amount' => $total_fee, 'bill_to_forename' => $this->student->registration->first_name, 'bill_to_surname' => $this->student->registration->last_name, 'bill_to_email' => $this->student->registration->contact_email, 'bill_to_address_line1' => $this->student->registration->adress, 'bill_to_phone' => $this->student->registration->contact_mobile, 'bill_to_address_city' => $this->student->registration->contactcity ? $this->student->registration->contactcity->name : '', 'bill_to_address_country' => 'OM'];
         $payment = new PaymentGateway($data);
         $fields = $payment->getData();
     }
     if (empty($total_fee)) {
         return response()->json(false, 200, [], JSON_NUMERIC_CHECK);
     }
     return response()->json(compact('subjects', 'fields'), 200, [], JSON_NUMERIC_CHECK);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:35,代码来源:PaymentsController.php

示例3: create

 /**
  * Show the form for creating a new resource.
  * @return Response
  */
 public function create()
 {
     $students = QuranTimeExtend::with('student', 'semester', 'subject')->where('semester_id', semester()->id)->paginate(20);
     $subjects = Subject::where('is_quran', 1)->pluck('name', 'id')->toArray();
     //$name = $students->$student;
     return view('quran::time_extend.create', compact('students', 'subjects'));
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:11,代码来源:TimeExtendController.php

示例4: index

 public function index(Request $request)
 {
     $student_id = $this->student->id;
     $order_dir = in_array($request->input('order_dir'), ['ASC', 'DESC']) ? $request->input('order_dir') : 'ASC';
     $exams = Exam::select('exams.type', 'exams.start_at', 'exams.finish_at', 'exams.name', 'exams.id')->join('subject_subjects as subsub', 'subsub.id', '=', 'exams.subject_id')->join('student_subjects as stusub', function ($j) use($student_id) {
         $j->on('stusub.subject_id', '=', 'subsub.id')->where('stusub.student_id', '=', $student_id)->where('stusub.state', '=', 'study');
     })->where(function ($query) use($request, $student_id) {
         $query->orWhereIn('exams.type', ['midterm', 'remidterm', 'activity'])->orWhereRaw('exams.id IN (SELECT ce.exam_id FROM classrooms_exam as ce
                             JOIN classrooms as c ON c.id = ce.classroom_id
                             JOIN classroom_students as cs ON cs.classroom_id = c.id
                                 AND cs.student_id = ' . $student_id . '
                             WHERE exam_id = exams.id GROUP BY ce.id)');
         if ($request->has('finalExam') == 'true') {
             $query->orWhereIn('exams.type', ['final', 'summer', 'refinal']);
         }
     })->where('exams.semester_id', semester()->id)->where('finish_at', '>=', date('Y-m-d H:i:s'))->groupBy('exams.id')->orderBy('exams.start_at', $order_dir)->with(['questions' => function ($w) {
         $w->select('questionbank_questions.id', 'questionbank_questions.question', 'questionbank_questions.type');
         if ($this->randomize_questions) {
             $w->orderByRaw('RAND()');
         } else {
             $w->orderBy('questionbank_questions.type', 'DESC');
         }
     }, 'questions.choices' => function ($w) {
         $w->select('questionbank_choices.id', 'questionbank_choices.question_id', 'questionbank_choices.choice', 'questionbank_choices.istrue');
     }])->get();
     return response()->json(compact('exams'), 200, [], JSON_NUMERIC_CHECK);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:27,代码来源:ExamsController.php

示例5: index

 /**
  * Display a listing of the resource.
  * @return Response
  */
 public function index(Request $request)
 {
     $excuses = ExamExcuse::where('semester_id', semester()->id)->with('student', 'subject', 'exam');
     if (request('subject_id')) {
         $subject_id = request('subject_id');
         $excuses->whereHas('exam.subject', function ($q) use($subject_id) {
             $q->where('subject_subjects.id', $subject_id);
         });
     }
     if (request('exam_year_term')) {
         $excuses->whereIn('subject_id', explode(',', request('exam_year_term')));
     }
     $per_page = request('per_page') ? request('per_page') : 50;
     $excuses = $excuses->paginate($per_page);
     $excuses->appends($request->except("page"));
     $subjects = Subject::lists('name', 'id')->toArray();
     $year_term = Year::join('academystructure_terms', 'academystructure_years.id', '=', 'academystructure_terms.year_id')->join('academystructure_departments', 'academystructure_terms.id', '=', 'academystructure_departments.term_id')->select(\DB::raw('CONCAT(academystructure_years.name, "-", academystructure_terms.name) as name,
                                     GROUP_CONCAT(DISTINCT(academystructure_departments.subject_ids)) as sid'))->groupBy('academystructure_terms.name', 'academystructure_years.name')->get()->toArray();
     $year_term_options;
     foreach ($year_term as $key => &$aa) {
         $a = implode(',', array_unique(array_merge(json_decode(str_replace('],[', ',', $aa['sid']), TRUE))));
         $year_term_options[$a] = $aa['name'];
     }
     return view('exams::excuses.index', compact('excuses', 'subjects', 'year_term_options'));
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:29,代码来源:ExamExcusesController.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $where = ['student_id' => student()->id, 'semester_id' => semester()->id, 'subject_id' => $request->subject_id, 'remaining' => 0];
     if (QuranRecording::where($where)->count()) {
         return redirect()->route('students.profile.subjects.index')->with('info', 'لقد استنفذت تسجيلات التلاوة المتاحة لك لهذه المادة.');
     }
     return $next($request);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:15,代码来源:QuranRecorded.php

示例7: scopeStudentNotAttended

 public function scopeStudentNotAttended($query, $student_id)
 {
     $query->join('subject_subjects as ss', 'ss.id', '=', 'exams.subject_id')->join('student_subjects as stusub', function ($j) use($student_id) {
         $j->on('stusub.subject_id', '=', 'ss.id')->where('stusub.student_id', '=', $student_id)->where('stusub.semester_id', '=', semester()->id)->where('stusub.state', '=', 'study');
     })->leftJoin('exam_results as er', function ($j) use($student_id) {
         $j->on('er.exam_id', '=', $this->getTable() . '.id')->where('er.student_id', '=', $student_id);
     })->whereNull('er.id')->groupBy('exams.id');
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:8,代码来源:Exam.php

示例8: index

 public function index()
 {
     $user = Auth::guard('api_student')->user();
     $lessons = Lesson::select('sl.id', 'sl.name', 'sl.subject_subject_id', 'sl.lesson_order', 'sl.type', 'sl.state')->join('subject_subjects as ss', 'ss.id', '=', 'sl.subject_subject_id')->join('student_subjects as stusub', function ($j) use($user) {
         $j->on('stusub.subject_id', '=', 'ss.id')->where('student_id', '=', $user->id)->where('semester_id', '=', semester()->id);
     })->from('subject_lessons as sl')->groupBy('sl.id')->get();
     return response()->json($lessons, 200, [], JSON_NUMERIC_CHECK);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:8,代码来源:LessonsController.php

示例9: chooseClassroom

 public function chooseClassroom(ChooseClassroomRequest $request)
 {
     $input = $request->all();
     $student = student();
     $student->classrooms()->attach([$input['classroom_id'] => ['semester_id' => semester()->id]]);
     event(new StudentChoseClassroom(Classroom::find($input['classroom_id']), $student, new User()));
     return redirect()->route('students.profile.classrooms.index');
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:8,代码来源:ClassroomsController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  * @param  Request $request
  * @return Response
  */
 public function store(Request $request, FinancialException $exceptions)
 {
     $exceptions->fill($request->all());
     $exceptions->active = $request->input('active');
     $exceptions->semester_id = semester()->id;
     $exceptions->save();
     $exceptions = FinancialException::with('students')->paginate(20);
     return redirect()->route('financials.exceptions.index');
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:14,代码来源:ExceptionsController.php

示例11: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     FinancialInvoice::creating(function ($invoice) {
         $invoice->semester_id = empty($invoice->semester_id) ? semester()->id : $invoice->semester_id;
     });
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:14,代码来源:FinancialsServiceProvider.php

示例12: boot

 /**
  * Boot the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
     StudentGrade::creating(function ($grade) {
         $grade->semester_id = semester()->id;
     });
     Relation::morphMap(['students' => \Modules\Students\Entities\Student::class]);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:15,代码来源:StudentsServiceProvider.php

示例13: delete

 public function delete(Request $request)
 {
     $input = $request->all();
     $this->student->classrooms()->detach($input['classroom_id']);
     event(new StudentExitClassroom(Classroom::find($input['classroom_id']), $this->student, new User()));
     $classroom = Classroom::select('cs.student_id as chosen', 'classrooms.attendees_limit', 'classrooms.name', 'classrooms.code', 'classrooms.id', 'classrooms.teacher_id', 'classrooms.subject_subject_id', 'classrooms.day', 'classrooms.hour')->join('subject_subjects as subsub', 'subsub.id', '=', 'classrooms.subject_subject_id')->join('student_subjects as stusub', function ($join) {
         $join->on('stusub.subject_id', '=', 'subsub.id')->where('stusub.student_id', '=', $this->student->id);
     })->leftJoin('classroom_students as cs', function ($j) {
         $j->on('cs.classroom_id', '=', 'classrooms.id')->where('cs.student_id', '=', $this->student->id)->where('cs.semester_id', '=', semester()->id);
     })->whereIn('classrooms.gender', [$this->student->gender, 'b'])->with('subject')->withCount('students')->find($input['classroom_id']);
     return response()->json($classroom, 200, [], JSON_NUMERIC_CHECK);
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:CalssroomsController.php

示例14: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $semester_id = semester()->id;
     $students = Student::whereIn('students.id', $this->students_ids)->select('students.id', 'students.registration_id', 'students.name', 'students.email', 'students.mobile', 'registrations.contact_email')->with('registration')->leftJoin('registrations', 'registrations.id', '=', 'students.registration_id')->groupBy('students.id')->get();
     $created_at = new DateTime();
     // $students = $this->students;
     $students_messages = [];
     foreach ($students as $student) {
         $student_message = [];
         $student_message['created_at'] = $created_at;
         $student_message['updated_at'] = $created_at;
         $student_message['sender_id'] = $this->sender_id;
         $student_message['semester_id'] = $semester_id;
         $student_message['email'] = $this->email;
         $student_message['sms'] = $this->sms;
         $student_message['student_id'] = $student->id;
         $student_message['email_sent'] = 0;
         $student_message['sms_sent'] = 0;
         if (!empty($this->email)) {
             try {
                 $mailer->send('students::emails.message', ['content' => $this->email], function ($m) use($student) {
                     if (!empty($student->registration) && !empty($student->registration->contact_email)) {
                         if (filter_var($student->registration->contact_email, FILTER_VALIDATE_EMAIL)) {
                             $m->cc([$student->registration->contact_email]);
                         }
                     }
                     $m->to($student->email, $student->name)->subject("مركز التعليم عن بعد");
                 });
                 $student_message['email_sent'] = 1;
             } catch (\Swift_RfcComplianceException $e) {
             }
         }
         $mobile_number = $student->mobile;
         if (substr($mobile_number, 0, 3) != 968 && substr($mobile_number, 0, 5) != '00968') {
             $mobile_number = '968' . $mobile_number;
         }
         if (substr($mobile_number, 0, 5) == '00968') {
             $mobile_number = str_replace('00968', '968', $mobile_number);
         }
         // \Log::info($mobile_number);
         if (!empty(trim($this->sms)) && strlen($mobile_number) == 11) {
             $sms = new SmsGateway($this->sms, [$mobile_number]);
             $result = $sms->send();
             if ($result == true or $result->getPushMessageResult()->PushMessageResult == 1) {
                 $student_message['sms_sent'] = 1;
             }
         }
         $students_messages[] = $student_message;
         // $message->save();
     }
     DB::table('student_messages')->insert($students_messages);
     event(new StudentsMessagesQueueFinished());
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:58,代码来源:SendStudentsMessage.php

示例15: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $student = Student::find($this->student_id);
     $currentSemester = semester();
     if ($student) {
         $history = StudentHistory::where('academycycle_semester_id', $currentSemester->id)->where('student_id', $student->id)->first();
         if ($history) {
             $history->update(['state' => 'fired', 'study_state' => 'stop']);
         }
         StudentSubject::where('semester_id', $currentSemester->id)->where('student_id', $student->id)->update(['state' => 'fail']);
         $student->update(['state' => 'fired', 'study_state' => 'stop']);
     }
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:18,代码来源:ExpelStudentJob.php


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