예제 #1
0
 function updatePosition()
 {
     $positionList = $this->input->post('positionList');
     $idList = $this->input->post('idList');
     $levels = new Level();
     for ($i = 0; $i < count($idList); $i++) {
         $levels->where("id", $idList[$i]);
         $levels->get();
         $levels->position = $positionList[$i];
         $levels->save();
         $levels->clear();
     }
     redirect("admin/levels/listAll/");
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check()) {
         $level = Level::find($id);
         $previous = Level::where('next_level', '=', $level->id)->first();
         $previous->next_level = $level->next_level;
         $previous->save();
         $calls = Call::where('level_id', '=', $id)->get();
         foreach ($calls as $call) {
             $call->delete();
         }
         $level = Level::find($id);
         $level->delete();
         return $this->index();
     }
     return 'you are not authorized to do this';
 }
예제 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // $validator = new Validator::make(Input::all(), ObjectsData::$rules);
     // if( $validator->fails())
     // {
     // 	return Redirect::back()->withInput()->withErrors($validator);
     // } else {
     // $oldData = ObjectsData::were('level_id', 1)->get();
     // dd($oldData);
     $prev = Level::where('next_level', '=', NULL)->first();
     $lvl = new Level();
     $lvl->game_id = 1;
     $lvl->level_name = Input::get('level_name');
     $lvl->next_level = null;
     $lvl->save();
     $prev->next_level = $lvl->id;
     $prev->save();
     // $oldData = Call::where('level_id', $lvl->id)->get();
     // foreach($oldData as $old)
     // {
     // 	$old->destroy($old->id);
     // }
     $lines = explode('*', Input::get('csvString'));
     foreach ($lines as $line) {
         $data = explode(',', $line);
         $submit = new Call();
         $submit->level_id = $lvl->id;
         $submit->function = $data[0];
         $submit->x = $data[1];
         $submit->y = $data[2];
         $submit->width = $data[3];
         $submit->height = $data[4];
         $submit->color = $data[5];
         $submit->save();
     }
     if ($submit) {
         return Redirect::action('GamesController@show', $lvl->id);
     } else {
         return Redirect::action('GamesController@create')->withInput();
     }
     // }
 }
예제 #4
0
 public function search_levels()
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         $data["actions"] = Session::get('actions');
         if (in_array('side_listar_niveles', $data["actions"])) {
             $data["search"] = Input::get('search');
             $search_criteria = $data["search"];
             $data["levels_data"] = Level::where('name', 'LIKE', "%{$search_criteria}%")->paginate(10);
             return View::make('levels/list_levels', $data);
         } else {
             // Llamo a la función para registrar el log de auditoria
             $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
             Helpers::registerLog(10, $log_description);
             Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
             return Redirect::to('/dashboard');
         }
     } else {
         return View::make('error/error');
     }
 }
예제 #5
0
<?php

require __DIR__ . '/../vendor/autoload.php';
require '../config.php';
require_once '../helpers/session.php';
require '../helpers/boot.php';
require '../helpers/functions.php';
require_once '../helpers/User.php';
require_once '../helpers/Article.php';
require_once '../helpers/Level.php';
$session = new Session();
$user = NULL;
if ($session->getLoggedin()) {
    $user = User::find($session->getUsername());
    $level = Level::where('user_id', $user->id)->first();
    $articles = Article::where('level', $level->level)->get();
} else {
    $articles = Article::all();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <title>Autism</title>
  <link href="../static/css/awe.css" rel="stylesheet">
  <link href="../static/css/player.css" rel="stylesheet">
  <script type="text/javascript" src="../static/js/jquery-1.11.3.min.js"></script>
 public function supply_lists()
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         $data["actions"] = Session::get('actions');
         if (in_array('side_subir_lista_utiles', $data["actions"])) {
             // si es un tutor, solo puede subir la lista de utiles de su nivel
             $data["is_tutor"] = $data["user"]->profiles()->where('name', '=', 'Tutor')->first() ? true : false;
             if ($data["is_tutor"]) {
                 $data["levels_data"] = Level::where('id', '=', $data["user"]->teacher->level->id)->get();
             } else {
                 $data["levels_data"] = Level::all();
             }
             return View::make('enrollments/supply_lists', $data);
         } else {
             // Llamo a la función para registrar el log de auditoria
             $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
             Helpers::registerLog(10, $log_description);
             Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
             return Redirect::to('/dashboard');
         }
     } else {
         return View::make('error/error');
     }
 }