:::

2-6-2 完成活動修改功能

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. 修改時,活動表單隱藏的 op 欄位值將會是 tad_signup_actions_update,意味著 index.phpswitch() 要有以下這段:
    //更新資料
    case 'tad_signup_actions_update':
        Tad_signup_actions::update($id);
        header("location: {$_SERVER['PHP_SELF']}?id=$id");
        exit;

     

  2. 編輯 class/Tad_signup_actions.php 中的 Tad_signup_actions 類別,編輯 update() 方法
    //更新某一筆資料
    public static function update($id = '')
    {
        global $xoopsDB;
    
        if (!$_SESSION['tad_signup_adm']) {
            redirect_header($_SERVER['PHP_SELF'], 3, "您沒有權限使用此功能");
        }
    
        //XOOPS表單安全檢查
        Utility::xoops_security_check();
    
        $myts = \MyTextSanitizer::getInstance();
    
        foreach ($_POST as $var_name => $var_val) {
            $$var_name = $myts->addSlashes($var_val);
        }
        $uid = (int) $uid;
        $enable = (int) $enable;
        $number = (int) $number;
    
        $sql = "update `" . $xoopsDB->prefix("tad_signup_actions") . "` set
        `title` = '{$title}',
        `detail` = '{$detail}',
        `action_date` = '{$action_date}',
        `end_date` = '{$end_date}',
        `number` = '{$number}',
        `setup` = '{$setup}',
        `enable` = '{$enable}',
        `uid` = '{$uid}'
        where `id` = '$id'";
        $xoopsDB->queryF($sql) or Utility::web_error($sql, __FILE__, __LINE__);
    
        return $id;
    }

     

link to https://github.com/tadlearn/tad_signup/commit/18fa4ef285579327ae4303ce0dc7de45be53722c \


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D48%26tbdsn%3D1613

書籍目錄

展開 | 闔起

線上使用者

45人線上 (10人在瀏覽線上書籍)

會員: 0

訪客: 45

更多…