Beispiel #1
0
 public function post()
 {
     $file = array('users' => Request::all());
     // setting up rules
     $rules = array('users' => 'required', 'mimes' => 'jpeg,jpg,png', 'max' => '200px');
     //mimes:jpeg,bmp,png and for max size max:10000
     // doing the validation, passing post data, rules and the messages
     $validator = Validator::make($file, $rules);
     if ($validator->fails()) {
         // send back to the page with the input data and errors
         return redirect('settings')->withInput()->withErrors($validator);
     } else {
         // checking file is valid.
         if (Input::file('user_image')->isValid()) {
             $extension = Input::file('user_image')->getClientOriginalExtension();
             // getting image extension
             $fileName = rand(11111, 99999) . '.' . $extension;
             // renaming image
             Input::file('user_image')->move('uploads/', $fileName);
             // uploading file to given path
             $file->user_image = $fileName;
             \Auth::user()->post->save();
             // sending back with message
             \Session::flash('flash_message', 'You have successfully updated your codename!');
             return redirect('settings');
         } else {
             // sending back with error message.
             \Session::flash('error', 'uploaded file is not valid');
             return redirect('home');
         }
     }
 }
Beispiel #2
0
 public function destroy($id)
 {
     $session = \App\Session::FindOrFail($id);
     $session->delete();
     \Session::flash('flash_message', 'Session has been deleted.');
     return redirect('sessions');
 }
 private function checkDates()
 {
     if (empty($_POST['txtmonto']) or !ctype_digit($_POST['txtmonto'])) {
         Session::set("msg", "Asegurese de ingresar el monto como nro entero");
         return false;
     } else {
         if (empty($_POST['txtcuotas']) or !ctype_digit($_POST['txtcuotas'])) {
             Session::set("msg", "Asegurese de ingresar la cuota como nro entero");
             return false;
         } else {
             if ($_POST['txtmonto'] < (new Compra())->findById(Session::get('id'))->obtenerPagoMinimo() * $_POST['txtcuotas']) {
                 Session::set("msg", "Monto no válido.. Ingrese nuevamente el monto");
                 return false;
             } else {
                 if ($_POST['txtcuotas'] > (new Compra())->findById(Session::get('id'))->obtenerCuotasRestantes()) {
                     Session::set("msg", "Cantidad no válida.. Ingrese nuevamente la cantidad de cuotas");
                     return false;
                 } else {
                     if ((new Compra())->findById(Session::get('id'))->obtenerCuotasRestantes() == 0) {
                         Session::set("msg", "Deuda Saldada.. no puede registrar más pagos");
                         return false;
                     } else {
                         return true;
                     }
                 }
             }
         }
     }
 }
Beispiel #4
0
 public function read($sessionId)
 {
     $session = Session::where('sid', '=', $sessionId)->first();
     if (is_null($session)) {
         return null;
     }
     $objects = \App\Object::where('session_id', '=', $sessionId)->get()->toArray();
     return new GamingSession($session->sid, $session->name, $objects, $session->scope, $session->password, $session->style);
 }
 private function checkDates()
 {
     if (empty($_POST['txtnom'])) {
         Session::set("msg", "Ingrese los datos obligatorios (*) para continuar.");
         return false;
     } else {
         return true;
     }
 }
 protected function checkUser()
 {
     if (Session::get("log_in") != null and Session::get("log_in")->getRol()->getNombre() == $this->getTypeRole()) {
         return true;
     } else {
         Session::set("msg", "Debe loguearse como " . $this->getMessageRole() . " para acceder.");
         header("Location:index.php?c=main&a=index");
     }
 }
Beispiel #7
0
 /**
  * Verificar se usuário logado tem permissão para a página
  * @return true ou false
  * @param $pagina
  */
 public static function PodeAcessarPagina($pagina)
 {
     if (Gate::denies('verifica_permissao', [$pagina, 'acessar'])) {
         \Session::flash('flash_message_erro', 'Sem permissão de acesso a página. Favor contactar o admin.');
         return false;
     } else {
         return true;
     }
 }
Beispiel #8
0
 public static function saveOrder()
 {
     $cartCollection = \Cart::getContent();
     $order = new self();
     $order->user_id = \Session::get('user_id');
     $order->data = $cartCollection->toJson();
     $order->save();
     \Cart::clear();
     \Session::flash('sm', 'Your order has been saved !');
 }
Beispiel #9
0
 public static function add($object, $action, $change = [], $level = self::LEVEL_INFO)
 {
     $clog = new self();
     $clog->action = $action;
     $clog->change = $change;
     $clog->time = \Carbon\Carbon::now();
     $clog->user()->associate(\Session::get('user'));
     $clog->object()->associate($object);
     $clog->level = $level;
     $clog->save();
 }
 /**
  * Run the database seeds. 
  * As a result of this database seeder script, 4 sessions will be created for the 
  * 'CM1103 Python Programming Lab' support activity, for which a single 
  * Demonstrator' role is assumed to be required
  *
  * @return void
  */
 public function run()
 {
     //truncate the activities table so that the auto incrementing 'id' field starts counting from 1 again
     DB::table('sessions')->truncate();
     $activtiesCSVFile = new CsvFile(__DIR__ . '/_data/SessionsData.csv');
     foreach ($activtiesCSVFile as $currentRow) {
         //maybe make it w0rth with get(); s0meh0w
         $supportActivity = Activity::where('title', '=', $currentRow[0])->first();
         $Session = Session::create(['activity_id' => $supportActivity->id, 'date_of_session' => trim($currentRow[1]), 'start_time' => trim($currentRow[2]), 'end_time' => trim($currentRow[3]), 'location' => trim($currentRow[4])]);
     }
 }
Beispiel #11
0
 public function update($object)
 {
     $aux = $this->findById($object->getId());
     if (!$object->equals($aux)) {
         if ($this->check($object)) {
             Session::set('msg', $this->getCheckMessage());
             return null;
         }
     }
     return $this->executeQuery($this->getUpdateQuery(), $this->getUpdateParameter($object));
 }
Beispiel #12
0
 public function updateSession(Request $request, $id)
 {
     $Session = Session::find($id);
     $Session->sessionStartTime = $request->input('sessionStartTime');
     $Session->sessionEndTime = $request->input('sessionEndTime');
     $Session->loginID = $request->input('loginID');
     $Session->sessionQuality = $request->input('sessionQuality');
     $Session->sessionTypeID = $request->input('sessionTypeID');
     $Session->sessionDeleted = 0;
     $Session->save();
     return response()->json($Session);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     Model::reguard();
     $userTest = User::create(['name' => 'userTest', 'email' => '*****@*****.**', 'password' => bcrypt('userTest'), 'height_inches' => 70]);
     $workout1 = Workout::create(['user_id' => $userTest->id, 'title' => 'Push', 'note' => 'This is a note']);
     $workout2 = Workout::create(['user_id' => $userTest->id, 'title' => 'Pull', 'note' => 'This is a note']);
     $workout3 = Workout::create(['user_id' => $userTest->id, 'title' => 'Legs', 'note' => 'This is a note']);
     $exercise1 = Exercise::create(['user_id' => $userTest->id, 'title' => 'Barbell Bench Press', 'max_one_rep_max' => 190, 'type' => 'Weighted', 'category' => 'Chest']);
     $exercise2 = Exercise::create(['user_id' => $userTest->id, 'title' => 'Overhead Press', 'max_one_rep_max' => 100, 'type' => 'Weighted', 'category' => 'Shoulders']);
     $exercise3 = Exercise::create(['user_id' => $userTest->id, 'title' => 'One Arm Row', 'max_one_rep_max' => 75, 'type' => 'Weighted', 'category' => 'Back']);
     $exercise4 = Exercise::create(['user_id' => $userTest->id, 'title' => 'Pulldown', 'max_one_rep_max' => 200, 'type' => 'Weighted', 'category' => 'Back']);
     $exercise5 = Exercise::create(['user_id' => $userTest->id, 'title' => 'Squats', 'max_one_rep_max' => 225, 'type' => 'Weighted', 'category' => 'Legs']);
     $exercise6 = Exercise::create(['user_id' => $userTest->id, 'title' => 'Deadlifts', 'max_one_rep_max' => 200, 'type' => 'Weighted', 'category' => 'Legs']);
     $session1 = Session::create(['user_id' => $userTest->id, 'exercise_id' => $exercise1->id, 'session_date' => Carbon::now()]);
     $session2 = Session::create(['user_id' => $userTest->id, 'exercise_id' => $exercise2->id, 'session_date' => Carbon::now()]);
     $session3 = Session::create(['user_id' => $userTest->id, 'exercise_id' => $exercise3->id, 'session_date' => Carbon::now()]);
     $session4 = Session::create(['user_id' => $userTest->id, 'exercise_id' => $exercise4->id, 'session_date' => Carbon::now()]);
     $session5 = Session::create(['user_id' => $userTest->id, 'exercise_id' => $exercise5->id, 'session_date' => Carbon::now()]);
     $session6 = Session::create(['user_id' => $userTest->id, 'exercise_id' => $exercise6->id, 'session_date' => Carbon::now()]);
     $sessionSet1 = SessionSet::create(['session_id' => $session1->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet2 = SessionSet::create(['session_id' => $session1->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet3 = SessionSet::create(['session_id' => $session1->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet4 = SessionSet::create(['session_id' => $session2->id, 'number_of_reps' => 8, 'weight_lifted' => 95, 'one_rep_max' => 100, 'failed' => false]);
     $sessionSet5 = SessionSet::create(['session_id' => $session2->id, 'number_of_reps' => 8, 'weight_lifted' => 95, 'one_rep_max' => 100, 'failed' => false]);
     $sessionSet6 = SessionSet::create(['session_id' => $session2->id, 'number_of_reps' => 8, 'weight_lifted' => 95, 'one_rep_max' => 100, 'failed' => false]);
     $sessionSet7 = SessionSet::create(['session_id' => $session3->id, 'number_of_reps' => 8, 'weight_lifted' => 65, 'one_rep_max' => 80, 'failed' => false]);
     $sessionSet8 = SessionSet::create(['session_id' => $session3->id, 'number_of_reps' => 8, 'weight_lifted' => 65, 'one_rep_max' => 80, 'failed' => false]);
     $sessionSet9 = SessionSet::create(['session_id' => $session3->id, 'number_of_reps' => 8, 'weight_lifted' => 65, 'one_rep_max' => 80, 'failed' => false]);
     $sessionSet10 = SessionSet::create(['session_id' => $session4->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet11 = SessionSet::create(['session_id' => $session4->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet12 = SessionSet::create(['session_id' => $session4->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet13 = SessionSet::create(['session_id' => $session5->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet14 = SessionSet::create(['session_id' => $session5->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet15 = SessionSet::create(['session_id' => $session5->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet16 = SessionSet::create(['session_id' => $session6->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet17 = SessionSet::create(['session_id' => $session6->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $sessionSet18 = SessionSet::create(['session_id' => $session6->id, 'number_of_reps' => 8, 'weight_lifted' => 180, 'one_rep_max' => 190, 'failed' => false]);
     $plan1 = Plan::create(['user_id' => $userTest->id, 'title' => '5/3/1', 'start_date' => Carbon::now(), 'end_date' => Carbon::now()->addWeeks(4)]);
     $planWorkout1 = PlanWorkout::create(['plan_id' => $plan1->id, 'workout_id' => $workout1->id]);
     $planWorkout2 = PlanWorkout::create(['plan_id' => $plan1->id, 'workout_id' => $workout2->id]);
     $planWorkout3 = PlanWorkout::create(['plan_id' => $plan1->id, 'workout_id' => $workout3->id]);
     $planDate1 = PlanDate::create(['plan_workout_id' => $planWorkout1->id, 'planned_date' => Carbon::tomorrow()]);
     $planDate2 = PlanDate::create(['plan_workout_id' => $planWorkout1->id, 'planned_date' => Carbon::tomorrow()->addDays(5)]);
     $planDate3 = PlanDate::create(['plan_workout_id' => $planWorkout2->id, 'planned_date' => Carbon::tomorrow()->addDay()]);
     $planDate4 = PlanDate::create(['plan_workout_id' => $planWorkout2->id, 'planned_date' => Carbon::tomorrow()->addDays(6)]);
     $planExercise1 = PlanExercise::create(['plan_workout_id' => $planWorkout1->id, 'exercise_id' => $exercise1->id, 'weight_to_add_for_success' => 5, 'weight_to_sub_for_fail' => 5]);
     $planExercise2 = PlanExercise::create(['plan_workout_id' => $planWorkout1->id, 'exercise_id' => $exercise2->id, 'weight_to_add_for_success' => 5, 'weight_to_sub_for_fail' => 5]);
     $planSet1 = PlanSet::create(['plan_exercise_id' => $planExercise1->id, 'expected_reps' => 10, 'expected_weight' => 100]);
     $planSet2 = PlanSet::create(['plan_exercise_id' => $planExercise1->id, 'expected_reps' => 10, 'expected_weight' => 100]);
 }
 /**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     //        dd($hasCode);
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider));
     if (!$user) {
         Session::flash('message', "Something went wrong!");
         Session::flash('alert-class', 'error');
     }
     $this->auth->login($user, true);
     //        event(new \App\Events\UserEvent($user->full_name));
     return $listener->userHasBeenRegistered($user);
 }
 /** Удаление данные сессии **/
 public static function deleteSessionData(Request $request)
 {
     $error = 0;
     if ($request->ajax()) {
         $data = $request->all();
         $files = FileTable::getAllFilesForSession($data['session_id']);
         foreach ($files as $file) {
             File::delete(public_path() . $file->file_path);
         }
         FileTable::deleteAllFilesForSession($data['session_id']);
         Session::deleteSession($data['session_id']);
     } else {
         abort(403);
     }
     return response()->json(['error' => $error]);
 }
 /**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider), $this->ip);
     if (!$user) {
         Session::flash('message', "Something went wrong!");
         Session::flash('alert-class', 'error');
     } else {
         if ($user == 'user exist') {
             return redirect()->route('home');
         }
     }
     return $listener->userHasBeenRegistered($user);
 }
Beispiel #17
0
 public static function addCategorie($request)
 {
     $file_name = '';
     if (Input::hasFile('file') && Input::file('file')->isValid()) {
         $file = Input::file('file');
         $file_name = str_random(23) . '.' . $file->getClientOriginalExtension();
         $file->move(public_path('assets\\img'), $file_name);
     }
     $categorie = new self();
     $categorie->title = $request['title'];
     $categorie->article = $request['article'];
     $categorie->url = General::make_url($request['title']);
     $categorie->image = !empty($file_name) ? $file_name : 'default.jpg';
     $categorie->save();
     \Session::flash('sm', 'Saved !');
 }
 protected function checkUser($email, $password)
 {
     $customer = Customer::where('email', '=', $email)->get();
     if (count($customer) == 0) {
         return false;
     } else {
         foreach ($customer as $key => $value) {
             if (\Hash::check($password, $value['password'])) {
                 \Session::put('name', $value['name']);
                 \Session::put('email', $value['email']);
                 \Session::put('role', $value['role']);
                 return true;
             } else {
                 return false;
             }
         }
     }
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('partials.latestArticles', function ($view) {
         $latestArticles = Article::published()->active()->latest()->take(10)->get();
         $view->with(['latestArticles' => $latestArticles]);
     });
     view()->composer('partials.latestCourses', function ($view) {
         $latestCourses = Course::latest()->take(10)->get();
         $view->with(['latestCourses' => $latestCourses]);
     });
     view()->composer('partials.latestSessions', function ($view) {
         $latestSessions = Session::latest()->take(10)->get();
         $view->with(['latestSessions' => $latestSessions]);
     });
     view()->composer('partials.categories', function ($view) {
         $totalCategories = DB::table('categories')->where('depth', '=', 1)->leftJoin('category_course', 'categories.id', '=', 'category_course.category_id')->leftJoin('article_category', 'categories.id', '=', 'article_category.category_id')->groupBy('categories.id')->select('categories.name', 'categories.id', DB::raw('COUNT(`course_id`) + COUNT(`article_id`) AS num'))->orderBy('num', 'DESC')->get();
         $view->with(['totalCategories' => $totalCategories]);
     });
 }
 public function getGoogleAuth(Request $request)
 {
     $client = new Google_Client();
     $client->setScopes(SCOPES);
     $client->setAuthConfigFile(CLIENT_SECRET_PATH);
     $client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/google_calendar_callback');
     $authCode = $request->input('code');
     $accessToken = $client->authenticate($authCode);
     $client->setAccessToken($accessToken);
     $request->session()->put('access_token', $client->getAccessToken());
     $authObj = json_decode($accessToken);
     if (isset($authObj->refresh_token)) {
         $session = Session::firstOrNew($request->session()->getId());
         $session->refresh_token = $authObj->refresh_token;
         $session->save();
     }
     // Refresh the token if it's expired.
     if ($client->isAccessTokenExpired()) {
         $client->refreshToken(Session::find($request->session()->getId()));
     }
     return redirect()->route('calendar_back', [$request->session()->get('dialog'), $request->session()->get('seance')], 302);
 }
Beispiel #21
0
 /**
  * Created By Dara on 8/2/2016
  * add reply to comment
  */
 public function session(Session $session, $comment_id, Request $request)
 {
     $user = $this->user;
     $this->validate($request, ['content' => 'required']);
     if ($comment_id) {
         //check if the comment has been set or not (reply) level 2 comment
         $comment = Comment::findOrFail($comment_id);
         $parent_id = $comment->id;
         $msg = trans('users.answerSent');
         $nested = true;
     } else {
         //level 1 comment
         $parent_id = 0;
         $msg = trans('users.commentSent');
         $nested = false;
     }
     //add comment to db
     $newComment = $session->comments()->create(['user_id' => $user->id, 'content' => $request->input('content'), 'parent_id' => $parent_id]);
     $numComment = $session->comments()->count();
     $session->update(['num_comment' => $numComment]);
     $obj = $session;
     $model = 'session';
     return ['hasCallback' => 1, 'callback' => 'session_comment', 'hasMsg' => 1, 'msgType' => '', 'msg' => $msg, 'returns' => ['newComment' => view('comment.comment', compact('newComment', 'session', 'user', 'obj', 'model'))->render(), 'nested' => $nested, 'numComment' => $numComment]];
 }
Beispiel #22
0
                                    <li><a href="index.php?c=usuarios&a=logout">Cerrar Sesión</a></li>                                   
                                <?php 
} else {
    ?>
                                    <li><a href="index.php?c=usuarios&a=login">Iniciar Sesión</a></li>
                                    <li><a href="index.php?c=usuarios&a=add">Registrarse</a></li>                                    
                            <?php 
}
?>
    
                        </ul>
                    </nav>                    
                </header>
                <section>
                    <?php 
if (\App\Session::get('msg') != null) {
    echo \App\Session::get('msg') . "<br /><br />";
    \App\Session::set('msg', "");
}
echo $content;
?>
                </section>
                <footer>
                    Copyright &copy; <?php 
echo date("Y");
?>
 -- Reservados todos los derechos
                </footer>
            </div>
    </body>
</html>
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(MonthlyReportRequest $request, $id)
 {
     //Find report
     $report = MonthlyReport::find($id);
     //Getting all the information of the form, expect the user id,
     //due to keep the report related with its creator
     $report->fill($request->except('user_id'));
     $report->save();
     //If the student is absent, it is not necessary create the sessions
     if ($report->student_present == true) {
         //##Updating the old sessions
         $sessionsIds = array();
         foreach ($request->input('old', array()) as $id => $sessionData) {
             $session = Session::find($id) ?: new Session();
             $session->fill($sessionData);
             $session->save();
             $sessionsIds[] = $session->id;
         }
         //##Delete the unused sessions
         //Getting all sessions ids
         $sessionsToRemove = array();
         foreach ($report->sessions()->get() as $session) {
             $sessionsToRemove[] = $session->id;
         }
         //The ids that are different from sessionsIds, must be deleted
         $sessionsToRemove = array_diff($sessionsToRemove, $sessionsIds);
         foreach ($sessionsToRemove as $id) {
             Session::find($id)->delete();
         }
         //##Inserting new sessions
         //Creating the new sessions
         $sessionsIds = array();
         foreach ($request->input('new', array()) as $id => $sessionData) {
             $session = new Session();
             $session->fill($sessionData);
             $session->monthly_report_id = $report->id;
             $session->save();
         }
     } else {
         //If the student is absent, delete all recorded sessions
         foreach ($report->sessions()->get() as $session) {
             $session->delete();
         }
     }
     //Sending the user to the monthly report
     return redirect()->route('monthlyreport/index');
 }
Beispiel #24
0
 /**
  * @param $var
  */
 protected function setCartSession($var)
 {
     \Session::put("sales_cart", $var);
 }
Beispiel #25
0
 /**
  * Permet la création d'une balise <a>.
  * Dans le cas de l'utilisation de Auth/Session, un token de sécurité est automatiquement
  * ajouté si l'utilisateur est connecté.
  * 
  * $title = 'mon_lien_interne';
  * $path = array(
  *      'controller' => 'mon_controleur',
  *      'method' => 'ma_methode',
  *      array('id' => 1, 'nom' => 'jean')
  * );
  * $params = array(
  *      'class' => 'ma_classe_de_style_css'
  * );
  * Donne : 
  * <a href="/mon_controleur/ma_methode/?id=1&nom=jean" title="mon_lien_interne" class="ma_classe_de_style_css">mon_lien_interne</a>
  * 
  * @param string $title
  * @param array $path
  * @param array $param = null
  * @return string
  */
 public static function link($title, $path, $params = null)
 {
     // Variables
     $vars = "";
     $html = '';
     // Si l'utilisateur s'est connecté avec Auth et que Session est utilisé
     if (Auth::userIsLogged()) {
         // $path - Variables GET
         if (isset($path[0])) {
             $vars .= "?";
             // On parcours...
             foreach ($path[0] as $key => $value) {
                 $vars .= "{$key}={$value}&";
             }
             // Ajout du token de sécurité
             $vars .= 'token=' . Session::getUserToken();
             $vars = rtrim($vars, '&');
         }
         // $params - Options HTML
         if (isset($params)) {
             foreach ($params as $key => $value) {
                 $html .= "{$key}=\"{$value}\" ";
             }
         }
     } else {
         // $path - Variables GET
         if (isset($path[0])) {
             $vars .= "?";
             // On parcours...
             foreach ($path[0] as $key => $value) {
                 $vars .= "{$key}={$value}&";
             }
             $vars = rtrim($vars, '&');
         }
         // $params - Options HTML
         if (isset($params)) {
             foreach ($params as $key => $value) {
                 $html .= "{$key}=\"{$value}\" ";
             }
         }
     }
     return '<a href="' . WWW_ROOTURL . $path['controller'] . US . $path['method'] . US . $vars . '" title="' . $title . '" ' . $html . '>' . $title . '</a>';
 }
Beispiel #26
0
<h3>Editar Modelo</h3>
<form method="post" action="index.php?c=modelos&a=edit&p=<?php 
echo \App\Session::get('id');
?>
" name="frmedit_mod">
    <table>
        <tr>
            <td><label for="id">Número del Rol:</label></td>
            <td><input type="hidden" name="hid" value="<?php 
echo $modelo->getId();
?>
" /><?php 
echo $modelo->getId();
?>
</td>
        </tr>
        <tr>
            <td><label for="nom">Nombre del Modelo:</label></td>
            <td><input type="text" id="nom" name="txtnom" required="required" autofocus value="<?php 
echo $modelo->getNombre();
?>
" /></td>
        </tr>
        <tr>
            <td><label for="mar">Marca del Modelo:</label></td>
            <td>                
                <input id="mar" list="marcas" required="required" name="txtmar" value="<?php 
echo $modelo->getMarca()->getId();
?>
" />
                <datalist id="marcas">
 /** Удаление файлов всей сессии **/
 public static function deleteSession($sessionId)
 {
     Session::where('id', $sessionId)->delete();
 }
Beispiel #28
0
 * @author    David BRIWA <*****@*****.**>
 * @copyright 2016 David BRIWA
 * @link      https://github.com/Davidou2a/Small-MVC
 * @license   https://opensource.org/licenses/GPL-3.0
 */
// Chargement de tous les fichiers essentiels requis par le framework.
require '../vendor/autoload.php';
require '../app/Constants.php';
require '../app/Config.php';
use App\Router, App\Session, App\Error;
/*
 * On initialise le Router avec les paramètres de l'URL passés par le .htaccess
 * On initialise les SESSIONS.
 */
Router::initialize($_GET);
Session::initialize();
/*
 * On assigne dans des variables :
 * - Le nom de classe du controlleur à instancier
 * - Le chemin de fichier PHP de la classe du controleur
 * - Le nom de la méthode à appeler
 * - Les eventuelles variables passées par URL
 */
$controllerName = Router::getControllerName();
$controllerFilePath = CONTROLLERS_DIR . Router::getControllerFilename();
$methodName = Router::getMethodName();
$args = Router::getArgs();
// On charge le controleur appellé ou celui par défaut
if (file_exists($controllerFilePath)) {
    include_once $controllerFilePath;
    $controllerInstance = new $controllerName();
Beispiel #29
0
"><?php 
    echo $cliente->getNick();
    ?>
</option>
                    <?php 
}
?>
                </datalist> &nbsp;
                <input type="button" onclick="frmadd_com.submit();" value="Buscar" />
            </td>
        </tr>
        <tr>
            <td><label for="veh">Vehículo:</label></td>
            <td>
                <input id="veh" list="vehiculos" required="required" name="txtveh" value="<?php 
echo \App\Session::get('veh');
?>
" />
                <datalist id="vehiculos">
                    <?php 
foreach ($vehiculos as $vehiculo) {
    ?>
                        <option value="<?php 
    echo $vehiculo->getId();
    ?>
"><?php 
    echo $vehiculo->getMat();
    ?>
</option> 
                    <?php 
}
Beispiel #30
0
 public function scopeCurrentMember($query)
 {
     return $query->where('session_id', \Session::getId());
 }