<?php

require_once '../../../../app/model/db.class.php';

class Con2 extends database
{
    function proceso($grado,$curso,$asig)
    {
   
        $this->conectar();
        $resul=$this->consulta("select * from logros where  grado='".$grado."' and curso='".$curso."'and asignatura='".$asig."' order by periodo asc, codigo asc;");

       
        if(mysql_num_rows($resul))
        {
            $f=0;
            while($row=$this->fetch_assoc($resul))
            {
                $c=0;


                $arr[$f][$c+0]= $this->name('grados',$row['grado']);
                $arr[$f][$c+1]= $this->name('cursos',$row['curso']);
                $arr[$f][$c+2]=$row['asignatura'];
                $arr[$f][$c+3]=$this->asignatura('catalogo',$row['asignatura']);
                $arr[$f][$c+4]=$row['periodo'];
                $arr[$f][$c+5]=$this->name('periodos',$row['periodo']);
                $arr[$f][$c+6]=$row['codigo'];
                $arr[$f][$c+7]=$row['descripcion'];
                $arr[$f][$c+8]=$row['orden'];
                $arr[$f][$c+9]=$row['orden1'];
                $f++;
            }

            return ($arr);
        }else{
            return ('no');
        }
    
    }
    
    function name($tabla,$cod){
         $result=$this->consulta("select * from ".$tabla." where codigo='".$cod."';");
         $rs=$this->fetch_assoc($result);
         return $rs['descripcion']; 
    }


    function asignatura($tabla,$cod){
         $result=$this->consulta("select * from ".$tabla." where codigo='".$cod."';");
         $rs=$this->fetch_assoc($result);
         return $rs['nombrecorto'];
    }
}
/*
$obj=new Con1();
        $arr=$obj->proceso($_REQUEST['grado'],$_REQUEST['curso'],$_REQUEST['asig']);
        $obj->disconnect();


for($i=0;$i<count($arr);$i++)
{
    for($c=0;$c<9;$c++)
    {
       echo $arr[$i][$c]." -- ";

    }
    echo "<br><br>";
}*/



?>