Ejemplo n.º 1
0
 function show_user_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "使用者列表";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $site_data = array();
     $count = 0;
     $dataTotal = $db->get_var("SELECT COUNT(user_id) FROM sys_user WHERE user_id != 'awoo_maintainer'");
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $sql = "SELECT user_id,user_nickname,user_email FROM sys_user WHERE user_id != 'awoo_maintainer' LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql);
     if (isset($result)) {
         foreach ($result as $rows) {
             $site_data[] = array('count' => $count + 1, 'user_id' => $rows->user_id, 'user_nickname' => $rows->user_nickname, 'user_email' => $rows->user_email, "show_edit_user_link" => $this->plu_path . "&func=show_edit_user&user_id={$rows->user_id}", "do_del_user_link" => $this->plu_path . "&func=do_del_user&user_id={$rows->user_id}");
             $count++;
         }
     }
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $count);
     $tpl->assign("site_data", $site_data);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("show_add_user_link", $this->plu_path . "&func=show_add_user");
     $tpl->assign("plu_header_path", $plu_header);
     return $tpl->fetch("show_user_list.tpl");
 }
Ejemplo n.º 2
0
 function show_m01_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "mobile01文章管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     ///print_r($_POST);
     $kw_ids = isset($_POST["kw_ids"]) ? $_POST["kw_ids"] : NULL;
     $filter = "";
     if (isset($kw_ids)) {
         foreach ($kw_ids as $ids) {
             if (empty($filter)) {
                 $filter = " WHERE kw_ids LIKE '%[{$ids}]%' ";
             } else {
                 $filter .= " OR kw_ids LIKE '%[{$ids}]%' ";
             }
         }
     }
     if (!empty($filter)) {
         $_SESSION['m01_filter'] = $filter;
     } else {
         if (!empty($_GET['page']) && isset($_SESSION['filter']) && !empty($_SESSION['filter'])) {
             $filter = $_SESSION['m01_filter'];
         }
     }
     $sel_sql = "SELECT DISTINCT kw_id, kw_content FROM plu_keywords";
     $sel_result = $db->get_results($sel_sql, ARRAY_A);
     $dataTotal = $db->get_var("SELECT COUNT(m01_id) FROM plu_mobile01" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal, 5);
     $sql = "SELECT m01_id, m01_title, m01_post_time, ModiTime FROM plu_mobile01 " . $filter . " LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $tpl->assign("sel_data", $sel_result);
     $tpl->assign("kw_ids", $kw_ids);
     $tpl->assign("m01_data", $result);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("css_path", WEBROOT . $this->css_path);
     $tpl->assign("img_path", WEBROOT . $this->upload_path);
     $tpl->assign("show_add_m01_link", $this->plu_path . "&func=show_add_m01");
     //$tpl->assign("show_add_news_category", $this->plu_path."&func=show_add_category");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_m01_list_link", $this->plu_path . "&func=show_m01_list");
     $tpl->assign("show_edit_m01_link", $this->plu_path . "&func=show_edit_m01&m01_id=");
     $tpl->assign("do_del_m01_link", $this->plu_path . "&func=do_del_m01&m01_id=");
     $tpl->assign("jq_multi_select_path", WEBROOT . "/cms/lib/jquery/multiSelect/");
     return $tpl->fetch("show_m01_list.tpl");
 }
Ejemplo n.º 3
0
 function show_doc_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "文件下載管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $filter = "";
     if (!empty($_POST["cate_id"]) && preg_match("/^[0-9]*\$/", $_POST["cate_id"])) {
         $cate_id = $_POST["cate_id"];
         $tpl->assign("cate_id", $cate_id);
         $filter = " WHERE cate_id = {$cate_id} ";
     }
     $sel_sql = "SELECT DISTINCT cate_id, cate_name FROM plu_document_category";
     $sel_result = $db->get_results($sel_sql, ARRAY_A);
     $dataTotal = $db->get_var("SELECT COUNT(doc_id) FROM plu_document" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $sql = "SELECT * FROM plu_document" . $filter . " LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $newArray = array();
     $i = 0;
     if (count($result) > 0) {
         foreach ($result as $row) {
             $newArray[$i] = array();
             foreach ($row as $key => $value) {
                 $newArray[$i][$key] = $value;
                 if ($key == "name") {
                     $newArray[$i][$key] = substr($value, 0, strrpos($row[$key], "."));
                 }
             }
             $i++;
         }
     }
     $tpl->assign("sel_data", $sel_result);
     $tpl->assign("doc_data", $newArray);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("show_doc_list_url", $this->plu_path . "&func=show_doc_list");
     $tpl->assign("show_add_doc_link", $this->plu_path . "&func=show_add_doc");
     $tpl->assign("show_add_cate_url", $this->plu_path . "&func=show_add_category");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_edit_doc_link", $this->plu_path . "&func=show_edit_doc&doc_id=");
     $tpl->assign("do_del_doc_link", $this->plu_path . "&func=do_del_doc&doc_id=");
     return $tpl->fetch("show_doc_list.tpl");
 }
Ejemplo n.º 4
0
 function show_news_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "最新消息管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $cate_id = !empty($_POST["cid"]) && preg_match("/^[0-9]*\$/", $_POST["cid"]) ? $_POST["cid"] : NULL;
     $filter = isset($cate_id) ? " WHERE cate_id = {$cate_id} " : "";
     if (!empty($filter)) {
         $_SESSION['news_filter'] = $filter;
     } else {
         if (!empty($_GET['page']) && isset($_SESSION['filter']) && !empty($_SESSION['filter'])) {
             $filter = $_SESSION['news_filter'];
         }
     }
     $sel_sql = "SELECT DISTINCT cate_id, cate_name FROM plu_news_category";
     $sel_result = $db->get_results($sel_sql, ARRAY_A);
     $dataTotal = $db->get_var("SELECT COUNT(news_id) FROM plu_news" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $orderby = isset($_GET["orderby"]) ? $_GET["orderby"] : "";
     if ($orderby == "ASC") {
         $tpl->assign("news_orderby_cond", $orderby);
         $tpl->assign("news_orderby_url", $this->plu_path . "&func=show_news_list&orderby=DESC");
         $filter .= " ORDER BY ModiTime ASC";
     } else {
         $tpl->assign("news_orderby_url", $this->plu_path . "&func=show_news_list&orderby=ASC");
         $filter .= " ORDER BY ModiTime DESC";
     }
     $sql = "SELECT news_id, caption, img_name, ModiTime FROM plu_news" . $filter . " LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $tpl->assign("sel_data", $sel_result);
     $tpl->assign("cate_id", $cate_id);
     $tpl->assign("news_data", $result);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("img_path", WEBROOT . $this->upload_path);
     $tpl->assign("show_add_news_link", $this->plu_path . "&func=show_add_news");
     $tpl->assign("show_add_news_category", $this->plu_path . "&func=show_add_category");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_edit_news_link", $this->plu_path . "&func=show_edit_news&news_id=");
     $tpl->assign("do_del_news_link", $this->plu_path . "&func=do_del_news&news_id=");
     return $tpl->fetch("show_news_list.tpl");
 }
Ejemplo n.º 5
0
 function show_dist_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "服務據點管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $place_id = !empty($_POST["place_id"]) && preg_match("/^[0-9]*\$/", $_POST["place_id"]) ? $_POST["place_id"] : NULL;
     $filter = isset($place_id) ? " WHERE place_id = '{$place_id}' " : "";
     $sel_sql = "SELECT DISTINCT place_id, place_name FROM plu_dist_place";
     $sel_result = $db->get_results($sel_sql, ARRAY_A);
     $dataTotal = $db->get_var("SELECT COUNT(dist_id) FROM plu_distributor" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $orderby = isset($_GET["orderby"]) ? $_GET["orderby"] : "";
     if ($orderby == "ASC") {
         $tpl->assign("dist_orderby_cond", $orderby);
         $tpl->assign("dist_orderby_url", $this->plu_path . "&func=show_dist_list&orderby=DESC");
         $filter .= " ORDER BY ModiTime ASC";
     } else {
         $tpl->assign("dist_orderby_url", $this->plu_path . "&func=show_dist_list&orderby=ASC");
         $filter .= " ORDER BY ModiTime DESC";
     }
     $sql = "SELECT dist_id, dist_name, dist_phone,dist_address, img_name, ModiTime FROM plu_distributor" . $filter . " LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $tpl->assign("sel_data", $sel_result);
     $tpl->assign("place_id", $place_id);
     $tpl->assign("dist_data", $result);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("img_path", WEBROOT . $this->upload_path);
     $tpl->assign("show_add_dist_link", $this->plu_path . "&func=show_add_dist");
     $tpl->assign("show_add_dist_place", $this->plu_path . "&func=show_add_place");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_edit_dist_link", $this->plu_path . "&func=show_edit_dist&dist_id=");
     $tpl->assign("do_del_dist_link", $this->plu_path . "&func=do_del_dist&dist_id=");
     return $tpl->fetch("show_dist_list.tpl");
 }
Ejemplo n.º 6
0
 function show_member_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "會員管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $filter = "";
     if (isset($_POST["search_item"])) {
         $search_item = $_POST["search_item"];
         $filter = " WHERE account LIKE '%{$search_item}%' OR name LIKE '%{$search_item}%'";
     } else {
         if (!empty($_POST["gid"]) && preg_match("/^[0-9]*\$/", $_POST["gid"])) {
             $cate_id = $_POST["gid"];
             $tpl->assign("cate_id", $cate_id);
             $filter = " WHERE group_id = {$cate_id} ";
         }
     }
     $sel_sql = "SELECT DISTINCT group_id, group_name FROM plu_member_group";
     $sel_result = $db->get_results($sel_sql, ARRAY_A);
     $dataTotal = $db->get_var("SELECT COUNT(member_id) FROM plu_member" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $sql = "SELECT * FROM plu_member" . $filter . " LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $tpl->assign("sel_data", $sel_result);
     $tpl->assign("member_data", $result);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("search_member_url", $this->plu_path . "&func=show_member_list");
     $tpl->assign("show_add_member_link", $this->plu_path . "&func=show_add_member");
     $tpl->assign("show_add_group_url", $this->plu_path . "&func=show_add_group");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_edit_member_link", $this->plu_path . "&func=show_edit_member&member_id=");
     $tpl->assign("do_del_member_link", $this->plu_path . "&func=do_del_member&member_id=");
     return $tpl->fetch("show_member_list.tpl");
 }
Ejemplo n.º 7
0
<?php

require_once SRVROOT . "/cms/inc/incpkg.inc.php";
include_db_pkg();
$news_id = isset($_GET['news_id']) ? $_GET['news_id'] : "";
if (!(isset($_GET['news_id']) && preg_match("/^[0-9]*\$/", $_GET['news_id']))) {
    redirect(WEBROOT, 0, "sorry!!你所要觀看的消息不合法");
    exit;
}
$db = init_db();
$upload_path = "/cms/upload/news/";
$img_path = WEBROOT . $upload_path;
$dataTotal = $db->get_var("SELECT COUNT(news_id) FROM plu_news");
list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
$sql = "SELECT caption, content, img_name, ModiTime FROM plu_news WHERE news_id = '{$news_id}' LIMIT {$dataStart}, {$dataLen}";
$result = $db->get_results($sql);
if (isset($result)) {
    foreach ($result as $rows) {
        $path = $img_path . $rows->img_name;
        if (empty($rows->img_name)) {
            $path = WEBROOT . "/cms/upload/noImg.jpg";
        }
        ?>
	<div class="image_box right">
		<img style="width:300px;height:248px;" src="<?php 
        echo $path;
        ?>
" />
	</div>
	<div id="news_txtbox" class=" left">
		<h3 class="news_h3"><?php 
Ejemplo n.º 8
0
 function get_pri_list_count()
 {
     $db = init_db();
     $dataTotal = $db->get_var("SELECT COUNT(user_id) FROM sys_user WHERE user_id != 'awoo_maintainer' ");
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     return $pagejump;
 }
Ejemplo n.º 9
0
 function show_orders_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "訂單管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $filter = "";
     if (isset($_GET['opt'])) {
         switch ($_GET['opt']) {
             case 1:
                 if ($_POST['deliveryStatus'] == 2) {
                     $filter = " WHERE delivery_status = 1";
                 } else {
                     if ($_POST['deliveryStatus'] == 3) {
                         $filter = " WHERE delivery_status = 0";
                     }
                 }
                 break;
             case 2:
                 if ($_POST['paymentStatus'] == 2) {
                     $filter = " WHERE payment_status = 1";
                 } else {
                     if ($_POST['paymentStatus'] == 3) {
                         $filter = " WHERE payment_status = 0";
                     }
                 }
                 break;
             case 3:
                 if ($_POST['recordedStatus'] == 2) {
                     $filter = " WHERE recorded_status = 1";
                 } else {
                     if ($_POST['recordedStatus'] == 3) {
                         $filter = " WHERE recorded_status = 0";
                     }
                 }
                 break;
         }
     } else {
         if (isset($_POST['search_item'])) {
             $txt = htmlspecialchars($_POST['search_txt']);
             switch ($_POST['search_item']) {
                 case 0:
                     $filter = " WHERE order_number='{$txt}'";
                     break;
                 case 1:
                     $filter = " WHERE order_name='{$txt}'";
                     break;
                 case 2:
                     $filter = " WHERE receiver_name='{$txt}'";
                     break;
                 case 3:
                     $filter = " a JOIN plu_orders_detail b ON a.order_id=b.order_id JOIN plu_product c ON b.prod_id=c.prod_id WHERE c.name='{$txt}'";
                     break;
                 case 4:
                     $filter = " a JOIN plu_member b ON a.member_id=b.member_id WHERE account='{$txt}'";
                     break;
             }
         }
     }
     $dataTotal = $db->get_var("SELECT COUNT(order_id) FROM plu_orders" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $sql = "SELECT delivery_status, order_id, order_name, order_date, payment_status, total_amount FROM plu_orders" . $filter . " LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $tpl->assign("show_orders_list_url", $this->plu_path . "&func=show_orders_list");
     $tpl->assign("orders_data", $result);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("show_add_orders_link", $this->plu_path . "&func=show_add_orders");
     $tpl->assign("show_add_orders_category", $this->plu_subpath . "&func=show_add_category");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_edit_orders_link", $this->plu_path . "&func=show_edit_orders&order_id=");
     $tpl->assign("do_del_orders_link", $this->plu_path . "&func=do_del_orders&order_id=");
     return $tpl->fetch("show_orders_list.tpl");
 }
Ejemplo n.º 10
0
 function show_product_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "商品/服務管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $sel_sql = "SELECT DISTINCT cate_id, cate_name FROM plu_product_category WHERE parent_id=-1";
     $sel_result = $db->get_results($sel_sql, ARRAY_A);
     $tpl->assign("sel_data", $sel_result);
     $tpl->assign("second_cate", $this->get_subcategory_script());
     $filter = "";
     if (isset($_GET['opt'])) {
         if ($_GET['opt'] == 1 && !empty($_POST['search_txt'])) {
             $txt = htmlspecialchars($_POST['search_txt']);
             switch ($_POST['search_item']) {
                 case 0:
                     //分類名稱
                     $filter = " a JOIN plu_product_category b ON a.cate_id=b.cate_id WHERE b.cate_name LIKE '%" . $txt . "%'";
                     break;
                 case 1:
                     //編號
                     $filter = " WHERE prod_number LIKE '%" . $txt . "%'";
                     break;
                 default:
                     //商品/服務名稱
                     $filter = " WHERE name LIKE '%" . $txt . "%'";
                     break;
             }
         } else {
             if ($_GET['opt'] == 2) {
                 $cate_id = isset($_POST['cate_id']) && preg_match("/^[0-9]*\$/", $_POST['cate_id']) ? $_POST['cate_id'] : "";
                 $second_cate_id = isset($_POST['second_cate_id']) && preg_match("/^[0-9]*\$/", $_POST['second_cate_id']) ? $_POST['second_cate_id'] : "";
                 $selectedCategory = 0;
                 if ($second_cate_id != "") {
                     $selectedCategory = $second_cate_id;
                     $tpl->assign("sec_cate_id", $second_cate_id);
                 } else {
                     if ($cate_id != "") {
                         $selectedCategory = $cate_id;
                     }
                 }
                 if ($selectedCategory != 0) {
                     $tpl->assign("cate_id", $cate_id);
                     $sel_sql = "SELECT DISTINCT cate_id, cate_name, parent_id FROM plu_product_category WHERE parent_id='{$cate_id}'";
                     $sel_result = $db->get_results($sel_sql, ARRAY_A);
                     $tpl->assign("sec_sel_data", $sel_result);
                     $filter = isset($cate_id) ? " WHERE cate_id = {$selectedCategory} " : "";
                 }
             }
         }
     } else {
         if (isset($_GET['cate_id'])) {
             $cate_id = isset($_GET['cate_id']) && preg_match("/^[0-9]*\$/", $_GET['cate_id']) ? $_GET['cate_id'] : "";
             $filter = $cate_id != "" ? " WHERE cate_id = '{$cate_id}' " : "";
         }
     }
     if (!empty($filter)) {
         $_SESSION['filter'] = $filter;
     } else {
         if (!empty($_GET['page']) && isset($_SESSION['filter']) && !empty($_SESSION['filter'])) {
             $filter = $_SESSION['filter'];
         } else {
             //echo "1234";
             $_SESSION['filter'] = "";
         }
     }
     $dataTotal = $db->get_var("SELECT COUNT(prod_id) FROM plu_product" . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $sql = "SELECT prod_id, prod_number, name, img_name, content FROM plu_product" . $filter . " ORDER BY ModiTime DESC LIMIT {$dataStart}, {$dataLen}";
     $result = $db->get_results($sql, ARRAY_A);
     $tpl->assign("search_item_url", $this->plu_path . "&func=show_product_list&opt=1");
     $tpl->assign("img_path", WEBROOT . $this->upload_path);
     $newArray = array();
     $i = 0;
     if (isset($result) && count($result) > 0) {
         foreach ($result as $row) {
             $newArray[$i] = array();
             foreach ($row as $key => $value) {
                 if ($key == "img_name") {
                     $idx = strpos($row[$key], "|");
                     if ($idx > 0) {
                         $newArray[$i][$key] = substr($value, 0, $idx);
                     } else {
                         $newArray[$i][$key] = $row[$key];
                     }
                 } else {
                     if ($key == "content") {
                         $newArray[$i][$key] = strip_tags($value);
                     } else {
                         $newArray[$i][$key] = $value;
                     }
                 }
             }
             $i++;
         }
     }
     $tpl->assign("show_product_list_url", $this->plu_path . "&func=show_product_list&opt=2");
     $tpl->assign("product_data", $newArray);
     //$result);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("show_add_product_link", $this->plu_path . "&func=show_add_product");
     $tpl->assign("show_add_product_category", $this->plu_subpath . "&func=show_add_category");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("show_edit_product_link", $this->plu_path . "&func=show_edit_product&prod_id=");
     $tpl->assign("do_del_product_link", $this->plu_path . "&func=do_del_product&prod_id=");
     return $tpl->fetch("show_product_list.tpl");
 }
Ejemplo n.º 11
0
 function show_objects_list()
 {
     $db = init_db();
     $tpl = init_tpl(SRVROOT . $this->tmpl_path);
     $plu_header = SRVROOT . $this->plu_header_path;
     //加入麵包屑
     $func_Cname = "物件管理";
     $trail = new Breadcrumb();
     $trail->add($func_Cname, $_SERVER['REQUEST_URI'], 1);
     $county = array(0, '台北市', '基隆市', '台北縣', '宜蘭縣', '桃園縣', '新竹市', '新竹縣', '苗栗縣', '台中市', '台中縣', '彰化縣', '南投縣', '嘉義市', '嘉義縣', '雲林縣', '台南市', '台南縣', '高雄市', '高雄縣', '澎湖縣', '屏東縣', '台東縣', '花蓮縣', '金門縣', '連江縣', '海南諸島');
     $district = array('100' => '中正區', '103' => '大同區', '104' => '中山區', '105' => '松山區', '106' => '大安區', '108' => '萬華區', '110' => '信義區', '111' => '士林區', '112' => '北投區', '114' => '內湖區', '115' => '南港區', '116' => '文山區', '200' => '仁愛區', '201' => '信義區', '202' => '中正區', '203' => '中山區', '204' => '安樂區', '205' => '暖暖區', '206' => '七堵區', '207' => '萬里鄉', '208' => '金山鄉', '220' => '板橋市', '221' => '汐止市', '222' => '深坑鄉', '223' => '石碇鄉', '224' => '瑞芳鎮', '226' => '平溪鄉', '227' => '雙溪鄉', '228' => '貢寮鄉', '231' => '新店市', '232' => '坪林鄉', '233' => '烏來鄉', '234' => '永和市', '235' => '中和市', '236' => '土城市', '237' => '三峽鎮', '238' => '樹林市', '239' => '鶯歌鎮', '241' => '三重市', '242' => '新莊市', '243' => '泰山鄉', '244' => '林口鄉', '247' => '蘆洲市', '248' => '五股鄉', '249' => '八里鄉', '251' => '淡水鎮', '252' => '三芝鄉', '253' => '石門鄉', '260' => '宜蘭市', '261' => '頭城鎮', '262' => '礁溪鄉', '263' => '狀圍鄉', '264' => '員山鄉', '265' => '羅東鎮', '266' => '三星鄉', '267' => '大同鄉', '268' => '五結鄉', '269' => '冬山鄉', '270' => '蘇澳鄉', '272' => '南澳鄉', '320' => '中壢市', '324' => '平鎮市', '325' => '龍潭鄉', '326' => '楊梅鎮', '327' => '新屋鄉', '328' => '觀音鄉', '330' => '桃園市', '333' => '龜山鄉', '334' => '八德市', '335' => '大溪鎮', '336' => '復興鄉', '337' => '大圍鄉', '338' => '蘆竹鄉', '300' => '新竹市', '302' => '竹北市', '303' => '湖口鄉', '304' => '新豐鄉', '305' => '新埔鎮', '306' => '關西鎮', '307' => '芎林鄉', '308' => '寶山鄉', '310' => '竹東鎮', '311' => '五峰鄉', '312' => '橫山鄉', '313' => '尖石鄉', '314' => '北埔鄉', '315' => '峨眉鄉', '350' => '竹南鎮', '351' => '頭份鎮', '352' => '三灣鄉', '353' => '南庄鄉', '354' => '獅潭鄉', '356' => '後龍鎮', '357' => '通宵鎮', '358' => '苑裡鎮', '360' => '苗栗市', '361' => '造橋鄉', '362' => '頭屋鄉', '363' => '公館鄉', '364' => '大湖鄉', '365' => '泰安鄉', '366' => '銅鑼鄉', '367' => '三義鄉', '368' => '西湖鄉', '369' => '卓蘭鎮', '400' => '中區', '401' => '東區', '402' => '南區', '403' => '西區', '404' => '北區', '406' => '北屯區', '407' => '西屯區', '408' => '南屯區', '411' => '太平市', '412' => '大里市', '413' => '霧峰鄉', '414' => '烏日鄉', '420' => '豐原市', '421' => '后里鄉', '422' => '石岡鄉', '423' => '東勢鎮', '424' => '和平鄉', '426' => '新社鄉', '427' => '潭子鄉', '428' => '大雅鄉', '429' => '神岡鄉', '432' => '大肚鄉', '433' => '沙鹿鎮', '434' => '龍井鄉', '435' => '梧棲鎮', '436' => '清水鎮', '437' => '大甲鎮', '438' => '外埔鄉', '439' => '大安鄉', '500' => '彰化市', '502' => '芬園鄉', '503' => '花壇鄉', '504' => '秀水鄉', '505' => '鹿港鎮', '506' => '福興鄉', '507' => '線西鄉', '508' => '和美鎮', '509' => '伸港鄉', '510' => '員林鎮', '511' => '社頭鄉', '512' => '永靖鄉', '513' => '埔心鄉', '514' => '溪湖鎮', '515' => '大村鄉', '516' => '埔鹽鄉', '520' => '田中鎮', '521' => '北斗鎮', '522' => '田尾鄉', '523' => '埤頭鄉', '524' => '溪州鄉', '525' => '竹塘鄉', '526' => '二林鎮', '527' => '大城鄉', '528' => '芳苑鄉', '600' => '二水鄉', '540' => '南投市', '541' => '中寮鄉', '542' => '草屯鎮', '544' => '國姓鄉', '545' => '埔里鎮', '546' => '仁愛鄉', '551' => '名間鄉', '552' => '集集鎮', '553' => '水里鄉', '555' => '魚池鄉', '556' => '信義鄉', '557' => '竹山鎮', '558' => '鹿谷鄉', '600' => '嘉義市', '602' => '番路鄉', '603' => '梅山鄉', '604' => '竹崎鄉', '605' => '阿里山鄉', '606' => '中埔鄉', '607' => '大埔鄉', '608' => '水上鄉', '611' => '鹿草鄉', '612' => '太保市', '613' => '朴子市', '614' => '東石鄉', '615' => '六腳鄉', '616' => '新港鄉', '621' => '民雄鄉', '622' => '大林鎮', '623' => '溪口鄉', '624' => '義竹鄉', '625' => '布袋鎮', '630' => '斗南鎮', '631' => '大埤鄉', '632' => '虎尾鎮', '633' => '土庫鎮', '634' => '褒忠鄉', '635' => '東勢鄉', '636' => '臺西鄉', '637' => '崙背鄉', '638' => '麥寮鄉', '640' => '斗六市', '643' => '林內鄉', '646' => '古坑鄉', '647' => '薊桐鄉', '648' => '西螺鎮', '649' => '二崙鄉', '651' => '北港鎮', '652' => '水林鄉', '653' => '口湖鄉', '654' => '四湖鄉', '655' => '元長鄉', '700' => '中區', '701' => '東區', '702' => '南區', '703' => '西區', '704' => '北區', '708' => '安平區', '709' => '安南區', '710' => '永康市', '711' => '歸仁鄉', '712' => '新化鎮', '713' => '左鎮鄉', '714' => '玉井鄉', '715' => '楠西鄉', '716' => '南化鄉', '717' => '仁德鄉', '718' => '關廟鄉', '719' => '龍崎鄉', '720' => '官田鄉', '721' => '麻豆鎮', '722' => '佳里鎮', '723' => '西港鄉', '724' => '七股鄉', '725' => '將軍鄉', '726' => '學甲鎮', '727' => '北門鄉', '730' => '新營市', '731' => '後壁鄉', '732' => '白河鎮', '733' => '東山鄉', '734' => '六甲鄉', '735' => '下營鄉', '736' => '柳營鄉', '737' => '鹽水鎮', '741' => '善化鎮', '742' => '大內鄉', '743' => '山上鄉', '744' => '新市鄉', '745' => '安定鄉', '800' => '新興區', '801' => '前金區', '802' => '苓雅區', '803' => '鹽埕區', '804' => '鼓山區', '805' => '旗津區', '806' => '前鎮區', '807' => '三民區', '811' => '楠梓區', '812' => '小港區', '813' => '左營區', '814' => '仁武鄉', '815' => '大社鄉', '820' => '岡山鎮', '821' => '路竹鄉', '822' => '阿蓮鄉', '823' => '田寮鄉', '824' => '燕巢鄉', '825' => '橋頭鄉', '826' => '梓官鄉', '827' => '彌陀鄉', '828' => '永安鄉', '829' => '湖內鄉', '830' => '鳳山市', '831' => '大寮鄉', '832' => '林園鄉', '833' => '鳥松鄉', '840' => '大樹鄉', '842' => '旗山鎮', '843' => '美濃鎮', '844' => '六龜鄉', '845' => '內門鄉', '846' => '杉林鄉', '847' => '甲仙鄉', '848' => '桃源鄉', '849' => '三民鄉', '851' => '茂林鄉', '852' => '茄萣鄉', '880' => '馬公市', '881' => '西嶼鄉', '882' => '望安鄉', '883' => '七美鄉', '884' => '白沙鄉', '885' => '湖西鄉', '900' => '屏東市', '901' => '三地門鄉', '902' => '霧臺鄉', '903' => '瑪家鄉', '904' => '九如鄉', '905' => '里港鄉', '906' => '高樹鄉', '907' => '鹽埔鄉', '908' => '長治鄉', '909' => '麟洛鄉', '911' => '竹田鄉', '912' => '內埔鄉', '913' => '萬丹鄉', '920' => '潮州鎮', '921' => '泰武鄉', '922' => '來義鄉', '923' => '萬巒鄉', '924' => '崁頂鄉', '925' => '新埤鄉', '926' => '南州鄉', '927' => '林邊鄉', '928' => '東港鎮', '929' => '琉球鄉', '931' => '佳冬鄉', '932' => '新園鄉', '940' => '枋寮鄉', '941' => '枋山鄉', '942' => '春日鄉', '943' => '獅子鄉', '944' => '車城鄉', '945' => '牡丹鄉', '946' => '恆春鎮', '947' => '滿州鄉', '950' => '臺東市', '951' => '綠島鄉', '952' => '蘭嶼鄉', '953' => '延平鄉', '954' => '卑南鄉', '955' => '鹿野鄉', '956' => '關山鎮', '957' => '海端鄉', '958' => '池上鄉', '959' => '東河鄉', '961' => '成功鎮', '962' => '長濱鄉', '963' => '太麻里鄉', '964' => '金峰鄉', '965' => '大武鄉', '966' => '達仁鄉', '970' => '花蓮市', '971' => '新城鄉', '972' => '秀林鄉', '973' => '吉安鄉', '974' => '壽豐鄉', '975' => '鳳林鎮', '976' => '光復鄉', '977' => '豐濱鄉', '978' => '瑞穗鄉', '979' => '萬榮鄉', '981' => '玉里鎮', '982' => '卓溪鄉', '983' => '富里鄉', '891' => '金湖鎮', '892' => '金寧鄉', '893' => '金城鎮', '894' => '烈嶼鄉', '896' => '烏坵鄉', '209' => '南竿', '210' => '北竿', '211' => '莒光', '212' => '東引', '817' => '東沙', '819' => '南沙', '290' => '釣魚台');
     $searchStr = "";
     $filter = "";
     $order = "";
     if (isset($_POST['searchbtn'])) {
         if (!empty($_POST['county']) && preg_match("/^[0-9]*\$/", $_POST["county"])) {
             $this->setFilterValue($filter, "county=" . $_POST['county']);
             $searchStr = $county[$_POST['county']] . ",";
         }
         if (!empty($_POST['district']) && preg_match("/^[0-9]*\$/", $_POST["district"])) {
             $this->setFilterValue($filter, "district=" . $_POST['district']);
             $searchStr .= $district[$_POST['district']] . ",";
         }
         if (!empty($_POST['auction_no'])) {
             $this->setFilterValue($filter, "auction_no LIKE '%" . htmlspecialchars($_POST['auction_no'] . "%'"));
             $searchStr .= htmlspecialchars($_POST['auction_no']) . ",";
         }
         if (!empty($_POST['beginDate']) && preg_match("/^[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}\$/", $_POST['beginDate'])) {
             $searchStr .= $_POST['beginDate'];
             $_POST['beginDate'] = $this->formatDate($_POST['beginDate']);
             $this->setFilterValue($filter, "auction_date>='" . $_POST['beginDate'] . "'");
         }
         if (!empty($_POST['endDate']) && preg_match("/^[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}\$/", $_POST['endDate'])) {
             $searchStr .= "-" . $_POST['endDate'] . ",<BR />";
             $_POST['endDate'] = $this->formatDate($_POST['endDate']);
             $this->setFilterValue($filter, "auction_date<='" . $_POST['endDate'] . "'");
         } else {
             $searchStr .= "-<BR />";
         }
         if (!empty($_POST['addr'])) {
             $this->setFilterValue($filter, "obj_addr LIKE '%" . htmlspecialchars($_POST['addr'] . "%'"));
             $searchStr .= sprintf('%7s', $_POST['addr']) . "...,";
         }
         $searchStr .= "未放置";
         if (!empty($_POST['unplaced_land']) && $_POST['unplaced_land'] == 'land') {
             $this->setFilterValue($filter, "b.total_area=0");
             $searchStr .= "謄本、";
         }
         if (!empty($_POST['unplaced_pic']) && $_POST['unplaced_pic'] == 'pic') {
             $this->setFilterValue($filter, "c.pha IS NULL ");
             $searchStr .= "相片、";
         }
         if (!empty($_POST['unplaced_struct']) && $_POST['unplaced_struct'] == 'structure') {
             $this->setFilterValue($filter, "e.hoa IS NULL ");
             $searchStr .= "平面圖";
         }
         if (!empty($_POST['unplaced_market']) && $_POST['unplaced_market'] == 'market') {
             $this->setFilterValue($filter, "quotations_addr_1 = '' AND quotations_addr_2 ='' ");
             $searchStr .= "行情";
         }
         if (!empty($_POST['unplaced_info']) && $_POST['unplaced_info'] == 'info') {
             $this->setFilterValue($filter, "d.pia IS NULL ");
             $searchStr .= "房訊";
         }
         $_SESSION['filter'] = $filter;
     } else {
         if (!empty($_GET['page']) && isset($_SESSION['filter']) && !empty($_SESSION['filter'])) {
             $filter = $_SESSION['filter'];
         }
     }
     if (isset($_GET['OPT'])) {
         switch ($_GET['OPT']) {
             case 2:
                 $order = "auction_date";
                 break;
             case 3:
                 $order = "auction_times";
                 break;
             case 4:
                 $order = "auction_times DESC";
                 break;
             case 5:
                 $order = "object_id";
                 break;
             case 6:
                 $order = "object_id DESC";
                 break;
             default:
                 $order = "auction_date DESC";
         }
         $order = " ORDER BY " . $order;
     } else {
         $order = " ORDER BY auction_date DESC";
     }
     $dataTotal = $db->get_var("SELECT COUNT(*) FROM plu_objects a JOIN plu_objects_household b ON a.object_id=b.object_id\r\nLEFT JOIN (SELECT object_id,COUNT(item) as pha FROM plu_objects_pic WHERE item LIKE 'pic_%' GROUP BY object_id) c ON (a.object_id=c.object_id)\r\nLEFT JOIN (SELECT object_id,COUNT(item) as pia FROM plu_objects_pic WHERE item LIKE 'house_pic_%' GROUP BY object_id) d ON (a.object_id=d.object_id)\r\nLEFT JOIN (SELECT object_id,COUNT(item) as hoa FROM plu_objects_pic WHERE item LIKE 'structure_%' GROUP BY object_id) e ON (a.object_id=e.object_id) " . $filter);
     list($dataStart, $dataLen, $pagejump) = init_sliding_pager($dataTotal);
     $sql = "SELECT a.*,IFNULL(b.total_area, 0) as total_area,IFNULL(c.pha, 0) as photo_amount,IFNULL(d.pia,0) as pic_amount,IFNULL(e.hoa,0) as house_amount FROM plu_objects a JOIN plu_objects_household b ON a.object_id=b.object_id\r\nLEFT JOIN (SELECT object_id,COUNT(item) as pha FROM plu_objects_pic WHERE item LIKE 'pic_%' GROUP BY object_id) c ON (a.object_id=c.object_id)\r\nLEFT JOIN (SELECT object_id,COUNT(item) as pia FROM plu_objects_pic WHERE item LIKE 'house_pic_%' GROUP BY object_id) d ON (a.object_id=d.object_id)\r\nLEFT JOIN (SELECT object_id,COUNT(item) as hoa FROM plu_objects_pic WHERE item LIKE 'structure_%' GROUP BY object_id) e ON (a.object_id=e.object_id) ";
     $sql .= $filter . $order . " LIMIT {$dataStart}, {$dataLen}";
     //		echo $sql."<BR />";
     $result = $db->get_results($sql, ARRAY_A);
     $newArray = array();
     $i = 0;
     if (isset($result) && count($result) > 0) {
         foreach ($result as $row) {
             $newArray[$i] = array();
             foreach ($row as $key => $value) {
                 if ($key == "county") {
                     $newArray[$i][$key] = $county[$value];
                 } else {
                     if ($key == "district") {
                         $newArray[$i][$key] = $district[$value];
                     } else {
                         $newArray[$i][$key] = $value;
                     }
                 }
             }
             $i++;
         }
     }
     $tpl->assign("searchStr", $searchStr);
     $tpl->assign("show_objects_list_url", $this->plu_path . "&func=show_objects_list");
     $tpl->assign("OPT", isset($_GET['OPT']) ? intval($_GET['OPT']) : 1);
     $tpl->assign("objects_data", $newArray);
     $tpl->assign("pager", $pagejump);
     $tpl->assign("count", $dataTotal);
     $tpl->assign("func_Cname", $func_Cname);
     $tpl->assign("show_add_objects_link", $this->plu_path . "&func=show_add_objects");
     $tpl->assign("datepicker_url", WEBROOT . '/cms/lib/js/chineseDatepicker.js');
     $tpl->assign("show_add_objects_category", $this->plu_subpath . "&func=show_add_category");
     $tpl->assign("plu_header_path", $plu_header);
     $tpl->assign("img_path", WEBROOT . $this->img_path);
     $tpl->assign("show_edit_objects_link", $this->plu_path . "&func=show_edit_objects&object_id=");
     $tpl->assign("do_del_objects_link", $this->plu_path . "&func=do_del_objects&object_id=");
     return $tpl->fetch("show_objects_list.tpl");
 }