public function column_display_text(EE_Question $item)
 {
     $system_question = $item->is_system_question();
     $actions = array();
     if (!defined('REG_ADMIN_URL')) {
         define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
     }
     $edit_query_args = array('action' => 'edit_question', 'QST_ID' => $item->ID());
     $trash_query_args = array('action' => 'trash_question', 'QST_ID' => $item->ID());
     $restore_query_args = array('action' => 'restore_question', 'QST_ID' => $item->ID());
     $delete_query_args = array('action' => 'delete_questions', 'QST_ID' => $item->ID());
     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
     $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
     $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
     $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
     if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID())) {
         $actions = array('edit' => '<a href="' . $edit_link . '" title="' . __('Edit Question', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>');
     }
     if (!$system_question && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_trash_question', $item->ID())) {
         $actions['delete'] = '<a href="' . $trash_link . '" title="' . __('Trash Question', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
     }
     if ($this->_view == 'trash') {
         if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_restore_question', $item->ID())) {
             $actions['restore'] = '<a href="' . $restore_link . '" title="' . __('Restore Question', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
         }
         if ($item->count_related('Answer') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_delete_questions', $item->ID())) {
             $actions['delete_permanently'] = '<a href="' . $delete_link . '" title="' . __('Delete Question Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
         }
     }
     $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID()) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' : $item->display_text();
     $content .= $this->row_actions($actions);
     return $content;
 }
 public function column_display_text(EE_Question $item)
 {
     $system_question = $item->is_system_question();
     if (!defined('REG_ADMIN_URL')) {
         define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
     }
     $edit_query_args = array('action' => 'edit_question', 'QST_ID' => $item->ID());
     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
     $actions = array('edit' => '<a href="' . $edit_link . '" title="' . __('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>');
     $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>';
     $content .= $this->row_actions($actions);
     return $content;
 }
 /**
  * @param EE_Registration $registration
  * @param EE_Question     $question
  * @param mixed EE_Answer|NULL      $answer
  * @return EE_Form_Input_Base
  */
 public function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer)
 {
     //		d( $registration );
     //		d( $question );
     //		d( $answer );
     // array of params to pass to parent constructor.
     // possible values:
     //		html_id;
     //		html_class;
     //		html_style;
     //		name;
     //		html_name;
     //		html_label_id;
     //		html_label_class;
     //		html_label_style;
     //		html_label_text;
     //		html_label;
     //		html_help_text;
     //		html_help_class = 'description';
     //		html_help_style;
     //		raw_value;
     $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
     $input_constructor_args = array('html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, 'required' => $question->required() ? TRUE : FALSE, 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, 'html_label_class' => 'ee-reg-qstn', 'html_label_text' => $question->display_text(), 'required_validation_error_message' => $question->required_text());
     // has this question been answered ?
     if ($answer instanceof EE_Answer) {
         if ($answer->ID()) {
             $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']';
             $input_constructor_args['html_id'] .= '-' . $answer->ID();
             $input_constructor_args['html_label_id'] .= '-' . $answer->ID();
         }
         $input_constructor_args['default'] = $answer->value();
     }
     //add "-lbl" to the end of the label id
     $input_constructor_args['html_label_id'] .= '-lbl';
     switch ($question->type()) {
         // Text
         case EEM_Question::QST_type_text:
             if ($identifier == 'email') {
                 return new EE_Email_Input($input_constructor_args);
             } else {
                 return new EE_Text_Input($input_constructor_args);
             }
             break;
             // Textarea
         // Textarea
         case EEM_Question::QST_type_textarea:
             return new EE_Text_Area_Input($input_constructor_args);
             break;
             // Radio Buttons
         // Radio Buttons
         case EEM_Question::QST_type_radio:
             return new EE_Radio_Button_Input($question->options(), $input_constructor_args);
             break;
             // Dropdown
         // Dropdown
         case EEM_Question::QST_type_dropdown:
             return new EE_Select_Input($question->options(), $input_constructor_args);
             break;
             // State Dropdown
         // State Dropdown
         case EEM_Question::QST_type_state:
             $state_options = array('' => array('' => ''));
             $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
             if (!empty($states)) {
                 foreach ($states as $state) {
                     if ($state instanceof EE_State) {
                         $state_options[$state->country()->name()][$state->ID()] = $state->name();
                     }
                 }
             }
             $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer);
             return new EE_State_Select_Input($state_options, $input_constructor_args);
             break;
             // Country Dropdown
         // Country Dropdown
         case EEM_Question::QST_type_country:
             $country_options = array('' => '');
             // get possibly cached list of countries
             $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
             if (!empty($countries)) {
                 foreach ($countries as $country) {
                     if ($country instanceof EE_Country) {
                         $country_options[$country->ID()] = $country->name();
                     }
                 }
             }
             $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer);
             return new EE_Country_Select_Input($country_options, $input_constructor_args);
             break;
             // Checkboxes
         // Checkboxes
         case EEM_Question::QST_type_checkbox:
             return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args);
             break;
             // Date
         // Date
         case EEM_Question::QST_type_date:
             return new EE_Datepicker_Input($input_constructor_args);
             break;
         case EEM_Question::QST_type_html_textarea:
             $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy();
             $input = new EE_Text_Area_Input($input_constructor_args);
             $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy');
             return $input;
             // fallback
         // fallback
         default:
             $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args);
             if (!$default_input) {
                 $default_input = new EE_Text_Input($input_constructor_args);
             }
             return $default_input;
     }
 }
 /**
  * @param EE_Registration $registration
  * @param EE_Question     $question
  * @param mixed EE_Answer|NULL      $answer
  * @return EE_Form_Input_Base
  */
 private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer)
 {
     $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
     $this->_required_questions[$identifier] = $question->required() ? true : false;
     add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4);
     add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4);
     $input_constructor_args = array('html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, 'html_label_class' => 'ee-reg-qstn');
     $input_constructor_args['html_label_id'] .= '-lbl';
     if ($answer instanceof EE_Answer && $answer->ID()) {
         $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']';
         $input_constructor_args['html_id'] .= '-' . $answer->ID();
         $input_constructor_args['html_label_id'] .= '-' . $answer->ID();
     }
     $form_input = $question->generate_form_input($registration, $answer, $input_constructor_args);
     remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'));
     remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'));
     return $form_input;
 }