You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1.0 KiB

<?php
require_once './config.php';
use nzedb\Category;
$page = new AdminPage();
$category = new Category(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
case 'submit':
$ret = $category->update($_POST["id"],
$_POST["status"],
$_POST["description"],
$_POST["disablepreview"],
$_POST["minsize"]);
header("Location:" . WWW_TOP . "/category-list.php");
break;
case 'view':
default:
if (isset($_GET["id"])) {
$page->title = "Category Edit";
$id = $_GET["id"];
$cat = $category->getById($id);
$page->smarty->assign('category', $cat);
}
break;
}
$page->smarty->assign('status_ids',
[
Category::STATUS_ACTIVE, Category::STATUS_INACTIVE,
Category::STATUS_DISABLED
]);
$page->smarty->assign('status_names', ['Yes', 'No', 'Disabled']);
$page->content = $page->smarty->fetch('category-edit.tpl');
$page->render();