<?php
$tabla = "olga_users";
$columnas = array(//las columnas de la tabla en el orden que las quieres, tipo, obligatorio y si pueden repetirse
//	array("id","number","required","unique"),//color,text,number,etc... o imagen, block o select:op1,op2,...
	array("tipo","select:admin,ventas,asistente","required",""),
	array("nombre","text","required",""),
	array("email","email","required","unique"),
	array("pwd","password","required",""),
//	array("imagen","imagen","",""),
//	array("Ver pedidos","meta","./pedidos.php?id=","email"),//cuando es meta en vez de required pones el link
);

include_once "./Configs.php"; ?>
<!DOCTYPE html>
<html lang="es">
<?php
$titulo="Usuarios";    	
include_once "./Head.php"; ?>
<body class="page-sidebar-collapsed">
<!-- Page Container -->
	<div class="page-container">
<!-- Page Sidebar -->
<?php echo $menu;?>		
<!-- Page Content -->
		<div class="page-content">
<!-- Page Header -->
<?php include_once "./Header.php"; ?>
<!-- Page Inner -->
			<div class="page-inner">
<!-- Lo que realmente se va a sacar con código-->
<div id="main-wrapper">

<h3 class="breadcrumb-header"><?php echo $titulo;?></h3>
<p class="panel-title">
Puede editar la lista de usuarios, sus datos y perfiles.<br>
</p>

<div class="panel-heading">
<?php 
echo $warning;
?>
</div>

<div class="panel-body">
	<button type="button" class="btn btn-success m-b-sm" data-toggle="modal" data-target="#myModal">Nuevo</button><br><br>
	<!-- Modal -->
	<form method="post" enctype="multipart/form-data">
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">Crear nuevo</h4>
				</div>
				<div class="modal-body">
<?php 
echo salvartabla($columnas);
?>				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
					<button type="submit" class="btn btn-success" name="botonnuevo">Guardar</button>
				</div>
			</div>
		</div>
	</div>
	</form>
	<form method="post" enctype="multipart/form-data">
	<div class="table-responsive">
		<table id="example3" class="display table" style="width: 100%; cellspacing: 0;">
<?php 
$sql="SELECT * FROM ".$tabla." ORDER BY id ASC; "; 
echo echotabla($columnas,$sql,$link);
?>		</table>
		</div>
		</form>
	</div>
	
	

</div><!-- Main Wrapper -->
				<div class="page-footer">
<?php  include_once "./Footer.php"; ?>
				</div>
			</div><!-- /Page Inner -->
		</div><!-- /Page Content -->
	</div><!-- /Page Container -->
</body>
</html>