<?php $ingredients = IngredientData::getAll(); $operations = ProductIngredientData::getAllByProductId($_GET["id"]); ?> <div class="content"> <h1>Ingredientes</h1> <?php if (isset($_GET["id"]) && $_GET["id"] != "") { ?> <a data-toggle="modal" href="#myModal" class="btn btn-default"><i class="glyphicon glyphicon-plus-sign"></i> Agregar Ingrediente</a> <!-- Modal --> <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-hidden="true">×</button> <h4 class="modal-title">Agregar Ingrediente</h4> </div> <div class="modal-body"> <form class="form-horizontal" method="post" action="index.php?view=addproductingredient" role="form"> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Ingrediente</label> <div class="col-lg-10"> <select name="ingredient_id" class="form-control" required> <option value="">-- INGREDIENTES -- </option> <?php foreach ($ingredients as $product) { ?>
</div> --> <h1><i class="glyphicon glyphicon-stats"></i> Inventario de Ingredientes</h1> <div class="clearfix"></div> <?php $page = 1; if (isset($_GET["page"])) { $page = $_GET["page"]; } $limit = 10; if (isset($_GET["limit"]) && $_GET["limit"] != "" && $_GET["limit"] != $limit) { $limit = $_GET["limit"]; } $products = IngredientData::getAll(); if (count($products) > 0) { if ($page == 1) { $curr_products = IngredientData::getAllByPage($products[0]->id, $limit); } else { $curr_products = IngredientData::getAllByPage($products[($page - 1) * $limit]->id, $limit); } $npaginas = floor(count($products) / $limit); $spaginas = count($products) % $limit; if ($spaginas > 0) { $npaginas++; } ?> <h3>Pagina <?php echo $page . " de " . $npaginas;