Difficulty with Weekly Agenda View

1

I'm trying to create a weekly display schedule that displays the scheduled classes for each day and time, and also leaves vacant schedules unchecked. I developed the following code to record all the dates of classes. However, I can not display search results in a table, as a weekly calendar divided into days and times ...

$dtv = explode('/', $resul['dia']);
for($i=1;$i<=26;$i++){
$proxdia = $dtv[2]+7;
if(($dtv[0]%4==0 && $dtv[0]%100 != 0)||($dtv[0]%400==0)):
    if($dtv[1] == 2):
        if($proxdia > 29):
            $sobra = 29 - $dtv[2];
            $sobra = 7 - $sobra;
            $proxdia = $sobra;
            $dtv[2] = $proxdia;
            $dtv[1] = $dtv[1]+1;
        else:
            $dtv[2] = $proxdia;
        endif;
    endif;
else:
    if($dtv[1] == 2):
        if($proxdia > 28):
            $sobra = 28 - $dtv[2];
            $sobra = 7 - $sobra;
            $proxdia = $sobra;
            $dtv[2] = $proxdia;
            $dtv[1] = $dtv[1]+1;
        else:
            $dtv[2] = $proxdia;
        endif;
    endif;
endif;
if($dtv[1] == 4 || $dtv[1] == 6 || $dtv[1] == 9 || $dtv[1] == 11):
    if($proxdia > 30):
        $sobra = 30 - $dtv[2];
        $sobra = 7 - $sobra;
        $proxdia = $sobra;
        $dtv[2] = $proxdia;
        $dtv[1] = $dtv[1]+1;
    else:
        $dtv[2] = $proxdia;
    endif;
else:
    if($proxdia > 31):
        $sobra = 31 - $dtv[2];
        $sobra = 7 - $sobra;
        $proxdia = $sobra;
        $dtv[2] = $proxdia;
        $dtv[1] = $dtv[1]+1;
    else:
        $dtv[2] = $proxdia;
    endif;
endif;
if($dtv[1]>12):
    $dtv[1]=1;
    $dtv[0]=$dtv[0]+1;
endif;
$dataaula = $dtv[0] . '-' . $dtv[1] . '-' . $dtv[2];
if($dataaula):
    $dtaula = conectar()->prepare('insert into descriaula
        set aula=?, dataaula=?');
    $retorno4 = $dtaula->execute(array(
        $idaula,
        $dataaula));
else:
    echo "Erro ao cadastrar aula";
endif;
    
asked by anonymous 02.06.2016 / 01:32

0 answers