diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-01 18:46:12 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-01 18:46:12 +0200 |
| commit | af6dd5f8f9844596e85db25a8e97df9e08cb795c (patch) | |
| tree | 8408e754dd335571635bcde041bbce69213af592 /categoryedit.php | |
| parent | be50d9ed4ba2b844bbc29686cee46b1dc149372a (diff) | |
| download | Catalog-af6dd5f8f9844596e85db25a8e97df9e08cb795c.tar.gz Catalog-af6dd5f8f9844596e85db25a8e97df9e08cb795c.zip | |
Port alls sites to smarty and use the inheritance model
Diffstat (limited to 'categoryedit.php')
| -rw-r--r-- | categoryedit.php | 71 |
1 files changed, 11 insertions, 60 deletions
diff --git a/categoryedit.php b/categoryedit.php index 6d83ee7..a3fb140 100644 --- a/categoryedit.php +++ b/categoryedit.php @@ -1,12 +1,12 @@ <?php session_start(); + require_once('vendor.inc.php'); + if(!isset($_SESSION['username'])) { header('Location: categories.php'); } - require_once('vendor.inc.php'); - if(isset($_GET['delete'])) { $category = CategoryQuery::create()->findOneById($_GET['delete']); @@ -37,61 +37,12 @@ $category->save(); header('Location: categories.php'); } -?> -<!DOCTYPE html> -<html> -<head> -<meta charset="UTF-8"> -<title>Category</title> -<link rel="stylesheet" type="text/css" href="styles/style.css"> -</head> -<body> - <header><h1><?php echo $category->getName(); ?></h1></header> - <nav> - <dl> - <dt><a href="contact.php">Contact us</a></dt> - <dt><a href=".">Home</a></dt> - <dt><a href="categories.php">Back</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"> - <form action="categoryedit.php?<?php echo "{$type}={$category->getId()}" ?>" method="post"> - <h1>Category</h1> - <div class="row"> - <label for="name"><u>N</u>ame:</label> <input class="formw" type="text" - placeholder="Name" id="name" name="name" accesskey="n" - maxlength="100" value="<?php echo $category->getName(); ?>"> - </div> - <div class="row"> - <label for="desc"><u>D</u>escription:</label> - <textarea class="formw" placeholder="Description" id="desc" name="desc" - accesskey="d" maxlength="1000"><?php echo $category->getDescription(); ?></textarea> - </div> - <div class="spacer"> - - </div> - <button type="submit"> - <?php - echo ucfirst($type); - ?> - </button> - <button type="reset"> - Reset - </button> - </form> - <div class="spacer"></div> - </div> - <footer>Copyright by SomeCompany Ltd.</footer> -</body> -</html>
\ No newline at end of file + + $smarty = new Smarty; + + $smarty->assign('loggedin', isset($_SESSION['username'])); + $smarty->assign('category', $category); + $smarty->assign('type', $type); + + $smarty->display('categoryedit.tpl'); +?>
\ No newline at end of file |
