@@ 911-939 (lines=29) @@ | ||
908 | ||
909 | ||
910 | ||
911 | protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
912 | // clean status |
|
913 | $venue_status = sanitize_key($venue_status); |
|
914 | // grab status |
|
915 | if (!empty($venue_status)) { |
|
916 | $success = TRUE; |
|
917 | //determine the event id and set to array. |
|
918 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
919 | // loop thru events |
|
920 | foreach ($VNU_IDs as $VNU_ID) { |
|
921 | if ($VNU_ID = absint($VNU_ID)) { |
|
922 | $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
923 | $success = $results !== FALSE ? $success : FALSE; |
|
924 | } else { |
|
925 | $msg = sprintf(__('An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', 'event_espresso'), $VNU_ID); |
|
926 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
927 | $success = FALSE; |
|
928 | } |
|
929 | } |
|
930 | } else { |
|
931 | $success = FALSE; |
|
932 | $msg = __('An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', 'event_espresso'); |
|
933 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
934 | } |
|
935 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
936 | $success = $success ? 2 : FALSE; |
|
937 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
938 | $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
939 | } |
|
940 | ||
941 | ||
942 |
@@ 1778-1807 (lines=30) @@ | ||
1775 | * @param string $event_status |
|
1776 | * @return void |
|
1777 | */ |
|
1778 | protected function _trash_or_restore_events($event_status = 'trash') { |
|
1779 | // clean status |
|
1780 | $event_status = sanitize_key($event_status); |
|
1781 | // grab status |
|
1782 | if (!empty($event_status)) { |
|
1783 | $success = TRUE; |
|
1784 | //determine the event id and set to array. |
|
1785 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1786 | // loop thru events |
|
1787 | foreach ($EVT_IDs as $EVT_ID) { |
|
1788 | if ($EVT_ID = absint($EVT_ID)) { |
|
1789 | $results = $this->_change_event_status($EVT_ID, $event_status); |
|
1790 | $success = $results !== FALSE ? $success : FALSE; |
|
1791 | } else { |
|
1792 | $msg = sprintf(__('An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.', 'event_espresso'), $EVT_ID); |
|
1793 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1794 | $success = FALSE; |
|
1795 | } |
|
1796 | } |
|
1797 | } else { |
|
1798 | $success = FALSE; |
|
1799 | $msg = __('An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', 'event_espresso'); |
|
1800 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1801 | } |
|
1802 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1803 | $success = $success ? 2 : FALSE; |
|
1804 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
1805 | ||
1806 | $this->_redirect_after_action($success, 'Events', $action, array('action' => 'default')); |
|
1807 | } |
|
1808 | ||
1809 | /** |
|
1810 | * _trash_or_restore_events |