blob: 0425ec1b93ade34319f40f93adb8753091e74069 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Categories</title>
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<body>
<header><h1>Categories</h1></header>
<nav>
<dl>
<dt><a href="contact.php">Contact us</a></dt>
<dt><a href=".">Home</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.php\">Login</a></dt>";
}
?>
</dl>
</nav>
<div id="content">
<table>
<?php
require_once('vendor.inc.php');
$categories = CategoryQuery::create()->find();
foreach( $categories as $category ){
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()}\" onClick=\"return confirm('Confirm deletion.')\">Delete</a></td>";
}
echo "</tr>";
}
if(isset($username))
{
echo "<tr>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td><a href=\"categoryedit.php?add\">Add</a></td>";
echo "</tr>";
}
?>
</table>
<div class="spacer"></div>
</div>
<footer>Copyright by SomeCompany Ltd.</footer>
</body>
</html>
|