:::

5-2 /chart.php

<?php
/**
 * Phone Book module
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright  The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license    http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package    Phone Book
 * @since      2.5
 * @author     tad
 * @version    $Id $
 **/

/*-----------引入檔案區--------------*/
include "header.php";
$xoopsOption['template_main'] = set_bootstrap('phone_book_chart_b3.html');
include_once XOOPS_ROOT_PATH . "/header.php";
get_jquery(true);
/*-----------功能函數區--------------*/

//取得派圖資料
function get_pie_data(){
  global $xoopsDB;
  $sql="select b.cate_title, count(*) from `" . $xoopsDB->prefix("phone_book") . "` as a
  join `" . $xoopsDB->prefix("phone_book_cate") . "` as b
  on a.cate_sn=b.cate_sn
  group by a.cate_sn";
  $result = $xoopsDB->query($sql) or web_error($sql);
  while(list($cate_title, $count) = $xoopsDB->fetchRow($result)){
    $data[]="\n['{$cate_title}', {$count}]";
  }
  $all_data=implode(',',$data);
  return $all_data;
}


/*-----------執行動作判斷區----------*/
$pie_data=get_pie_data();
$xoopsTpl->assign('pie_data',$pie_data);

/*-----------秀出結果區--------------*/

$xoopsTpl->assign("toolbar", toolbar_bootstrap($interface_menu));
$xoopsTpl->assign("isAdmin", $isAdmin);
include_once XOOPS_ROOT_PATH . '/footer.php';

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D39%26tbdsn%3D1241

書籍目錄

展開 | 闔起

線上使用者

46人線上 (5人在瀏覽線上書籍)

會員: 0

訪客: 46

更多…