Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
No commit message
  • Loading branch information
Josh authored and Josh committed Nov 29, 2016
1 parent 8740ed6 commit 20a01d2
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 20 deletions.
49 changes: 45 additions & 4 deletions commonFunctions.php
@@ -1,4 +1,35 @@
<?php
function writeMenuEmp($curPage){
$menuItems = array(
"eDashboard.php" => array("Home",""),
"eOrdersToFill.php" => array("Active Orders",""),
"eEditProducts.php" => array("Search/Edit Products",""),
"eEditCategories.php" => array("Edit Categories",""),
"eReviewCustomerDemographics.php" => array("Review Customer Information",""),
"logout.php" => array("Log Out","class='fRight'")
);
$menuItems[$curPage][1] = "class='active'";

echo "<ul id='menu' class='blue'>";
foreach($menuItems as $page => $pageArgs) {
echo "<li " . $pageArgs[1] . "><a href='" . $page . "'>" . $pageArgs[0] . "</a></li>";
}
echo "</ul>";

/* echo "
<ul id='menu' class='blue'>
<li><a href='eDashboard.php'>Home</a></li>
<li class='active'><a href='eOrdersToFill.php'>Active Orders</a></li>
<li><a href='eEditProducts.php'>Search/Edit Products</a></li>
<li><a href='eEditCategories.php'>Edit Categories</a></li>
<li><a href='eReviewCustomerDemographics.php'>Review Customer Information</a></li>
<li class='fRight'><a href='logout.php'>Log Out</a></li>
</ul>
";
*/
}

function orderCustomer($orderID) { //Get the customerID of the whomever placed this order
global $con;
$sql = "SELECT CustomerID from orders WHERE OrderID=" . $orderID;
Expand Down Expand Up @@ -164,11 +195,11 @@ function loadPicture($blob, $widthPercent=100){
echo '<img src="data:image/jpeg;base64,'.base64_encode($blob).'" width=' . $widthPercent . '%/>';
}

function makeTable($result, $trArgs="") {
function makeTable($result, $trArgs=array("",array("" => ""))) {
$result->fetch_array( MYSQLI_ASSOC );
echo "<table id='niceTable'>";
tableHead( $result );
tableBody( $result, $trArgs="" );
tableBody( $result, $trArgs);
echo '</table>';
}

Expand All @@ -185,10 +216,20 @@ function tableHead($result) {
echo '</thead>';
}

function tableBody($result, $trArgs="") {
function tableBody($result, $trArgs) {
echo '<tbody>';
// onclick=\"window.document.location='cViewOrder.php?orderID=" . $row['orderID']
// onclick=\"window.document.location='cViewOrder.php?orderID=%orderID%

foreach ($result as $x) {
echo '<tr ' . $trArgs . '>';
$trArgsS = $trArgs[0];
if ($trArgsS <> ""){
foreach($trArgs[1] as $sString => $varID) { //Replace each search string given in $trArgs with actual value
$trArgsS = str_replace($sString, $x[$varID], $trArgsS);
}
}
echo $trArgsS . " ";
echo '<tr ' . $trArgsS . '>';
foreach ($x as $y) {
echo '<td>' . $y . '</td>';
}
Expand Down
3 changes: 2 additions & 1 deletion customerPages/cCart.php
Expand Up @@ -97,7 +97,8 @@ if(!isset($_SESSION['RequiredBy']) || !isset($_SESSION['PaymentType'])){
<form action = "cCart_save.php" method = "POST">
<?php
// echo "Welcome " . EXPLODE(" ",$ContactName)[0] . "!";
$_SESSION['confirmationCode'] = $random_hash = substr(md5(uniqid(rand(), true)), 8, 24);
// $_SESSION['confirmationCode'] = $random_hash = substr(md5(uniqid(rand(), true)), 8, 24);
$_SESSION['confirmationCode'] = uniqid();
$_SESSION['fqPayment'] = " INSERT INTO payment (OrderID, Total, PaymentTypeID, ConfNum) VALUES (" .
"(SELECT MAX(OrderID) FROM orders), " .
$_SESSION['TotalDue'] . ", " .
Expand Down
3 changes: 3 additions & 0 deletions employeePages/eDashboard.php
Expand Up @@ -22,6 +22,8 @@ if ($row) {
</head>
<body>
<div id="header">
<?php writeMenuEmp(basename($_SERVER['PHP_SELF'])); ?>
<!--
<ul id="menu" class="blue">
<li class="active"><a href="eDashboard.php">Home</a></li>
<li><a href="eOrdersToFill.php">Active Orders</a></li>
Expand All @@ -31,6 +33,7 @@ if ($row) {
<li class='fRight'><a href="logout.php">Log Out</a></li>
</ul>
-->
</div>
<div id='contentwrapper'>
<h1>
Expand Down
24 changes: 9 additions & 15 deletions employeePages/eOrdersToFill.php
Expand Up @@ -21,27 +21,21 @@ if ($row) {
</head>
<body>
<div id="header">
<ul id="menu" class="blue">
<li><a href="eDashboard.php">Home</a></li>
<li class="active"><a href="eOrdersToFill.php">Active Orders</a></li>
<li><a href="eEditProducts.php">Search/Edit Products</a></li>
<li><a href="eEditCategories.php">Edit Categories</a></li>
<li><a href="eReviewCustomerDemographics.php">Review Customer Information</a></li>

<li class='fRight'><a href="logout.php">Log Out</a></li>
</ul>
<?php writeMenuEmp(basename($_SERVER['PHP_SELF'])); ?>
</div>
<div id='contentwrapper'>
<h1>Active orders</h1>
<hr>
<?php
$sql = "SELECT * FROM northwind.`orders qry` WHERE EmployeeID is null ORDER BY RequiredDate ASC;";
if (!$result = $con->query($sql)){}
makeTable($result);
$sql = "SELECT * FROM northwind.`orders qry` WHERE EmployeeID is null ORDER BY RequiredDate ASC;";
if (!$result = $con->query($sql)){}


$trArgs = array("onclick=\"window.document.location='eViewOrder.php?orderID=%OrderID%'\"",
array('%OrderID%' => 'OrderID')
);
makeTable($result, $trArgs);
?>
</div>
</body>



</html>
28 changes: 28 additions & 0 deletions employeePages/eViewOrder.php
@@ -0,0 +1,28 @@
<?php
require("../dbCon.php");
require("../commonFunctions.php");

$orderID = $_GET['orderID'];
//echo "Welcome " . $_SESSION["userName"] . "!";
?>

<html>
<head>
<link rel="stylesheet" href="../style.css">
</head>
<body>
<div id="header">
<?php writeMenuEmp('eOrdersToFill.php'); ?>
</div>
<div id='contentwrapper'>
<?php
displayOrders(0, $orderID);
echo "<hr>";
displayOrderDetails($orderID);
?>
</div>
</body>



</html>
29 changes: 29 additions & 0 deletions employeePages/eViewProduct.php
@@ -0,0 +1,29 @@
<?php
require("../dbCon.php");
require("../commonFunctions.php");

$productID = $_GET['productID'];
//echo "Welcome " . $_SESSION["userName"] . "!";
?>

<html>
<head>
<link rel="stylesheet" href="../style.css">
</head>
<body>
<div id="header">
<?php writeMenuEmp('eOrdersToFill.php'); ?>
</div>
<div id='contentwrapper'>

<button onclick="goBack()" style="border:none; background: none;"> <img src="http://mixvassallo.com/website/frontend/css/images/back-button.png" width='100' alt='Return' id = "backbutton"></button>
<hr>
<?php
displayProduct($productID);
?>
</div>
</body>



</html>

0 comments on commit 20a01d2

Please sign in to comment.