<?php
class EditController extends Controller {
public function __construct() {
parent::__construct();
$this->import('main');
$this->import('edit');
}
public function indexMethod() {
$this->mainModel->head();
$this->view->display('head.main.html');
$this->view->display('edit.html');
$this->view->display('foot.html');
}
public function addCategoryMethod() {
if (isset($this->post->save)) {
$upper_id = $this->post->sub_select ? $this->post->main_name : 0;
$data = array('name'=>$this->post->category_name,'upper_id'=>$upper_id,'description'=>$this->post->description);
if($this->editModel->addCategory($data)){
header("location: index.php");
exit;
}else{
die("Add Error");
}
}
$this->mainModel->head();
$this->view->TITLE = 'Add Category';
$this->view->main_categorys = $this->mainModel->getCategorys('main');
$this->view->display('head.main.html');
$this->view->display('category.add.html');
}
public function addBkMethod(){
if (isset($this->post->save)) {
if(!empty($this->post->sub_name)){
$c_id = $this->post->sub_name;
}else{
$c_id = $this->post->main_name;
}
$m_list = array();
foreach($this->post as $mk =>$mv){
if(strstr($mk, 'menu_name')){
$m_list[] = substr($mk, -1,1);
}
}
$menu_datas = array();
foreach($m_list as $m){
$menu_name = 'menu_name'.$m;
$description = 'description'.$m;
$time = date("Y-m-d H:i:s");
$menu_data[] = array('name'=>$this->post->bk_name ,'c_id'=>$c_id,'summary'=>$this->post->summary,
'menu_name'=>$this->post->$menu_name,'description'=>$this->post->$description,'enter_date'=>$time);
}
if($this->editModel->addBk($menu_data)){
header("location: index.php");
exit;
}else{
die("Add Error");
}
}
$this->mainModel->head();
$this->view->TITLE = 'Add 百科';
$this->view->addMenu = 1;
$this->view->categorys = $this->mainModel->getCategorys();
$this->view->display('head.main.html');
$this->view->display('bk.add.html');
}
public function getSubCategorysMethod(){
$c_id = $this->post->id;
$ajaxDatas = $this->mainModel->getSubCategorys($c_id);
if($ajaxDatas){
print json_encode($ajaxDatas);
}else{
print json_encode(array('error'=>"没有下层数据"));
}
}
//百科条目删除
public function deleteBkMethod(){
$result = $this->editModel->deleteBk($this->post->name);
if($result){
print 1;
}else{
print 0;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
1.zip (50个子文件)
1
themes
sweet
view
head.html 561B
js
jquery.mobile.css 59KB
jquery.mobile.js 184KB
images
ajax-loader.png 503B
icons-18-white.png 2KB
icons-36-black.png 3KB
icon-search-black.png 1KB
icons-36-white.png 4KB
icons-18-black.png 2KB
action.js 3KB
jquery.js 89KB
config_local.php 1KB
index.php 568B
system1
library
template_c
Main
detail.html.php 416B
list.html.php 334B
category.add.html.php 1KB
head.html.php 566B
head.main.html.php 813B
edit.html.php 302B
bk.add.html.php 2KB
main.html.php 663B
search.html.php 809B
foot.html.php 656B
cache
modules
Main
index.php 500B
list.php 1KB
edit.php 3KB
view
bk.add.html 2KB
head.main.html 803B
main.html 652B
list.html 329B
search.html 799B
detail.html 409B
foot.html 656B
category.add.html 1KB
edit.html 302B
model
list.php 1KB
edit.php 1KB
main.php 2KB
core
Db.php 681B
Load.php 857B
db
Mysqli.php 3KB
milkDb.php 544B
View.php 2KB
Config.php 736B
Common.php 1KB
Entrance.php 2KB
Controller.php 1KB
Network.php 2KB
Model.php 826B
config.php 1KB
共 50 条
- 1
资源评论
葡萄哥哥
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功