function jobman_interview_application($aid, $display = 'full')
{
    $filter = array('post_type' => 'jobman_interview', 'post_status' => 'private', 'numberposts' => '-1', 'meta_key' => 'application', 'meta_value' => $aid);
    $interviews = get_posts($filter);
    ?>
	<div class="wrap">
<?php 
    if ('full' == $display) {
        ?>
	<h2><?php 
        _e('Job Manager: Application Interview Summary', 'jobman');
        ?>
</h2>
<?php 
    }
    jobman_interview_new_form(date('Y-m-d'), $aid);
    ?>
	<table class="widefat page fixed">
		<thead>
		<tr>
			<th><?php 
    _e('Interview Date', 'jobman');
    ?>
</th>
			<th><?php 
    _e('Interview Rating', 'jobman');
    ?>
</th>
			<th><?php 
    _e('Interview Details', 'jobman');
    ?>
</th>
		</tr>
		</thead>
<?php 
    if (count($interviews)) {
        foreach ($interviews as $interview) {
            $rating = get_post_meta($interview->ID, 'rating', true);
            ?>
		<tr>
			<td><?php 
            echo date('Y-m-d H:i', strtotime($interview->post_date));
            ?>
</td>
			<td><?php 
            jobman_print_rating_stars($interview->ID, $rating);
            ?>
</td>
			<td><a href="<?php 
            echo admin_url("admin.php?page=jobman-interviews&amp;display=interview&amp;filter={$interview->ID}");
            ?>
"><?php 
            _e('Interview Details', 'jobman');
            ?>
</a></td>
		</tr>
<?php 
        }
    } else {
        ?>
		<tr>
			<td colspan="3"><?php 
        _e('There are no interviews for this application.', 'jobman');
        ?>
</td>
		</tr>
<?php 
    }
    ?>
	</table>
	</div>
<?php 
}
function jobman_application_display_details($appid)
{
    $options = get_option('jobman_options');
    $fromid = $options['application_email_from'];
    $app = get_post($appid);
    $appmeta = get_post_custom($appid);
    $appdata = array();
    if (!empty($appmeta)) {
        foreach ($appmeta as $key => $value) {
            if (is_array($value)) {
                $appdata[$key] = $value[0];
            } else {
                $appdata[$key] = $value;
            }
        }
    }
    $fromid = $options['application_email_from'];
    $email = $appdata["data{$fromid}"];
    $grav_url = 'http://www.gravatar.com/avatar/' . md5(strtolower($email)) . '?size=120';
    echo "<img src='{$grav_url}' alt='' class='jobman-gravatar' />";
    if (NULL != $app) {
        echo '<table class="form-table jobman-form-table">';
        $parents = get_post_meta($app->ID, 'job', false);
        if (!empty($parents)) {
            $parentstr = array();
            foreach ($parents as $parent) {
                $data = get_post($parent);
                $children = get_posts("post_type=jobman_app&meta_key=job&meta_value={$data->ID}&post_status=publish,private");
                if (count($children) > 0) {
                    $applications = '<a href="' . admin_url("admin.php?page=jobman-list-applications&amp;jobman-jobid={$data->ID}") . '">' . count($children) . '</a>';
                } else {
                    $applications = 0;
                }
                $parentstr[] = "<a href='?page=jobman-list-jobs&amp;jobman-jobid={$data->ID}'>{$data->post_title}</a> ({$applications})";
            }
            $title = __('Job', 'jobman');
            if (count($parentstr) > 1) {
                $title = __('Jobs', 'jobman');
            }
            echo "<tr><th scope='row'><strong>{$title}</strong></th><td><strong>" . implode(', ', $parentstr) . '</strong></td></tr>';
        }
        $post_date = date_i18n('l, d F Y, H:i:s', strtotime($app->post_date));
        echo '<tr><th scope="row"><strong>' . __('Timestamp', 'jobman') . "</strong></th><td>{$post_date}</td></tr>";
        echo '<tr><th scope="row"><strong>' . __('Rating', 'jobman') . '</strong></th>';
        echo '<td>';
        $rating = 0;
        if (array_key_exists('rating', $appdata)) {
            $rating = $appdata['rating'];
        }
        jobman_print_rating_stars($app->ID, $rating);
        echo '</div></td><tr><td colspan="2">&nbsp;</td></tr>';
        $fields = $options['fields'];
        if (count($fields) > 0) {
            uasort($fields, 'jobman_sort_fields');
            foreach ($fields as $fid => $field) {
                if (!array_key_exists("data{$fid}", $appdata)) {
                    continue;
                }
                $item = $appdata["data{$fid}"];
                echo '<tr><th scope="row" style="min-width: 150px;"><strong>' . $fields[$fid]['label'] . '</strong></th><td>';
                if ($fid == $fromid) {
                    echo "<a href='mailto:{$item}'>";
                }
                switch ($fields[$fid]['type']) {
                    case 'text':
                    case 'radio':
                    case 'checkbox':
                    case 'date':
                    case 'textarea':
                    case 'select':
                        echo htmlspecialchars($item);
                        break;
                    case 'file':
                        $fileurl = wp_get_attachment_url($item);
                        if (!empty($fileurl)) {
                            echo "<a href='{$fileurl}'>" . __('Download', 'jobman') . "</a>";
                        }
                        break;
                    case 'geoloc':
                        echo '<a href="http://maps.google.com/maps?q=' . urlencode($item) . '">' . htmlspecialchars($appdata['data-display' . $fid]) . ' (' . htmlspecialchars($item) . ')</a>';
                        break;
                }
                if ($fid == $fromid) {
                    echo '</a>';
                }
                echo '</td></tr>';
            }
        }
    }
    ?>
		</table>
<?php 
}