function Consul_profesor($cedula, $nombres, $apellidos, $genero, $telefono, $celular, $email, $area, $imagen)
 {
     include '../Datos/class.Profesor.php';
     $clase = new Profesor();
     $clase->Nuevo_profesor($cedula, $nombres, $apellidos, $genero, $telefono, $celular, $email, $area, $imagen);
     header("Location: ../buscar_profesor.php?");
 }
Ejemplo n.º 2
0
 public function registrarProfesor()
 {
     $new_profesor = new Profesor();
     $new_profesor->num_empleado = Input::get("num_empleado");
     $new_profesor->password = Input::get("password");
     $new_profesor->email = Input::get("email");
     $new_datos_profesor = new DatosProfesor();
     $new_datos_profesor->nombre = Input::get("nombre");
     $new_datos_profesor->apellido_paterno = Input::get("apellido_paterno");
     $new_datos_profesor->apellido_materno = Input::get("apellido_materno");
     $new_datos_profesor->sexo = Input::get("sexo");
     $new_datos_profesor->celular = Input::get("celular");
     // Pequeño hack. Primero lo ponemos como archivo para validarlo, después le asignamos la ruta real para guardarlo
     $new_datos_profesor->ruta = Input::file('cv');
     if ($new_profesor->validate()) {
         if ($new_datos_profesor->validate()) {
             $nombreCV = Input::get("nombre") . "_" . Input::get("apellido_paterno") . "_" . Input::get("apellido_materno") . "_CV.pdf";
             //CHECAR PORQUE NO SE CREA EL PUTO CV!!!
             Input::file('cv')->move("CVs", $nombreCV);
             $new_datos_profesor->ruta = "/CVs/" . $nombreCV;
             //Ahora si, guardamos todo después de haberlo validado
             $new_profesor->save();
             $new_datos_profesor->profesor()->associate($new_profesor);
             // Forzamos Save porque sabemos que no validará ruta como un string, sino como un file
             $new_datos_profesor->forceSave();
             return Redirect::to('/');
         } else {
             return Redirect::route('registro')->withErrors($new_datos_profesor->errors())->withInput();
         }
     } else {
         $new_datos_profesor->validate();
         $erroresValidaciones = array_merge_recursive($new_profesor->errors()->toArray(), $new_datos_profesor->errors()->toArray());
         return Redirect::route('registro')->withErrors($erroresValidaciones)->withInput();
     }
 }
 public function asignatura($profesor_id)
 {
     $profesor = new Profesor();
     $profesorasignatura = new Profesorasignatura();
     $this->profesor = $profesor->find($profesor_id);
     $this->asignaturas = $profesorasignatura->getAsignaturasByProfesorId($profesor_id);
     $this->select = $profesorasignatura->getParaAsignaturaParaAsignar($profesor_id);
 }
Ejemplo n.º 4
0
 public function run()
 {
     Eloquent::unguard();
     $this->command->info('Borrando profesores existentes en la tabla ...');
     DB::table('profesores')->delete();
     $faker = Faker::create();
     $this->command->info('Insertando nuevos profesores a la tabla ...');
     $cont = 1;
     foreach (range(1, 10) as $index) {
         $nombre = $faker->firstName;
         $user = User::create(array('username' => $nombre, 'password' => Hash::make('123'), 'is_superuser' => false, 'is_active' => true));
         $user->attachRole(2);
         $prof = array('id' => $cont++, 'nombres' => $nombre, 'apellidos' => $faker->lastName, 'sexo' => rand(0, 1) ? 'M' : 'F', 'fecha_nac' => $faker->date(), 'email' => $faker->email(), 'facebook' => $faker->email(), 'celular' => $faker->phoneNumber, 'direccion' => $faker->address, 'user_id' => $user->id);
         //$this->command->info("	" . $index . ". -> " . implode(",", $prof));
         Profesor::create($prof);
     }
 }
Ejemplo n.º 5
0
 public function editarDatos()
 {
     if (Request::ajax()) {
         $new_profesor = Profesor::find(Auth::user()->id);
         $new_profesor->email = Input::get("email");
         $new_datos_profesor = DatosProfesor::where('profesor_id', '=', Auth::user()->id)->first();
         $new_datos_profesor->nombre = Input::get("nombre");
         $new_datos_profesor->apellido_paterno = Input::get("apellido_paterno");
         $new_datos_profesor->apellido_materno = Input::get("apellido_materno");
         $new_datos_profesor->celular = Input::get("celular");
         if ($new_datos_profesor->validate(array('nombre' => 'required', 'apellido_paterno' => 'required', 'apellido_materno' => 'required', 'celular' => 'required|digits:10'))) {
             if ($new_profesor->updateUniques()) {
                 $new_datos_profesor->forceSave();
                 return Response::json(array('success' => true));
             } else {
                 return Response::json(array('success' => false, 'errores' => $new_profesor->errors()->toArray()));
             }
         } else {
             return Response::json(array('success' => false, 'errores' => $new_datos_profesor->errors()->toArray()));
         }
     }
 }
Ejemplo n.º 6
0
 public function actionListado()
 {
     if ($_SESSION['perfil'] == 2) {
         $params['active'] = 5;
         $params['vista'] = '_listado';
         $profesor = Profesor::model()->find('idUsuario=:usuario', array('usuario' => $_SESSION['idUsuario']));
         $params['listadoElectivas'] = Electiva::model()->findAll('idProfesor=:profesor', array('profesor' => $profesor->idProfesor));
     } else {
         $params['active'] = 0;
         $params['vista'] = "_sinPermisos";
     }
     $this->render('panel', array('params' => $params));
 }
<?php

include '../Datos/class.Profesor.php';
$clase = new Profesor();
$nr = $clase->Verificar_carga_profesor($_POST['id']);
if ($nr != 0) {
    $clase = new Profesor();
    $vector = $clase->Cargar_carga_profesor($_POST['id']);
    echo json_encode($vector);
} else {
    $clase = new Profesor();
    $vector = $clase->Cargar_profesores_id($_POST['id']);
    echo json_encode($vector);
}
 public function getProfesor($id)
 {
     $prof = new Profesor();
     return $prof->find($id);
 }
<?php

include '../Datos/class.Profesor.php';
$clase = new Profesor();
$vector = $clase->Cargar_profesores($_POST['apellidos']);
echo json_encode($vector);
Ejemplo n.º 10
0
$form = $this->beginWidget('CActiveForm', array('enableClientValidation' => true, 'htmlOptions' => array('id' => "form-autenticar", 'class' => "form-horizontal", 'role' => 'form'), 'errorMessageCssClass' => 'has-error', 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => true, 'errorCssClass' => 'has-error', 'successCssClass' => 'has-success')));
?>
<br/><br/><br/>
<div class="row">
    <div class="col-md-3">
        <?php 
echo $form->textField($modelElectiva, 'descripcion', array('class' => 'form-control', 'placeholder' => $modelElectiva->getAttributeLabel('descripcion')));
?>
        <?php 
echo $form->error($modelElectiva, 'descripcion', array('class' => 'has-error'));
?>
    </div>

    <div class="col-md-3">
        <?php 
echo $form->dropdownlist($modelElectiva, 'idProfesor', CHtml::listData(Profesor::model()->findAll(), 'idProfesor', 'nombreCompleto'), array('class' => 'form-control', 'prompt' => 'Seleccione docente...'));
?>
        <?php 
echo $form->error($modelElectiva, 'idProfesor', array('class' => 'has-error'));
?>
    </div>

    <div class="col-md-3">
        <?php 
echo $form->textField($modelElectiva, 'cuposDisponibles', array('class' => 'form-control', 'placeholder' => $modelElectiva->getAttributeLabel('cuposDisponibles')));
?>
        <?php 
echo $form->error($modelElectiva, 'cuposDisponibles', array('class' => 'has-error'));
?>
    </div>
    <div class="center col-md-3">
 public function cambiarpass($id_profesor)
 {
     $this->titulo = "Cambiar contraseña";
     $this->profesor = new Profesor();
     $this->profesor->id = $id_profesor;
     if (Input::post("profesor") and Input::post("pass1")) {
         $inputs = Input::post("profesor");
         if ($inputs['password'] != $inputs['password2']) {
             Input::delete();
             Flash::info("Las nuevas contraseñas no coinciden");
             Router::redirect("perfil/cambiarpass/{$id_profesor}");
             die;
         }
         $prof = new Profesor();
         $prof_pass = $prof->find($id_profesor);
         if ($prof->encriptar(Input::post("pass1")) != $prof_pass->password) {
             Input::delete();
             Flash::info("La contraseña anterior no coincide");
             Router::redirect("perfil/cambiarpass/{$id_profesor}");
             die;
         }
         $prof_pass->password = $prof->encriptar($inputs['password']);
         if ($prof_pass->update()) {
             Flash::valid("La contraseña ha sido cambiada con éxito");
         } else {
             Flash::error("No se pudo cambiar la contraseña");
         }
         Input::delete();
     }
 }
Ejemplo n.º 12
0
class Student
{
    public $ime;
    public function pej()
    {
        echo "tra la la la la...";
    }
}
class Profesor
{
    public function predavaj()
    {
        echo "bla bla bla bla...";
    }
    public function ocenuvaj()
    {
        echo "sedi 1!";
    }
}
$s = new Student();
$s->ime = 'Bojan';
$s->pej();
ocenuvaj();
$prof = new Profesor();
$prof->predavaj();
$prof->predavaj();
$prof->predavaj();
$prof->ocenuvaj();
$prof->ocenuvaj();
$prof->ocenuvaj();
Ejemplo n.º 13
0
    <div class="container">
        <div class="form-group">
            <div class="col-sm-7 col-xs-12 text-center">
                {{ Form::open(array('id'=>'formAActividad', 'role'=>'form')) }}
                <span class="mensajeError alert-danger"></span>
                <div class="form-group row">
                {{ Form::label('nombre', 'Indica el nombre de la actividad', array('class' => 'col-sm-5'))}}
                {{ Form::text('nombre', '', array('class' => 'col-xs-5')) }}
                </div>
                <div class="form-group row">
                {{ Form::label('profesor_id', 'Selecciona al profesor', array('class' => 'col-sm-5'))}}
                <?php 
$collection = DB::table('datos_profesor')->join('profesores', 'profesores.id', '=', 'datos_profesor.profesor_id')->join('academias_profesores', 'profesores.id', '=', 'academias_profesores.profesores_id')->where('academias_profesores.academias_id', '=', Academia::academiaPDAActual())->select('profesores.id', DB::raw('CONCAT(datos_profesor.nombre, " ", datos_profesor.apellido_paterno, " ", datos_profesor.apellido_materno) as nombre'))->orderBy('datos_profesor.nombre')->get();
$arreglo = array();
foreach ($collection as $clave => $valor) {
    if ($valor->nombre == Profesor::nombre()) {
        $valor->nombre = $valor->nombre . " (TU)";
    }
    $arreglo[$valor->id] = $valor->nombre;
}
?>
                {{ Form::select('profesor_id', $arreglo, null, array('class' => 'col-sm-5')) }}
                </div>
                {{ Form::submit('Añadir', array('class'=>'btn btn-lg btn-primary')) }}
                {{ Form::close() }}
            </div>
        </div>
        <table id="tablaAActividadProfesor" class="table table-bordered table-responsive table-striped table-hover tablaCRUD ocultar">
            <thead>
            <tr>
                <th>ID</th>
Ejemplo n.º 14
0
 public function eliminarODesactivarProfesor()
 {
     if (Request::ajax()) {
         $profesor = Profesor::find(Input::get('id'));
         if (Input::get('borrado') === "temporal") {
             $profesor->status = 0;
             if ($profesor->forceSave()) {
                 return Response::json(array('success' => 'true'));
             } else {
                 return Response::json(array('success' => 'false'));
             }
         } else {
             if (Input::get('borrado') === "permanente") {
                 if ($profesor->rol == 'profesor') {
                     if (unlink('../public/CVs/' . $profesor->datos->ruta)) {
                         $profesor->delete();
                         return Response::json(array('success' => 'true'));
                     } else {
                         return Response::json(array('success' => 'false'));
                     }
                 } else {
                     return Response::json(array('success' => 'denegado'));
                 }
             } else {
                 return Response::json(array('success' => 'false'));
             }
         }
     }
 }
<?php

include '../Datos/class.Profesor.php';
$clase = new Profesor();
$nreg = $clase->Buscar_profesor($_POST['cedula']);
echo $nreg;
Ejemplo n.º 16
0
<?php

include "../Datos/class.Profesor.php";
if ($_POST['caso'] == "cargar_tabla") {
    $clase = new Profesor();
    $vector = $clase->Cargar_profesores($_POST['text_buscar']);
    echo json_encode($vector);
}
if ($_POST['caso'] == "buscar") {
    $clase = new Profesor();
    $vector = $clase->Cargar_profesores_id($_POST["id"]);
    echo json_encode($vector);
}
if ($_POST['caso'] == "Eliminar") {
    $clase = new Profesor();
    $clase->Eliminar_profesor($_POST['cedula']);
}
if ($_POST['caso'] == "Modificar") {
    $clase = new Profesor();
    $clase->Actualizar_profesor($_POST["cedula"], $_POST["nombres"], $_POST["apellidos"], $_POST["genero"], $_POST["telefono"], $_POST["celular"], $_POST["email"], $_POST["area"]);
}
Ejemplo n.º 17
0
 public function eliminarPDA()
 {
     if (Request::ajax()) {
         $academia = Academia::find(Input::get('id'));
         $profesor = Profesor::find($academia->profesores_id);
         $academia->profesores_id = null;
         $profesor->rol = $profesor->rol === "PDAJDA" ? "JDA" : "profesor";
         if ($profesor->forceSave() && $academia->save()) {
             return Response::json(array('success' => true));
         } else {
             return Response::json(array('success' => false));
         }
     }
 }
Ejemplo n.º 18
0
 public function eliminarJDD()
 {
     if (Request::ajax()) {
         $depto = Departamento::find(Input::get('id'));
         $profesor = Profesor::find($depto->profesores_id);
         $depto->profesores_id = null;
         $profesor->rol = "profesor";
         if ($profesor->forceSave() && $depto->save()) {
             return Response::json(array('success' => true));
         } else {
             return Response::json(array('success' => false));
         }
     }
 }
Ejemplo n.º 19
0
 public function run()
 {
     $faker = Faker\Factory::create();
     $primerNumValido = 11110;
     for ($i = 0; $i < 150; $i++) {
         ProfesorValido::create(['num_empleado' => $primerNumValido + $i]);
     }
     for ($i = 1; $i <= 100; $i++) {
         Profesor::create(['num_empleado' => $primerNumValido + $i, 'password' => '' . ($primerNumValido + $i), 'email' => $faker->unique()->email, 'status' => 1, 'rol' => $i == 1 ? "subdirector" : ($i == 2 ? "JDD" : ($i == 3 || $i == 5 ? "PDA" : ($i == 4 || $i == 6 ? "JDA" : "profesor")))]);
     }
     // Añadir más de cada uno y asignarlos a academias y deptos
     //
     for ($i = 1; $i <= 100; $i++) {
         $sexo = rand(0, 1) ? 'H' : 'M';
         $nombre = $sexo == 'H' ? $faker->firstName('male') : $faker->firstName('female');
         $aux = DatosProfesor::create(['nombre' => $nombre, 'apellido_paterno' => $faker->lastName, 'apellido_materno' => $faker->lastName, 'sexo' => $sexo, 'celular' => $faker->numberBetween($min = 1111111111, $max = 9999999999), 'ruta' => $nombre . '_' . $faker->word . '_CV.pdf', 'profesor_id' => $i]);
         $aux->forceSave();
         //  NI IDEA DE PORQUE TUVE QUE HACER ESTO, NO JALABA DE OTRA FORMA
     }
     Departamento::create(['nombre' => 'Departamento X', 'profesores_id' => 2]);
     Departamento::create(['nombre' => 'Departamento Y', 'profesores_id' => null]);
     Academia::create(['nombre' => 'Academia A', 'profesores_id' => 3, 'departamentos_id' => 1]);
     Academia::create(['nombre' => 'Academia B', 'profesores_id' => 5, 'departamentos_id' => 1]);
     Academia::create(['nombre' => 'Academia C', 'profesores_id' => null, 'departamentos_id' => 1]);
     Academia::create(['nombre' => 'Academia D', 'profesores_id' => null, 'departamentos_id' => 2]);
     Academia::create(['nombre' => 'Academia E', 'profesores_id' => null, 'departamentos_id' => 2]);
     for ($i = 0; $i < 10; $i++) {
         $nombre = $faker->sentence(3);
         Asignatura::create(['nombre' => 'Materia ' . substr($nombre, 0, strlen($nombre) - 1), 'academia_id' => 1, 'profesores_id' => $i == 0 ? 4 : null]);
     }
     for ($i = 0; $i < 10; $i++) {
         $nombre = $faker->sentence(3);
         Asignatura::create(['nombre' => 'Materia ' . substr($nombre, 0, strlen($nombre) - 1), 'academia_id' => 2, 'profesores_id' => $i == 0 ? 6 : null]);
     }
     for ($i = 0; $i < 10; $i++) {
         $nombre = $faker->sentence(3);
         Asignatura::create(['nombre' => 'Materia ' . substr($nombre, 0, strlen($nombre) - 1), 'academia_id' => 3, 'profesores_id' => null]);
     }
     for ($i = 0; $i < 10; $i++) {
         $nombre = $faker->sentence(3);
         Asignatura::create(['nombre' => 'Materia ' . substr($nombre, 0, strlen($nombre) - 1), 'academia_id' => 4, 'profesores_id' => null]);
     }
     for ($i = 0; $i < 10; $i++) {
         $nombre = $faker->sentence(3);
         Asignatura::create(['nombre' => 'Materia ' . substr($nombre, 0, strlen($nombre) - 1), 'academia_id' => 5, 'profesores_id' => null]);
     }
     for ($i = 1; $i <= 8; $i++) {
         for ($j = 1; $j <= 12; $j++) {
             Grupo::create(['nombre' => $i . 'CM' . $j]);
         }
     }
     $arrayAsignaturasGrupos = array();
     $arrayAsignaturasGruposProfesores = array();
     $arrayAcademiasProfesores = array();
     for ($i = 1; $i <= 96; $i++) {
         //Hay 96 grupos
         $materiasUsadas = array();
         $academiasUsadas = array();
         for ($j = 1; $j <= 5; $j++) {
             // Asignar 5 materias por grupo y al profesor a academia
             $profesor = $faker->numberBetween(1, 100);
             do {
                 $materia = $faker->numberBetween(1, 50);
             } while (in_array($materia, $materiasUsadas));
             $materiasUsadas[] = $materia;
             $arrayAsignaturasGrupos[] = array('asignatura_id' => $materia, 'grupo_id' => $i);
             $idAGP = count($arrayAsignaturasGrupos);
             $arrayAsignaturasGruposProfesores[] = array('asignaturas_grupos_id' => $idAGP, 'profesores_id' => $profesor);
             if ($materia <= 10) {
                 $academia = 1;
             } else {
                 if ($materia <= 20) {
                     $academia = 2;
                 } else {
                     if ($materia <= 30) {
                         $academia = 3;
                     } else {
                         if ($materia <= 40) {
                             $academia = 4;
                         } else {
                             $academia = 5;
                         }
                     }
                 }
             }
             if (!in_array($academia, $academiasUsadas)) {
                 $arrayAcademiasProfesores[] = array('academias_id' => $academia, 'profesores_id' => $profesor);
             }
         }
         unset($materiasUsadas);
         unset($academiasUsadas);
     }
     $arrayAcademiasProfesores = array_unique($arrayAcademiasProfesores, SORT_REGULAR);
     TipoDocumento::create(['nombre' => "Convocatoria  y Orden del dia", 'rol' => 'PDAJDA']);
     TipoDocumento::create(['nombre' => "Informe Semestral de Academia", 'rol' => 'PDA']);
     TipoDocumento::create(['nombre' => "Informe Semestral de Asignatura", 'rol' => 'JDA']);
     TipoDocumento::create(['nombre' => "Lista de Asistencia", 'rol' => 'PDAJDA']);
     TipoDocumento::create(['nombre' => "Memorandum", 'rol' => 'PDAJDA']);
     TipoDocumento::create(['nombre' => "Minuta", 'rol' => 'PDAJDA']);
     TipoDocumento::create(['nombre' => "Planeación Didáctica", 'rol' => 'profesor']);
     TipoDocumento::create(['nombre' => "Seguimiento Programático", 'rol' => 'profesor']);
     $arrayDocumentos = array();
     $arrayDocumentos[] = array('ruta' => 'ruta/que/no/existe.pdf', 'fecha_agregacion' => '2015-01-18', 'ciclo' => '2014-2015/1', 'periodo' => '19/1', 'tipos_documento_id' => '1', 'profesor_id' => '3', 'academia_id' => '1', 'asignatura_id' => '1');
     $arrayDocumentos[] = array('ruta' => 'otra/ruta/que/no/existe.pdf', 'fecha_agregacion' => '2015-01-30', 'ciclo' => '2014-2015/1', 'periodo' => '19/1', 'tipos_documento_id' => '2', 'profesor_id' => '4', 'academia_id' => '1', 'asignatura_id' => '3');
     $arrayDocumentos[] = array('ruta' => 'ruta/no/existe.pdf', 'fecha_agregacion' => '2015-02-10', 'ciclo' => '2014-2015/1', 'periodo' => '19/1', 'tipos_documento_id' => '3', 'profesor_id' => '5', 'academia_id' => '1', 'asignatura_id' => '2');
     DB::table('asignaturas_grupos')->insert($arrayAsignaturasGrupos);
     DB::table('asignaturas_grupos_profesores')->insert($arrayAsignaturasGruposProfesores);
     DB::table('academias_profesores')->insert($arrayAcademiasProfesores);
     DB::table('documentos')->insert($arrayDocumentos);
 }