コード例 #1
0
ファイル: alumno.class.php プロジェクト: yo-alan/santiago
 static function alumnoSinComision($anio, $carrera, $materia)
 {
     //METODO ESTATICO QUE RETORNA TODOS LOS ALUMNOS SIN UNA COMISION
     $as = array();
     $conn = new Conexion();
     $sql = "SELECT \n                    ca.*,a.legajo,a.documento,concat(p.apellido,', ',p.nombre) as nombre \n                FROM \n                    alumno a \n                JOIN \n                    persona p ON a.documento=p.documento\n                LEFT JOIN \n                    comision_alumno ca ON ca.alumno=a.documento\n                LEFT JOIN\n                    comision c ON ca.comision=c.id_comision\n                WHERE (c.anio!=? OR c.carrera!=? OR c.materia!=?) OR ca.comision IS NULL\n                GROUP BY documento;";
     $consulta = $conn->prepare($sql);
     $consulta->setFetchMode(PDO::FETCH_ASSOC);
     $consulta->bindParam(1, $anio, PDO::PARAM_INT);
     $consulta->bindParam(2, $carrera, PDO::PARAM_STR);
     $consulta->bindParam(3, $materia, PDO::PARAM_INT);
     try {
         $consulta->execute();
         $results = $consulta->fetchall();
         foreach ($results as $r) {
             $a = Alumno::alumno($r['legajo']);
             array_push($as, $a);
         }
     } catch (PDOException $e) {
     }
     return $as;
 }
コード例 #2
0
ファイル: clase.class.php プロジェクト: yo-alan/santiago
    function getAlumnos()
    {
        $as = array();
        $sql = 'SELECT a.legajo FROM alumno a, comision_alumno ca, comision c, clase cl
				WHERE a.documento = ca.alumno
				AND c.id_comision = ca.comision
				AND c.id_comision = cl.comision
				AND cl.id_clase = :id_clase';
        $conn = new Conexion();
        $consulta = $conn->prepare($sql);
        $consulta->setFetchMode(PDO::FETCH_ASSOC);
        $consulta->bindParam(':id_clase', $this->id_clase, PDO::PARAM_INT);
        try {
            $consulta->execute();
            $results = $consulta->fetchall();
            foreach ($results as $r) {
                $a = Alumno::alumno($r['legajo']);
                array_push($as, $a);
            }
        } catch (PDOException $e) {
            throw new Exception("Ocurrio un error: " . $e->getMessage());
        }
        return $as;
    }
コード例 #3
0
ファイル: comision.class.php プロジェクト: yo-alan/santiago
 function getAlumnos()
 {
     $as = array();
     $sql = "SELECT alumno FROM comision_alumno WHERE comision = :comision";
     $consulta = $conn->prepare($sql);
     $consulta->setFetchMode(PDO::FETCH_ASSOC);
     $consulta->bindParam(':comision', $this->id_comision, PDO::PARAM_INT);
     try {
         $consulta->execute();
         $results = $consulta->fetchAll();
         foreach ($results as $r) {
             $a = Alumno::alumno($r['alumno']);
             array_push($as, $a);
         }
     } catch (PDOException $e) {
         throw new Exception('Error al eliminar la comision: ' . $e->getMessage());
     }
     return $as;
 }