:::

5-5-3 讓無法報名的活動也能顯示出來

您沒有觀看影片的權限

您沒有觀看影片的權限

請先登入,登入後,確認您的權限後,即可觀看影片。

  1. 只要修改index.php即可
    default:
        if (empty($id)) {
            Tad_signup_actions::index($xoopsModuleConfig['only_enable']);
            $op = 'tad_signup_actions_index';
        } else {
            Tad_signup_actions::show($id);
            $op = 'tad_signup_actions_show';
        }
        break;

     

  2. 可以排序一下,讓啟用的活動排前面,所以修改 class\Tad_signup_actions.phpget_all()
    //取得所有資料陣列
    public static function get_all($only_enable = true, $auto_key = false)
    {
        /*--略--*/
    
        $sql = "select * from `" . $xoopsDB->prefix("tad_signup_actions") . "` where 1 $and_enable order by `enable`, `action_date` desc";
    
        /*--略--*/
    }

     

  3. 另外也要提防直接輸入網址去報名的狀況,所以修改 class\Tad_signup_data.php 中的 create()
    //編輯表單
    public static function create($action_id, $id = '')
    {
        global $xoopsTpl, $xoopsUser;
    
        /*--略--*/
    
        $action = Tad_signup_actions::get($action_id, true);
        if (!$action['enable']) {
            redirect_header($_SERVER['PHP_SELF'] . "?id=$action_id", 3, "該報名已關閉,無法再進行報名或修改報名");
        } elseif (time() > strtotime($action['end_date'])) {
            redirect_header($_SERVER['PHP_SELF'] . "?id=$action_id", 3, "已報名截止,無法再進行報名或修改報名");
        }
        /*--略--*/
    }

     

link to https://github.com/tadlearn/tad_signup/commit/43a433f6370cc193a495aa7407a7dae51bf5df2c \


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D48%26tbdsn%3D1721

書籍目錄

展開 | 闔起

線上使用者

47人線上 (8人在瀏覽線上書籍)

會員: 0

訪客: 47

更多…