<?php
/*
Template Name: [Resumes]
*/

if (!defined('THEME_VERSION')) {	header('HTTP/1.0 403 Forbidden'); exit; }

global  $userdata, $CORE; get_currentuserinfo();  $GLOBALS['nosidebar-right'] = true; $GLOBALS['nosidebar-left'] = true; 


get_header($CORE->pageswitch()); ?>


 
<div class="col-md-8">



<div class="panel panel-default">

<div class="panel-body">
  

<ul class="list-unstyled">
<?php

$searchword = "";
if(isset($_GET['rs'])){ $searchword = strip_tags($_GET['rs']); }

$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;

$args = array(
	'post_type' 		=> 'wlt_resume',
	'posts_per_page' 	=> 10,
	'paged' 			=> $paged,
 	's' 				=> $searchword,
);
$the_query = new WP_Query($args);
 
if ( $the_query->have_posts() ) : ?>

	 
	<!-- the loop -->
	<?php while ( $the_query->have_posts() ) :  $the_query->the_post(); 
	
	// USER COUNTRY
	$selected_country = get_user_meta($post->post_author,'country',true); 

 	
	?>
    
    <li>
    
    <div class="thumbnail" style="margin:0px;">
    
        <div class="col-md-2">
       
       <?php echo str_replace("img-responsive","img-responsive img-circle", get_avatar( $post->post_author,100 ) ); ?>
       
        </div>
        
        <div class="col-md-6" style="border-left:1px solid #ddd; padding-left:30px; margin-left:20px;">
        
        
        	<h3><?php the_title(); ?></h3>
            
            <?php if(strlen($selected_country) > 0){ ?>
            
            <p><div class="flag flag-<?php echo strtolower($selected_country); ?> wlt_locationflag"></div><?php echo $GLOBALS['core_country_list'][$selected_country]; ?></p>
            
            <?php } ?>
            
        </div>
        
        <div class="col-md-2 text-center">
        
        <a href="<?php echo get_permalink($post->ID); ?>" class="btn btn-success btn-lg" style="margin-top:20px;">View Resume</a>
        
        </div>	
        
     <div class="clearfix"></div>	
        
    </div> 
    
    <div class="well">
    
    <?php echo get_post_meta($post->ID, 'resume0', true); ?>
    
    </div>  
    
    </li>
    
	<?php endwhile; ?>
	<!-- end of the loop -->

	<!-- pagination here -->

	<?php wp_reset_postdata(); ?>

<?php else : ?>
	<li class="text-center"> No Resumes Found </li>
<?php endif; ?>

</ul>



<hr />

<?php
$big = 999999999; // need an unlikely integer

echo '<ul class="pagination pull-right">'.str_replace("<span","<li><span",str_replace("span/>","span/></li>",str_replace("a/>","a/></li>",str_replace("<a","<li><a rel='nofollow'",paginate_links( array(
	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
	'format' => '?paged=%#%',
	'current' => max( 1, get_query_var('paged') ),
	'total' => $the_query->max_num_pages
) ).'</ul>'))));
?>
 
 
</div></div> 




</div>
<div class="col-md-4">



<form id="member-search" action="" method="get" class="well">
            
 
        
 <input type="text" name="rs" class="form-control input-lg" value="<?php if(isset($_GET['rs'])){ echo strip_tags($_GET['rs']); } ?>" placeholder="Search Resumes" >

<hr />
  
 <input type="submit" value="<?php echo $CORE->_e(array('button','11','flag_noedit')); ?>" class="btn btn-lg  btn-primary" style="width:100%;">
     
 <div class="clearfix"></div>

</form>

</div>
 
<?php get_footer($CORE->pageswitch()); ?>