summaryrefslogtreecommitdiffstats
path: root/categories.php
diff options
context:
space:
mode:
Diffstat (limited to 'categories.php')
-rw-r--r--categories.php32
1 files changed, 26 insertions, 6 deletions
diff --git a/categories.php b/categories.php
index 2ef44df..f141e3e 100644
--- a/categories.php
+++ b/categories.php
@@ -1,3 +1,6 @@
+<?php
+session_start();
+?>
<!DOCTYPE html>
<html>
<head>
@@ -9,25 +12,42 @@
<header><h1>Categories</h1></header>
<nav>
<dl>
-<dt><a href="contact.html">Contact us</a></dt>
+<dt><a href="contact.php">Contact us</a></dt>
<dt><a href=".">Home</a></dt>
-<dt><a href="login.html">Login</a></dt>
+<?php
+if(isset($_SESSION['username']))
+{
+ echo "<dt><a href=\"login.php?logout\">Logout</a></dt>";
+ $username = $_SESSION['username'];
+}
+else
+{
+ echo "<dt><a href=\"login.html\">Login</a></dt>";
+}
+?>
</dl>
</nav>
<div id="content">
-<dl>
+<table>
<?php
require_once('vendor.inc.php');
$categories = CategoryQuery::create()->find();
foreach( $categories as $category ){
- echo "<dt><a href=\"products.php?id={$category->getId()}\">{$category->getName()}</a></dt>";
- echo "<dd>{$category->getDescription()}</dd>";
+ echo "<tr>";
+ echo "<td><a href=\"products.php?id={$category->getId()}\">{$category->getName()}</a></td>";
+ echo "<td>{$category->getDescription()}</td>";
+ if(isset($username))
+ {
+ echo "<td><a href=\"categoryedit.php?modify={$category->getId()}\">Edit</a></td>";
+ echo "<td><a href=\"categoryedit.php?delete={$category->getId()}\">Delete</a></td>";
+ }
+ echo "</tr>";
}
?>
-</dl>
+</table>
<div class="spacer"></div>
</div>
<footer>Copyright by SomeCompany Ltd.</footer>