Updates for the taxonomy names.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 7 Dec 2015 21:31:25 +0000 (16:31 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 7 Dec 2015 21:31:25 +0000 (16:31 -0500)
Setup defines for these and use theme.

assets/click-here-to-print.jpg [new file with mode: 0644]
controllers/front.php
css/admin-print-application.css
glm-employment.php
models/job.php
views/admin/view-application.php
views/front/formTemplate.php
views/front/jobDetail.php
views/front/jobList.php
views/front/jobSearch.php

diff --git a/assets/click-here-to-print.jpg b/assets/click-here-to-print.jpg
new file mode 100644 (file)
index 0000000..05ea0fa
Binary files /dev/null and b/assets/click-here-to-print.jpg differ
index 30aea10..4a84ed8 100644 (file)
@@ -337,20 +337,28 @@ class glm_employment_front
                 if (in_array($field['name'], array('fname', 'lname', 'mname'))) {
                     $this->$field['name'] = $form[$rowKey][$fieldKey]['value'];
                 }
-                if (   ($field['type'] == 'checkbox' || $field['type'] == 'radio')
-                    && isset($field['opts']) && !empty($field['opts'])
+                if (   ($field['type'] == 'radio') && isset($field['opts']) && !empty($field['opts'])
                 ) {
 
                     foreach ($field['opts'] as $opKey => $option) {
                         if (isset($_POST[$field['name']])) {
                             $form[$rowKey][$fieldKey]['opts'][$opKey]['checked'] = true;
-                            if ($field['type'] == 'checkbox') {
-                                $_POST[$option['name']] = $option['value'];
-                            }
-
                         }
                     }
                 }
+                if (   ($field['type'] == 'checkbox') && isset($field['opts']) && !empty($field['opts'])
+                ) {
+                    $checkboxOptions = array();
+                    foreach ($field['opts'] as $opKey => $option) {
+                        if (isset($_POST[$option['name']])) {
+                            $form[$rowKey][$fieldKey]['opts'][$opKey]['checked'] = true;
+                            $_POST[$option['name']][] = $option['value'];
+                            $checkboxOptions[] = $option['value'];
+                        }
+                    }
+                    $form[$rowKey][$fieldKey]['value'][] = implode(', ', $checkboxOptions);
+                    $checkboxOptions = array();
+                }
                 if (   isset($field['req'])
                     && $field['req'] == true
                     && $_POST[$field['name']] == ''
@@ -360,8 +368,7 @@ class glm_employment_front
                     ++$this->errorCount;
                 }
 
-                if (   isset($field['rule'])
-                    && $_POST[$field['name']] != ''
+                if (   isset($field['rule']) && $_POST[$field['name']] != ''
                 ) {
                     switch ($field['rule']) {
                     case 'email':
@@ -406,6 +413,14 @@ class glm_employment_front
         global $wpdb, $wp;
         $job    = get_post($job_id);
         $custom = get_post_custom($job->ID);
+        $depTax = wp_get_post_terms( $job->ID, GLM_EMP_TAX_DEPARTMENTS, 'name' );
+        foreach ($depTax as $depTerm) {
+            $deps[] = $depTerm->name;
+        }
+        $catTax = wp_get_post_terms( $job->ID, GLM_EMP_TAX_CATEGORIES, 'name' );
+        foreach ($catTax as $catTerm) {
+            $cats[] = $catTerm->name;
+        }
         $job->glm_jobs_startdate = $custom['glm_jobs_startdate'][0];
         $job->glm_jobs_enddate   = $custom['glm_jobs_enddate'][0];
         $job->glm_jobs_contact   = $custom['glm_jobs_contact'][0];
@@ -415,6 +430,8 @@ class glm_employment_front
         $job->glm_jobs_email     = $custom['glm_jobs_email'][0];
         $job->glm_jobs_comments  = $custom['glm_jobs_comments'][0];
         $job->glm_jobs_code      = $custom['glm_jobs_code'][0];
+        $job->glm_jobs_property  = $deps;
+        $job->glm_jobs_category  = $cats;
         $current_url             = esc_url(add_query_arg($wp->query_string, '', home_url($wp->request)));
         $applyOnlineHref         = $current_url
                 . ((strpos($current_url, '?')) ? '&' : '?')
@@ -443,6 +460,7 @@ class glm_employment_front
             ? filter_var($_REQUEST['glm_jobsdepartment'])
             : false;
         $args = array(
+            'posts_per_page' => -1,
             'post_type' => GLM_EMP_POST_TYPE,
             'meta_query' => array(
                 array(
@@ -481,7 +499,16 @@ class glm_employment_front
         $current_url = esc_url(add_query_arg($wp->query_string, '', home_url($wp->request)));
         $iterator = 1;
         foreach ($jobs as $job) {
+            $deps = $cats = array();
             $custom = get_post_custom($job->ID);
+            $depTax = wp_get_post_terms( $job->ID, GLM_EMP_TAX_DEPARTMENTS, 'name' );
+            foreach ($depTax as $depTerm) {
+                $deps[] = $depTerm->name;
+            }
+            $catTax = wp_get_post_terms( $job->ID, GLM_EMP_TAX_CATEGORIES, 'name' );
+            foreach ($catTax as $catTerm) {
+                $cats[] = $catTerm->name;
+            }
             $job->end                = false;
             $job->glm_jobs_startdate = $custom['glm_jobs_startdate'][0];
             $job->glm_jobs_enddate   = $custom['glm_jobs_enddate'][0];
@@ -492,6 +519,8 @@ class glm_employment_front
             $job->glm_jobs_email     = $custom['glm_jobs_email'][0];
             $job->glm_jobs_comments  = $custom['glm_jobs_comments'][0];
             $job->glm_jobs_code      = $custom['glm_jobs_code'][0];
+            $job->glm_jobs_property  = $deps;
+            $job->glm_jobs_category  = $cats;
             $job->href               = $current_url
                 . ((strpos($current_url, '?')) ? '&' : '?')
                 . "job=" . $job->ID;
index 5dd923d..62bcdbb 100644 (file)
@@ -22,8 +22,8 @@
     width: 91.66667%; }
 .large-12 {
     width: 100%; }
-#adminmenuback, #adminmenuwrap, #wpadminbar, #wpfooter {
-    display: none;
+#adminmenu, #adminmenuback, #adminmenuwrap, #wpadminbar, #wpfooter, .updated, #print-this-page {
+    display: none !important;
 }
 #appForm {
     width: 100%;
index 8f4b1f9..a081020 100644 (file)
@@ -17,7 +17,11 @@ define('GLM_EMP_VERSION', '0.0.1');
 define('GLM_EMP_VRS_OPTION_NAME', 'glm_jobs_db_version');
 define('GLM_EMP_POST_TYPE', 'glm_jobs');
 define('GLM_EMP_TAX_CATEGORIES', 'glm_jobscategory');
+define('GLM_EMP_CATEGORY_SINGLE', 'Category');
+define('GLM_EMP_CATEGORY_PLURAL', 'Categories');
 define('GLM_EMP_TAX_DEPARTMENTS', 'glm_jobsdepartment');
+define('GLM_EMP_DEPARTMENT_SINGLE', 'Department');
+define('GLM_EMP_DEPARTMENT_PLURAL', 'Departments');
 define('GLM_EMP_APPLICATION_TABLE', 'glm_jobs_application');
 define('GLM_EMP_FORM_TABLE', 'glm_jobs_app_form');
 $wp_upload_dir = wp_upload_dir();
index 21eb477..8c1b71d 100644 (file)
@@ -328,7 +328,7 @@ class glm_employment_job
             'menu_name'          => 'Jobs'
         );
         $args   = array(
-//            'label'           => __('Jobs'),
+            'label'           => __('Jobs'),
             'labels'          => $labels,
             'description'     => 'Stores Jobs and Job data',
             'public'          => true,
@@ -367,7 +367,7 @@ class glm_employment_job
     {
         global $post, $post_ID;
 
-        $messages['post'] = array(
+        $messages['glm_jobs'] = array(
             0  => '', // Unused. Messages start at index 1.
             1  => sprintf(__('Job updated. <a href="%s">View item</a>'),
                              esc_url(get_permalink($post_ID))),
@@ -404,28 +404,28 @@ class glm_employment_job
     public function createJobTaxonomy()
     {
         $labels = array(
-            'name'                       => _x('Categories',
+            'name'                       => _x(GLM_EMP_CATEGORY_PLURAL,
                                                'taxonomy general name'),
-            'singular_name'              => _x('Category',
+            'singular_name'              => _x(GLM_EMP_CATEGORY_SINGLE,
                                                'taxonomy singular name'),
-            'search_items'               => __('Search Categories'),
-            'popular_items'              => __('Popular Categories'),
-            'all_items'                  => __('All Categories'),
+            'search_items'               => __('Search' . GLM_EMP_CATEGORY_PLURAL),
+            'popular_items'              => __('Popular ' . GLM_EMP_CATEGORY_PLURAL),
+            'all_items'                  => __('All ' . GLM_EMP_CATEGORY_PLURAL),
             'parent_item'                => null,
             'parent_item_colon'          => null,
-            'edit_item'                  => __('Edit Category'),
-            'update_item'                => __('Update Category'),
-            'add_new_item'               => __('Add New Category'),
-            'new_item_name'              => __('New Category Name'),
-            'separate_items_with_commas' => __('Separate categories with commas'),
-            'add_or_remove_items'        => __('Add or remove categories'),
-            'choose_from_most_used'      => __('Choose from the most used categories'),
+            'edit_item'                  => __('Edit ' . GLM_EMP_CATEGORY_SINGLE),
+            'update_item'                => __('Update ' . GLM_EMP_CATEGORY_SINGLE),
+            'add_new_item'               => __('Add New ' . GLM_EMP_CATEGORY_SINGLE),
+            'new_item_name'              => __('New ' . GLM_EMP_CATEGORY_SINGLE . ' Name'),
+            'separate_items_with_commas' => __('Separate ' . strtolower( GLM_EMP_CATEGORY_PLURAL ) . ' with commas'),
+            'add_or_remove_items'        => __('Add or remove ' . strtolower( GLM_EMP_CATEGORY_PLURAL )),
+            'choose_from_most_used'      => __('Choose from the most used ' . strtolower( GLM_EMP_CATEGORY_PLURAL )),
         );
 
         register_taxonomy(
             GLM_EMP_TAX_CATEGORIES, GLM_EMP_POST_TYPE,
             array(
-            'label'             => __('Job Category'),
+        'label'             => __('Job ' . GLM_EMP_CATEGORY_SINGLE),
             'labels'            => $labels,
             'hierarchical'      => true,
             'show_ui'           => true,
@@ -436,28 +436,28 @@ class glm_employment_job
         ));
 
         $labels = array(
-            'name'                       => _x('Departments',
+            'name'                       => _x(GLM_EMP_DEPARTMENT_PLURAL,
                                                'taxonomy general name'),
-            'singular_name'              => _x('Department',
+            'singular_name'              => _x(GLM_EMP_DEPARTMENT_SINGLE,
                                                'taxonomy singular name'),
-            'search_items'               => __('Search Departments'),
-            'popular_items'              => __('Popular Departments'),
-            'all_items'                  => __('All Departments'),
+            'search_items'               => __('Search ' . GLM_EMP_DEPARTMENT_PLURAL),
+            'popular_items'              => __('Popular ' . GLM_EMP_DEPARTMENT_PLURAL),
+            'all_items'                  => __('All ' . GLM_EMP_DEPARTMENT_PLURAL),
             'parent_item'                => null,
             'parent_item_colon'          => null,
-            'edit_item'                  => __('Edit Department'),
-            'update_item'                => __('Update Department'),
-            'add_new_item'               => __('Add New Department'),
-            'new_item_name'              => __('New Department Name'),
-            'separate_items_with_commas' => __('Separate departments with commas'),
-            'add_or_remove_items'        => __('Add or remove departments'),
-            'choose_from_most_used'      => __('Choose from the most used departments'),
+            'edit_item'                  => __('Edit ' . GLM_EMP_DEPARTMENT_SINGLE),
+            'update_item'                => __('Update ' . GLM_EMP_DEPARTMENT_SINGLE),
+            'add_new_item'               => __('Add New ' . GLM_EMP_DEPARTMENT_SINGLE),
+            'new_item_name'              => __('New ' . GLM_EMP_DEPARTMENT_SINGLE . ' Name'),
+            'separate_items_with_commas' => __('Separate ' . strtolower( GLM_EMP_DEPARTMENT_PLURAL ) . ' with commas'),
+            'add_or_remove_items'        => __('Add or remove ' . strtolower( GLM_EMP_DEPARTMENT_PLURAL )),
+            'choose_from_most_used'      => __('Choose from the most used ' . strtolower( GLM_EMP_DEPARTMENT_PLURAL )),
         );
 
         register_taxonomy(
             GLM_EMP_TAX_DEPARTMENTS, GLM_EMP_POST_TYPE,
             array(
-            'label'        => __('Job Department'),
+            'label'        => __('Job ' . GLM_EMP_DEPARTMENT_SINGLE),
             'labels'       => $labels,
             'hierarchical' => true,
             'show_ui'      => true,
index 8095610..8d8337f 100644 (file)
@@ -1,5 +1,6 @@
-<link rel="stylesheet" href="../wp-content/plugins/glm-employment/css/admin-view-application.css" type="text/css"/>
-<link rel="stylesheet" href="../wp-content/plugins/glm-employment/css/admin-print-application.css" type="text/css" media="print" />
+<link rel="stylesheet" href="<?php echo plugins_url( basename( $this->pluginDirName ) ); ?>/css/admin-view-application.css" type="text/css"/>
+<link rel="stylesheet" href="<?php echo plugins_url( basename( $this->pluginDirName ) ); ?>/css/admin-print-application.css" type="text/css" media="print" />
+<a href="javascript:window.print();" id="print-this-page"><img src="<?php echo plugins_url( basename( $this->pluginDirName ) ); ?>/assets/click-here-to-print.jpg"></a>
 <div id="appForm">
     <?php include $viewPath . 'form_1.php';?>
 </div>
index b3c5728..91f8c2a 100644 (file)
@@ -1,22 +1,11 @@
 <style>
-    div.static {
-        text-align:left;
-        padding-top: 5px;
-    }
-    .row.content ul.glm-emp-forms-ul {
-        columns: 1;
-        -moz-columns: 1;
-        -webkit-columns: 1;
-        margin-left: auto;
-        margin-right: auto;
-        padding-left: 20px;
-    }
-    input[type="checkbox"] {
-        margin-top: 10px;
-    }
+    div.static {text-align:left;padding-top: 5px;}
+    .row.content ul.glm-emp-forms-ul {columns: 1;-moz-columns: 1;-webkit-columns: 1;margin-left:auto;margin-right:auto;padding-left: 20px;}
+    input[type="checkbox"] {margin-top: 10px; }
     .row h4 {padding-top: 0;}
+    #glm-job-form-wrap input[type=radio]+label {margin-left:0;}
 </style>
-<div class="row">
+<div class="row" id="glm-job-form-wrap">
     <div class="small-12 columns">
         <h1><?php if(isset($formTitle)) {echo $formTitle;}?></h1>
         <form method="post" action="<?php echo $formAction;?>" enctype="multipart/form-data">
             <?php if (isset($jobId) && $jobId):?>
             <input type="hidden" name="job" value="<?php echo $jobId;?>">
             <?php endif;?>
-            <?php foreach($form as $row):?>
+            <?php $totalFormRows = count( $form ); $fRowCounter = 0;?>
+            <?php foreach($form as $row): // $form foreach ?>
+            <?php ++$fRowCounter;?>
             <?php if (isset($row['type']) && $row['type'] == 'header') :?>
-                <h3><?php echo $row['label'];?></h3>
+                    <?php if ( $fRowCounter != 1 ) : ?>
+                    </div>
+                    <?php endif;?>
+                    <h3><?php echo $row['label'];?></h3>
+                    <div class="panel radius">
                 <?php if (isset($row['subheader']) && $row['subheader']) {?>
                     <h4 class="subheader"><?php echo $row['subheader'];?></h4>
                 <?php }?>
             <?php else:?>
                 <div class="row<?php echo (isset($row[0]['rcoll']) && $row[0]['rcoll'])?' collapse':'';?>">
                     <?php foreach($row as $field) :?>
-                    <div class="small-<?php echo $field['grid'];?> columns">
+                    <div class="small-12 medium-<?php echo $field['grid'];?> columns">
                         <label<?php if (isset($field['req']) && $field['req']):?> class="error"<?php endif;?>>
-                            <?php if(isset($field['label'])) { echo $field['label'];}?>
+                            <?php if ( isset( $field['label'] ) ) {
+                                    if ( $field['type'] == 'static' ) {
+                                        echo '<span class="show-for-medium-up">' . $field['label'] . '</span>';
+                                    } else {
+                                        echo $field['label'];
+                                    }
+                                    if ( $field['label'] == '' && $field ['hdr'] ) {
+                                        echo '<span class="show-for-small-only">' . $field['hdr']['label'] . '</span>';
+                                    }
+                                }?>
                         </label>
                             <?php switch($field['type']) :
                             case 'text':?>
                                 <?php endforeach;?>
                             <?php break;?>
                             <?php case 'checkbox':?>
-                                <?php foreach($field['opts'] as $option) :?>
+                                <?php $opCounter = 1; $totalOpts = count($field['opts']);?>
+                                <?php foreach($field['opts'] as $option) :?><label for="<?php echo $option['name'];?>"
+                                    class="small-12 medium-6 large-4 columns<?php if ($opCounter == $totalOpts) {echo ' end';}?>">
                                     <input
                                         <?php if (isset($field['error']) && $field['error']){echo 'class="error"';}?>
                                         <?php if (isset($field['req']) && $field['req']){echo 'required';}?>
                                         <?php if (isset($option['checked']) && $option['checked']) {
                                             echo 'checked';
                                         }?> />
-                                    <label for="<?php echo $option['name'];?>"><?php echo $option['label'];?></label>
+                                    <?php echo $option['label'];?></label>
+                                    <?php ++$opCounter;?>
                                 <?php endforeach;?>
                             <?php break;?>
                             <?php endswitch;?>
                     <?php endforeach;?>
                 </div>
             <?php endif;?>
-            <?php endforeach;?>
+            <?php if ( $fRowCounter == $totalFormRows ) { ?>
+                </div>
+            <?php } ?>
+            <?php endforeach; // $form endforeach ?>
             <div class="row">
-                <div>
+                <div class="small-12 small-text-center columns">
+                    <?php if ( $endOfForms == true ) : ?>
+                    <input type="submit" class="button" value="Submit">
+                    <?php else : ?>
                     <input type="submit" class="button" value="Continue">
+                    <?php endif;?>
                 </div>
             </div>
         </form>
index 752537c..09934f0 100644 (file)
@@ -1,9 +1,32 @@
-<a href="<?php echo get_permalink();?>">Back To Search</a>
 <div class="small-12 columns">
-    <h2><a href="<?php echo $job->href; ?>"><?php echo $job->post_title; ?></a></h2>
+    <a href="<?php echo get_permalink();?>">Back To Employment Search</a>
+    <br>
+    <br>
+</div>
+<div class="small-12 columns">
+    <h2><?php echo $job->post_title; ?></h2>
+    <?php if ($job->glm_jobs_property) : ?>
+    <div><strong>
+    <?php echo (count( $job->glm_jobs_property ) > 1 ) ? GLM_EMP_DEPARTMENT_PLURAL . ':' : GLM_EMP_DEPARTMENT_SINGLE . ':' ?> </strong>
+    <?php echo implode(', ', $job->glm_jobs_property);?>
+    </div>
+    <?php endif; ?>
+    <?php if ($job->glm_jobs_category) : ?>
+    <div><strong>
+    <?php echo (count( $job->glm_jobs_category ) > 1 ) ? GLM_EMP_CATEGORY_PLURAL . ':' : GLM_EMP_CATEGORY_SINGLE . ':' ?> </strong>
+    <?php echo implode(', ', $job->glm_jobs_category);?>
+    </div>
+    <?php endif; ?>
+    <?php if ($job->glm_jobs_status):?>
     <div><strong>Status: </strong><?php echo $job->glm_jobs_status; ?></div>
+    <?php endif;?>
+    <?php if ($job->glm_jobs_pay_grade):?>
     <div><strong>Pay Grade: </strong><?php echo $job->glm_jobs_pay_grade; ?></div>
+    <?php endif;?>
+    <?php if ($job->glm_jobs_email):?>
     <div><strong>Shift: </strong><?php echo $job->glm_jobs_shift; ?></div>
+    <?php endif;?>
+    <?php if ($job->glm_jobs_contact):?>
     <div><strong>Contact: </strong>
         <?php if ($job->glm_jobs_email):?>
         <a href="mailto: <?php echo $job->glm_jobs_email;?>">
@@ -13,6 +36,7 @@
         </a>
         <?php endif;?>
     </div>
+    <?php endif;?>
     <div><?php echo apply_filters('the_content', $job->post_content);?></div>
     <a href="<?php echo $applyOnlineHref;?>">Apply Online</a>
-</div>
\ No newline at end of file
+</div>
index 1cd1cc4..02774e2 100644 (file)
@@ -1,11 +1,20 @@
 <div>
-    <h1>List Jobs</h1>
     <div class="row">
         <?php if ($jobs): foreach($jobs as $job) :?>
-        <div class="small-12 medium-6 columns<?php if ($job->end){ echo ' end';}?>">
+        <div class="small-12 columns<?php if ($job->end){ echo ' end';}?>">
             <h2><a href="<?php echo $job->href;?>"><?php echo $job->post_title;?></a></h2>
-            <div><strong>Status: </strong><?php echo $job->glm_jobs_status;?></div>
-            <div><a href="<?php echo $job->href;?>">Full Job Description</a></div>
+            <?php if ($job->glm_jobs_property) : ?>
+            <div>
+            <?php echo (count( $job->glm_jobs_property ) > 1 ) ? GLM_EMP_DEPARTMENT_PLURAL . ':' : GLM_EMP_DEPARTMENT_SINGLE . ':' ?>
+            <?php echo implode(', ', $job->glm_jobs_property);?>
+            </div>
+            <?php endif; ?>
+            <?php if ($job->glm_jobs_category) : ?>
+            <div>
+            <?php echo (count( $job->glm_jobs_category ) > 1 ) ? GLM_EMP_CATEGORY_PLURAL . ':' : GLM_EMP_CATEGORY_SINGLE . ':' ?>
+            <?php echo implode(', ', $job->glm_jobs_category);?>
+            </div>
+            <?php endif; ?>
         </div>
         <?php endforeach; endif;?>
     </div>
index 7dbaa99..b12a496 100644 (file)
@@ -14,4 +14,4 @@
             <input class="button" type="submit" value="Search">
         </div>
     </div>
-</form>
\ No newline at end of file
+</form>