From cdc2b0876ce26a1b344cecac7b10277c10a01dd1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 18 Dec 2014 08:34:44 -0500 Subject: [PATCH] Hide elements for search jobs in admin side --- controllers/front.php | 7 ++- css/glm_jobs.css | 6 +++ glm-employment.php | 14 ++++-- models/SH_Walker_TaxonomyDropdown.php | 44 ++++++++++++++++++ models/job.php | 65 ++++++++++++++++++++------- views/front/jobDetail.php | 2 +- views/front/jobSearch.php | 24 ++++------ 7 files changed, 124 insertions(+), 38 deletions(-) create mode 100644 css/glm_jobs.css create mode 100644 models/SH_Walker_TaxonomyDropdown.php diff --git a/controllers/front.php b/controllers/front.php index ff5ff84..3307d4e 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -83,6 +83,8 @@ class glm_employment_front $job_id = (isset($_REQUEST['job'])) ? filter_var($_REQUEST['job'], FILTER_VALIDATE_INT) : false; + + ob_start(); if ($applyOnline) { $this->show_apply_form(); } else if ($job_id) { @@ -91,6 +93,9 @@ class glm_employment_front $this->search_form(); $this->list_jobs(); } + $output = ob_get_contents(); + ob_end_clean(); + return $output; } /** @@ -524,7 +529,7 @@ class glm_employment_front 'taxonomy' => 'glm_jobsdepartment', 'hide_if_empty' => false, ); - $form_url = home_url() . '/searchJobs/?search=1'; + $form_url = get_permalink(); $categories = get_terms('glm_jobscategory'); include $this->frontViewDir . '/jobSearch.php'; } diff --git a/css/glm_jobs.css b/css/glm_jobs.css new file mode 100644 index 0000000..f8f5a0b --- /dev/null +++ b/css/glm_jobs.css @@ -0,0 +1,6 @@ + +#post-query-submit, +#post-search-input, +#search-submit { + display:none; +} diff --git a/glm-employment.php b/glm-employment.php index 247b1d5..56f88a0 100644 --- a/glm-employment.php +++ b/glm-employment.php @@ -71,11 +71,17 @@ $employmentApp = new glm_employment_setup(); /** * Load style sheet for displaying the view and print for the application forms */ -function glm_load_style() +function glm_load_view_style() { - wp_enqueue_style('foundation', - plugin_dir_url(__FILE__) . 'css/foundation.css'); + wp_enqueue_style('foundation', plugin_dir_url(__FILE__) . 'css/foundation.css'); +} +function glm_load_edit_style() +{ + wp_enqueue_style('glm_jobs', plugin_dir_url(__FILE__) . 'css/glm_jobs.css'); } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'view') { - add_action('admin_enqueue_scripts', 'glm_load_style'); + add_action('admin_enqueue_scripts', 'glm_load_view_style'); +} +if (isset($_REQUEST['post_type']) && $_REQUEST['post_type'] == GLM_EMP_POST_TYPE) { + add_action('admin_enqueue_scripts', 'glm_load_edit_style'); } diff --git a/models/SH_Walker_TaxonomyDropdown.php b/models/SH_Walker_TaxonomyDropdown.php new file mode 100644 index 0000000..4b89299 --- /dev/null +++ b/models/SH_Walker_TaxonomyDropdown.php @@ -0,0 +1,44 @@ + new SH_Walker_TaxonomyDropdown(), 'value'=>'slug', .... ); + * wp_dropdown_categories($args); + * + * If the 'value' parameter is not set it will use term ID for categories, and the term's slug for other taxonomies in the value attribute of the term's \n"; + } + +} diff --git a/models/job.php b/models/job.php index c3d9022..941ea4d 100644 --- a/models/job.php +++ b/models/job.php @@ -31,8 +31,20 @@ class glm_employment_job add_action('admin_init', array($this, 'metaDates')); add_action('save_post', array($this, 'saveEmpMeta')); add_filter('manage_edit-glm_jobs_sortable_columns', array($this, 'sortingColumns')); - add_action('restrict_manage_posts', array($this, 'jobFilterList')); - add_filter('parse_query', array($this, 'jobFilter')); +// add_action('restrict_manage_posts', array($this, 'jobFilterList')); +// add_filter('parse_query', array($this, 'jobFilter')); + add_filter('user_row_actions', array($this, 'remove_row_actions')); + } + + public function remove_row_actions($actions, $post) + { + global $curren_screen; + if ($curren_screen->post_type != GLM_EMP_POST_TYPE) { + return $actions; + } + unset($actions['view']); + unset($actions['inline hide-if-no-js']); + return $actions; } /** @@ -59,21 +71,40 @@ class glm_employment_job */ public function jobFilter($query) { - $qv =& $query->query_vars; + if (isset($_REQUEST['post_type']) && $_REQUEST['post_type'] == GLM_EMP_POST_TYPE) { + $qv =& $query->query_vars; + if (isset($qv['post_type']) && $qv['post_type'] == GLM_EMP_POST_TYPE) { + if (isset($qv[GLM_EMP_TAX_CATEGORIES]) && $qv[GLM_EMP_TAX_CATEGORIES] != 0) { + $term = get_term_by('id',$qv[GLM_EMP_TAX_CATEGORIES],GLM_EMP_TAX_CATEGORIES); + $qv[GLM_EMP_TAX_CATEGORIES] = $term->slug; - if (isset($qv['post_type']) && $qv['post_type'] == GLM_EMP_POST_TYPE - && isset($qv[GLM_EMP_TAX_CATEGORIES]) && $qv[GLM_EMP_TAX_CATEGORIES] != 0 - ) { - $term = get_term_by('id',$qv[GLM_EMP_TAX_CATEGORIES],GLM_EMP_TAX_CATEGORIES); - $qv[GLM_EMP_TAX_CATEGORIES] = $term->slug; - } - if (isset($qv['post_type']) && $qv['post_type'] == GLM_EMP_POST_TYPE - && isset($qv[GLM_EMP_TAX_DEPARTMENTS]) && $qv[GLM_EMP_TAX_DEPARTMENTS] != 0 - ) { - $term = get_term_by('id',$qv[GLM_EMP_TAX_DEPARTMENTS],GLM_EMP_TAX_DEPARTMENTS); - $qv[GLM_EMP_TAX_DEPARTMENTS] = $term->slug; +// if (isset($query->tax_query)) { +// $tax_query =& $query->tax_query; +// $queries =& $tax_query->queries; +//// echo '
'.print_r($queries, true).'
'; +// foreach ($queries as $key => &$qs) { +// if ($qs['taxonomy'] == GLM_EMP_TAX_CATEGORIES) { +// $qs['terms'][$key] = $term->slug; +// } +// } +// } + + } + if (isset($qv[GLM_EMP_TAX_DEPARTMENTS]) && $qv[GLM_EMP_TAX_DEPARTMENTS] != 0) { + $term = get_term_by('id',$qv[GLM_EMP_TAX_DEPARTMENTS],GLM_EMP_TAX_DEPARTMENTS); + $qv[GLM_EMP_TAX_DEPARTMENTS] = $term->slug; + } + if ($qv['post_type'] == GLM_EMP_POST_TYPE) { +// echo '
'.print_r($qv, true).'
'; + + } +// echo '
'.print_r($query, true).'
'; + } + + + return $query; } - return $query; + } /** @@ -248,10 +279,10 @@ class glm_employment_job 'supports' => array('title', 'editor'), 'has_archive' => true, 'menu_icon' => 'dashicons-businessman', - 'capability_type' => 'post', + 'capability_type' => 'page', 'hierarchical' => false, 'rewrite' => array('slug' => 'jobs'), -// 'taxonomies' => array(GLM_EMP_TAX_CATEGORIES, GLM_EMP_TAX_DEPARTMENTS), + 'taxonomies' => array(GLM_EMP_TAX_CATEGORIES, GLM_EMP_TAX_DEPARTMENTS), 'show_in_menu' => true ); register_post_type(GLM_EMP_POST_TYPE, $args); diff --git a/views/front/jobDetail.php b/views/front/jobDetail.php index bb4d10f..233c520 100644 --- a/views/front/jobDetail.php +++ b/views/front/jobDetail.php @@ -1,4 +1,4 @@ -Back To Search +Back To Search

post_title; ?>

Status: glm_jobs_status; ?>
diff --git a/views/front/jobSearch.php b/views/front/jobSearch.php index 85b9dfa..7dbaa99 100644 --- a/views/front/jobSearch.php +++ b/views/front/jobSearch.php @@ -1,23 +1,17 @@ - -

Employment Search