Advertisement
SRD75

submit-resume-form.php

Jan 25th, 2014
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.33 KB | None | 0 0
  1. <?php
  2. /**
  3.  * JobRoller Resume form
  4.  * Function outputs the resume submit form
  5.  *
  6.  *
  7.  * @version 1.4
  8.  * @author AppThemes
  9.  * @package JobRoller
  10.  * @copyright 2010 all rights reserved
  11.  *
  12.  */
  13.  
  14. function jr_submit_resume_form( $resume_id = 0 ) {
  15.    
  16.     global $post, $posted;
  17.    
  18.     jr_geolocation_scripts();
  19.  
  20.     ?>
  21.     <form action="<?php
  22.         if ($resume_id>0) echo add_query_arg('edit', $resume_id, get_permalink( $post->ID ));
  23.         else echo get_permalink( $post->ID );
  24.     ?>" method="post" enctype="multipart/form-data" id="submit_form" class="submit_form main_form">
  25.        
  26.         <p><?php _e('Enter your resume details below. Once saved you will be able to view your resume and optionally add links to your websites/social networks if you wish.', APP_TD); ?></p>
  27.        
  28.         <fieldset>
  29.             <legend><?php _e('Your Resume', APP_TD); ?></legend>
  30.            
  31.             <p><label for="resume_name"><?php _e('Resume Title', APP_TD); ?> <span title="required">*</span></label> <input type="text" class="text" name="resume_name" id="resume_name" class="text" placeholder="<?php _e('e.g. Security Consultant', APP_TD); ?>" value="<?php if (isset($posted['resume_name'])) echo $posted['resume_name']; ?>" /></p>
  32.            
  33.             <p><label for="summary"><?php _e('Resume Summary', APP_TD); ?> <span title="required">*</span></label> <textarea rows="5" cols="30" name="summary" id="summary" placeholder="<?php _e('Briefly describe yourself.', APP_TD); ?>" class="short" style="height:100px;"><?php if (isset($posted['summary'])) echo $posted['summary']; ?></textarea></p>
  34.            
  35.             <p class="optional"><label for="resume_cat"><?php _e('Resume Category', APP_TD); ?></label> <?php
  36.                 $sel = 0;
  37.                 if (isset($posted['resume_cat']) && $posted['resume_cat']>0) $sel = $posted['resume_cat'];
  38.                 $args = array(
  39.                     'orderby'            => 'name',
  40.                     'order'              => 'ASC',
  41.                     'name'               => 'resume_cat',
  42.                     'hierarchical'       => 1,
  43.                     'echo'               => 0,
  44.                     'class'              => 'resume_cat',
  45.                     'selected'           => $sel,
  46.                     'taxonomy'           => 'resume_category',
  47.                     'hide_empty'         => false
  48.                 );
  49.                 $dropdown = wp_dropdown_categories( $args );
  50.                 $dropdown = str_replace('class=\'resume_cat\' >','class=\'resume_cat\' ><option value="">'.__('Select a category&hellip;', APP_TD).'</option>',$dropdown);
  51.                 echo $dropdown;
  52.             ?></p> 
  53.            
  54.             <p class="optional"><label for="your-photo"><?php _e('Resume Photo (.jpg, .gif or .png)', APP_TD); ?></label> <input type="file" class="text" name="your-photo" id="your-photo" /></p>
  55.  
  56.             <p class="optional"><label for="desired_salary"><?php _e('Desired Salary (only numeric values)', APP_TD); ?></label> <input type="text" class="tags text" name="desired_salary" id="desired_salary" placeholder="<?php _e('e.g. 25000', APP_TD); ?>" value="<?php if (isset($posted['desired_salary'])) echo $posted['desired_salary']; ?>" /></p>
  57.            
  58.             <p class="optional"><label for="desired_position"><?php _e('Desired Type of Position', APP_TD); ?></label> <select name="desired_position" id="desired_position">
  59.                 <option value=""><?php _e('Any', APP_TD); ?></option>
  60.                 <?php
  61.                 $job_types = get_terms( 'resume_job_type', array( 'hide_empty' => '0' ) );
  62.                 if ($job_types && sizeof($job_types) > 0) {
  63.                     foreach ($job_types as $type) {
  64.                         ?>
  65.                         <option <?php if (isset($posted['desired_position']) && $posted['desired_position']==$type->slug) echo 'selected="selected"'; ?> value="<?php echo $type->slug; ?>"><?php echo $type->name; ?></option>
  66.                         <?php
  67.                     }
  68.                 }
  69.                 ?>
  70.             </select></p>
  71.            
  72.         </fieldset>
  73.  
  74.         <fieldset>
  75.             <legend><?php _e('Your Contact Details', APP_TD); ?></legend>
  76.            
  77.             <p><?php _e('Optionally fill in your contact details below to have them appear on your resume. This is important if you want employers to be able to contact you!', APP_TD); ?></p>
  78.            
  79.             <p class="optional"><label for="email_address"><?php _e('Email Address', APP_TD); ?></label> <input type="text" class="text" name="email_address" value="<?php if (isset($posted['email_address'])) echo $posted['email_address']; ?>" id="email_address" placeholder="<?php _e('you@yourdomain.com', APP_TD); ?>" /></p>
  80.             <p class="optional"><label for="tel"><?php _e('Telephone', APP_TD); ?></label> <input type="text" class="text" name="tel" value="<?php if (isset($posted['tel'])) echo $posted['tel']; ?>" id="tel" placeholder="<?php _e('Telephone including area code', APP_TD); ?>" /></p>
  81.             <p class="optional"><label for="mobile"><?php _e('Mobile', APP_TD); ?></label> <input type="text" class="text" name="mobile" value="<?php if (isset($posted['mobile'])) echo $posted['mobile']; ?>" id="mobile" placeholder="<?php _e('Mobile number', APP_TD); ?>" /></p>
  82.            
  83.         </fieldset>
  84.        
  85.         <fieldset>
  86.             <legend><?php _e('Resume Location', APP_TD); ?></legend>
  87.             <p><?php _e('Entering your location will help employers find you.', APP_TD); ?></p>
  88.             <div id="geolocation_box">
  89.                 <p>
  90.                     <label>
  91.                         <input id="geolocation-load" type="button" class="button geolocationadd submit" value="<?php esc_attr_e('Find Address/Location', APP_TD); ?>" />
  92.                     </label>
  93.  
  94.                     <input type="text" class="text" name="jr_address" id="geolocation-address" value="<?php if (isset($posted['jr_address'])) echo esc_attr($posted['jr_address']); ?>" />
  95.                     <input type="hidden" class="text" name="jr_geo_latitude" id="geolocation-latitude" value="<?php if (isset($posted['jr_geo_latitude'])) echo esc_attr($posted['jr_geo_latitude']); ?>" />
  96.                     <input type="hidden" class="text" name="jr_geo_longitude" id="geolocation-longitude" value="<?php if (isset($posted['jr_geo_longitude'])) echo esc_attr($posted['jr_geo_longitude']); ?>" />
  97.                 </p>
  98.  
  99.                 <div id="map_wrap" style="border:solid 2px #ddd;"><div id="geolocation-map" style="width:100%;height:300px;"></div></div>
  100.             </div>
  101.            
  102.         </fieldset>
  103.  
  104.         <fieldset>
  105.             <legend><?php _e('Education and Training', APP_TD); ?></legend>
  106.             <p><?php _e('Detail your education, including details on your professional security training (e.g. unarmed restraint training, evasive driving) and schools/universities attended.', APP_TD); ?></p>
  107.             <p><textarea rows="5" cols="30" name="education" id="education" class="mceEditor"><?php if (isset($posted['education'])) echo $posted['education']; ?></textarea></p>
  108.         </fieldset>
  109.         <fieldset>
  110.             <legend><?php _e('Experience', APP_TD); ?></legend>
  111.             <p><?php _e('Detail your work experience, including details on your employers and job roles and responsibilities. If you are a veteran, list branch of service and type of discharge.', APP_TD); ?></p>
  112.             <p><textarea rows="5" cols="30" name="experience" id="experience" class="mceEditor"><?php if (isset($posted['experience'])) echo $posted['experience']; ?></textarea></p>
  113.         </fieldset>
  114.        
  115.         <fieldset>
  116.             <legend><?php _e('Qualifications', APP_TD); ?></legend>
  117.  
  118.             <p class="optional"><label for="skills" class="forskills"><?php _e('Professional Licenses <small>(one per line) -  e.g. medical certificates, state licenses, and weapons permits</small>', APP_TD); ?></label> <textarea rows="1" cols="30" name="skills" id="skills" class="short grow" placeholder="<?php _e('e.g. medical certificate', APP_TD); ?>"><?php if (isset($posted['skills'])) echo $posted['skills']; ?></textarea></p>
  119.            
  120.             <p class="optional"><label for="specialities"><?php _e('Government Clearance <small>e.g. top secret, secret, or confidential</small>', APP_TD); ?></label> <input type="text" class="tags text tag-input-commas" data-separator="," name="specialities" id="specialities" placeholder="<?php _e('e.g. Public Speaking, Team Management', APP_TD); ?>" value="<?php if (isset($posted['specialities'])) echo $posted['specialities']; ?>" /></p>
  121.            
  122.             <p class="optional"><label for="groups"><?php _e('Groups/Associations <small>e.g. As is, VFW</small>', APP_TD); ?></label> <input type="text" class="text text tag-input-commas" data-separator="," name="groups" value="<?php if (isset($posted['groups'])) echo $posted['groups']; ?>" id="groups" placeholder="<?php _e('e.g. IEEE, W3C', APP_TD); ?>" /></p>
  123.            
  124.             <p class="optional" id="languages_wrap"><label for="languages"><?php _e('Spoken Languages <small>e.g. English, French</small>', APP_TD); ?></label> <input type="text" class="text text tag-input-commas" data-separator="," name="languages" value="<?php if (isset($posted['languages'])) echo $posted['languages']; ?>" id="languages" placeholder="<?php _e('e.g. English, French', APP_TD); ?>" /></p>
  125.            
  126.         </fieldset>
  127.        
  128.         <p align="right">* indicates this is a required field.</p>
  129.        
  130.         <p><input type="submit" class="submit" name="save_resume" value="<?php _e('Save &rarr;', APP_TD); ?>" /></p>
  131.            
  132.         <div class="clear"></div>
  133.            
  134.     </form>
  135.     <script type="text/javascript">
  136.        
  137.         jQuery(function(){
  138.        
  139.             /* Auto Complete */
  140.             var availableTags = [
  141.                 <?php
  142.                     $terms_array = array();
  143.                     $terms = get_terms( 'resume_languages', 'hide_empty=0' );
  144.                     if ($terms) foreach ($terms as $term) {
  145.                         $terms_array[] = '"'.$term->name.'"';
  146.                     }
  147.                     echo implode(',', $terms_array);
  148.                 ?>
  149.             ];
  150.             function split( val ) {
  151.                 return val.split( /,\s*/ );
  152.             }
  153.             function extractLast( term ) {
  154.                 return split( term ).pop();
  155.             }
  156.             jQuery("#languages_wrap input").on( "keydown", function( event ) {
  157.                 if ( (event.keyCode === jQuery.ui.keyCode.TAB || event.keyCode === jQuery.ui.keyCode.COMMA) &&
  158.                         jQuery( this ).data( "autocomplete" ).menu.active ) {
  159.                     event.preventDefault();
  160.                 }
  161.             }).autocomplete({
  162.                 minLength: 0,
  163.                 source: function( request, response ) {
  164.                     // delegate back to autocomplete, but extract the last term
  165.                     response( jQuery.ui.autocomplete.filter(
  166.                         availableTags, extractLast( request.term ) ) );
  167.                 },
  168.                 focus: function() {
  169.                     jQuery('input.ui-autocomplete-input').val('');
  170.                     // prevent value inserted on focus
  171.                     return false;
  172.                 },
  173.                 select: function( event, ui ) {
  174.  
  175.                     var terms = split( this.value );
  176.                     // remove the current input
  177.                     terms.pop();
  178.                     // add the selected item
  179.                     terms.push( ui.item.value );
  180.                     // add placeholder to get the comma-and-space at the end
  181.                     terms.push( "" );
  182.                     //this.value = terms.join( ", " );
  183.                     this.value = terms.join( "" );
  184.                    
  185.                     jQuery(this).blur();
  186.                     jQuery(this).focus();
  187.                    
  188.                     return false;
  189.                 }
  190.             });
  191.        
  192.         });
  193.     </script>
  194.     <?php
  195.     if ( get_option('jr_html_allowed') == 'yes' && ! wp_is_mobile() )
  196.         jr_tinymce();
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement