Update the output of the jobs and add new field for phone
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 16 Oct 2015 20:17:17 +0000 (16:17 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 16 Oct 2015 20:17:17 +0000 (16:17 -0400)
phone was missing.

controllers/front.php
models/job.php
views/admin/job_meta.php
views/front/jobDetail.php

index 20513c4..01866b5 100644 (file)
@@ -415,10 +415,16 @@ class emmet_employment_front
         $job->emmet_jobs_email     = $custom['emmet_jobs_email'][0];
         $job->emmet_jobs_comments  = $custom['emmet_jobs_comments'][0];
         $job->emmet_jobs_code      = $custom['emmet_jobs_code'][0];
-        //$current_url             = esc_url(add_query_arg($wp->query_string, '', home_url($wp->request)));
-        //$applyOnlineHref         = $current_url
-                //. ((strpos($current_url, '?')) ? '&' : '?')
-                //. self::FORM_VAR . "=1&job=" . $job->ID;
+        $job->emmet_jobs_contact   = $custom['emmet_jobs_contact'][0];
+        $job->emmet_jobs_phone     = $custom['emmet_jobs_phone'][0];
+        $job->emmet_jobs_email     = $custom['emmet_jobs_email'][0];
+        
+        $cats = wp_get_post_terms($job->ID, EMMET_EMP_TAX_DEPARTMENTS, array('fields' => 'names'));
+        $terms = wp_get_post_terms($job->ID, EMMET_EMP_TAX_CATEGORIES, array('fields' => 'names'));
+        
+        $job->terms = $terms;
+        $job->cats  = $cats;
+        
         include $this->frontViewDir . '/jobDetail.php';
         return;
     }
@@ -492,6 +498,9 @@ class emmet_employment_front
             $job->emmet_jobs_email     = $custom['emmet_jobs_email'][0];
             $job->emmet_jobs_comments  = $custom['emmet_jobs_comments'][0];
             $job->emmet_jobs_code      = $custom['emmet_jobs_code'][0];
+            $job->emmet_jobs_contact   = $custom['emmet_jobs_contact'][0];
+            $job->emmet_jobs_phone     = $custom['emmet_jobs_phone'][0];
+            $job->emmet_jobs_email     = $custom['emmet_jobs_email'][0];
             $job->href               = $current_url
                 . ((strpos($current_url, '?')) ? '&' : '?')
                 . "job=" . $job->ID;
index ead637e..6f47b9c 100644 (file)
@@ -246,6 +246,9 @@ class emmet_employment_job
         $emmet_jobs_email     = (isset($emmet_jobs_email[0]))
             ? $emmet_jobs_email[0]
             : '';
+        $emmet_jobs_phone     = (isset($emmet_jobs_phone[0]))
+            ? $emmet_jobs_phone[0]
+            : '';
         $emmet_jobs_comments  = (isset($emmet_jobs_comments[0]))
             ? $emmet_jobs_comments[0]
             : '';
@@ -299,6 +302,7 @@ class emmet_employment_job
         update_post_meta($post->ID, 'emmet_jobs_contact',
                          $_POST['emmet_jobs_contact']);
         update_post_meta($post->ID, 'emmet_jobs_email', $_POST['emmet_jobs_email']);
+        update_post_meta($post->ID, 'emmet_jobs_phone', $_POST['emmet_jobs_phone']);
         update_post_meta($post->ID, 'emmet_jobs_comments',
                          $_POST['emmet_jobs_comments']);
         update_post_meta($post->ID, 'emmet_jobs_code', $_POST['emmet_jobs_code']);
index cd74b3b..7a7d1cb 100644 (file)
                    value="<?php echo $emmet_jobs_shift; ?>" />
         </li>
         <li>
-            <label>HR Contact Name</label>
+            <label>Contact Name</label>
             <input name="emmet_jobs_contact"
                    value="<?php echo $emmet_jobs_contact; ?>" />
         </li>
         <li>
-            <label>HR Email</label>
+            <label>Direct Phone</label>
+            <input name="emmet_jobs_phone"
+                   value="<?php echo $emmet_jobs_phone; ?>" />
+        </li>
+        <li>
+            <label>Email</label>
             <input name="emmet_jobs_email"
                    value="<?php echo $emmet_jobs_email; ?>" />
         </li>
index ea3a34a..d1e99a5 100644 (file)
@@ -1,6 +1,16 @@
 <a href="<?php echo get_permalink();?>">Back To Search</a>
     <h4><a href="<?php echo $job->href; ?>"><?php echo $job->post_title; ?></a></h4>
-    <?php if($job->emmet_jobs_status):?>
+    <?php if (count($job->cats) > 0) :?>
+    <div><strong>Category:</strong> <?php foreach ($job->cats as $cat) : ?>
+    <?php echo $cat; ?>
+    <?php endforeach;?></div>
+    <?php endif;?>
+    <?php if (count($job->terms) > 0) : ?>
+    <div><strong>Department:</strong> <?php foreach ($job->terms as $term) : ?>
+    <?php echo $term; ?>
+    <?php endforeach;?></div>
+    <?php endif; ?>
+     <?php if($job->emmet_jobs_status):?>
     <div><strong>Status: </strong><?php echo $job->emmet_jobs_status; ?></div>
     <?php endif;?>
     <?php if($job->emmet_jobs_pay_grade):?>
     <?php endif;?>
 
     <?php if($job->emmet_jobs_shift):?>
-    <div><strong>Shift: </strong><?php echo $job->emmet_jobs_shift; ?></div>
-    <?php endif;?>
-
-    <?php if($job->emmet_jobs_contact):?>
-    <div><strong>Contact: </strong>
-        <?php if ($job->emmet_jobs_email):?>
-        <a href="mailto: <?php echo $job->emmet_jobs_email;?>">
-        <?php endif;?>
-        <?php echo $job->emmet_jobs_contact; ?>
-        <?php if ($job->emmet_jobs_email):?>
-        </a>
-        <?php endif;?>
-    </div>
+    <div><strong>Primary Shift: </strong><?php echo $job->emmet_jobs_shift; ?></div>
     <?php endif;?>
+    
     <div><?php echo apply_filters('the_content', $job->post_content);?></div>
 
     <?php if($job->emmet_jobs_code):?>
     <div><strong>Job Code: </strong><?php echo $job->emmet_jobs_code; ?></div>
     <?php endif;?>
+    
+    <?php if($job->emmet_jobs_contact):?>
+    <div><strong>Contact: </strong><?php echo $job->emmet_jobs_contact; ?></div>
+    <?php endif;?>
+    <?php if($job->emmet_jobs_phone):?>
+    <div><strong>Phone: </strong><?php echo $job->emmet_jobs_phone; ?></div>
+    <?php endif;?>
+    <?php if($job->emmet_jobs_email):?>
+    <div><strong>Email: </strong><a href="mailto: <?php echo $job->emmet_jobs_email; ?>"><?php echo $job->emmet_jobs_email; ?></a></div>
+    <?php endif;?>
 
     <a target="_blank" href="<?php echo get_template_directory_uri();?>/assets/employment-form.pdf">Employment Application</a>