function show_one_tad_web_action($ActionID = "") { global $xoopsDB, $xoopsTpl, $TadUpFiles, $web_cate; if (empty($ActionID)) { return; } else { $ActionID = intval($ActionID); } add_tad_web_action_counter($ActionID); $sql = "select * from " . $xoopsDB->prefix("tad_web_action") . " where ActionID='{$ActionID}'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all = $xoopsDB->fetchArray($result); //以下會產生這些變數: $ActionID , $ActionName , $ActionDesc , $ActionDate , $ActionPlace , $uid , $WebID , $ActionCount foreach ($all as $k => $v) { ${$k} = $v; } $TadUpFiles->set_col("ActionID", $ActionID); $pics = $TadUpFiles->show_files('upfile'); //是否縮圖,顯示模式 filename、small,顯示描述,顯示下載次數 $uid_name = XoopsUser::getUnameFromId($uid, 1); $xoopsTpl->assign('isMineAction', isMine()); $xoopsTpl->assign('ActionName', $ActionName); $xoopsTpl->assign('ActionDate', $ActionDate); $xoopsTpl->assign('ActionPlace', $ActionPlace); $xoopsTpl->assign('ActionDesc', nl2br($ActionDesc)); $xoopsTpl->assign('uid_name', $uid_name); $xoopsTpl->assign('ActionCount', $ActionCount); $xoopsTpl->assign('pics', $pics); $xoopsTpl->assign('op', 'show_one_tad_web_action'); $xoopsTpl->assign('ActionID', $ActionID); $xoopsTpl->assign('ActionInfo', sprintf(_MD_TCW_INFO, $uid_name, $ActionDate, $ActionCount)); //取得單一分類資料 $cate = $web_cate->get_tad_web_cate($CateID); $xoopsTpl->assign('cate', $cate); }
function tad_web_config($WebID) { global $xoopsDB, $xoopsTpl, $MyWebs, $op, $TadUpFiles; $bg_path = XOOPS_ROOT_PATH . "/modules/tad_web/images/bg"; $bg_user_path = XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/bg"; mk_dir($bg_user_path); mk_dir("{$bg_user_path}/thumbs"); import_img($bg_path, "bg", $WebID); $TadUpFilesBg = TadUpFilesBg(); $xoopsTpl->assign('upform_bg', $TadUpFilesBg->upform(false, "bg", null, false)); $TadUpFilesBg->set_col("bg", $WebID); $xoopsTpl->assign('all_bg', $TadUpFilesBg->get_file_for_smarty()); $head_path = XOOPS_ROOT_PATH . "/modules/tad_web/images/head"; $head_user_path = XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/head"; mk_dir($head_user_path); mk_dir("{$head_user_path}/thumbs"); import_img($head_path, "head", $WebID); $TadUpFilesHead = TadUpFilesHead(); $xoopsTpl->assign('upform_head', $TadUpFilesHead->upform(false, "head", null, false)); $TadUpFilesHead->set_col("head", $WebID); $xoopsTpl->assign('all_head', $TadUpFilesHead->get_file_for_smarty()); $logo_path = XOOPS_ROOT_PATH . "/modules/tad_web/images/logo"; $logo_user_path = XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/logo"; mk_dir($logo_user_path); mk_dir("{$logo_user_path}/thumbs"); import_img($logo_path, "logo", $WebID); $TadUpFilesLogo = TadUpFilesLogo(); $xoopsTpl->assign('upform_logo', $TadUpFilesLogo->upform(false, "logo", null, false)); $TadUpFilesLogo->set_col("logo", $WebID); $xoopsTpl->assign('all_logo', $TadUpFilesLogo->get_file_for_smarty()); $xoopsTpl->assign('config', true); get_jquery(true); $TadUpFiles->set_col("WebOwner", $WebID, 1); $teacher_pic = $TadUpFiles->get_pic_file('thumb'); $xoopsTpl->assign('teacher_thumb_pic', $teacher_pic); $upform = $TadUpFiles->upform(true, 'upfile', '1', false); $xoopsTpl->assign('upform', $upform); $ConfigValue = get_web_config("hide_function", $WebID); $hide_function = explode(';', $ConfigValue); $mod_name['aboutus'] = _MD_TCW_ABOUTUS; $mod_name['news'] = _MD_TCW_NEWS; $mod_name['works'] = _MD_TCW_WORKS; $mod_name['homework'] = _MD_TCW_HOMEWORK; $mod_name['files'] = _MD_TCW_FILES; $mod_name['action'] = _MD_TCW_ACTION; $mod_name['video'] = _MD_TCW_VIDEO; $mod_name['link'] = _MD_TCW_LINK; $mod_name['discuss'] = _MD_TCW_DISCUSS; $mod_name['calendar'] = _MD_TCW_CALENDAR; $all_functions = ""; $inline = $_SESSION['bootstrap'] == '3' ? '-inline' : ' inline'; foreach ($mod_name as $function_name => $function_text) { $checked = in_array($function_name, $hide_function) ? "checked" : ""; $all_functions .= "\n <label class='checkbox{$inline}'>\n <input name='ConfigValue[]' type='checkbox' value='{$function_name}' {$checked}>{$function_text}\n </label>"; } $Web = get_tad_web($WebID); $xoopsTpl->assign('all_functions', $all_functions); $xoopsTpl->assign('op', 'tad_web_config'); $xoopsTpl->assign('isMine', isMine()); $xoopsTpl->assign('WebName', $Web['WebName']); $TadUpFiles->set_col("WebOwner", $WebID); $list_del_file = $TadUpFiles->list_del_file(); $xoopsTpl->assign('list_del_file', $list_del_file); if (!file_exists(XOOPS_ROOT_PATH . "/modules/tadtools/mColorPicker.php")) { redirect_header("index.php", 3, _MA_NEED_TADTOOLS); } include_once XOOPS_ROOT_PATH . "/modules/tadtools/mColorPicker.php"; $mColorPicker = new mColorPicker('.color'); $mColorPicker_code = $mColorPicker->render(); $xoopsTpl->assign('mColorPicker_code', $mColorPicker_code); //區塊設定 $display_blocks = get_web_config("display_blocks", $WebID); if (!empty($display_blocks)) { $display_blocks_arr = explode(',', $display_blocks); } else { $display_blocks_arr = ""; } $sql = "select bid,name,title from " . $xoopsDB->prefix("newblocks") . " where dirname='tad_web' order by weight"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $myts = MyTextSanitizer::getInstance(); $block_ok = $block_yet = $block_name = ""; while ($all = $xoopsDB->fetchArray($result)) { foreach ($all as $k => $v) { ${$k} = $v; } $name = $myts->htmlSpecialChars($name); $title = $myts->htmlSpecialChars($title); if (!empty($display_blocks)) { if (!in_array($bid, $display_blocks_arr)) { $block_yet .= "<option value=\"{$bid}\">{$name}</option>"; } $block_name[$bid] = $name; } else { $block_ok .= "<option value=\"{$bid}\">{$name}</option>"; $blocks[] = $bid; } } if (empty($display_blocks_arr)) { $display_blocks = implode(',', $blocks); } else { foreach ($display_blocks_arr as $bid) { $block_ok .= "<option value=\"{$bid}\">{$block_name[$bid]}</option>"; } } $block_content = "\n <script type=\"text/javascript\" src=\"" . XOOPS_URL . "/modules/tad_web/class/tmt_core.js\"></script>\n <script type=\"text/javascript\" src=\"" . XOOPS_URL . "/modules/tad_web/class/tmt_spry_linkedselect.js\"></script>\n <script type=\"text/javascript\">\n function getOptions()\n {\n\n var values = [];\n var sel = document.getElementById('destination');\n for (var i=0, n=sel.options.length;i<n;i++) {\n if (sel.options[i].value) values.push(sel.options[i].value);\n }\n document.getElementById('display_blocks').value=values.join(',');\n }\n </script>\n\n <table style='width:auto'>\n\n <tr>\n <td style='vertical-align:top;'>\n <h3>" . _MD_TCW_BLOCKS_LIST . "</h3>\n <select name=\"repository\" id=\"repository\" size=\"12\" multiple=\"multiple\" tmt:linkedselect=\"true\" style='width: 300px;'>\n {$block_yet}\n </select>\n </td>\n <td style='vertical-align:middle'>\n <img src=\"" . XOOPS_URL . "/modules/tad_web/images/right.png\" onclick=\"tmt.spry.linkedselect.util.moveOptions('repository', 'destination');getOptions();\"><br>\n <img src=\"" . XOOPS_URL . "/modules/tad_web/images/left.png\" onclick=\"tmt.spry.linkedselect.util.moveOptions('destination' , 'repository');getOptions();\"><br><br>\n\n <img src=\"" . XOOPS_URL . "/modules/tad_web/images/up.png\" onclick=\"tmt.spry.linkedselect.util.moveOptionUp('destination');getOptions();\"><br>\n <img src=\"" . XOOPS_URL . "/modules/tad_web/images/down.png\" onclick=\"tmt.spry.linkedselect.util.moveOptionDown('destination');getOptions();\">\n </td>\n <td style='vertical-align:top;'>\n <h3>" . _MD_TCW_BLOCKS_SELECTED . "</h3>\n <select id=\"destination\" size=\"12\" multiple=\"multiple\" tmt:linkedselect=\"true\" style='width: 300px;'>\n {$block_ok}\n </select>\n </td>\n </tr>\n <tr>\n <td colspan=4>\n <input type='hidden' name='display_blocks' id='display_blocks' value='{$display_blocks}'>\n </td>\n </tr>\n </table>\n "; $xoopsTpl->assign('block_content', $block_content); }
function show_one_tad_web_news($NewsID = "", $show_place = false, $nl2br = false) { global $xoopsDB, $WebID, $isAdmin, $xoopsTpl, $TadUpFiles, $web_cate; if (empty($NewsID)) { return; } else { $NewsID = intval($NewsID); } add_tad_web_news_counter($NewsID); $sql = "select * from " . $xoopsDB->prefix("tad_web_news") . " where NewsID='{$NewsID}'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all = $xoopsDB->fetchArray($result); //以下會產生這些變數: $NewsID , $NewsTitle , $NewsContent , $NewsDate , $toCal , $NewsPlace , $NewsMaster , $NewsUrl , $WebID , $NewsKind , $NewsCounter ,$uid foreach ($all as $k => $v) { ${$k} = $v; } if (empty($uid)) { redirect_header('index.php', 3, _MD_TCW_NEWS_NOT_EXIST); } $uid_name = XoopsUser::getUnameFromId($uid, 1); $NewsUrlTxt = empty($NewsUrl) ? "" : "<div>" . _MD_TCW_NEWSURL . _TAD_FOR . "<a href='{$NewsUrl}' target='_blank'>{$NewsUrl}</a></div>"; $NewsContent = $nl2br ? nl2br($NewsContent) : $NewsContent; $learn_info = ""; if ($show_place) { $showNewsMaster = empty($NewsMaster) ? "" : _MD_TCW_NEWS_TEACHER . _TAD_FOR . "<u>{$NewsMaster}</u>"; $learn_info = "<table><tr><td>" . _MD_TCW_NEWSPLACE . _TAD_FOR . "<u>{$NewsPlace}</u></td><td>{$showNewsMaster}</td></tr></table>"; } $TadUpFiles->set_col("NewsID", $NewsID); $NewsFiles = $TadUpFiles->show_files('upfile', true, null, true); $xoopsTpl->assign('isMine', isMine()); $xoopsTpl->assign('mode', 'one_news'); $xoopsTpl->assign('NewsTitle', $NewsTitle); $xoopsTpl->assign('NewsUrlTxt', $NewsUrlTxt); $xoopsTpl->assign('NewsContent', $NewsContent); $xoopsTpl->assign('learn_info', $learn_info); $xoopsTpl->assign('uid_name', $uid_name); $xoopsTpl->assign('NewsDate', $NewsDate); $xoopsTpl->assign('NewsCounter', $NewsCounter); $xoopsTpl->assign('NewsFiles', $NewsFiles); $xoopsTpl->assign('NewsID', $NewsID); $xoopsTpl->assign('NewsInfo', sprintf(_MD_TCW_INFO, $uid_name, $NewsDate, $NewsCounter)); if ($NewsKind == "homework") { $xoopsTpl->assign('HomeTitle', _MD_TCW_HOMEWORK); } else { $xoopsTpl->assign('HomeTitle', _MD_TCW_NEWS); } //取得單一分類資料 $cate = $web_cate->get_tad_web_cate($CateID); $xoopsTpl->assign('cate', $cate); }
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 show_one_tad_web($WebID = "") { global $xoopsDB, $xoopsTpl, $MyWebs, $op, $TadUpFiles; $Web = get_tad_web($WebID); $sql = "select a.*,b.* from " . $xoopsDB->prefix("tad_web_link_mems") . " as a left join " . $xoopsDB->prefix("tad_web_mems") . " as b on a.MemID=b.MemID where a.WebID ='{$WebID}' and a.MemEnable='1'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $i = 0; $students1 = $students2 = ""; $class_total = $class_boy = $class_girl = 0; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: `MemID`, `MemName`, `MemNickName`, `MemSex`, `MemUnicode`, `MemBirthday`, `MemUrl`, `MemClassOrgan`, `MemExpertises`, `uid`, `MemUname`, `MemPasswd`,`WebID`, `MemNum`, `MemSort`, `MemEnable`, `top`, `left` foreach ($all as $k => $v) { ${$k} = $v; $all_main[$i][$k] = $v; } $TadUpFiles->set_col("MemID", $MemID, 1); $pic_url = $TadUpFiles->get_pic_file('thumb'); if (empty($pic_url) or !$MyWebs) { $pic = $MemSex == '1' ? "images/boy.gif" : "images/girl.gif"; $cover = ""; } else { $pic = $pic_url; $cover = "background-size: cover;"; } if (!$MyWebs) { $MemName = empty($MemNickName) ? mb_substr($MemName, 0, 1, _CHARSET) . _MD_TCW_SOMEBODY : $MemNickName; } $color = $MemSex == '1' ? "#006699" : "#CC3300"; $color2 = $MemSex == '1' ? "#000066" : "#660000"; if ($MemSex == '1') { $class_boy++; } else { $class_girl++; } $style = (empty($top) and empty($left)) ? "float:left;" : "top:{$top}px;left:{$left}px;"; $MemName = empty($MemName) ? "---" : $MemName; $StuID = $_REQUEST['op'] == "tad_web_adm" ? $MemID : $MemNum; $students = "<div id='{$StuID}' class='draggable' style='width:60px;height:60px;background:transparent url({$pic}) top center no-repeat;{$style};{$cover}padding:0px;'><p style='width:100%;line-height:1;text-align:center;margin:50px 0px 0px 0px;font-size:11px;padding:3px 1px;color:{$color2};text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, 1px -1px 0 #FFFFFF, -1px 1px 0 #FFFFFF, 0px -1px 0 #FFFFFF, 0px 1px 0 #FFFFFF, -1px 0px 0 #FFFFFF, 1px 0px 0 #FFFFFF'>{$MemNum} <a href='javascript:edit_stu({$MemID});' style='font-weight:normal;color:{$color2};text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, 1px -1px 0 #FFFFFF, -1px 1px 0 #FFFFFF, 0px -1px 0 #FFFFFF, 0px 1px 0 #FFFFFF, -1px 0px 0 #FFFFFF, 1px 0px 0 #FFFFFF;'>{$MemName}</a></p></div>"; //$students = "<div id='{$StuID}' class='draggable'>{$MemName}</a></p></div>"; if (empty($top) and empty($left)) { $students2 .= $students; } else { $students1 .= $students; } $class_total++; $i++; } $TadUpFiles->set_col("WebOwner", $WebID, 1); $teacher_pic = $TadUpFiles->get_pic_file(); //$teacher_pic=empty($pic_url)?"":"<div style='background:transparent url($pic_url) no-repeat center center;width:325px;height:249px;'><img src='images/photo.png'></div>"; if ($_REQUEST['op'] == "tad_web_adm") { $xoopsTpl->assign('op', 'tad_web_adm'); } else { $xoopsTpl->assign('op', 'show_one_tad_web'); } $xoopsTpl->assign('all_mems', $all_main); $xoopsTpl->assign('WebOwner', $Web['WebOwner']); $xoopsTpl->assign('isMine', isMine()); $xoopsTpl->assign('teacher_pic', $teacher_pic); $xoopsTpl->assign('class_total', $class_total); $xoopsTpl->assign('class_boy', $class_boy); $xoopsTpl->assign('class_girl', $class_girl); $xoopsTpl->assign('students1', $students1); $xoopsTpl->assign('students2', $students2); $sql = "select min(`MemNum`) as min , max(`MemNum`) as max from " . $xoopsDB->prefix("tad_web_link_mems") . " where `WebID` = '{$WebID}' and MemEnable='1'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); list($min, $max) = $xoopsDB->fetchRow($result); $xoopsTpl->assign('min', $min); $xoopsTpl->assign('max', $max); }