Example #1
0
function createItem($type_item_id, $website_category_id, $url, $title, $width_image, $height_image, $image, $alt_image, $description, $date_publication, $author)
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $guid = substr(md5(microtime(TRUE) * 100000), 0, 5);
        $objItem = new Item($bdd, $_TABLES);
        $objItem->createItem($type_item_id, $website_category_id, $guid, $url, $title, $width_image, $height_image, $image, $alt_image, $description, $date_publication, $author);
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
if ($curl_response === false) {
    $info = curl_getinfo($curl);
    curl_close($curl);
    die('error has occurred during curl exec. Additional info: ' . var_export($info));
}
curl_close($curl);
$json_array = array();
unset($json_array);
$json_array = json_decode($curl_response, false, 512, JSON_BIGINT_AS_STRING);
if (isset($json_array->response->status) && $json->response->status == 'ERROR') {
    die('error occurred: ' . $json_array->response->errormessage);
}
foreach ($json_array as $items) {
    //echo "<pre>{$item->name}  {$item->category}  {$item->price} {$item->quantity}<br/></pre>";
    $item = new Item();
    $item->createItem($items->id, $items->name, $items->category, $items->price, $items->quantity);
    $itemList[] = $item;
}
sort($itemList);
$addItem = array();
?>

    <form action = 'viewalltoys.php' method = 'post'>
        <fieldset>
            <legend>Please click add on the toy/s you wish to purchase</legend>
            <table border="1" cellspacing='5px' cellpadding="7px">
                <tr>
                    <td><strong>Item no.</strong></td>
                    <td align="center"><strong>Item Name</strong></td>
                    <td><strong>Age Group/Category</strong></td>
                    <td><strong>Item Price</strong></td>
$json_array = json_decode($curl_response, false, 512, JSON_BIGINT_AS_STRING);
if (isset($json_array->response->status) && $json_array->response->status == 'ERROR') {
    die('error occurred: ' . $json_array->response->errormessage);
}
if (isset($_SESSION['itemsAdded'])) {
    foreach ($json_array as $items) {
        //echo "<pre>{$item->name}  {$item->category}  {$item->price} {$item->quantity}<br/></pre>";
        /*$tmp1 = "";
          $tmpIndex = 0;
          $tmp2 = 0;*/
        if (in_array($items->id, $_SESSION['itemsAdded'])) {
            $tmpIndex = array_search($items->id, $_SESSION['itemsAdded']);
            $tmpNumber = $_SESSION['amountOrdered_' . $items->id];
            $tmpTotalPrice = $items->price * $tmpNumber;
            $item = new Item();
            $item->createItem($items->id, $items->name, $items->category, $tmpTotalPrice, $tmpNumber);
            $itemList[] = $item;
        }
    }
}
?>

    <form action="ShoppingCart.php" method = "POST">
        <fieldset>
            <legend>Please note that you will only be able to checkout your Shopping Cart once Signed In</legend>
            </br>
            <table border="1" cellspacing='5px' cellpadding="7px">
                <tr>
                    <td><strong>Item no.</strong></td>
                    <td align="center"><strong>Item Name</strong></td>
                    <td><strong>Age Group/Category</strong></td>
Example #4
0
$msg = '操作成功';
global $currentUserInfo;
//$data = array();
$typeid = (int) $_REQUEST['typeid'];
$id = (int) $_REQUEST['id'];
$club = $_REQUEST['club'];
switch ($act) {
    case 'update':
        //验证登录
        $item = array('id' => $id, 'typeid' => $typeid, 'lang' => $_REQUEST['lang'], 'content' => stripslashes($_REQUEST['text']), 'title' => $_REQUEST['title'], 'itemtime' => $_REQUEST['itemtime'], 'itemcreatetime' => date('Y-m-j G:i:s'), 'operator' => $currentUserInfo['idoperator'], 'club' => $_REQUEST['club']);
        //var_dump($item['content'],$_REQUEST['text']);
        // die();
        if ($id) {
            $result = Item::updateItem($item);
        } else {
            $result = Item::createItem($item);
        }
        if ($result) {
            $data = $result;
        }
        break;
    case 'delete':
        if ($id) {
            $result = Item::deleteItem($id);
            $code = $result['code'];
            $msg = $result['msg'];
            $data = $result['data'];
        } else {
            $code = 1;
            $msg = "无效的id";
        }