/**
  * Metabox for person details
  * @param  WP_Post $post wp post object
  * @return string        person address details (and form)
  */
 public function person_address_details($post)
 {
     //get people object (should already have it)
     $this->_template_args['person'] = $this->_cpt_model_obj;
     $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => __('State/Province', 'event_espresso'), 'QST_system' => 'admin-state')), EE_Answer::new_instance(array('ANS_ID' => 0, 'ANS_value' => $this->_cpt_model_obj->state_ID())), array('input_id' => 'STA_ID', 'input_name' => 'STA_ID', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => __('Country', 'event_espresso'), 'QST_system' => 'admin-country')), EE_Answer::new_instance(array('ANS_ID' => 0, 'ANS_value' => $this->_cpt_model_obj->country_ID())), array('input_id' => 'CNT_ISO', 'input_name' => 'CNT_ISO', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template = EEA_PEOPLE_ADDON_ADMIN_TEMPLATE_PATH . 'people_address_details_metabox_content.template.php';
     EEH_Template::display_template($template, $this->_template_args);
 }
 protected function _country_settings()
 {
     $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
     $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
     //load field generator helper
     $this->_template_args['values'] = $this->_yes_no_values;
     $this->_template_args['countries'] = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => __('Select Country', 'event_espresso'), 'QST_system' => 'admin-country')), EE_Answer::new_instance(array('ANS_ID' => 0, 'ANS_value' => $CNT_ISO)), array('input_id' => 'country', 'input_name' => 'country', 'input_prefix' => '', 'append_qstn_id' => FALSE));
     //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
     add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
     $this->_template_args['country_details_settings'] = $this->display_country_settings();
     $this->_template_args['country_states_settings'] = $this->display_country_states();
     $this->_set_add_edit_form_tags('update_country_settings');
     $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
     $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE);
     $this->display_admin_page_with_no_sidebar();
 }
 /**
  * 	display_add_new_state_micro_form
  *
  * 	@access 	public
  * 	@return 		string
  */
 public static function display_add_new_state_micro_form($input_html, $question, $answer, $name, $id, $class, $system_ID)
 {
     // load JS
     add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10);
     $output = '';
     // we're only doing this for state select inputs
     if ($system_ID == 'state') {
         // add hidden input to indicate that a new state is being added
         $output .= EEH_Form_Fields::hidden_input(str_replace('state', 'add_new_state', $name), 0, str_replace('state', 'add_new_state', $id));
         $output .= '<a id="display-' . $id . '" class="ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js" rel="' . $id . '">' . __('click here to add a new state/province', 'event_espresso') . '</a>';
         $output .= '<div id="' . $id . '-dv" class="ee-form-add-new-state-dv" style="display: none;">';
         $output .= '<h6>' . __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso') . '</h6>';
         $output .= '<ul>';
         $output .= sprintf(__('%1$sfirst select the Country that your State/Province belongs to%2$s%1$senter the name of your State/Province%2$s%1$senter a two to six letter abbreviation for the name of your State/Province%2$s%1$sclick the ADD button%2$s', 'event_espresso'), '<li>', '</li>');
         $output .= '</ul>';
         // NEW STATE COUNTRY
         $cntry_id = str_replace('state', 'new_state_country', $id);
         $cntry_input = str_replace('state', 'new_state_country', $name);
         $country = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => __('New State/Province Country', 'event_espresso'), 'QST_system' => 'admin-country', 'QST_type' => EEM_Question::QST_type_dropdown, 'QST_required' => FALSE)), EE_Answer::new_instance(array('ANS_value' => EE_Registry::instance()->REQ->is_set($cntry_input) ? EE_Registry::instance()->REQ->get($cntry_input) : '')), array('input_name' => $cntry_input, 'input_id' => $cntry_id, 'input_class' => $class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
         $output .= EEH_Form_Fields::generate_form_input($country);
         // NEW STATE NAME
         $state_id = str_replace('state', 'new_state_name', $id);
         $state_name = str_replace('state', 'new_state_name', $name);
         $new_state_name = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => __('New State/Province Name', 'event_espresso'), 'QST_system' => '', 'QST_type' => EEM_Question::QST_type_text, 'QST_required' => FALSE)), EE_Answer::new_instance(array('ANS_value' => EE_Registry::instance()->REQ->is_set($state_name) ? EE_Registry::instance()->REQ->get($state_name) : '')), array('input_name' => $state_name, 'input_id' => $state_id, 'input_class' => $class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
         $output .= EEH_Form_Fields::generate_form_input($new_state_name);
         // NEW STATE ABBREVIATION
         $abbrv_id = str_replace('state', 'new_state_abbrv', $id);
         $abbrv_name = str_replace('state', 'new_state_abbrv', $name);
         $new_state_abbrv = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => __('New State/Province Abbreviation', 'event_espresso'), 'QST_system' => '', 'QST_type' => EEM_Question::QST_type_text, 'QST_required' => FALSE)), EE_Answer::new_instance(array('ANS_value' => EE_Registry::instance()->REQ->is_set($abbrv_name) ? EE_Registry::instance()->REQ->get($abbrv_name) : '')), array('input_name' => $abbrv_name, 'input_id' => $abbrv_id, 'input_class' => $class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
         // add filters for reducing size of State Abbrv text input, and adding an "ADD" button, as well as a "cancel" button
         add_filter('FHEE__EEH_Form_Fields__additional_form_field_attributes', array('EED_Add_New_State', 'set_new_state_input_size'));
         add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'add_new_state_submit_button'), 1, 3);
         add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'cancel_new_state'), 2, 3);
         $output .= EEH_Form_Fields::generate_form_input($new_state_abbrv);
         // remove the filters from above so that they don't affect any other inputs
         remove_filter('FHEE__EEH_Form_Fields__additional_form_field_attributes', array('EED_Add_New_State', 'set_new_state_input_size'));
         remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'add_new_state_submit_button'), 1, 3);
         remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Add_New_State', 'cancel_new_state'), 2, 3);
         $output .= '</div>';
     }
     return $input_html . $output;
 }
 public function venue_address_metabox()
 {
     $template_args['_venue'] = $this->_cpt_model_obj;
     $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), array('input_name' => 'sta_id', 'input_id' => 'sta_id', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), array('input_name' => 'cnt_iso', 'input_id' => 'cnt_iso', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
     EEH_Template::display_template($template, $template_args);
 }
 /**
  * Return an array of dummy question objects indexed by answer id and dummy answer objects indexed by answer id.  This will be used in our dummy data setup
  * @return array
  */
 private function _get_some_q_and_as()
 {
     $quests_array = array(0 => array(555, __('What is your favorite planet?', 'event_espresso'), 0), 1 => array(556, __('What is your favorite food?', 'event_espresso'), 0), 2 => array(557, __('How many lightyears have you travelled', 'event_espresso'), 0));
     $ans_array = array(0 => array(999, 555, 'Tattoine'), 1 => array(1000, 555, 'Alderaan'), 2 => array(1001, 555, 'Dantooine'), 3 => array(1002, 556, 'Fish Fingers'), 4 => array(1003, 556, 'Sushi'), 5 => array(1004, 556, 'Water'), 6 => array(1005, 557, 'A lot'), 7 => array(1006, 557, "That's none of your business."), 8 => array(1007, 557, "People less travel me then."));
     $qst_columns = array('QST_ID', 'QST_display_text', 'QST_system');
     $ans_columns = array('ANS_ID', 'QST_ID', 'ANS_value');
     EE_Registry::instance()->load_class('Question', array(), FALSE, TRUE, TRUE);
     EE_Registry::instance()->load_class('Answer', array(), FALSE, TRUE, TRUE);
     //first the questions
     foreach ($quests_array as $qst) {
         $qstobj = array_combine($qst_columns, $qst);
         $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj);
     }
     //now the answers (and we'll setup our arrays)
     $q_n_as = array();
     foreach ($ans_array as $ans) {
         $ansobj = array_combine($ans_columns, $ans);
         $ansobj = EE_Answer::new_instance($ansobj);
         $q_n_as['answers'][$ansobj->ID()] = $ansobj;
         $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')];
     }
     return $q_n_as;
 }
 /**
  *        generate_question_form_inputs_for_object
  *
  * @access    protected
  * @param bool|object $object $object
  * @param    array    $input_types
  * @return        array
  */
 static function generate_question_form_inputs_for_object($object = FALSE, $input_types = array())
 {
     if (!is_object($object)) {
         return FALSE;
     }
     $inputs = array();
     $fields = $object->get_model()->field_settings(FALSE);
     //		$pk = $object->ID(); <<< NO!
     //		printr( $object, get_class( $object ) . '<br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     //		printr( $fields, '$fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     //		printr( $input_types, '$input_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     foreach ($fields as $field_ID => $field) {
         if ($field instanceof EE_Model_Field_Base) {
             //			echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
             //			printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
             if (isset($input_types[$field_ID])) {
                 // get saved value for field
                 $value = $object->get($field_ID);
                 //				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                 // if no saved value, then use default
                 $value = $value !== NULL ? $value : $field->get_default_value();
                 //			if ( $field_ID == 'CNT_active' )
                 //				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
                 // determine question type
                 $type = isset($input_types[$field_ID]) ? $input_types[$field_ID]['type'] : 'TEXT';
                 // input name
                 $input_name = isset($input_types[$field_ID]) && isset($input_types[$field_ID]['input_name']) ? $input_types[$field_ID]['input_name'] . '[' . $field_ID . ']' : $field_ID;
                 // css class for input
                 $class = isset($input_types[$field_ID]['class']) && !empty($input_types[$field_ID]['class']) ? ' ' . $input_types[$field_ID]['class'] : '';
                 // whether to apply htmlentities to answer
                 $htmlentities = isset($input_types[$field_ID]['htmlentities']) ? $input_types[$field_ID]['htmlentities'] : TRUE;
                 // whether to apply htmlentities to answer
                 $label_b4 = isset($input_types[$field_ID]['label_b4']) ? $input_types[$field_ID]['label_b4'] : FALSE;
                 // whether to apply htmlentities to answer
                 $use_desc_4_label = isset($input_types[$field_ID]['use_desc_4_label']) ? $input_types[$field_ID]['use_desc_4_label'] : FALSE;
                 // create EE_Question_Form_Input object
                 $QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_ID' => 0, 'QST_display_text' => $field->get_nicename(), 'QST_type' => $type)), EE_Answer::new_instance(array('ANS_ID' => 0, 'QST_ID' => 0, 'REG_ID' => 0, 'ANS_value' => $value)), array('input_id' => $field_ID . '-' . $object->ID(), 'input_name' => $input_name, 'input_class' => $field_ID . $class, 'input_prefix' => '', 'append_qstn_id' => FALSE, 'htmlentities' => $htmlentities, 'label_b4' => $label_b4, 'use_desc_4_label' => $use_desc_4_label));
                 // does question type have options ?
                 if (in_array($type, array('DROPDOWN', 'SINGLE', 'MULTIPLE')) && isset($input_types[$field_ID]) && isset($input_types[$field_ID]['options'])) {
                     foreach ($input_types[$field_ID]['options'] as $option) {
                         $option = stripslashes_deep($option);
                         $option_id = !empty($option['id']) ? $option['id'] : 0;
                         $QSO = EE_Question_Option::new_instance(array('QSO_value' => (string) $option_id, 'QSO_desc' => $option['text'], 'QSO_deleted' => FALSE));
                         // all QST (and ANS) properties can be accessed indirectly thru QFI
                         $QFI->add_temp_option($QSO);
                     }
                 }
                 // we don't want ppl manually changing primary keys cuz that would just lead to total craziness man
                 if ($field_ID == $object->get_model()->primary_key_name()) {
                     $QFI->set('QST_disabled', TRUE);
                 }
                 //printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
                 $inputs[$field_ID] = $QFI;
                 //			if ( $field_ID == 'CNT_active' ) {
                 //				printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
                 //			}
             }
         }
     }
     return $inputs;
 }
 /**
  * @param string $action
  */
 protected function _edit_question($action = 'add')
 {
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     $ID = isset($this->_req_data['QST_ID']) && !empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE;
     $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
     // add PRC_ID to title if editing
     $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
     if ($ID) {
         $question = $this->_question_model->get_one_by_ID($ID);
         $additional_hidden_fields = array('QST_ID' => array('type' => 'hidden', 'value' => $ID));
         $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
     } else {
         $question = EE_Question::new_instance();
         $question->set_order_to_latest();
         $this->_set_add_edit_form_tags('insert_question');
     }
     $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types();
     $this->_template_args['QST_ID'] = $ID;
     $this->_template_args['question'] = $question;
     $this->_template_args['question_types'] = $question_types;
     $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
     $this->_set_publish_post_box_vars('id', $ID);
     $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE);
     // the details template wrapper
     $this->display_admin_page_with_sidebar();
 }
 /**
  * 		generate s HTML for the billing info form during registration
  * 		@access 		protected
  * 		@param		array	$billing_inputs - array of input field details
  * 		@param		array	$section - what part of the billing info form, "address", "credit_card", or "other"
  * 		@return 		string
  */
 protected function _generate_billing_info_form_fields($billing_inputs = array(), $section = FALSE)
 {
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     if (empty($billing_inputs) || !$section) {
         return;
     }
     global $wp_filter, $css_class;
     // fill out section name
     $section = '_billing_info_' . $section . '_fields';
     // if you don't behave - this is what you're gonna get !!!
     $output = '';
     // cycle thru billing inputs
     foreach ($billing_inputs as $input_key => $billing_input) {
         // is the billing input in the requested section	?
         if (in_array($input_key, $this->{$section})) {
             // required fields get a *
             $required = $billing_input['required'] ? EEH_Form_Fields::prep_required(array('class' => 'required', 'label' => '<em>*</em>')) : '';
             // answer
             $answer = EE_Registry::instance()->REQ->is_set($input_key) ? EE_Registry::instance()->REQ->get($input_key) : $billing_input['value'];
             if ($input_key == '_reg-page-billing-card-exp-date-mnth-' . $this->_gateway_name) {
                 // Credit Card MONTH
                 add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= EEH_Form_Fields::select(__('Expiry Date', 'event_espresso'), $answer, EEH_Form_Fields::two_digit_months_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-month display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= "\n\t\t\t" . '&nbsp;/&nbsp;';
             } elseif ($input_key == '_reg-page-billing-card-exp-date-year-' . $this->_gateway_name) {
                 // Credit Card YEAR
                 // remove label
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= EEH_Form_Fields::select(__('Year', 'event_espresso'), $answer, EEH_Form_Fields::next_decade_two_digit_year_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-year display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE);
                 // remove filter that removes label, or else no other inputs will have labels
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= "\n\t\t\t" . '<span class="small-text lt-grey-text">' . __('(mm/yy)', 'event_espresso') . '</span>';
             } else {
                 // create question form input
                 $QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => $billing_input['label'], 'QST_system' => $billing_input['db-col'], 'QST_type' => $billing_input['input'], 'QST_required' => $billing_input['required'])), EE_Answer::new_instance(array('ANS_value' => $answer)), array('input_name' => $input_key, 'input_id' => $input_key, 'input_class' => $css_class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
                 // add options
                 if (isset($billing_input['options'])) {
                     $options = is_array($billing_input['options']) ? $billing_input['options'] : explode(',', $billing_input['options']);
                     foreach ($options as $option) {
                         $QSO = EE_Question_Option::new_instance(array('QSO_value' => $option, 'QSO_desc' => $option));
                         $QFI->add_temp_option($QSO);
                     }
                 }
                 $output .= EEH_Form_Fields::generate_form_input($QFI);
             }
         }
         // end if ( in_array( $input_key, $this->$section ))
     }
     // end foreach( $billing_inputs as $input_key => $billing_input )
     return $output;
 }
 /**
  * decaf venue metabox
  * @return string form for Event Venue
  */
 public function venue_metabox()
 {
     //first let's see if we have a venue already
     $event_id = $this->_cpt_model_obj->ID();
     $venue = !empty($event_id) ? $this->_cpt_model_obj->venues() : NULL;
     $venue = empty($venue) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift($venue);
     $template_args['_venue'] = $venue;
     $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), EE_Answer::new_instance(array('ANS_value' => $venue->state_ID())), array('input_name' => 'state', 'input_id' => 'phys-state', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input($QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), EE_Answer::new_instance(array('ANS_value' => $venue->country_ID())), array('input_name' => 'countries', 'input_id' => 'phys-country', 'input_class' => '', 'input_prefix' => '', 'append_qstn_id' => FALSE)));
     $template_path = EVENTS_TEMPLATE_PATH . 'event_venues_metabox_content.template.php';
     EEH_Template::display_template($template_path, $template_args);
 }