@@ -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 | * |
@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | //required variables for template: |
| 3 | 3 | assert($question_group instanceof EE_Question_Group); |
| 4 | -assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));//list of unused questions |
|
| 5 | -foreach($all_questions as $question_option){ |
|
| 4 | +assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); //list of unused questions |
|
| 5 | +foreach ($all_questions as $question_option) { |
|
| 6 | 6 | assert($question_option); |
| 7 | 7 | assert($question_option instanceof EE_Question); |
| 8 | 8 | } |
| 9 | 9 | ?> |
| 10 | -<h4><?php _e('Check off all questions that you wish to appear in this group.','event_espresso');?></h4> |
|
| 10 | +<h4><?php _e('Check off all questions that you wish to appear in this group.', 'event_espresso'); ?></h4> |
|
| 11 | 11 | <ul> |
| 12 | 12 | <?php |
| 13 | - foreach( $all_questions as $question_ID=>$question ){ |
|
| 13 | + foreach ($all_questions as $question_ID=>$question) { |
|
| 14 | 14 | /*@var $question EE_Question*/ |
| 15 | - $checked = array_key_exists( $question_ID, $question_group->questions() ) ? ' checked="checked"' : ''; |
|
| 15 | + $checked = array_key_exists($question_ID, $question_group->questions()) ? ' checked="checked"' : ''; |
|
| 16 | 16 | ?> |
| 17 | 17 | <li> |
| 18 | 18 | <label for="question-<?php echo $question_ID?>"> |
| 19 | - <input type="checkbox" name="questions[<?php echo $question_ID;?>]" id="question-<?php echo $question_ID;?>" value="<?php echo $question_ID;?>"<?php echo $checked;?>/> |
|
| 19 | + <input type="checkbox" name="questions[<?php echo $question_ID; ?>]" id="question-<?php echo $question_ID; ?>" value="<?php echo $question_ID; ?>"<?php echo $checked; ?>/> |
|
| 20 | 20 | <?php echo $question->display_text()?> |
| 21 | 21 | </label> |
| 22 | 22 | </li> |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <div class="padding"> |
| 2 | - <?php do_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template' ); ?> |
|
| 2 | + <?php do_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template'); ?> |
|
| 3 | 3 | </div> |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -123,8 +125,9 @@ discard block |
||
| 123 | 125 | } |
| 124 | 126 | |
| 125 | 127 | //if no reg id then get out cause need a reg id |
| 126 | - if ( empty( $REG_ID ) || empty( $DTT_ID ) ) |
|
| 127 | - throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso') ); |
|
| 128 | + if ( empty( $REG_ID ) || empty( $DTT_ID ) ) { |
|
| 129 | + throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso') ); |
|
| 130 | + } |
|
| 128 | 131 | |
| 129 | 132 | //set orderby |
| 130 | 133 | $orderby = 'CHK_timestamp'; //note that with this table we're only providing the option to orderby the timestamp value. |
@@ -147,8 +150,9 @@ discard block |
||
| 147 | 150 | $query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit ); |
| 148 | 151 | |
| 149 | 152 | //if no per_page value then we just want to return a count of all Check-ins |
| 150 | - if ( $count ) |
|
| 151 | - return EEM_Checkin::instance()->count( array( $_where ) ); |
|
| 153 | + if ( $count ) { |
|
| 154 | + return EEM_Checkin::instance()->count( array( $_where ) ); |
|
| 155 | + } |
|
| 152 | 156 | |
| 153 | 157 | return $count ? EEM_Checkin::instance()->count( array( $_where ) ) : EEM_Checkin::instance()->get_all($query_params); |
| 154 | 158 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - public function __construct( $admin_page ) { |
|
| 31 | + public function __construct($admin_page) { |
|
| 32 | 32 | parent::__construct($admin_page); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | protected function _setup_data() { |
| 39 | - $this->_data = $this->_get_checkins( $this->_per_page ); |
|
| 40 | - $this->_all_data_count = $this->_get_checkins( $this->_per_page, TRUE ); |
|
| 39 | + $this->_data = $this->_get_checkins($this->_per_page); |
|
| 40 | + $this->_all_data_count = $this->_get_checkins($this->_per_page, TRUE); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | 60 | $this->_sortable_columns = array( |
| 61 | - 'CHK_timestamp' => array( 'CHK_timestamp' => TRUE ) |
|
| 61 | + 'CHK_timestamp' => array('CHK_timestamp' => TRUE) |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | $this->_primary_column = 'CHK_in'; |
@@ -82,25 +82,25 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| 85 | - function column_cb($item ) { |
|
| 86 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" />', $item->ID() ); |
|
| 85 | + function column_cb($item) { |
|
| 86 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', $item->ID()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | - function column_CHK_in( EE_Checkin $item ) { |
|
| 90 | + function column_CHK_in(EE_Checkin $item) { |
|
| 91 | 91 | $checkinstatus = $item->get('CHK_in'); |
| 92 | 92 | $checkinstatus = $checkinstatus ? EE_Registration::checkin_status_in : EE_Registration::checkin_status_out; |
| 93 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . '"></span><span class="show-on-mobile-view-only">' . $item->get_datetime('CHK_timestamp') . '</span>'; |
|
| 93 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.'"></span><span class="show-on-mobile-view-only">'.$item->get_datetime('CHK_timestamp').'</span>'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | |
| 98 | - function column_CHK_timestamp( EE_Checkin $item ) { |
|
| 98 | + function column_CHK_timestamp(EE_Checkin $item) { |
|
| 99 | 99 | $actions = array(); |
| 100 | - $delete_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'delete_checkin_row', 'DTT_ID' => $this->_req_data['DTT_ID'], '_REGID' => $this->_req_data['_REGID'], 'CHK_ID' => $item->ID() ) ); |
|
| 101 | - $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_checkins', 'espresso_registrations_delete_checkin_row' ) ? '<a href="' . $delete_url . '" title="' . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>' : ''; |
|
| 100 | + $delete_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_checkin_row', 'DTT_ID' => $this->_req_data['DTT_ID'], '_REGID' => $this->_req_data['_REGID'], 'CHK_ID' => $item->ID())); |
|
| 101 | + $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can('ee_delete_checkins', 'espresso_registrations_delete_checkin_row') ? '<a href="'.$delete_url.'" title="'.esc_attr__('Click here to delete this check-in record', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>' : ''; |
|
| 102 | 102 | |
| 103 | - return sprintf( '%1$s %2$s', $item->get_datetime('CHK_timestamp'), $this->row_actions($actions) ); |
|
| 103 | + return sprintf('%1$s %2$s', $item->get_datetime('CHK_timestamp'), $this->row_actions($actions)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -115,30 +115,30 @@ discard block |
||
| 115 | 115 | * @param bool $count Whether to return a count or not |
| 116 | 116 | * @return EE_Checkin[]|int |
| 117 | 117 | */ |
| 118 | - protected function _get_checkins( $per_page = 10, $count = FALSE ) { |
|
| 119 | - $REG_ID = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : FALSE; |
|
| 120 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : FALSE; |
|
| 118 | + protected function _get_checkins($per_page = 10, $count = FALSE) { |
|
| 119 | + $REG_ID = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : FALSE; |
|
| 120 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : FALSE; |
|
| 121 | 121 | |
| 122 | 122 | //if user does not have the capability for the checkins for this registration then get out! |
| 123 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $REG_ID ) ) { |
|
| 123 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $REG_ID)) { |
|
| 124 | 124 | return $count ? 0 : array(); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //if no reg id then get out cause need a reg id |
| 128 | - if ( empty( $REG_ID ) || empty( $DTT_ID ) ) |
|
| 129 | - throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso') ); |
|
| 128 | + if (empty($REG_ID) || empty($DTT_ID)) |
|
| 129 | + throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso')); |
|
| 130 | 130 | |
| 131 | 131 | //set orderby |
| 132 | 132 | $orderby = 'CHK_timestamp'; //note that with this table we're only providing the option to orderby the timestamp value. |
| 133 | 133 | |
| 134 | - $order = !empty( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'ASC'; |
|
| 134 | + $order = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
| 135 | 135 | |
| 136 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
| 137 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
| 136 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
| 137 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
| 138 | 138 | $limit = NULL; |
| 139 | - if ( !$count ) { |
|
| 140 | - $offset = ($current_page-1)*$per_page; |
|
| 141 | - $limit = array( $offset, $per_page ); |
|
| 139 | + if ( ! $count) { |
|
| 140 | + $offset = ($current_page - 1) * $per_page; |
|
| 141 | + $limit = array($offset, $per_page); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $_where = array( |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | 'DTT_ID' => $DTT_ID |
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | - $query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit ); |
|
| 149 | + $query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit); |
|
| 150 | 150 | |
| 151 | 151 | //if no per_page value then we just want to return a count of all Check-ins |
| 152 | - if ( $count ) |
|
| 153 | - return EEM_Checkin::instance()->count( array( $_where ) ); |
|
| 152 | + if ($count) |
|
| 153 | + return EEM_Checkin::instance()->count(array($_where)); |
|
| 154 | 154 | |
| 155 | - return $count ? EEM_Checkin::instance()->count( array( $_where ) ) : EEM_Checkin::instance()->get_all($query_params); |
|
| 155 | + return $count ? EEM_Checkin::instance()->count(array($_where)) : EEM_Checkin::instance()->get_all($query_params); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | } //end class EE_Registration_CheckIn_List_Table |
@@ -31,20 +31,20 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * REG_date |
| 33 | 33 | */ |
| 34 | - function column_REG_date(EE_Registration $item){ |
|
| 34 | + function column_REG_date(EE_Registration $item) { |
|
| 35 | 35 | |
| 36 | 36 | //Build row actions |
| 37 | 37 | $actions = array(); |
| 38 | 38 | |
| 39 | 39 | //Build row actions |
| 40 | - $check_in_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
| 41 | - $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? ' |
|
| 42 | - <a href="'.$check_in_url.'" title="' . esc_attr__( 'The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso' ) . '">' . __( 'View Check-ins', 'event_espresso' ) . '</a>' : __( 'View Check-ins', 'event_espresso' ); |
|
| 40 | + $check_in_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
| 41 | + $actions['check_in'] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? ' |
|
| 42 | + <a href="'.$check_in_url.'" title="'.esc_attr__('The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso').'">'.__('View Check-ins', 'event_espresso').'</a>' : __('View Check-ins', 'event_espresso'); |
|
| 43 | 43 | |
| 44 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID() ), TXN_ADMIN_URL ); |
|
| 45 | - $REG_date = EE_Regisry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
| 44 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID()), TXN_ADMIN_URL); |
|
| 45 | + $REG_date = EE_Regisry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
| 46 | 46 | |
| 47 | - return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions) ); |
|
| 47 | + return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions)); |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * column_default |
| 56 | 56 | */ |
| 57 | - function column_DTT_EVT_start(EE_Registration $item){ |
|
| 57 | + function column_DTT_EVT_start(EE_Registration $item) { |
|
| 58 | 58 | $datetime_strings = array(); |
| 59 | 59 | $remove_defaults = array('default_where_conditions' => 'none'); |
| 60 | 60 | $ticket = $item->ticket(); |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | 'action'=>'event_registrations', |
| 64 | 64 | 'event_id'=>$item->event_ID() |
| 65 | 65 | ); |
| 66 | - foreach($datetimes as $datetime){ |
|
| 66 | + foreach ($datetimes as $datetime) { |
|
| 67 | 67 | $query_args['DTT_ID'] = $datetime->ID(); |
| 68 | - $checkin_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, REG_ADMIN_URL ); |
|
| 69 | - $datetime_strings[] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? '<a href="' . $checkin_url . '" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $datetime->get_i18n_datetime( 'DTT_EVT_start' ) . '</a>' : $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
| 68 | + $checkin_url = EE_Admin_Page::add_query_args_and_nonce($query_args, REG_ADMIN_URL); |
|
| 69 | + $datetime_strings[] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? '<a href="'.$checkin_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$datetime->get_i18n_datetime('DTT_EVT_start').'</a>' : $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
| 70 | 70 | } |
| 71 | - return implode("<br />",$datetime_strings); |
|
| 71 | + return implode("<br />", $datetime_strings); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * REG_date |
| 33 | - */ |
|
| 33 | + */ |
|
| 34 | 34 | function column_REG_date(EE_Registration $item){ |
| 35 | 35 | |
| 36 | 36 | //Build row actions |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * column_default |
| 56 | - */ |
|
| 56 | + */ |
|
| 57 | 57 | function column_DTT_EVT_start(EE_Registration $item){ |
| 58 | 58 | $datetime_strings = array(); |
| 59 | 59 | $remove_defaults = array('default_where_conditions' => 'none'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $datetime_strings[] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? '<a href="' . $checkin_url . '" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $datetime->get_i18n_datetime( 'DTT_EVT_start' ) . '</a>' : $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
| 70 | 70 | } |
| 71 | 71 | return implode("<br />",$datetime_strings); |
| 72 | - } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | |
@@ -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 |
@@ -679,8 +680,9 @@ discard block |
||
| 679 | 680 | EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
| 680 | 681 | } |
| 681 | 682 | |
| 682 | - if ( defined('DOING_AJAX' ) ) |
|
| 683 | - return $new_status; |
|
| 683 | + if ( defined('DOING_AJAX' ) ) { |
|
| 684 | + return $new_status; |
|
| 685 | + } |
|
| 684 | 686 | |
| 685 | 687 | $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
| 686 | 688 | |
@@ -918,7 +920,7 @@ discard block |
||
| 918 | 920 | $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
| 919 | 921 | if($count){ |
| 920 | 922 | $registrations = EEM_Registration::instance()->count(array($query_params[0])); |
| 921 | - }else{ |
|
| 923 | + } else{ |
|
| 922 | 924 | $registrations = EEM_Registration::instance()->get_all($query_params); |
| 923 | 925 | |
| 924 | 926 | |
@@ -631,8 +631,6 @@ |
||
| 631 | 631 | /** |
| 632 | 632 | * handles toggleing the checkin status for the registration, |
| 633 | 633 | * @access protected |
| 634 | - * @param boolean $check_in |
|
| 635 | - * @return void |
|
| 636 | 634 | */ |
| 637 | 635 | protected function _toggle_checkin_status() { |
| 638 | 636 | //first let's get the query args out of the way for the redirect |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | /** |
| 455 | 455 | * generates Business Reports regarding Registrations |
| 456 | - * @access protected |
|
| 457 | - * @return void |
|
| 458 | - */ |
|
| 456 | + * @access protected |
|
| 457 | + * @return void |
|
| 458 | + */ |
|
| 459 | 459 | protected function _registration_reports() { |
| 460 | 460 | $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
| 461 | 461 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true ); |
@@ -630,10 +630,10 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | /** |
| 632 | 632 | * handles toggleing the checkin status for the registration, |
| 633 | - * @access protected |
|
| 634 | - * @param boolean $check_in |
|
| 635 | - * @return void |
|
| 636 | - */ |
|
| 633 | + * @access protected |
|
| 634 | + * @param boolean $check_in |
|
| 635 | + * @return void |
|
| 636 | + */ |
|
| 637 | 637 | protected function _toggle_checkin_status() { |
| 638 | 638 | //first let's get the query args out of the way for the redirect |
| 639 | 639 | $query_args = array( |
@@ -754,9 +754,9 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | /** |
| 756 | 756 | * generates HTML for the Event Registrations List Table |
| 757 | - * @access protected |
|
| 758 | - * @return void |
|
| 759 | - */ |
|
| 757 | + * @access protected |
|
| 758 | + * @return void |
|
| 759 | + */ |
|
| 760 | 760 | protected function _event_registrations_list_table() { |
| 761 | 761 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
| 762 | 762 | $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
@@ -786,11 +786,11 @@ discard block |
||
| 786 | 786 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
| 787 | 787 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
| 788 | 788 | ), |
| 789 | - 'cancelled_status' => array( |
|
| 789 | + 'cancelled_status' => array( |
|
| 790 | 790 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
| 791 | 791 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
| 792 | 792 | ), |
| 793 | - 'declined_status' => array( |
|
| 793 | + 'declined_status' => array( |
|
| 794 | 794 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
| 795 | 795 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
| 796 | 796 | ), |
@@ -818,9 +818,9 @@ discard block |
||
| 818 | 818 | /** |
| 819 | 819 | * get_attendees |
| 820 | 820 | * @param bool $count whether to return count or data. |
| 821 | - * @access public |
|
| 822 | - * @return array |
|
| 823 | - */ |
|
| 821 | + * @access public |
|
| 822 | + * @return array |
|
| 823 | + */ |
|
| 824 | 824 | public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
| 825 | 825 | |
| 826 | 826 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -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 | /** |
@@ -37,20 +37,20 @@ discard block |
||
| 37 | 37 | protected $_reports_template_data = array(); |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - public function __construct( $routing = TRUE ) { |
|
| 41 | - parent::__construct( $routing ); |
|
| 42 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
| 43 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
| 44 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
| 40 | + public function __construct($routing = TRUE) { |
|
| 41 | + parent::__construct($routing); |
|
| 42 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
| 43 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
| 44 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | protected function _extend_page_config() { |
| 49 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
| 49 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
| 50 | 50 | |
| 51 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
| 52 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
|
| 53 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
| 51 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
| 52 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0; |
|
| 53 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
| 54 | 54 | |
| 55 | 55 | $new_page_routes = array( |
| 56 | 56 | 'reports' => array( |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | ) |
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
| 92 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
| 93 | 93 | |
| 94 | 94 | $new_page_config = array( |
| 95 | 95 | 'reports' => array( |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | 'filename' => 'registrations_event_checkin_other' |
| 135 | 135 | ) |
| 136 | 136 | ), |
| 137 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
| 138 | - 'qtips' => array('Registration_List_Table_Tips' ), |
|
| 137 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
| 138 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
| 139 | 139 | 'list_table' => 'EE_Event_Registrations_List_Table', |
| 140 | 140 | 'metaboxes' => array(), |
| 141 | 141 | 'require_nonce' => FALSE |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | ), |
| 154 | 154 | ); |
| 155 | 155 | |
| 156 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
| 156 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
| 157 | 157 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
| 158 | 158 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
| 159 | 159 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | protected function _ajax_hooks() { |
| 164 | 164 | parent::_ajax_hooks(); |
| 165 | - add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) ); |
|
| 165 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -172,20 +172,20 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | //if newsletter message type is active then let's add filter and load js for it. |
| 174 | 174 | EE_Registry::instance()->load_helper('MSG_Template'); |
| 175 | - if ( EEH_MSG_Template::is_mt_active('newsletter') ) { |
|
| 175 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
| 176 | 176 | //enqueue newsletter js |
| 177 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 178 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 177 | + wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 178 | + wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 179 | 179 | //hook in buttons for newsletter message type trigger. |
| 180 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); |
|
| 180 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | public function load_scripts_styles_reports() { |
| 187 | - wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true ); |
|
| 188 | - wp_enqueue_script( 'ee-reg-reports-js' ); |
|
| 187 | + wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true); |
|
| 188 | + wp_enqueue_script('ee-reg-reports-js'); |
|
| 189 | 189 | $this->_registration_reports_js_setup(); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | 'slug' => 'all', |
| 218 | 218 | 'label' => __('All', 'event_espresso'), |
| 219 | 219 | 'count' => 0, |
| 220 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array( |
|
| 220 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array( |
|
| 221 | 221 | 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
| 222 | 222 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
| 223 | 223 | ) |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | 'slug' => 'all', |
| 236 | 236 | 'label' => __('All', 'event_espresso'), |
| 237 | 237 | 'count' => 0, |
| 238 | - 'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) |
|
| 238 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) |
|
| 239 | 239 | ), |
| 240 | 240 | ); |
| 241 | 241 | } |
@@ -251,20 +251,20 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function get_newsletter_form_content() { |
| 253 | 253 | //do a nonce check cause we're not coming in from an normal route here. |
| 254 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : ''; |
|
| 254 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : ''; |
|
| 255 | 255 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
| 256 | 256 | |
| 257 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
| 257 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
| 258 | 258 | //let's get the mtp for the incoming MTP_ ID |
| 259 | - if ( !isset( $this->_req_data['GRP_ID'] ) ) { |
|
| 260 | - EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 259 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
| 260 | + EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 261 | 261 | $this->_template_args['success'] = FALSE; |
| 262 | 262 | $this->_template_args['error'] = TRUE; |
| 263 | 263 | $this->_return_json(); |
| 264 | 264 | } |
| 265 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
| 266 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
| 267 | - EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 265 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
| 266 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
| 267 | + EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); |
|
| 268 | 268 | $this->_template_args['success'] = FALSE; |
| 269 | 269 | $this->_template_args['error'] = TRUE; |
| 270 | 270 | $this->_return_json(); |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | $MTPs = $MTPG->context_templates(); |
| 274 | 274 | $MTPs = $MTPs['attendee']; |
| 275 | 275 | $template_fields = array(); |
| 276 | - foreach ( $MTPs as $MTP ) { |
|
| 276 | + foreach ($MTPs as $MTP) { |
|
| 277 | 277 | $field = $MTP->get('MTP_template_field'); |
| 278 | - if ( $field == 'content' ) { |
|
| 278 | + if ($field == 'content') { |
|
| 279 | 279 | $content = $MTP->get('MTP_content'); |
| 280 | - if ( !empty( $content['newsletter_content'] ) ) { |
|
| 280 | + if ( ! empty($content['newsletter_content'])) { |
|
| 281 | 281 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
| 282 | 282 | } |
| 283 | 283 | continue; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $this->_template_args['data'] = array( |
| 291 | 291 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '', |
| 292 | 292 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '', |
| 293 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : '' |
|
| 293 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : '' |
|
| 294 | 294 | ); |
| 295 | 295 | $this->_return_json(); |
| 296 | 296 | } |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | * @param EE_Admin_List_Table $list_table |
| 307 | 307 | * @return string html string for extra buttons |
| 308 | 308 | */ |
| 309 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
| 310 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { |
|
| 309 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
| 310 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { |
|
| 311 | 311 | return ''; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | 'event_registrations', |
| 317 | 317 | 'default' |
| 318 | 318 | ); |
| 319 | - if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
| 320 | - if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { |
|
| 319 | + if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
| 320 | + if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { |
|
| 321 | 321 | echo ''; |
| 322 | 322 | } else { |
| 323 | - $button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); |
|
| 324 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>'; |
|
| 325 | - add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); |
|
| 323 | + $button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); |
|
| 324 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>'; |
|
| 325 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | } |
@@ -334,38 +334,38 @@ discard block |
||
| 334 | 334 | $list_table = $this->_list_table_object; |
| 335 | 335 | $codes = array(); |
| 336 | 336 | //need to templates for the newsletter message type for the template selector. |
| 337 | - $values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); |
|
| 338 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) ); |
|
| 339 | - foreach ( $mtps as $mtp ) { |
|
| 337 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
| 338 | + $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); |
|
| 339 | + foreach ($mtps as $mtp) { |
|
| 340 | 340 | $name = $mtp->name(); |
| 341 | 341 | $values[] = array( |
| 342 | - 'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, |
|
| 342 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
| 343 | 343 | 'id' => $mtp->ID() |
| 344 | 344 | ); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | //need to get a list of shortcodes that are available for the newsletter message type. |
| 348 | 348 | EE_Registry::instance()->load_helper('MSG_Template'); |
| 349 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE ); |
|
| 350 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
| 351 | - $codes[$field] = implode(', ', array_keys($shortcode_array ) ); |
|
| 349 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); |
|
| 350 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
| 351 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | $shortcodes = $codes; |
| 355 | 355 | |
| 356 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
| 356 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
| 357 | 357 | $form_template_args = array( |
| 358 | 358 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
| 359 | 359 | 'form_route' => 'newsletter_selected_send', |
| 360 | 360 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
| 361 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
| 361 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
| 362 | 362 | 'redirect_back_to' => $this->_req_action, |
| 363 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'), |
|
| 364 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), |
|
| 363 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
| 364 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
| 365 | 365 | 'shortcodes' => $shortcodes, |
| 366 | 366 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration' |
| 367 | 367 | ); |
| 368 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
| 368 | + EEH_Template::display_template($form_template, $form_template_args); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | protected function _newsletter_selected_send() { |
| 381 | 381 | $success = TRUE; |
| 382 | 382 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
| 383 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
| 383 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
| 384 | 384 | EE_Error::add_error( |
| 385 | 385 | __( |
| 386 | 386 | 'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $success = FALSE; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ( $success ) { |
|
| 394 | + if ($success) { |
|
| 395 | 395 | //update Message template in case there are any changes |
| 396 | 396 | $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID( |
| 397 | 397 | $this->_req_data['newsletter_mtp_selected'] |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group |
| 400 | 400 | ? $Message_Template_Group->context_templates() |
| 401 | 401 | : array(); |
| 402 | - if ( empty( $Message_Templates ) ) { |
|
| 402 | + if (empty($Message_Templates)) { |
|
| 403 | 403 | EE_Error::add_error( |
| 404 | 404 | __( |
| 405 | 405 | 'Unable to retrieve message template fields from the db. Messages not sent.', |
@@ -410,25 +410,25 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | //let's just update the specific fields |
| 413 | - foreach ( $Message_Templates['attendee'] as $Message_Template ) { |
|
| 414 | - if ( $Message_Template instanceof EE_Message_Template ) { |
|
| 415 | - $field = $Message_Template->get( 'MTP_template_field' ); |
|
| 416 | - $content = $Message_Template->get( 'MTP_content' ); |
|
| 413 | + foreach ($Message_Templates['attendee'] as $Message_Template) { |
|
| 414 | + if ($Message_Template instanceof EE_Message_Template) { |
|
| 415 | + $field = $Message_Template->get('MTP_template_field'); |
|
| 416 | + $content = $Message_Template->get('MTP_content'); |
|
| 417 | 417 | $new_content = $content; |
| 418 | - switch ( $field ) { |
|
| 418 | + switch ($field) { |
|
| 419 | 419 | case 'from' : |
| 420 | - $new_content = ! empty( $this->_req_data['batch_message']['from'] ) |
|
| 420 | + $new_content = ! empty($this->_req_data['batch_message']['from']) |
|
| 421 | 421 | ? $this->_req_data['batch_message']['from'] |
| 422 | 422 | : $content; |
| 423 | 423 | break; |
| 424 | 424 | case 'subject' : |
| 425 | - $new_content = ! empty( $this->_req_data['batch_message']['subject'] ) |
|
| 425 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) |
|
| 426 | 426 | ? $this->_req_data['batch_message']['subject'] |
| 427 | 427 | : $content; |
| 428 | 428 | break; |
| 429 | 429 | case 'content' : |
| 430 | 430 | $new_content = $content; |
| 431 | - $new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] ) |
|
| 431 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) |
|
| 432 | 432 | ? $this->_req_data['batch_message']['content'] |
| 433 | 433 | : $content['newsletter_content']; |
| 434 | 434 | break; |
@@ -436,35 +436,35 @@ discard block |
||
| 436 | 436 | continue; |
| 437 | 437 | break; |
| 438 | 438 | } |
| 439 | - $Message_Template->set( 'MTP_content', $new_content ); |
|
| 439 | + $Message_Template->set('MTP_content', $new_content); |
|
| 440 | 440 | $Message_Template->save(); |
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
| 445 | - $id_type = ! empty( $this->_req_data['batch_message']['id_type'] ) |
|
| 445 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) |
|
| 446 | 446 | ? $this->_req_data['batch_message']['id_type'] |
| 447 | 447 | : 'registration'; |
| 448 | 448 | |
| 449 | 449 | //id_type will affect how we assemble the ids. |
| 450 | - $ids = ! empty( $this->_req_data['batch_message']['ids'] ) |
|
| 451 | - ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) |
|
| 450 | + $ids = ! empty($this->_req_data['batch_message']['ids']) |
|
| 451 | + ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) |
|
| 452 | 452 | : array(); |
| 453 | 453 | |
| 454 | 454 | $registrations_used_for_contact_data = array(); |
| 455 | 455 | //using switch because eventually we'll have other contexts that will be used for generating messages. |
| 456 | - switch ( $id_type ) { |
|
| 456 | + switch ($id_type) { |
|
| 457 | 457 | case 'registration' : |
| 458 | 458 | $registrations_used_for_contact_data = EEM_Registration::instance()->get_all( |
| 459 | 459 | array( |
| 460 | 460 | array( |
| 461 | - 'REG_ID' => array( 'IN', $ids ) |
|
| 461 | + 'REG_ID' => array('IN', $ids) |
|
| 462 | 462 | ) |
| 463 | 463 | ) |
| 464 | 464 | ); |
| 465 | 465 | break; |
| 466 | 466 | case 'contact' : |
| 467 | - $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids ); |
|
| 467 | + $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids); |
|
| 468 | 468 | break; |
| 469 | 469 | } |
| 470 | 470 | do_action( |
@@ -475,8 +475,8 @@ discard block |
||
| 475 | 475 | //kept for backward compat, internally we no longer use this action. |
| 476 | 476 | //@deprecated 4.8.36.rc.002 |
| 477 | 477 | $contacts = $id_type == 'registration' |
| 478 | - ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) |
|
| 479 | - : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); |
|
| 478 | + ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) |
|
| 479 | + : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
| 480 | 480 | do_action( |
| 481 | 481 | 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', |
| 482 | 482 | $contacts, |
@@ -484,11 +484,11 @@ discard block |
||
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | 486 | $query_args = array( |
| 487 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) |
|
| 487 | + 'action' => ! empty($this->_req_data['redirect_back_to']) |
|
| 488 | 488 | ? $this->_req_data['redirect_back_to'] |
| 489 | 489 | : 'default' |
| 490 | 490 | ); |
| 491 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
| 491 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | |
@@ -510,8 +510,8 @@ discard block |
||
| 510 | 510 | * @return void |
| 511 | 511 | */ |
| 512 | 512 | protected function _registration_reports() { |
| 513 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
| 514 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true ); |
|
| 513 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
| 514 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true); |
|
| 515 | 515 | // the final template wrapper |
| 516 | 516 | $this->display_admin_page_with_no_sidebar(); |
| 517 | 517 | |
@@ -524,29 +524,29 @@ discard block |
||
| 524 | 524 | * |
| 525 | 525 | * @return string |
| 526 | 526 | */ |
| 527 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
| 527 | + private function _registrations_per_day_report($period = '-1 month') { |
|
| 528 | 528 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
| 529 | 529 | |
| 530 | - $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period ); |
|
| 531 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 530 | + $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
| 531 | + EE_Registry::instance()->load_helper('Template'); |
|
| 532 | 532 | |
| 533 | 533 | $results = (array) $results; |
| 534 | 534 | $regs = array(); |
| 535 | 535 | $subtitle = ''; |
| 536 | 536 | |
| 537 | - if( $results ) { |
|
| 537 | + if ($results) { |
|
| 538 | 538 | $column_titles = array(); |
| 539 | 539 | $tracker = 0; |
| 540 | - foreach ( $results as $result ) { |
|
| 540 | + foreach ($results as $result) { |
|
| 541 | 541 | $report_column_values = array(); |
| 542 | - foreach( $result as $property_name => $property_value ) { |
|
| 542 | + foreach ($result as $property_name => $property_value) { |
|
| 543 | 543 | $property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value; |
| 544 | 544 | $report_column_values[] = $property_value; |
| 545 | - if ( $tracker === 0 ) { |
|
| 546 | - if ( $property_name == 'Registration_REG_date' ) { |
|
| 547 | - $column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' ); |
|
| 545 | + if ($tracker === 0) { |
|
| 546 | + if ($property_name == 'Registration_REG_date') { |
|
| 547 | + $column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso'); |
|
| 548 | 548 | } else { |
| 549 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
| 549 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | } |
@@ -555,37 +555,37 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | //make sure the column_titles is pushed to the beginning of the array |
| 558 | - array_unshift( $regs, $column_titles ); |
|
| 558 | + array_unshift($regs, $column_titles); |
|
| 559 | 559 | //setup the date range. |
| 560 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
| 561 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
| 562 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
| 563 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
| 560 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
| 561 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
| 562 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
| 563 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
| 564 | 564 | $subtitle = sprintf( |
| 565 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
| 566 | - $beginning_date->format( 'Y-m-d' ), |
|
| 567 | - $ending_date->format( 'Y-m-d' ) |
|
| 565 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
| 566 | + $beginning_date->format('Y-m-d'), |
|
| 567 | + $ending_date->format('Y-m-d') |
|
| 568 | 568 | ); |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
| 571 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
| 572 | 572 | |
| 573 | 573 | $report_params = array( |
| 574 | 574 | 'title' => $report_title, |
| 575 | 575 | 'subtitle' => $subtitle, |
| 576 | 576 | 'id' => $report_ID, |
| 577 | 577 | 'regs' => $regs, |
| 578 | - 'noResults' => empty( $regs ), |
|
| 578 | + 'noResults' => empty($regs), |
|
| 579 | 579 | 'noRegsMsg' => sprintf( |
| 580 | 580 | __( |
| 581 | 581 | '%sThere are currently no registration records in the last month for this report.%s', |
| 582 | 582 | 'event_espresso' |
| 583 | 583 | ), |
| 584 | - '<h2>' . $report_title . '</h2><p>', |
|
| 584 | + '<h2>'.$report_title.'</h2><p>', |
|
| 585 | 585 | '</p>' |
| 586 | 586 | ), |
| 587 | 587 | ); |
| 588 | - wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params ); |
|
| 588 | + wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
| 589 | 589 | |
| 590 | 590 | return $report_ID; |
| 591 | 591 | } |
@@ -597,30 +597,30 @@ discard block |
||
| 597 | 597 | * |
| 598 | 598 | * @return string |
| 599 | 599 | */ |
| 600 | - private function _registrations_per_event_report( $period = '-1 month' ) { |
|
| 600 | + private function _registrations_per_event_report($period = '-1 month') { |
|
| 601 | 601 | |
| 602 | 602 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
| 603 | 603 | |
| 604 | - $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period ); |
|
| 605 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 604 | + $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
| 605 | + EE_Registry::instance()->load_helper('Template'); |
|
| 606 | 606 | |
| 607 | 607 | $results = (array) $results; |
| 608 | 608 | $regs = array(); |
| 609 | 609 | $subtitle = ''; |
| 610 | 610 | |
| 611 | - if ( $results ) { |
|
| 611 | + if ($results) { |
|
| 612 | 612 | $column_titles = array(); |
| 613 | 613 | $tracker = 0; |
| 614 | - foreach ( $results as $result ) { |
|
| 614 | + foreach ($results as $result) { |
|
| 615 | 615 | $report_column_values = array(); |
| 616 | - foreach( $result as $property_name => $property_value ) { |
|
| 617 | - $property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value; |
|
| 616 | + foreach ($result as $property_name => $property_value) { |
|
| 617 | + $property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value; |
|
| 618 | 618 | $report_column_values[] = $property_value; |
| 619 | - if ( $tracker === 0 ) { |
|
| 620 | - if ( $property_name == 'Registration_Event' ) { |
|
| 621 | - $column_titles[] = __( 'Event', 'event_espresso' ); |
|
| 619 | + if ($tracker === 0) { |
|
| 620 | + if ($property_name == 'Registration_Event') { |
|
| 621 | + $column_titles[] = __('Event', 'event_espresso'); |
|
| 622 | 622 | } else { |
| 623 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
| 623 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -629,38 +629,38 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | //make sure the column_titles is pushed to the beginning of the array |
| 632 | - array_unshift( $regs, $column_titles ); |
|
| 632 | + array_unshift($regs, $column_titles); |
|
| 633 | 633 | |
| 634 | 634 | //setup the date range. |
| 635 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
| 636 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
| 637 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
| 638 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
| 635 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
| 636 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
| 637 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
| 638 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
| 639 | 639 | $subtitle = sprintf( |
| 640 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
| 641 | - $beginning_date->format( 'Y-m-d' ), |
|
| 642 | - $ending_date->format( 'Y-m-d' ) |
|
| 640 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
| 641 | + $beginning_date->format('Y-m-d'), |
|
| 642 | + $ending_date->format('Y-m-d') |
|
| 643 | 643 | ); |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
| 646 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
| 647 | 647 | |
| 648 | 648 | $report_params = array( |
| 649 | 649 | 'title' => $report_title, |
| 650 | 650 | 'subtitle' => $subtitle, |
| 651 | 651 | 'id' => $report_ID, |
| 652 | 652 | 'regs' => $regs, |
| 653 | - 'noResults' => empty( $regs ), |
|
| 653 | + 'noResults' => empty($regs), |
|
| 654 | 654 | 'noRegsMsg' => sprintf( |
| 655 | 655 | __( |
| 656 | 656 | '%sThere are currently no registration records in the last month for this report.%s', |
| 657 | 657 | 'event_espresso' |
| 658 | 658 | ), |
| 659 | - '<h2>' . $report_title . '</h2><p>', |
|
| 659 | + '<h2>'.$report_title.'</h2><p>', |
|
| 660 | 660 | '</p>' |
| 661 | 661 | ), |
| 662 | 662 | ); |
| 663 | - wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params ); |
|
| 663 | + wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
| 664 | 664 | |
| 665 | 665 | return $report_ID; |
| 666 | 666 | } |
@@ -674,8 +674,8 @@ discard block |
||
| 674 | 674 | * @return void |
| 675 | 675 | */ |
| 676 | 676 | protected function _registration_checkin_list_table() { |
| 677 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 678 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
| 677 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 678 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
| 679 | 679 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
| 680 | 680 | $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2'); |
| 681 | 681 | |
@@ -689,15 +689,15 @@ discard block |
||
| 689 | 689 | 'desc' => __('This indicates the attendee has been checked out', 'event_espresso') |
| 690 | 690 | ) |
| 691 | 691 | ); |
| 692 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
| 692 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
| 693 | 693 | |
| 694 | 694 | |
| 695 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
| 696 | - $go_back_url = !empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; |
|
| 695 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
| 696 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; |
|
| 697 | 697 | |
| 698 | - $this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; |
|
| 699 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
| 700 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
| 698 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; |
|
| 699 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
| 700 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
| 701 | 701 | |
| 702 | 702 | $this->display_admin_list_table_page_with_no_sidebar(); |
| 703 | 703 | } |
@@ -710,24 +710,24 @@ discard block |
||
| 710 | 710 | */ |
| 711 | 711 | public function toggle_checkin_status() { |
| 712 | 712 | //first make sure we have the necessary data |
| 713 | - if ( !isset( $this->_req_data['_regid'] ) ) { |
|
| 714 | - EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 713 | + if ( ! isset($this->_req_data['_regid'])) { |
|
| 714 | + EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 715 | 715 | $this->_template_args['success'] = FALSE; |
| 716 | 716 | $this->_template_args['error'] = TRUE; |
| 717 | 717 | $this->_return_json(); |
| 718 | 718 | }; |
| 719 | 719 | |
| 720 | 720 | //do a nonce check cause we're not coming in from an normal route here. |
| 721 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : ''; |
|
| 721 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : ''; |
|
| 722 | 722 | $nonce_ref = 'checkin_nonce'; |
| 723 | 723 | |
| 724 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
| 724 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
| 725 | 725 | |
| 726 | 726 | //beautiful! Made it this far so let's get the status. |
| 727 | 727 | $new_status = $this->_toggle_checkin_status(); |
| 728 | 728 | |
| 729 | 729 | //setup new class to return via ajax |
| 730 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status; |
|
| 730 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status; |
|
| 731 | 731 | $this->_template_args['success'] = TRUE; |
| 732 | 732 | $this->_return_json(); |
| 733 | 733 | } |
@@ -747,32 +747,32 @@ discard block |
||
| 747 | 747 | //first let's get the query args out of the way for the redirect |
| 748 | 748 | $query_args = array( |
| 749 | 749 | 'action' => 'event_registrations', |
| 750 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL, |
|
| 751 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL |
|
| 750 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL, |
|
| 751 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL |
|
| 752 | 752 | ); |
| 753 | 753 | $new_status = FALSE; |
| 754 | 754 | |
| 755 | 755 | // bulk action check in toggle |
| 756 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
| 756 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 757 | 757 | // cycle thru checkboxes |
| 758 | - while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
| 759 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
| 758 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 759 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
| 760 | 760 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
| 763 | + } elseif (isset($this->_req_data['_regid'])) { |
|
| 764 | 764 | //coming from ajax request |
| 765 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL; |
|
| 765 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL; |
|
| 766 | 766 | $query_args['DTT_ID'] = $DTT_ID; |
| 767 | 767 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
| 768 | 768 | } else { |
| 769 | - EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 769 | + EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - if ( defined('DOING_AJAX' ) ) |
|
| 772 | + if (defined('DOING_AJAX')) |
|
| 773 | 773 | return $new_status; |
| 774 | 774 | |
| 775 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
|
| 775 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
| 776 | 776 | |
| 777 | 777 | } |
| 778 | 778 | |
@@ -788,11 +788,11 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | private function _toggle_checkin($REG_ID, $DTT_ID) { |
| 790 | 790 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
| 791 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
| 792 | - if ( $new_status !== FALSE ) { |
|
| 793 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) ); |
|
| 791 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
| 792 | + if ($new_status !== FALSE) { |
|
| 793 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
| 794 | 794 | } else { |
| 795 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 795 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__); |
|
| 796 | 796 | $new_status = FALSE; |
| 797 | 797 | } |
| 798 | 798 | return $new_status; |
@@ -808,28 +808,28 @@ discard block |
||
| 808 | 808 | protected function _delete_checkin_rows() { |
| 809 | 809 | $query_args = array( |
| 810 | 810 | 'action' => 'registration_checkins', |
| 811 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
| 812 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
| 811 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
| 812 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
| 813 | 813 | ); |
| 814 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
| 815 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
| 814 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 815 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 816 | 816 | $errors = 0; |
| 817 | - if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { |
|
| 817 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
| 818 | 818 | $errors++; |
| 819 | 819 | } |
| 820 | 820 | } |
| 821 | 821 | } else { |
| 822 | - EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 823 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
| 822 | + EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 823 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | - if ( $errors > 0 ) { |
|
| 827 | - EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 826 | + if ($errors > 0) { |
|
| 827 | + EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); |
|
| 828 | 828 | } else { |
| 829 | - EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); |
|
| 829 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
| 832 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | |
@@ -841,20 +841,20 @@ discard block |
||
| 841 | 841 | protected function _delete_checkin_row() { |
| 842 | 842 | $query_args = array( |
| 843 | 843 | 'action' => 'registration_checkins', |
| 844 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
| 845 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
| 844 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
| 845 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
| 846 | 846 | ); |
| 847 | 847 | |
| 848 | - if ( !empty( $this->_req_data['CHK_ID'] ) ) { |
|
| 849 | - if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { |
|
| 850 | - EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 848 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
| 849 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
| 850 | + EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 851 | 851 | } else { |
| 852 | - EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); |
|
| 852 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
| 853 | 853 | } |
| 854 | 854 | } else { |
| 855 | - EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 855 | + EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 856 | 856 | } |
| 857 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
| 857 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | * @return void |
| 868 | 868 | */ |
| 869 | 869 | protected function _event_registrations_list_table() { |
| 870 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 871 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
| 870 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 871 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
| 872 | 872 | |
| 873 | 873 | $legend_items = array( |
| 874 | 874 | 'star-icon' => array( |
@@ -892,31 +892,31 @@ discard block |
||
| 892 | 892 | 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') |
| 893 | 893 | ), |
| 894 | 894 | 'approved_status' => array( |
| 895 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
| 896 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
| 895 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
| 896 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
| 897 | 897 | ), |
| 898 | 898 | 'cancelled_status' => array( |
| 899 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
| 900 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
| 899 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
| 900 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
| 901 | 901 | ), |
| 902 | 902 | 'declined_status' => array( |
| 903 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
| 904 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
| 903 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
| 904 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
| 905 | 905 | ), |
| 906 | 906 | 'not_approved' => array( |
| 907 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
| 908 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
| 907 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
| 908 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
| 909 | 909 | ), |
| 910 | 910 | 'pending_status' => array( |
| 911 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
| 912 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
| 911 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
| 912 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
| 913 | 913 | )/**/ |
| 914 | 914 | ); |
| 915 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
| 915 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
| 916 | 916 | |
| 917 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
| 918 | - $this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; |
|
| 919 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : ''; |
|
| 917 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
| 918 | + $this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; |
|
| 919 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : ''; |
|
| 920 | 920 | |
| 921 | 921 | $this->display_admin_list_table_page_with_no_sidebar(); |
| 922 | 922 | } |
@@ -930,15 +930,15 @@ discard block |
||
| 930 | 930 | * @access public |
| 931 | 931 | * @return array |
| 932 | 932 | */ |
| 933 | - public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
|
| 933 | + public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { |
|
| 934 | 934 | |
| 935 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 936 | - require_once(EE_MODELS . 'EEM_Attendee.model.php'); |
|
| 935 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 936 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
| 937 | 937 | //$ATT_MDL = EEM_Attendee::instance(); |
| 938 | 938 | |
| 939 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
| 940 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE; |
|
| 941 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
| 939 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
| 940 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE; |
|
| 941 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
| 942 | 942 | |
| 943 | 943 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
| 944 | 944 | |
@@ -951,94 +951,94 @@ discard block |
||
| 951 | 951 | // $orderby = 'reg.REG_final_price'; |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
| 954 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
| 955 | 955 | |
| 956 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
| 957 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
| 956 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
| 957 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
| 958 | 958 | |
| 959 | 959 | |
| 960 | - $offset = ($current_page-1)*$per_page; |
|
| 961 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
| 962 | - $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
| 963 | - if ($EVT_ID){ |
|
| 964 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
| 960 | + $offset = ($current_page - 1) * $per_page; |
|
| 961 | + $limit = $count ? NULL : array($offset, $per_page); |
|
| 962 | + $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
| 963 | + if ($EVT_ID) { |
|
| 964 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
| 965 | 965 | } |
| 966 | - if($CAT_ID){ |
|
| 966 | + if ($CAT_ID) { |
|
| 967 | 967 | throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | //if DTT is included we do multiple datetimes. |
| 971 | - if ( $DTT_ID ) { |
|
| 971 | + if ($DTT_ID) { |
|
| 972 | 972 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | //make sure we only have default where on the current regs |
| 976 | 976 | $query_params['default_where_conditions'] = 'this_model_only'; |
| 977 | 977 | |
| 978 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
| 978 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
| 979 | 979 | |
| 980 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
| 980 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
| 981 | 981 | |
| 982 | - if($trash){ |
|
| 983 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed; |
|
| 982 | + if ($trash) { |
|
| 983 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | - if ( isset( $this->_req_data['s'] ) ) { |
|
| 987 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
| 986 | + if (isset($this->_req_data['s'])) { |
|
| 987 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
| 988 | 988 | $query_params[0]['OR'] = array( |
| 989 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
| 990 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
| 991 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
| 992 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
| 993 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
| 994 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
| 995 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
| 996 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
| 997 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
| 998 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
| 999 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
| 1000 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
| 1001 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
| 1002 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
| 1003 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
| 1004 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
| 989 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
| 990 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
| 991 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
| 992 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
| 993 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
| 994 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
| 995 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
| 996 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
| 997 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
| 998 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
| 999 | + 'REG_final_price' => array('LIKE', $sstr), |
|
| 1000 | + 'REG_code' => array('LIKE', $sstr), |
|
| 1001 | + 'REG_count' => array('LIKE', $sstr), |
|
| 1002 | + 'REG_group_size' => array('LIKE', $sstr), |
|
| 1003 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
| 1004 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
| 1005 | 1005 | ); |
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | $query_params['order_by'][$orderby] = $sort; |
| 1009 | 1009 | $query_params['limit'] = $limit; |
| 1010 | - $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
| 1011 | - if($count){ |
|
| 1012 | - $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' )); |
|
| 1013 | - }else{ |
|
| 1010 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
| 1011 | + if ($count) { |
|
| 1012 | + $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only')); |
|
| 1013 | + } else { |
|
| 1014 | 1014 | $registrations = EEM_Registration::instance()->get_all($query_params); |
| 1015 | 1015 | |
| 1016 | 1016 | |
| 1017 | 1017 | // $registrations = EEM_Registration::instance(); |
| 1018 | 1018 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
| 1019 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
| 1019 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
| 1020 | 1020 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 1021 | 1021 | // name |
| 1022 | 1022 | $first_registration = $registrations[0]; |
| 1023 | 1023 | $event_obj = $first_registration->event_obj(); |
| 1024 | - if($event_obj){ |
|
| 1024 | + if ($event_obj) { |
|
| 1025 | 1025 | $event_name = $first_registration->event_obj()->name(); |
| 1026 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
| 1026 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
| 1027 | 1027 | // edit event link |
| 1028 | - if ( $event_name != '' ) { |
|
| 1029 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
| 1030 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
| 1031 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
| 1028 | + if ($event_name != '') { |
|
| 1029 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
| 1030 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
| 1031 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
| 1035 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
| 1034 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
| 1035 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
| 1036 | 1036 | |
| 1037 | 1037 | $this->_template_args['before_admin_page_content'] = ' |
| 1038 | 1038 | <div id="admin-page-header"> |
| 1039 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
| 1040 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
| 1041 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
| 1039 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
| 1040 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
| 1041 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
| 1042 | 1042 | </div> |
| 1043 | 1043 | '; |
| 1044 | 1044 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | <input type="hidden" id="get_newsletter_form_content_nonce" name="get_newsletter_form_content_nonce" value="<?php echo $ajax_nonce; ?>"> |
| 33 | 33 | <input type="hidden" name="batch_message[id_type]" value="<?php echo $id_type; ?>"> |
| 34 | 34 | <input id="newsletter-batch-ids" type="hidden" name="batch_message[ids]" value=""> |
| 35 | - <h3 class="newsletter-send-form-title"><?php printf( __('Sending batch message to %s people...', 'event_espresso'), '[NUMPEOPLE]' ); ?></h3> |
|
| 35 | + <h3 class="newsletter-send-form-title"><?php printf(__('Sending batch message to %s people...', 'event_espresso'), '[NUMPEOPLE]'); ?></h3> |
|
| 36 | 36 | <label for="batch-message-template-selector"><?php _e('Select Template:', 'event_espresso'); ?></label> |
| 37 | 37 | <?php echo $template_selector; ?> |
| 38 | 38 | <div class="batch-message-edit-fields" style="display:none;"> |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is the template for newsletter send form |
|
| 4 | - * |
|
| 5 | - * @since 4.3.0 |
|
| 6 | - * |
|
| 7 | - * @package Event Espresso |
|
| 8 | - * @subpackage Admin, Messages |
|
| 9 | - */ |
|
| 3 | + * This file is the template for newsletter send form |
|
| 4 | + * |
|
| 5 | + * @since 4.3.0 |
|
| 6 | + * |
|
| 7 | + * @package Event Espresso |
|
| 8 | + * @subpackage Admin, Messages |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Template args found in this template. |