function list_all_web($defCateID = '') { global $xoopsDB, $xoopsTpl; if (!is_dir(XOOPS_ROOT_PATH . "/themes/for_tad_web_theme")) { $xoopsTpl->assign('op', 'need_tad_web_theme'); return; } $and_cate = empty($defCateID) ? "" : "and CateID='{$defCateID}'"; $sql = "select * from " . $xoopsDB->prefix("tad_web") . " where 1 {$and_cate} order by WebSort"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $data = ""; $i = 1; include_once XOOPS_ROOT_PATH . "/modules/tadtools/jeditable.php"; $file = "save.php"; //$jeditable = new jeditable(false); while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $WebID , $WebName , $WebSort , $WebEnable , $WebCounter foreach ($all as $k => $v) { ${$k} = $v; $data[$i][$k] = $v; } $data[$i]['memAmount'] = memAmount($WebID); $data[$i]['uname'] = XoopsUser::getUnameFromId($WebOwnerUid, 0); //$jeditable->setSelectCol(".Class{$WebID}",$file,"{{$teacher_option}, 'selected':'{$WebOwnerUid}'}","{'WebID' : $WebID , 'op' : 'save_teacher'}",_MA_TCW_CLICK_TO_EDIT); $i++; } if (empty($data)) { $xoopsTpl->assign('op', 'create_web'); } else { //$jeditable_set=$jeditable->render(); $jquery = get_jquery(true); //$xoopsTpl->assign('jeditable_set',$jeditable_set); $xoopsTpl->assign('WebYear', $WebYear); $xoopsTpl->assign('data', $data); $xoopsTpl->assign('jquery', $jquery); $xoopsTpl->assign('CateID', $defCateID); $web_cate = new web_cate("", "", "web_cate"); $cate = $web_cate->get_tad_web_cate_arr(); $xoopsTpl->assign('cate', $cate); } }
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; }
function list_tad_web_discuss($WebID = "", $CateID = "", $limit = null) { global $xoopsDB, $xoopsUser, $xoopsTpl; if (!$xoopsUser and empty($_SESSION['LoginMemID'])) { $xoopsTpl->assign('mode', 'need_login'); } else { $showWebTitle = empty($WebID) ? 1 : 0; $andWebID = empty($WebID) ? "" : "and a.WebID='{$WebID}'"; //取得tad_web_cate所有資料陣列 $web_cate = new web_cate($WebID, "tad_web_discuss", "discuss"); if (empty($CateID)) { $andCateID = ""; } else { //取得單一分類資料 $cate = $web_cate->get_tad_web_cate($CateID); $xoopsTpl->assign('cate', $cate); $andCateID = "and a.`CateID`='{$CateID}'"; } $andLimit = $limit > 0 ? "limit 0,{$limit}" : ""; $sql = "select a.* from " . $xoopsDB->prefix("tad_web_discuss") . " as a left join " . $xoopsDB->prefix("tad_web") . " as b on a.WebID=b.WebID where b.`WebEnable`='1' and a.ReDiscussID='0' {$andWebID} {$andCateID} order by a.LastTime desc {$andLimit}"; if (empty($limit)) { //getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項); $PageBar = getPageBar($sql, 20, 10); $bar = $PageBar['bar']; $sql = $PageBar['sql']; $total = $PageBar['total']; } else { $bar = ""; } $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $main_data = ""; $i = 0; while ($all = $xoopsDB->fetchArray($result)) { //`DiscussID`, `ReDiscussID`, `CateID`, `WebID`, `MemID`, `MemName`, `DiscussTitle`, `DiscussContent`, `DiscussDate`, `LastTime`, `DiscussCounter` foreach ($all as $k => $v) { ${$k} = $v; } $renum = get_re_num($DiscussID); $show_re_num = empty($renum) ? "" : " ({$renum}) "; $LastTime = substr($LastTime, 0, 10); $Class = getWebInfo($WebID); $web_cate->set_WebID($WebID); $cate = $web_cate->get_tad_web_cate_arr(); $main_data[$i]['cate'] = $cate[$CateID]; $main_data[$i]['DiscussID'] = $DiscussID; $main_data[$i]['DiscussTitle'] = $DiscussTitle; $main_data[$i]['show_re_num'] = $show_re_num; $main_data[$i]['LastTime'] = $LastTime; $main_data[$i]['MemName'] = $MemName; $main_data[$i]['DiscussCounter'] = $DiscussCounter; $main_data[$i]['WebID'] = $WebID; $main_data[$i]['WebTitle'] = "<a href='index.php?WebID={$WebID}'>{$Class['WebTitle']}</a>"; $i++; } $xoopsTpl->assign('discuss_data', $main_data); $xoopsTpl->assign('bar', $bar); $xoopsTpl->assign('isMineDiscuss', isMine()); $xoopsTpl->assign('showWebTitleDiscuss', $showWebTitle); } }