PageRenderTime 27ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/Project/faci-qsoft/wp-content/themes/noo-jobmonster/layouts/manage-application.php

https://gitlab.com/hop23typhu/list-theme
PHP | 204 lines | 200 code | 4 blank | 0 comment | 11 complexity | 91ab6c0af3f3dd76d71bff1502583c22 MD5 | raw file
  1. <?php
  2. if( is_front_page() || is_home()) {
  3. $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : ( ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 );
  4. } else {
  5. $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
  6. }
  7. $job_filter = isset($_POST['job']) ? absint($_POST['job']) : 0;
  8. $jobs_list = get_posts(array(
  9. 'post_type'=>'noo_job',
  10. 'post_status'=>array('publish','pending','expired'),
  11. 'author'=>get_current_user_id(),
  12. 'posts_per_page'=>-1,
  13. 'suppress_filters' => false
  14. ));
  15. $job_ids = array_map(create_function('$o', 'return $o->ID;'), $jobs_list);
  16. $args = array(
  17. 'post_type'=>'noo_application',
  18. 'paged' => $paged,
  19. 'post_parent__in'=>array_merge($job_ids, array(0)), // make sure return zero application if there's no job.
  20. 'post_status'=>array('publish','pending','rejected'),
  21. );
  22. if(!empty($job_filter) && in_array($job_filter, $job_ids)){
  23. $args['post_parent__in'] = array($job_filter);
  24. }
  25. $r = new WP_Query($args);
  26. ob_start();
  27. do_action('noo_member_manage_application_before');
  28. ?>
  29. <div class="member-manage">
  30. <h3><?php echo sprintf(__("You've received %s application(s)",'noo'),$r->found_posts)?></h3>
  31. <form method="post">
  32. <div class="member-manage-toolbar top-toolbar hidden-xs clearfix">
  33. <div class="bulk-actions clearfix">
  34. <strong><?php _e('Filter:','noo')?></strong>
  35. <div class="form-control-flat" style="width: 200px;">
  36. <select name="job">
  37. <option value="0"><?php _e('-All jobs-','noo')?></option>
  38. <?php foreach ($jobs_list as $a_job):?>
  39. <option value="<?php echo esc_attr($a_job->ID)?>" <?php selected($job_filter,$a_job->ID)?> ><?php echo $a_job->post_title?></option>
  40. <?php endforeach;?>
  41. </select>
  42. <i class="fa fa-caret-down"></i>
  43. </div>
  44. <button type="submit" class="btn btn-primary"><?php _e('Go', 'noo')?></button>
  45. </div>
  46. </div>
  47. <div style="display: none">
  48. <?php wp_nonce_field('application-manage-action')?>
  49. </div>
  50. <div class="member-manage-table">
  51. <table class="table">
  52. <thead>
  53. <tr>
  54. <th><?php _e('Candidate','noo')?></th>
  55. <th><?php _e('Applied job','noo')?></th>
  56. <th class="hidden-xs hidden-sm"><?php _e('Message','noo')?></th>
  57. <th class="hidden-xs hidden-sm"><?php _e('Applied Date','noo')?></th>
  58. <th class="hidden-xs text-center"><?php _e('Action','noo')?></th>
  59. <th class="text-center"><?php _e('CV','noo')?></th>
  60. <th class="text-center"><?php _e('Status','noo')?></th>
  61. </tr>
  62. </thead>
  63. <tbody>
  64. <?php if($r->have_posts()):?>
  65. <?php
  66. while ($r->have_posts()): $r->the_post();global $post;
  67. if ( $attachment = noo_get_post_meta( $post->ID, '_attachment', '' ) ) {
  68. $attachment_icon = 'fa-eye';
  69. $maybe_resume = is_numeric($attachment) ? get_post(absint($attachment)) : '';
  70. if($maybe_resume && $maybe_resume->post_type == 'noo_resume') {
  71. $attachment_link = get_permalink( $maybe_resume->ID );
  72. $attachment_link = esc_url( add_query_arg('application_id', $post->ID, $attachment_link) );
  73. } else {
  74. $attachment_icon = 'fa-file-text-o';
  75. $attachment_link = $attachment;
  76. }
  77. if( strpos($attachment_link,'linkedin') ) {
  78. $attachment_icon = 'fa-linkedin';
  79. }
  80. } else {
  81. $attachment_link = '';
  82. $attachment_icon = '';
  83. }
  84. $mesage_excerpt = !empty($post->post_content) ? wp_trim_words( $post->post_content, 10 ) : '';
  85. $mesage_excerpt = !empty($mesage_excerpt) ? $mesage_excerpt . __('...', 'noo') : '';
  86. $candidate_email = noo_get_post_meta($post->ID,'_candidate_email');
  87. $avatar = noo_get_avatar($candidate_email, 40);
  88. ?>
  89. <tr>
  90. <td>
  91. <?php $candidate_link = apply_filters( 'noo_application_candidate_link', '', $post->ID, $candidate_email ); ?>
  92. <span class="candidate-avatar">
  93. <?php echo ($avatar) ?>
  94. </span>
  95. <span class="candidate-name"><?php if(!empty($candidate_link)) echo '<a href="'. $candidate_link . '">'; ?><?php echo get_the_title(); ?><?php if(!empty($candidate_link)) echo '</a>'; ?></span>
  96. </td>
  97. <td>
  98. <?php
  99. $parent_job = get_post( $post->post_parent );
  100. if ( $parent_job && $parent_job->post_type === 'noo_job' ) {
  101. echo ('<a href="' . get_permalink( $parent_job->ID ) . '">' . $parent_job->post_title . '</a>');
  102. } elseif ( $parent_job = noo_get_post_meta( $post->ID, '_job_applied_for', true ) ) {
  103. echo esc_html( $parent_job );
  104. } else {
  105. echo ('<span class="na">&ndash;</span>');
  106. }
  107. ?>
  108. </td>
  109. <td class="hidden-xs hidden-sm">
  110. <?php
  111. $readmore_link = '<a href="#" data-application-id="' . esc_attr($post->ID) . '" class="member-manage-action view-employer-message" data-mode="1"><em class="text-primary">' . __('Continue reading', 'noo') . '&nbsp;<i class="fa fa-long-arrow-right"></i></em></a>';
  112. $readmore_link = apply_filters( 'noo-manage-application-message-link', $readmore_link, $post->ID );
  113. ?>
  114. <strong class="hidden-xs hidden-sm"><?php echo esc_html($mesage_excerpt); ?></strong>&nbsp;<?php echo $readmore_link; ?>
  115. </td>
  116. <td class="hidden-xs hidden-sm"><span><i class="fa fa-calendar"></i> <em><?php echo date_i18n( get_option('date_format'), strtotime( $post->post_date ) )?></em></span></td>
  117. <td class="member-manage-actions hidden-xs text-center">
  118. <?php
  119. if( $post->post_status == 'pending' ) :
  120. $approve_link = '<a href="#" class="member-manage-action approve-reject-action" data-hander="approve" data-application-id="' . $post->ID . '" data-toggle="tooltip" title="' . esc_attr__('Approve Application','noo') . '"><i class="fa fa-check-square-o"></i></a>';
  121. $reject_link = '<a href="#" class="member-manage-action approve-reject-action" data-hander="reject" data-application-id="' . $post->ID . '" data-toggle="tooltip" title="' . esc_attr__('Reject Application','noo') . '"><i class="fa fa-ban"></i></a>';
  122. $approve_link = apply_filters( 'noo-manage-application-approve-link', $approve_link, $post->ID );
  123. $reject_link = apply_filters( 'noo-manage-application-reject-link', $reject_link, $post->ID );
  124. echo $approve_link;
  125. echo $reject_link;
  126. else: ?>
  127. <a class="member-manage-action action-no-link" title="<?php esc_attr_e('Approve Application','noo')?>"><i class="fa fa-check-square-o"></i></a>
  128. <a class="member-manage-action action-no-link" title="<?php esc_attr_e('Reject Application','noo')?>"><i class="fa fa-ban"></i></a>
  129. <?php endif;?>
  130. <?php
  131. $email_link = '<a href="mailto:' . $candidate_email . '" class="member-manage-action" data-toggle="tooltip" title="' . esc_attr__('Email Candidate','noo') . '"><i class="fa fa-envelope-o"></i></a>';
  132. $email_link = apply_filters( 'noo-manage-application-email-link', $email_link, $post->ID );
  133. echo $email_link;
  134. ?>
  135. <?php do_action( 'noo-manage-application-action', $post->ID ); ?>
  136. <a href="<?php echo wp_nonce_url( add_query_arg(array('action'=>'delete','application_id'=>$post->ID)), 'application-manage-action' );?>" class="member-manage-action action-delete" data-toggle="tooltip" title="<?php esc_attr_e('Delete Application','noo')?>"><i class="fa fa-trash-o"></i></a>
  137. </td>
  138. <td class="text-center">
  139. <?php
  140. if ( !empty( $attachment_link ) ) {
  141. echo ('<a class="view_applications" data-application-id="'. $post->ID .'" href="' . $attachment_link . '" data-toggle="tooltip" title="'.esc_attr__('CV','noo').'"><i class="fa '.$attachment_icon.'"></i></a>');
  142. } else {
  143. echo ('<span class="na">&ndash;</span>');
  144. }
  145. ?>
  146. </td>
  147. <td class="text-center">
  148. <?php
  149. $status = $post->post_status;
  150. $status_class = $status;
  151. $statuses = Noo_Application::get_application_status();
  152. if ( isset( $statuses[ $status ] ) ) {
  153. $status = $statuses[ $status ];
  154. } else {
  155. $status = __( 'Inactive', 'noo' );
  156. $status_class = 'inactive';
  157. }
  158. ?>
  159. <span class="jm-status jm-status-<?php echo esc_attr($status_class) ?>">
  160. <?php echo esc_html($status)?>
  161. </span>
  162. </td>
  163. </tr>
  164. <?php endwhile;?>
  165. <?php else:?>
  166. <tr>
  167. <td colspan="8" class="text-center"><h3><?php _e('No Application','noo')?></h3></td>
  168. </tr>
  169. <?php endif;?>
  170. </tbody>
  171. </table>
  172. </div>
  173. <div class="member-manage-toolbar bottom-toolbar clearfix">
  174. <div class="bulk-actions clearfix pull-left">
  175. <strong class="hidden-xs"><?php _e('Filter:','noo')?></strong>
  176. <div class="form-control-flat" style="width: 200px;">
  177. <select name="job2">
  178. <option value="0"><?php _e('-All jobs-','noo')?></option>
  179. <?php foreach ($jobs_list as $a_job):?>
  180. <option value="<?php echo esc_attr($a_job->ID)?>" <?php selected($job_filter,$a_job->ID)?> ><?php echo $a_job->post_title?></option>
  181. <?php endforeach;?>
  182. </select>
  183. <i class="fa fa-caret-down"></i>
  184. </div>
  185. <button type="submit" class="btn btn-primary"><?php _e('Go', 'noo')?></button>
  186. </div>
  187. <div class="member-manage-page pull-right">
  188. <?php noo_pagination(array(),$r)?>
  189. </div>
  190. </div>
  191. </form>
  192. </div>
  193. <?php
  194. do_action('noo_member_manage_application_after');
  195. wp_reset_query();