Ejemplo n.º 1
0
    /**
     * @param string $summary
     * @param EM_Person $EM_Person
     * @return string|unknown
     */
    public static function em_person_display_summary($summary, $EM_Person)
    {
        global $EM_Booking;
        $EM_Form = self::get_form();
        $no_user = get_option('dbem_bookings_registration_disable') && $EM_Person->ID == get_option('dbem_bookings_registration_user');
        ob_start();
        //a bit of repeated stuff from the original EM_Person::display_summary() static function
        ?>
		<table class="em-form-fields">
			<tr>
				<td><?php 
        echo get_avatar($EM_Person->ID);
        ?>
</td>
				<td style="padding-left:10px; vertical-align: top;">
					<table>
						<?php 
        if ($no_user) {
            ?>
						<tr><th><?php 
            esc_html_e_emp('Name', 'dbem');
            ?>
 : </th><th><?php 
            echo $EM_Person->get_name();
            ?>
</th></tr>
						<?php 
        } else {
            ?>
						<tr><th><?php 
            esc_html_e_emp('Name', 'dbem');
            ?>
 : </th><th><a href="<?php 
            echo $EM_Person->get_bookings_url();
            ?>
"><?php 
            echo $EM_Person->get_name();
            ?>
</a></th></tr>
						<?php 
        }
        ?>
						<tr><th><?php 
        esc_html_e_emp('Email', 'dbem');
        ?>
 : </th><td><?php 
        echo esc_html($EM_Person->user_email);
        ?>
</td></tr>
						<?php 
        foreach ($EM_Form->form_fields as $field_id => $field) {
            if ($field['type'] == 'html') {
                ?>
								<td colspan="2"><?php 
                echo $field['options_html_content'];
                ?>
</td>
								<?php 
            } else {
                $value = esc_html(self::get_user_meta($EM_Person->ID, $field_id, true));
                //override by registration value in case value is now empty, otherwise show n/a
                if (!empty($EM_Booking->booking_meta['registration'][$field_id]) && (empty($value) || $no_user)) {
                    $value = $EM_Booking->booking_meta['registration'][$field_id];
                } elseif (empty($value) || $no_user) {
                    $value = "<em>" . __('n/a', 'em-pro') . "</em>";
                }
                if ($value != "<em>" . __('n/a', 'em-pro') . "</em>") {
                    $value = $EM_Form->get_formatted_value($field, $value);
                }
                ?>
								<tr><th><?php 
                echo $field['label'];
                ?>
 : </th><td><?php 
                echo $value;
                ?>
</td></tr>	
								<?php 
            }
        }
        ?>
					</table>
				</td>
			</tr>
		</table>
		<?php 
        return ob_get_clean();
    }