$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) {
$this->search_form();
$this->list_jobs();
}
+ $output = ob_get_contents();
+ ob_end_clean();
+ return $output;
}
/**
'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';
}
--- /dev/null
+
+#post-query-submit,
+#post-search-input,
+#search-submit {
+ display:none;
+}
/**
* 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');
}
--- /dev/null
+<?php
+
+/*
+ * A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID.
+ *
+ * See http://core.trac.wordpress.org/ticket/13258
+ *
+ * Usage, as normal:
+ * wp_dropdown_categories($args);
+ *
+ * But specify the custom walker class, and (optionally) a 'id' or 'slug' for the 'value' parameter:
+ * $args=array('walker'=> 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 <option>.
+ */
+class SH_Walker_TaxonomyDropdown
+ extends Walker_CategoryDropdown
+{
+
+ function start_el(&$output, $category, $depth, $args)
+ {
+ $pad = str_repeat(' ', $depth * 3);
+ $cat_name = apply_filters('list_cats', $category->name, $category);
+ if (!isset($args['value'])) {
+ $args['value'] = ( $category->taxonomy != 'category'
+ ? 'slug'
+ : 'id' );
+ }
+ $value = ($args['value'] == 'slug'
+ ? $category->slug
+ : $category->term_id );
+ $output .= "\t<option class=\"level-$depth\" value=\"" . $value . "\"";
+ if ($value === (string) $args['selected']) {
+ $output .= ' selected="selected"';
+ }
+ $output .= '>';
+ $output .= $pad . $cat_name;
+ if ($args['show_count'])
+ $output .= ' (' . $category->count . ')';
+ $output .= "</option>\n";
+ }
+
+}
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;
}
/**
*/
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 '<pre>'.print_r($queries, true).'</pre>';
+// 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 '<pre>'.print_r($qv, true).'</pre>';
+
+ }
+// echo '<pre>'.print_r($query, true).'</pre>';
+ }
+
+
+ return $query;
}
- return $query;
+
}
/**
'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);
-<a href="#">Back To Search</a>
+<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>
<div><strong>Status: </strong><?php echo $job->glm_jobs_status; ?></div>
-<style>
- #job_search {width: 100%;padding: 2%;}
- #cat_id_wrapper {width: 45%;float:left;}
- #status_wrapper {width: 45%;float:right;}
- #submit_wrapper, input[type="submit"] {width: 100%;text-align: center;}
-</style>
-
<h2>Employment Search</h2>
<form name="job_search" id="job_search" action="<?php echo $form_url;?>" method="post">
- <div id="cat_id_wrapper">
- <div id="cat_id_label">Search by Category</div>
- <div id="cat_wrap">
+ <input type="hidden" name="glm_job_search" value="1">
+ <div class="row">
+ <div class="small-12 medium-5 columns">
+ <label>Search by Category</label>
<?php wp_dropdown_categories( $cat_args );?>
</div>
- </div>
- <div id="status_wrapper">
- <div id="status_label">Search by Department</div>
- <div id="dept_wrap">
+ <div class="small-12 medium-5 columns">
+ <label>Search by Department</label>
<?php wp_dropdown_categories( $dep_args );?>
</div>
+ <div class="small-12 medium-2 columns">
+ <input class="button" type="submit" value="Search">
+ </div>
</div>
- <div id="submit_wrapper"><input type="submit" value="Search"></div>
</form>
\ No newline at end of file