$order = json_decode($_POST['order']); foreach ($order as $value) { $message .= json_encode($value) . "\n"; } $message .= "\n"; $student = $order[0]; //banner, fname, lname, email, phone $result = makeStudent($student[0], $student[1], $student[2], $student[3], $student[4]); $message .= "Student: " . json_encode($student) . "\n"; $message .= "Insert Status: " . ($result ? "Success" : "Failure") . "\n\n"; $workerId = getLeastBusyWorker(); //If count is more than 5, then we also have a hallId. Otherwise we will not insert a hallId if (count($student) > 5) { $orderId = makeOrder($student[0], $workerId, $student[5]); } else { $orderId = makeOrder($student[0], $workerId); } if ($orderId == -2) { respond(1); } $message .= "Order: Insert: " . ($orderId != -1 ? "Success, Id: {$orderId}" : "Failure") . "\n"; $message .= "WorkerId: {$workerId}\n\n"; $order = array_slice($order, 1); //Removes the student array order[0] from order. Moves all indexes forward. foreach ($order as $detail) { switch ($detail[0]) { case 0: //Custom Pizza $pizzaId = makeCustomPizza($detail[3], $detail[2]); //Size, ToppingArray makeOrderDetailPizza($orderId, $detail[1], $pizzaId);
<td>' . $shop_offer_description . '</td></tr><br> <tr><td align="center" ><b>Offer Name:</b></td> <td>' . $shop_offer_name . '</td></tr> <br><form action="?subtopic=shopadmin&action=addoffer" method="post" ><input name="submit" type="submit" value="Back" title="Back"/></form>'; } } if ($action == "viewoffer") { $items = simplexml_load_file($config['site']['server_path'] . '/data/items/items.xml') or die('<b>Could not load items!</b>'); foreach ($items->item as $v) { $itemList[(int) $v['id']] = $v['name']; } $order = array("id" => "id", "points" => "points", "offer_type" => "offer_type", "itemid1" => "itemid1", "itemid2" => "itemid2"); $main_content .= '<center><table width="550"><tr BGCOLOR="#505050"><td width="5"><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'id') . '" class=white>ID:</td><td width="5"><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'points') . '" class=white>Points:</td><td width="7"> <font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'itemid1') . '" class=white>Item ID:</td><td width="5"><font color="white">Count:</td><td width="7"><center><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'itemid2') . '" class=white>Container ID:</center></td><td width="5"><font color="white">Count:</td><td width="7"><font color="white"><a href="index.php?subtopic=shopadmin&action=viewoffer&order=' . getOrder($order, 'order', 'offer_type') . '" class=white>Offer Type:</td> <td width="85"><font color="white">Offer Description:</td><td width="30"><font color="white">Offer Name:</td><td width="30"></td></tr>'; $shopoffers = $SQL->query('SELECT id, points, itemid1, count1, itemid2, count2, offer_type, offer_description, offer_name, pid FROM z_shop_offer ' . makeOrder($order, 'order', 'id')); foreach ($shopoffers as $shop) { $main_content .= '</B><tr BGCOLOR="#D4C0A1"><td align="center">' . $shop['id'] . '<td align="center">' . $shop['points'] . '</td>'; if ($shop['itemid1'] == "0") { $main_content .= '<td align="center">' . $shop['itemid1'] . '<br></td>'; } else { $main_content .= '<td align="center">' . $shop['itemid1'] . '<br>(' . $itemList[(int) $shop['itemid1']] . ')</td>'; } $main_content .= '<td align="center">' . $shop['count1'] . '</td>'; if ($shop['itemid2'] == "0") { $main_content .= '<td align="center">' . $shop['itemid2'] . '</td>'; } else { $main_content .= '<td align="center">' . $shop['itemid2'] . '<br>(' . $itemList[(int) $shop['itemid2']] . ')</td>'; } $main_content .= '<td align="center">' . $shop['count2'] . '</td><td align="center">' . $shop['offer_type'] . '</td><td align="left">' . $shop['offer_description'] . '</td><td align="left">' . $shop['offer_name'] . '</td>'; $main_content .= '<td align="center"><a href="?subtopic=shopadmin&action=editoffer&id=' . $shop['id'] . '"><img src="' . $layout_name . '/images/news/edit_news.png" border="0"></a><br><br><a href="?subtopic=shopadmin&action=deleteoffer&id=' . $shop['id'] . '"><img src="' . $layout_name . '/images/news/delete_news.png" border="0"></a></td>';
$quantity_pizza_2 = 4; $quantity_pizza_3 = 2; $items = array(2, 4, 6); //Cheese Bread (12in), Cinnamon Knots, Ranch $quantity_item_1 = 2; $quantity_item_2 = 1; $quantity_item_3 = 3; //Create a student entry // bannerId FirstName LastName Email PhoneNumber $student = makeStudent($studentId, $studentInfo[0], $studentInfo[1], $studentInfo[2], $studentInfo[3]); echo "Creating student. Result: " . ($student ? "Success" : "Failure"); echo "<br>"; //Create an Order for Pickup. //If deliver, call like: $orderId = makeOrder($studentId, $hallId, $workerId); // bannerId $orderId = makeOrder($studentId, $workerId, $studentHall); echo "Creating order. Result: " . ($orderId != -1 ? "Success (id: {$orderId})" : "Failure") . "<br>"; //echo "Creating order. Result: " . ($orderId ? "Success" : "Failure"); echo "<br>"; //Insert 3 custom pizzas and their toppings (as defined in the topping arrays above) echo "Inserting Custom Pizzas...<br>"; $pizza_1 = makeCustomPizza(1, $toppingIds_pizza_1); //size(0= medium, 1=large) toppingId array $pizza_2 = makeCustomPizza(0, $toppingIds_pizza_2); $pizza_3 = makeCustomPizza(1, $toppingIds_pizza_3); echo "Pizza 1. result: " . ($pizza_1 != -1 ? "Success (id: {$pizza_1})" : "Failure") . "<br>"; echo "Pizza 2. result: " . ($pizza_2 != -1 ? "Success (id: {$pizza_2})" : "Failure") . "<br>"; echo "Pizza 3. result: " . ($pizza_3 != -1 ? "Success (id: {$pizza_3})" : "Failure") . "<br>"; echo "<br>"; //Create Order_Details for these 3 pizzas to connect them to the order echo "Making Details for the Pizzas<br>";