From b7695258afd2a6c235d38540818718195ad52f8d Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 14 Sep 2017 16:43:33 -0400 Subject: [PATCH] fixing the edit and update functions for the posting, adding more styles styling and structuring the admin list, fixing the update functionality for pre-existing job postings --- classes/data/dataJobs.php | 7 +- css/admin.css | 38 ++- models/admin/jobs/index.php | 22 +- .../create_database_V0.0.1.sql | 12 +- views/admin/jobs/edit.html | 282 ++++++++++++------ views/admin/jobs/index.html | 42 +-- 6 files changed, 279 insertions(+), 124 deletions(-) diff --git a/classes/data/dataJobs.php b/classes/data/dataJobs.php index b4de75f..825718d 100644 --- a/classes/data/dataJobs.php +++ b/classes/data/dataJobs.php @@ -35,7 +35,7 @@ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ */ -class GlmDatajobs extends GlmDataAbstract +class GlmDataJobs extends GlmDataAbstract { /** @@ -133,6 +133,7 @@ class GlmDatajobs extends GlmDataAbstract 'id' => array ( 'field' => 'id', 'type' => 'integer', + 'view_only' => true, 'use' => 'a' ), 'title' => array ( @@ -170,8 +171,8 @@ class GlmDatajobs extends GlmDataAbstract ), 'post_date' => array ( 'field' => 'post_date', - 'type' => 'date', - 'use' => 'a' + 'type' => 'datetime', + 'use' => 'lge' ), 'visible' => array ( 'field' => 'visible', diff --git a/css/admin.css b/css/admin.css index f6fd0fc..d6e341d 100644 --- a/css/admin.css +++ b/css/admin.css @@ -1,7 +1,43 @@ #glm-admin-content-container .admin-job-label, -#glm-admin-content-container .admin-job-input{ +#glm-admin-content-container .admin-job-input, +#glm-admin-content-container .admin-job-list{ padding: 0; } .jobTitle-record{ float: left; +} +.admin-job-input textarea{ + +} +.admin-new-job{ + margin-bottom: 15px; +} +.admin-new-job .admin-new-job-link{ + padding: 5px; + background: #3D84D0; + color: white; + text-decoration: none; + border-radius: 4px; +} +.no-padding{ + padding: 0; +} +.no-margin{ + margin: 0; +} +#glm-admin-content-container .admin-job-list-header{ + margin-bottom: 20px; + padding-bottom: 2px; + border-bottom: 1px solid lightgray; +} +.admin-job-list-row{ + padding-bottom: 5px; +/* border-bottom: 1px solid lightgray;*/ +} +.job-company-list-header,.job-date-list-header, .job-title-list-header{ + font-weight: bold; + font-size: 16px; +} +.admin-job-list-row:nth-child(odd){ + background: #e3e3e5; } \ No newline at end of file diff --git a/models/admin/jobs/index.php b/models/admin/jobs/index.php index e705187..f934c51 100644 --- a/models/admin/jobs/index.php +++ b/models/admin/jobs/index.php @@ -18,7 +18,7 @@ require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH .'/data/dataJobs.php'; require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH .'/data/dataJobTitles.php'; require_once GLM_MEMBERS_PLUGIN_CLASS_PATH .'/data/dataMembers.php'; -class GlmMembersAdmin_jobs_index extends GlmDatajobs +class GlmMembersAdmin_jobs_index extends GlmDataJobs { /** @@ -109,9 +109,20 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs } // get the Job id for use in the edit, add and delete options - $this->job_id = ( isset( $_REQUEST['job'] ) ? filter_var( $_REQUEST['job'], FILTER_SANITIZE_STRING) : ''); + // 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; + } + + } $job_data = $this->getList(); + // echo '
', print_r($this->getList()), '
'; // echo '
', print_r($_REQUEST), '
'; @@ -136,7 +147,7 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs // Get this again so we have the created date $job = $this->editEntry($this->job_id); - + $option = 'edit'; $jobAdded = true; @@ -161,15 +172,15 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs break; case 'update': - // Try to update this Job $job = $this->updateEntry($this->job_id); - + // Check if that was successful if ($job['status']) { $jobUpdated = true; $job = $this->editEntry($this->job_id); + } else { $jobUpdateError = true; } @@ -200,6 +211,7 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs $templateData = array( 'jobData' => $job_data, 'jobTitles' => $job_titles, + 'jobID' => $this->job_id, 'haveJob' => $haveJob, 'jobUpdated' => $jobUpdated, 'jobUpdateError' => $jobUpdateError, diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql index 9dc6513..4cb6ac4 100644 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -14,7 +14,7 @@ -- Conditions Table CREATE TABLE {prefix}jobs ( id INT NOT NULL AUTO_INCREMENT, - title TINYTEXT NULL , + title int NULL , descr TEXT NULL , salary TINYTEXT NULL , email_location TINYTEXT NULL , @@ -26,7 +26,7 @@ CREATE TABLE {prefix}jobs ( requirements TEXT NULL, benefits TEXT NULL , job_location TINYTEXT NULL , - job_expiration TINYTEXT NULL, + job_expiration INT NULL, duration TINYTEXT NULL , deadline TINYTEXT NULL , company TINYTEXT NULL , @@ -56,8 +56,8 @@ INSERT INTO {prefix}job_titles ( id,job_title) VALUES INSERT INTO {prefix}jobs ( id,title,descr,salary, email_location,contactname,contactphone,post_date,visible, facility_operation,requirements,job_location,job_expiration,duration,deadline,position_available, -company,member -) VALUES ( 1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'CONTACT NAME', '453-3443', NOW(), false, -'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 'JOB EXPIRATION', 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE', -'COMPANY', 1 +company,member,benefits +) VALUES ( 1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'CONTACT NAME', '453-3443', NOW(), true, +'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 30, 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE', +'COMPANY', 1, 'JOB BENEFITS' ); \ No newline at end of file diff --git a/views/admin/jobs/edit.html b/views/admin/jobs/edit.html index ab8ea32..b5c1694 100644 --- a/views/admin/jobs/edit.html +++ b/views/admin/jobs/edit.html @@ -5,7 +5,7 @@ {if $option == 'edit' || $option == 'update'} Delete this Job -

Edit Job Postings +

Edit Job Posting {else}

Add New Job Posting {/if} @@ -16,11 +16,10 @@ {if $jobAddError}Job Add Error{/if}

- {if $jobUpdateError || $jobAddError} -

NOTICE: Your Job has not yet been submitted.
Please select the tabs indicating a problem, correct the indicated fields and resubmit.

- {else} - {/if} - + {if $jobUpdateError || $jobAddError} +

NOTICE: Your Job has not yet been submitted.
Please select the tabs indicating a problem, correct the indicated fields and resubmit.

+ {else} + {/if}
@@ -36,15 +35,15 @@
-
+
Job Title
-
+
-
-
- -
-
- -
-
-
- +
- +
-
- +
+ Member
-
- +
+
- +
-
- +
+ Company
-
- +
+
+
-
- +
+ Facility Operation
-
- + +
+ {php} + wp_editor( + + '{$job.fieldData.facility_operation|escape:quotes}', + + + 'facility_operation', array( + 'media_buttons' => false, + 'tinymce' => false, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'facility_operation', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php}
+
-
- -
-
- +
+ Description +
+
+ {php} + wp_editor( + + '{$job.fieldData.descr|escape:quotes}', + + 'descr', array( + 'media_buttons' => false, + 'tinymce' => false, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'descr', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php}
+
-
- -
-
- +
+ Job Requirements +
+
+ {php} + wp_editor( + + '{$job.fieldData.requirements|escape:quotes}', + + 'requirements', array( + 'media_buttons' => false, + 'tinymce' => false, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'requirements', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php}
+
-
- -
-
- +
+ Job Benefits +
+
+ {php} + wp_editor( + + '{$job.fieldData.benefits|escape:quotes}', + + + 'benefits', array( + 'media_buttons' => false, + 'tinymce' => false, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'benefits', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php}
+
-
- +
+ Salary
-
- +
+
+
-
- +
+ Position Available
-
- +
+
+
-
- +
+ Job Duration
-
- +
+
+
-
- +
+ Deadline
-
- +
+
+
-
- -
-
- +
+ Job Location +
+
+ {php} + wp_editor( + + '{$job.fieldData.job_location|escape:quotes}', + + 'job_location', array( + 'media_buttons' => false, + 'tinymce' => false, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'job_location', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php}
+ +
-
- +
+ Contact Name
-
- +
+
+
-
- +
+ Email To
-
- +
+
+
-
- +
+ Contact Phone
-
- +
+
+
-
- +
+ Visible
-
- +
+
+
-
- +
+ Job Expiration
-
- +
+
+ + diff --git a/views/admin/jobs/index.html b/views/admin/jobs/index.html index 6aa0b36..e8652fb 100644 --- a/views/admin/jobs/index.html +++ b/views/admin/jobs/index.html @@ -1,25 +1,29 @@ {include file='admin/header.html'} - - - - - - -
 
New Job
{if $jobData} - - - - - {foreach $jobData as $job=>$data} - - {$data.title}{$data.company}{$data.post_date.timestamp|date_format:"%Y-%m-%d"} - - - {/foreach} -
EditDelete
- + +
+
Job Title
+
Company
+
Job Post Date
+
+ {foreach $jobData as $job=>$data} +
+
+
+
{$data.title}
+
{$data.company}
+
{$data.post_date.timestamp|date_format:"%Y-%m-%d"}
+
+
+
+ Edit + Delete +
+
+ {/foreach}