<?php //引入静态常量 require_once '../../../util/StackConst.php'; //引入CategoryDao require_once '../dao/CategoryDao.php'; //实例化dao $categoryDao = new CategoryDao(); //获取招聘类别集合 $arrCagegorys = $categoryDao->getCategoryList(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>服务支持|招聘类别列表</title> </head> <body> <table border="1" width="100%"> <tr> <th>序号</th> <th>招聘类别</th> <th>操作</th> </tr> <?php $XH = 1; foreach ($arrCagegorys as $category) { ?> <tr align="center"> <td><?php
<?php include_once '../util/CrossBrowserHead.php'; include_once '../util/DbUtil.php'; include_once '../dao/CategoryDao.php'; include_once '../bo/CategoryBO.php'; include_once '../util/util.php'; $data = json_decode(file_get_contents("php://input")); //echo $data->category; $pdo = DbUtil::connect(); $categoryDao = new CategoryDao($pdo); //echo '{"message":'. $data->category .'}'; if ($data->btn_action == 'save') { try { $category = $data->category; $startAge = $data->startAge; $endAge = $data->endAge; $gender = $data->gender; //$contact = $_POST['contact_no']; $categoryBO = new CategoryBO(); $categoryBO->setLabel($category); $categoryBO->setStartAge($startAge); $categoryBO->setEndAge($endAge); $categoryBO->setGender($gender); if ($categoryDao->create($categoryBO)) { echo json_encode('{"message":"success"}'); } else { echo json_encode('{"message":"failure"}'); } } catch (Exception $e) { $msg = 'failure' . $e->getMessage() . $e->getFile() . $e->getLine();
public function getCategoryList() { require_once 'CategoryDao.php'; $categoryDao = new CategoryDao(); return $categoryDao->getCategoryList(); }
static function loadAllCategories() { $catdao = new CategoryDao(); return $catdao->loadAllNew(); }
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php require_once '../../../util/StackConst.php'; //获取操作类型值 $type = @$_POST['type'] == "" ? @$_GET['type'] : @$_POST['type']; if ("addCate" == $type) { $arrCategoryInfo = array("in_cat_content" => @$_POST['in_cat_content']); //引入CategoryDao require_once '../dao/CategoryDao.php'; //实例化CategoryDao $categoryDao = new CategoryDao(); if ($categoryDao->addCategory($arrCategoryInfo)) { echo "添加招聘类别成功!"; StackConst::jump_page("../view/inrea1categorylist.php"); } else { echo "添加招聘类别失败!"; } } else { if ("deleteCate" == $type) { //引入CategoryDao require_once '../dao/CategoryDao.php'; //实例化CategoryDao $categoryDao = new CategoryDao(); if ($categoryDao->deleteCategoryById(@$_GET['in_cat_id'])) { echo "添加招聘类别成功!"; StackConst::jump_page("../view/inrea1categorylist.php"); } else { echo "添加招聘类别失败!"; } } }
<?php include_once 'data/CategoryDAO.php'; include_once 'control/ArticleControls.php'; include_once 'business/Article.php'; if (session_status() == PHP_SESSION_NONE) { session_start(); } $categoryDao = new CategoryDao(); $articleController = new ArticleControls(); var_dump($_POST['category']); $categoryId = $categoryDao->getIdForName($_POST['category']); $article = new Article(); $article->setName($_POST['title']); $article->setContent($_POST['editor']); $article->setSumup($_POST['sumup_editor']); $article->setCategory($categoryId); $article->setAuthor($_SESSION['USR']); $article->setTags($_POST['tags']); $ret = $articleController->submitNewArticle($article); if ($ret) { header("location:../adminConsole.php"); } else { echo "Unexpected exception"; }
public function toJSON() { return json_encode($this); } } $book = new Book(); $book->setTitle("JSF Cookbook"); $book->author = "Anghel Leonard"; $book->yearofpublication = "2012"; $result = $book->toJSON(); echo 'The JSON representation is:' . $result . '<br>'; include_once '../util/DbUtil.php'; include_once '../dao/CategoryDao.php'; include_once '../bo/CategoryBO.php'; $pdo = DbUtil::connect(); $categoryDao = new CategoryDao($pdo); $categoryArray = $categoryDao->getAllCategory(); $size = sizeof($categoryArray); $jsonstr = ''; $jsonstr .= '{"message":"success","data":['; //for ($x = 0; $x < $size; $x++) { // $category = $categoryArray[$x]; foreach ($categoryArray as $category) { //var_dump($category); $jsonstr .= $category->__toString() . ","; } $jsonstr = substr($jsonstr, 0, -1); $jsonstr .= ']}'; echo $jsonstr; DbUtil::disconnect(); /* echo '************************'.'<br>';
<?php require_once '../../../util/StackConst.php'; //获取操作类型值 $type = @$_POST['type'] == "" ? @$_GET['type'] : @$_POST['type']; //新增加类别 if ("addCategory" == $type) { $arrCategoryInfo = array("pro_cate_name" => @$_POST['pro_cate_name']); //引入CategoryDao require_once '../dao/CategoryDao.php'; //实例化产品DAO $categoryDao = new CategoryDao(); if ($categoryDao->addCategory($arrCategoryInfo)) { echo "新增产品类别成功!"; StackConst::jump_page("../view/categorylist.php"); } else { echo "新增产品类别失败!"; } } else { if ("deleteCate" == $type) { //引入CategoryDao require_once '../dao/CategoryDao.php'; //实例化产品DAO $categoryDao = new CategoryDao(); if ($categoryDao->deleteCategoryById(@$_GET['pro_cate_id'])) { echo "删除产品类别成功!"; StackConst::jump_page("../view/categorylist.php"); } else { echo "删除产品类别失败!"; } } }