adding settings section for the job titles, adding default database data to work...
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 11 Sep 2017 20:30:16 +0000 (16:30 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 11 Sep 2017 20:30:16 +0000 (16:30 -0400)
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

15 files changed:
classes/data/dataJobTitles.php
classes/data/dataJobs.php
css/admin.css
css/front.css [new file with mode: 0644]
models/admin/jobs/index.php
models/admin/settings/jobTitles.php [new file with mode: 0644]
models/front/jobs/list.php
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.1.sql
setup/validActions.php
views/admin/jobs/edit.html
views/admin/jobs/index.html
views/admin/settings/jobTitles.html [new file with mode: 0644]
views/front/jobs/detail.html [new file with mode: 0644]
views/front/jobs/list.html

index b441a03..0a10234 100644 (file)
@@ -136,7 +136,7 @@ class GlmDatajobTitles extends GlmDataAbstract
                 'use' => 'a'
             ),
             'job_title' => array (
-                'field' => 'title',
+                'field' => 'job_title',
                 'type' => 'text',
                 'use' => 'a'
             ),
index 39b3882..1d441c3 100644 (file)
@@ -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 (
index 1f6797d..f638434 100644 (file)
@@ -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 (file)
index 0000000..e69de29
index b910c6c..8f2ee5f 100644 (file)
@@ -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 '<pre>', print_r($_REQUEST), '</pre>';
+        echo '<pre>', print_r($this->getList()), '</pre>';
+        // echo '<pre>', print_r($_REQUEST), '</pre>';
         
         switch ($option) {
 
@@ -123,7 +120,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs
 
             case 'insert':
                 $job = $this->insertEntry();
-//               echo '<pre>', print_r($job), '</pre>';
                 $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 (file)
index 0000000..97d01ae
--- /dev/null
@@ -0,0 +1,148 @@
+
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Obits Dashboard
+ *
+ * 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 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
+        );
+
+    }
+
+
+}
index 45f1d1d..7452ac1 100644 (file)
@@ -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 '<pre>', print_r($JOBS), '</pre>';
+//        echo '<pre>', print_r($jobs), '</pre>';
         $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
index 0d6de9b..c1dd7e0 100644 (file)
  * );
  *
  */
+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;
+            }
+        );
+
+    }
+}
index e8a032c..e175f23 100644 (file)
 -- 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
index fba7242..8c4e429 100644 (file)
@@ -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
index 1ee4312..d9d72ff 100644 (file)
        <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
             <a id="glm-Job-descr" data-show-table="glm-table-descr" class="glm-Job-tab nav-tab nav-tab-active">Job Postings</a>
         </h2>
-
-        <table id="glm-table-descr" class="glm-admin-table glm-Job-table">
-        
-        </table>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                Job Title
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="title">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="position_available">
+            </div>
+        </div>
+        <div class="glm-job-row glm-row">
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
+                    
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-job-input">
+                <input type="text" name="member">
+            </div>
+        </div>
         <input id="updateJob" type="submit" value="{if $haveJob}Update Job{else}Save New Job{/if}">
     </form>
 
     </div>
     <script type="text/javascript">
         jQuery(document).ready(function($) {
-            $("#Job-tabs").fadeTo("600", 1);
-            $('#Job-tabs').tabs();
-            $('.groom-date').datepicker({
-                showOn: "both",
-                buttonImage: '{$assetsUrl}' + "/calIcon.png",
-                buttonImageOnly: true
-            });
+
         {if $haveJob}
             // Delete Job dialog
             $("#deleteJobDialog").dialog({
index 531ee0b..866ba80 100644 (file)
@@ -8,19 +8,15 @@
         </tr>
 
     </table>
+    {$jobData}
     {if $jobData}
-        
+        yes there is
             <table class="glm-admin-table">
                 <tr>
-                    <th>Job Date</th>
-                    <th>Job Blurb</th>
-                    <th>Job Notes</th>
+
                 </tr>
-            {foreach $jobData as $record=>$data}
+            {foreach $jobData as $job=>$data}
                 <tr>
-                    <td>{$data.job_date.date}</td>
-                    <td>{$data.job_blurb}</td>
-                    <td>{$data.job_notes}</td>
                     <td><a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=edit&Job={$data.id}">Edit</a><a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&Job={$data.id}">Delete</a></td>
                 </tr>
             {/foreach}
diff --git a/views/admin/settings/jobTitles.html b/views/admin/settings/jobTitles.html
new file mode 100644 (file)
index 0000000..c627c24
--- /dev/null
@@ -0,0 +1,16 @@
+<!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>
diff --git a/views/front/jobs/detail.html b/views/front/jobs/detail.html
new file mode 100644 (file)
index 0000000..c627c24
--- /dev/null
@@ -0,0 +1,16 @@
+<!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>
index c58e030..dd13ac3 100644 (file)
@@ -2,14 +2,10 @@
     {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"}
+                <!-- <span class='Job-date'> Job Date: {$job.job_info.job_date.date|date_format:"%B %e, %Y"} -->
             </div>
             <div class="job-info">
-                {include file='front/jobs/parts/bigBay.html'}
-                {include file='front/jobs/parts/alston.html'}
-                {include file='front/jobs/parts/nestoria.html'}
-                {include file='front/jobs/parts/chassell.html'}
-                {include file='front/jobs/parts/pinery.html'}  
+                jobs
             </div>
         </div>
     {/foreach}