<?php require_once('Connections/conn_sustentabilidade.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_lista_evento = "-1";
if (isset($_GET['id_tipo'])) {
  $colname_lista_evento = $_GET['id_tipo'];
}
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$query_lista_evento = sprintf("SELECT * FROM vw_tbeventos WHERE tipo_evento = %s ORDER BY nome_evento ASC", GetSQLValueString($colname_lista_evento, "int"));
$lista_evento = mysql_query($query_lista_evento, $conn_sustentabilidade) or die(mysql_error());
$row_lista_evento = mysql_fetch_assoc($lista_evento);
$totalRows_lista_evento = mysql_num_rows($lista_evento);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Sustentaitapê</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/estilo.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="css/favicon.ico" />
<link rel="stylesheet" href="css/font-face/stylesheet.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
	<div class="modal-open">
	<?php include ('contato.php');?>
	<?php include ('sobre.php');?>
		
	</div>
	<nav class="navbar navbar-fixed-top navbar-inverse navbar-transparente">
		<?php include ('menu.php');?>
	</nav>
	<section class="container main" style="margin-top: 80px;">
			<h1><?php echo $row_lista_evento['rotulo_tipo']; ?></h1>
			<section class="container-fluid">
			  <section class="row">
				<?php do { ?>
				<section class="col-xs-12 col-md-6 col-sm-6 thumbnail">
					<section class="col-md-12">
					  <img src="imagens/<?php echo $row_lista_evento['imagem_evento']?>" class="img-responsive img-thumbnail" alt="Imagem do Evento" style="max-height: 100%">
					  </section>
					<section class="col-md-12">
					  <h4><?php echo $row_lista_evento['rotulo_tipo']?></h4>
					  <p>Público: <?php echo $row_lista_evento['publico_evento']?></p>
					  <p><?php echo mb_strimwidth($row_lista_evento['descr_evento'],0,55,"...")?></p>
					  <p class="text-right">
						  <a href="eventos_detalhe.php?id_evento=<?php echo $row_lista_evento['id_evento'];?>" class="btn btn-default">Veja mais!</a>
					  </p>
					</section>
				</section>
				<?php } while ($row_lista_evento = mysql_fetch_assoc($lista_evento)); ?>
			  </section>
			</section>
		</section>
	<footer><?php include 'rodape.php';?></footer>
	<!-- Jquery (obrigatório para plugin JS do Bootstrap) -->
	<script src="bootstrap/jquery.min.js"></script>

	<!-- Plugin JS-->
	<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
<?php
mysql_free_result($lista_evento);
?>
</html>