From: Steve Sutton Date: Tue, 1 Dec 2015 20:28:10 +0000 (-0500) Subject: Updating the taxonomy name to properties and redo the form to use them. X-Git-Tag: vt0.1.0^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=0a749f825a82d0c0c9a8195f08421b91a622aaa9;p=WP-Plugins%2Fstaffords-employment.git Updating the taxonomy name to properties and redo the form to use them. The form is now using these properties to build the form and will select them off if the job is assigned to them. --- diff --git a/config/settings1.php b/config/settings1.php index 67c0d03..3102a3c 100644 --- a/config/settings1.php +++ b/config/settings1.php @@ -209,37 +209,25 @@ $salary_desired = [ 'label' => 'Salary Desired', 'grid' => 6 ]; +$properties = get_terms(STAFFORDS_EMP_TAX_DEPARTMENTS, array( + 'heirarchical' => false, + 'hide_empty' => false +)); +$opts = array(); +foreach ( $properties as $term ) { + $opts[] = array( + 'name' => 'location_preference_' . $term->slug, + 'label' => $term->name, + 'value' => $term->name + ); +} $location_preference = [ 'type' => 'checkbox', 'name' => 'location_preference', 'label' => 'Property', - 'grid' => 12, + 'grid' => 12, 'req' => false, - 'opts' => [[ - 'name' => 'location_preference_bayview', - 'label' => 'Bay View Inn', - 'value' => 'Bay View Inn' - ],[ - 'name' => 'location_preference_crookedriver', - 'label' => 'Crooked River Lodge', - 'value' => 'Crooked River Lodge' - ],[ - 'name' => 'location_preference_perryhotel', - 'label' => 'Perry Hotel', - 'value' => 'Perry Hotel' - ],[ - 'name' => 'location_preference_pier', - 'label' => 'Pier Restaurant', - 'value' => 'Pier Restaurant' - ],[ - 'name' => 'location_preference_weathervane', - 'label' => 'Weathervane Restaurant', - 'value' => 'Weathervane Restaurant' - ],[ - 'name' => 'location_preference_drawbridge', - 'label' => 'Drawbridge Bistro', - 'value' => 'Drawbridge Bistro' - ]] + 'opts' => $opts ]; $high_school_name = [ 'type' => 'text', diff --git a/controllers/front.php b/controllers/front.php index b4886c8..17f069c 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -161,6 +161,26 @@ class staffords_employment_front } $formPart = 1; $form = $this->load_form_settings($formPart); + $termArray = array(); + if ( $jobId ) { + $terms = wp_get_post_terms( $jobId, STAFFORDS_EMP_TAX_DEPARTMENTS, 'name' ); + foreach ($terms as $term) { + $termArray[] = $term->name; + } + if ( !empty( $termArray ) ) { + foreach ( $form as $key => $formPart ) { + if ( is_array( $formPart[0] ) && $formPart[0]['name'] == 'location_preference' ) { + foreach ( $termArray as $termName ) { + foreach ( $formPart[0]['opts'] as $optkey => $option ) { + if ( $option['label'] == $termName ) { + $form[$key][0]['opts'][$optkey]['checked'] = 'checked'; + } + } + } + } + } + } + } include $this->frontViewDir . '/' . self::FORM_TEMPLATE; break; } diff --git a/models/job.php b/models/job.php index 3905b29..8f107ec 100644 --- a/models/job.php +++ b/models/job.php @@ -436,19 +436,19 @@ class staffords_employment_job )); $labels = array( - 'name' => _x('Departments', + 'name' => _x('Properties', 'taxonomy general name'), - 'singular_name' => _x('Department', + 'singular_name' => _x('Property', 'taxonomy singular name'), - 'search_items' => __('Search Departments'), - 'popular_items' => __('Popular Departments'), - 'all_items' => __('All Departments'), + 'search_items' => __('Search Properties'), + 'popular_items' => __('Popular Properties'), + 'all_items' => __('All Properties'), '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'), + 'edit_item' => __('Edit Property'), + 'update_item' => __('Update Property'), + 'add_new_item' => __('Add New Property'), + 'new_item_name' => __('New Property 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'), @@ -457,7 +457,7 @@ class staffords_employment_job register_taxonomy( STAFFORDS_EMP_TAX_DEPARTMENTS, STAFFORDS_EMP_POST_TYPE, array( - 'label' => __('Job Department'), + 'label' => __('Job Property'), 'labels' => $labels, 'hierarchical' => true, 'show_ui' => true, @@ -479,7 +479,7 @@ class staffords_employment_job "cb" => "", "title" => "Job Title", "glmjobs_col_cat" => "Category", - "glmjobs_col_dep" => "Department", + "glmjobs_col_dep" => "Property", "glmjobs_col_date" => "Dates", ); return $columns; diff --git a/views/front/formTemplate.php b/views/front/formTemplate.php index a520a51..cd7fe1d 100644 --- a/views/front/formTemplate.php +++ b/views/front/formTemplate.php @@ -115,7 +115,9 @@ - + + + diff --git a/views/front/jobSearch.php b/views/front/jobSearch.php index 7dbaa99..39f5389 100644 --- a/views/front/jobSearch.php +++ b/views/front/jobSearch.php @@ -7,11 +7,11 @@
- +
- \ No newline at end of file +