echo get_job_application_avatar($application->ID); ?> --> <?php if ($attachments = get_job_application_attachments($application->ID)) { ?> <?php foreach ($attachments as $attachment) { ?> <img src="<?php echo esc_url($attachment); ?> " title="<?php echo esc_attr(get_job_application_attachment_name($attachment)); ?> " alt="image attachment" class="job-application-image" /> <?php } } ?> <h3><?php echo $application->post_title; ?> </h3> <span class="job-application-rating"><span style="width: <?php echo get_job_application_rating($application->ID) / 5 * 100; ?> %;"></span></span>
/** * custom_columns function. * * @access public * @param mixed $column * @return void */ public function custom_columns($column) { global $post; switch ($column) { case "application_status": echo '<span class="status">' . $post->post_status . '</a>'; break; case "candidate": echo '<a href="' . admin_url('post.php?post=' . $post->ID . '&action=edit') . '" class="tips candidate_name" data-tip="' . sprintf(__('Application ID: %d', 'wp-job-manager-applications'), $post->ID) . '">' . $post->post_title . '</a>'; if ($email = get_post_meta($post->ID, '_candidate_email', true)) { echo '<br/><a href="mailto:' . esc_attr($email) . '">' . esc_attr($email) . '</a>'; echo get_avatar($email, 42); } echo '<div class="hidden" id="inline_' . $post->ID . '"><div class="post_title">' . $post->post_title . '</div></div>'; break; case 'job': $job = get_post($post->post_parent); if ($job && $job->post_type === 'job_listing') { echo '<a href="' . get_permalink($job->ID) . '">' . $job->post_title . '</a>'; } elseif ($job = get_post_meta($post->ID, '_job_applied_for', true)) { echo esc_html($job); } else { echo '<span class="na">–</span>'; } break; case 'attachment': if ($attachments = get_job_application_attachments($post->ID)) { foreach ($attachments as $attachment) { echo '<a href="' . esc_url($attachment) . '">' . get_job_application_attachment_name($attachment, 20) . '</a></br>'; } } else { echo '<span class="na">–</span>'; } break; case 'online_resume': if (($resume_id = get_job_application_resume_id($post->ID)) && function_exists('get_resume_share_link') && ($share_link = get_resume_share_link($resume_id))) { echo '<a href="' . esc_attr($share_link) . '" target="_blank" class="job-application-resume">' . get_the_title($resume_id) . '</a>'; } else { echo '<span class="na">–</span>'; } break; case 'application_rating': echo '<span class="job-application-rating"><span style="width: ' . get_job_application_rating($post->ID) / 5 * 100 . '%;"></span></span>'; break; case 'application_notes': printf(_n('%d note', '%d notes', $post->comment_count, 'wp-job-manager-applications'), $post->comment_count); break; case "job_application_posted": echo '<strong>' . date_i18n(__('M j, Y', 'wp-job-manager-applications'), strtotime($post->post_date)) . '</strong><span>'; echo (empty($post->post_author) ? __('by a guest', 'wp-job-manager-applications') : sprintf(__('by %s', 'wp-job-manager-applications'), '<a href="' . get_edit_user_link($post->post_author) . '">' . get_the_author() . '</a>')) . '</span>'; break; case "job_application_actions": echo '<div class="actions">'; $admin_actions = array(); if ($post->post_status !== 'trash') { $admin_actions['view'] = array('action' => 'view', 'name' => __('View', 'wp-job-manager-applications'), 'url' => get_edit_post_link($post->ID)); $admin_actions['delete'] = array('action' => 'delete', 'name' => __('Delete', 'wp-job-manager-applications'), 'url' => get_delete_post_link($post->ID)); } $admin_actions = apply_filters('job_manager_job_applications_admin_actions', $admin_actions, $post); foreach ($admin_actions as $action) { printf('<a class="icon-%s button tips" href="%s" data-tip="%s">%s</a>', esc_attr($action['action']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name'])); } echo '</div>'; break; } }
/** * Download a CSV */ public function csv_handler() { if (!empty($_GET['download-csv'])) { $job_id = absint($_REQUEST['job_id']); $job = get_post($job_id); // Permissions if (!job_manager_user_can_edit_job($job)) { return; } $args = apply_filters('job_manager_job_applications_args', array('post_type' => 'job_application', 'post_status' => array_merge(array_keys(get_job_application_statuses()), array('publish')), 'ignore_sticky_posts' => 1, 'posts_per_page' => -1, 'post_parent' => $job_id)); // Filters $application_status = !empty($_GET['application_status']) ? sanitize_text_field($_GET['application_status']) : ''; $application_orderby = !empty($_GET['application_orderby']) ? sanitize_text_field($_GET['application_orderby']) : ''; if ($application_status) { $args['post_status'] = $application_status; } switch ($application_orderby) { case 'name': $args['order'] = 'ASC'; $args['orderby'] = 'post_title'; break; case 'rating': $args['order'] = 'DESC'; $args['orderby'] = 'meta_value'; $args['meta_key'] = '_rating'; break; default: $args['order'] = 'DESC'; $args['orderby'] = 'date'; break; } $applications = get_posts($args); @set_time_limit(0); if (function_exists('apache_setenv')) { @apache_setenv('no-gzip', 1); } @ini_set('zlib.output_compression', 0); @ob_clean(); header('Content-Type: text/csv; charset=UTF-8'); header('Content-Disposition: attachment; filename=' . __('applications', 'wp-job-manager-applications') . '.csv'); header('Pragma: no-cache'); header('Expires: 0'); $fp = fopen('php://output', 'w'); $row = array_map(__CLASS__ . '::wrap_column', array(__('Application date', 'wp-job-manager-applications'), __('Application status', 'wp-job-manager-applications'), __('Applicant name', 'wp-job-manager-applications'), __('Applicant email', 'wp-job-manager-applications'), __('Job applied for', 'wp-job-manager-applications'), __('Attachment', 'wp-job-manager-applications'), __('Applicant message', 'wp-job-manager-applications'), __('Rating', 'wp-job-manager-applications'))); // Other custom fields $custom_fields = array(); foreach ($applications as $application) { $custom_fields = array_merge($custom_fields, array_keys(get_post_custom($application->ID))); } $custom_fields = array_unique($custom_fields); $custom_fields = array_diff($custom_fields, array('_edit_lock', '_attachment', '_attachment_file', '_job_applied_for', '_candidate_email', '_candidate_user_id', '_rating', '_application_source', '_secret_dir')); foreach ($custom_fields as $custom_field) { $row[] = $custom_field; } fwrite($fp, implode(',', $row) . "\n"); foreach ($applications as $application) { $row = array(); $row[] = date_i18n(get_option('date_format'), strtotime($application->post_date)); $row[] = $application->post_status; $row[] = $application->post_title; $row[] = get_job_application_email($application->ID); $row[] = get_the_title($application->post_parent); $row[] = get_post_meta($application->ID, '_attachment', true); $row[] = $application->post_content; $row[] = get_job_application_rating($application->ID); foreach ($custom_fields as $custom_field) { $row[] = get_post_meta($application->ID, $custom_field, true); } $row = array_map(__CLASS__ . '::wrap_column', $row); fwrite($fp, implode(',', $row) . "\n"); } fclose($fp); exit; } }
</fieldset> <fieldset class="fieldset-rating"> <label for="application-rating-<?php esc_attr_e($application->ID); ?> "><?php _e('Rating (out of 5)', 'wp-job-manager-applications'); ?> :</label> <div class="field"> <input type="number" id="application-rating-<?php esc_attr_e($application->ID); ?> " name="application_rating" step="0.1" max="5" min="0" placeholder="0" value="<?php echo esc_attr(get_job_application_rating($application->ID)); ?> " /> </div> </fieldset> <p> <a class="delete_job_application" href="<?php echo wp_nonce_url(add_query_arg('delete_job_application', $application->ID), 'delete_job_application'); ?> "><?php _e('Delete', 'wp-job-manager-applications'); ?> </a> <input type="submit" name="wp_job_manager_edit_application" value="<?php esc_attr_e('Save changes', 'wp-job-manager-applications');