:::

3-1-2 完成顯示活動列表畫面

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. Smarty 的 foreach迴圈
    <{foreach from=$來源變數 key=索引 item=內容名稱 name=來源變數}>
        <!-- 從0開始的次數 <{smarty.foreach.來源變數.index}> -->
        <!-- 從1開始的次數 <{smarty.foreach.來源變數.iteration}> -->
        <{$索引}>:<{$內容名稱}>
    <{/foreach}>

     

  2. 修改既有的 templates\op_tad_signup_actions_index.tpl,加入活動列表
  3. 報名有三個條件:1.人數未滿;2.報名者有登入;3.報名日期未截止
    <h2 class="my">活動列表</h2>
    
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>活動名稱</th>
                <th>活動日期</th>
                <th>報名截止日</th>
                <th>已報名人數</th>
                <th>功能</th>
            </tr>
        </thead>
        <tbody>
            <{foreach from=$all_data key=id item=action name=all_data}>
                <tr>
                    <td><{$action.title}></td>
                    <td><{$action.action_date}></td>
                    <td><{$action.end_date}></td>
                    <td>0/<{$action.number}></td>
                    <td>
                        <{if $smarty.session.tad_signup_adm}>
                            <a href="index.php?op=tad_signup_actions_edit&id=<{$action.id}>" class="btn btn-sm btn-warning"><i class="fa fa-pencil" aria-hidden="true"></i> 編輯活動</a>
                        <{/if}>
    
                        <{if $xoops_isuser && $action.end_date|strtotime >= $smarty.now}>
                            <a href="index.php?op=tad_signup_data_create&action_id=<{$action.id}>" class="btn btn-sm btn-info"><i class="fa fa-plus" aria-hidden="true"></i> 立即報名</a>
                        <{/if}>
                    </td>
                </tr>
            <{/foreach}>
        </tbody>
    </table>

     

  4. 關於BootStrap4表格可參考:https://bootstrap.hexschool.com/docs/4.2/content/tables/

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

 


:::

搜尋

QR Code 區塊

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

書籍目錄

展開 | 闔起

線上使用者

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

會員: 0

訪客: 131

更多…