public function admin_add_category($admin) { if (!Visitor::current()->group()->can('manage_categorize')) { show_403(__("Access Denied"), __('You do not have sufficient privileges to manage categories.', 'categorize')); } # deal with a good submission if (isset($_POST['add'])) { if (!empty($_POST['name'])) { Category::addCategory($_POST); Flash::notice(__("Category added.", "categorize"), "/admin/?action=manage_category"); } else { $fields['categorize'] = array("name" => $_POST['name']); } } $admin->display("add_category", $fields = array()); # we land here when we aren't posting }
$conn_ategory->updQuestion($question_id, $question, $answer, $resolution, $keyword, $exam_id, $year, $jitem); $returnMesg = "題目修改成功"; } else { $returnMesg = "資料不齊全"; } } else { if (!empty($_POST["addData"])) { if ($_POST["submitType"] == "新增類別") { $category_id = $_POST["categoryID"]; if (empty($category_id)) { $returnMesg = "請輸入類別編號"; } else { if (empty($addData)) { $returnMesg = "請輸入類別內容"; } else { $conn_ategory->addCategory($category_id, $addData); $returnMesg = "類別輸入成功"; } } } else { if ($_POST["submitType"] == "新增學科") { $category_id = $_POST["postCategory"]; $subject_id = $_POST["subjectID"]; $sub_id = $_POST["subID"]; if (empty($sub_id)) { $sub_id = "00"; } if (empty($category_id)) { $returnMesg = "請重新選擇類別"; } else { if (empty($subject_id)) {
<?php session_start(); require_once '../classes/connection.class.php'; require_once '../classes/category.class.php'; $addCategoryObj = new Category(); if (isset($_POST['add_category'])) { $category_id = $_POST['category_id']; $category_title = $_POST['category_title']; $category_thumb_image = $_POST['category_thumb_image']; } $addCategoryObj->setCategoryID($category_id); $addCategoryObj->setCategoryTitle($category_title); $addCategoryObj->setCategoryThumbImage($category_thumb_image); /*echo '<pre>'; print_r($addCategoryObj); echo '</pre>'; exit;*/ $flag = $addCategoryObj->addCategory(); /*echo '<pre>'; print_r($addCategoryObj->addCategory()); echo '</pre>'; exit;*/ if ($flag) { $_SESSION['error'] = $addCategoryObj->er = "The category successfully added"; header('location:../index.php?page=category&action=view'); } else { $_SESSION['error'] = $addCategoryObj->er = "The category couldn't be added"; header('location:../index.php?page=category&action=add'); }
public function parseCategory($xml) { $cat = new Category(); $cat->setInfos($this->getAttributes($xml)); while ($xml->read()) { if ($xml->nodeType == XMLReader::ELEMENT) { switch ($xml->localName) { case 'Category': $cat->addCategory($this->parseCategory($xml)); break; } } else { if ($xml->nodeType == XMLReader::END_ELEMENT) { if ($xml->localName == 'Category') { break; } } } } return $cat; }
function addCategory($cat_name) { $category = new Category(); $category->setCategoryType($cat_name); $category->addCategory(); }
<?php include "../../../classes/Database.php"; include "../../../classes/Connection.php"; include_once "../../../includes/bootstrap.php"; include "../../../classes/Category.php"; include "../../../classes/AdminAction.php"; include "../../../includes/security.funcs.inc"; include_once "../../../includes/Pagination.php"; include_once 'thumbnail/thumbnail_images.class.php'; include_once 'functions/myFunctions.php'; if (isset($_POST['submit'])) { $_POST = sanitize($_POST); $category = $_POST; settype($category, 'object'); Category::addCategory($category); $success = "Category Successfully Saved!"; $updates = 'Add new product category content'; AdminAction::addAdminAction($_SESSION['admin_name'], $updates); } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/core3.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php