public function search_enrollments()
 {
     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_aprobar_matriculas_online', $data["actions"])) {
             $current_ay = AcademicYear::getCurrentAcademicYear();
             if (!$current_ay) {
                 return View::make('enrollments/academic_year_error', $data);
             }
             $data["search"] = Input::get('search');
             $search_criteria = $data["search"];
             $data["state"] = Input::get('search_state');
             $search_level = Input::get('search_level');
             $data["level"] = $search_level ? $search_level : '0';
             $data["enrollments_data"] = Enrollment::search($search_criteria, $data["state"], $data["level"])->paginate(20);
             $data["states"] = ['P' => 'Pendientes de aprobación', 'A' => 'Aprobadas', 'D' => 'Desaprobadas'];
             $data["levels"] = Level::lists('name', 'id');
             $data["levels"]["0"] = "Todos los niveles";
             return View::make('enrollments/approve_online_enrollments', $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');
     }
 }
 public function new_notice()
 {
     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_nuevo_comunicado', $data["actions"])) {
             $current_ay = AcademicYear::getCurrentAcademicYear();
             if (!$current_ay) {
                 return View::make('notices/academic_year_error', $data);
             }
             $data["levels"] = Level::lists('name', 'id');
             $data["levels"]["0"] = 'Todos los niveles';
             return View::make('notices/new_notice', $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');
     }
 }
 public function new_incident()
 {
     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_nueva_anotacion', $data["actions"])) {
             $current_ay = AcademicYear::getCurrentAcademicYear();
             if (!$current_ay) {
                 return View::make('control_notebook_incidents/academic_year_error', $data);
             }
             $data["levels"] = Level::lists('name', 'id');
             $data["levels"]["0"] = 'Seleccione un nivel';
             $level_id = Input::old('level_id');
             $level = null;
             if ($level_id) {
                 $level = $level_id;
             } else {
                 $level = Input::get('level');
             }
             $data["level"] = $level ? $level : '0';
             if ($data["level"]) {
                 $data["students"] = Student::getStudentsEnrolledInLevel($data["level"])->lists('FullName', 'id');
                 //$data["students"] = Student::orderBy('lastname')->get()->lists('FullName','id');
                 $data["students"]["0"] = 'Seleccione un alumno';
             } else {
                 $data["students"] = ['0' => 'Seleccione un nivel'];
             }
             $student_id = Input::old('student_id');
             if ($student_id) {
                 $data["student_id"] = $student_id;
             } else {
                 $data["student_id"] = '0';
             }
             $data["types"] = ['0' => 'Seleccione', '1' => 'Informativa', '2' => 'Felicitación', '3' => 'Llamada de atención'];
             return View::make('control_notebook_incidents/new_incident', $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');
     }
 }
 public function new_student()
 {
     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_nuevo_alumno', $data["actions"])) {
             $data["levels"] = Level::lists('name', 'id');
             $data["levels"]["0"] = 'Seleccione el nivel del alumno';
             $data["level_id"] = '0';
             return View::make('people/new_student', $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');
     }
 }
 public function new_homework()
 {
     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_nueva_tarea', $data["actions"])) {
             $current_ay = AcademicYear::getCurrentAcademicYear();
             if (!$current_ay) {
                 return View::make('homeworks/academic_year_error', $data);
             }
             $data["levels"] = Level::lists('name', 'id');
             $data["levels"]["0"] = 'Seleccione un nivel';
             $level_id = Input::old('level_id');
             $level = null;
             if ($level_id) {
                 $level = $level_id;
             } else {
                 $level = Input::get('level');
             }
             $data["level"] = $level ? $level : '0';
             $data["is_tutor"] = $data["user"]->profiles()->where('name', '=', 'Tutor')->first() ? true : false;
             $data["is_teacher"] = $data["user"]->profiles()->where('name', '=', 'Profesor')->first() ? true : false;
             if ($data["level"]) {
                 if ($data["is_tutor"]) {
                     // si es tutor y se elige su nivel, mostrar todos los cursos de su nivel
                     if ($data["user"]->teacher->level->id == $data["level"]) {
                         $data["courses"] = Level::find($data["level"])->courses->lists('name', 'id');
                     } else {
                         $data["courses"] = Level::find($data["level"])->courses()->where('teacher_id', '=', $data["user"]->teacher->id)->lists('name', 'id');
                     }
                 } elseif ($data["is_teacher"]) {
                     // si es un profesor, mostrar solo los cursos que dicta
                     $data["courses"] = Level::find($data["level"])->courses()->where('teacher_id', '=', $data["user"]->teacher->id)->lists('name', 'id');
                 } else {
                     // si no es un profesor (entonces es director o webmaster), mostrar todos los cursos
                     $data["courses"] = Level::find($data["level"])->courses->lists('name', 'id');
                 }
                 $data["courses"]["0"] = 'Seleccione un curso';
             } else {
                 $data["courses"] = ['0' => 'Seleccione un nivel'];
             }
             $course_id = Input::old('course_id');
             if ($course_id) {
                 $data["course_id"] = $course_id;
             } else {
                 $data["course_id"] = '0';
             }
             return View::make('homeworks/new_homework', $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');
     }
 }
Пример #6
0
 public function new_course($level_id)
 {
     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_nuevo_curso', $data["actions"])) {
             $data["level_id"] = $level_id;
             $data["levels"] = Level::lists('name', 'id');
             $teachers = Teacher::orderBy('lastname')->get();
             $data["teachers"] = $teachers->lists('FullName', 'id');
             return View::make('levels/new_course', $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');
     }
 }