2-1
blocks/list_signup.php
<?php
function list_signup($options){
global $xoopsDB;
$action_id=intval($_GET['action_id']);
if($action_id){
include_once XOOPS_ROOT_PATH . "/modules/tadtools/sweet_alert.php";
$sweet_alert = new sweet_alert();
$sweet_alert->render("delete_signup", XOOPS_URL."/modules/tad_signup/index.php?op=delete_signup&action_id=", 'action_id', "確定要取消嗎?" , "取消後就不能參加活動囉!" , "是!含淚取消!");
$signups['action_id']=$action_id;
$signups['show_button']=$options[0];
$signups_tbl=$xoopsDB->prefix('signups');
$users_tbl=$xoopsDB->prefix('users');
$sql="SELECT b.* FROM `{$signups_tbl}` AS a
JOIN `{$users_tbl}` AS b ON a.`uid`=b.`uid`
WHERE a.`action_id`='{$action_id}'";
$result = $xoopsDB->query($sql) or web_error($sql);
$signups['users']=[];
while($data=$xoopsDB->fetchArray($result)){
$signups['users'][]=$data;
}
return $signups;
}
}
//編輯函數
function list_signup_edit($options){
$opt0_1 = $options[0] == 1 ? 'checked' : '';
$opt0_0 = $options[0] != 1 ? 'checked' : '';
$form = "
<div class='form-group'>
<label class='col-sm-2 control-label'>
是否顯示報名按鈕?
</label>
<div class='col-sm-10'>
<label class='radio-inline'>
<input type='radio' name='options[0]' value=1 {$opt0_1}> 是
</label>
<label class='radio-inline disabled'>
<input type='radio' name='options[0]' value=0 {$opt0_0}> 否
</label>
</div>
</div>";
return $form;
}