| @@ 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 | ||
| @@ 1697-1721 (lines=25) @@ | ||
| 1694 | * @param string $event_status |
|
| 1695 | * @return void |
|
| 1696 | */ |
|
| 1697 | protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
| 1698 | //determine the event id and set to array. |
|
| 1699 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
|
| 1700 | // loop thru events |
|
| 1701 | if ($EVT_ID) { |
|
| 1702 | // clean status |
|
| 1703 | $event_status = sanitize_key($event_status); |
|
| 1704 | // grab status |
|
| 1705 | if (!empty($event_status)) { |
|
| 1706 | $success = $this->_change_event_status($EVT_ID, $event_status); |
|
| 1707 | } else { |
|
| 1708 | $success = FALSE; |
|
| 1709 | $msg = __('An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', 'event_espresso'); |
|
| 1710 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1711 | } |
|
| 1712 | } else { |
|
| 1713 | $success = FALSE; |
|
| 1714 | $msg = __('An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'); |
|
| 1715 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1716 | } |
|
| 1717 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
| 1718 | ||
| 1719 | if ( $redirect_after ) |
|
| 1720 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
| 1721 | } |
|
| 1722 | ||
| 1723 | /** |
|
| 1724 | * _trash_or_restore_events |
|