儀錶板主頁
對應程式: index.php

業務功能
打卡系統的主控台頁面,提供開課中班別的即時出席狀況總覽、歷史出席率折線圖、以及缺席學員排行榜,供管理人員快速掌握各班出勤情形。
頁面操作
當日出席紀錄(即時更新)
- 以甜甜圈圖(Donut Chart)顯示每個開課中班別的即時出席人數 / 總人數
- 每 10 秒自動 AJAX 更新出席人數(呼叫
ajax_today.php) - 非上課日的班別會顯示灰色並提示「本日非上課日」
出席率歷史報表
- 以 C3.js 折線圖顯示各班每日出席率百分比
- 右上角「篩選班別」可開啟 ClassPicker Modal,依狀態(開課中/已結業)、地區(北/竹/中/南/企/短)、類別(技術/經理/醫療…)篩選班別
- 支援 Checkbox 多選、圖表支持縮放(zoom)
- 手機版自動顯示最後 6 天的 subchart
缺席學員排行榜
- 顯示指定班別中上課時數最少的學員排名
- 分為「🐔 無補刷」和「🐧 含補刷」兩個分頁
- 右上角可切換班別(ClassPicker Modal,Radio 單選)
- 排名表格各欄位支援排序(點擊 🔽 圖示)
- 預設顯示依據使用者 IP 所在地區對應的最新技術班
工具列表(Select2 下拉)
處理邏輯
- 載入流程:
index.php→requireinc.php(定義權限、函式、常數)→requireajax_today.php(處理 AJAX 請求)→requirehd.php(頁面 header) - 當日出席:透過
ClassDates::get_opening_classdates(true)取得開課中班別,逐班查詢學生卡片,以display_todaybox()產生甜甜圈圖 - 歷史報表:若 URL 無
kind_id參數,依使用者 IP 地區 (get_request_kind_area()) 自動選擇對應班別;組合 SQL 查詢每日出席人數,以 C3.js 繪製折線圖 - 缺席排行:呼叫
render_student_rank()計算每位學生的總上課時數(含/不含補刷),依時數升序排列,支援自訂每日最大時數(maxhr_by_date) - 篩選班別 Modal:前端 POST 至 ajax_get_card_kinds.php 取回符合條件的班別清單,動態產生 Checkbox/Radio
備註
- 頁面使用 D3.js v5 + C3.js 繪製圖表
- 使用者 IP 地區判斷透過
ipinfo.io外部 API IS_DEBUG_DASH_BACKEND常數(URL 帶?a)可切換到除錯後台模式- 出席時數上限預設 7.5 小時、休息時數 1 小時
- URL 支援
?kind_id[]=xxx指定多個班別
使用的 Functions
| Function | 定義於 |
|---|---|
calc_log_datetimes_total_seconds($ary_log_datetimes, ...) | dashboard/inc.php |
get_request_ip_location_city() | dashboard/inc.php |
get_request_kind_area() | dashboard/inc.php |
is_kind_inside_area($kind_name, $area) | dashboard/inc.php |
get_latest_kind_id_by_kind_area($area, $xlass) | dashboard/inc.php |
render_student_rank($kind_id) | dashboard/inc.php |
display_autocomplete_searchkind_input($part, $conf) | dashboard/inc.php |
display_todaybox($kind_id, $color, $total, $label, ...) | dashboard/inc.php |
display_classpicker_modal($classname, $modal_title) | dashboard/inc.php |
_add_cards_cache($kind_id, $ary_cards) | index.php |
_get_cards_cache($kind_id) | index.php |
get_short_kind_name($kind_name) | _aiacademy_helper.php |
get_matched_classprefix($kind_name, $flag) | _aiacademy_helper.php |
get_all_card_by_card_kind($kind_id, $flag) | enter_logs/inc.php |
get_kind_by_suffix_classprefix($classprefix) | enter_logs/inc.php |
get_kind_by_kind_id($kind_id) | enter_logs/inc.php |
get_all_kinds($flag1, $flag2) | enter_logs/inc.php |
get_holiday_logs_by_school_no($school_no, $result) | enter_logs/inc.php |
get_student_sum_of_holidays($ary, $map, $unit) | enter_logs/inc.php |
get_card_by_card_id($card_id) | enter_logs/inc.php |
is_CT_card($card_id) | enter_logs/inc.php |
now($format) | wp-config.php |
get_dates_diff($date1, $date2) | wp-config.php |
ajax_response($code, $data, $msg) | wp-config.php |
get_string_by_tmpl($str_tmpl, $dict) | wp-config.php |
is_user_logged_in() | WordPress core |
wp_get_current_user() | WordPress core |
$wpdb->get_results/get_row | WordPress core |
ClassDates::get_opening_classdates() | enter_logs/classes/ClassDates.php |
ClassDates::get_one($classprefix) | enter_logs/classes/ClassDates.php |
ClassDates::get_ary_dates($dates) | enter_logs/classes/ClassDates.php |
ClassDates::get_ary_dates_by_classprefix($prefix) | enter_logs/classes/ClassDates.php |
使用的常數
| Constant | 值 | 定義於 |
|---|---|---|
IS_DEBUG_DASH_BACKEND | isset($_GET['a']) | dashboard/inc.php |
TBL_ENTER_LOGS | "enter_logs" | enter_logs/inc.php |
ENTER_LOGS_URL | "/enter_logs/" | wp-config.php |
ENTER_LOGS_JQUERY_UI_URL | "/enter_logs/js/vendors/jquery-ui-1.12.1.custom/" | wp-config.php |
ENTER_LOGS_DASHBOARD_URL | "/enter_logs/dashboard/" | wp-config.php |
ENTER_LOGS_DASHBOARD_LIB_URL | "/enter_logs/dashboard/lib/" | wp-config.php |
PAGE_ACCESS_CONFIG_VALUE_FOR_ALL_STAFF | "ALL_STAFF" | enter_logs/inc.php |