function tad_web_list_cate() { global $xoopsDB, $xoopsTpl, $isAdmin; $myts = MyTextSanitizer::getInstance(); $sql = "select * from `" . $xoopsDB->prefix("tad_web_cate") . "` where `WebID`='0' and `ColName`='web_cate' and `ColSN`='0' order by `CateSort`"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all_content = ''; $i = 0; $web_cate = get_web_cate_arr(); while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $CateID, $WebID, $CateName, $ColName, $ColSN, $CateSort, $CateEnable, $CateCounter foreach ($all as $k => $v) { ${$k} = $v; } //將是/否選項轉換為圖示 $CateEnable = $CateEnable == 1 ? '<img src="' . XOOPS_URL . '/modules/tad_web/images/yes.gif" alt="' . _YES . '" title="' . _YES . '">' : '<img src="' . XOOPS_URL . '/modules/tad_web/images/no.gif" alt="' . _NO . '" title="' . _NO . '">'; //過濾讀出的變數值 $CateName = $myts->htmlSpecialChars($CateName); $ColName = $myts->htmlSpecialChars($ColName); $ColSN = $myts->htmlSpecialChars($ColSN); $all_content[$i]['CateID'] = $CateID; $all_content[$i]['WebID'] = ${$WebID}; $all_content[$i]['CateName'] = $CateName; $all_content[$i]['ColName'] = $ColName; $all_content[$i]['ColSN'] = $ColSN; $all_content[$i]['CateSort'] = $CateSort; $all_content[$i]['CateEnable'] = $CateEnable; $all_content[$i]['CateCounter'] = $CateCounter; //die(var_export($web_cate[0])); $all_content[$i]['repository'] = $web_cate[0]; $all_content[$i]['destination'] = $web_cate[$CateID]; $all_content[$i]['web_cate_arr_str'] = implode(",", $web_cate[$CateID]['WebID']); $all_content[$i]['web_cate_blank_arr'] = implode(",", $web_cate[0]['WebID']); $i++; } //刪除確認的JS if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php")) { redirect_header("index.php", 3, _MA_NEED_TADTOOLS); } include_once XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php"; $sweet_alert_obj = new sweet_alert(); $delete_tad_web_cate_func = $sweet_alert_obj->render('delete_tad_web_cate_func', "{$_SERVER['PHP_SELF']}?op=delete_tad_web_cate&CateID=", "CateID"); $xoopsTpl->assign('delete_tad_web_cate_func', $delete_tad_web_cate_func); $xoopsTpl->assign('tad_web_cate_jquery_ui', get_jquery(true)); $xoopsTpl->assign('bar', $bar); $xoopsTpl->assign('action', $_SERVER['PHP_SELF']); $xoopsTpl->assign('isAdmin', $isAdmin); $xoopsTpl->assign('all_content', $all_content); }
function get_tad_web_cate_all() { global $xoopsDB; $web_cate = new web_cate('0', '', "web_cate"); $cate = $web_cate->get_tad_web_cate_arr(); $webs = get_web_cate_arr(); foreach ($cate as $CateID => $data) { $data_arr[$CateID] = $data; $data_arr[$CateID]['webs'] = $webs[$CateID]; } return $data_arr; }