예제 #1
0
        //         'date' => $p->deposits["date"],
        //          'status' => $p->deposits["status"]
        //     );
        // }
        $data[] = array('product_id' => $products['id'], 'product_name' => $products['name'], 'product_category' => $products['category'], 'product_brand' => $products['brand'], 'product_applicationarea' => $products['applicationarea'], 'product_image' => $products['image'], 'product_finish' => $products['finish'], 'product_size' => $products['size'], 'product_url' => $products['productpageurl']);
    }
    $products = array('aaData' => array('data' => $data, 'totalresults' => $count));
    $app->response()->header('content-type', 'application/json');
    echo json_encode($products);
});
$app->get('/sellers(/:id)', function ($id = null) use($app, $db) {
    $tenants_deposits = array();
    if ($id == null) {
        $data = array();
        $count = 0;
        foreach ($db->sellers() as $tenants) {
            $allp = $db->sellers_products()->where('sellers_id', $tenants['id']);
            $countall = count($allp);
            // $days   = days($tenants['entry_date']);
            //  $dthdays = days($houses['house_rent_due_date']);
            //  foreach ($houses->sellers_tenants() as $p) {
            //      $count++;
            //         $houses_tenants[] = array('name'=>$p->tenants["name"],
            //          'phone'=>$p->tenants["phone"]);
            // }
            $data[] = array('id' => $tenants['id'], 'address' => $tenants['address'], 'name' => $tenants['name'], 'phone' => $tenants['phone'], 'storename' => $tenants['storename'], 'comments' => $tenants['comments'], 'noofproducts' => $countall);
        }
    } else {
        $data = null;
        $houses_tenants = array();
        if ($tenants = $db->sellers()->where('id', $id)->fetch()) {
예제 #2
0
});
//   --------------------------
$app->post('/shiningfloor/sellers_products', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    // echo $array;
    $data = $db->sellers_products()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
    // echo json_encode($array);
});
// --------- Seller Info -------------
$app->get('/shiningfloor/sellers(/:id)', function ($id = null) use($app, $db) {
    if ($id == null) {
        $data = array();
        $count = 0;
        foreach ($db->sellers() as $seller) {
            $allp = $db->sellers_products()->where('sellers_id', $seller['id']);
            $countall = count($allp);
            $data[] = array('id' => $seller['id'], 'address' => $seller['address'], 'name' => $seller['name'], 'phone' => $seller['phone'], 'storename' => $seller['storename'], 'comments' => $seller['comments'], 'noofproducts' => $countall);
        }
    } else {
        $data = null;
        if ($seller = $db->sellers()->where('id', $id)->fetch()) {
            $allp = $db->sellers_products()->where('sellers_id', $id);
            $countall = count($allp);
            $data = array('id' => $seller['id'], 'address' => $seller['address'], 'name' => $seller['name'], 'phone' => $seller['phone'], 'storename' => $seller['storename'], 'comments' => $seller['comments'], 'noofproducts' => $countall);
        }
    }
    $seller = array('aaData' => $data);
    $app->response()->header('content-type', 'application/json');
    echo json_encode($seller);
예제 #3
0
        }
    }
});
//   --------------------------
$app->post('/shiningfloor/sellers_products', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->sellers_products()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
});
// --------- Seller Info -------------
$app->get('/shiningfloor/sellers(/:id)', $authenticate_admin($app), function ($id = null) use($app, $db) {
    if ($id == null) {
        $data = array();
        $count = 0;
        foreach ($db->sellers() as $seller) {
            $allp = $db->sellers_products()->where('sellers_id', $seller['id']);
            $countall = count($allp);
            $data[] = array('id' => $seller['id'], 'address' => $seller['address'], 'name' => $seller['name'], 'email' => $seller['email'], 'phone' => $seller['phone'], 'storename' => $seller['storename'], 'comments' => $seller['comments'], 'noofproducts' => $countall);
        }
    } else {
        $data = null;
        if ($seller = $db->sellers()->where('id', $id)->fetch()) {
            $allp = $db->sellers_products()->where('sellers_id', $id);
            $countall = count($allp);
            $data = array('id' => $seller['id'], 'address' => $seller['address'], 'name' => $seller['name'], 'email' => $seller['email'], 'phone' => $seller['phone'], 'storename' => $seller['storename'], 'comments' => $seller['comments'], 'noofproducts' => $countall);
        }
    }
    $seller = array('seller_data' => $data);
    $app->response()->header('content-type', 'application/json');
    echo json_encode($seller);