Example #1
0
function getOrders($companyID)
{
    global $conn;
    if ($stmtOrders = $conn->prepare("SELECT o.`orde_id`, o.`Users_user_id`, o.`orde_price`, o.`orde_status`, o.`orde_stars`, o.`orde_address`, ohp.`Products_prod_id`, p.`prod_description`, p.`prod_price`, u.`user_name` FROM orders o, orders_has_products ohp, products p, users u WHERE o.`Companies_comp_id`=? AND ohp.`Orders_orde_id`=o.`orde_id` AND p.`prod_id`=ohp.`Products_prod_id` AND u.`user_id`=o.`Users_user_id` ORDER BY o.`orde_id` DESC")) {
        $stmtOrders->bind_param("i", $companyID);
        $stmtOrders->execute();
        $stmtOrders->bind_result($orderID, $orderUserID, $orderPrice, $orderStatus, $orderStars, $orderAddress, $productID, $productDescription, $productPrice, $userName);
        $stmtOrders->store_result();
        while ($stmtOrders->fetch()) {
            $statusClass = getStatusClass($orderStatus);
            $orderStatus = getStatus($orderStatus);
            $orderStars = getStars($orderStars);
            echo "<tr class=\"{$statusClass}\">\n\n            <td>{$orderID}</td>\n\n            <td class=\"text-center\">{$userName}</td>\n\n            <td>{$productDescription}</td>\n\n            <td class=\"text-center\">" . $orderPrice / $productPrice . "</td>\n\n            <td class=\"text-right\">R\$ " . number_format($orderPrice, 2, ',', ' ') . "</td>\n\n            <td class=\"text-center\">{$orderStatus}</td>\n\n            <td class=\"text-center\">{$orderStars}</td>\n\n            <td>{$orderAddress}</td>\n\n            <td class=\"text-center\"><a class=\"btn btn-primary btn-xs\" href=\"../../controllers/sendOrder.php?order={$orderID}\" role=\"button\" data-toggle=\"modal\" data-target=\"#order\">Enviar</a></td>\n\n            </tr>";
        }
    } else {
        echo "Falha na conexão: " . $conn->error;
    }
}
Example #2
0
function getOrders($userID)
{
    global $conn;
    if ($stmtOrders = $conn->prepare("SELECT o.`orde_id`, o.`Companies_comp_id`, o.`orde_price`, o.`orde_status`, o.`orde_stars`, o.`orde_address`, ohp.`Products_prod_id`, p.`prod_description`, p.`prod_price`, c.`comp_name` FROM orders o, orders_has_products ohp, products p, companies c WHERE o.`Users_user_id`=? AND ohp.`Orders_orde_id`=o.`orde_id` AND p.`prod_id`=ohp.`Products_prod_id` AND c.`comp_id`=o.`Companies_comp_id` ORDER BY o.`orde_id` DESC")) {
        $stmtOrders->bind_param("i", $userID);
        $stmtOrders->execute();
        $stmtOrders->bind_result($orderID, $orderCompanyID, $orderPrice, $orderStatus, $orderStars, $orderAddress, $productID, $productDescription, $productPrice, $compName);
        $stmtOrders->store_result();
        while ($stmtOrders->fetch()) {
            $showReceiveOption = $orderStatus;
            $statusClass = getStatusClass($orderStatus);
            $orderStatus = getStatus($orderStatus);
            $orderStars = getStars($orderStars);
            echo "<tr class=\"{$statusClass}\">\n\n            <td>{$compName}</td>\n\n            <td class=\"text-center\">{$orderID}</td>\n\n            <td>{$productDescription}</td>\n\n            <td class=\"text-center\">" . $orderPrice / $productPrice . "</td>\n\n            <td class=\"text-right\">R\$ " . number_format($orderPrice, 2, ',', ' ') . "</td>\n\n            <td class=\"text-center\">{$orderStatus}</td>\n\n            <td class=\"text-center\">{$orderStars}</td>\n\n            <td>{$orderAddress}</td>\n";
            echo getOption($showReceiveOption, $orderID);
            echo "</tr>";
        }
    } else {
        echo "Falha na conexão: " . $conn->error;
    }
}
		</section>
<!-- Top books -->
		<?php 
$topbooks = getBook(1, 'tag', 7, 'stars');
if (!empty($topbooks['book'][0]['id'])) {
    ?>
		<section class="readingsoon">
			<h1>Top books</h1>
			<ol>
				<?php 
    foreach ($topbooks['book'] as $book) {
        if ($book['status'][0]['id'] == "3") {
            ?>
							<li>
								<?php 
            echo getStars($book['review'][0]['stars']);
            ?>
								<a href="book.php?id=<?php 
            echo $book['id'];
            ?>
">
									<img class="coverimagerhn" src="<?php 
            echo $book['image'][0]['uri'];
            ?>
" alt="<?php 
            echo $book['title'];
            ?>
">
								</a>
							</li>
							<?php