; Entry Status Types
;
job_expiration[30] = '30 Days'
-job_expiration[60] = '60 days'
\ No newline at end of file
+job_expiration[60] = '60 Days'
\ No newline at end of file
+.no-padding{
+ padding: 0;
+}
+.front-job-list-row{
+ margin-bottom: 20px;
+}
\ No newline at end of file
public function modelAction($actionData = false)
{
+ $members = new GlmDataMembers($this->wpdb, $this->config);
+ $member_list = $members->getList();
+
$job_titles = new GlmDataJobTitles($this->wpdb,$this->config);
$job_titles = $job_titles->getList();
- if( ! wp_script_is( 'jquery-ui', 'enqueued' ) ){
- wp_enqueue_script('jquery-ui-datepicker', false, array('jquery'), false, true);
- wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css');
+ $success_message = "";
+ $haveJob = false;
+ $option = false;
+ $job = false;
+ $job_data = false;
+ $jobUpdated = false;
+ $jobUpdateError = false;
+ $jobAdded = false;
+ $jobAddError = false;
+ $view_file = 'index';
+ $lockedToMember = false;
+ $isModerated = false;
+ $memberID = false;
+ $haveMember = false;
+ $where = '';
+
+ // Check if there's a logged in user who is locked to their own entity
+ $lockedToMember = apply_filters('glm_members_locked_to_member_id', false);
+ if ($lockedToMember) {
+
+ $isModerated = apply_filters('glm_user_is_moderated', $lockedToMember);
+ $memberID = $lockedToMember;
+
+ $this->fields['admin_name']['required'] = true;
+ $this->fields['admin_email']['required'] = true;
+ $this->fields['admin_phone']['required'] = true;
+
+ // Check for Member Menu Use
+ } elseif (defined('GLM_JOB_MEMBER_MENU')) {
+
+ // Try to get member ID
+ $memberID = (isset($_REQUEST['member']) ? $_REQUEST['member'] : 0);
+
+ // If there's no valid member ID, we can't continue
+ if ($memberID == 0) {
+ return array(
+ 'status' => false,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => array(
+ 'reason' => 'No member ID was provided.'
+ )
+ );
+ }
+ }
+
+ // If not a valid member ID
+ if ($memberID > 0) {
+
+ // Get base member information
+ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
+
+ $memberData = $members->getEntry($memberID);
+ $where .= "member = $memberID";
+ if (!$memberData) {
+ return array(
+ 'status' => false,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => array(
+ 'reason' => 'No member data found for provided member ID.'
+ )
+ );
+ } else{
+ $haveMember = true;
+ $memberName = $memberData['name'];
+ }
+
}
- $success_message = "";
- $haveJob = false;
- $option = false;
- $job = false;
- $jobUpdated = false;
- $jobUpdateError = false;
- $jobAdded = false;
- $jobAddError = false;
- $view_file = 'index';
+
if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
$option = $_REQUEST['option'];
}
if ($this->job_id <= 0) {
$this->job_id = false;
}
-
}
-
- $job_data = $this->getList();
+
+ $job_data = $this->getList($where);
// echo '<pre>', print_r($this->getList()), '</pre>';
// echo '<pre>', print_r($_REQUEST), '</pre>';
case 'edit':
$job = $this->editEntry($this->job_id);
-
+
// If we have a good Job
if ($job['status']) {
$haveJob = true;
$haveJob = true;
$view_file = 'edit';
-
+
break;
case 'delete':
$job_data = $this->getList();
break;
default:
- $job_data = $this->getList();
+ $job_data = $this->getList($where);
$view_file = 'index';
break;
}
// Compile template data
$templateData = array(
'jobData' => $job_data,
+ 'memberList' => $member_list,
+ 'lockedToMember' => $lockedToMember,
+ 'haveMember' => $haveMember,
+ 'memberID' => $memberID,
'jobTitles' => $job_titles,
'jobID' => $this->job_id,
'haveJob' => $haveJob,
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Job Postings
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Load Contacts data abstract
+require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobs.php';
+require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobTitles.php';
+
+class GlmMembersFront_jobs_detail extends GlmDatajobs
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Contact Info
+ *
+ * @var $contactInfo
+ * @access public
+ */
+ public $contactInfo = false;
+ /**
+ * Member ID
+ *
+ * @var $memberID
+ * @access public
+ */
+ public $memberID = false;
+ /**
+ * Contact ID
+ *
+ * @var $contactID
+ * @access public
+ */
+ public $contactID = false;
+ public $job_id;
+
+ /*
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ /*
+ * Run constructor for the Contacts data class
+ *
+ * Note, the third parameter is a flag that indicates to the Contacts
+ * data class that it should flag a group of fields as 'view_only'.
+ */
+ parent::__construct(false, false, true);
+
+
+ }
+
+ public function modelAction($actionData = false)
+ {
+ $job_titles = new GlmDataJobTitles($this->wpdb,$this->config);
+ $job_titles = $job_titles->getList();
+
+ $success_message = "";
+ $option = false;
+ if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+ $option = $_REQUEST['option'];
+ }
+ // get the Job id for use in the edit, add and delete options
+ // Get obit ID if supplied
+ if (isset($_REQUEST['job'])) {
+
+ // Make sure it's numeric
+ $this->job_id= ($_REQUEST['job'] - 0);
+
+ if ($this->job_id <= 0) {
+ $this->job_id = false;
+ }
+ }
+ $where = "id = $this->job_id";
+
+ $job = $this->getList($where);
+ foreach($job as $j){
+ $job = $j;
+ }
+ // Compile template data
+ $templateData = array(
+ 'jobData' => $job,
+ 'jobTitles' => $job_titles,
+ 'siteBaseUrl' => GLM_MEMBERS_JOBS_SITE_BASE_URL,
+ 'currentUrl' => GLM_MEMBERS_JOBS_PLUGIN_CURRENT_URL,
+ );
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'front/jobs/detail.html',
+ 'data' => $templateData
+ );
+ }
+}
// Load Contacts data abstract
require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobs.php';
+require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobTitles.php';
class GlmMembersFront_jobs_list extends GlmDatajobs
{
public function modelAction($actionData = false)
{
+ $job_titles = new GlmDataJobTitles($this->wpdb,$this->config);
+ $job_titles = $job_titles->getList();
+
$success_message = "";
$option = false;
if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
$option = $_REQUEST['option'];
}
- // separate the main Job info and the individual details
- $job_data = $this->getList();
- foreach($job_data as $id=>$record){
- foreach($record as $key=>$value){
- if(strpos($key, "Job") !== false){
- $jobs['trail_Job'][$id]['job_info'][$key] = $value;
- } else {
- $jobs['trail_Job'][$id]['trail_info'][$key] = $value;
- }
- }
+ if (isset($_REQUEST['job_titles']) && $_REQUEST['job_titles'] !== '') {
+ // Make sure it's numeric
+ $job_title_id = ($_REQUEST['job_titles'] - 0);
+ $where = "title = $job_title_id";
+ $job_data = $this->getList($where);
+ } else {
+ $job_data = $this->getList();
}
-// echo '<pre>', print_r($jobs), '</pre>';
- $view_file = 'list';
- switch ($option) {
-
- case "edit":
- $view_file = 'edit';
- break;
-
- default:
-
- break;
- }
-
+ $view_file = 'list';
-
// Compile template data
$templateData = array(
- 'jobData' => $jobs
+ 'jobData' => $job_data,
+ 'jobTitles' => $job_titles,
+ 'siteBaseUrl' => GLM_MEMBERS_JOBS_SITE_BASE_URL,
+ 'currentUrl' => GLM_MEMBERS_JOBS_PLUGIN_CURRENT_URL,
);
// Return status, any suggested view, and any data to controller
* is named the same as the "glm_action" parameter.
*
*/
-add_submenu_page(
- 'glm-members-admin-menu-members',
- 'Job Postings',
- 'Job Postings',
- 'edit_posts',
- 'glm-members-admin-menu-jobs-index',
- function(){$this->controller('jobs');}
-);
+ if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser']['contactUser']) && $this->config['loggedInUser']['contactUser']) {
+ add_submenu_page(
+ $mainMenuSlug,
+ 'Job Postings',
+ 'Job Postings',
+ 'glm_members_edit_my_entity',
+ 'glm-members-admin-menu-jobs-index',
+ function(){$this->controller('jobs');}
+ );
+} else {
+ add_submenu_page(
+ 'glm-members-admin-menu-members',
+ 'Job Postings',
+ 'Job Postings',
+ 'edit_posts',
+ 'glm-members-admin-menu-jobs-index',
+ function(){$this->controller('jobs');}
+ );
+}
*
* $permit is a boolean set before this function call for passing on permissions.
*/
+// Logged in all members manager user may edit an event for all members
+add_filter('glm_members_permit_admin_members_job',
+ function($permit) {
+ return glmMembersUserCan('glm_members_edit_any_member', $permit);
+ }
+);
+
+// Logged in member user may edit an event only for their own entity
+add_filter('glm_members_permit_admin_member_job',
+ function($permit) {
+ return glmMembersUserCan('glm_members_edit_my_member', $permit);
+ }
+);
*/
$glmMembersjobsShortcodes = array(
- 'glm-jobs' => array(
+ 'glm-members-jobs' => array(
'plugin' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
'menu' => 'jobs',
'action' => 'list',
'member_only' => true
)
),
+ 'glm-members-job-detail' => array(
+ 'plugin' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
+ 'menu' => 'jobs',
+ 'action' => 'detail',
+ 'table' => false,
+ 'attributes' => array(
+ 'id' => false,
+ )
+ ),
);
$glmMembersjobsShortcodesDescription = '';
),
'frontActions' => array(
'jobs' => array(
- 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG
+ 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
+ 'detail' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
),
)
);
{/if}
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="index">
-
{if $haveJob}
<input type="hidden" name="option" value="update">
<input type="hidden" name="job" value="{$job.fieldData.id}">
<!-- <input type="text" name="title">-->
</div>
</div>
- <!-- MEMBER -->
+ <!-- MEMBER for admins only-->
+ {if !$lockedToMember}
<div class="glm-job-row glm-row">
<div class="glm-small-12 glm-medium-2 glm-columns admin-job-label">
Member
<div class="glm-small-12 glm-medium-5 glm-columns admin-job-input">
<select id="member" data-id="member" name="member">
<option value="">Select a Member</option>
- {foreach from=$jobData.member item=m}
+ {foreach from=$memberList item=m}
{if 'fieldData'|array_key_exists:$job}
- <option value="{$job.id}" {if $job.fieldData.title.name == {$j.job_title}} selected="selected"{/if}>
+ <option value="{$m.id}" {if $job.fieldData.member.name == {$m.name}} selected="selected"{/if}>
{else if}
- <option value="{$j.id}">
+ <option value="{$m.id}">
{/if}
- {$j.job_title}
+ {$m.name}
</option>
{/foreach}
</select>
</div>
</div>
+ {/if}
<!-- COMPANY -->
<div class="glm-job-row glm-row">
<div class="glm-small-12 glm-medium-2 glm-columns admin-job-label">
{include file='admin/header.html'}
-
+{if $haveMember}
+<input type="hidden" name="member" value="{$memberID}">
+{if !$lockedToMember}
+<input type="hidden" name="glm_action" value="job">
+{/if}
+<input type="hidden" name="option" value="list">
+{/if}
{if $jobData}
<div class="admin-new-job">
<a class="admin-new-job-link" href="{$thisUrl}?page={$thisPage}&glm_action=index&option=add">New Job Posting</a>
-<!DOCTYPE html>
-<!--
-To change this license header, choose License Headers in Project Properties.
-To change this template file, choose Tools | Templates
-and open the template in the editor.
--->
-<html>
- <head>
- <title>TODO supply a title</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- </head>
- <body>
- <div>TODO write content</div>
- </body>
-</html>
+<div class="job-title-search glm-row">
+ <form action="{$siteBaseUrl}job-postings" method="post" enctype="multipart/form-data">
+ <select name="job_titles" id="job_title_dropdown">
+ <option value="">Show All</option>
+ {foreach $jobTitles as $jtitle=>$title}
+ <option value="{$title.id}">{$title.job_title}</option>
+ {/foreach}
+ <input type="submit" value="Show">
+ </select>
+ </form>
+</div>
+<div class="glm-row job-detail-wrapper">
+ <div class="glm-small-12 columns front-title">{$jobData.title}</div>
+ <div class="glm-small-12 columns front-location">{$jobData.job_location}</div>
+ <div class="glm-small-12 columns front-position">{$jobData.position_available}</div>
+ <div class="glm-small-12 columns front-salary">{$jobData.salary}</div>
+ <div class="glm-small-12 columns front-duration">{$jobData.duration}</div>
+ <div class="glm-small-12 columns front-company">{$jobData.company}</div>
+ <div class="glm-small-12 columns front-facility">{$jobData.facility_operation}</div>
+ <div class="glm-small-12 columns front-description">{$jobData.descr}</div>
+ <div class="glm-small-12 columns front-requirements">{$jobData.requirements}</div>
+ <div class="glm-small-12 columns front-benefits">{$jobData.benefits}</div>
+ <div class="glm-small-12 columns front-email">{$jobData.email_location}</div>
+ <div class="glm-small-12 columns front-email">{$jobData.email_location}</div>
+ <div class="glm-small-12 columns front-phone">{$jobData.contactphone}</div>
+</div>
\ No newline at end of file
-{foreach $jobData as $key=>$value}
- {foreach $value as $id=>$job}
- <div id='job-Job-{$id}' class="job-Job">
- <div class='job-info'>
- <!-- <span class='Job-date'> Job Date: {$job.job_info.job_date.date|date_format:"%B %e, %Y"} -->
- </div>
- <div class="job-info">
- jobs
+<div class="job-title-search glm-row">
+ <form action="{$siteBaseUrl}job-postings" method="post" enctype="multipart/form-data">
+ <select name="job_titles" id="job_title_dropdown">
+ <option value="">Show All</option>
+ {foreach $jobTitles as $jtitle=>$title}
+ <option value="{$title.id}">{$title.job_title}</option>
+ {/foreach}
+ <input type="submit" value="Show">
+ </select>
+ </form>
+</div>
+{if $jobData}
+ {foreach $jobData as $key=>$value}
+ <div class='glm-row front-job-list-row'>
+ <div class="glm-small-12 glm-columns front-job-list">
+ <div class="glm-row front-job-data">
+ <div class="job-title-list glm-small-12 glm-columns no-padding">
+ <span>{$value.title}</span>
+ </div>
+ <div class="job-location-list glm-small-12 glm-columns no-padding">
+ <span>Location: </span>{$value.job_location}
+ </div>
+ <div class="job-company-list glm-small-12 glm-columns no-padding">
+ <span>Company: </span>{$value.company}
+ </div>
+ <div class="job-date-list glm-small-12 glm-columns no-padding">
+ <span></span>{$value.post_date.timestamp|date_format:"%Y-%m-%d"}
+ </div>
+ <a href="{$siteBaseUrl}job-detail/?job={$value.id}">Full Job Description</a>
+ </div>
</div>
</div>
{/foreach}
-{/foreach}
\ No newline at end of file
+{else}
+<div class="glm-row">
+ <div class="glm-small-12 glm-columns">
+ No Job Listings
+ </div>
+</div>
+{/if}
\ No newline at end of file