Jill 筆記
:::
:::
所有書籍
「Xoops新物件寫法」目錄
MarkDown
3-2 編輯活動表單
1. 前置作業
1-1 流程
2. 列出所有活動
3. 新增活動表單
3-1 新增到資料庫
3-2 編輯活動表單
4. 刪除活動
5. 修改前台首頁
5. 修改前台首頁
Xoops新物件寫法 ========== 1. 加入SweetAlert刪除物件 [action/AdminAction.class.php](https://github.com/tnjaile/ck_signup/commit/bf2e70902ab5a0d1dd2d92d0392d35763d024f9d#diff-0ece6698acedde7d0cebc5f0184eee02 "action/AdminAction.class.php") ```php use XoopsModules\Tadtools\SweetAlert; $sweet_alert = new SweetAlert(); $sweet_alert->render('delete_action', "{$_SERVER['PHP_SELF']}?op=delete&action_id=", "action_id"); ``` 2. 建立刪除函數 [action/AdminAction.class.php](https://github.com/tnjaile/ck_signup/commit/2d0a2debf15cc69991ab00b7cbb4e8ab699b1b22#diff-0ece6698acedde7d0cebc5f0184eee02 "action/AdminAction.class.php") ```php // 刪除 public function delete() { if (isset($_GET['action_id'])) { $_row = $this->_action->actions_delete(); } header("location: {$_SERVER['PHP_SELF']}"); exit; } ``` 3. model/ActionsModel.class.php ```php public function actions_delete($_whereData = array()) { $_where = (empty($_whereData)) ? array("action_id='{$this->_R['action_id']}'") : $_whereData; return parent::delete($_where); } ```