public function execute($dataContainer) { //No direct access defined('_WEXEC') or die("Access denied"); require_once PATH_ACCESS . '/GlobalSettingsManager.php'; require_once PATH_ACCESS . '/OrderManager.php'; require_once PATH_ACCESS . '/MealManager.php'; $smarty = $dataContainer->getSmarty(); $orderManager = new OrderManager('BabeskOrders'); $mealManager = new MealManager('BabeskMeals'); $meal = array(); $orders_existing = true; $meal_problems = false; $mealHistory = array(); try { $orders = $orderManager->getAllOrdersOfUser($_SESSION['uid'], strtotime(date('Y-m-d'))); } catch (MySQLVoidDataException $e) { $smarty->assign('error', 'Keine Bestellungen vorhanden.'); $orders_existing = false; } catch (Exception $e) { die('Error: ' . $e); } if ($orders_existing) { $today = date('Y-m-d'); $hour = date('H', time()); $this->_lastCancel = $this->lastOrdercancelDatemodGet(); foreach ($orders as $order) { try { $mealname = $mealManager->getEntryData($order['MID'], 'name'); } catch (MySQLVoidDataException $e) { $meal_problems = true; $smarty->assign('error', '<p class="error">Zu bestimmten Bestellung(-en) fehlen Daten einer Mahlzeit! Bitte benachrichtigen sie den Administrator!</p>'); continue; } if (!$order['fetched'] and $order['date'] >= $today) { //fetch last_order_time from database and compare with actual time $hour = date('H:i', time()); $cancelAllowed = $this->isAllowedToCancel($order['date']); $meal[] = array('date' => formatDate($order["date"]), 'name' => $mealname["name"], 'orderID' => $order['ID'], 'cancel' => $cancelAllowed); } else { $mealHistory[] = array('date' => formatDate($order["date"]), 'name' => $mealname["name"], 'orderID' => $order['ID'], 'cancel' => false, 'fetched' => $order['fetched']); } } } if (!count($meal) && !count($mealHistory) && !$meal_problems) { //no new meals there $smarty->assign('error', 'Keine Bestellungen vorhanden.'); } $smarty->assign('meal', $meal); $smarty->assign('mealHistory', $mealHistory); $smarty->display($this->smartyPath . 'menu.tpl'); }
public static function getInstance() { if (!self::$orderManager) { self::$orderManager = new ProductManager(); self::$orderDataStore = new BeanDataStore(Order::$className, Order::$tableName); return self::$orderManager; } return self::$orderManager; }
class OrderManager { public static function order(Order $order) { $item_dao = ItemDao::getInstance(); //1.ItemDaoインスタンスを取得し、 foreach ($order->getItems() as $order_item) { //2.在庫を引き当て、 $item_dao->setAside($order_item); } OrderDao::createOrder($order); //3.注文結果を表示する } } /* * Client */ /* TODO * 以下5行、クライアント側にコードが記述されてしまっている! * 以下のようにすると良いかも。 * 1.OrderクラスやItemDaoクラスの使用箇所は、Facadeにまとめる。 * 2.クライアント側からは、汎用的なデータ(配列など)を注文情報として渡すようにする。 */ $order = new Order(); $item_dao = ItemDao::getInstance(); $order->addItem(new OrderItem($item_dao->findById(1), 2)); $order->addItem(new OrderItem($item_dao->findById(2), 1)); $order->addItem(new OrderItem($item_dao->findById(3), 3)); //注文処理は、この1行に隠蔽される OrderManager::order($order);
<?php if (isset($_GET['page'])) { // Add item if ($_GET['page'] == 'item' && isset($_GET['id'], $_POST['add_qty'])) { $qry = intval($_POST['add_qty']); $orderManager = new OrderManager($db); $itemManager = new ItemManager($db); // Get item try { $item = $itemManager->readById($_GET['id']); } catch (Exception $e) { $errors[] = $e->getMessage(); } // Find existing basket or create new one try { $order = $orderManager->readByUser($currentUser, 0); } catch (Exception $e) { try { $order = $orderManager->create($currentUser); } catch (Exception $e) { $errors[] = $e->getMessage(); } } // Check quantity if ($item->getQuantity() < $qty) { $errors[] = 'We only have ' . $item->getQuantity() . ' of this item in stock'; } if (empty($errors)) { try { $order->updateItem($item, $qty);
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/PhotoManager.php"; include_once "./Manager/OrderManager.php"; $productMgr = new ProductManager(); $photoMgr = new PhotoManager(); $orderMgr = new OrderManager(); /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $operation = ''; $operation = filter_input(INPUT_POST, 'operation'); if ($operation === '') { $operation = $_GET['operation']; } if ($operation === "add_product") { $valid = true; $product_name = filter_input(INPUT_POST, 'product_name'); $random_no = (string) rand(0, 10000); $product_id = "AL" . $random_no; $symbol_code = filter_input(INPUT_POST, 'symbol_code'); if (empty($symbol_code)) { $symbol_code = ''; } $price = filter_input(INPUT_POST, 'price');
<?php require 'fpdf17/fpdf.php'; include 'fpdf17/php-barcode.php'; include_once "./Manager/ConnectionManager.php"; include_once "./Manager/ProductManager.php"; include_once "./Manager/CustomerManager.php"; include_once "./Manager/OrderManager.php"; include_once "./Manager/AddressManager.php"; $productMgr = new ProductManager(); $customerMgr = new CustomerManager(); $orderMgr = new OrderManager(); $addressMgr = new AddressManager(); // -------------------------------------------------- // // GET ORDER INFORMATION // -------------------------------------------------- // $order_id = implode("", $_POST); $orderList = $orderMgr->getPendingOrder(); $order = []; //var_dump($orderList); foreach ($orderList as $o) { if ($o["order_id"] === $order_id) { $order = $o; } } //$order = $orderList[$order_id]; //var_dump($order); class eFPDF extends FPDF { function TextWithRotation($x, $y, $txt, $txt_angle, $font_angle = 0) {
<div class="panel-body"> <div class="table-responsive"> <table class="table table-bordered table-hover table-striped" id="displayPendingOrder"> <thead> <tr> <th>Order ID</th> <th>Customer ID</th> <th>Total Price</th> <th>Pay Time</th> <th>Status</th> <th width="10%">Option</th> </tr> </thead> <tbody> <?php $orderMgr = new OrderManager(); $addressMgr = new AddressManager(); $pendingList = $orderMgr->getPendingOrder(); foreach ($pendingList as $pendingOrder) { $pendingOrder_id = $pendingOrder["order_id"]; $pendingOrder_customerId = $pendingOrder["customer_id"]; $pendingOrder_status = $pendingOrder["status"]; $pendingOrder_payTime = $pendingOrder["payment_time"]; $pendingOrder_totalPrice = $pendingOrder["totalPrice"]; $pendingOrder_itemList = $pendingOrder["itemList"]; $pendingOrder_address = $addressMgr->getGeneralAddress($pendingOrder_customerId, intval($pendingOrder['address_no'])); ?> <tr> <td><?php echo $pendingOrder_id; ?>
<?php /** * La classe OrderRepository è solo di esempio e non è implementata. */ $order_manager = new OrderManager(); //... $order = OrderRepository::fetchOrder(); $order_manager->write($order); //... $order_number = OrderRepository::latestOrderByUserId($user_id); $order = $order_manager->read($order_number); //... $orders = OrderRepository::findExpiredOrders(); foreach ($orders as $order) { $order_manager->remove($order->number); }
/** * Deletes old Meals and Orders (Yesterday and before) */ public function DeleteOldMealsAndOrders() { if (isset($_POST['dialogConfirmed'])) { require_once PATH_ACCESS . '/MealManager.php'; require_once PATH_ACCESS . '/OrderManager.php'; $timestamp = time(); $orderManager = new OrderManager(); try { $this->mealManager->deleteMealsBeforeDate($timestamp); $orderManager->deleteOrdersBeforeDate($timestamp); } catch (MySQLConnectionException $e) { $this->mealInterface->dieError($this->msg['err_conn_mysql']); } catch (Exception $e) { $this->mealInterface->dieError($e->getMessage()); } $this->mealInterface->dieMsg($this->msg['fin_del_meals_orders']); } else { if (isset($_POST['dialogNotConfirmed'])) { $this->mealInterface->Menu(); } else { $this->mealInterface->confirmationDialog('Wollen sie die alten Mahlzeiten und Bestellungen wirklich löschen?', 'Babesk|Meals', '4', 'Ja', 'Nein'); } } }
use PayPal\Api\RedirectUrls; include_once __DIR__ . "/../../Manager/ConnectionManager.php"; include_once __DIR__ . "/../../Manager/RewardManager.php"; include_once __DIR__ . "/../../Manager/CreditManager.php"; include_once __DIR__ . "/../../Manager/CustomerManager.php"; include_once __DIR__ . "/../../Manager/OrderManager.php"; include_once __DIR__ . "/../../Manager/ProductManager.php"; if (!isset($_SESSION)) { session_start(); } $userid = null; $userid = $_SESSION["userid"]; $rewardMgr = new RewardManager(); $creditMgr = new CreditManager(); $customerMgr = new CustomerManager(); $orderMgr = new OrderManager(); $productMgr = new ProductManager(); // ### CreditCard // A resource representing a credit card that can be // used to fund a payment. $card = new CreditCard(); //$card->setType("visa") // ->setNumber("4148529247832259") // ->setExpireMonth("11") // ->setExpireYear("2019") // ->setCvv2("012") // ->setFirstName("Joe") // ->setLastName("Shopper"); $creditcard_type = $_POST["creditcard"]; $cardHolderFN = filter_input(INPUT_POST, 'cardHolderFN'); $cardHolderLN = filter_input(INPUT_POST, 'cardHolderLN');
$description = __("You are trying to dowload more than 30 orders over the last month. You need to upgrade the ShipWorks Bridge plugin version or to pay for the last month. Please go on our site : http://www.advanced-creation.com/plugin-shipworks/. And then create a subscription with your domaine name which is currently : " . $_SERVER['HTTP_HOST']); include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'view/error.php'; } else { if (isset($_POST['start'])) { $date = htmlspecialchars($_POST['start']); $count = new Count($software, $date); include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'view/count.php'; } else { $count = new Count($software); include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'view/count.php'; } } } } else { if ('getorders' == $action) { $orderManager = new OrderManager($software, $date); if (isset($_POST['start'])) { if (!$orderManager->isFree() && !$orderManager->hasPayed() && isset($_POST['start']) && $orderManager->getFreeOrdersNumber(htmlspecialchars($_POST['start'])) > 0) { // Variable pour la vue $numberLimite = $orderManager->getFreeOrdersNumber(htmlspecialchars($_POST['start'])); } if (!$orderManager->isFree() && !$orderManager->hasPayed() && isset($_POST['start']) && $orderManager->getFreeOrdersNumber(htmlspecialchars($_POST['start'])) == 0) { $description = __("You are trying to dowload more than 30 orders over the last month. You need to upgrade the ShipWorks Bridge plugin version or to pay for the last month. Please go on our site : http://www.advanced-creation.com/plugin-shipworks/. And then create a subscription with your domaine name which is currently : " . $_SERVER['HTTP_HOST']); include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'view/error.php'; } else { $date = htmlspecialchars($_POST['start']); $orders = new Orders($software, $date); include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'view/orders.php'; } } else { $orders = new Orders($software);