<?php
session_start();

if (!session_is_registered("clave_audio")) {
	include("../login.php");
	if (!$continuar) exit;
}

include('../db.php');

if(isset($_REQUEST['op'])) {
	$op = $_REQUEST['op'];
} else {
	$op = "list";
}

// this code is for the "paginator"
$start = (isset($$_REQUEST['start']) ? $$_REQUEST['start'] : 0);
$limit = 25;
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>secciones</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- CONTENT -->
<?php
	if($op == "edit"){
?>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr><td><a href="secciones_edit.php?op=add" class="button">[ add a new record ]</a></td></tr>
		<tr><td><img src="img/d.gif" width="200" height="5"></td></tr>
	</table>

<?php
	}
?>

<table border="0" cellspacing="0" cellpadding="0">
<?php
//	include("../login.php");
//	if (!$continuar) exit;

	$conn = db_connect();
	if($conn) {
		$query = "SELECT seccion_id, seccion_orden, seccion_orden, seccion_nombre, seccion_descripcion, seccion_code FROM shoop_secciones ORDER BY seccion_id, seccion_orden LIMIT " . $start . ",25";
		$result = mysql_query($query, $conn);
		$num_results = mysql_num_rows($result);
?>
	<tr>
		<td width="30" valign="top" class="hdr">Orden</td><td width="200" valign="top" class="hdr">Nombre</td><td width="500" valign="top" class="hdr">Descripcion</td><td width="50" valign="top" class="hdr">Seccion Code</td>
<?php
			// this buttons will always be after the data
	if($op == "edit"){
?>
		<td></td>
<?php
	}
?>
	</tr>
<?php
	for ($i=0; $i <$num_results; $i++)
	{
		$row = mysql_fetch_array($result);
		$seccion_id = $row['seccion_id'];
$seccion_orden = $row['seccion_orden'];
$seccion_orden = $row['seccion_orden'];
$seccion_nombre = $row['seccion_nombre'];
$seccion_descripcion = $row['seccion_descripcion'];
$seccion_code = $row['seccion_code'];

?>
	<tr>
			<td width="30" valign="top" class="data"><a href="secciones_show.php?id=<?php echo $seccion_id; ?>" class="button"><?php echo $seccion_orden; ?></a></td><td width="200" valign="top" class="data"><a href="secciones_show.php?id=<?php echo $seccion_id; ?>" class="button"><?php echo $seccion_nombre; ?></a></td><td width="500" valign="top" class="data"><a href="secciones_show.php?id=<?php echo $seccion_id; ?>" class="button"><?php echo $seccion_descripcion; ?></a></td><td width="50" valign="top" class="data"><a href="secciones_show.php?id=<?php echo $seccion_id; ?>" class="button"><?php echo $seccion_code; ?></a></td>
<?php
			// this buttons will always be after the data
		if($op == "edit"){
?>
			<td valign="top" class="data">&nbsp;<a href="secciones_edit.php?op=edit&id=<?php echo $seccion_id; ?>" class="button">[ edit ]</a>&nbsp;&nbsp;<a href="secciones_db.php?op=del&id=<?php echo $seccion_id; ?>" class="button">[ delete ]</a></td>
<?php
		}	
?>	
	</tr>
	<tr>
<?php
			if($op == "edit") {
?>
		<td bgcolor="#DBDEE6" colspan=5><img src="img/d.gif" width="5" height="1"></td>
<?php
			} else {
?>
		<td bgcolor="#DBDEE6" colspan=4><img src="img/d.gif" width="5" height="1"></td>
<?php
			}
?>
	</tr>
<?php
		}	// FOR
	} else {	// IF CONN
		echo '<p>An error has occurred while accessing the database: ' . mysql_error();
	}	 
?>
</table>
<?php
	// do we need to paginate the result?
	if($num_results > $limit) {
	
	}
?>
<!-- EOF CONTENT -->

<?php
	if($op == "edit"){
?>
	<table border="0" cellspacing="0" cellpadding="0">
		<tr><td></td></tr>
		<tr><td><img src="img/d.gif" width="200" height="5"></td></tr>
	</table>

<?php
	}
?>
<!-- END OF CONTENT -->
</body>
</html>
