ok
Direktori : /home/institutonamaste/www/class/ |
Current File : /home/institutonamaste/www/class/class-agenda.php |
<?php class Agenda{ private $tb = "agenda"; public function __construct() { $sql = DBRead($this->tb, "WHERE data >= NOW() AND status = '1' GROUP BY MONTH(data) ORDER BY data+0 ASC LIMIT 8", "DATE_FORMAT(data, '%m') mes, DATE_FORMAT(data, '%Y') ano"); while($row = mysqli_fetch_object($sql)) { $mes = MesMin($row->mes); $css = strtolower($mes); $act = ($i++ == 0) ? 'active' : ''; $nav .= '<li class="nav-item"><a class="nav-link '.$act.'" data-toggle="tab" href="#'.$css.'" role="tab">'.$mes.' <br/><span>'.$row->ano.'</span></a></li>'; $data .= '<div class="tab-pane '.$act.'" id="'.$css.'" role="tabpanel">'; $data .= $this->BoxData($row->mes, $row->ano); $data .= '</div><!-- tab-pane -->'; } if(mysqli_num_rows($sql) > 0) { $page = ' <section class="home-agenda bg-full title-max"> <div class="container"> <h1><span>PRÓXIMOS EVENTOS</span></h1> <h2>Confira nossa agenda</h2>'; $page .= '<div class="calendario">'; $page .= '<ul class="nav nav-tabs" role="tablist">'; $page .= $nav; $page .= '</ul>'; $page .= '<div class="tab-content">'; $page .= $data; $page .= '</div><!-- tab-content -->'; $page .= '</div><!-- calendario -->'; $page .= ' </div> </section>'; echo $page; } } public function BoxData($month, $year) { unset($data); $sql = DBRead($this->tb, "WHERE MONTH(data) = '$month' AND YEAR(data) = '$year' AND status = '1' ORDER BY data+0 ASC", "titulo, descricao, detalhes, cidade, estado, url, DATE_FORMAT(data, '%d') dia"); while($row = mysqli_fetch_object($sql)) { $mes = MesMin($month); $dia = ($row->dia == '00') ? '' : $row->dia; $data .= ' <div class="row"> <div class="col-md-2 col-6 data"> <i class="fa fa-calendar" aria-hidden="true"></i> '.$dia.' '.$mes.'<br/> <span>'.$row->hora.'</span> </div> <div class="col-md-3 col-6 local"> <i class="fa fa-map-marker" aria-hidden="true"></i> '.$row->cidade.'<br/> <span>'.$row->estado.'</span> </div> <div class="col-md-7 col-12 detalhes"> <h3>'.$row->titulo.'</h3> <p>'.$row->descricao.'</p> <a href="'.$row->url.'" target="_blank">saiba mais</a> </div> </div><!-- row -->'; } return $data; } } ?>