If you would like use this model in a list table view controller, see the interface of WPDKListTableModel.
저자: =undo= (info@wpxtre.me)
 /**
  * Create an instance of WPDKDBTableModelListTable class
  *
  * @brief Construct
  *
  * @param string $table_name The name of the database table without WordPress prefix
  * @param string $sql_file   Optional. The filename of SQL file with the database table structure and init data.
  *
  * @return WPDKDBTableModelListTable
  */
 public function __construct($table_name, $sql_file = '')
 {
     // Init the database table model
     parent::__construct($table_name, $sql_file);
     // Add action to get the post data
     $action = get_class($this) . '-listtable-viewcontroller';
     // This action is documented in classes/ui/wpdk-listtable-viewcontroller.php
     add_action($action, array($this, 'process_bulk_action'));
 }
예제 #2
0
파일: wpdk-db.php 프로젝트: wpxtreme/wpdk
 /**
  * Delete one or more record from table. Return the number of rows affected/selected or false on error.
  * Use the primaryKey.
  *
  * You can override this method in your subclass.
  *
  * @brief Delete
  * @since 1.5.16
  *
  * @param int|array $id Any single int or array list of primary keys
  *
  * @sa    WPDKDBTableModel::delete()
  *
  * @return int|bool
  */
 public function delete($id)
 {
     // Stability warning
     if (is_null($this->table)) {
         die(__METHOD__ . ' must be override in your subclass');
     }
     return $this->table->delete($id);
 }