function get_re($DiscussID = "") { global $xoopsDB, $MyWebs, $TadUpFiles; if (empty($DiscussID)) { return; } $sql = "select * from " . $xoopsDB->prefix("tad_web_discuss") . " where ReDiscussID='{$DiscussID}' order by DiscussDate"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $re_data = ""; while ($all = $xoopsDB->fetchArray($result)) { //以下會產生這些變數: $DiscussID , $ReDiscussID , $MemID , $DiscussTitle , $DiscussContent , $DiscussDate , $WebID , $LastTime , $DiscussCounter foreach ($all as $k => $v) { ${$k} = $v; } if (!empty($uid)) { $TadUpFiles->set_col("WebOwner", $WebID, "1"); $pic = $TadUpFiles->get_pic_file("thumb"); if (empty($pic)) { $pic = "images/nobody.png"; } } else { $TadUpFiles->set_col("MemID", $MemID, "1"); $pic = $TadUpFiles->get_pic_file("thumb"); $M = get_tad_web_mems($MemID); if (empty($pic)) { $pic = $M['MemSex'] == '1' ? XOOPS_URL . "/modules/tad_web/images/boy.gif" : XOOPS_URL . "/modules/tad_web/images/girl.gif"; } } $fun = isMineDiscuss($MemID) ? "<div style='font-size:12px;'>\n \t<a href='{$_SERVER['PHP_SELF']}?WebID={$WebID}&op=tad_web_discuss_form&DiscussID={$DiscussID}'>" . _TAD_EDIT . "</a> | <a href=\"javascript:delete_tad_web_discuss_func({$DiscussID});\">" . _TAD_DEL . "</a>\n \t</div>" : ""; $DiscussContent = nl2br($DiscussContent); $DiscussContent = bubble($DiscussContent); $re_data .= "<tr><td style='line-height:180%;'>\n {$DiscussContent}\n <img src='{$pic}' alt='{$MemName}" . _MD_TCW_DISCUSS_REPLY . "' style='margin:0px 15px 0px 30px;float:left;' class='img-rounded img-polaroid'>\n <div style='line-height:1.5em;'>\n <div>{$MemName}</div><div style='font-size:12px;'>{$DiscussDate}</div>{$fun}\n </div>\n <div style='clean:both;'></div>\n </td></tr>"; } $re = ""; if (!empty($re_data)) { $re = "\n \t<table>\n \t{$re_data}\n \t</table>\n "; } return $re; }
function tad_web_mems_form($WebID = "0", $MemID = "0") { global $xoopsDB, $xoopsUser, $TadUpFiles; //抓取預設值 if (!empty($MemID)) { $DBV = get_tad_web_mems($MemID); $DBV2 = get_tad_web_link_mems($MemID); } else { $DBV = $DBV2 = array(); } //`MemID`, `MemName`, `MemNickName`, `MemSex`, `MemUnicode`, `MemBirthday`, `MemUrl`, `MemClassOrgan`, `MemExpertises`, `uid`, `MemUname`, `MemPasswd`, `MemNum`, `MemSort`, `MemEnable`, `top`, `left` //設定「MemName」欄位預設值 $MemName = !isset($DBV['MemName']) ? "" : $DBV['MemName']; //設定「MemNickName」欄位預設值 $MemNickName = !isset($DBV['MemNickName']) ? "" : $DBV['MemNickName']; //設定「MemSex」欄位預設值 $MemSex = !isset($DBV['MemSex']) ? "" : $DBV['MemSex']; //設定「MemUnicode」欄位預設值 $MemUnicode = !isset($DBV['MemUnicode']) ? "" : $DBV['MemUnicode']; //設定「MemBirthday」欄位預設值 $MemBirthday = !isset($DBV['MemBirthday']) ? "" : $DBV['MemBirthday']; //設定「MemUrl」欄位預設值 $MemUrl = !isset($DBV['MemUrl']) ? "" : $DBV['MemUrl']; //設定「MemClassOrgan」欄位預設值 $MemClassOrgan = !isset($DBV['MemClassOrgan']) ? "" : $DBV['MemClassOrgan']; //設定「MemExpertises」欄位預設值 $MemExpertises = !isset($DBV['MemExpertises']) ? "" : $DBV['MemExpertises']; //設定「uid」欄位預設值 $uid = !isset($DBV['uid']) ? "" : $DBV['uid']; //設定「MemUname」欄位預設值 $MemUname = !isset($DBV['MemUname']) ? "" : $DBV['MemUname']; //設定「MemPasswd」欄位預設值 $MemPasswd = !isset($DBV['MemPasswd']) ? "" : $DBV['MemPasswd']; //設定「MemNum」欄位預設值 $MemNum = !isset($DBV2['MemNum']) ? "" : $DBV2['MemNum']; //設定「MemSort」欄位預設值 $MemSort = !isset($DBV2['MemSort']) ? "" : $DBV2['MemSort']; //設定「MemEnable」欄位預設值 $MemEnable = !isset($DBV2['MemEnable']) ? "" : $DBV2['MemEnable']; //設定「top」欄位預設值 $top = !isset($DBV['top']) ? "" : $DBV['top']; //設定「left」欄位預設值 $left = !isset($DBV['left']) ? "" : $DBV['left']; $op = empty($MemID) ? "insert_tad_web_mems" : "update_tad_web_mems"; $TadUpFiles->set_col("MemID", $MemID, 1); $pic_url = $TadUpFiles->get_pic_file('thumb'); if (empty($pic_url)) { $pic = $MemSex == '1' ? XOOPS_URL . "/modules/tad_web/images/boy.gif" : XOOPS_URL . "/modules/tad_web/images/girl.gif"; $cover = ""; } else { $pic = $pic_url; $cover = "background-size: cover;"; } $color2 = $MemSex == '1' ? "#000066" : "#660000"; $pic = !empty($MemID) ? "\n <div id='{$MemID}' style='padding: 5px;font-size: 12px; border:0px dotted gray;width:60px;height:50px;background:transparent url({$pic}) top center no-repeat;margin:0px auto;{$cover}'>\n </div>" : ""; if (!file_exists(TADTOOLS_PATH . "/formValidator.php")) { redirect_header("index.php", 3, _MA_NEED_TADTOOLS); } include_once TADTOOLS_PATH . "/formValidator.php"; $formValidator = new formValidator("#myForm", true); $formValidator_code = $formValidator->render(); if (!empty($MemID)) { $del_btn = "<a href=\"javascript:delete_student_func({$MemID});\" class='btn btn-danger'>" . _TAD_DEL . "</a>\n "; } else { $del_btn = ""; } $main = "\n {$formValidator_code}\n <script type='text/javascript' src='" . TADTOOLS_URL . "/My97DatePicker/WdatePicker.js'></script>\n <script type='text/javascript'>\n function delete_student_func(MemID){\n var sure = window.confirm('" . _TAD_DEL_CONFIRM . "');\n if (!sure) return;\n location.href=\"{$_SERVER['PHP_SELF']}?op=delete_tad_web_mems&MemID=\" + MemID;\n }\n </script>\n <form action='{$_SERVER['PHP_SELF']}' method='post' id='myForm' enctype='multipart/form-data'>\n <fieldset>\n <legend>" . _MD_TCW_STUDENT_SETUP . "</legend>\n\n <!--學生姓名-->\n <div class='row'>\n <label class='col-md-1'>" . _MD_TCW_MEM_NAME . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemName' value='{$MemName}' id='MemName' class='validate[required] form-control' placeholder='" . _MD_TCW_MEM_NAME . "'>\n </div>\n\n <!--學生暱稱-->\n <label class='col-md-1'>" . _MD_TCW_MEM_NICKNAME . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemNickName' value='{$MemNickName}' id='MemNickName' class='form-control' placeholder='" . _MD_TCW_MEM_NICKNAME . "'>\n </div>\n\n <div class='col-md-4'>\n {$pic}\n </div>\n </div>\n\n\n <div class='row'>\n <!--性別-->\n <label class='col-md-1'>" . _MD_TCW_MEM_SEX . "</label>\n <div class='col-md-3'>\n <select name='MemSex' class='form-control'>\n <option value='1' " . chk($MemSex, '1', '1', 'selected') . ">" . _MD_TCW_BOY . "</option>\n <option value='0' " . chk($MemSex, '0', '0', 'selected') . ">" . _MD_TCW_GIRL . "</option>\n </select>\n </div>\n\n <!--生日-->\n <label class='col-md-1'>" . _MD_TCW_MEM_BIRTHDAY . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemBirthday' value='{$MemBirthday}' id='MemBirthday' class='form-control' onClick=\"WdatePicker({dateFmt:'yyyy-MM-dd' , startDate:'%y-%M-%d}'})\" placeholder='" . _MD_TCW_MEM_BIRTHDAY . "'>\n </div>\n\n <label class='col-md-1'>" . _MD_TCW_UPLOAD_MEM_PHOTO . "</label>\n <div class='col-md-3'>\n <input type='file' name='upfile[]' class='form-control' maxlength='1' accept='gif|jpg|png|GIF|JPG|PNG'>\n </div>\n </div>\n\n\n <div class='row'>\n\n <!--學號-->\n <label class='col-md-1'>" . _MD_TCW_MEM_UNICODE . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemUnicode' value='{$MemUnicode}' id='MemUnicode' class='validate[required] form-control' placeholder='" . _MD_TCW_MEM_UNICODE . "'>\n </div>\n\n <!--座號-->\n <label class='col-md-1'>" . _MD_TCW_MEM_NUM . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemNum' value='{$MemNum}' id='MemNum' class='validate[required] form-control' placeholder='" . _MD_TCW_MEM_NUM . "'>\n </div>\n\n\n <!--是否還在班上-->\n <label class='col-md-1'>" . _MD_TCW_MEM_STATUS . "</label>\n <div class='col-md-3'>\n <select name='MemEnable' id='MemEnable' class='form-control'>\n <option value='1' " . chk($MemEnable, '1', '1', 'selected') . ">" . _MD_TCW_MEM_ENABLE . "</option>\n <option value='0' " . chk($MemEnable, '0', '', 'selected') . ">" . _MD_TCW_MEM_UNABLE . "</option>\n </select>\n </div>\n\n </div>\n\n\n <div class='row'>\n\n <!--帳號-->\n <label class='col-md-1'>" . _MD_TCW_MEM_UNAME . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemUname' value='{$MemUname}' id='MemUname' class='validate[required] form-control' placeholder='" . _MD_TCW_MEM_UNAME . "'>\n </div>\n\n <!--密碼-->\n <label class='col-md-1'>" . _MD_TCW_MEM_PASSWD . "</label>\n <div class='col-md-3'>\n <input type='text' name='MemPasswd' value='{$MemPasswd}' id='MemPasswd' class='validate[required] form-control' placeholder='" . _MD_TCW_MEM_PASSWD . "'>\n </div>\n\n <div class='col-md-4'>\n {$del_btn}\n <input type='hidden' name='WebID' value='{$WebID}'>\n <input type='hidden' name='MemID' value='{$MemID}'>\n <input type='hidden' name='op' value='{$op}'>\n <button type='submit' class='btn btn-primary'>" . _TAD_SAVE . "</button>\n </div>\n </div>\n\n </fieldset>\n </form>\n "; return $main; }