Example #1
0
    $data['create_date'] = date('Y-m-d H:i:s', $_WGT['TIME']);
    $data['location_name'] = isset($_POST['location_name']) ? str_inmysql($_POST['location_name']) : '';
    $data['location_intro'] = isset($_POST['location_intro']) ? str_inmysql($_POST['location_intro']) : '';
    $data['location_desc'] = isset($_POST['location_desc']) ? str_inmysql($_POST['location_desc']) : '';
    $data['location_pic'] = isset($_POST['location_pic']) ? str_inmysql($_POST['location_pic']) : '';
    $data['state'] = isset($_POST['state']) ? str_inmysql($_POST['state']) : '';
    $data['x_dian'] = isset($_POST['x_dian']) ? str_inmysql($_POST['x_dian']) : '';
    $data['y_dian'] = isset($_POST['y_dian']) ? str_inmysql($_POST['y_dian']) : '';
    if (!$data['location_name']) {
        ajax_feedback(0, '1310');
    }
    if (!$data['x_dian']) {
        ajax_feedback(0, '1311');
    }
    if (!$data['y_dian']) {
        ajax_feedback(0, '1312');
    }
    //save-InfoLbs
    $info_id = Model_Table::get('InfoLbs')->upsert($data);
    //save-keywordlist
    $list = array('customer_id' => $customer_id, 'info_id' => $info_id, 'keyword' => $data['keyword'], 'info_type' => $info_type);
    Model_Table::get('KeywordList')->saveForKeywords($list);
    //return
    ajax_feedback(1);
}
//category
$cateModel = new Model_InfoCate();
$cates = $cateModel->getCatesByType($info_type);
$smarty->assign("cates", $cates);
$smarty->assign("today", date("Y-m-d"));
$smarty->setTpl('info/templates/lbs.html')->display();
Example #2
0
    }
}
$filter['order'] = "id desc";
//result
$table = 'Model_Info' . ucfirst(Model_InfoCate::getTypeName($type));
$infoModel = new $table();
//echo "<pre>";var_dump($filter);die();
$result = $infoModel->paginate($filter, '*', $page, $size = '20');
$pager = $result['pager'];
//pager
if ($pager['pagenum'] > $pager['size']) {
    $pagerhtml = new SubPages($pager['size'], $pager['count'], $pager['current'], $pager['range'], 2);
    $smarty->assign("pagerhtml", $pagerhtml);
}
//category
$cateModel = new Model_InfoCate();
$cates = $cateModel->getCatesByType($type);
//获取分类条数
foreach ($cates as &$v) {
    $filter['where'] = "customer_id='{$customer_id}' and cate_id='{$v['id']}'";
    $v['cate_num'] = $infoModel->count($filter);
}
//echo "<pre>";var_dump($cates);die();
//smarty
if ($cate_id) {
    $smarty->assign("cate_id", $cate_id);
}
$smarty->assign("type", $type);
$smarty->assign("typeyhtml", $type . "_table");
$smarty->assign("cates", $cates);
//var_dump($result[data]);die();
Example #3
0
<?php

include_once "../../includes/config.inc.php";
include_once "../../includes/login_check.php";
$customer_id = (int) $_SESSION['customer_id'];
$infoModel = new Model_InfoCate();
if (method_is('post') && $_POST['cate_name_two']) {
    $cate_name = str_inmysql($_POST['cate_name_two']);
    $id = (int) $_POST['id'];
    $infoModel->query("update info_cate set cate_name='{$cate_name}' where id='{$id}' and customer_id='{$customer_id}'");
    echo "success";
    die;
}
if (method_is('post') && $_POST['del_id']) {
    $id = (int) $_POST['del_id'];
    $infoModel->delete("id='{$id}' and customer_id='{$customer_id}'");
    echo "success";
    die;
}
$type = $_POST['info_type'];
$data['info_type'] = str_inmysql($_POST['info_type']);
$data['customer_id'] = $customer_id;
$data['cate_name'] = $_POST['cate_name'];
$filter['where'] = "info_type='{$data['info_type']}' and customer_id='{$customer_id}' and cate_name='{$data['cate_name']}'";
$nums = $infoModel->count($filter);
if ($nums > 0) {
    echo '1';
    die;
}
$num = $infoModel->insert($data);
if ($num > 0) {