<?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 = CutData::getAll(); if (count($products) > 0) { if ($page == 1) { $curr_products = CutData::getAllByPage($products[0]->id, $limit); } else { $curr_products = CutData::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; ?> </h3> <div class="btn-group pull-right"> <?php $px = $page - 1;
<?php $current = CutData::getCurrent(); if ($current != null) { $current->update(); } print "<script>window.location='index.php?view=cuts';</script>";
<?php $current = CutData::getCurrent(); if ($current == null) { $cut = new CutData(); $cut->add(); } else { setcookie("cut", "therecurrent"); } print "<script>window.location='index.php?view=cuts';</script>";