if ($go && isset($_SESSION["cart"])) { $cart = $_SESSION["cart"]; if (count($cart) > 0) { /* $sell = new SellData(); $sell->user_id = $_SESSION["user_id"]; $sell->total = $_POST["total"]; $sell->discount = $_POST["discount"]; $s = $sell->add(); */ foreach ($cart as $c) { $op = new OperationData(); $op->item_id = $c["item_id"]; $op->client_id = $_POST["client_id"]; $op->start_at = $_POST["start_at"]; $op->finish_at = $_POST["finish_at"]; $op->user_id = $_SESSION["user_id"]; $add = $op->add(); $item = ItemData::getById($c["item_id"]); $item->unavaiable(); unset($_SESSION["cart"]); setcookie("selled", "selled"); } //////////////////// } } if ($go) { print "<script>window.location='index.php?view=rents';</script>"; } else { print "<script>alert('Rango de fecha invalido!');</script>"; print "<script>window.location='index.php?view=rent';</script>"; }
<?php $thejson = array(); $events = OperationData::getRents(); foreach ($events as $event) { $item = ItemData::getById($event->item_id); $book = $item->getBook(); $thejson[] = array("title" => $item->code . " - " . $book->title, "url" => "", "start" => $event->start_at, "end" => $event->finish_at); } // print_r(json_encode($thejson)); ?> <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: '<?php echo date("Y-m-d"); ?> ', editable: false, eventLimit: true, // allow "more" link when too many events events: <?php echo json_encode($thejson); ?>
<?php $item = ItemData::getById($_GET["id"]); $book = BookData::getById($item->book_id); ?> <div class="row"> <div class="col-md-12"> <h1><?php echo $book->title; ?> <small>Editar Ejemplar</small></h1> <br> <form class="form-horizontal" method="post" id="addcategory" action="./index.php?action=updateitem" role="form"> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Codigo*</label> <div class="col-md-6"> <input type="text" name="code" required value="<?php echo $item->code; ?> " class="form-control" id="code" placeholder="Codigo"> </div> </div> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Status*</label> <div class="col-md-6"> <select name="status_id" class="form-control"> <?php foreach (StatusData::getAll() as $p) { ?>
public function getItem() { return ItemData::getById($this->item_id); }
<?php if ($_SESSION["user_id"] != "") { $operation = OperationData::getById($_GET["id"]); $item = ItemData::getById($operation->item_id); $item->avaiable(); $operation->del(); Core::redir("./?view=rents"); }
<?php if (count($_POST) > 0) { $user = ItemData::getById($_POST["item_id"]); $user->code = $_POST["code"]; $user->status_id = $_POST["status_id"]; $user->update(); print "<script>window.location='index.php?view=items&id={$user->book_id}';</script>"; }