2013年10月30日 星期三
2013年10月19日 星期六
更新資料結構 (模組更新)
市場攤販管理,更改資料表結構
function xoops_module_update_ugm_market(&$module, $old_version) {
GLOBAL $xoopsDB;
if(!chk_ugm1()) go_ugm1(); # ---- 更改結構為 `e_last` -> DECIMAL( 10, 2 )
if(!chk_ugm2()) go_ugm2(); # ---- 更改結構為 `e_now` -> DECIMAL( 10, 2 )
return true;
}
# -------------------- ugm --------------------------------------------------*/
# ---- 更改結構 ugm_market_utility_main `e_last` 120->130----
function chk_ugm1(){
global $xoopsDB;
$sql="select `e_last` from ".$xoopsDB->prefix("ugm_market_utility_main")."";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
if(mysql_field_type($result,0)=='int')return false ;
return true;
}
function go_ugm1(){
global $xoopsDB;
$sql="ALTER TABLE ".$xoopsDB->prefix("ugm_market_utility_main")." CHANGE `e_last` `e_last` DECIMAL( 10, 2 ) UNSIGNED NOT NULL COMMENT '上期用電度數'";
$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
return true;
}
# -----------------------------------------
# ---- 更改結構 ugm_market_utility_main `e_now` 120->130-----
function chk_ugm2(){
global $xoopsDB;
$sql="select `e_now` from ".$xoopsDB->prefix("ugm_market_utility_main")."";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
if(mysql_field_type($result,0)=='int')return false ;
return true;
}
function go_ugm2(){
global $xoopsDB;
$sql="ALTER TABLE ".$xoopsDB->prefix("ugm_market_utility_main")." CHANGE `e_now` `e_now` DECIMAL( 10, 2 ) UNSIGNED NOT NULL COMMENT '本期用電度數'";
$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
return true;
}
# -----------------------------------------
2013年10月17日 星期四
2013年9月25日 星期三
取得XOOPS內建表單語法
取得XOOPS內建表單語法
群組多選選單
群組多選選單
# ---- 引入XOOPS 內建表單物件 -------------------------------
include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");
# ---- 預設值 -----------------------------------------------
$group=$xoopsModuleConfig['query_admin'];
# ---- XoopsFormSelectGroup('標題', 'name', 含訪客, '預設值', 高度 ,多選)
$form=new XoopsFormSelectGroup ("", "group", false, $group, 3, true);
# ---- 輸出HTML碼 ------------------------------------------
$main_form = $form->render();
# ----- 輸出驗證碼-----------------------------------------------------
$configs="";
$Captcha=new XoopsFormCaptcha ("請輸入驗證碼", 'xoopscaptcha', false, $configs);
# ---- 輸出HTML碼 ------------------------------------------
$form_Captcha = $Captcha->render();
2013年8月31日 星期六
bootstrap accordion-menu
bootstrap accordion-menu 架構
參考網站:http://kkbruce.tw/Bootstrap/JavaScript#collapse
<div class="accordion" id="menu_block_1">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#menu_block_1" href="#menu_sn_1">伸縮選單1</a>
</div>
<div id="menu_sn_1" class="accordion-body in collapse">
<div class="accordion-inner">
<ul>
<li>第一層21</li>
<li>第一層22</li>
<li>第一層2</li>
</ul>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#menu_block_1" href="#menu_sn_2">伸縮選單2</a>
</div>
<div id="menu_sn_2" class="accordion-body in collapse">
<div class="accordion-inner">
<ul>
<li>第一層21</li>
<li>第一層22</li>
<li>第一層2</li>
</ul>
</div>
</div>
</div>
</div>
2013年8月15日 星期四
AJAX JQUERY
範例網址:http://www.tad0616.net/modules/tad_book3/page.php?tbdsn=746
ajax_utility.php
js
html
ajax_utility.php
<?php include_once "header.php"; $market_sn=$_REQUEST['market_sn']; echo get_market_fill($market_sn); ?>這裡直返回「填發人員」
js
<script>
//開啟表單時
$(document).ready(function(){
//由市場決定填發人員
$.post('ajax_utility.php' , {market_sn:$('#market_sn').val()},
function(data){
$('#fill').val(data);
});
//市場改變,填發人員改變
$('#market_sn').change(function(){
$.post('ajax_utility.php' , {market_sn: $('#market_sn').val()},
function(data){
$('#fill').val(data); //排序
});
});
//自動抓取年度
$('#limit_year').val($('#year').val()); //年度
$('#year').change(function(){
$('#limit_year').val($('#year').val()); //年度
});
//自動抓取月份
$('#limit_month').val($('#month').val()); //月份
$('#month').change(function(){
$('#limit_month').val($('#month').val()); //月份
});
});
</script>
取得值:$('#market_sn').val()
寫入值:$('#fill').val(data);
jQuery的.val ()方法
- $('#menu1').val()可以取得id="menu1"的網頁元件的值。
- $('#menu1').val('xxx')可以設定id="menu1"的網頁元件的值。
html
<select name='market_sn' size=1 id='market_sn'>{$market_select_option}</select>
<input type='text' name='fill' size='5' value='' id='fill' >
2013年8月5日 星期一
2013年8月3日 星期六
模組開發物件
按鈕
2.
$add_button="<a href='{$_SERVER['PHP_SELF']}?op=ugm_market_hire_form' class='Button'><span>按鈕</span></a>";
固定表格<table border='0' cellspacing='3' cellpadding='3' id='ugm_tb' style='word-wrap:break-word; word-break:break-all;table-layout:fixed;'>表單
<td><input type='text' name='hier[{$sn}][userfees]' value='{$userfees}' id='userfees_{$sn}' class='validate[required,custom[integer]]' style='width:60px'></td>
<td><input type='text' name='hier[{$sn}][cleaningfees]' value='{$cleaningfees}' id='cleaningfees_{$sn}' class='validate[required,custom[integer]]' style='width:60px'></td>
<td><input type='text' name='hier[{$sn}][delayfees]' value='{$delayfees}' id='delayfees_{$sn}' class='validate[custom[integer]]' style='width:60px'></td>
<td><input type='text' name='hier[{$sn}][ps]' value='{$ps}' id='ps_{$sn}' style='width:140px'></td>
接收foreach ($_REQUEST['hier'] as $sn => $data){
foreach ($data as $k => $v){
//以下會產生這些變數: $userfees, $cleaningfees,$delayfees,$ps
$$k=$v;
}
echo $sn."<br>";
echo $userfees."<br>";
echo $cleaningfees."<br>";
echo $delayfees."<br>";
echo $ps."<br>";
die();
}
2.
$last_button="上一步";
2013年7月25日 星期四
「UGM_自訂頁面」模組更新(2.0)
-
這一版的更新主要是將模組改為XOOPS 2.5.5的模組架構
示範網站:http://www.taytzang.com.tw/web/
請先上傳覆蓋模組,並執行模組更新:
- 檔案下載位置:
-
育將電腦工作室:XOOPS 模組開發及修改
聯絡:tawan158@gmail.com ugm
訂閱:
文章 (Atom)










