/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user_request = UserRequest::where('token', $data['request_token'])->first(); if ($user_request->role == "Student") { $user = Student::where('email', $user_request->email)->first(); } else { if ($user_request->role == "Teacher") { $user = Teacher::where('email', $user_request->email)->first(); } } $newUser = User::create(['name' => $user->name, 'email' => $user->email, 'password' => bcrypt($data['password'])]); $newUser->roles()->attach($user_request->role); $user_request->delete(); return $newUser; }
public function save() { $user_request = new UserRequest(); $user_request->token = bin2hex(random_bytes(15)); $user_request->role = $this->string; $user_request->email = $this->email; $user_request->save(); if ($this->string == 'Student') { $user = Student::where('email', $this->email)->first(); } elseif ($this->string == 'Teacher') { $user = Teacher::where('email', $this->email)->first(); } Mail::send('emails.reminder', ['user' => $user_request], function ($m) use($user) { $m->from('*****@*****.**', 'Your Account'); $m->to($user->email, $user->name)->subject('Set up your account!'); }); }
public function postUpdateSubject($scode) { //Moin //Subject Update post Function For admin //return $scode; $teacher = Input::get('subteacher'); $class = Input::get('subclass'); $teacher_name = Teacher::where('teacher_id', '=', $teacher)->pluck('teacher_id'); $class_name = ClassAdd::where('class_id', '=', $class)->pluck('class_name'); //return $class; $subname = Input::get('subname'); $subcode = Input::get('subcode'); $subclass = Input::get('subclass'); $subclass = $class_name; $subteacher = Input::get('subteacher'); $teacher_name = $teacher_name; $subauth = Input::get('subauth'); $subnote = Input::get('note'); //return $subname.$subcode.$subclass.$class_name.$subteacher.$teacher_name.$subauth.$subnote; $subupdate = Subject::where('institute_code', '=', Auth::user()->institute_id)->where('subject_code', '=', $scode)->update(['subject_name' => $subname, 'subject_code' => $subcode, 'class_name' => $subclass, 'class_id' => $class, 'teacher_name' => $subteacher, 'teacher_id' => $teacher_name, 'sub_author' => $subauth, 'note' => $subnote]); Session::flash('data', 'Data successfully added !'); return Redirect::to('admin/edit/subject/' . $scode); }
public function deleteTeachersInfo($uid) { //Moin //Student Delete Function for admin $infoDelete = Teacher::where('institute_code', '=', Auth::user()->institute_id)->where('teacher_id', '=', $uid)->delete(); $infoDelete = User::where('institute_id', '=', Auth::user()->institute_id)->where('uid', '=', $uid)->delete(); Session::flash('data', 'Data successfully deleted !'); return Redirect::to('/admin/add/teacher'); }
public function teacherbyalph() { if (\Request::ajax()) { $caracter = Input::get('caracter'); $teachers = Teacher::where('nom_teacher', 'LIKE', $caracter . '%')->where('user_id', \Auth::user()->id)->get(); foreach ($teachers as $teacher) { if ($teacher->photo) { $photo = asset('uploads/' . $teacher->photo); } else { $photo = asset('images/no_avatar.jpg'); } echo ' <tr> <td class="no-print"><div class="minimal single-row"> <div class="checkbox_liste "> <input type="checkbox" value="' . $teacher->id . ' " name="select[]"> </div> </div></td> <td><img class="avatar" src="' . $photo . '"></td> <td>' . $teacher->nom_teacher . '</td> <td>' . $teacher->poste . '</td> <td class="no-print"> <a href="' . action('TeachersController@delete', [$teacher->id]) . '" class="actions_icons delete-teacher"> <i class="fa fa-trash-o liste_icons"></i></a> <!--<a class="archive-teacher" href="' . action('TeachersController@archive', [$teacher->id]) . '"> <i class="fa fa-archive liste_icons"></i> </a>--> </td> <td class="no-print"><a href="' . action('TeachersController@show', [$teacher->id]) . '"><div class="btn_details">Détails</div></a></td> </tr> '; } // echo json_encode($enfants); //die(); } }
public function instituteReport($Iid) { /****Admin****/ $today = date('Y-m-d'); $y = date("Y"); //return $today; $totalStudents = Students::where('status', '=', 1)->where('institute_code', '=', $Iid)->count(); $totalStudentsMale = Students::where('status', '=', 1)->where('institute_code', '=', $Iid)->where('gender', '=', 'Male')->count(); $totalStudentsFemale = Students::where('status', '=', 1)->where('institute_code', '=', $Iid)->where('gender', '=', 'Female')->count(); $totalTeachesrs = Teacher::where('institute_code', '=', $Iid)->count(); $teacherAttendence = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Teacher')->where('status', '=', 0)->where('created_at', 'LIKE', "%{$today}%")->count(); $teacherAttendence1 = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Teacher')->where('status', '=', 1)->where('created_at', 'LIKE', "%{$today}%")->count(); $total = $teacherAttendence + $teacherAttendence1; //return $total; $today_atten = (int) ($total / $totalTeachesrs * 100); //return $today_atten; $a1 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$y}%")->where('type', '=', 'Teacher')->where('status', '=', 1)->count(); $a0 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$y}%")->where('type', '=', 'Teacher')->where('status', '=', 0)->count(); $ay = $a1 + $a0; //return $ay; if ($y % 4 == 0) { $x = 366; $year_percent = (int) ($ay / $x * 100); } else { $yx = 365; $year_percent = (int) ($ay / $yx * 100); } //return $atten_percent; // return $AtotalInstitute; $totalTeacherMale = Teacher::where('institute_code', '=', $Iid)->where('gender', '=', 'Male')->count(); $totalTeacherFemale = Teacher::where('institute_code', '=', $Iid)->where('gender', '=', 'Female')->count(); $m = date("Y-m"); ///$h=Holyday::where('holiday_date','LIKE',"%2016-03%")->get(); //$h=Holyday::where('holiday_date','LIKE',"%$m%")->get(); $d = date('t'); $at = Holyday::where('holiday_date', 'LIKE', "%{$m}%")->count(); $p = $d - $at; //return $p; $a12 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$m}%")->where('type', '=', 'Teacher')->where('status', '=', 1)->count(); $a02 = Attendence::where('institute_code', '=', $Iid)->where('created_at', 'LIKE', "%{$m}%")->where('type', '=', 'Teacher')->where('status', '=', 0)->count(); $ay2 = $a12 + $a02; //return $a12.$a02; $t = $totalTeachesrs * $p; $ms = (int) ($ay2 / $t * 100); $at = Holyday::where('holiday_date', 'LIKE', "%{$m}%")->count(); $InstiHolyday = InstiHolyday::where('holiday_date', 'LIKE', "%{$m}%")->where('institute_code', '=', $Iid)->count(); $InstiWeekEnd = AcademicCalender::where('institute_code', '=', $Iid)->pluck('weekendday'); $WeekEnd1 = str_limit($InstiWeekEnd, 3, ''); $WeekEnd2 = substr($InstiWeekEnd, 4); $WeekEnd3 = substr($InstiWeekEnd, 9); // return date('d', strtotime($WeekEnd1)); $month = date('m'); $year = date("Y"); $start_date = "01-" . $month . "-" . $year; $start_time = strtotime($start_date); $end_time = strtotime("+1 month", $start_time); for ($i = $start_time; $i < $end_time; $i += 86400) { $list[] = date('D', $i); } $p = $d - ($at + $InstiHolyday); $ms = (int) ($p / $d * 100); //students attendence report saif... //today attendence calculation $totalStudents = Students::where('institute_code', '=', $Iid)->count(); $totalstudentsAtten = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Student')->where('status', '=', 0)->where('created_at', 'LIKE', "%{$today}%")->count(); $studentTodayReport = (int) ($totalstudentsAtten / $totalStudents * 100); //monthly calculation $stdPrestAve = Attendence::where('institute_code', '=', $Iid)->where('type', '=', 'Student')->where('status', '=', 0)->where('created_at', 'LIKE', "%{$m}%")->count(); //$presentPersent= (int)(($stdPrestAve/$p)*100); $mtotal = $totalStudents * $p; $monthpresentPersent = (int) ($stdPrestAve / $mtotal * 100); ///yearly calculation return view('superadmin.ListofInstituteReport')->with('totalStudents', $totalStudents)->with('totalTeachesrs', $totalTeachesrs)->with('totalStudentsMale', $totalStudentsMale)->with('totalStudentsFemale', $totalStudentsFemale)->with('today', $today_atten)->with('year', $year_percent)->with('m', $totalTeacherMale)->with('f', $totalTeacherFemale)->with('mon', $ms)->with('studentTodayReport', $studentTodayReport)->with('monthpresentPersent', $monthpresentPersent); }
public function showTeacherList($taxonomy) { if (!array_key_exists($taxonomy, Admin::TEACHER_TAXONOMY)) { abort(404); } $data = ['section' => 'szdw']; $lists = Teacher::where('taxonomy', '=', $taxonomy)->paginate(6); if ($taxonomy === 'famous') { $lists = Teacher::where('famous', '=', 1)->paginate(6); } $data['teachers'] = $lists; $data = self::equipSort($data, 'szdw', $taxonomy); return view('teacherList', $data); }
public function postRoutineByClass() { //Moin //Exam routine search Function for admin //return 1; $class = Input::get('class'); //return $class; if ($class != '') { $examname = Exam::where('institute_code', '=', Auth::user()->institute_id)->lists('exam_id', 'exam_name'); $classname = ClassAdd::where('institute_code', '=', Auth::user()->institute_id)->lists('class_id', 'class_name'); $schedule = ExamSchedule::where('institute_code', '=', Auth::user()->institute_id)->get(); $teacher = Teacher::where('institute_code', '=', Auth::user()->institute_id)->get(); $sid = ClassRoutine::where('class_name', 'LIKE', $class)->pluck('institute_code'); $sat = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'SATURDAY')->get(); $sun = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'SUNDAY')->get(); $mon = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'MONDAY')->get(); $tue = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'TUESDAY')->get(); $wed = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'WEDNESDAY')->get(); $thu = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'THURSDAY')->get(); $fri = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'FRIDAY')->get(); $search1 = Section::where('class_name', '=', $class)->where('institute_code', '=', $sid)->orderBy('section_name', 'ASC')->lists('section_category', 'section_name'); $indsec = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->get(); //return $indsec; return view('admin.addroutine', ['examview' => $examname, 'classview' => $classname, 'examschedule' => $schedule, 'sat' => $sat, 'sun' => $sun, 'mon' => $mon, 'tue' => $tue, 'wed' => $wed, 'thu' => $thu, 'fri' => $fri, 'sec' => $indsec, 'section' => $search1, 'teacher' => $teacher]); } }
public function getTeacherAttdenceAllReport($tid) { $AppWE = AcademicCalender::where('institute_code', '=', Auth::user()->institute_id)->pluck('weekendday'); $tpinfo = Teacher::where('institute_code', '=', Auth::user()->institute_id)->where('teacher_id', '=', $tid)->first(); $App = str_limit($AppWE, 3, ''); $sewe = substr($AppWE, 4); $sewe3 = substr($AppWE, 9); $month = Input::get('month'); // return $month; $year = date("Y"); $start_date = "01-" . $month . "-" . $year; $start_time = strtotime($start_date); //return $start_time; $end_time = strtotime("+1 month", $start_time); for ($i = $start_time; $i < $end_time; $i += 86400) { $list[] = date('l', $i); $list1[] = date('Y-m-d', $i); } //return $list1; return view('admin.attendence.individualteacherreport', ['pre' => $list1, 'day' => $list, 'teacher' => $tpinfo, 'App' => $App, 'sewe' => $sewe, 'sewe3' => $sewe3]); }
/** * Set registration process active / in-active * * @param $user * @return mixed */ public function toggleRegistrationProcess($user) { if ($user === 'staff') { if ($this->isRegistrationActive('staff')) { unlink(storage_path() . '/app/activeForStaff'); // Clear the tables Grade::truncate(); ElectiveCount::truncate(); TeacherRequest::truncate(); AllocatedElective::truncate(); AdminStaffRequest::truncate(); HostelStaffRequest::truncate(); CurrentStudentState::truncate(); LibraryStaffRequest::truncate(); ChiefWardenStaffRequest::truncate(); Teacher::where('semNo', '>', '0')->update(['semNo' => null]); } else { touch(storage_path() . '/app/activeForStaff'); } } else { if ($user === 'students') { if ($this->isRegistrationActive('student')) { unlink(storage_path() . '/app/activeForStudents'); } else { touch(storage_path() . '/app/activeForStudents'); } } } return redirect()->back(); }
public function getmatters() { if (\Request::ajax()) { $value = \Input::get('value'); $teacher = Teacher::where('user_id', \Auth::user()->id)->where('id', $value)->first(); foreach ($teacher->matters as $item) { echo '<option value="' . $item->id . '">' . $item->nom_matiere . '</option>'; } } }