| @@ 722-738 (lines=17) @@ | ||
| 719 | //echo "trash $trash"; |
|
| 720 | //var_dump($this->_req_data['checkbox']);die; |
|
| 721 | if ( isset( $this->_req_data['checkbox'] )) { |
|
| 722 | if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
| 723 | // if array has more than one element than success message should be plural |
|
| 724 | $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 725 | // cycle thru bulk action checkboxes |
|
| 726 | while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
| 727 | if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) { |
|
| 728 | $success = 0; |
|
| 729 | } |
|
| 730 | } |
|
| 731 | ||
| 732 | } else { |
|
| 733 | // grab single id and delete |
|
| 734 | $ID = absint($this->_req_data['checkbox']); |
|
| 735 | if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
| 736 | $success = 0; |
|
| 737 | } |
|
| 738 | } |
|
| 739 | ||
| 740 | } else { |
|
| 741 | // delete via trash link |
|
| @@ 859-876 (lines=18) @@ | ||
| 856 | ||
| 857 | $success = 1; |
|
| 858 | //Checkboxes |
|
| 859 | if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 860 | // if array has more than one element than success message should be plural |
|
| 861 | $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 862 | // cycle thru bulk action checkboxes |
|
| 863 | while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
| 864 | if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
| 865 | $success = 0; |
|
| 866 | } |
|
| 867 | } |
|
| 868 | ||
| 869 | } else { |
|
| 870 | // grab single id and delete |
|
| 871 | $PRC_ID = absint($this->_req_data['id']); |
|
| 872 | if ( ! $PRC->delete_permanently_by_ID($PRC_ID)) { |
|
| 873 | $success = 0; |
|
| 874 | } |
|
| 875 | ||
| 876 | } |
|
| 877 | ||
| 878 | $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
| 879 | ||