@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <div class="import-area"> |
| 2 | 2 | <div class="important-notice"> |
| 3 | - <?php _e( 'The import feature has been disabled because of bugs. It is expected to be put back in place soon.', 'event_espresso' );?> |
|
| 3 | + <?php _e('The import feature has been disabled because of bugs. It is expected to be put back in place soon.', 'event_espresso'); ?> |
|
| 4 | 4 | </div> |
| 5 | 5 | <?php // echo $form?> |
| 6 | 6 | </div> |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | ?> |
| 6 | 6 | <div class="padding"> |
| 7 | 7 | |
| 8 | - <?php do_action( 'AHEE__template_settings__template__before_settings_form' ); ?> |
|
| 8 | + <?php do_action('AHEE__template_settings__template__before_settings_form'); ?> |
|
| 9 | 9 | |
| 10 | 10 | </div> |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | <?php echo EEH_Template::get_help_tab_link('full_logging_info'); ?> |
| 12 | 12 | </th> |
| 13 | 13 | <td> |
| 14 | - <?php echo EEH_Form_Fields::select_input('use_full_logging', $values, $use_full_logging ); ?> |
|
| 14 | + <?php echo EEH_Form_Fields::select_input('use_full_logging', $values, $use_full_logging); ?> |
|
| 15 | 15 | <p class="description"> |
| 16 | 16 | <span class="reminder-spn"> |
| 17 | 17 | <?php _e('Please use caution when using this feature. These files may be publicly available.', 'event_espresso'); ?> |
| 18 | 18 | </span><br/> |
| 19 | - <?php echo sprintf( __('Once saved, this file will be available at: %s', 'event_espresso'), '<br /><b>/wp-content/uploads/espresso/logs/' . EE_Registry::instance()->CFG->admin->log_file_name() . '</b>' ); ?> |
|
| 19 | + <?php echo sprintf(__('Once saved, this file will be available at: %s', 'event_espresso'), '<br /><b>/wp-content/uploads/espresso/logs/'.EE_Registry::instance()->CFG->admin->log_file_name().'</b>'); ?> |
|
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | </td> |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | <?php echo EEH_Template::get_help_tab_link('remote_logging_info'); ?> |
| 29 | 29 | </th> |
| 30 | 30 | <td> |
| 31 | - <?php echo EEH_Form_Fields::select_input('use_remote_logging', $values, $use_remote_logging ); ?> |
|
| 31 | + <?php echo EEH_Form_Fields::select_input('use_remote_logging', $values, $use_remote_logging); ?> |
|
| 32 | 32 | <p class="description"> |
| 33 | 33 | <?php _e('Send debugging data to the remote URL below.', 'event_espresso'); ?> |
| 34 | 34 | </p> |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | <?php echo EEH_Template::get_help_tab_link('remote_logging_url_info'); ?> |
| 42 | 42 | </th> |
| 43 | 43 | <td> |
| 44 | - <input name="remote_logging_url" id="remote_logging_url" size="20" class="regular-text" type="text" value="<?php echo $remote_logging_url;?>" /> |
|
| 44 | + <input name="remote_logging_url" id="remote_logging_url" size="20" class="regular-text" type="text" value="<?php echo $remote_logging_url; ?>" /> |
|
| 45 | 45 | <p class="description"> |
| 46 | 46 | <?php _e('Example: http://requestb.in/MY_UNIQUE_ID', 'event_espresso'); ?> |
| 47 | 47 | |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -144,17 +145,19 @@ discard block |
||
| 144 | 145 | $msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array(); |
| 145 | 146 | $mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array(); |
| 146 | 147 | |
| 147 | - if ( empty( $m_values ) ) |
|
| 148 | - $msgr_filters[0] = array( |
|
| 148 | + if ( empty( $m_values ) ) { |
|
| 149 | + $msgr_filters[0] = array( |
|
| 149 | 150 | 'id' => 'no_messenger_options', |
| 150 | 151 | 'text' => __('No Messengers active', 'event_espresso') |
| 151 | 152 | ); |
| 153 | + } |
|
| 152 | 154 | |
| 153 | - if ( empty($mt_values) ) |
|
| 154 | - $mt_filters[0] = array( |
|
| 155 | + if ( empty($mt_values) ) { |
|
| 156 | + $mt_filters[0] = array( |
|
| 155 | 157 | 'id' => 'no_message_type_options', |
| 156 | 158 | 'text' => __('No Message Types active', 'event_espresso') |
| 157 | 159 | ); |
| 160 | + } |
|
| 158 | 161 | |
| 159 | 162 | if ( count( $messengers ) >= 1 && !empty( $m_values ) ) { |
| 160 | 163 | unset( $msgr_filters[0] ); |
@@ -191,10 +194,11 @@ discard block |
||
| 191 | 194 | * @return string |
| 192 | 195 | */ |
| 193 | 196 | public function no_items() { |
| 194 | - if ( $this->_view !== 'trashed' ) |
|
| 195 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
| 196 | - else |
|
| 197 | - parent::no_items(); |
|
| 197 | + if ( $this->_view !== 'trashed' ) { |
|
| 198 | + printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
| 199 | + } else { |
|
| 200 | + parent::no_items(); |
|
| 201 | + } |
|
| 198 | 202 | } |
| 199 | 203 | |
| 200 | 204 | |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | * |
| 94 | 94 | * @abstract |
| 95 | 95 | * @access protected |
| 96 | - * @return array |
|
| 96 | + * @return string[] |
|
| 97 | 97 | */ |
| 98 | 98 | protected function _get_table_filters() { |
| 99 | 99 | $filters = array(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | class Custom_Messages_Template_List_Table extends EE_Admin_List_Table { |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - public function __construct( $admin_page ) { |
|
| 33 | + public function __construct($admin_page) { |
|
| 34 | 34 | //Set parent defaults |
| 35 | 35 | parent::__construct($admin_page); |
| 36 | 36 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | protected function _setup_data() { |
| 52 | - $this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE ); |
|
| 53 | - $this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE ); |
|
| 52 | + $this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE); |
|
| 53 | + $this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | protected function _set_properties() { |
| 61 | 61 | $this->_wp_list_args = array( |
| 62 | - 'singular' => __('Message Template Group', 'event_espresso' ), |
|
| 63 | - 'plural' => __('Message Template', 'event_espresso' ), |
|
| 62 | + 'singular' => __('Message Template Group', 'event_espresso'), |
|
| 63 | + 'plural' => __('Message Template', 'event_espresso'), |
|
| 64 | 64 | 'ajax' => TRUE, //for now, |
| 65 | 65 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
| 66 | 66 | ); |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | 'cb' => '<input type="checkbox" />', |
| 70 | 70 | 'name' => __('Template Name', 'event_espresso'), |
| 71 | 71 | 'message_type' => __('Message Type', 'event_espresso'), |
| 72 | - 'messenger' => __( 'Messenger', 'event_espresso'), |
|
| 73 | - 'description' => __( 'Description', 'event_espresso' ), |
|
| 74 | - 'events' => __( 'Events', 'event_espresso'), //count of events using this template. |
|
| 72 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
| 73 | + 'description' => __('Description', 'event_espresso'), |
|
| 74 | + 'events' => __('Events', 'event_espresso'), //count of events using this template. |
|
| 75 | 75 | 'actions' => '' |
| 76 | 76 | //'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place. |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | 79 | $this->_sortable_columns = array( |
| 80 | - 'messenger' => array( 'MTP_messenger' => TRUE ), |
|
| 80 | + 'messenger' => array('MTP_messenger' => TRUE), |
|
| 81 | 81 | //'message_type' => array( 'MTP_message_type' => FALSE ) |
| 82 | 82 | ); |
| 83 | 83 | |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return string |
| 98 | 98 | */ |
| 99 | - public function single_row( $item ) { |
|
| 99 | + public function single_row($item) { |
|
| 100 | 100 | $message_type = $item->message_type_obj(); |
| 101 | 101 | $messenger = $item->messenger_obj(); |
| 102 | 102 | |
| 103 | - if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) { |
|
| 103 | + if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
| 104 | 104 | echo ''; |
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - parent::single_row( $item ); |
|
| 108 | + parent::single_row($item); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | protected function _get_table_filters() { |
| 117 | 117 | $filters = array(); |
| 118 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
| 118 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
| 119 | 119 | //setup messengers for selects |
| 120 | 120 | $m_values = $this->get_admin_page()->get_messengers_for_list_table(); |
| 121 | 121 | //lets do the same for message types |
| 122 | 122 | $mt_values = $this->get_admin_page()->get_message_types_for_list_table(); |
| 123 | 123 | //setup messengers for selects |
| 124 | 124 | $m_values[0]['id'] = 'all'; |
| 125 | - $m_values[0]['text'] = __('All Messengers', 'event_espresso' ); |
|
| 125 | + $m_values[0]['text'] = __('All Messengers', 'event_espresso'); |
|
| 126 | 126 | |
| 127 | 127 | $msgr_default[0] = array( |
| 128 | 128 | 'id' => 'none_selected', |
@@ -134,28 +134,28 @@ discard block |
||
| 134 | 134 | 'text' => __('Show All', 'event_espresso') |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - $msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array(); |
|
| 138 | - $mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array(); |
|
| 137 | + $msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array(); |
|
| 138 | + $mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array(); |
|
| 139 | 139 | |
| 140 | - if ( empty( $m_values ) ) |
|
| 140 | + if (empty($m_values)) |
|
| 141 | 141 | $msgr_filters[0] = array( |
| 142 | 142 | 'id' => 'no_messenger_options', |
| 143 | 143 | 'text' => __('No Messengers active', 'event_espresso') |
| 144 | 144 | ); |
| 145 | 145 | |
| 146 | - if ( empty($mt_values) ) |
|
| 146 | + if (empty($mt_values)) |
|
| 147 | 147 | $mt_filters[0] = array( |
| 148 | 148 | 'id' => 'no_message_type_options', |
| 149 | 149 | 'text' => __('No Message Types active', 'event_espresso') |
| 150 | 150 | ); |
| 151 | 151 | |
| 152 | - if ( count( $m_values ) >= 1 && !empty( $m_values ) ) { |
|
| 153 | - unset( $msgr_filters[0] ); |
|
| 154 | - $msgr_filters = array_values( $msgr_filters ); //reindex keys |
|
| 152 | + if (count($m_values) >= 1 && ! empty($m_values)) { |
|
| 153 | + unset($msgr_filters[0]); |
|
| 154 | + $msgr_filters = array_values($msgr_filters); //reindex keys |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key( $this->_req_data['ee_messenger_filter_by']) : '' ); |
|
| 158 | - $filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key( $this->_req_data['ee_message_type_filter_by']) : ''); |
|
| 157 | + $filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : ''); |
|
| 158 | + $filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : ''); |
|
| 159 | 159 | return $filters; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | * we're just removing the search box for message templates, not needed. |
| 164 | 164 | * @return string (empty); |
| 165 | 165 | */ |
| 166 | - function search_box( $text, $input_id ) { |
|
| 166 | + function search_box($text, $input_id) { |
|
| 167 | 167 | return ''; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | protected function _add_view_counts() { |
| 172 | - foreach ( $this->_views as $view => $args ) { |
|
| 173 | - $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE ); |
|
| 172 | + foreach ($this->_views as $view => $args) { |
|
| 173 | + $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -184,16 +184,16 @@ discard block |
||
| 184 | 184 | * @return string |
| 185 | 185 | */ |
| 186 | 186 | public function no_items() { |
| 187 | - if ( $this->_view !== 'trashed' ) |
|
| 188 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
| 187 | + if ($this->_view !== 'trashed') |
|
| 188 | + printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>'); |
|
| 189 | 189 | else |
| 190 | 190 | parent::no_items(); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | |
| 195 | - public function column_cb( $item ) { |
|
| 196 | - return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() ); |
|
| 195 | + public function column_cb($item) { |
|
| 196 | + return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID()); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
@@ -201,29 +201,29 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | |
| 204 | - function column_name( $item ) { |
|
| 205 | - return '<p>' . $item->name() . '</p>'; |
|
| 204 | + function column_name($item) { |
|
| 205 | + return '<p>'.$item->name().'</p>'; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - function column_description( $item ) { |
|
| 212 | - return '<p>' . $item->description() . '</p>'; |
|
| 211 | + function column_description($item) { |
|
| 212 | + return '<p>'.$item->description().'</p>'; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | |
| 217 | - function column_actions( $item ) { |
|
| 218 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) { |
|
| 217 | + function column_actions($item) { |
|
| 218 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) { |
|
| 219 | 219 | $create_args = array( |
| 220 | 220 | 'GRP_ID' => $item->ID(), |
| 221 | 221 | 'messenger' => $item->messenger(), |
| 222 | 222 | 'message_type' => $item->message_type(), |
| 223 | 223 | 'action' => 'add_new_message_template' |
| 224 | 224 | ); |
| 225 | - $create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL ); |
|
| 226 | - return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') ); |
|
| 225 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
| 226 | + return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso')); |
|
| 227 | 227 | } |
| 228 | 228 | return ''; |
| 229 | 229 | } |
@@ -240,27 +240,27 @@ discard block |
||
| 240 | 240 | $actions = array(); |
| 241 | 241 | |
| 242 | 242 | // edit link but only if item isn't trashed. |
| 243 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) { |
|
| 244 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL ); |
|
| 245 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
| 243 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) { |
|
| 244 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL); |
|
| 245 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() )? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] ); |
|
| 249 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
| 248 | + $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']); |
|
| 249 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
| 250 | 250 | // restore link |
| 251 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
| 251 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
| 252 | 252 | // delete price link |
| 253 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
| 253 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
| 254 | 254 | |
| 255 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) { |
|
| 256 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
| 255 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) { |
|
| 256 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
| 257 | 257 | } else { |
| 258 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) { |
|
| 259 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
| 258 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) { |
|
| 259 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) { |
|
| 263 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
| 262 | + if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) { |
|
| 263 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
@@ -269,15 +269,15 @@ discard block |
||
| 269 | 269 | $c_configs = $item->contexts_config(); |
| 270 | 270 | $ctxt = array(); |
| 271 | 271 | $context_templates = $item->context_templates(); |
| 272 | - foreach ( $context_templates as $context => $template_fields ) { |
|
| 273 | - $mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
| 274 | - $inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : ''; |
|
| 272 | + foreach ($context_templates as $context => $template_fields) { |
|
| 273 | + $mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
| 274 | + $inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : ''; |
|
| 275 | 275 | $context_title = ucwords($c_configs[$context]['label']); |
| 276 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL ); |
|
| 277 | - $ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title; |
|
| 276 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL); |
|
| 277 | + $ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : ''; |
|
| 280 | + $ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : ''; |
|
| 281 | 281 | |
| 282 | 282 | |
| 283 | 283 | //Return the name contents |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | /* $1%s */ $name_link, |
| 286 | 286 | /* $2%s */ $item->GRP_ID(), |
| 287 | 287 | /* %4$s */ $ctx_content, |
| 288 | - /* $3%s */ $this->row_actions( $actions ) |
|
| 288 | + /* $3%s */ $this->row_actions($actions) |
|
| 289 | 289 | ); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * @return string message_type name |
| 307 | 307 | */ |
| 308 | 308 | function column_message_type($item) { |
| 309 | - return ucwords($item->message_type_obj()->label['singular'] ); |
|
| 309 | + return ucwords($item->message_type_obj()->label['singular']); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -134,8 +135,9 @@ discard block |
||
| 134 | 135 | } |
| 135 | 136 | |
| 136 | 137 | //first we consider whether this template has override set. If it does then that means no custom templates can be created from this template as a base. So let's just skip the button creation. |
| 137 | - if ( $item->get('MTP_is_override' ) ) |
|
| 138 | - return ''; |
|
| 138 | + if ( $item->get('MTP_is_override' ) ) { |
|
| 139 | + return ''; |
|
| 140 | + } |
|
| 139 | 141 | |
| 140 | 142 | |
| 141 | 143 | $create_args = array( |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function __construct( $routing = TRUE ) { |
|
| 35 | - parent::__construct( $routing ); |
|
| 36 | - if ( !defined( 'EE_MSG_CAF_ASSETS_PATH' ) ) { |
|
| 37 | - define( 'EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/' ); |
|
| 38 | - define( 'EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' ); |
|
| 39 | - define( 'EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/' ); |
|
| 40 | - define( 'EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/' ); |
|
| 34 | + public function __construct($routing = TRUE) { |
|
| 35 | + parent::__construct($routing); |
|
| 36 | + if ( ! defined('EE_MSG_CAF_ASSETS_PATH')) { |
|
| 37 | + define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/assets/'); |
|
| 38 | + define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
| 39 | + define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/'); |
|
| 40 | + define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/templates/'); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | protected function _extend_page_config() { |
| 45 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages'; |
|
| 45 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'messages'; |
|
| 46 | 46 | $this->_page_routes['custom_mtps'] = array( |
| 47 | 47 | 'func' => '_ee_custom_messages_overview_list_table', |
| 48 | 48 | 'capability' => 'ee_read_messages' ); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | 'require_nonce' => FALSE |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | - add_action( 'current_screen', array( $this, 'dynamic_screen_hooks' ), 10 ); |
|
| 73 | + add_action('current_screen', array($this, 'dynamic_screen_hooks'), 10); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | public function dynamic_screen_hooks() { |
| 88 | 88 | global $admin_page_hooks; |
| 89 | 89 | |
| 90 | - if ( !empty( $admin_page_hooks['espresso_events'] ) ) { |
|
| 90 | + if ( ! empty($admin_page_hooks['espresso_events'])) { |
|
| 91 | 91 | //we're on a EE specific page... good stuff! |
| 92 | 92 | $hook_prefix = $admin_page_hooks['espresso_events']; |
| 93 | - $filter_ref = $hook_prefix . '_page_' . $this->page_slug; |
|
| 94 | - add_filter( 'FHEE_manage_' . $filter_ref . '_columns', array( $this, 'add_custom_mtps_columns' ), 10, 2 ); |
|
| 95 | - add_action( 'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref, array( $this, 'custom_mtp_create_button_column'), 10, 2 ); |
|
| 93 | + $filter_ref = $hook_prefix.'_page_'.$this->page_slug; |
|
| 94 | + add_filter('FHEE_manage_'.$filter_ref.'_columns', array($this, 'add_custom_mtps_columns'), 10, 2); |
|
| 95 | + add_action('AHEE__EE_Admin_List_Table__column_actions__'.$filter_ref, array($this, 'custom_mtp_create_button_column'), 10, 2); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | * @param array $columns Original defined list of columns |
| 107 | 107 | * @param string $screen_id The unique screen id for the page. |
| 108 | 108 | */ |
| 109 | - public function add_custom_mtps_columns( $columns, $screen_id ) { |
|
| 110 | - if ( $screen_id !== 'espresso_messages_global_mtps' ) { |
|
| 109 | + public function add_custom_mtps_columns($columns, $screen_id) { |
|
| 110 | + if ($screen_id !== 'espresso_messages_global_mtps') { |
|
| 111 | 111 | return $columns; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return string html content for the page. |
| 130 | 130 | */ |
| 131 | - public function custom_mtp_create_button_column( $item, $screen_id ) { |
|
| 132 | - if ( $screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) { |
|
| 131 | + public function custom_mtp_create_button_column($item, $screen_id) { |
|
| 132 | + if ($screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) { |
|
| 133 | 133 | return ''; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | //first we consider whether this template has override set. If it does then that means no custom templates can be created from this template as a base. So let's just skip the button creation. |
| 137 | - if ( $item->get('MTP_is_override' ) ) |
|
| 137 | + if ($item->get('MTP_is_override')) |
|
| 138 | 138 | return ''; |
| 139 | 139 | |
| 140 | 140 | |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | 'message_type' => $item->message_type(), |
| 145 | 145 | 'action' => 'add_new_message_template' |
| 146 | 146 | ); |
| 147 | - $create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL ); |
|
| 148 | - echo sprintf( '<a href="%s" class="button button-small">%s</a>', $create_link, __('Create Custom', 'event_espresso') ); |
|
| 147 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
| 148 | + echo sprintf('<a href="%s" class="button button-small">%s</a>', $create_link, __('Create Custom', 'event_espresso')); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | ) |
| 179 | 179 | ) |
| 180 | 180 | ); |
| 181 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'espresso_messages_trash_message_template' ) ) { |
|
| 181 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'espresso_messages_trash_message_template')) { |
|
| 182 | 182 | $this->_views['trashed'] = array( |
| 183 | 183 | 'slug' => 'trashed', |
| 184 | 184 | 'label' => __('Trash', 'event_espresso'), |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | 'persistent' => FALSE |
| 236 | 236 | ), |
| 237 | 237 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
| 238 | - 'help_tabs' => array( |
|
| 238 | + 'help_tabs' => array( |
|
| 239 | 239 | 'registration_form_add_question_help_tab' => array( |
| 240 | 240 | 'title' => __('Add Question', 'event_espresso'), |
| 241 | 241 | 'filename' => 'registration_form_add_question' |
| 242 | 242 | ), |
| 243 | 243 | ), |
| 244 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
| 244 | + 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
| 245 | 245 | 'require_nonce' => FALSE |
| 246 | 246 | ), |
| 247 | 247 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | 'filename' => 'registration_form_add_question_group' |
| 259 | 259 | ), |
| 260 | 260 | ), |
| 261 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
| 261 | + 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
| 262 | 262 | 'require_nonce' => FALSE |
| 263 | 263 | ), |
| 264 | 264 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | 'filename' => 'registration_form_edit_question_group' |
| 277 | 277 | ), |
| 278 | 278 | ), |
| 279 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
| 279 | + 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
| 280 | 280 | 'require_nonce' => FALSE |
| 281 | 281 | ), |
| 282 | 282 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | 'filename' => 'registration_form_reg_form_settings' |
| 296 | 296 | ), |
| 297 | 297 | ), |
| 298 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
| 298 | + 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
| 299 | 299 | 'require_nonce' => FALSE |
| 300 | 300 | ) |
| 301 | 301 | |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -468,12 +469,12 @@ discard block |
||
| 468 | 469 | } |
| 469 | 470 | } |
| 470 | 471 | |
| 471 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
| 472 | + } elseif( !empty($this->_req_data['QSG_ID'])){ |
|
| 472 | 473 | $success = $model->delete_permanently_by_ID($this->_req_data['QSG_ID']); |
| 473 | 474 | |
| 474 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
| 475 | + } elseif( !empty($this->_req_data['QST_ID'])){ |
|
| 475 | 476 | $success = $model->delete_permanently_by_ID($this->_req_data['QST_ID']); |
| 476 | - }else{ |
|
| 477 | + } else{ |
|
| 477 | 478 | EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
| 478 | 479 | } |
| 479 | 480 | return $success; |
@@ -498,7 +499,7 @@ discard block |
||
| 498 | 499 | $questionGroup=$this->_question_group_model->get_one_by_ID($ID); |
| 499 | 500 | $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
| 500 | 501 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
| 501 | - }else{ |
|
| 502 | + } else{ |
|
| 502 | 503 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
| 503 | 504 | $questionGroup->set_order_to_latest(); |
| 504 | 505 | $this->_set_add_edit_form_tags('insert_question_group'); |
@@ -656,7 +657,7 @@ discard block |
||
| 656 | 657 | if($trash){ |
| 657 | 658 | $action_desc = 'trashed'; |
| 658 | 659 | $status = 'trash'; |
| 659 | - }else{ |
|
| 660 | + } else{ |
|
| 660 | 661 | $action_desc = 'restored'; |
| 661 | 662 | $status = 'all'; |
| 662 | 663 | } |
@@ -673,7 +674,7 @@ discard block |
||
| 673 | 674 | //note: this a subclass of EEM_Soft_Delete_Base, so thsi is actually only getting nontrashed items |
| 674 | 675 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
| 675 | 676 | $results=$this->_question_model->count_deleted($where); |
| 676 | - }else{ |
|
| 677 | + } else{ |
|
| 677 | 678 | //note: this a subclass of EEM_Soft_Delete_Base, so thsi is actually only getting nontrashed items |
| 678 | 679 | $results=$this->_question_model->get_all_deleted($query_params); |
| 679 | 680 | } |
@@ -688,7 +689,7 @@ discard block |
||
| 688 | 689 | if ($count){ |
| 689 | 690 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
| 690 | 691 | $results = $questionGroupModel->count($where); |
| 691 | - }else{ |
|
| 692 | + } else{ |
|
| 692 | 693 | $results = $questionGroupModel->get_all($query_params); |
| 693 | 694 | } |
| 694 | 695 | return $results; |
@@ -703,7 +704,7 @@ discard block |
||
| 703 | 704 | $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
| 704 | 705 | $query_params['limit'] = NULL; |
| 705 | 706 | $results = $questionGroupModel->count_deleted($where); |
| 706 | - }else{ |
|
| 707 | + } else{ |
|
| 707 | 708 | $results = $questionGroupModel->get_all_deleted($query_params); |
| 708 | 709 | } |
| 709 | 710 | return $results; |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | * being address info, and 0 being neither) |
| 127 | 127 | * @global type $wpdb |
| 128 | 128 | * @param type $new_question_group_id |
| 129 | - * @return boolean |
|
| 129 | + * @return integer |
|
| 130 | 130 | */ |
| 131 | 131 | private function _is_system_question_group($new_question_group_id){ |
| 132 | 132 | global $wpdb; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - public function __construct( $routing = TRUE ) { |
|
| 34 | - define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS ); |
|
| 35 | - define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS ); |
|
| 36 | - define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' ); |
|
| 37 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS ); |
|
| 38 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' ); |
|
| 39 | - parent::__construct( $routing ); |
|
| 33 | + public function __construct($routing = TRUE) { |
|
| 34 | + define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS); |
|
| 35 | + define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS); |
|
| 36 | + define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/'); |
|
| 37 | + define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS); |
|
| 38 | + define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/'); |
|
| 39 | + parent::__construct($routing); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | protected function _extend_page_config() { |
| 48 | 48 | $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN; |
| 49 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
| 50 | - $qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0; |
|
| 49 | + $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
| 50 | + $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0; |
|
| 51 | 51 | |
| 52 | 52 | $new_page_routes = array( |
| 53 | 53 | 'question_groups' => array( |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | 'func' => '_trash_or_restore_questions', |
| 81 | 81 | 'capability' => 'ee_delete_question', |
| 82 | 82 | 'obj_id' => $qst_id, |
| 83 | - 'args' => array( 'trash' => FALSE ), |
|
| 83 | + 'args' => array('trash' => FALSE), |
|
| 84 | 84 | 'noheader' => TRUE |
| 85 | 85 | ), |
| 86 | 86 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | 'trash_question_group' => array( |
| 141 | 141 | 'func' => '_trash_or_restore_question_groups', |
| 142 | - 'args' => array( 'trash' => TRUE ), |
|
| 142 | + 'args' => array('trash' => TRUE), |
|
| 143 | 143 | 'capability' => 'ee_delete_question_group', |
| 144 | 144 | 'obj_id' => $qsg_id, |
| 145 | 145 | 'noheader' => TRUE |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | 'restore_question_group' => array( |
| 149 | 149 | 'func' => '_trash_or_restore_question_groups', |
| 150 | - 'args' => array( 'trash' => FALSE ), |
|
| 150 | + 'args' => array('trash' => FALSE), |
|
| 151 | 151 | 'capability' => 'ee_delete_question_group', |
| 152 | 152 | 'obj_id' => $qsg_id, |
| 153 | 153 | 'noheader' => TRUE |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | 'update_question_group' => array( |
| 164 | 164 | 'func' => '_insert_or_update_question_group', |
| 165 | - 'args' => array('new_question_group' => FALSE ), |
|
| 165 | + 'args' => array('new_question_group' => FALSE), |
|
| 166 | 166 | 'capability' => 'ee_edit_question_group', |
| 167 | 167 | 'obj_id' => $qsg_id, |
| 168 | 168 | 'noheader' => TRUE, |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | 'noheader' => TRUE |
| 201 | 201 | ), |
| 202 | 202 | ); |
| 203 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
| 203 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
| 204 | 204 | |
| 205 | 205 | $new_page_config = array( |
| 206 | 206 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | 'filename' => 'registration_form_question_groups_views_bulk_actions_search' |
| 225 | 225 | ), |
| 226 | 226 | ), |
| 227 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
| 227 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
| 228 | 228 | 'metaboxes' => $this->_default_espresso_metaboxes, |
| 229 | 229 | 'require_nonce' => FALSE, |
| 230 | 230 | 'qtips' => array( |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | 'order' => 5, |
| 239 | 239 | 'persistent' => FALSE |
| 240 | 240 | ), |
| 241 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
| 241 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 242 | 242 | 'help_tabs' => array( |
| 243 | 243 | 'registration_form_add_question_help_tab' => array( |
| 244 | 244 | 'title' => __('Add Question', 'event_espresso'), |
| 245 | 245 | 'filename' => 'registration_form_add_question' |
| 246 | 246 | ), |
| 247 | 247 | ), |
| 248 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
| 248 | + 'help_tour' => array('Registration_Form_Add_Question_Help_Tour'), |
|
| 249 | 249 | 'require_nonce' => FALSE |
| 250 | 250 | ), |
| 251 | 251 | |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | 'order' => 5, |
| 256 | 256 | 'persistent' => FALSE |
| 257 | 257 | ), |
| 258 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
| 258 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 259 | 259 | 'help_tabs' => array( |
| 260 | 260 | 'registration_form_add_question_group_help_tab' => array( |
| 261 | 261 | 'title' => __('Add Question Group', 'event_espresso'), |
| 262 | 262 | 'filename' => 'registration_form_add_question_group' |
| 263 | 263 | ), |
| 264 | 264 | ), |
| 265 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
| 265 | + 'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'), |
|
| 266 | 266 | 'require_nonce' => FALSE |
| 267 | 267 | ), |
| 268 | 268 | |
@@ -271,16 +271,16 @@ discard block |
||
| 271 | 271 | 'label' => __('Edit Question Group', 'event_espresso'), |
| 272 | 272 | 'order' => 5, |
| 273 | 273 | 'persistent' => FALSE, |
| 274 | - 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
| 274 | + 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
| 275 | 275 | ), |
| 276 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
| 276 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 277 | 277 | 'help_tabs' => array( |
| 278 | 278 | 'registration_form_edit_question_group_help_tab' => array( |
| 279 | 279 | 'title' => __('Edit Question Group', 'event_espresso'), |
| 280 | 280 | 'filename' => 'registration_form_edit_question_group' |
| 281 | 281 | ), |
| 282 | 282 | ), |
| 283 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
| 283 | + 'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'), |
|
| 284 | 284 | 'require_nonce' => FALSE |
| 285 | 285 | ), |
| 286 | 286 | |
@@ -292,19 +292,19 @@ discard block |
||
| 292 | 292 | 'labels' => array( |
| 293 | 293 | 'publishbox' => __('Update Settings', 'event_espresso') |
| 294 | 294 | ), |
| 295 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
| 295 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
| 296 | 296 | 'help_tabs' => array( |
| 297 | 297 | 'registration_form_reg_form_settings_help_tab' => array( |
| 298 | 298 | 'title' => __('Registration Form Settings', 'event_espresso'), |
| 299 | 299 | 'filename' => 'registration_form_reg_form_settings' |
| 300 | 300 | ), |
| 301 | 301 | ), |
| 302 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
| 302 | + 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
| 303 | 303 | 'require_nonce' => FALSE |
| 304 | 304 | ) |
| 305 | 305 | |
| 306 | 306 | ); |
| 307 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
| 307 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
| 308 | 308 | |
| 309 | 309 | //change the list table we're going to use so it's the NEW list table! |
| 310 | 310 | $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table'; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | 'edit_question_group' => __('Edit Question Group', 'event_espresso'), |
| 319 | 319 | 'delete_question_group' => __('Delete Question Group', 'event_espresso'), |
| 320 | 320 | ); |
| 321 | - $this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels ); |
|
| 321 | + $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels); |
|
| 322 | 322 | |
| 323 | 323 | } |
| 324 | 324 | |
@@ -327,14 +327,14 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | |
| 329 | 329 | protected function _ajax_hooks() { |
| 330 | - add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' )); |
|
| 330 | + add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | |
| 336 | 336 | public function load_scripts_styles_question_groups() { |
| 337 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
| 337 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @return void |
| 356 | 356 | */ |
| 357 | 357 | public function load_sortable_question_script() { |
| 358 | - wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
| 358 | + wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
| 359 | 359 | wp_enqueue_script('ee-question-sortable'); |
| 360 | 360 | } |
| 361 | 361 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | ) |
| 375 | 375 | ); |
| 376 | 376 | |
| 377 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
| 377 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
| 378 | 378 | $this->_views['trash'] = array( |
| 379 | 379 | 'slug' => 'trash', |
| 380 | 380 | 'label' => __('Trash', 'event_espresso'), |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | ) |
| 405 | 405 | ); |
| 406 | 406 | |
| 407 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) { |
|
| 407 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) { |
|
| 408 | 408 | $this->_views['trash'] = array( |
| 409 | 409 | 'slug' => 'trash', |
| 410 | 410 | 'label' => __('Trash', 'event_espresso'), |
@@ -440,24 +440,24 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | |
| 443 | - protected function _delete_question(){ |
|
| 444 | - $success = $this->_delete_items( $this->_question_model ); |
|
| 443 | + protected function _delete_question() { |
|
| 444 | + $success = $this->_delete_items($this->_question_model); |
|
| 445 | 445 | $this->_redirect_after_action( |
| 446 | 446 | $success, |
| 447 | - $this->_question_model->item_name( $success ), |
|
| 447 | + $this->_question_model->item_name($success), |
|
| 448 | 448 | 'deleted', |
| 449 | - array( 'action' => 'default', 'status' => 'all' ) |
|
| 449 | + array('action' => 'default', 'status' => 'all') |
|
| 450 | 450 | ); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | |
| 454 | 454 | protected function _delete_questions() { |
| 455 | - $success = $this->_delete_items( $this->_question_model ); |
|
| 455 | + $success = $this->_delete_items($this->_question_model); |
|
| 456 | 456 | $this->_redirect_after_action( |
| 457 | 457 | $success, |
| 458 | - $this->_question_model->item_name( $success ), |
|
| 458 | + $this->_question_model->item_name($success), |
|
| 459 | 459 | 'deleted permanently', |
| 460 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
| 460 | + array('action' => 'default', 'status' => 'trash') |
|
| 461 | 461 | ); |
| 462 | 462 | } |
| 463 | 463 | |
@@ -468,26 +468,26 @@ discard block |
||
| 468 | 468 | * @param EEM_Soft_Delete_Base $model |
| 469 | 469 | * @return int number of items deleted permanently |
| 470 | 470 | */ |
| 471 | - private function _delete_items(EEM_Soft_Delete_Base $model){ |
|
| 471 | + private function _delete_items(EEM_Soft_Delete_Base $model) { |
|
| 472 | 472 | $success = 0; |
| 473 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 474 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 473 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 474 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 475 | 475 | // if array has more than one element than success message should be plural |
| 476 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 476 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 477 | 477 | // cycle thru bulk action checkboxes |
| 478 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
| 479 | - if ( ! $this->_delete_item( $ID, $model ) ) { |
|
| 478 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 479 | + if ( ! $this->_delete_item($ID, $model)) { |
|
| 480 | 480 | $success = 0; |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
| 485 | - $success = $this->_delete_item( $this->_req_data['QSG_ID'], $model ); |
|
| 484 | + }elseif ( ! empty($this->_req_data['QSG_ID'])) { |
|
| 485 | + $success = $this->_delete_item($this->_req_data['QSG_ID'], $model); |
|
| 486 | 486 | |
| 487 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
| 488 | - $success = $this->_delete_item( $this->_req_data['QST_ID'], $model ); |
|
| 489 | - }else{ |
|
| 490 | - EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 487 | + }elseif ( ! empty($this->_req_data['QST_ID'])) { |
|
| 488 | + $success = $this->_delete_item($this->_req_data['QST_ID'], $model); |
|
| 489 | + } else { |
|
| 490 | + EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__); |
|
| 491 | 491 | } |
| 492 | 492 | return $success; |
| 493 | 493 | } |
@@ -498,11 +498,11 @@ discard block |
||
| 498 | 498 | * @param EEM_Soft_Delete_Base $model |
| 499 | 499 | * @return boolean |
| 500 | 500 | */ |
| 501 | - protected function _delete_item( $id, $model ) { |
|
| 502 | - if( $model instanceof EEM_Question ) { |
|
| 503 | - EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) ); |
|
| 501 | + protected function _delete_item($id, $model) { |
|
| 502 | + if ($model instanceof EEM_Question) { |
|
| 503 | + EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); |
|
| 504 | 504 | } |
| 505 | - return $model->delete_permanently_by_ID( absint( $id ) ); |
|
| 505 | + return $model->delete_permanently_by_ID(absint($id)); |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | |
@@ -514,29 +514,29 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | |
| 517 | - protected function _edit_question_group( $type = 'add' ) { |
|
| 518 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 519 | - $ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE; |
|
| 520 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
| 517 | + protected function _edit_question_group($type = 'add') { |
|
| 518 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 519 | + $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE; |
|
| 520 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
| 521 | 521 | // add ID to title if editing |
| 522 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
| 523 | - if($ID){ |
|
| 524 | - $questionGroup=$this->_question_group_model->get_one_by_ID($ID); |
|
| 525 | - $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
| 522 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
| 523 | + if ($ID) { |
|
| 524 | + $questionGroup = $this->_question_group_model->get_one_by_ID($ID); |
|
| 525 | + $additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
| 526 | 526 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
| 527 | - }else{ |
|
| 527 | + } else { |
|
| 528 | 528 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
| 529 | 529 | $questionGroup->set_order_to_latest(); |
| 530 | 530 | $this->_set_add_edit_form_tags('insert_question_group'); |
| 531 | 531 | } |
| 532 | 532 | $this->_template_args['values'] = $this->_yes_no_values; |
| 533 | - $this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group(); |
|
| 534 | - $this->_template_args['QSG_ID']=$ID ? $ID : TRUE; |
|
| 535 | - $this->_template_args['question_group']=$questionGroup; |
|
| 533 | + $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group(); |
|
| 534 | + $this->_template_args['QSG_ID'] = $ID ? $ID : TRUE; |
|
| 535 | + $this->_template_args['question_group'] = $questionGroup; |
|
| 536 | 536 | |
| 537 | - $redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url ); |
|
| 538 | - $this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL ); |
|
| 539 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
| 537 | + $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); |
|
| 538 | + $this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL); |
|
| 539 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE); |
|
| 540 | 540 | |
| 541 | 541 | // the details template wrapper |
| 542 | 542 | $this->display_admin_page_with_sidebar(); |
@@ -547,76 +547,76 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | protected function _delete_question_groups() { |
| 549 | 549 | $success = $this->_delete_items($this->_question_group_model); |
| 550 | - $this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' )); |
|
| 550 | + $this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash')); |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | |
| 554 | 554 | |
| 555 | - protected function _insert_or_update_question_group( $new_question_group = TRUE) { |
|
| 556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 557 | - $set_column_values=$this->_set_column_values_for($this->_question_group_model); |
|
| 558 | - if ( $new_question_group ){ |
|
| 555 | + protected function _insert_or_update_question_group($new_question_group = TRUE) { |
|
| 556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 557 | + $set_column_values = $this->_set_column_values_for($this->_question_group_model); |
|
| 558 | + if ($new_question_group) { |
|
| 559 | 559 | $QSG_ID = $this->_question_group_model->insert($set_column_values); |
| 560 | 560 | $success = $QSG_ID ? 1 : 0; |
| 561 | 561 | } else { |
| 562 | 562 | $QSG_ID = absint($this->_req_data['QSG_ID']); |
| 563 | - unset( $set_column_values[ 'QSG_ID' ] ); |
|
| 564 | - $success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID ))); |
|
| 563 | + unset($set_column_values['QSG_ID']); |
|
| 564 | + $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); |
|
| 565 | 565 | } |
| 566 | - $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone ); |
|
| 566 | + $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone); |
|
| 567 | 567 | // update the existing related questions |
| 568 | 568 | // BUT FIRST... delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group) |
| 569 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) { |
|
| 569 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) { |
|
| 570 | 570 | // delete where QST ID = system phone question ID and Question Group ID is NOT this group |
| 571 | - EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID )))); |
|
| 571 | + EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID)))); |
|
| 572 | 572 | } |
| 573 | 573 | /** @type EE_Question_Group $question_group */ |
| 574 | - $question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID ); |
|
| 574 | + $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID); |
|
| 575 | 575 | $questions = $question_group->questions(); |
| 576 | 576 | // make sure system phone question is added to list of questions for this group |
| 577 | - if ( ! isset( $questions[$phone_question_id ] )) { |
|
| 578 | - $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id ); |
|
| 577 | + if ( ! isset($questions[$phone_question_id])) { |
|
| 578 | + $questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - foreach( $questions as $question_ID => $question ){ |
|
| 581 | + foreach ($questions as $question_ID => $question) { |
|
| 582 | 582 | // first we always check for order. |
| 583 | - if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){ |
|
| 583 | + if ( ! empty($this->_req_data['question_orders'][$question_ID])) { |
|
| 584 | 584 | //update question order |
| 585 | - $question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] ); |
|
| 585 | + $question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | // then we always check if adding or removing. |
| 589 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) { |
|
| 590 | - $question_group->add_question( $question_ID ); |
|
| 589 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) { |
|
| 590 | + $question_group->add_question($question_ID); |
|
| 591 | 591 | } else { |
| 592 | 592 | // not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it) |
| 593 | 593 | if ( |
| 594 | 594 | in_array( |
| 595 | 595 | $question->system_ID(), |
| 596 | - EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() ) |
|
| 596 | + EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group()) |
|
| 597 | 597 | ) |
| 598 | 598 | ) { |
| 599 | 599 | continue; |
| 600 | 600 | } else { |
| 601 | - $question_group->remove_question( $question_ID ); |
|
| 601 | + $question_group->remove_question($question_ID); |
|
| 602 | 602 | } |
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | // save new related questions |
| 606 | - if ( isset( $this->_req_data['questions'] )) { |
|
| 607 | - foreach( $this->_req_data['questions'] as $QST_ID ){ |
|
| 608 | - $question_group->add_question( $QST_ID ); |
|
| 609 | - if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) { |
|
| 610 | - $question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] ); |
|
| 606 | + if (isset($this->_req_data['questions'])) { |
|
| 607 | + foreach ($this->_req_data['questions'] as $QST_ID) { |
|
| 608 | + $question_group->add_question($QST_ID); |
|
| 609 | + if (isset($this->_req_data['question_orders'][$QST_ID])) { |
|
| 610 | + $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]); |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - if ( $success !== FALSE ) { |
|
| 616 | - $msg = $new_question_group ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() ); |
|
| 617 | - EE_Error::add_success( $msg ); |
|
| 615 | + if ($success !== FALSE) { |
|
| 616 | + $msg = $new_question_group ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name()); |
|
| 617 | + EE_Error::add_success($msg); |
|
| 618 | 618 | } |
| 619 | - $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE); |
|
| 619 | + $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE); |
|
| 620 | 620 | |
| 621 | 621 | } |
| 622 | 622 | |
@@ -624,39 +624,39 @@ discard block |
||
| 624 | 624 | * duplicates a question and all its question options and redirects to the new question. |
| 625 | 625 | */ |
| 626 | 626 | public function _duplicate_question() { |
| 627 | - $question_ID = intval( $this->_req_data[ 'QST_ID' ] ); |
|
| 628 | - $question = EEM_Question::instance()->get_one_by_ID( $question_ID ); |
|
| 629 | - if( $question instanceof EE_Question ) { |
|
| 627 | + $question_ID = intval($this->_req_data['QST_ID']); |
|
| 628 | + $question = EEM_Question::instance()->get_one_by_ID($question_ID); |
|
| 629 | + if ($question instanceof EE_Question) { |
|
| 630 | 630 | $new_question = $question->duplicate(); |
| 631 | - if( $new_question instanceof EE_Question ) { |
|
| 632 | - $this->_redirect_after_action( true, __( 'Question', 'event_espresso' ), __( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE); |
|
| 631 | + if ($new_question instanceof EE_Question) { |
|
| 632 | + $this->_redirect_after_action(true, __('Question', 'event_espresso'), __('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE); |
|
| 633 | 633 | } else { |
| 634 | 634 | global $wpdb; |
| 635 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 636 | - $this->_redirect_after_action(false, '', '', array('action'=>'default'), false ); |
|
| 635 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__); |
|
| 636 | + $this->_redirect_after_action(false, '', '', array('action'=>'default'), false); |
|
| 637 | 637 | } |
| 638 | 638 | } else { |
| 639 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 640 | - $this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false ); |
|
| 639 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__); |
|
| 640 | + $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); |
|
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
| 645 | 645 | |
| 646 | 646 | protected function _trash_or_restore_question_groups($trash = TRUE) { |
| 647 | - return $this->_trash_or_restore_items( $this->_question_group_model, $trash ); |
|
| 647 | + return $this->_trash_or_restore_items($this->_question_group_model, $trash); |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - protected function _trash_question(){ |
|
| 651 | - $success=$this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID'])); |
|
| 652 | - $query_args=array('action'=>'default','status'=>'all'); |
|
| 650 | + protected function _trash_question() { |
|
| 651 | + $success = $this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID'])); |
|
| 652 | + $query_args = array('action'=>'default', 'status'=>'all'); |
|
| 653 | 653 | $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | |
| 657 | 657 | |
| 658 | - protected function _trash_or_restore_questions($trash=TRUE){ |
|
| 659 | - $this->_trash_or_restore_items( $this->_question_model, $trash ); |
|
| 658 | + protected function _trash_or_restore_questions($trash = TRUE) { |
|
| 659 | + $this->_trash_or_restore_items($this->_question_model, $trash); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | |
@@ -667,21 +667,21 @@ discard block |
||
| 667 | 667 | * @param EEM_Base $model |
| 668 | 668 | * @param boolean $trash wehter to trash or restore |
| 669 | 669 | */ |
| 670 | - private function _trash_or_restore_items( EEM_Base $model, $trash = TRUE ) { |
|
| 670 | + private function _trash_or_restore_items(EEM_Base $model, $trash = TRUE) { |
|
| 671 | 671 | |
| 672 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 672 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 673 | 673 | |
| 674 | 674 | $success = 1; |
| 675 | 675 | //Checkboxes |
| 676 | 676 | //echo "trash $trash"; |
| 677 | 677 | //var_dump($this->_req_data['checkbox']);die; |
| 678 | - if ( isset( $this->_req_data['checkbox'] )) { |
|
| 679 | - if ( isset( $this->_req_data['checkbox'] ) && ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
| 678 | + if (isset($this->_req_data['checkbox'])) { |
|
| 679 | + if (isset($this->_req_data['checkbox']) && ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 680 | 680 | // if array has more than one element than success message should be plural |
| 681 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 681 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 682 | 682 | // cycle thru bulk action checkboxes |
| 683 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
| 684 | - if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) { |
|
| 683 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 684 | + if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) { |
|
| 685 | 685 | $success = 0; |
| 686 | 686 | } |
| 687 | 687 | } |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | } else { |
| 690 | 690 | // grab single id and delete |
| 691 | 691 | $ID = absint($this->_req_data['checkbox']); |
| 692 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
| 692 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
| 693 | 693 | $success = 0; |
| 694 | 694 | } |
| 695 | 695 | } |
@@ -697,53 +697,53 @@ discard block |
||
| 697 | 697 | } else { |
| 698 | 698 | // delete via trash link |
| 699 | 699 | // grab single id and delete |
| 700 | - $ID = absint($this->_req_data[ $model->primary_key_name() ]); |
|
| 701 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
| 700 | + $ID = absint($this->_req_data[$model->primary_key_name()]); |
|
| 701 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
| 702 | 702 | $success = 0; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | |
| 708 | - $action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) ); |
|
| 708 | + $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) ); |
|
| 709 | 709 | //echo "action :$action"; |
| 710 | 710 | //$action = 'questions' ? 'default' : $action; |
| 711 | - if($trash){ |
|
| 711 | + if ($trash) { |
|
| 712 | 712 | $action_desc = 'trashed'; |
| 713 | 713 | $status = 'trash'; |
| 714 | - }else{ |
|
| 714 | + } else { |
|
| 715 | 715 | $action_desc = 'restored'; |
| 716 | 716 | $status = 'all'; |
| 717 | 717 | } |
| 718 | - $this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) ); |
|
| 718 | + $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status)); |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | |
| 722 | 722 | |
| 723 | 723 | |
| 724 | - public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) { |
|
| 724 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
| 725 | 725 | $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
| 726 | 726 | |
| 727 | - if( $count ){ |
|
| 727 | + if ($count) { |
|
| 728 | 728 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
| 729 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
| 730 | - $results=$this->_question_model->count_deleted($where); |
|
| 731 | - }else{ |
|
| 729 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 730 | + $results = $this->_question_model->count_deleted($where); |
|
| 731 | + } else { |
|
| 732 | 732 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
| 733 | - $results=$this->_question_model->get_all_deleted($query_params); |
|
| 733 | + $results = $this->_question_model->get_all_deleted($query_params); |
|
| 734 | 734 | } |
| 735 | 735 | return $results; |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | |
| 739 | 739 | |
| 740 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
| 741 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
| 742 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
| 743 | - if ($count){ |
|
| 744 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
| 740 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
| 741 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
| 742 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
| 743 | + if ($count) { |
|
| 744 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 745 | 745 | $results = $questionGroupModel->count($where); |
| 746 | - }else{ |
|
| 746 | + } else { |
|
| 747 | 747 | $results = $questionGroupModel->get_all($query_params); |
| 748 | 748 | } |
| 749 | 749 | return $results; |
@@ -751,14 +751,14 @@ discard block |
||
| 751 | 751 | |
| 752 | 752 | |
| 753 | 753 | |
| 754 | - public function get_trashed_question_groups( $per_page,$current_page = 1, $count = FALSE ) { |
|
| 755 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
| 756 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
| 757 | - if($count){ |
|
| 758 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
| 754 | + public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
| 755 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
| 756 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
| 757 | + if ($count) { |
|
| 758 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
| 759 | 759 | $query_params['limit'] = NULL; |
| 760 | 760 | $results = $questionGroupModel->count_deleted($where); |
| 761 | - }else{ |
|
| 761 | + } else { |
|
| 762 | 762 | $results = $questionGroupModel->get_all_deleted($query_params); |
| 763 | 763 | } |
| 764 | 764 | return $results; |
@@ -771,22 +771,22 @@ discard block |
||
| 771 | 771 | */ |
| 772 | 772 | public function update_question_group_order() { |
| 773 | 773 | |
| 774 | - $success = __( 'Question group order was updated successfully.', 'event_espresso' ); |
|
| 774 | + $success = __('Question group order was updated successfully.', 'event_espresso'); |
|
| 775 | 775 | |
| 776 | 776 | // grab our row IDs |
| 777 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
| 777 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
| 778 | 778 | |
| 779 | - $perpage = !empty( $this->_req_data['perpage'] ) ? (int) $this->_req_data['perpage'] : NULL; |
|
| 780 | - $curpage = !empty( $this->_req_data['curpage'] ) ? (int) $this->_req_data['curpage'] : NULL; |
|
| 779 | + $perpage = ! empty($this->_req_data['perpage']) ? (int) $this->_req_data['perpage'] : NULL; |
|
| 780 | + $curpage = ! empty($this->_req_data['curpage']) ? (int) $this->_req_data['curpage'] : NULL; |
|
| 781 | 781 | |
| 782 | - if ( is_array( $row_ids )) { |
|
| 782 | + if (is_array($row_ids)) { |
|
| 783 | 783 | //figure out where we start the row_id count at for the current page. |
| 784 | - $qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage; |
|
| 784 | + $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage; |
|
| 785 | 785 | |
| 786 | 786 | global $wpdb; |
| 787 | - for ( $i = 0; $i < count($row_ids); $i++ ) { |
|
| 787 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
| 788 | 788 | //Update the questions when re-ordering |
| 789 | - if ( EEM_Question_Group::instance()->update ( array( 'QSG_order' => $qsgcount ), array(array( 'QSG_ID' => $row_ids[$i] ))) === FALSE ) { |
|
| 789 | + if (EEM_Question_Group::instance()->update(array('QSG_order' => $qsgcount), array(array('QSG_ID' => $row_ids[$i]))) === FALSE) { |
|
| 790 | 790 | $success = FALSE; |
| 791 | 791 | } |
| 792 | 792 | $qsgcount++; |
@@ -795,9 +795,9 @@ discard block |
||
| 795 | 795 | $success = FALSE; |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - $errors = ! $success ? __( 'An error occurred. The question group order was not updated.', 'event_espresso' ) : FALSE; |
|
| 798 | + $errors = ! $success ? __('An error occurred. The question group order was not updated.', 'event_espresso') : FALSE; |
|
| 799 | 799 | |
| 800 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
| 800 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
| 801 | 801 | die(); |
| 802 | 802 | |
| 803 | 803 | } |
@@ -814,10 +814,10 @@ discard block |
||
| 814 | 814 | |
| 815 | 815 | protected function _reg_form_settings() { |
| 816 | 816 | $this->_template_args['values'] = $this->_yes_no_values; |
| 817 | - $this->_template_args = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args ); |
|
| 818 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
| 819 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
| 820 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
| 817 | + $this->_template_args = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args); |
|
| 818 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
| 819 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
| 820 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
| 821 | 821 | $this->display_admin_page_with_sidebar(); |
| 822 | 822 | } |
| 823 | 823 | |
@@ -825,9 +825,9 @@ discard block |
||
| 825 | 825 | |
| 826 | 826 | |
| 827 | 827 | protected function _update_reg_form_settings() { |
| 828 | - EE_Registry::instance()->CFG->registration = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration ); |
|
| 829 | - $success = $this->_update_espresso_configuration( __('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 830 | - $this->_redirect_after_action( $success, __('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) ); |
|
| 828 | + EE_Registry::instance()->CFG->registration = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration); |
|
| 829 | + $success = $this->_update_espresso_configuration(__('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
| 830 | + $this->_redirect_after_action($success, __('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings')); |
|
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | } |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -125,8 +126,9 @@ discard block |
||
| 125 | 126 | $actions = array(); |
| 126 | 127 | |
| 127 | 128 | //return $item->name(); |
| 128 | - if ( !defined('REG_ADMIN_URL') ) |
|
| 129 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
| 129 | + if ( !defined('REG_ADMIN_URL') ) { |
|
| 130 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
| 131 | + } |
|
| 130 | 132 | |
| 131 | 133 | $edit_query_args = array( |
| 132 | 134 | 'action' => 'edit_question_group', |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | class Registration_Form_Question_Groups_Admin_List_Table extends EE_Admin_List_Table { |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function __construct( $admin_page ) { |
|
| 34 | + public function __construct($admin_page) { |
|
| 35 | 35 | parent::__construct($admin_page); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | protected function _setup_data() { |
| 42 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, FALSE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, FALSE ); |
|
| 43 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
| 42 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, FALSE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, FALSE); |
|
| 43 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | protected function _set_properties() { |
| 51 | 51 | $this->_wp_list_args = array( |
| 52 | - 'singular' => __('question group', 'event_espresso' ), |
|
| 53 | - 'plural' => __('question groups', 'event_espresso' ), |
|
| 52 | + 'singular' => __('question group', 'event_espresso'), |
|
| 53 | + 'plural' => __('question groups', 'event_espresso'), |
|
| 54 | 54 | 'ajax' => TRUE, //for now, |
| 55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
| 56 | 56 | ); |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | $this->_sortable_columns = array( |
| 68 | - 'id' => array( 'QSG_ID' => FALSE ), |
|
| 69 | - 'name' => array( 'QSG_name' => FALSE ) |
|
| 68 | + 'id' => array('QSG_ID' => FALSE), |
|
| 69 | + 'name' => array('QSG_name' => FALSE) |
|
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | $this->_hidden_columns = array( |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | protected function _add_view_counts() { |
| 95 | - $this->_views['all']['count'] = $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
| 96 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_group' ) ) { |
|
| 97 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
| 95 | + $this->_views['all']['count'] = $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
| 96 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_group')) { |
|
| 97 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $system_group = $item->get('QSG_system'); |
| 108 | 108 | $has_questions_with_answers = $item->has_questions_with_answers(); |
| 109 | 109 | $lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
| 110 | - return $system_group > 0 || ( $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID() ) ? '<span class="' . $lock_icon . '"></span>' . sprintf( '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID() ) : sprintf( '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID() ); |
|
| 110 | + return $system_group > 0 || ($system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers) || ! EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID()) ? '<span class="'.$lock_icon.'"></span>'.sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) : sprintf('<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | public function column_id(EE_Question_Group $item) { |
| 119 | 119 | $content = $item->ID(); |
| 120 | - $content .= ' <span class="show-on-mobile-view-only">' .$item->name() . '</span>'; |
|
| 120 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
| 121 | 121 | return $content; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $actions = array(); |
| 128 | 128 | |
| 129 | 129 | //return $item->name(); |
| 130 | - if ( !defined('REG_ADMIN_URL') ) |
|
| 130 | + if ( ! defined('REG_ADMIN_URL')) |
|
| 131 | 131 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
| 132 | 132 | |
| 133 | 133 | $edit_query_args = array( |
@@ -152,32 +152,32 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | |
| 155 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL ); |
|
| 156 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL ); |
|
| 157 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL ); |
|
| 158 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL ); |
|
| 155 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
| 156 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
| 157 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
| 158 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
| 159 | 159 | |
| 160 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ) { |
|
| 160 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID())) { |
|
| 161 | 161 | $actions = array( |
| 162 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Question Group', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
| 162 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Question Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | - if ( $item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID() ) ) { |
|
| 166 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__('Delete Question Group', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
| 165 | + if ($item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID())) { |
|
| 166 | + $actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__('Delete Question Group', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if ( $this->_view == 'trash' ) { |
|
| 169 | + if ($this->_view == 'trash') { |
|
| 170 | 170 | |
| 171 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID() ) ) { |
|
| 172 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__('Restore Question Group', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>'; |
|
| 171 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID())) { |
|
| 172 | + $actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__('Restore Question Group', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( !$item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID() ) ) { |
|
| 176 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
| 175 | + if ( ! $item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID())) { |
|
| 176 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Question Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name(); |
|
| 180 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name(); |
|
| 181 | 181 | $content .= $this->row_actions($actions); |
| 182 | 182 | return $content; |
| 183 | 183 | } |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | public function column_show_group_name(EE_Question_Group $item) { |
| 201 | - return $this->_yes_no[ $item->show_group_name() ]; |
|
| 201 | + return $this->_yes_no[$item->show_group_name()]; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | public function column_show_group_desc(EE_Question_Group $item) { |
| 207 | - return $this->_yes_no[ $item->show_group_desc() ]; |
|
| 207 | + return $this->_yes_no[$item->show_group_desc()]; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -142,8 +143,9 @@ discard block |
||
| 142 | 143 | if ( !empty( $question_groups ) ) { |
| 143 | 144 | foreach ( $question_groups as $id => $val ) { |
| 144 | 145 | //add to event |
| 145 | - if ( $val ) |
|
| 146 | - $qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) ); |
|
| 146 | + if ( $val ) { |
|
| 147 | + $qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) ); |
|
| 148 | + } |
|
| 147 | 149 | $success[] = !empty($qg) ? 1 : 0; |
| 148 | 150 | } |
| 149 | 151 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks { |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
| 33 | + public function __construct(EE_Admin_Page $admin_page) { |
|
| 34 | 34 | parent::__construct($admin_page); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -54,31 +54,31 @@ discard block |
||
| 54 | 54 | ) |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - $this->_metaboxes = array_merge( $this->_metaboxes, $new_metaboxes); |
|
| 57 | + $this->_metaboxes = array_merge($this->_metaboxes, $new_metaboxes); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - public function modify_callbacks( $callbacks ) { |
|
| 64 | - $callbacks = parent::modify_callbacks( $callbacks ); |
|
| 65 | - $callbacks[] = array( $this, 'additional_question_group_update' ); |
|
| 63 | + public function modify_callbacks($callbacks) { |
|
| 64 | + $callbacks = parent::modify_callbacks($callbacks); |
|
| 65 | + $callbacks[] = array($this, 'additional_question_group_update'); |
|
| 66 | 66 | return $callbacks; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | - public function restore_revision( $post_id, $revision_id ) { |
|
| 72 | - $post_evt = parent::restore_revision( $post_id, $revision_id ); |
|
| 71 | + public function restore_revision($post_id, $revision_id) { |
|
| 72 | + $post_evt = parent::restore_revision($post_id, $revision_id); |
|
| 73 | 73 | |
| 74 | 74 | //restore revision for additional questions |
| 75 | - $post_evt->restore_revision( $revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
| 75 | + $post_evt->restore_revision($revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 0))); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | - public function additional_questions( $post_id, $post ) { |
|
| 81 | + public function additional_questions($post_id, $post) { |
|
| 82 | 82 | $this->_event = $this->_adminpage_obj->get_event_object(); |
| 83 | 83 | $event_id = $this->_event->ID(); |
| 84 | 84 | ?> |
@@ -95,32 +95,32 @@ discard block |
||
| 95 | 95 | <?php |
| 96 | 96 | |
| 97 | 97 | $qsg_where['QSG_deleted'] = FALSE; |
| 98 | - $query_params = array( $qsg_where, 'order_by' => array( 'QSG_order' => 'ASC' ) ); |
|
| 99 | - $QSGs = EEM_Question_Group::instance()->get_all( $query_params ); |
|
| 100 | - $EQGs = !empty( $event_id ) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0 )) ) : array(); |
|
| 98 | + $query_params = array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')); |
|
| 99 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
| 100 | + $EQGs = ! empty($event_id) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))) : array(); |
|
| 101 | 101 | $EQGids = array_keys($EQGs); |
| 102 | 102 | |
| 103 | - if ( ! empty( $QSGs )) { |
|
| 104 | - $html = count( $QSGs ) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
| 105 | - foreach ( $QSGs as $QSG ) { |
|
| 103 | + if ( ! empty($QSGs)) { |
|
| 104 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
| 105 | + foreach ($QSGs as $QSG) { |
|
| 106 | 106 | |
| 107 | - $checked = in_array( $QSG->ID(), $EQGids ) ? ' checked="checked" ' : ''; |
|
| 108 | - $edit_link = $this->_adminpage_obj->add_query_args_and_nonce( array( 'action' => 'edit_question_group', 'QSG_ID' => $QSG->ID() ), EE_FORMS_ADMIN_URL ); |
|
| 107 | + $checked = in_array($QSG->ID(), $EQGids) ? ' checked="checked" ' : ''; |
|
| 108 | + $edit_link = $this->_adminpage_obj->add_query_args_and_nonce(array('action' => 'edit_question_group', 'QSG_ID' => $QSG->ID()), EE_FORMS_ADMIN_URL); |
|
| 109 | 109 | |
| 110 | 110 | $html .= ' |
| 111 | - <p id="event-question-group-' . $QSG->ID() . '"> |
|
| 112 | - <input value="' . $QSG->ID() . '" type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
| 113 | - <a href="' . $edit_link . '" title="' . sprintf( esc_attr__( 'Edit %s Group', 'event_espresso' ), $QSG->get('QSG_name') ) . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
| 111 | + <p id="event-question-group-' . $QSG->ID().'"> |
|
| 112 | + <input value="' . $QSG->ID().'" type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' /> |
|
| 113 | + <a href="' . $edit_link.'" title="'.sprintf(esc_attr__('Edit %s Group', 'event_espresso'), $QSG->get('QSG_name')).'" target="_blank">'.$QSG->get('QSG_name').'</a> |
|
| 114 | 114 | </p>'; |
| 115 | 115 | } |
| 116 | - $html .= count( $QSGs ) > 10 ? '</div>' : ''; |
|
| 116 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
| 117 | 117 | |
| 118 | 118 | echo $html; |
| 119 | 119 | |
| 120 | 120 | } else { |
| 121 | 121 | echo __('There seems to be a problem with your questions. Please contact [email protected]', 'event_espresso'); |
| 122 | 122 | } |
| 123 | - do_action( 'AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content' ); |
|
| 123 | + do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
| 124 | 124 | ?> |
| 125 | 125 | </div> |
| 126 | 126 | <?php |
@@ -130,31 +130,31 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | |
| 133 | - public function additional_question_group_update( $evtobj, $data ) { |
|
| 134 | - $question_groups = !empty( $data['add_attendee_question_groups'] ) ? (array) $data['add_attendee_question_groups'] : array(); |
|
| 133 | + public function additional_question_group_update($evtobj, $data) { |
|
| 134 | + $question_groups = ! empty($data['add_attendee_question_groups']) ? (array) $data['add_attendee_question_groups'] : array(); |
|
| 135 | 135 | $added_qgs = array_keys($question_groups); |
| 136 | 136 | $success = array(); |
| 137 | 137 | |
| 138 | 138 | //let's get all current question groups associated with this event. |
| 139 | - $current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0) ) ); |
|
| 139 | + $current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
| 140 | 140 | $current_qgs = array_keys($current_qgs); //we just want the ids |
| 141 | 141 | |
| 142 | 142 | //now let's get the groups selected in the editor and update (IF we have data) |
| 143 | - if ( !empty( $question_groups ) ) { |
|
| 144 | - foreach ( $question_groups as $id => $val ) { |
|
| 143 | + if ( ! empty($question_groups)) { |
|
| 144 | + foreach ($question_groups as $id => $val) { |
|
| 145 | 145 | //add to event |
| 146 | - if ( $val ) |
|
| 147 | - $qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) ); |
|
| 148 | - $success[] = !empty($qg) ? 1 : 0; |
|
| 146 | + if ($val) |
|
| 147 | + $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0)); |
|
| 148 | + $success[] = ! empty($qg) ? 1 : 0; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | //wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
| 153 | - $removed_qgs = array_diff( $current_qgs, $added_qgs ); |
|
| 153 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
| 154 | 154 | |
| 155 | - foreach ( $removed_qgs as $qgid ) { |
|
| 156 | - $qg = $evtobj->_remove_relation_to( $qgid, 'Question_Group', array('EQG_primary' => 0 ) ); |
|
| 157 | - $success[] = !empty($qg) ? 1 : 0; |
|
| 155 | + foreach ($removed_qgs as $qgid) { |
|
| 156 | + $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0)); |
|
| 157 | + $success[] = ! empty($qg) ? 1 : 0; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -116,42 +116,42 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | protected function _start() { |
| 119 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
| 120 | - $content .= '<p>' . __('This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>'; |
|
| 119 | + $content = '<h3>'.__('Questions Overview', 'event_espresso').'</h3>'; |
|
| 120 | + $content .= '<p>'.__('This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>'; |
|
| 121 | 121 | |
| 122 | 122 | return $content; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | protected function _display_text_stop() { |
| 126 | - return '<p>' . __('View available questions. You can reorder your questions by dragging and dropping them.', 'event_espresso') . '</p>'; |
|
| 126 | + return '<p>'.__('View available questions. You can reorder your questions by dragging and dropping them.', 'event_espresso').'</p>'; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | protected function _admin_label_stop() { |
| 130 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
| 130 | + return '<p>'.__('View the admin label for your questions.', 'event_espresso').'</p>'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | protected function _type_stop() { |
| 134 | - return '<p>' . __('View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso') . '</p>'; |
|
| 134 | + return '<p>'.__('View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso').'</p>'; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | protected function _values_stop() { |
| 138 | - return '<p>' . __('View stored values for checkboxes, radio buttons, and select boxes.', 'event_espresso') . '</p>'; |
|
| 138 | + return '<p>'.__('View stored values for checkboxes, radio buttons, and select boxes.', 'event_espresso').'</p>'; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | protected function _required_stop() { |
| 142 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
| 142 | + return '<p>'.__('View if a question is required.', 'event_espresso').'</p>'; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | protected function _bulk_actions_stop() { |
| 146 | - return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
|
| 146 | + return '<p>'.__('Perform bulk actions to multiple questions.', 'event_espresso').'</p>'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | protected function _search_stop() { |
| 150 | - return '<p>' . __('Search through questions. The following sources will be searched: Name of Question (display text).', 'event_espresso') . '</p>'; |
|
| 150 | + return '<p>'.__('Search through questions. The following sources will be searched: Name of Question (display text).', 'event_espresso').'</p>'; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | protected function _add_new_question_stop() { |
| 154 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
| 154 | + return '<p>'.__('Click here to add a new question.', 'event_espresso').'</p>'; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | } |
| 158 | 158 | \ No newline at end of file |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |