tit_azul("Aula não encontrada");
}
else
{
#---------------- INICIO MONTANDO BREADCRUMB VERSAO 2 ---------------------#
for($i=3; $i>=0; $i--)
{
if($i > 0)
{
$obj_tx_bread = new Principal;
$obj_tx_bread -> executa("select cod_materia_sub".$i." from cruza_materia_sub".$i."_aula where cod_aula = '$id' ");
$numRows_bread = $obj_tx_bread -> numRows();
}
else if($i == 0)
{
$obj_tx_bread = new Principal;
$obj_tx_bread -> executa("select cod_materia from cruza_materia_aula where cod_aula = '$id' ");
$numRows_bread = $obj_tx_bread -> numRows();
}
if($numRows_bread > 0)
{
$row_tx_bread = $obj_tx_bread -> fetchArray();
$ids_original = $cod_bread = $row_tx_bread[0];
for($i2 = $i; $i2>=0; $i2--)
{
$obj_tx_bread3 = new Principal;
if($i2 > 1)
{
$sql = "select cod_materia_sub".($i2-1)." as cod_mat, cad_materia_sub".$i2.".tx as tx_mat from
cad_materia_sub".$i2." inner join cruza_materia_sub".($i2-1)."_materia_sub".$i2."
on cad_materia_sub".$i2.".cod = cruza_materia_sub".($i2-1)."_materia_sub".$i2.".cod_materia_sub".$i2."
where cruza_materia_sub".($i2-1)."_materia_sub".$i2.".cod_materia_sub".$i2." = '$cod_bread' ";
}
else if($i2 == 1 && $i > 0)
{
$sql = "select cod_materia as cod_mat, cad_materia_sub".$i2.".tx as tx_mat from
cad_materia_sub".$i2." inner join cruza_materia_materia_sub".$i2."
on cad_materia_sub".$i2.".cod = cruza_materia_materia_sub".$i2.".cod_materia_sub".$i2."
where cruza_materia_materia_sub".$i2.".cod_materia_sub".$i2." = '$cod_bread' ";
}
else
{
$sql = "select tx as tx_mat from cad_materia where cod = '$cod_bread' ";
}
// ------------ INICIO SQL PROXIMAS AULAS ------------------//
if($i3 == 0)
{
$i3 = 1;
if($i >= 1)
{
$tab_cruza = "cruza_materia_sub".$i2."_".$tb;
$sql_sequencia = "select ".$tab_cruza.".*, cad_".$tb.".cod as t2_cod, tit, ordem_".$categoria.", tx from
".$tab_cruza." inner join cad_".$tb." on
".$tab_cruza.".cod_".$tb." = cad_".$tb.".cod
where ".$tab_cruza.".cod_materia_sub".$i2." = '$cod_bread' && show_home = 1 && ".$categoria."=1 order by cad_".$tb.".ordem_".$categoria." ";
$sql_prox = "select ". $tab_cruza .".*, cad_".$tb.".cod as t2_cod, tit, tx from
".$tab_cruza." inner join cad_".$tb." on
".$tab_cruza.".cod_".$tb." = cad_".$tb.".cod
where ".$tab_cruza.".cod_materia_sub".$i2." = '$cod_bread' && show_home = 1 && ".$categoria."=1 ";
}
else
{
$tab_cruza = "cruza_materia_".$tb;
$sql_sequencia = "select ".$tab_cruza.".*, cad_".$tb.".cod as t2_cod, tit, ordem_".$categoria.", tx from
".$tab_cruza." inner join cad_".$tb." on
".$tab_cruza.".cod_".$tb." = cad_".$tb.".cod
where ".$tab_cruza.".cod_materia = '$cod_bread' && show_home = 1 && ".$categoria."=1 order by cad_".$tb.".ordem_".$categoria." ";
$sql_prox = "select ". $tab_cruza .".*, cad_".$tb.".cod as t2_cod, tit, tx from
".$tab_cruza." inner join cad_".$tb." on
".$tab_cruza.".cod_".$tb." = cad_".$tb.".cod
where ".$tab_cruza.".cod_materia = '$cod_bread' && show_home = 1 && ".$categoria."=1 ";
}
}
// ------------ FIM SQL PROXIMAS AULAS ------------------//
$obj_tx_bread3 -> executa($sql);
$row_tx_bread3 = $obj_tx_bread3 -> fetchArray();
$cod_bread = $row_tx_bread3[cod_mat];
//echo "# $sql
$row_tx_bread3[cod_mat] - $row_tx_bread3[tx_mat] #
";
$space = $ids_original == '' ? '' : '_';
$ids_original = $cod_bread.$space.$ids_original;
if($i2 == 0)
{
$breadcrumb = " >
".$row_tx_bread3[tx_mat]."".$breadcrumb;
}
else if($i2 == $i)
{
$link_bread = "/aulas/$categoria/materia_sub".$i2."/".variavel_url($row_tx_bread3[tx_mat]);
$breadcrumb = " >
".$row_tx_bread3[tx_mat]."".$breadcrumb;
}
else
{
$breadcrumb = " >
".$row_tx_bread3[tx_mat]."".$breadcrumb;
}
unset($sql, $obj_tx_bread3, $space);
}
break;
}
unset($numRows_bread);
}
$ids_original .= '_'.$id;
switch($categoria)
{
case 'vestibular': $categoria_tx = 'Vestibular'; $ids_original = '1'.$ids_original; break;
case 'enem': $categoria_tx = 'Enem'; $ids_original = '2'.$ids_original; break;
case 'ensino': $categoria_tx = 'Ensino Médio'; $ids_original = '3'.$ids_original; break;
case 'eja': $categoria_tx = 'EJA'; $ids_original = '4'.$ids_original; break;
}
$ids_original = str_replace('__', '_', $ids_original);
$ids = explode('_', $ids_original);
$qtd_id = count($ids);
$categoria_bread = "
$categoria_tx";
$obj_tx = new Titulo;
$obj_tx -> tit_azul($categoria_bread."$breadcrumb");
#---------------- FIM MONTANDO BREADCRUMB VERSAO 2 ---------------------#
#------------------------ INICIO ESCREVENDO O CONTEUDO DA AULA ------------------#
echo "
";
echo '
';
$obj_tx -> cont_tx($row_tx_pagina["tit"],"");
echo '
';
if($row_tx_pagina["resumo"] != '' && $pg == 0)
{
echo '
Ver Resumo
'.$row_tx_pagina["resumo"].'
';
}
if($row_tx_pagina["topico"] != '' && $pg == 0)
{
echo '
Ver Principais Tópicos
'.$row_tx_pagina["topico"].'
';
}
$tx = explode('## quebra pagina ##', $row_tx_pagina['tx']);
echo "
".str_ireplace("_img/","/_img/",$tx[$pg])."
";
echo "
";
#------------------------ FIM ESCREVENDO O CONTEUDO DA AULA ------------------#
#---------------- INICIO PAGINAÇÃO DA AULA ----------------------#
$qtd_pg = count($tx);
$pg_prox = $pg+1 <$qtd_pg ? $pg+1 : $pg;
$pg_ante = $pg-1 >=0 ? $pg-1 : $pg;
if($pg_ante == 0){ $pg_ante='';}
$link_ante = $pg-1 >=0 ? "
| página anterior | " : "
| página anterior | ";
$link_prox = $pg+1 < $qtd_pg ? "
próxima página | | " : "
próxima página | | ";
echo "
$link_ante
|
";
for(($i_pg = $pg > 4 ? $pg-4 : 1) ; ($i_pg<=$qtd_pg = $pg+6 < $qtd_pg ? $pg+6 : $qtd_pg) ;$i_pg++) {
// Verifica se a página que o navegante esta e retira o link do número para identificar visualmente
if ($pg == ($i_pg-1)) {
echo " $i_pg ";
} else {
$i_pg2 = $i_pg-1; if($i_pg2 == 0){ $i_pg2='';}
echo " $i_pg ";
}
}
$qtd_pg2 = count($tx)-1;
if($pg+5 < $qtd_pg2){ echo "...";}
echo "
|
|
$link_prox
";
#---------------- FIM PAGINAÇÃO DA AULA ----------------------#
#---------------- INICIO MARCAR COMO ESTUDADO ----------------#
echo "
";
$obj_estudado = new Principal;
$obj_estudado -> executa("select cod from cad_materia_estudada where cod_usuario = '$_SESSION[cod_usu]' && cod_materia = '$ids_original' ");
if($obj_estudado ->numRows() == 0)
{
echo "
";
}
else
{
echo "
";
}
#---------------- FIM MARCAR COMO ESTUDADO ----------------#
$obj_resp = new Principal;
$obj_resp -> executa("select cod from cruza_questao_aula where cod_aula ='$id' limit 1 ");
if($obj_resp ->numRows() > 0)
{
echo "
";
}
echo " |
";
if($qtd_id > 2)
{
#---------------- INICIO PROXIMA AULA ---------------------------#
$tb_cruza = $qtd_id-3;
$ordem_prox = $row_tx_pagina["ordem_".$categoria]+1;
$obj_tx_prox = new Principal;
$m = $sql_prox."&& ordem_".$categoria." >= '$ordem_prox' order by cad_". $tb .".ordem_". $categoria ." ";
$obj_tx_prox -> executa($m);
$row_tx_prox = $obj_tx_prox -> fetchArray();
$tit_prox = variavel_url($row_tx_prox['tit']);
if($tit_prox)
{
echo "
ver próxima aula: $row_tx_prox[tit] ";
}
#---------------- FIM PROXIMA AULA ---------------------------#
#---------------- INICIO AULA ANTERIOR ---------------------#
$ordem_ante = $row_tx_pagina["ordem_".$categoria]-1;
$obj_tx_ante = new Principal;
$n = $sql_prox."&& ordem_".$categoria." <= '$ordem_ante' order by cad_". $tb .".ordem_".$categoria." desc";
$obj_tx_ante -> executa($n);
$row_tx_ante = $obj_tx_ante -> fetchArray();
$tit_ante = variavel_url($row_tx_ante['tit']);
if($tit_ante)
{
echo "
ver aula anterior: $row_tx_ante[tit] ";
}
#---------------- FIM AULA ANTERIOR ---------------------------#
}
#---------------- INICIO AULAS RELACIONADAS ---------------#
$obj_aula_relacionada = new Principal;
$obj_aula_relacionada -> executa("select cad_aula.tit, vestibular, enem, ensino, eja, cruza_aula_aula.cod_aula2, cruza_aula_aula.cod as cod_cruza_aa from
cruza_aula_aula inner join cad_aula on
cruza_aula_aula.cod_aula2 = cad_aula.cod
where cruza_aula_aula.cod_aula1 = '$id' order by tit");
if($obj_aula_relacionada ->numRows() > 0)
{
echo "
";
$obj_tx -> cx_tit_lat_R4("Aulas relacionadas a esta:", '', '', '');
echo "
";
while($row_aula_relacionada = $obj_aula_relacionada -> fetchArray())
{
if($row_aula_relacionada[vestibular] == 1)
{
$categoria_rel = 'vestibular';
}
else if($row_aula_relacionada[enem] == 1)
{
$categoria_rel = 'enem';
}
else if($row_aula_relacionada[ensino] == 1)
{
$categoria_rel = 'ensino';
}
else if($row_aula_relacionada[eja] == 1)
{
$categoria_rel = 'eja';
}
$tit_relacionada = variavel_url($row_aula_relacionada['tit']);
echo "
$row_aula_relacionada[tit]";
}
echo "
";
}
#---------------- FIM AULAS RELACIONADAS ---------------#
#---------------- INICIO ATIVIDADES RELACIONADAS ---------------#
$obj_atividade = new Principal;
$obj_atividade -> executa("select cad_atividade.tit1, cad_atividade.cod, cruza_aula_atividade.cod as cod_cruza_aa1 from
cruza_aula_atividade inner join cad_atividade on
cruza_aula_atividade.cod_atividade = cad_atividade.cod
where cruza_aula_atividade.cod_aula = '$id' order by tit1");
if($obj_atividade ->numRows() > 0)
{
echo "
";
$obj_tx -> cx_tit_lat_R4("Atividades relacionadas a esta aula", '', '', '');
echo "
";
while($row_atividade = $obj_atividade -> fetchArray())
{
$tit_url = variavel_url($row_atividade['tit1']);
echo "
$row_atividade[tit1]";
}
echo "
";
}
#---------------- FIM ATIVIDADES RELACIONADAS ---------------#
#---------------- INICIO SEQUENCIA DE AULAS ----------------#
$count_seq =1;
for($i=0; $i<$qtd_id-1; $i++)
{
$ids_seq .= $ids[$i]."_";
}
echo "
";
$obj_sequencia= new Principal;
if(count($ids) > 2)
{
$_SESSION['new_sql']=$sql_sequencia;
$_SESSION['categoria']=$categoria;
$obj_sequencia -> executa($sql_sequencia);
if($obj_sequencia ->numRows() > 0)
{
$obj_tx = new Titulo;
$obj_tx -> cx_tit_lat_R4("Sequência de Aulas" ,"","","");
echo "
";
$i=0;
$k=0;
while($row_sequencia = $obj_sequencia -> fetchArray())
{
$tit_seq = variavel_url($row_sequencia['tit']);
if( $tit == $tit_seq)
{
$temp=1;
}
if($temp == 1 && $k==1)
{
$i++;
echo "
Aula $count_seq - $row_sequencia[tit]";
}
if($temp == 1)
{
$k=1;
}
$count_seq++;
if($i == 3)
{
break;
}
}
echo "
";
echo "
";
}
}
#---------------- FIM SEQUENCIA DE AULAS --------------------#
}
?>
executa("select * from cad_anuncio limit 1");
$num_prop = $obj_prop -> numRows();
if($num_prop > 0)
{
$sorteio = rand(1,2);
}
if($sorteio == 1)
{
echo '