:::

4-1-1 取得所有報名的完整資料

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. 取得所有報名資料我們可以修改 class\Tad_signup_data.php 中的 get_all() 方法
    //取得所有資料陣列
    public static function get_all($action_id, $auto_key = false)
    {
        global $xoopsDB;
        $myts = \MyTextSanitizer::getInstance();
    
        $sql = "select * from `" . $xoopsDB->prefix("tad_signup_data") . "` where `action_id`='$action_id' order by `signup_date`";
        $result = $xoopsDB->query($sql) or Utility::web_error($sql, __FILE__, __LINE__);
        $data_arr = [];
        $TadDataCenter = new TadDataCenter('tad_signup');
        while ($data = $xoopsDB->fetchArray($result)) {
            $TadDataCenter->set_col('id', $data['id']);
            $data['tdc'] = $TadDataCenter->getData();
    
            if ($_SESSION['api_mode'] or $auto_key) {
                $data_arr[] = $data;
            } else {
                $data_arr[$data['id']] = $data;
            }
        }
        return $data_arr;
    }

     

  2. 我們希望可以取得某一個活動的報名資料,所以,必須多一個 $action_id 參數,如此才能指定找出哪一個活動的報名資料。
  3. 當抓出每一個人的報名基本資料後,再到 TadDataCenter取出每個人的報名表單資料內容。
  4. 由於有異動參數,所以我們必須搜尋一下是否有其他地方有用到此方法的,也要一併修改,如 class\Tad_signup_data.php 中的 index() 方法:
    //列出所有資料
    public static function index($action_id)
    {
        global $xoopsTpl;
    
        $all_data = self::get_all($action_id);
        $xoopsTpl->assign('all_data', $all_data);
    }

     

link to https://github.com/tadlearn/tad_signup/commit/7b26a35347b7d3f3d59c8393053e8224959d1a54 \


:::

搜尋

QR Code 區塊

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

書籍目錄

展開 | 闔起

線上使用者

57人線上 (12人在瀏覽線上書籍)

會員: 0

訪客: 57

更多…