Major refactoring of listing/router/model relation
- updated Subscribers listing - udpated Segments listing - added Forms router
This commit is contained in:
@ -5,15 +5,17 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class BulkAction {
|
||||
private $listing = null;
|
||||
private $action = null;
|
||||
private $data = null;
|
||||
private $model_class = null;
|
||||
|
||||
function __construct($model_class, $data) {
|
||||
$this->model_class = $model_class;
|
||||
$this->action = $data['action'];
|
||||
unset($data['action']);
|
||||
$this->data = $data;
|
||||
|
||||
$this->model_class = $model_class;
|
||||
$this->listing = new Handler(
|
||||
$this->model_class,
|
||||
$model_class,
|
||||
$this->data['listing']
|
||||
);
|
||||
return $this;
|
||||
@ -21,8 +23,9 @@ class BulkAction {
|
||||
|
||||
function apply() {
|
||||
return call_user_func_array(
|
||||
array($this->model_class, $this->data['action']),
|
||||
array($this->listing, $this->data)
|
||||
array($this->model_class, 'bulk'.ucfirst($this->action)),
|
||||
array($this->listing->getSelection(), $this->data)
|
||||
);
|
||||
return $models->count();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user