根节点添加功能

ct-mobile-first
ycc 5 years ago
parent 600f49c7f7
commit 96b1c2a4aa

@ -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));
}
}

@ -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)

@ -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
{

@ -1,62 +1,55 @@
<link rel="stylesheet" type="text/css" href="/js/jqcloud/jqcloud.css" />
<script type="text/javascript" src="/js/jqcloud/jqcloud-1.0.4.min.js"></script>
<script type="text/javascript">
var word_array = [
{text: "Lorem", weight: 15},
{text: "Ipsum", weight: 9, link: "http://jquery.com/"},
{text: "Dolor", weight: 6},
{text: "Sit", weight: 7},
{text: "Amet", weight: 5}
];
$(function() {
$(".inspiration").jQCloud(word_array, {width: 600,height:300});
});
</script>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<?php if (isset($lastEditList)){ ?>
<table class="table table-striped">
<caption>最新编辑</caption>
<thead>
<tr>
<th class="col-md-4">#</th>
<th class="col-md-16">标题</th>
<th class="col-md-4">时间</th>
</tr>
</thead>
<tbody>
<?php foreach ($lastEditList as $key => $item){ ?>
<tr>
<td><?php echo $key+1; ?></td>
<td><a href="<?php echo site_url('information/edit/' . $item->is_id); ?>" ><?php echo $item->ic_url_title; ?></a></td>
<td><?php echo date('m/d/Y',strtotime($item->ic_datetime)); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
<div class="col-md-16">
<?php foreach($groupList as $item){ if($item->is_level==0){?>
<div class="row"><div class="col-md-24">
<div class="panel panel-default">
<div class="panel-heading"><?php echo $item->ic_title; ?></div>
<div class="panel-body">
<ul class="list-inline">
<?php if($item->is_level==0){
foreach($groupList as $item_child){
if($item_child->is_parent_id==$item->is_id){
echo ' <li><a href="'.site_url('information/edit/' . $item_child->is_id).'">'.$item_child->ic_title.'</a></li> ';
}
}
} ?>
</ul></div></div> </div></div>
<?php }} ?>
</div>
<div class="col-md-2">.col-xs-6 .col-md-4</div>
</div>
<div class="row">
<div class="col-md-6">
<?php if (isset($lastEditList)) { ?>
<table class="table table-striped">
<caption>最新编辑</caption>
<thead>
<tr>
<th class="col-md-4">#</th>
<th class="col-md-16">标题</th>
<th class="col-md-4">时间</th>
</tr>
</thead>
<tbody>
<?php foreach ($lastEditList as $key => $item) { ?>
<tr>
<td><?php echo $key + 1; ?></td>
<td>
<a href="<?php echo site_url('information/edit/' . $item->is_id); ?>"><?php echo $item->ic_url_title; ?></a>
</td>
<td><?php echo date('m/d/Y', strtotime($item->ic_datetime)); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
<div class="col-md-16">
<?php foreach ($groupList as $item) {
if ($item->is_level == 0) { ?>
<div class="row">
<div class="col-md-24">
<div class="panel panel-default">
<div class="panel-heading"><?php echo $item->ic_title; ?> <span class="pull-right" title="添加节点"><a href="<?php echo site_url('city/addnode/'.$item->is_id) ?>">+</a></span>
</div>
<div class="panel-body">
<ul class="list-inline">
<?php if ($item->is_level == 0) {
foreach ($groupList as $item_child) {
if ($item_child->is_parent_id == $item->is_id) {
echo ' <li><a href="' . site_url('information/edit/' . $item_child->is_id) . '">' . $item_child->ic_title . '</a></li> ';
}
}
} ?>
</ul>
</div>
</div>
</div>
</div>
<?php }
} ?>
</div>
<div class="col-md-2">.col-xs-6 .col-md-4</div>
</div>
</div>

Loading…
Cancel
Save