Ejemplo n.º 1
0
 public function catGoodsCount($cat_id)
 {
     $category = new Catmodel();
     $cats = $category->select();
     // 取出所有的栏目来
     $sons = $category->getCatTree($cats, $cat_id);
     // 取出给定栏目的子孙栏目
     $sub = array($cat_id);
     if (!empty($sons)) {
         // 没有子孙栏目
         foreach ($sons as $v) {
             $sub[] = $v['cat_id'];
         }
     }
     $in = implode(',', $sub);
     $sql = 'select count(*) from ' . $this->table . ' where cat_id in (' . $in . ')';
     return $this->db->getOne($sql);
 }
Ejemplo n.º 2
0
<?php

/***
file index.php
***/
define('AICN', true);
session_start();
if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') {
    require '../include/init.php';
    $gds_id = $_GET['goods_id'] + 0;
    //print_r($gds_id);
    $good = new goodsmodel();
    $g = array();
    $g = $good->findsingle($gds_id);
    $xq = $good->findsinglexq($gds_id);
    //print_r($g);
    //print_r($xq);
    $cat = new Catmodel();
    $catlist = $cat->select();
    $catlist = $cat->getcattree($catlist);
    //print_r($catlist);
    include ROOT . 'hment/goodsdit.html';
}
Ejemplo n.º 3
0
<?php

/***
file index.php
***/
define('AICN', true);
session_start();
if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') {
    require '../include/init.php';
    $cat_id = $_GET['cat_id'] + 0;
    $cat = new Catmodel();
    $sons = $cat->getSon($cat_id);
    if (!empty($sons)) {
        exit('有子档目不可以删除');
    } else {
        if ($cat->delete($cat_id)) {
            echo '删除成功';
        } else {
            echo '删除失败';
        }
    }
}
Ejemplo n.º 4
0
<?php

/***
file index.php
***/
define('AICN', true);
session_start();
if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') {
    require '../include/init.php';
    //echo ROOT;
    $catlist = new Catmodel();
    $cattree = $catlist->select();
    $cattree = $catlist->getcattree($cattree, 0);
    //print_r($cattree);
    include ROOT . 'hment/catelis.html';
}
Ejemplo n.º 5
0
file index.php
***/
define('AICN', true);
session_start();
if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') {
    require '../include/init.php';
    //print_r($_POST);
    $data = array();
    if (empty($_POST['cat_name'])) {
        exit('栏目名不能为空');
    }
    $data['cat_name'] = $_POST['cat_name'];
    $data['parent_id'] = $_POST['parent_id'] + 0;
    $data['intro'] = $_POST['intro'];
    $cat_id = $_POST['cat_id'] + 0;
    $cat = new Catmodel();
    // 查找新父栏目的家谱树
    $trees = $cat->getTree($data['parent_id']);
    // 判断自身是否在新父栏目的家谱树里面
    $flag = true;
    foreach ($trees as $value) {
        if ($value['cat_id'] == $cat_id) {
            $flag = false;
            break;
        }
    }
    if (!$flag) {
        echo '父栏目选取错误';
        exit;
    }
    if ($cat->update($data, $cat_id)) {
Ejemplo n.º 6
0
<?php

/***
file index.php
***/
define('AICN', true);
session_start();
if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') {
    require '../include/init.php';
    $cat_id = $_GET['cat_id'] + 0;
    //print_r($cat_id);
    $cat = new Catmodel();
    $catinfo = $cat->find($cat_id);
    $catlist = $cat->select();
    $catlist = $cat->getcattree($catlist);
    //print_r($catinfo);
    include ROOT . 'hment/cateadit.html';
}
Ejemplo n.º 7
0
<?php

/***
file index.php
***/
define('AICN', true);
session_start();
if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') {
    require '../include/init.php';
    //print_r($_POST);
    $data = array();
    if (empty($_POST['cat_name'])) {
        exit('栏名不能为空');
        # code...
    }
    $data['cat_name'] = $_POST['cat_name'];
    $data['parent_id'] = $_POST['parent_id'];
    $data['intro'] = $_POST['intro'];
    require ROOT . 'model/catmodel.class.php';
    $catadd = new Catmodel();
    if ($catadd->add($data)) {
        echo '添加成功';
    } else {
        echo '添加失败';
    }
}