{
$members = new GlmDataMembers($this->wpdb, $this->config);
$member_list = $members->getList(false, 'name');
-
+
$job_titles = new GlmDataJobTitles($this->wpdb,$this->config);
-
-
+
+
$success_message = "";
$haveJob = false;
$option = false;
$memberID = false;
$haveMember = false;
$where = ' TRUE ';
-
-
+
+
$isPending = ( !empty( $_REQUEST['pending-job'] ) ) ? true : false;
$textSearch = ( !empty( $_REQUEST['text-search'] ) ) ? filter_var($_REQUEST['text-search'], FILTER_SANITIZE_STRING) : false;
-
+
// Load Notifications from the helper classes
include_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH. '/helper/notifications.php';
$notification = new GlmMembersAdmin_jobs_notification( $this->wpdb, $this->config );
-
-
+
+
// 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);
+ $isModerated = true;//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;
// Get base member information
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
-
+
$memberData = $members->getEntry($memberID);
$where .= "AND member = $memberID";
if (!$memberData) {
}
}
-
+
if($isPending){
$where .= " AND active = 0 ";
}
else if($textSearch){
$where .= " AND (title LIKE '%$textSearch%' OR company LIKE '%$textSearch%') ";
}
-
+
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'])) {
$this->job_id = false;
}
}
-
+
switch ($option) {
case 'add':
-
+
$job = $this->newEntry();
$view_file = 'edit';
$job_titles = $job_titles->getList();
$job_data = $this->getList($where);
-
+
break;
case 'insert':
-
+
$job = $this->insertEntry();
$this->job_id = $job['fieldData']['id'];
$this->checkNewJobTitles();
$updated = $this->getUpdatedTime($this->job_id);
-
+
if ($job['status']) {
$haveJob = true;
$jobAdded = true;
$job = $this->editEntry($this->job_id);
$this->updateTimestamp('updated', $this->job_id,$job,$updated);
// $job = $this->addNewTitle($job);
-
+
$option = 'edit';
$jobAdded = true;
-
-
+
+
} else {
$option = 'add';
$jobAddError = true;
}
-
+
$job_data = $this->getList($where);
$view_file = 'edit';
break;
case 'edit':
-
+
$job = $this->editEntry($this->job_id);
-
-
+
+
// If we're locked to a member as a contact user and the event member doesn't equal the contact member
if ($lockedToMember && $job['fieldData']['member']['value'] != $lockedToMember) {
$haveJob = false;
// Try to update this Job
$job = $this->updateEntry($this->job_id);
$this->checkNewJobTitles();
-
+
// Check if that was successful
if ($job['status']) {
$jobUpdated = true;
$job = $this->editEntry($this->job_id);
-
+
} else {
$jobUpdateError = true;
}
$this->updateTimestamp('updated', $this->job_id,$job,$updated);
$haveJob = true;
$view_file = 'edit';
-
+
break;
case 'delete':
default:
$job_data = $this->getList($where, "post_date DESC");
$view_file = 'index';
-
+
break;
}
// echo $where;
'isPending' => $isPending,
'textSearch' => $textSearch,
'assetsUrl' => GLM_MEMBERS_JOBS_PLUGIN_URL . 'assets/',
-
+
);
// Return status, any suggested view, and any data to controller
*/
public function checkNewJobTitles()
{
-
+
// If we have a member ID and this was a submission with a new city (id < 0)
if (isset($_REQUEST['new_job_title']) && trim($_REQUEST['new_job_title']) != '') {
-
+
// Clean up job titlename
$jName = trim(filter_var($_REQUEST['new_job_title']));
-
- // Try to add the job title
+
+ // Try to add the job title
require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobTitles.php';
$jobTitles = new GlmDataJobTitles($this->wpdb, $this->config);
$jID = $jobTitles->addJobTitles($jName);
-
+
// If we got a job title id back
if (is_int($jID) && $jID > 0) {
-
+
// Update the job title selected for this job record
$sql = "
UPDATE ".GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX."jobs
WHERE id = ".$this->job_id."
;";
$insert = $this->wpdb->query($sql);
-
-
+
+
// Update submitted job title value to use the new ID
$_REQUEST['new_job_title'] = $jID;
-
+
}
}
}