$query = $dou->query($sql); $cate_info = $dou->fetch_array($query); // 赋值给模板-meta和title信息 $smarty->assign('page_title', $dou->page_title('article_category', $cat_id)); $smarty->assign('keywords', $cate_info['keywords']); $smarty->assign('description', $cate_info['description']); // 赋值给模板-导航栏 $smarty->assign('nav_top_list', $dou->get_nav('top')); $smarty->assign('nav_middle_list', $dou->get_nav('middle', '0', 'article_category', $cat_id, $cate_info['parent_id'])); $smarty->assign('nav_bottom_list', $dou->get_nav('bottom')); // 赋值给模板-数据 $smarty->assign('ur_here', $dou->ur_here('article_category', $cat_id)); $smarty->assign('cate_info', $cate_info); $smarty->assign('article_category', $dou->get_category('article_category', 0, $cat_id)); $smarty->assign('article_list', $article_list); $pageBar = getPageBar($smarty->_tpl_vars['pager']); $smarty->assign('pageBar', $pageBar); $smarty->display('article_category.dwt'); function getPageBar($pager) { $href = substr($pager['last'], 0, strrpos($pager['last'], 'page=')) . 'page='; //页面链接 $curr = $pager['page']; //当前页码 $count = $pager['page_count']; //总页数 $left = max($curr - 2, 1); //初步计算最左边页码 $right = min($left + 4, $count); //计算最右边页码 $left = max($right - 4, 1);
function list_jill_booking_item() { global $xoopsDB, $xoopsTpl, $isAdmin; $myts =& MyTextSanitizer::getInstance(); $sql = "select * from `" . $xoopsDB->prefix("jill_booking_item") . "` order by `jbi_sort`"; //getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項); $PageBar = getPageBar($sql, 20, 10, null, null, $_SESSION['bootstrap']); $bar = $PageBar['bar']; $sql = $PageBar['sql']; $total = $PageBar['total']; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all_content = ""; $i = 0; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $jbi_sn , $jbi_start , $jbi_end , $jbi_title , $jbi_desc , $jbi_approval , $jbi_sort , $jbi_enable foreach ($all as $k => $v) { ${$k} = $v; } //將是/否選項轉換為圖示 $jbi_enable = $jbi_enable == 1 ? '<img src="../images/yes.gif" alt="' . _YES . '" title="' . _YES . '">' : '<img src="../images/no.gif" alt="' . _NO . '" title="' . _NO . '">'; if (empty($jbi_approval)) { $jbi_approval = '<img src="../images/no.gif" alt="' . _NO . '" title="' . _NO . '">'; } else { $jbi_approvalArr = explode(";", $jbi_approval); //die(var_dump($jbi_approvalArr)); $jbi_approval = ""; foreach ($jbi_approvalArr as $approval_uid) { $jbi_approval .= XoopsUser::getUnameFromId($approval_uid, 1) . ","; } $jbi_approval = substr($jbi_approval, 0, -1); } //過濾讀出的變數值 $jbi_start = $myts->htmlSpecialChars($jbi_start); $jbi_end = $myts->htmlSpecialChars($jbi_end); $jbi_title = $myts->htmlSpecialChars($jbi_title); $jbi_desc = $myts->displayTarea($jbi_desc, 1, 1, 1, 1, 0); $all_content[$i]['jbi_sn'] = $jbi_sn; $all_content[$i]['jbi_start'] = $jbi_start; $all_content[$i]['jbi_end'] = $jbi_end; $all_content[$i]['jbi_title_link'] = "<a href='{$_SERVER['PHP_SELF']}?jbi_sn={$jbi_sn}'>{$jbi_title}</a>"; $all_content[$i]['jbi_title'] = $jbi_title; $all_content[$i]['jbi_desc'] = $jbi_desc; $all_content[$i]['jbi_approval'] = $jbi_approval; $all_content[$i]['jbi_sort'] = $jbi_sort; $all_content[$i]['jbi_enable'] = $jbi_enable; ++$i; } //刪除確認的JS $xoopsTpl->assign('bar', $bar); $xoopsTpl->assign('action', $_SERVER['PHP_SELF']); $xoopsTpl->assign('isAdmin', $isAdmin); $xoopsTpl->assign('all_content', $all_content); $xoopsTpl->assign('now_op', 'list_jill_booking_item'); 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 = new sweet_alert(); $delete_jill_booking_item_func = $sweet_alert->render('delete_jill_booking_item_func', "{$_SERVER['PHP_SELF']}?op=delete_jill_booking_item&jbi_sn=", "jbi_sn"); $xoopsTpl->assign('delete_jill_booking_item_func', $delete_jill_booking_item_func); }
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); } }
function jill_booking_list($def_jbi_sn = "") { global $xoopsDB, $xoopsTpl, $xoopsUser, $isAdmin, $Isapproval; if (!$xoopsUser) { return; } //場地設定 $item_opt = get_jill_booking_time_options($def_jbi_sn); $xoopsTpl->assign('item_opt', $item_opt); $where_jbisn = empty($def_jbi_sn) ? "" : " and c.jbi_sn='{$def_jbi_sn}' "; $uid = $xoopsUser->uid(); $myts =& MyTextSanitizer::getInstance(); $sql = "select a.jb_sn,a.jb_date,a.jbt_sn,a.jb_waiting,a.jb_status,b.jb_uid,b.jb_booking_time,b.jb_booking_content,b.jb_start_date,b.jb_end_date,c.jbi_sn,c.jbt_title,c.jbt_sort,d.jbi_title,d.jbi_approval\n from `" . $xoopsDB->prefix("jill_booking_date") . "` as a\n join `" . $xoopsDB->prefix("jill_booking") . "` as b on a.jb_sn=b.jb_sn\n join `" . $xoopsDB->prefix("jill_booking_time") . "` as c on a.jbt_sn=c.jbt_sn\n join `" . $xoopsDB->prefix("jill_booking_item") . "` as d on c.jbi_sn=d.jbi_sn\n where b.`jb_uid`='{$uid}' {$where_jbisn} order by a.jb_status desc,a.`jb_date` desc,a.`jb_waiting`,a.jbt_sn "; //die($sql); //getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項); $PageBar = getPageBar($sql, 20, 10, null, null, $_SESSION['bootstrap']); $bar = $PageBar['bar']; $sql = $PageBar['sql']; $total = $PageBar['total']; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all_content = ""; $i = 0; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數:jb_sn,jb_date,jbt_sn,,jb_waiting,jb_status,jb_uid,jb_booking_time,jb_booking_content,jb_start_date,jb_end_date,jbi_sn,jbt_title,jbt_sort,jbi_title,jbi_approval foreach ($all as $k => $v) { ${$k} = $v; } //過濾讀出的變數值 $jb_booking_content = $myts->displayTarea($jb_booking_content, 1, 1, 0, 1, 0); $jb_start_date = $myts->htmlSpecialChars($jb_start_date); $jb_end_date = $myts->htmlSpecialChars($jb_end_date); $all_content[$i]['jb_sn'] = $jb_sn; $all_content[$i]['jb_date'] = $jb_date; $all_content[$i]['jbt_sn'] = $jbt_sn; $all_content[$i]['primary'] = $jbi_sn . "_" . $jb_date . "_" . $jbt_sn; $all_content[$i]['jb_waiting'] = $jb_waiting; $all_content[$i]['jb_status'] = $jb_status; $all_content[$i]['jb_uid'] = XoopsUser::getUnameFromId($jb_uid, 1); $all_content[$i]['jb_booking_time'] = $jb_booking_time; $all_content[$i]['jb_booking_content'] = $jb_booking_content; $all_content[$i]['jb_start_date'] = $jb_start_date; $all_content[$i]['jb_end_date'] = $jb_end_date; $all_content[$i]['jbi_sn'] = $jbi_sn; $all_content[$i]['jbt_title'] = $jbt_title; $all_content[$i]['jbt_sort'] = $jbt_sort; $all_content[$i]['jbi_title'] = $jbi_title; $all_content[$i]['jbi_approval'] = $jbi_approval; $today = date("Y-m-d"); $all_content[$i]['fun'] = strtotime($jb_date) >= strtotime($today) ? 1 : ''; $i++; } //刪除確認的JS $xoopsTpl->assign('bar', $bar); $xoopsTpl->assign('action', $_SERVER['PHP_SELF']); $xoopsTpl->assign('isAdmin', $isAdmin); $xoopsTpl->assign('all_content', $all_content); $xoopsTpl->assign('now_op', 'jill_booking_list'); if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php"; $sweet_alert = new sweet_alert(); $delete_jill_booking_func = $sweet_alert->render('delete_jill_booking_func', "{$_SERVER['PHP_SELF']}?op=delete_jill_booking&primary=", "primary"); $xoopsTpl->assign('delete_jill_booking_func', $delete_jill_booking_func); }
function jill_booking_approvallist($jbi_sn = "") { global $xoopsDB, $xoopsTpl, $xoopsUser, $isAdmin; $uid = $xoopsUser->uid(); $myts =& MyTextSanitizer::getInstance(); //場地設定 $item_opt = get_jill_booking_time_options($jbi_sn, $uid); //die(var_export($item_opt)); if (!empty($jbi_sn)) { $itemArr = get_jill_booking_item($jbi_sn, 1); $checkapproval = explode(";", $itemArr['jbi_approval']); if (in_array($uid, $checkapproval)) { $sql = "select b.jb_sn,b.jbt_sn,b.jb_date,b.jb_waiting,b.jb_status,c.jbi_sn,c.jbt_title,d.jb_uid,d.jb_booking_time,d.jb_booking_content,d.jb_start_date,d.jb_end_date from `" . $xoopsDB->prefix("jill_booking_date") . "` as b\n join `" . $xoopsDB->prefix("jill_booking_time") . "` as c on b.jbt_sn=c.jbt_sn\n join `" . $xoopsDB->prefix("jill_booking") . "` as d on b.jb_sn=d.jb_sn\n where c.jbi_sn='{$jbi_sn}' && b.jb_status='0' && b.jb_date>= ' " . date("Y-m-d", xoops_getUserTimestamp(time())) . " ' order by b.jb_date ,b.jbt_sn,d.jb_booking_time"; //die($sql); //getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項); $PageBar = getPageBar($sql, 20, 10, null, null, $_SESSION['bootstrap']); $bar = $PageBar['bar']; $sql = $PageBar['sql']; $total = $PageBar['total']; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all_content = ""; $i = 0; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: a.jb_sn,a.jb_week,a.jbt_sn,b.jb_date,b.jb_waiting,b.jb_status,c.jbi_sn,c.jbt_title,c.jbt_sort,c.jbt_week,d.jb_uid,d.jb_booking_time,d.jb_booking_content,d.jb_start_date,d.jb_end_date foreach ($all as $k => $v) { ${$k} = $v; } //過濾讀出的變數值 $jb_booking_content = $myts->displayTarea($jb_booking_content, 1, 1, 0, 1, 0); $jb_start_date = $myts->htmlSpecialChars($jb_start_date); $jb_end_date = $myts->htmlSpecialChars($jb_end_date); $all_content[$i]['jb_sn'] = $jb_sn; $all_content[$i]['jbt_sn'] = $jbt_sn; $all_content[$i]['jb_date'] = $jb_date; $all_content[$i]['jb_week'] = date('w', strtotime($jb_date)); $all_content[$i]['jb_waiting'] = $jb_waiting; $all_content[$i]['jb_status'] = $jb_status; $all_content[$i]['jbi_sn'] = $jbi_sn; $all_content[$i]['jbt_title'] = $jbt_title; $all_content[$i]['jb_uid'] = XoopsUser::getUnameFromId($jb_uid, 1); $all_content[$i]['jb_booking_time'] = $jb_booking_time; $all_content[$i]['jb_booking_content'] = $jb_booking_content; $all_content[$i]['jb_start_date'] = $jb_start_date; $all_content[$i]['jb_end_date'] = $jb_end_date; $i++; } } } //die(var_dump($all_content)); //刪除確認的JS if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php")) { redirect_header("index.php", 3, _MD_NEED_TADTOOLS); } include_once XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php"; $sweet_alert = new sweet_alert(); $delete_jill_booking_func = $sweet_alert->render('delete_jill_booking_func', "{$_SERVER['PHP_SELF']}?op=delete_booking&jb_info=", "jb_info"); $xoopsTpl->assign('delete_jill_booking_func', $delete_jill_booking_func); $xoopsTpl->assign('bar', $bar); $xoopsTpl->assign('action', $_SERVER['PHP_SELF']); $xoopsTpl->assign('isAdmin', $isAdmin); $xoopsTpl->assign('item_opt', $item_opt); $xoopsTpl->assign('all_content', $all_content); $xoopsTpl->assign('now_op', 'jill_booking_approvallist'); }