public function login()
 {
     $data = Input::all();
     $log = Auth::attempt(array('email' => $data['email'], 'password' => $data['password']));
     if ($log) {
         $search = $data['password'];
         $data = Result::where('regno', $search)->get();
         $count = Count($data);
         return View::make('StudentReport')->with('results', $data);
     } else {
         return Redirect::Route('home')->with('fail', 'Bad combination of username and password');
     }
 }
 public function recycleBin($task)
 {
     //put the task into the recycle bin
     if (Auth::check()) {
         $id = $task;
         Task::destroy($id);
         if (Auth::user()->admin == 'true') {
             $deletedTasks = Task::onlyTrashed()->paginate(5);
             return Redirect::Route('tasks.index', ['deletedTasks' => $deletedTasks]);
         }
     }
     return Redirect::route('tasks.index');
 }
Example #3
0
 /**
  * Show the form for creating a new resource.
  * GET /nurse/create
  */
 public function visitSummaryEntry()
 {
     $destinationPath = public_path('retinal_image/');
     $link_address = "/view/patients_managment/visitSummary";
     $patient_id = null;
     $rules = ['patient_id' => 'required', 'patient_name' => 'required', 'height' => 'required', 'weight' => 'required', 'bp' => 'required'];
     $data = Input::all();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     } else {
         if (!Input::hasFile('retinal_image')) {
             return Redirect::back()->withErrors("Image is required");
         } else {
             $photo_fileName = null;
             if (Input::hasFile('retinal_image')) {
                 $photo = Input::file('retinal_image');
                 $photo_fileName = strtotime(date('Y-m-d H:i:s')) . md5($photo->getClientOriginalName()) . "." . $photo->getClientOriginalExtension();
                 $photo->move($destinationPath, $photo_fileName);
             }
             $visitSummary = new Visitsummary();
             $visitSummary->patient_id = $data['patient_id'];
             $visitSummary->patient_name = $data['patient_name'];
             $visitSummary->height = $data['height'];
             $visitSummary->weight = $data['weight'];
             $visitSummary->bp = $data['bp'];
             $visitSummary->retinal_image = $photo_fileName;
             if ($visitSummary->save()) {
                 $patient_id = $visitSummary->id;
                 return Redirect::Route('nurse_dashboard')->with('success', 'Successfully Updated');
             } else {
                 return Redirect::back()->withErrors("Something Went Wrong. Try Again.");
             }
         }
     }
 }
 public function getFMWalkin()
 {
     if (Auth::User()->isAdmin()) {
         return View::make('reservation.fm_walkin');
     } else {
         return Redirect::Route('home');
     }
 }
Example #5
0
 public function signup()
 {
     $name = Input::get('name');
     $pwd = Input::get('password');
     $pwd_verify = Input::get('password_verify');
     $ldap = Input::get('ldap');
     $ldap = explode('@', $ldap)[0];
     $ldap = $ldap . "@iitb.ac.in";
     $email = Input::get('email');
     // $captcha=Input::get('g-recaptcha-response');
     $messageBag = new MessageBag();
     $bag_empty = true;
     // echo $captcha;
     // // To incorporate captcha
     // $url = 'https://www.google.com/recaptcha/api/siteverify';
     // $data = array('secret' => '6LeQbA0TAAAAAGj7pDd26ghKX_LyotrYw8ABD48o', 'response' => $captcha);
     // // use key 'http' even if you send the request to https://...
     // $options = array(
     //   		'http' => array(
     //         'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
     //         'method'  => 'POST',
     //         'content' => http_build_query($data),
     //     ),
     // );
     // $context  = stream_context_create($options);
     // $result = file_get_contents($url, false, $context);
     //    	echo $result;
     //    	return;
     //    	$result = json_decode($result);
     // if($result->success=='false'){
     // 	$messageBag->add('message',"Wrong Captcha");
     // 	$bag_empty = false;
     // }
     if ($name == "") {
         $messageBag->add('message', "Please enter Name");
         $bag_empty = false;
     }
     if ($pwd == "") {
         $messageBag->add('message', "Please enter Password");
         $bag_empty = false;
     }
     if ($ldap == "") {
         $messageBag->add('message', "Please enter LDAP ID");
         $bag_empty = false;
     }
     if ($email == "") {
         $messageBag->add('message', "Please enter Email");
         $bag_empty = false;
     }
     // if (strlen($_POST["password"]) < '8' || strlen($_POST["password"]) > '20') {
     // 	$messageBag->add('message',"Password Must Contain At Least 8 and At Most 20 Characters" );
     // 	$bag_empty = false;
     //    }
     if (!preg_match("/^[a-zA-Z ]*\$/", $name)) {
         $messageBag->add('message', "Only letters and white space allowed in Name");
         $bag_empty = false;
     }
     if (!filter_var($ldap, FILTER_VALIDATE_EMAIL)) {
         $messageBag->add('message', "Please enter valid LDAP ID");
         $bag_empty = false;
     }
     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         $messageBag->add('message', "Please enter valid Email");
         $bag_empty = false;
     }
     if ($pwd != $pwd_verify) {
         $messageBag->add('message', "Passwords do not Match");
         $bag_empty = false;
     }
     if (!$bag_empty) {
         return Redirect::back()->with('messages', $messageBag);
     }
     $users = User::where('ldap_email', '=', $ldap)->get();
     if (sizeof($users) == 0) {
         $user = new User();
         $user->other_email = $email;
         $user->name = $name;
         $user->password = sha1($pwd);
         $user->ldap_email = $ldap;
         $user->save();
         Auth::login($user);
         return Redirect::Route('user.profile');
         $gpo_id = $ldap;
         $gpo_id = explode('@', $gpo_id)[0];
         $user = Auth::User();
         //var_dump($user);
         $key = 'Prateek';
         $string = $user->id;
         $user->ldap_email = $gpo_id . "@iitb.ac.in";
         User::where('id', '=', $string)->update(array('ldap_email' => $gpo_id . '@iitb.ac.in'));
         $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
         $decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "");
         //var_dump($encrypted);
         //var_dump($decrypted);
         //echo $gpo_id;
         try {
             Mail::send('email.verifygpo', ['key' => URL::Route('user.profile') . '?key=' . urlencode($encrypted), 'name' => $user->Name], function ($message) use($user) {
                 $message->to($user->ldap_email, $user->Name)->subject('Verify Stab Id');
             });
             $messageBag_new = new MessageBag();
             $messageBag_new->add('message', "We have sent you an email regarding account activation on your gpo id " . $user->ldap_email . " .Click on the link to verify.");
             if (Auth::check()) {
                 Auth::logout();
             }
             return Redirect::back()->with('messages', $messageBag_new)->withInput();
         } catch (Exception $e) {
             if (Auth::check()) {
                 Auth::logout();
             }
             return $e->getMessage();
         }
         // return Redirect::route('user.profile');
     } else {
         $messageBag->add('message', "A User with the same LDAP ID Already Exists");
         return Redirect::back()->with('messages', $messageBag);
     }
 }
Example #6
0
 public function tutorials_upload()
 {
     if (Auth::check()) {
         if (Auth::User()->ldap_verified == 0) {
             $messageBag = new MessageBag();
             $messageBag->add('message', "Please Verify Your GPO ID before Uploading a Tutorial");
             return Redirect::Route('user.profile')->with('messages', $messageBag)->withInput();
         } else {
             return View::make('tutorials_upload');
         }
     } else {
         $messageBag = new MessageBag();
         $messageBag->add('message', 'Please Login before Uploading a Tutorial');
         return Redirect::to('login_page')->with('messages', $messageBag)->withInput();
     }
 }
Example #7
0
Route::get('redirect-asignar-profesores', array('as' => 'redirect-asignar-profesores', function () {
    $datos = Input::all();
    $id = $datos['id'];
    $nombre = $datos['nombre'];
    $profesores = Usuario::all();
    $profesores2 = Usuario::where('nombre', 'ILIKE', '%' . $nombre . '%')->get();
    $curso = Curso::find($id);
    return Redirect::Route('crear-curso-4', array($id, $nombre));
}));
//Ruta para redireccionar los contenidos creados en el administrador
Route::get('redirect-temario-curso', array('as' => 'redirect-temario-curso', function () {
    $datos = Input::all();
    $id = $datos['id_curso'];
    $tipo_contenido = $datos['tipo_contenido'];
    $curso = Curso::find($id);
    return Redirect::Route('crear-curso-5', array($id));
}));
//Ruta para asignar profesor a un curso
Route::get('asignar-profesor/{id_curso}/{id_usuario}/{tipo}', array('as' => 'asignar-profesor', function ($id_curso, $id_usuario, $tipo) {
    DB::table('relacion_usuario_curso')->insert(array('id_usuario' => $id_usuario, 'id_curso' => $id_curso, 'tipo_relacion' => $tipo, 'fecha_creacion' => date('Y-m-d H:i:s'), 'estado' => 'activo'));
    return Redirect::route('crear-curso-3', $id_curso);
}))->where('id_curso', '[0-9]+');
//Ruta para eliminar una asignacion de profesor a un curso
Route::get('desasignar-profesor/{id_curso}/{id_usuario}/{tipo}', array('as' => 'desasignar-profesor', function ($id_curso, $id_usuario, $tipo) {
    RelacionUsuarioCurso::where('tipo_relacion', '=', $tipo)->where('id_usuario', '=', $id_usuario)->where('id_curso', '=', $id_curso)->delete();
    return Redirect::route('crear-curso-3', $id_curso);
}))->where('id_curso', '[0-9]+');
Route::resource('curso', 'CursoController');
Route::resource('usuario', 'UsuarioController');
Route::resource('evaluacion', 'EvaluacionController');
Route::resource('leccion', 'LeccionController');
 public function postCategory()
 {
     $validation = \Post::validate(\Input::all());
     $input = \Input::all();
     if ($validation->fails()) {
         if ($input['type'] == "page") {
             return \Redirect::Route("addnewpage")->withErrors($validation)->withInput();
         } elseif ($input['type'] == "post") {
             return \Redirect::Route("addnewpost")->withErrors($validation)->withInput();
         } elseif ($input['type'] == "category") {
             return \Redirect::Route("listcat")->withErrors($validation)->withInput();
         }
     } else {
         $post = new \Post();
         $post->title = $input['title'];
         $post->p_content = $input['p_content'];
         $post->permalink = $input['permalink'];
         $post->type = $input['type'];
         $post->created_by = "Admin";
         //var_dump($post);
         try {
             $post = $post->save();
             return '<div class="alert alert-success fade in">
                                     <button class="close" data-dismiss="alert">×</button>
                                     <i class="fa-fw fa fa-times">Category created"</div>';
             // $redirect = (isset($input['form_save'])) ? "backend/{$input['type']}s" : "backend/{$input['type']}s/create";
             //return \Redirect::to($redirect)
             // ->with('success_message', 'The ' . $this->type . ' was created.');
         } catch (ValidationException $e) {
             return "Unexpected Error! Category not created";
             // \Redirect::back()->withInput()->withErrors($e->getErrors());
         }
     }
 }
Example #9
0
 public function deletecik($id)
 {
     $cik = Cik::where('id', $id)->delete();
     return Redirect::Route('cikFree');
 }
 public function saveNewProfile()
 {
     $id = Auth::user()->id;
     $profile = UserProfile::firstOrNew(array('id' => $id));
     $profile->fname = Input::get('fname');
     $profile->lname = Input::get('lname');
     $profile->streetno = Input::get('streetno');
     $profile->street = Input::get('street');
     $profile->suburb = Input::get('suburb');
     $profile->postcode = Input::get('postcode');
     $profile->state = Input::get('state');
     $profile->day_dob = Input::get('day_dob');
     $profile->month_dob = Input::get('month_dob');
     $profile->year_dob = Input::get('year_dob');
     $profile->phone = Input::get('phone');
     $profile->tfn = Input::get('tfn');
     $profile->pidtype = Input::get('pidtype');
     $profile->pidnum = Input::get('pidnum');
     $profile->sidtype = Input::get('sidtype');
     $profile->sidnum = Input::get('sidnum');
     $profile->description = Input::get('description');
     $profile->gender = Input::get('gender');
     $profile->occupation = Input::get('occupation');
     $profile->currency = 'AUD';
     $profile->save();
     $user = User::where('id', '=', $id)->first();
     $user->profile_complete = 1;
     $user->save();
     return Redirect::Route('profile');
 }