public function destroy($student_id)
 {
     $student = Student::find($student_id);
     if ($student) {
         $student->courses()->detach();
         $student->delete();
         return $this->createSuccessResponse("The student with id {$student_id} has been removed", 200);
     }
     return $this->createErrorResponse('The student with the specified id does not exists');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $students = Student::find($id);
     $faculties = Faculty::lists('faculty_name', 'faculty_code');
     $studies = Study::lists('study_name', 'id');
     $programStudies = ProgramStudy::lists('name', 'id');
     $academicRegistrations = AcademicRegistration::lists('academic_year', 'id');
     $religions = Religion::lists('name', 'id');
     return view('dashboard.admin.student.edit', ['student' => $students, 'faculty' => $faculties, 'study' => $studies, 'programStudy' => $programStudies, 'academicRegistration' => $academicRegistrations, 'religion' => $religions]);
 }
Beispiel #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateParentRequest $request)
 {
     $parent = new Guardian(array('firstname' => $request->firstname, 'lastname' => $request->lastname, 'middlename' => $request->middle_name, 'phone' => $request->phone, 'district' => $request->district, 'home_address' => $request->home_address, 'office_address' => $request->office_address, 'occupation' => $request->occupation, 'email' => $request->email));
     $student = \App\Student::find($request->student_id);
     $parent = $student->guardians()->save($parent, ['relation' => $request->relation]);
     if ($parent) {
         return \Redirect::route('learners')->with('message', 'Parent successfuly registered!');
     } else {
         return \Redirect::route('learners')->with('error-message', 'Failed to register Parent!');
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $student = Student::find($id);
     $student->sernum = $request->sernum;
     $student->category_id = $request->category_id;
     $student->lastname = $request->lastname;
     $student->firstname = $request->firstname;
     $student->email = $request->email;
     $student->sernum = $request->sernum;
     $student->save();
     return redirect()->route('student.index');
 }
 /**
  * This function sends a verification
  * mail with code to the students.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function sendVerifiactionMail()
 {
     // Get currently logged in student
     $student = Student::find(Auth::guard('student')->user()->rollNo);
     $verificationCode = $this->generateVerificationCode($student->rollNo);
     $student->verificationCode = $verificationCode;
     $student->save();
     Mail::queue('student.auth.emails.verification', ['student' => $student], function ($msg) use($student) {
         $msg->from('*****@*****.**', 'Support');
         $msg->to($student->email, $student->name)->subject('Your Verification code');
     });
     $statusMsg = 'Verification code successfully sent on ' . $student->email;
     return redirect()->back()->with('status', $statusMsg);
 }
 public function destroy($course_id, $student_id)
 {
     $course = Course::find($course_id);
     if ($course) {
         $student = Student::find($student_id);
         if ($student) {
             if (!$course->students()->find($student->id)) {
                 return $this->createErrorResponse("The student with id {$student->id} does not exists in the course with id {$course->id}", 404);
             }
             $course->students()->detach($student->id);
             return $this->createSuccessResponse("The student with id {$student->id} was removed from the course with id {$course->id}", 200);
         }
         return $this->createErrorResponse("The student with id {$student_id} does not exists", 404);
     }
     return $this->createErrorResponse("The course with id {$course_id}, does not exists", 404);
 }
 public function ucenik($id)
 {
     //
     $student = Student::find($id);
     $ulogovani_user_id = \Auth::user()->id;
     $odabrani_razred_id = $student->category->id;
     $odabrani_ucenik_id = $student->id;
     $count = Report::where('user_id', '=', $ulogovani_user_id)->where('category_id', '=', $odabrani_razred_id)->where('student_id', '=', $odabrani_ucenik_id)->count();
     if ($count < 1) {
         return view('reports.create')->with('ulogovani_user_id', $ulogovani_user_id)->with('odabrani_razred_id', $odabrani_razred_id)->with('odabrani_ucenik_id', $odabrani_ucenik_id);
         //return $count;
     } else {
         $report = Report::where('user_id', '=', $ulogovani_user_id)->where('category_id', '=', $odabrani_razred_id)->where('student_id', '=', $odabrani_ucenik_id)->first();
         return view('reports.index')->with('report', $report);
     }
 }
Beispiel #8
0
 public function postUpdate(Request $request, $id)
 {
     $inputs = $request->all();
     $rules = ['phone' => 'required'];
     $validator = Validator::make($inputs, $rules);
     if ($validator->passes()) {
         $student = Student::find($id);
         $student->c_lxdh = $inputs['phone'];
         $student->c_zyh = $inputs['major'];
         if ($student->save()) {
             return redirect('/')->with('status', '双学位报名成功');
         } else {
             return back()->withErrors('双学位报名失败');
         }
     } else {
         return back()->withErrors($validator);
     }
 }
 public static function rollbackLog($id, $user, $review_ip)
 {
     $review_at = date('Y-m-d H:i:s', time());
     $update_arr = array('review_name' => $user->name, 'review_email' => $user->email, 'review_ip' => $review_ip, 'review_at' => $review_at, 'review' => true, 'status' => '审核未通过');
     $manage_log = self::find($id);
     $before = json_decode($manage_log->before_info, true);
     $after = json_decode($manage_log->after_info, true);
     //Student
     if ($manage_log->type == "新增信息") {
         $student = Student::find($after['id']);
         if (!$student) {
             return "数据回滚失败:学号为" . $after['id'] . "的学生已不存在!";
         }
         $student->delete();
     }
     if ($manage_log->type == "修改信息") {
         $data = array();
         foreach ($before as $key => $value) {
             if ($before[$key] != $after[$key]) {
                 $data[$key] = $before[$key];
             }
         }
         $student = Student::find($after['id']);
         if (!$student) {
             return "数据回滚失败:学号为" . $after['id'] . "的学生已不存在!";
         }
         $student->update($data);
     }
     if ($manage_log->type == "删除信息") {
         $student = Student::find($before['id']);
         if ($student) {
             return "数据回滚失败:已存在学号为" . $before['id'] . "的学生!";
         }
         Student::create($before);
     }
     $manage_log->update($update_arr);
 }
 /**
  * Update user password
  *
  * @param Request $request
  * @return mixed
  */
 public function updatePassword(Request $request)
 {
     // Get the logged in user
     $student = Student::find(Auth::guard('student')->user()->rollNo);
     $newPassword = $request['password'];
     // Validate the password
     $this->validate($request, ['password' => 'required|min:8']);
     // Save updated password
     $student->password = bcrypt($newPassword);
     $student->save();
     return redirect()->back()->with('status', 'Success');
 }
 public function editStudent(Request $request)
 {
     $id = $this->clean($request->input('id'));
     $student = Student::find($id);
     return view('student/delete_edit', array('student' => $student));
 }
Beispiel #12
0
 /**
  * @param  int
  * @param  string
  * @return double
  */
 public static function calculateStaffDiscount($student_id, $fee_schedule_code)
 {
     //initialise discount to zero
     $discount = 0;
     //get stuednt info
     $student = Student::find($student_id);
     //get the staff discount value for this fee schedule
     $staff_discount = self::getStaffDiscountAmount($fee_schedule_code);
     //get details of staff discount policy
     $discount_policy = DiscountPolicy::where('discount_name', 'Parent')->first();
     //get all wards with same staff
     $same_staff = Student::select('id')->where('staff_id', $student->staff_id)->get();
     //divide staff discount accross all wards that have thesame staff
     if ($discount_policy->all_wards == 1) {
         $discount += $staff_discount / count($same_staff);
         return $discount;
     }
     //dont divide staff discount accross all wards that have thesame staff
     if ($discount_policy->dont_divide == 1) {
         $discount += $staff_discount;
         return $discount;
     }
     if ($discount_policy->all_wards == 0) {
         $student_ids = [];
         foreach ($same_staff as $stud) {
             $student_ids[] = $stud->id;
         }
         sort($student_ids);
         foreach ($student_ids as $key => $student_id) {
             if ($key == $discount_policy->ward_to_deduct - 1) {
                 $ward_to_deduct = $student_id;
             }
         }
         if ($ward_to_deduct == $student->id) {
             $discount += $staff_discount;
         }
         return $discount;
     }
 }
Beispiel #13
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $student = Student::find($id);
     $student->delete();
     return redirect('/student');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $student = Student::find($id);
     $student->destroy();
     return \Redirect::to('admin/students');
 }
 public function destroy($id)
 {
     $data = Student::find($id);
     $data->delete();
     return redirect()->route('student.index');
 }
 /**
  * Manually verify a student
  *
  * @param $rollNo
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function verifyStudent($rollNo)
 {
     if ($rollNo != null) {
         $student = Student::find($rollNo);
         $student->verified = true;
         $student->save();
     }
     return redirect('admins/manage/students');
 }
Beispiel #17
0
<?php

use App\Student;
use App\Lecturer;
?>
@extends('layout.template')
@section('content')

    <h1>Update Thread</h1>
    {!! Form::model($threadforum,['method' => 'PATCH','route'=>['threadforum.update',$threadforum->kdThread]]) !!}
    <?php 
$user = $threadforum->kdAuthor;
$author = Lecturer::find($user);
if ($author == null) {
    $author = Student::find($user);
}
//echo $author['nama'];
?>
	<div class="form-group">
        {!! Form::label('Author', 'Author:') !!}
        {!! Form::label($author["nama"],null,['class'=>'form-control']) !!}
    </div>
	<div class="form-group">
        {!! Form::label('Subject', 'Subject:') !!}
        {!! Form::text('judul',null,['class'=>'form-control']) !!}
    </div>
    
    <div class="form-group">
        {!! Form::label('Detail', 'Detail:') !!}
        {!! Form::textarea('isi',null,['class'=>'form-control']) !!}
    </div>
 /**
  * Register a student for new semester
  *
  * @param Request $request
  * @return mixed
  */
 public function registerStudent(Request $request)
 {
     if (!$this->isRegistrationActive('staff')) {
         return view($this->inactiveView);
     }
     $rollNo = $request['rollNo'];
     // Now register the student
     $verificationCode = $this->generateVerificationCode($rollNo);
     CurrentStudentState::find($rollNo)->update(['approved' => true, 'verificationCode' => $verificationCode]);
     Student::find($rollNo)->update(['semNo' => CurrentStudentState::find($rollNo)->semNo]);
     return redirect()->back();
 }
 public function downloadSheet($id, $level, ExcelWorker $worker)
 {
     $student = Student::find($id);
     $this->getSheet($student, $worker, $level);
 }
 public static function fetchAllNoregisterInfo($currentSheet, $force = false)
 {
     $arr = array();
     $arr['type'] = '未报到';
     $arr['success'] = 0;
     $arr['new'] = 0;
     $arr['update'] = 0;
     $arr['keep'] = 0;
     $arr['fail'] = 0;
     $arr['note'] = '';
     $highestRow = $currentSheet->getHighestRow();
     // 取得总行数
     $highestColumm = $currentSheet->getHighestColumn();
     // 取得总列数
     $highestColumm = PHPExcel_Cell::columnIndexFromString($highestColumm);
     for ($row = 2; $row <= $highestRow; $row++) {
         $item = array();
         //$item = array('number 0' =>'', 'type 1' => '', 'nationality 2' => '', 'stu_id 3' => '', 'name_cn 4' => '', 'name_en 5' => '',
         //			'csc_no 6' => '', 'passport_id 7' => '', 'sex 8' => '', 'birthday 9' => '', 'school 10' => '', 'major 11' => '',
         //			'admission_date 12' => '', 'old_class 13' => '', 'new_class 14' => '', 'language 15' => '', 'fee 16' => '',
         //           'address 17' => '', 'telephone 18' => '', 'email 19' => '', 'note1 20' => '', 'note2 21' => '');
         for ($column = 0; $column < $highestColumm; $column++) {
             $columnName = PHPExcel_Cell::stringFromColumnIndex($column);
             $item[$column] = $currentSheet->getCellByColumnAndRow($column, $row)->getValue();
         }
         if ($item[3]) {
         } else {
             $arr['fail']++;
             $arr['note'] = '学号不能为空!';
             continue;
         }
         $item[3] = strtoupper($item[3]);
         $student = Student::find($item[3]);
         if ($student && $force) {
             //已存在,强制时处理
             $student->id = $item[3];
             $student->type = $item[1];
             $student->nationality = $item[2];
             $student->name_cn = $item[4];
             $student->name_en = $item[5];
             $student->csc_no = $item[6];
             $student->passport_id = $item[7];
             $student->gender = $item[8];
             $student->birthday = $item[9];
             $student->school = $item[10];
             $student->major = $item[11];
             $student->admission_date = $item[12];
             $student->old_class = $item[13];
             $student->new_class = $item[14];
             $student->language = $item[15];
             $student->fee_type = $item[16];
             $student->inschool_address = $item[17];
             $student->telephone = $item[18];
             $student->email = $item[19];
             $student->tutor = $item[20];
             $student->inschool_note1 = $item[21];
             $student->inschool_note2 = $item[22];
             $student->stu_type = '未报到';
             $student->save();
             $arr['success']++;
             $arr['update']++;
         } else {
             if (!$student) {
                 $student = new Student();
                 $student->id = $item[3];
                 $student->type = $item[1];
                 $student->nationality = $item[2];
                 $student->name_cn = $item[4];
                 $student->name_en = $item[5];
                 $student->csc_no = $item[6];
                 $student->passport_id = $item[7];
                 $student->gender = $item[8];
                 $student->birthday = $item[9];
                 $student->school = $item[10];
                 $student->major = $item[11];
                 $student->admission_date = $item[12];
                 $student->old_class = $item[13];
                 $student->new_class = $item[14];
                 $student->language = $item[15];
                 $student->fee_type = $item[16];
                 $student->inschool_address = $item[17];
                 $student->telephone = $item[18];
                 $student->email = $item[19];
                 $student->tutor = $item[20];
                 $student->inschool_note1 = $item[21];
                 $student->inschool_note2 = $item[22];
                 $student->stu_type = '未报到';
                 $student->save();
                 $arr['success']++;
                 $arr['new']++;
             } else {
                 $arr['success']++;
                 $arr['keep']++;
             }
         }
     }
     return $arr;
 }
 public function show($id)
 {
     return view('student.detail', ['student' => Student::find($id)]);
 }
 public function report_sheet($student_id, $class_id)
 {
     $data['title'] = 'Report Sheet';
     $data['results_menu'] = 1;
     $data['school'] = School::find(1)->first();
     $data['offered_subjects'] = \App\Helpers\Helper::get_offered_subjects($class_id, $student_id);
     $data['class'] = studentClass::find($class_id);
     $data['student'] = Student::find($student_id);
     $data['students'] = Student::where(['class_id' => $class_id])->get();
     $data['admission_number'] = str_pad(str_replace('-', '/', \Session::get('current_session')) . '/' . $student_id, 4, '0', STR_PAD_LEFT);
     $positions_table = 'class_positions_' . \Session::get('current_session') . '_' . \Session::get('current_term');
     $data['student_position'] = \DB::table($positions_table)->where(['class_id' => $class_id, 'student_id' => $student_id])->first();
     return view('academics.results.report_sheet', $data);
 }
 public function showStudent($id)
 {
     $student = Student::find($id);
     return view('student.single', compact('student'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $student = Student::find(Crypt::decrypt($id));
     if (count($student) == 0) {
         return response()->json(['success' => false, 'message' => 'Invalid id!']);
     }
     if (!$student->delete()) {
         return response()->json(['success' => false, 'message' => 'Failed to delete record!']);
     }
     $students = Student::orderBy('name')->get();
     return response()->json(['success' => true, 'message' => 'Delete record successful!', 'content' => view('partials.student-table', compact('students'))->render()]);
 }
 public function getRegistrations($id)
 {
     $registrations = Student::find($id)->registrations;
     return $registrations->toJson();
 }
	                    			<td style="text-align:center">Invoice Amt</td>
	                    			<td style="text-align:center">Discount</td>
	                    			<td style="text-align:center">Balance</td>
	                    			<td style="text-align:center">Total</td>
	                    			<td style="text-align:center">Status</td>
	                    			<td style="text-align:center">Actions</td>
	                    		</tr>
	                    	</tfoot>
	                    	<tbody>
	                    	<?php 
    $count = 1;
    ?>
	                    	@foreach($invoices as $invoice)
	                    		<tr>
	                    			<?php 
    $student = \App\Student::find($invoice->student_id);
    $status = \App\Status::find($invoice->status_id);
    ?>
	                    			<td style="text-align:center">{!! $count !!}</td>
	                    			<td><a href="{!! route('admin.students.show', array($student->id)) !!}">{!! $student->lname.' '.substr($student->mname,0 ,1).'. '.$student->fname !!}</a></td>
	                    			<td style="text-align:right">{!! number_format($invoice->amount , 2) !!}</td>
	                    			<td style="text-align:right">{!! number_format($invoice->discount , 2) !!}</td>
	                    			<td style="text-align:right">{!! number_format($invoice->balance , 2) !!}</td>
	                    			<td style="text-align:right">{!! number_format($invoice->total , 2) !!}</td>
		                            <td style="text-align:center">
		                              <div class="label {{ $invoice->status_id == 4? 'label-default': '' }}{{ $invoice->status_id == 8? 'label-success disabled': '' }}">
		                                {!! $status->status !!}
		                              </div>
		                            </td>
	                    			<td style="text-align:center">
					                  	<a href="{!! route('billing.invoices.student_invoice', array($invoice->student_id, $invoice->fee_schedule_code)) !!}" data-target="#customWidthModal" data-toggle="modal"  class="btn btn-sm btn-secondary">Invoice</a>
Beispiel #27
0
 public function change_photo(Requests\ChangePhotoRequest $request, $id)
 {
     $file = $request->avatar_file;
     $student = Student::find($id);
     if ($file->isValid()) {
         $destinationPath = 'public/photos/students';
         // upload path
         $extension = $request->avatar_file->getClientOriginalExtension();
         $fileName = $student->firstname . "" . $student->firstname . $extension;
         // renameing image
         $request->avatar_file->move($destinationPath, $fileName);
         // sending back with message
         $student->photo = $fileName;
         $student->save();
         return redirect('show_learner', $id);
     }
 }
 public function getDeleteinfo(Request $request)
 {
     if ($request->has("id")) {
         $stu = Student::find(Input::get("id"));
         if ($stu) {
             $operand = $stu->name . "(" . $stu->id . ")";
             $before_json = $stu->toJson();
             $stu->delete();
             $after_json = "";
             StudentManageLog::insertLog("删除信息", $operand, $before_json, $after_json, $request->ip());
             $response = array('status' => ['error' => 0, 'note' => '删除成功'], 'influence' => 1);
             return json_encode($response);
         } else {
             //未找到stu_id
             $response = array('status' => ['error' => 1, 'note' => '未找到id'], 'influence' => 0);
             return json_encode($response);
         }
     } else {
         //没有stu_id参数
         $response = array('status' => ['error' => -1, 'note' => '需要id'], 'influence' => 0);
         return json_encode($response);
     }
 }
 /**
  * Get information of a student
  *
  * @param $rollNo
  * @return mixed
  */
 public function getStudentInfo($rollNo)
 {
     if (!$this->isRegistrationActive('staff')) {
         return view($this->inactiveView);
     }
     // Get the student
     $student = Student::find($rollNo);
     $student->department->dName;
     $student->currentStudentState->semNo;
     return $student;
 }
Beispiel #30
0
 public function asyncGuess(AjaxGuessRequest $request)
 {
     if (GameController::isGameEnded()) {
         return response()->json(['result' => 'error', 'reason' => 'Game ended.']);
     }
     $guess = $request->input('guess');
     $studentId = $request->getStudentIdFromSession();
     $currentGame = $request->getGameFromSession();
     $guessResult = $currentGame->guess($guess);
     $roundCount = $currentGame->getRoundCount();
     $guessCount = $currentGame->getRoundGuessCount();
     $correctness = $currentGame->getCorrectness();
     $roundPoints = 0;
     $totalPoints = $currentGame->getTotalPoints();
     if ($correctness || $roundCount < 5 && $guessCount == 10) {
         $currentGame->completeCurrentRound();
         $roundPoints = $currentGame->getRoundPoints();
         $totalPoints = $currentGame->getTotalPoints();
         $currentGame->newRound();
         // update points record and find out ranking info.
         // Retrieve the student entity from database.
         $student = Student::find($studentId);
         if (!$student) {
             return response()->json(['result' => 'error', 'reason' => 'student data do not exist.']);
         }
         if ($student['highestMark'] < $totalPoints) {
             // update
             if (!in_array($studentId, ['a1203212', 'a1165070'])) {
                 $student['highestMark'] = $totalPoints;
                 $student['recordDate'] = Carbon::now();
                 $student->save();
             }
         }
     }
     $jsonResponse = ['result' => 'guessResult', 'roundData' => ['roundCount' => $roundCount, 'resultText' => $guessResult, 'guessCount' => $guessCount, 'roundPoints' => $roundPoints, 'totalPoints' => $totalPoints, 'correctness' => $correctness]];
     if (GameController::isDebug()) {
         $jsonResponse['roundData']['secret'] = $currentGame->getRoundSecret();
     }
     return response()->json($jsonResponse);
 }