diff --git a/app/LKT/webapp/modules/Article/views/IndexInputView.class.php b/app/LKT/webapp/modules/Article/views/IndexInputView.class.php
index 683fe80502ffe71f75543863412d92e8dfc5b770..43d94cc1e2e41b466101214637173c34d3c352b5 100644
--- a/app/LKT/webapp/modules/Article/views/IndexInputView.class.php
+++ b/app/LKT/webapp/modules/Article/views/IndexInputView.class.php
@@ -12,6 +12,7 @@ class IndexInputView extends SmartyView {
$request = $this->getContext()->getRequest();
$this->setAttribute("list",$request->getAttribute("list"));
$this->setAttribute("uploadImg",$request->getAttribute("uploadImg"));
+ $this->setAttribute("cat_name",$request->getAttribute("cat_name"));
$this->setTemplate("index.tpl");
}
}
diff --git a/app/LKT/webapp/modules/Article/views/addInputView.class.php b/app/LKT/webapp/modules/Article/views/addInputView.class.php
index 7ddc5e3d280001e8daa4e87c0ac37cefc3f13ac8..c31b5ff9cbfb49e75abf713f8bb1517016a0df57 100644
--- a/app/LKT/webapp/modules/Article/views/addInputView.class.php
+++ b/app/LKT/webapp/modules/Article/views/addInputView.class.php
@@ -18,11 +18,14 @@ class addInputView extends SmartyView {
$this->setAttribute("ctype",$request->getAttribute("ctype"));
$this->setAttribute('pic', $request->getAttribute('pic'));
+ $this->setAttribute("articleclass",$request->getAttribute("articleclass"));
+ // $this->setAttribute("cat_name",$request->getAttribute("cat_name"));
+
$this->setTemplate("add.tpl");
}
-}
+}擦头
?>
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/Article/views/modifyInputView.class.php b/app/LKT/webapp/modules/Article/views/modifyInputView.class.php
index cafb0c5f4c8c0591d0c248e7b42ba92d0fc730ff..e5459883e9645f3d01b8daa88dcb1285ef7cb3b1 100644
--- a/app/LKT/webapp/modules/Article/views/modifyInputView.class.php
+++ b/app/LKT/webapp/modules/Article/views/modifyInputView.class.php
@@ -18,6 +18,7 @@ class modifyInputView extends SmartyView {
$this->setAttribute('id',$request->getAttribute('id'));
$this->setAttribute('Article_title',$request->getAttribute('Article_title'));
+ $this->setAttribute("articleclass",$request->getAttribute("articleclass"));
$this->setAttribute('Article_prompt',$request->getAttribute('Article_prompt'));
diff --git a/app/LKT/webapp/modules/article_class/actions/IndexAction.class.php b/app/LKT/webapp/modules/article_class/actions/IndexAction.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..de773e23261607c250a4e9ad96801bae77e2835a
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/actions/IndexAction.class.php
@@ -0,0 +1,65 @@
+getContext()->getRequest();
+
+
+ $pageto = $request -> getParameter('pageto');
+ // 导出
+ $pagesize = $request -> getParameter('pagesize');
+ $pagesize = $pagesize ? $pagesize:10;
+ // 每页显示多少条数据
+ $page = $request -> getParameter('page');
+
+ // 页码
+ if($page){
+ $start = ($page-1)*$pagesize;
+ }else{
+ $start = 0;
+ $page =1;
+ }
+ $sql = "select * from lkt_article_class";
+ $r_pager = $db->select($sql);
+ if($r_pager){
+ $total = count($r_pager);
+ }else{
+ $total = 0;
+ }
+ $pager = new ShowPager($total,$pagesize,$page);
+
+ // 查询新闻分类表,根据sort顺序排列
+ $sql = "select * from lkt_article_class order by sort asc, add_date desc limit $start,$pagesize ";
+ $r = $db->select($sql);
+
+ $url = "index.php?module=article_class&action=Index&pagesize=".urlencode($pagesize);
+ $pages_show = $pager->multipage($url,$total,$page,$pagesize,$start,$para = '');
+
+
+ $request->setAttribute("list",$r);
+ $request -> setAttribute('pages_show', $pages_show);
+
+ return View :: INPUT;
+ }
+
+ public function execute() {
+
+ }
+
+ public function getRequestMethods(){
+ return Request :: NONE;
+ }
+}
+?>
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/actions/addAction.class.php b/app/LKT/webapp/modules/article_class/actions/addAction.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..c73f73adafe0f772c192c1bde05243feeeb5ef4f
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/actions/addAction.class.php
@@ -0,0 +1,111 @@
+getContext()->getRequest();
+
+
+ $cat_name = addslashes(trim($request->getParameter('cat_name'))); // 分类名称
+ $sort = addslashes(trim($request->getParameter('sort'))); // 排序
+
+
+
+ $request->setAttribute("cat_name",$cat_name);
+ $request->setAttribute("sort",$sort);
+
+ return View :: INPUT;
+ }
+
+ public function execute(){
+ $db = DBAction::getInstance();
+ $request = $this->getContext()->getRequest();
+ $admin_id = $this->getContext()->getStorage()->read('admin_id');
+
+ // 获取分类名称和排序号
+ $cat_name = addslashes(trim($request->getParameter('cat_name'))); // 分类名称
+ $sort = addslashes(trim($request->getParameter('sort'))); // 排序
+
+
+ if($cat_name == ''){
+ header("Content-type:text/html;charset=utf-8");
+ echo "";
+ return $this->getDefaultView();
+ }
+ //检查分类名称是否重复
+ $sql = "select * from lkt_article_class where cat_name = '$cat_name'";
+ // var_dump($sql);
+ // die();
+
+ $r = $db->select($sql);
+ // var_dump($r);
+ // die();
+ // 如果有数据 并且 数据条数大于0
+ if ($r>0&& count($r)) {
+
+ header("Content-type:text/html;charset=utf-8");
+ echo "";
+ return $this->getDefaultView();
+
+ }
+ //添加分类
+ $sql = "insert into lkt_article_class(cat_name,sort,add_date) "
+ ."values('$cat_name','$sort',CURRENT_TIMESTAMP)";
+ // var_dump($sql);
+ // die();
+ $r = $db->insert($sql);
+ if($r == -1) {
+ $db->admin_record($admin_id,'添加文章分类'.$cat_name.'失败',1);
+
+ header("Content-type:text/html;charset=utf-8");
+ echo "";
+ return $this->getDefaultView();
+ } else {
+ $db->admin_record($admin_id,'添加文章分类'.$cat_name,1);
+
+ header("Content-type:text/html;charset=utf-8");
+ echo "";
+ return $this->getDefaultView();
+ }
+
+ return;
+ }
+
+ public function getRequestMethods(){
+ return Request :: POST;
+ }
+
+ public function menu_merge($data,$parent_id=0,$level=1){
+ $res = array();
+ foreach ($data as $v) {
+ if($v['sid']==$parent_id){
+ $v['level'] = $level;
+ $v['disabled'] = false;
+ $res[]=$v;
+ $res = array_merge($res,menu_merge($data,$v['id'],$level+1));
+ }
+ }
+ return $res;
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/actions/delAction.class.php b/app/LKT/webapp/modules/article_class/actions/delAction.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..6aaf480eb106a33f6baed11ded82033c40416760
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/actions/delAction.class.php
@@ -0,0 +1,63 @@
+getContext()->getRequest();
+ $admin_id = $this->getContext()->getStorage()->read('admin_id');
+
+ $cat_id = intval($request->getParameter('cat_id')); // 文章分类id
+
+
+ $sql = "select * from lkt_article where article_class = '$cat_id'";
+ $r = $db->select($sql);
+ if($r){
+ $db->admin_record($admin_id,' 删除文章分类id为 '.$cat_id.' 失败,检查此分类下是否有文章',3);
+ echo 2;
+ exit;
+ }else{
+ // 根据分类id,删除这条数据
+ $sql = "delete from lkt_article_class where cat_id=$cat_id";
+ // echo $sql;
+ // var_dump( $cat_id);
+ // var_dump( $sql);
+
+
+ $res = $db->delete($sql);
+ // var_dump( $res);
+ // die();
+
+ if($res){
+ $db->admin_record($admin_id,' 删除文章分类id为 '.$cat_id.' 的信息',3);
+ echo 1;
+ exit;
+ }else{
+ $db->admin_record($admin_id,' 删除文章分类id为 '.$cat_id.' 失败',3);
+ echo 0;
+ exit;
+ };
+ }
+
+
+ }
+
+
+
+ public function execute(){
+ return $this->getDefaultView();
+ }
+
+ public function getRequestMethods(){
+ return Request :: NONE;
+ }
+}
+?>
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/actions/modifyAction.class.php b/app/LKT/webapp/modules/article_class/actions/modifyAction.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..17e4e7194cbb6851696db20492469ff33b908e6b
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/actions/modifyAction.class.php
@@ -0,0 +1,120 @@
+getContext()->getRequest();
+ // 接收分类id
+ $cat_id = intval($request->getParameter("cat_id")); // 文章分类id
+
+
+ // 根据分类id,查询分类表
+ $sql = "select * from lkt_article_class where cat_id = '$cat_id'";
+ $r = $db->select($sql);
+ if($r){
+ $cat_name = $r[0]->cat_name; // 文章分类名称
+ $sort = $r[0]->sort; // 排序
+ }
+ // var_dump( $sort);
+
+ // $articleclass = $this->articleclass($cat_id);//分类名称
+ // $request->setAttribute("articleclass", $articleclass);//分类名称
+
+
+
+ $request->setAttribute("cat_id",$cat_id);
+ $request->setAttribute("cat_name",$cat_name);
+ $request->setAttribute('sort', $sort);
+
+
+ return View :: INPUT;
+ }
+
+ public function articleclass($article_cat_id1)
+ {//文章分类
+ $db = DBAction::getInstance();
+ $sql01 = "select cat_id ,cat_name from lkt_article_class ";
+ $r01 = $db->select($sql01);
+ $articleclass = '';
+ // $articleclass_num = 0;
+ if ($r01) {
+ if ($article_cat_id1) {
+ foreach ($r01 as $k01 => $v01) {
+ if ($v01->cat_id == $article_cat_id1) {
+ $articleclass .= '
';
+ } else {
+ $articleclass .= '
';
+ }
+ }
+ } else {
+ foreach ($r01 as $k2 => $v2) {
+ $articleclass .= '
';
+
+ }
+ }
+ }
+ return $articleclass;
+
+ }
+ public function execute(){
+ $db = DBAction::getInstance();
+ $request = $this->getContext()->getRequest();
+ $admin_id = $this->getContext()->getStorage()->read('admin_id');
+
+ // $cat_id = intval($request->getParameter('cat_id')); // 文章分类id
+ $cat_id = intval($request->getParameter("cat_id")); // 文章分类id
+ // $r = $db->update($sql);
+
+ // var_dump($cat_id);
+ // die();
+
+ $cat_name = addslashes(trim($request->getParameter('cat_name'))); // 文章分类名称
+
+ $sort = addslashes(trim($request->getParameter('sort'))); // 排序
+
+
+
+ //更新分类列表
+ $sql = "update lkt_article_class " .
+ "set cat_name = '$cat_name',sort = '$sort'"
+ ." where cat_id = '$cat_id'";
+ $r = $db->update($sql);
+
+ // var_dump($sql);
+ // die();
+
+ if($r == -1) {
+ $db->admin_record($admin_id,' 修改文章分类id为 '.$cat_id.' 失败',2);
+
+ echo "";
+ return $this->getDefaultView();
+ } else {
+ $db->admin_record($admin_id,' 修改文章分类id为 '.$cat_id.' 的信息',2);
+
+ header("Content-type:text/html;charset=utf-8");
+ echo "";
+ }
+ return;
+ }
+
+ public function getRequestMethods(){
+ return Request :: POST;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/actions/statusAction.class.php b/app/LKT/webapp/modules/article_class/actions/statusAction.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..d578b312a4e5c2bbe92b941dcdf48b042d6cb9ee
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/actions/statusAction.class.php
@@ -0,0 +1,29 @@
+
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/config/module.ini b/app/LKT/webapp/modules/article_class/config/module.ini
new file mode 100644
index 0000000000000000000000000000000000000000..389bb867bf250de27ea941d4891614b48cb89c8c
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/config/module.ini
@@ -0,0 +1,28 @@
+; +----------------------------------------------------------------------------+
+; | This file is part of the LaiKeTui package. |
+; | Copyright (c) laiketui.com. |
+; | |
+; | For the full copyright and license information, please view the LICENSE |
+; | file that was distributed with this source code. You can also view the |
+; | LICENSE file online at http://www.laiketui.com. |
+; | -------------------------------------------------------------------------- |
+; | MODULE INFORMATION FILE |
+; +----------------------------------------------------------------------------+
+
+[module]
+
+ ENABLED = "On"
+
+ TITLE = "article_class LaiKeTui Module"
+
+ VERSION = "1.0"
+
+ NAME = "article_class"
+
+ AUTHOR = "fly"
+
+ HOMEPAGE = ""
+
+ UPDATE_URL = ""
+
+ DESCRIPTION = "article_class LaiKeTui Module"
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/templates/add.tpl b/app/LKT/webapp/modules/article_class/templates/add.tpl
new file mode 100644
index 0000000000000000000000000000000000000000..f585ce346f3f6123e8f4d955d390c1ea08a79833
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/templates/add.tpl
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+{php}include BASE_PATH."/modules/assets/templates/top.tpl";{/php}
+
+{literal}
+
+{/literal}
+
添加文章分类
+
+
+
+
+
+
+
+
+
+{php}include BASE_PATH."/modules/assets/templates/footer.tpl";{/php}
+
+
+
+
+
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/templates/index.tpl b/app/LKT/webapp/modules/article_class/templates/index.tpl
new file mode 100644
index 0000000000000000000000000000000000000000..b7422eef945845b252c25130e64d7fb4daf3db4f
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/templates/index.tpl
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+{php}include BASE_PATH."/modules/assets/templates/top.tpl";{/php}
+
+
+
文章分类
+{literal}
+
+{/literal}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID |
+ 分类排序 |
+
+ 分类名称 |
+ 添加时间 |
+ 操作 |
+
+
+
+ {foreach from=$list item=item name=f1}
+
+ {$item->cat_id} |
+ {$item->sort} |
+
+ {$item->cat_name} |
+ {$item->add_date} |
+
+
+
+
+ 修改
+
+
+
+
+ {if $item->tistrue=='1'}
+
+ {else}
+
+
+
+ 删除
+
+
+
+ {/if}
+ |
+
+
+ {/foreach}
+
+
+
+
{$pages_show}
+
+
+{php}include BASE_PATH."/modules/assets/templates/footer.tpl";{/php}
+
+
+{literal}
+
+{/literal}
+
+
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/templates/modify.tpl b/app/LKT/webapp/modules/article_class/templates/modify.tpl
new file mode 100644
index 0000000000000000000000000000000000000000..d687d4074d94340eef58d0cb8898578e4cf294b7
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/templates/modify.tpl
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+{php}include BASE_PATH."/modules/assets/templates/top.tpl";{/php}
+
+{literal}
+
+{/literal}
+
修改新闻分类
+
+
+
+
+
+
+
+
+
+{php}include BASE_PATH."/modules/assets/templates/footer.tpl";{/php}
+
+
+
+
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/views/IndexInputView.class.php b/app/LKT/webapp/modules/article_class/views/IndexInputView.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..72ed7922da2d1cbb6b8e514374f5e12570e944f9
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/views/IndexInputView.class.php
@@ -0,0 +1,13 @@
+getContext()->getRequest();
+
+ $this->setAttribute("list",$request->getAttribute("list"));
+ $this->setAttribute("cat_name",$request->getAttribute("cat_name"));
+ $this->setAttribute("cat_id",$request->getAttribute("cat_id"));
+ $this->setAttribute("pages_show",$request->getAttribute("pages_show"));
+ $this->setTemplate("index.tpl");
+ }
+}
+?>
diff --git a/app/LKT/webapp/modules/article_class/views/addInputView.class.php b/app/LKT/webapp/modules/article_class/views/addInputView.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..7117e175b53ac3da63c246b9e467c52447188a65
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/views/addInputView.class.php
@@ -0,0 +1,15 @@
+getContext()->getRequest();
+
+
+ $this->setAttribute("cat_name",$request->getAttribute("cat_name"));
+
+ $this->setAttribute("sort",$request->getAttribute("sort"));
+
+ $this->setTemplate("add.tpl");
+ }
+}
+?>
\ No newline at end of file
diff --git a/app/LKT/webapp/modules/article_class/views/modifyInputView.class.php b/app/LKT/webapp/modules/article_class/views/modifyInputView.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..584b5b98b1c7fe464d7bb9305392e307f33eaa12
--- /dev/null
+++ b/app/LKT/webapp/modules/article_class/views/modifyInputView.class.php
@@ -0,0 +1,13 @@
+getContext()->getRequest();
+ $this->setAttribute('cat_id',$request->getAttribute('cat_id'));
+
+ $this->setAttribute('cat_name', $request->getAttribute('cat_name'));
+
+ $this->setAttribute('sort', $request->getAttribute('sort'));
+ $this->setTemplate("modify.tpl");
+ }
+}
+?>
\ No newline at end of file
diff --git a/app/data/20200819.sql b/app/data/20200819.sql
new file mode 100644
index 0000000000000000000000000000000000000000..bf7992c2593c9c5f283f554571d98341ee3aead2
--- /dev/null
+++ b/app/data/20200819.sql
@@ -0,0 +1,11 @@
+ALTER TABLE `lkt_article` CHANGE `article_class` `article_class` INT(10) NULL DEFAULT NULL COMMENT '文章分类id';
+CREATE TABLE `lkt_article_class` (
+ `cat_id` int(11) UNSIGNED NOT NULL COMMENT '文章分类id',
+ `cat_name` char(15) DEFAULT NULL COMMENT '分类名称',
+ `sort` int(11) DEFAULT NULL COMMENT '排序',
+ `add_date` timestamp NULL DEFAULT NULL COMMENT '添加时间'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ALTER TABLE `lkt_article_class`
+ ADD PRIMARY KEY (`cat_id`);
+COMMIT;
\ No newline at end of file