From 96b1c2a4aa562f37c2c6610bf58461c407b6df40 Mon Sep 17 00:00:00 2001 From: ycc Date: Thu, 3 Dec 2020 15:08:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E8=8A=82=E7=82=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/city.php | 12 +++ application/models/infoContents_model.php | 12 +++ application/models/infoStructures_model.php | 7 +- application/views/bootstrap3/welcome.php | 113 +++++++++----------- 4 files changed, 81 insertions(+), 63 deletions(-) diff --git a/application/controllers/city.php b/application/controllers/city.php index 400aeea4..34d45845 100644 --- a/application/controllers/city.php +++ b/application/controllers/city.php @@ -39,4 +39,16 @@ class City extends CI_Controller redirect(site_url('information/edit/' . $is_id)); } + //$is_sort=-99 代表根节点 + public function addnode($is_parent_id,$is_sort=-99){ + $Structure = $this->InfoStructures_model->Detail($is_parent_id); + if ($Structure == FALSE) { + show_404(); + } + + $ic_id=$this->InfoContents_model->add_use_ORM('infoContents',array('ic_url_title'=>'new information','ic_title'=>'new information','ic_sitecode'=>$this->config->item('site_code'))); + $this->InfoStructures_model->Add($is_parent_id,$ic_id,$is_sort); + redirect(site_url('information/edit/' . $this->InfoStructures_model->insert_id)); + } + } \ No newline at end of file diff --git a/application/models/infoContents_model.php b/application/models/infoContents_model.php index 40e7ec54..2f315330 100644 --- a/application/models/infoContents_model.php +++ b/application/models/infoContents_model.php @@ -11,6 +11,18 @@ class InfoContents_model extends CI_Model $this->HT = $this->load->database('HT', TRUE); } + public function add_use_ORM($table, $data) { + if ($this->HT->insert($table, $data)) { + return $this->HT->last_id($table); + } else { + return false; + } + } + + public function update_use_ORM($table, $data, $where) { + $this->HT->update($table, $data, $where); + } + function Add($ic_url, $ic_url_title, $ic_type, $ic_title, $ic_content, $ic_summary, $ic_seo_title, $ic_seo_description, $ic_seo_keywords, $ic_show_bread_crumbs, $ic_status, $ic_template, $ic_photo, $ic_photo_width, $ic_photo_height, $ic_recommend_tours, $ic_recommend_packages, $ic_ht_area_id, $ic_ht_area_type, $ic_ht_product_id, $ic_ht_product_type,$ic_author) diff --git a/application/models/infoStructures_model.php b/application/models/infoStructures_model.php index 45459c40..5bc64e3e 100644 --- a/application/models/infoStructures_model.php +++ b/application/models/infoStructures_model.php @@ -11,6 +11,8 @@ class InfoStructures_model extends CI_Model $this->HT = $this->load->database('HT', TRUE); } + + function Detail($is_id) { $sql = "SELECT TOP 1 is1.is_id, \n" @@ -36,13 +38,13 @@ class InfoStructures_model extends CI_Model } } - function Add($is_parent_id, $is_ic_id=-1) + + function Add($is_parent_id, $is_ic_id=-1,$is_sort=999) { if ($is_parent_id == 0) { $is_path = ''; $is_level = 1; - $is_sort = 999; } else { @@ -51,7 +53,6 @@ class InfoStructures_model extends CI_Model { $is_path = $infoStructure->is_path; $is_level = $infoStructure->is_level + 1; - $is_sort = 999; } else { diff --git a/application/views/bootstrap3/welcome.php b/application/views/bootstrap3/welcome.php index 32ea6320..3831e009 100644 --- a/application/views/bootstrap3/welcome.php +++ b/application/views/bootstrap3/welcome.php @@ -1,62 +1,55 @@ - - - -
-
-
- - - - - - - - - - - - $item){ ?> - - - - - - - -
最新编辑
#标题时间
ic_url_title; ?>ic_datetime)); ?>
- -
-
- is_level==0){?> -
-
-
ic_title; ?>
-
-
    - is_level==0){ - foreach($groupList as $item_child){ - if($item_child->is_parent_id==$item->is_id){ - echo '
  • '.$item_child->ic_title.'
  • '; - } - } - } ?> -
- -
-
.col-xs-6 .col-md-4
-
+
+
+ + + + + + + + + + + + $item) { ?> + + + + + + + +
最新编辑
#标题时间
+ ic_url_title; ?> + ic_datetime)); ?>
+ +
+
+ is_level == 0) { ?> +
+
+
+
ic_title; ?> + +
+
+
    + is_level == 0) { + foreach ($groupList as $item_child) { + if ($item_child->is_parent_id == $item->is_id) { + echo '
  • ' . $item_child->ic_title . '
  • '; + } + } + } ?> +
+
+
+
+
+ +
+
.col-xs-6 .col-md-4
+