From: Anthony Talarico Date: Mon, 11 Sep 2017 20:30:16 +0000 (-0400) Subject: adding settings section for the job titles, adding default database data to work... X-Git-Tag: v1.0.0~1^2~37 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=8c31f69e72396dcbce5250a8630a5b05daa9fcd0;p=WP-Plugins%2Fglm-member-db-jobs.git adding settings section for the job titles, adding default database data to work with more test code and dummy data to work with, setting up the settings menu so the client can add job titles for the job posting views --- diff --git a/classes/data/dataJobTitles.php b/classes/data/dataJobTitles.php index b441a03..0a10234 100644 --- a/classes/data/dataJobTitles.php +++ b/classes/data/dataJobTitles.php @@ -136,7 +136,7 @@ class GlmDatajobTitles extends GlmDataAbstract 'use' => 'a' ), 'job_title' => array ( - 'field' => 'title', + 'field' => 'job_title', 'type' => 'text', 'use' => 'a' ), diff --git a/classes/data/dataJobs.php b/classes/data/dataJobs.php index 39b3882..1d441c3 100644 --- a/classes/data/dataJobs.php +++ b/classes/data/dataJobs.php @@ -153,8 +153,8 @@ class GlmDatajobs extends GlmDataAbstract 'type' => 'text', 'use' => 'a' ), - 'location' => array ( - 'field' => 'location', + 'email_location' => array ( + 'field' => 'email_location', 'type' => 'text', 'use' => 'a' ), @@ -175,7 +175,7 @@ class GlmDatajobs extends GlmDataAbstract ), 'visible' => array ( 'field' => 'visible', - 'type' => 'boolean', + 'type' => 'checkbox', 'use' => 'a' ), 'facility_operation' => array ( @@ -195,15 +195,15 @@ class GlmDatajobs extends GlmDataAbstract ), 'job_location' => array ( 'field' => 'job_location', - 'type' => 'tex', + 'type' => 'text', 'use' => 'a' ), 'job_expiration' => array ( 'field' => 'job_expiration', 'type' => 'list', - 'list' => $this->config['job_expiration'], - 'default' => '30 Days', - 'force_list' => true, + 'list' => $this->config['job_expiration'], + 'default' => '30 Days', + 'force_list' => true, 'use' => 'a' ), 'duration' => array ( diff --git a/css/admin.css b/css/admin.css index 1f6797d..f638434 100644 --- a/css/admin.css +++ b/css/admin.css @@ -1,21 +1,4 @@ -#Job-tabs{ - opacity: 0; - max-width: 725px; -} -.job-notes{ - height: 100px; -} -.condition-label,.job-label{ - margin-bottom: 5px; -} -.ui-datepicker-trigger{ - margin-left: 5px; - position: absolute; -} -.ui-tabs-panel .groom-date,.ui-tabs-panel .snow-base,.job-conditions{ - margin-bottom: 20px; -} -.job-name{ - margin-bottom: 20px; - -} +#glm-admin-content-container .admin-job-label, +#glm-admin-content-container .admin-job-input{ + padding: 0; +} \ No newline at end of file diff --git a/css/front.css b/css/front.css new file mode 100644 index 0000000..e69de29 diff --git a/models/admin/jobs/index.php b/models/admin/jobs/index.php index b910c6c..8f2ee5f 100644 --- a/models/admin/jobs/index.php +++ b/models/admin/jobs/index.php @@ -82,8 +82,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs * data class that it should flag a group of fields as 'view_only'. */ parent::__construct(false, false, true); - - } public function modelAction($actionData = false) @@ -91,7 +89,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs 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'); - wp_enqueue_script("jquery-ui-tabs"); } $success_message = ""; $haveJob = false; @@ -102,7 +99,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs $jobAdded = false; $jobAddError = false; - if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { $option = $_REQUEST['option']; } @@ -111,7 +107,8 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs $this->job_id = ( isset( $_REQUEST['job'] ) ? filter_var( $_REQUEST['job'], FILTER_SANITIZE_STRING) : ''); $job_data = $this->getList(); - echo '
', print_r($_REQUEST), '
'; + echo '
', print_r($this->getList()), '
'; + // echo '
', print_r($_REQUEST), '
'; switch ($option) { @@ -123,7 +120,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs case 'insert': $job = $this->insertEntry(); -// echo '
', print_r($job), '
'; $this->job_id = $job['fieldData']['id']; if ($job['status']) { @@ -182,7 +178,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs break; case 'delete': - echo "delte"; $job = $this->deleteEntry($this->job_id,true); if ($job) { diff --git a/models/admin/settings/jobTitles.php b/models/admin/settings/jobTitles.php new file mode 100644 index 0000000..97d01ae --- /dev/null +++ b/models/admin/settings/jobTitles.php @@ -0,0 +1,148 @@ + + + * @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 Obits data abstract +require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobTitles.php'; + +class GlmMembersAdmin_settings_jobTitles extends GlmDataJobTitles +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Obit ID + * + * @var $obitID + * @access public + */ + public $obitID = false; + + /** + * 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 Obits 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) + { + + $numbObits = 0; + $namesList = false; + + // Check if an ID is supplied + $id = 0; + if ( isset( $_REQUEST['id'] ) ) { + $id = $_REQUEST['id'] - 0; + } + // If there's an action option + if ( isset( $_REQUEST['option'] ) ) { + switch( $_REQUEST['option'] ) { + + case 'addNew': + $return = $this->insertEntry(); + $id = $return['fieldData']['id']; + break; + + case 'update': + if ( $id > 0 ) { + $this->updateEntry( $id ); + } + echo "no id"; + break; + + case 'delete': + if ( $id > 0 ) { + $this->deleteEntry( $id, true ); + } + break; + + default: + $option2 = false; + break; + + } + } + + // Get number of obits + + $jobTitles = $this->getList(); + + // Compile template data + $templateData = array( + 'jobTitles' => $jobTitles, + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/settings/jobTitles.html', + 'data' => $templateData + ); + + } + + +} diff --git a/models/front/jobs/list.php b/models/front/jobs/list.php index 45f1d1d..7452ac1 100644 --- a/models/front/jobs/list.php +++ b/models/front/jobs/list.php @@ -114,13 +114,13 @@ class GlmMembersFront_jobs_list extends GlmDatajobs foreach($job_data as $id=>$record){ foreach($record as $key=>$value){ if(strpos($key, "Job") !== false){ - $JOBS['trail_Job'][$id]['job_info'][$key] = $value; + $jobs['trail_Job'][$id]['job_info'][$key] = $value; } else { - $JOBS['trail_Job'][$id]['trail_info'][$key] = $value; + $jobs['trail_Job'][$id]['trail_info'][$key] = $value; } } } -// echo '
', print_r($JOBS), '
'; +// echo '
', print_r($jobs), '
'; $view_file = 'list'; switch ($option) { @@ -138,7 +138,7 @@ class GlmMembersFront_jobs_list extends GlmDatajobs // Compile template data $templateData = array( - 'jobData' => $JOBS + 'jobData' => $jobs ); // Return status, any suggested view, and any data to controller diff --git a/setup/adminTabs.php b/setup/adminTabs.php index 0d6de9b..c1dd7e0 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -32,4 +32,22 @@ * ); * */ +if (current_user_can('glm_members_members')) { + if (apply_filters('glm_members_permit_admin_members_jobTitles_tab', true)) { + add_filter('glm-member-db-add-tab-for-settings', + function($addOnTabs) { + $newTabs = array( + array( + 'text' => 'Job Titles', + 'menu' => 'settings', + 'action' => 'jobTitles' + ), + ); + $addOnTabs = array_merge($addOnTabs, $newTabs); + return $addOnTabs; + } + ); + + } +} diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql index e8a032c..e175f23 100644 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -14,23 +14,23 @@ -- Conditions Table CREATE TABLE {prefix}jobs ( id INT NOT NULL AUTO_INCREMENT, - title TINYTEXT NULL DEFAULT '', - descr TEXT NULL DEFAULT '', - salary TINYTEXT NULL DEFAULT '', - location TINYTEXT NULL DEFAULT '', - contactname TINYTEXT NULL DEFAULT '', - contactphone TINYTEXT NULL DEFAULT '', + title TINYTEXT NULL , + descr TEXT NULL , + salary TINYTEXT NULL , + email_location TINYTEXT NULL , + contactname TINYTEXT NULL , + contactphone TINYTEXT NULL , post_date DATETIME NULL DEFAULT NOW(), visible BOOL NULL, - facility_operation TEXT NULL DEFAULT '', - requirements TEXT NULL DEFAULT '', - benefits TEXT NULL DEFAULT '', - job_location TINYTEXT NULL DEFAULT '', + facility_operation TEXT NULL, + requirements TEXT NULL, + benefits TEXT NULL , + job_location TINYTEXT NULL , job_expiration TINYTEXT NULL, - duration TINYTEXT NULL DEFAULT '', - deadline TINYTEXT NULL DEFAULT '', - course_operation TINYTEXT NULL DEFAULT '', - position_available TINYTEXT NULL DEFAULT '', + duration TINYTEXT NULL , + deadline TINYTEXT NULL , + course_operation TINYTEXT NULL , + position_available TINYTEXT NULL , member INT NULL, PRIMARY KEY (id) ); @@ -40,6 +40,24 @@ CREATE TABLE {prefix}jobs ( -- Job Titles CREATE TABLE {prefix}job_titles ( id INT NOT NULL AUTO_INCREMENT, - job_title TINYTEXT NULL DEFAULT '', + job_title TINYTEXT NULL , PRIMARY KEY (id) +); + +---- + +-- Job Titles default entries in table +INSERT INTO {prefix}job_titles ( id,job_title) VALUES +(1, 'Supervisor'),(2,'Groundskeeper'),(3,'Janitor'); + +---- + +-- Job Titles default entries in table +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, +course_operation,member +) VALUES ( 1, 'TITLE',"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'CONTACT NAME', '453-3443', NOW(), false, +'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 'JOB EXPIRATION', 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE', +'COURSE OPERATION', 1 ); \ No newline at end of file diff --git a/setup/validActions.php b/setup/validActions.php index fba7242..8c4e429 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -64,6 +64,9 @@ $glmMembersjobsAddOnValidActions = array( 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, ), ), + 'settings' => array( + 'jobTitles' => GLM_MEMBERS_JOBS_PLUGIN_SLUG, + ), 'frontActions' => array( 'jobs' => array( 'list' => GLM_MEMBERS_JOBS_PLUGIN_SLUG diff --git a/views/admin/jobs/edit.html b/views/admin/jobs/edit.html index 1ee4312..d9d72ff 100644 --- a/views/admin/jobs/edit.html +++ b/views/admin/jobs/edit.html @@ -34,10 +34,150 @@ - - - -
+
+
+ Job Title +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
@@ -72,13 +212,7 @@