| @@ 880-905 (lines=26) @@ | ||
| 877 | ||
| 878 | ||
| 879 | ||
| 880 | protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
| 881 | $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
| 882 | ||
| 883 | //loop thru venues |
|
| 884 | if ( $VNU_ID ) { |
|
| 885 | //clean status |
|
| 886 | $venue_status = sanitize_key( $venue_status ); |
|
| 887 | // grab status |
|
| 888 | if (!empty($venue_status)) { |
|
| 889 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
| 890 | } else { |
|
| 891 | $success = FALSE; |
|
| 892 | $msg = __('An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', 'event_espresso'); |
|
| 893 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 894 | } |
|
| 895 | } else { |
|
| 896 | $success = FALSE; |
|
| 897 | $msg = __('An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', 'event_espresso'); |
|
| 898 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 899 | } |
|
| 900 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
| 901 | ||
| 902 | if ( $redirect_after ) |
|
| 903 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
| 904 | ||
| 905 | } |
|
| 906 | ||
| 907 | ||
| 908 | ||
| @@ 1748-1772 (lines=25) @@ | ||
| 1745 | * @param string $event_status |
|
| 1746 | * @return void |
|
| 1747 | */ |
|
| 1748 | protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
| 1749 | //determine the event id and set to array. |
|
| 1750 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
|
| 1751 | // loop thru events |
|
| 1752 | if ($EVT_ID) { |
|
| 1753 | // clean status |
|
| 1754 | $event_status = sanitize_key($event_status); |
|
| 1755 | // grab status |
|
| 1756 | if (!empty($event_status)) { |
|
| 1757 | $success = $this->_change_event_status($EVT_ID, $event_status); |
|
| 1758 | } else { |
|
| 1759 | $success = FALSE; |
|
| 1760 | $msg = __('An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', 'event_espresso'); |
|
| 1761 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1762 | } |
|
| 1763 | } else { |
|
| 1764 | $success = FALSE; |
|
| 1765 | $msg = __('An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'); |
|
| 1766 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1767 | } |
|
| 1768 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
| 1769 | ||
| 1770 | if ( $redirect_after ) |
|
| 1771 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
| 1772 | } |
|
| 1773 | ||
| 1774 | /** |
|
| 1775 | * _trash_or_restore_events |
|