<?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>cate_caracteristicas</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="cate_caracteristicas_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 catop_categoria, catop_tipo, catop_label, catop_values, catop_orden FROM shoop_cate_caracteristicas ORDER BY catop_categoria LIMIT " . $start . ",25";
		$result = mysql_query($query, $conn);
		$num_results = mysql_num_rows($result);
?>
	<tr>
		<td width="90" valign="top" class="hdr">Tipo</td><td width="150" valign="top" class="hdr">Label</td><td width="300" valign="top" class="hdr">Valores</td><td width="20" valign="top" class="hdr">Orden</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);
		$catop_categoria = $row['catop_categoria'];
$catop_tipo = $row['catop_tipo'];
$catop_label = $row['catop_label'];
$catop_values = $row['catop_values'];
$catop_orden = $row['catop_orden'];

?>
	<tr>
			<td width="90" valign="top" class="data"><a href="cate_caracteristicas_show.php?id=<?php echo $catop_categoria; ?>" class="button"><?php echo $catop_tipo; ?></a></td><td width="150" valign="top" class="data"><a href="cate_caracteristicas_show.php?id=<?php echo $catop_categoria; ?>" class="button"><?php echo $catop_label; ?></a></td><td width="300" valign="top" class="data"><a href="cate_caracteristicas_show.php?id=<?php echo $catop_categoria; ?>" class="button"><?php echo $catop_values; ?></a></td><td width="20" valign="top" class="data"><a href="cate_caracteristicas_show.php?id=<?php echo $catop_categoria; ?>" class="button"><?php echo $catop_orden; ?></a></td>
<?php
			// this buttons will always be after the data
		if($op == "edit"){
?>
			<td valign="top" class="data">&nbsp;<a href="cate_caracteristicas_edit.php?op=edit&id=<?php echo $catop_categoria; ?>" class="button">[ edit ]</a>&nbsp;&nbsp;<a href="cate_caracteristicas_db.php?op=del&id=<?php echo $catop_categoria; ?>" 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>
