From: Anthony Talarico Date: Thu, 21 Sep 2017 20:36:59 +0000 (-0400) Subject: getting the job title from the old job title id X-Git-Tag: v1.0.0~1^2~28 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=27507ebe3c78ce6464784e4bf878065ada7f06c3;p=WP-Plugins%2Fglm-member-db-jobs.git getting the job title from the old job title id using the old job title id to get the job title name --- diff --git a/classes/data/dataJobs.php b/classes/data/dataJobs.php index bdd4b5d..7200d28 100644 --- a/classes/data/dataJobs.php +++ b/classes/data/dataJobs.php @@ -146,7 +146,7 @@ class GlmDataJobs extends GlmDataAbstract 'type' => 'pointer', 'p_table' => GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'job_titles', 'p_field' => 'job_title', - 'p_orderby' => 'job_Title', + 'p_orderby' => 'job_title', 'use' => 'a' ), 'descr' => array ( @@ -169,13 +169,13 @@ class GlmDataJobs extends GlmDataAbstract 'type' => 'text', 'use' => 'a' ), - 'contactname' => array ( - 'field' => 'contactname', + 'contact_name' => array ( + 'field' => 'contact_name', 'type' => 'text', 'use' => 'a' ), - 'contactphone' => array ( - 'field' => 'contactphone', + 'contact_phone' => array ( + 'field' => 'contact_phone', 'type' => 'text', 'use' => 'a' ), diff --git a/models/admin/jobs/index.php b/models/admin/jobs/index.php index 709f016..c036c20 100644 --- a/models/admin/jobs/index.php +++ b/models/admin/jobs/index.php @@ -277,18 +277,45 @@ class GlmMembersAdmin_jobs_index extends GlmDataJobs $jobDeleteError = true; } $view_file = "index"; - $job_titles = $job_titles->getList(); + $job_data = $this->getList(); break; default: - $job_data = $this->getList($where); +// $job_data = $this->getList($where); + $sql = "SELECT * FROM ". GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . "jobs";; + $job_data = $this->wpdb->get_results($sql, ARRAY_A); + $job_titles = $job_titles->getList(); + $job_data_new = []; + $start = 0; + foreach($job_data as $job=>$data){ + // echo '
', print_r($data), '
'; + $title_text = false; + // echo "
START + $start
"; + // echo '======================
'; + foreach($job_titles as $job=>$titles){ + // echo $data['title'] . " --data
"; + // echo $titles['old_id'] . " --title
"; + if($data['title'] === $titles['old_id']){ + $title_text = $titles['job_title']; + break; + } else if($data['title'] === $titles['id']) { + $title_text = $titles['job_title']; + break; + } + } + $start++; + $data['new_title'] = $title_text; + $job_data_new[] = $data; + } + + echo '
', print_r($job_data_new), '
'; $view_file = 'index'; break; } // echo '
', print_r($this->getList()), '
'; // Compile template data $templateData = array( - 'jobData' => $job_data, + 'jobData' => $job_data_new, 'memberList' => $member_list, 'lockedToMember' => $lockedToMember, 'haveMember' => $haveMember, diff --git a/setup/adminTabs.php b/setup/adminTabs.php index c1dd7e0..eb01c70 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -32,6 +32,7 @@ * ); * */ + if (current_user_can('glm_members_members')) { if (apply_filters('glm_members_permit_admin_members_jobTitles_tab', true)) { diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql index cb4d254..d5ccb80 100644 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -20,8 +20,8 @@ CREATE TABLE {prefix}jobs ( salary TINYTEXT NULL , email_location TINYTEXT NULL , resume_location TINYTEXT NULL , - contactname TINYTEXT NULL , - contactphone TINYTEXT NULL , + contact_name TINYTEXT NULL , + contact_phone TINYTEXT NULL , post_date DATETIME NULL DEFAULT NOW(), updated DATETIME NULL DEFAULT NOW(), visible BOOL NULL, @@ -51,14 +51,14 @@ CREATE TABLE {prefix}job_titles ( ---- -- Job Titles default entries in table -INSERT INTO {prefix}job_titles ( id,old_id,job_title) VALUES -(1,1, 'Supervisor'),(2,1,'Groundskeeper'),(3,1,'Janitor'); +-- INSERT INTO {prefix}job_titles ( id,old_id,job_title) VALUES +-- (1,1, 'Supervisor'),(2,1,'Groundskeeper'),(3,1,'Janitor'); ---- -- Job Titles default entries in table INSERT INTO {prefix}jobs ( -id,old_id,title,descr,salary, email_location,resume_location,contactname,contactphone,post_date,updated,visible, +id,old_id,title,descr,salary, email_location,resume_location,contact_name,contact_phone,post_date,updated,visible, facility_operation,requirements,job_location,job_expiration,duration,deadline,position_available, company,member,benefits ) VALUES ( 1,1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'RESUME LOCATION','CONTACT NAME', '453-3443', NOW(),NOW(), true, diff --git a/views/admin/jobs/edit.html b/views/admin/jobs/edit.html index c889f0e..d38278c 100644 --- a/views/admin/jobs/edit.html +++ b/views/admin/jobs/edit.html @@ -37,13 +37,14 @@
Job Title
+
+
@@ -293,7 +294,7 @@ Contact Phone
- +
diff --git a/views/admin/jobs/index.html b/views/admin/jobs/index.html index 7dbf365..ce644ef 100644 --- a/views/admin/jobs/index.html +++ b/views/admin/jobs/index.html @@ -20,10 +20,10 @@
-
{$data.title}
-
{$data.company}
-
{$data.member}
-
{$data.post_date.timestamp|date_format:"%Y-%m-%d"}
+
{if $data.new_title} {$data.new_title} {else}   {/if}
+
{if $data.company} {$data.company} {else}   {/if}
+
{if $data.member} {$data.member} {else}   {/if}
+
{$data.post_date|date_format:"%Y-%m-%d"}