/** * JobRoller Application form * Function outputs the job application form * * * @version 1.0 * @author AppThemes * @package JobRoller * @copyright 2010 all rights reserved * */ function jr_application_form() { global $post, $app_form_results; $errors = $app_form_results['errors']; $posted = $app_form_results['posted']; if (!$posted && is_user_logged_in()) { $current_user = wp_get_current_user(); $posted['your_name'] = $current_user->user_firstname . ' ' . $current_user->user_lastname; $posted['your_email'] = $current_user->user_email; } ?> <div id="apply_form" class="section_content <?php echo $app_form_results['class']; ?> "> <h2><?php _e('Apply for this Job', 'appthemes'); ?> </h2> <?php jr_show_errors($errors, 'apply_form_result'); ?> <form action="<?php echo get_permalink($post->ID); ?> #apply_form_result" method="post" class="main_form" enctype="multipart/form-data"> <p><label for="your_name"><?php _e('Name', 'appthemes'); ?> <span title="required">*</span></label> <input type="text" class="text" name="your_name" id="your_name" value="<?php if (isset($posted['your_name'])) { echo $posted['your_name']; } ?> " /> </p> <p><label for="your_email"><?php _e('Email', 'appthemes'); ?> <span title="required">*</span></label> <input type="text" class="text" name="your_email" id="your_email" value="<?php if (isset($posted['your_email'])) { echo $posted['your_email']; } ?> " /></p> <p><label for="your_message"><?php _e('Message', 'appthemes'); ?> <span title="required">*</span></label> <textarea rows="5" cols="30" name="your_message" id="your_message"><?php if (isset($posted['your_message'])) { echo $posted['your_message']; } ?> </textarea></p> <?php if (is_user_logged_in() && !current_user_can('can_submit_job')) { ?> <p class="optional"><label for="your_online_cv"><?php _e('Link to Resumé', 'appthemes'); ?> </label> <select name="your_online_cv" id="your_online_cv"> <option value=""><?php _e('None', 'appthemes'); ?> </option> <?php $args = array('ignore_sticky_posts' => 1, 'posts_per_page' => -1, 'author' => get_current_user_id(), 'post_type' => 'resume', 'post_status' => 'publish'); $my_query = new WP_Query($args); if ($my_query->have_posts()) { while ($my_query->have_posts()) { $my_query->the_post(); echo '<option '; if (isset($posted['your_online_cv']) && $posted['your_online_cv'] == $my_query->post->ID) { echo 'selected="selected"'; } echo ' value="' . $my_query->post->ID . '">' . $my_query->post->post_title . '</option>'; } } wp_reset_query(); ?> </select></p> <?php } ?> <p class="optional"><label for="your_cv"><?php _e('Upload resumé (zip, pdf, doc, txt, rtf)', 'appthemes'); ?> </label> <input type="file" class="text" name="your_cv" id="your_cv" /></p> <p class="optional"><label for="your_coverletter"><?php _e('Upload cover letter (zip, pdf, doc, txt, rtf)', 'appthemes'); ?> </label> <input type="file" class="text" name="your_coverletter" id="your_coverletter" /></p> <?php if (!is_user_logged_in()) { ?> <p><label for="antispam_answer" title="<?php _e('This is to prevent spam', 'appthemes'); ?> "><?php echo get_option('jr_antispam_question'); ?> <span title="required">*</span></label> <input type="text" class="text small" name="antispam_answer" id="antispam_answer" value="<?php if (isset($posted['antispam_answer'])) { echo $posted['antispam_answer']; } ?> " /></p> <?php } ?> <p><input type="submit" class="submit" name="apply_to_job" value="<?php _e('Apply for Job', 'appthemes'); ?> " /></p> </form> </div> <?php }
<?php while (have_posts()) { the_post(); ?> <h1><?php the_title(); ?> </h1> <?php the_content(); ?> <?php jr_show_errors($errors); if (isset($message) && !empty($message)) { echo '<p class="success">' . $message . '</p>'; } ?> <!-- Contact Form --> <form method="post" action="<?php echo get_permalink($post->ID); ?> " class="main_form"> <p><label for="your_name"><?php _e('Your Name/Company Name', 'appthemes'); ?> <span title="required">*</span></label> <input type="text" class="text" name="your_name" id="your_name" value="<?php
function jr_edit_job_pack() { global $wpdb, $message, $errors; $errors = new WP_Error(); $message = ''; $edited_pack = (int) $_GET['edit']; if (!$edited_pack) { _e('Pack not found!', 'appthemes'); exit; } // Get Job details $job_pack = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "jr_job_packs WHERE id = %d", $edited_pack)); if (!$job_pack) { _e('Pack not found!', 'appthemes'); exit; } if ($_POST) { $posted = array(); $fields = array('pack_name', 'pack_description', 'pack_duration', 'pack_cost', 'job_count', 'job_duration'); foreach ($fields as $field) { if (isset($_POST[$field])) { $posted[$field] = stripslashes(trim($_POST[$field])); } else { $posted[$field] = ''; } } $required = array('pack_name' => __('Pack name', 'appthemes'), 'pack_description' => __('Pack Description', 'appthemes')); foreach ($required as $field => $name) { if (empty($posted[$field])) { $errors->add('submit_error', __('<strong>ERROR</strong>: “', 'appthemes') . $name . __('” is a required field.', 'appthemes')); } } if ($errors && sizeof($errors) > 0 && $errors->get_error_code()) { } else { $wpdb->update($wpdb->prefix . 'jr_job_packs', array('pack_name' => $posted['pack_name'], 'pack_description' => $posted['pack_description'], 'pack_duration' => $posted['pack_duration'], 'pack_cost' => $posted['pack_cost'], 'job_count' => $posted['job_count'], 'job_duration' => $posted['job_duration']), array('id' => $edited_pack), array('%s', '%s', '%s', '%s', '%s', '%s')); $message = __('Pack updated successfully', 'appthemes'); $job_pack = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "jr_job_packs WHERE id = %d", $edited_pack)); } } ?> <h3><?php _e('Edit Job Pack', 'appthemes'); ?> </h3> <?php jr_show_errors($errors); if (isset($message) && !empty($message)) { echo '<p class="success">' . $message . '</p>'; } ?> <form method="post" id="mainform" action=""> <table class="widefat fixed" id="tblspacer" style="width:850px;"> <thead> <tr> <th scope="col" width="200px"><?php _e('Job Pack Details', 'appthemes'); ?> </th> <th scope="col"> </th> </tr> </thead> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a name for this pack. This will be visible on the website', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Name', 'appthemes'); ?> :</td> <td class="forminp"><input style="width:300px;" name="pack_name" id="pack_name" type="text" value="<?php echo $job_pack->pack_name; ?> " class="required" /></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a description for this pack. This will be visible on the website', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Description', 'appthemes'); ?> :</td> <td class="forminp"><input style="width:500px;" name="pack_description" id="pack_description" type="text" value="<?php echo $job_pack->pack_description; ?> " class="required" /></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter the number of days', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Duration', 'appthemes'); ?> :</td> <td class="forminp"><input name="pack_duration" id="pack_duration" type="text" value="<?php echo $job_pack->pack_duration; ?> " /><br/><small><?php _e('Days this pack remains valid to use. Leave blank if it never expires.', 'appthemes'); ?> </small></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a numeric value, do not include currency values.', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Pack Cost', 'appthemes'); ?> :</td> <td class="forminp"><input name="pack_cost" id="pack_cost" type="text" value="<?php echo $job_pack->pack_cost; ?> " /><br/><small><?php _e('Pack cost. Leave blank if free.', 'appthemes'); ?> </small></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a numeric value or leave blank', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Job Count', 'appthemes'); ?> :</td> <td class="forminp"><input name="job_count" id="job_count" type="text" value="<?php echo $job_pack->job_count; ?> " /><br/><small><?php _e('How many jobs can the user list with this pack? Leave blank for an <em>unlimited</em> amount.', 'appthemes'); ?> </small></td> </tr> <tr> <td class="titledesc"><a href="#" tip="<?php _e('Enter a numeric value or leave blank', 'appthemes'); ?> " tabindex="99"><div class="helpico"></div></a> <?php _e('Job Duration', 'appthemes'); ?> :</td> <td class="forminp"><input name="job_duration" id="job_duration" type="text" value="<?php echo $job_pack->job_duration; ?> " class="required" /><br/><small><?php _e('How long do jobs last? e.g. <code>30</code> for 30 days.', 'appthemes'); ?> </small></td> </tr> </table> <p class="submit bbot"><input name="save" type="submit" value="<?php _e('Save Pack', 'appthemes'); ?> " /> <input name="submitted" type="hidden" value="yes" /></p> </form> <?php }