From 8439ed9ba5b36fa382e32ea883a0877d6ec536c0 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Thu, 9 Jun 2011 16:56:39 -0700 Subject: Finished added prices. Added more buttons to the headers. Fixed the categories. --- htdocs/new-post.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'htdocs/new-post.php') diff --git a/htdocs/new-post.php b/htdocs/new-post.php index 961cdda..e421d3c 100644 --- a/htdocs/new-post.php +++ b/htdocs/new-post.php @@ -99,7 +99,7 @@ function finish_category() { if (isset($_GET['category'])) { $category = Category::getByShortname(addslashes($_GET['category'])); if ($category) { - $post->setCategory($category->getId()); + $post->setCategory($category); return true; } } @@ -168,6 +168,11 @@ function finish_post() { $post->setName($values['title']); $post->setDescription($values['description']); $post->setLocation($values['location']); + + // Price is optional + if (isset($_POST['price'])) { + $post->setPrice($_POST['price']); + } if ($post->save()) { return true; @@ -293,8 +298,10 @@ require_once "src/footer.inc.php"; function render_form($error="") { + $category = $_SESSION['newpost']->getCategory(); $title = isset($_POST['title']) ? $_POST['title'] : ''; + $price = isset($_POST['price']) ? $_POST['price'] : ''; $location = isset($_POST['location']) ? $_POST['location'] : ''; $description = isset($_POST['description']) ? $_POST['description'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; @@ -304,7 +311,14 @@ function render_form($error="") { echo "
$error
"; } - echo "

"; + echo "

"; + + if ($category->getOption('price')) { + echo " "; + } + + + echo "

"; echo "

"; -- cgit v1.2.3