예제 #1
0
    require_once '../bootstrap.php';
    require_once '../vendor/autoload.php';
    require_once '../Persistance/OrderDaoImp.php';
    require_once '../Persistance/OrderBookDaoImp.php';
    require_once '../Model/Client.php';
} else {
    $root = $_SERVER['DOCUMENT_ROOT'];
    require_once $root . '/phoenix/Project/bootstrap.php';
    require_once $root . '/phoenix/Project/vendor/autoload.php';
    require_once $root . '/phoenix/Project/Persistance/OrderDaoImp.php';
    require_once $root . '/phoenix/Project/Persistance/OrderBookDaoImp.php';
    require_once $root . '/phoenix/Project/vendor/autoload.php';
    require_once $root . '/phoenix/Project/Model/Client.php';
    $odi = new OrderDaoImp($entityManager);
    $cdi = new ClientDaoImp($entityManager);
    $obi = new OrderBookDaoImp($entityManager);
    if (isset($_POST['action'])) {
        $see = array();
        $seeall = array();
        $ffinale = array();
        $tmp = array();
        $tmpp = array();
        if (strcmp(trim($_POST['action']), 'edit') == 0) {
            $orderId = intval(trim($_POST['id']));
            $orderDate = new DateTime(trim($_POST['data']['orders']['Order Date']));
            $orderValid = trim($_POST['data']['orders']['Valid']);
            $clientId = intval(trim($_POST['data']['orders']['Client Id']));
            $orderBookId = trim($_POST['data']['orders']['Order Book Id']);
            $order = $odi->getOrderById($orderId);
            $client = $cdi->getClientById($clientId);
            if ($order !== null) {
예제 #2
0
                 foreach ($order->getOrderBook() as $orderbook) {
                     $array["Order Id"] = $order->getId();
                     $array["Order Date"] = $order->getDate()->format('d/m/Y');
                     $array["Valid"] = $order->getValid();
                     $array["Client Id"] = $order->getClient()->getId();
                     $array["Client Name"] = $order->getClient()->getName();
                     $array["Order Book Id"] = $orderbook->getId();
                     $final[] = $array;
                 }
             }
         }
     }
     echo json_encode(array('flag' => true, 'data' => $final));
 } else {
     if (strcmp(trim($_POST['action']), 'ids') == 0) {
         $obdi = new OrderBookDaoImp($entityManager);
         $array = array();
         foreach ($obdi->getAllOrderBooks() as $orderbook) {
             $array[] = $orderbook->getId();
         }
         echo json_encode(array('flag' => true, 'data' => $array));
     } else {
         if (strcmp(trim($_POST['action']), 'updateOrder') == 0) {
             $odi = new OrderDaoImp($entityManager);
             $order = $odi->getOrderById(intval(trim($_POST['id'])));
             if ($order != null) {
                 $order->setOrderDate(new DateTime(trim($_POST['date'])));
                 if (strcmp(trim($_POST['valid']), 'true') == 0) {
                     $order->setValid(true);
                 } else {
                     $order->setValid(false);