:::

4. 刪除活動

  1. 加入SweetAlert刪除物件
    action/AdminAction.class.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
    // 刪除
        public function delete()
        {
            if (isset($_GET['action_id'])) {
                $_row = $this->_action->actions_delete();
            }
            header("location: {$_SERVER['PHP_SELF']}");
            exit;
        }
  3. model/ActionsModel.class.php
    public function actions_delete($_whereData = array())
        {
            $_where = (empty($_whereData)) ? array("action_id='{$this->_R['action_id']}'") : $_whereData;
    
            return parent::delete($_where);
        }