public function view() { if ($this->checkUser()) { Session::set("id", $_GET['p']); $this->redirect(array('view.php'), array('compra' => (new Compra())->findById(Session::get('id')))); } }
private function checkDates() { if (empty($_POST['txtmonto']) or !ctype_digit($_POST['txtmonto'])) { Session::set("msg", "Asegurese de ingresar el monto como nro entero"); return false; } else { if (empty($_POST['txtcuotas']) or !ctype_digit($_POST['txtcuotas'])) { Session::set("msg", "Asegurese de ingresar la cuota como nro entero"); return false; } else { if ($_POST['txtmonto'] < (new Compra())->findById(Session::get('id'))->obtenerPagoMinimo() * $_POST['txtcuotas']) { Session::set("msg", "Monto no válido.. Ingrese nuevamente el monto"); return false; } else { if ($_POST['txtcuotas'] > (new Compra())->findById(Session::get('id'))->obtenerCuotasRestantes()) { Session::set("msg", "Cantidad no válida.. Ingrese nuevamente la cantidad de cuotas"); return false; } else { if ((new Compra())->findById(Session::get('id'))->obtenerCuotasRestantes() == 0) { Session::set("msg", "Deuda Saldada.. no puede registrar más pagos"); return false; } else { return true; } } } } } }
protected function checkUser() { if (Session::get("log_in") != null and Session::get("log_in")->getRol()->getNombre() == $this->getTypeRole()) { return true; } else { Session::set("msg", "Debe loguearse como " . $this->getMessageRole() . " para acceder."); header("Location:index.php?c=main&a=index"); } }
public static function saveOrder() { $cartCollection = \Cart::getContent(); $order = new self(); $order->user_id = \Session::get('user_id'); $order->data = $cartCollection->toJson(); $order->save(); \Cart::clear(); \Session::flash('sm', 'Your order has been saved !'); }
public static function add($object, $action, $change = [], $level = self::LEVEL_INFO) { $clog = new self(); $clog->action = $action; $clog->change = $change; $clog->time = \Carbon\Carbon::now(); $clog->user()->associate(\Session::get('user')); $clog->object()->associate($object); $clog->level = $level; $clog->save(); }
public function edit() { if ($this->checkUser()) { Session::set("id", $_GET['p']); if (Session::get('id') != null && isset($_POST['btnaceptar'])) { if ($this->checkDates()) { $rol = $this->createEntity(); $id = $rol->save(); Session::set("msg", isset($id) ? "Rol Editado" : Session::get('msg')); header("Location:index.php?b=backend&c=roles&a=index"); exit; } } $this->redirect(array('edit.php'), array("rol" => (new Rol())->findById(Session::get('id')))); } }
public function edit() { if ($this->checkUser()) { Session::set("id", $_GET['p']); if (Session::get('id') != null && isset($_POST['btnaceptar'])) { if ($this->checkDates()) { $tv = $this->createEntity(); $id = $tv->save(); Session::set("msg", isset($id) ? "Tipo de Vehículos Editado" : Session::get('msg')); header("Location:index.php?b=backend&c=tiposveh&a=index"); exit; } } $this->redirect(array('edit.php'), array("tv" => (new TipoVehiculo())->findById(Session::get('id')))); } }
public function edit() { if ($this->checkUser()) { Session::set("id", $_GET['p']); Session::set('mar', isset($_POST['txtmar']) ? $_POST['txtmar'] : Session::get('mar')); $marcas = Session::get('mar') != "" ? (new Modelo())->findByMarcas(Session::get('mar')) : array(); if (Session::get('id') != null && isset($_POST['btnaceptar'])) { if ($this->checkDates()) { $modelo = $this->createEntity(); $id = $modelo->save(); Session::set("msg", isset($id) ? "Modelo Editado" : Session::get('msg')); header("Location:index.php?b=backend&c=modelos&a=index"); exit; } } $this->redirect(array('edit.php'), array("modelo" => (new Modelo())->findById(Session::get('id')), 'marcas' => $marcas)); } }
public function foto() { if ($this->checkUser()) { if (isset($_POST['btnaceptar'])) { if (isset($_FILES['foto'])) { $ruta = $this->upload->uploadImage($_FILES['foto']); if ($ruta != null) { $veh = (new Vehiculo())->findById(Session::get('id')); $veh->setFoto($ruta); $veh->saveImg(); header("Location:index.php?b=backend&c=vehiculos&a=edit&p=" . $veh->getId()); exit; } } } $this->redirect(array('foto.php'), array('vehiculo' => (new Vehiculo())->findById(Session::get('id')))); } }
public function hourlyrate() { return currency_symbol(Session::get('currency')) . ' ' . in_session_currency($this->currency, $this->rate_hourly, 3); }
public function session_currency_amount() { $amount = in_session_currency($this->currency, $this->amount, 3, $this->exchange_rate); return currency_symbol(Session::get('currency')) . ' ' . $amount; }
<h3>Editar Modelo</h3> <form method="post" action="index.php?c=modelos&a=edit&p=<?php echo \App\Session::get('id'); ?> " name="frmedit_mod"> <table> <tr> <td><label for="id">Número del Rol:</label></td> <td><input type="hidden" name="hid" value="<?php echo $modelo->getId(); ?> " /><?php echo $modelo->getId(); ?> </td> </tr> <tr> <td><label for="nom">Nombre del Modelo:</label></td> <td><input type="text" id="nom" name="txtnom" required="required" autofocus value="<?php echo $modelo->getNombre(); ?> " /></td> </tr> <tr> <td><label for="mar">Marca del Modelo:</label></td> <td> <input id="mar" list="marcas" required="required" name="txtmar" value="<?php echo $modelo->getMarca()->getId(); ?> " /> <datalist id="marcas">
"><?php echo $cliente->getNick(); ?> </option> <?php } ?> </datalist> <input type="button" onclick="frmadd_com.submit();" value="Buscar" /> </td> </tr> <tr> <td><label for="veh">Vehículo:</label></td> <td> <input id="veh" list="vehiculos" required="required" name="txtveh" value="<?php echo \App\Session::get('veh'); ?> " /> <datalist id="vehiculos"> <?php foreach ($vehiculos as $vehiculo) { ?> <option value="<?php echo $vehiculo->getId(); ?> "><?php echo $vehiculo->getMat(); ?> </option> <?php }
public function addCampaignMembership() { $relationship = new Relationship(); $relationship->source_type = 'App\\Campaign'; $relationship->source_id = \Session::get('campaign')->id; $relationship->sibling_type = $this->referenceClass; $relationship->sibling_id = $this->id; try { $relationship->save(); } catch (Exception $e) { \Log::error('Could not register ' . $this->referenceClass . ': ' . $this->id . ' with campaign ' . \Session::get('campaign')->id . ': Error message is ' . $e->getMessage()); } }
public function cons4() { if ($this->checkUser()) { $this->redirect(array('cons4.php'), array("compras" => $this->getPaginator()->paginar((new Consulta())->cons4(Session::get('log_in')->getId())), "paginador" => $this->getPaginator()->getPages())); } }
/** * @return mixed */ protected function getCartSession() { return \Session::get("sales_cart"); }
public function c4() { if ($this->checkUser()) { $compras = (new Consulta())->cons4(Session::get('log_in')->getId()); $this->getPdf()->AddPage(); $this->getPdf()->AliasNbPages(); $this->getPdf()->SetFont('Arial', 'B', 16); $this->getPdf()->Cell(40, 10, 'Mostrar Mis Compras y Pagos'); $this->getPdf()->SetFont('Arial', 'B', 12); $this->getPdf()->Ln(20); $this->getPdf()->Cell(20, 5, "Cliente: " . Session::get('log_in')->getApellido() . " " . Session::get('log_in')->getNombre()); $this->getPdf()->Ln(8); foreach ($compras as $compra) { $this->getPdf()->Cell(20, 5, "Compra: " . $compra->getId() . " Fecha: " . $compra->getFecha() . " Cuotas: " . count($compra->getPagos()) . "/" . $compra->getCuotas()); $this->getPdf()->Ln(10); $this->getPdf()->Cell(20, 5, "Pago", 'B', null, "C"); $this->getPdf()->Cell(30, 5, "Fecha de Pago", 'B', null, "C"); $this->getPdf()->Cell(40, 5, "Fecha de Venc", 'B', null, "C"); $this->getPdf()->Cell(30, 5, "Monto", 'B', null, "C"); $this->getPdf()->Ln(8); foreach ($compra->getPagos() as $pago) { $this->getPdf()->Cell(20, 5, $pago->getId(), null, null, "C"); $this->getPdf()->Cell(30, 5, $pago->getFecpago(), null, null, "C"); $this->getPdf()->Cell(40, 5, $pago->getFecvenc(), null, null, "C"); $this->getPdf()->Cell(30, 5, "\$" . $pago->getMonto(), null, null, "C"); $this->getPdf()->Ln(5); } $this->getPdf()->Ln(10); } $this->getPdf()->SetFont('Arial', 'BI', 12); // Número de página $this->getPdf()->SetY(265); $this->getPdf()->Cell(0, 10, utf8_decode('Página: ') . $this->getPdf()->PageNo(), 'T', 0, 'C'); $this->getPdf()->Output(); } }
<li><a href="index.php?c=usuarios&a=logout">Cerrar Sesión</a></li> <?php } else { ?> <li><a href="index.php?c=usuarios&a=login">Iniciar Sesión</a></li> <li><a href="index.php?c=usuarios&a=add">Registrarse</a></li> <?php } ?> </ul> </nav> </header> <section> <?php if (\App\Session::get('msg') != null) { echo \App\Session::get('msg') . "<br /><br />"; \App\Session::set('msg', ""); } echo $content; ?> </section> <footer> Copyright © <?php echo date("Y"); ?> -- Reservados todos los derechos </footer> </div> </body> </html>
public function index() { if ($this->checkUser()) { Session::set('p', isset($_GET['p']) ? $_GET['p'] : 1); Session::set('b', isset($_POST['txtbuscador']) ? $_POST['txtbuscador'] : Session::get('b')); $usuarios = Session::get('b') != "" ? $this->getPaginator()->paginar((new Usuario())->find(Session::get('b')), Session::get('p')) : array(); $this->redirect(array("index.php"), array("usuarios" => $usuarios, "paginador" => $this->getPaginator()->getPages())); } }