# -------------------------------------------------------------------------------------CSS Dock Menu # -------------------------------------------------------------------------------------
2012年6月21日 星期四
CSS Dock Menu
2012年6月19日 星期二
寄信函數
#----------------------------------------------------------------
/**
* 寄信函數
* @param string $title 信件標題
* @param string $content 信件內容,可含HTML
* @param string $to_mode 寄信對象,uid(使用者uid編號)、group(群組編號)、email(單一email)、email_array(Email陣列)
* @param string $to 寄信對象的值(如uid編號、群組編號或Email...等)
* @param string $mode 寄發模式,email 或 pm
* @param string $tpl 樣板檔名稱,需放在語系的mail_template下
*/
function mail_to_user($title,$content="",$to_mode="group",$to="2",$mode="email",$tpl="tpl.html",$return_ok=true)
{
global $xoopsConfig , $xoopsModule;
$dirname=$xoopsModule->dirname();
$xoopsMailer =& getMailer();
if($mode=="email"){
$xoopsMailer->useMail();
}else{
$xoopsMailer->usePM();
}
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH."/modules/{$dirname}/language/{$xoopsConfig['language']}/mail_template/");
$xoopsMailer->setTemplate($tpl);
$xoopsMailer->assign('CONTENT', $content);
if($to_mode=="uid"){
$xoopsMailer->setToUsers(new XoopsUser($to));
}elseif($to_mode=="group"){
$member_handler =& xoops_gethandler('member');
$xoopsMailer->setToGroups($member_handler->getGroup($to));
}elseif($to_mode=="email"){
$xoopsMailer->setToEmails($to);
}elseif($to_mode=="email_array"){
$xoopsMailer->setToEmails($to);
}
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject($title);
$xoopsMailer->multimailer->isHTML(true);
if ( !$xoopsMailer->send(true) ) {
$error=$xoopsMailer->getErrors(false);
$error=implode(" ",$error);
redirect_header('index.php', 3, ""._MD_FREDREPAIR_MAIL_NO."!{$error}");
} else {
if($return_ok){
redirect_header('index.php', 3, ""._MD_FREDREPAIR_MAIL_OK."!");
}
}
}
#----------------------------------------------------------------
2012年6月18日 星期一
ibox燈箱
# ----------------- javascript ----------------------------------------------------- # ------------------------------------------------------------------------------------- 詳細資料 # -------------------------------------------------------------------------------------
相關網址: http://www.enthropia.com/labs/ibox/
2012年6月17日 星期日
表格排序(tablesort)
#------ css ------------------- # ------- html ---------------------- # class="sortable-onload-5-6r rowstyle-alt colstyle-alt no-arrow"
相關資料:
http://www.frequency-decoder.com/demo/table-sort-revisited/
http://www.ajaxdaddy.com/demos.html
http://www.frequency-decoder.com/demo/table-sort-revisited/custom-sort-functions/
http://www.ajaxdaddy.com/
frequency-decoder.com
http://www.frequency-decoder.com/2006/09/16/unobtrusive-table-sort-script-revisited
分頁:http://www.frequency-decoder.com/demo/table-sort-revisited/paginate/
mysql 指令
- LEFT JOIN
select 欄位(a.col1,b.col2,c.col5)
from 資料表 as a left join 資料表 as b on 欄位a = 欄位b left join 資料表 as c on 欄位a = 欄位c
where 撈資料條件 - $sql = "select a.nsn,b.nc_title,a.start_day ,a.news_title,a.uid,a.enable_group,a.have_read_group,a.prefix_tag,c.sign_unit from ".$xoopsDB->prefix("tad_news")." as a left join ".$xoopsDB->prefix("tad_news_cate")." as b on a.ncsn=b.ncsn left join ".$xoopsDB->prefix("ugm_sign_news")." as c on a.nsn=c.nsn where b.not_news='0' and a.enable='1' order by a.start_day desc ";
2012年6月15日 星期五
表單顏色選擇器
------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------
"._MA_FREDREPAIR_UNIT_UNIT_BGCOLOR."
# ---------------------------------------------------------------------------------
------------------------------------------------------------------------------
2012年6月14日 星期四
套用TadTools 工具包 for XOOPS
-
教學網站:http://www.cnblogs.com/aijun/archive/2011/03/21/1989991.html
http://www.cnblogs.com/aijun/archive/2011/03/15/1984477.html
http://www.36ria.com/1645
*http://code.ciaoca.com/jquery/validation_engine/
作者:https://github.com/posabsolute/jQuery-printPage-plugin -
取得驗證程式碼,已引入jquery
# ---------------取得驗證程式碼,已引入jquery------------------- 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("bottomRight");//選項有:topLeft, topRight, bottomLeft, centerRight, bottomRight # --------------------------------------------------------------
-
只限數字,不能有正負號及其他文字
class='validate[custom[onlyNumber]]'
-
必填
class='validate[required]'
-
必填且為數字
class='validate[required,custom[onlyNumber]]'
-
只能整數
class='validate[required,custom[integer]]'
-
只能整數且範圍在 1~12
class='validate[required,custom[integer],min[1],max[12]]'
-
2012年6月12日 星期二
在區塊使用複選(checkbox)
在區塊使用複選(checkbox)
name='options[4][]'
xoops會將值存為(a,b,c)
###############################################################################
# 得到文章標題
#
#
#
###############################################################################
if(!function_exists("get_ugm_page_b_cate")){
function get_ugm_page_b_cate($csns=array()){
global $xoopsDB;
$csns=explode(",",$csns);
//不考慮多層cate
$sql = "select * from ".$xoopsDB->prefix("ugm_page_cate")." where `enable`=1 order by `sort`";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
while($all=$xoopsDB->fetchArray($result)){
//以下會產生這些變數: `csn`, `of_csn`, `title`, `sort`, `enable`, `type`
foreach($all as $k=>$v){
$$k=$v;
}
$checkbox_cate.="";
}
return $checkbox_cate;
}
}
###############################################################################
# 單選回復原始資料函數
# chk($DBV="",$NEED_V="",$defaul="",$return="checked='checked'");
#
#
###############################################################################
//單選回復原始資料函數
if(!function_exists('chk')){
function chk($DBV="",$NEED_V="",$defaul="",$return="checked='checked'"){
if($DBV==$NEED_V){
return $return;
}elseif(empty($DBV) && $defaul=='1'){
return $return;
}
return "";
}
}
###############################################################################
# 複選回復原始資料函數
# chk2($defaul_array="",$NEED_V="",$defaul=1);
#
#
###############################################################################
//複選回復原始資料函數
if(!function_exists('chk2')){
function chk2($default_array="",$NEED_V="",$default=0){
if(in_array($NEED_V,$default_array)){
return "checked";
}elseif(empty($default_array) && $default=='1'){
return "checked";
}
return "";
}
}
2012年6月5日 星期二
XOOPS常用指令
- $total=$xoopsDB->getRowsNum($result); #記錄筆數
- $xoopsConfig['language']; #取得語系(tchinese_utf8)
- $getGroups=$xoopsUser->getGroups(); # 取得使用者的群組陣列
- user_name=XoopsUser::getUnameFromId($uid,0);// 取得該使用者的帳號
- user_name=XoopsUser::getUnameFromId($uid,1);// 取得該使用者的姓名
- $uname=XoopsUser::getUnameFromId($uid,1)?XoopsUser::getUnameFromId($uid,1):XoopsUser::getUnameFromId($uid,0); //
- $MDIR=$xoopsModule->getVar('dirname');
- $xoopsConfig['language'] #取得目前語系
- //取得目前使用者的所屬群組
if($xoopsUser){
$User_Groups=$xoopsUser->getGroups();
}else{
$User_Groups=array();
} - 將值傳至head
$xoopsTpl->assign( "xoops_module_header" , $jquery_ui); - $xoopsOption['xoops_pagetitle']=sprintf(_MD_UGMPAGE_UPDATE_SORT_LIST,$DBV['title']);;//指定標題
- $last_button="上一步";
- # ---- 取得 uid ----
$user_uid=$xoopsUser->getVar('uid');
訂閱:
意見 (Atom)








