making changes to the database setup script to changes some of the field names
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 13 Sep 2017 20:37:48 +0000 (16:37 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 13 Sep 2017 20:37:48 +0000 (16:37 -0400)
finishing the setup for the job titles settings and pulling them into the edit view,
changing some of the database field's names.

classes/data/dataJobTitles.php
classes/data/dataJobs.php
css/admin.css
models/admin/jobs/index.php
models/admin/settings/jobTitles.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

index 0a10234..fb21aa2 100644 (file)
@@ -35,7 +35,7 @@
  *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
  *          Exp $
  */
-class GlmDatajobTitles extends GlmDataAbstract
+class GlmDataJobTitles extends GlmDataAbstract
 {
 
     /**
@@ -112,7 +112,7 @@ class GlmDatajobTitles extends GlmDataAbstract
          * Table Name
          */
         
-        $this->table = GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'jobs';
+        $this->table = GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'job_titles';
 
         //        -- Conditions Table
         //CREATE TABLE {prefix}conditions (
index 1d441c3..b4de75f 100644 (file)
@@ -138,7 +138,7 @@ class GlmDatajobs extends GlmDataAbstract
             'title' => array (
                 'field' => 'title',
                 'type' => 'pointer',
-                    'p_table' => GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'jobs_titles',
+                    'p_table' => GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'job_titles',
                     'p_field' => 'job_title',
                     'p_orderby' => 'job_Title',
                 'use' => 'a'
@@ -216,8 +216,8 @@ class GlmDatajobs extends GlmDataAbstract
                 'type' => 'text',
                 'use' => 'a'
             ),
-            'course_operation' => array (
-                'field' => 'course_operation',
+            'company' => array (
+                'field' => 'company',
                 'type' => 'text',
                 'use' => 'a'
             ),
index f638434..f6fd0fc 100644 (file)
@@ -1,4 +1,7 @@
 #glm-admin-content-container .admin-job-label,
 #glm-admin-content-container .admin-job-input{
     padding: 0;
+}
+.jobTitle-record{
+    float: left;
 }
\ No newline at end of file
index 8f2ee5f..e705187 100644 (file)
@@ -14,7 +14,9 @@
  */
 
 // Load Contacts data abstract
-require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobs.php';
+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
 {
@@ -86,6 +88,9 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs
 
     public function modelAction($actionData = false)
     {
+        $job_titles = new GlmDataJobTitles($this->wpdb,$this->config);
+        $job_titles = $job_titles->getList();
+        
         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');
@@ -98,7 +103,7 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs
         $jobUpdateError = false;
         $jobAdded       = false;
         $jobAddError    = false;
-        
+        $view_file = 'index';
         if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
             $option = $_REQUEST['option'];
         }
@@ -107,7 +112,7 @@ 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($this->getList()), '</pre>';
+//        echo '<pre>', print_r($this->getList()), '</pre>';
         // echo '<pre>', print_r($_REQUEST), '</pre>';
         
         switch ($option) {
@@ -145,9 +150,6 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs
                 break;
 
             case 'edit':
-
-
-
                 $job = $this->editEntry($this->job_id);
 
                 // If we have a good Job
@@ -193,10 +195,11 @@ class GlmMembersAdmin_jobs_index extends GlmDatajobs
                 $view_file = 'index';
                 break;
         }
-        
+//        echo '<pre>', print_r($this->getList()), '</pre>';
         // Compile template data
         $templateData = array(
             'jobData'        => $job_data,
+            'jobTitles'      => $job_titles,
             'haveJob'        => $haveJob,
             'jobUpdated'     => $jobUpdated,
             'jobUpdateError' => $jobUpdateError,
index 97d01ae..e92b9ad 100644 (file)
@@ -2,7 +2,7 @@
 <?php
 /**
  * Gaslight Media Members Database
- * Admin Obits Dashboard
+ * Admin Job Titles Dashboard
  *
  * PHP version 5.5
  *
@@ -14,7 +14,7 @@
  * @link     http://dev.gaslightmedia.com/
  */
 
-// Load Obits data abstract
+// Load Job Titles data abstract
 require_once GLM_MEMBERS_JOBS_PLUGIN_CLASS_PATH.'/data/dataJobTitles.php';
 
 class GlmMembersAdmin_settings_jobTitles extends GlmDataJobTitles
@@ -35,12 +35,12 @@ class GlmMembersAdmin_settings_jobTitles extends GlmDataJobTitles
      */
     public $config;
     /**
-     * Obit ID
+     * Job Title ID
      *
      * @var $obitID
      * @access public
      */
-    public $obitID = false;
+    public $jobTitleID = false;
 
     /**
      * Constructor
@@ -77,7 +77,7 @@ class GlmMembersAdmin_settings_jobTitles extends GlmDataJobTitles
         $this->config = $config;
 
         /*
-         * Run constructor for the Obits data class
+         * Run constructor for the Job Titles 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'.
@@ -89,9 +89,9 @@ class GlmMembersAdmin_settings_jobTitles extends GlmDataJobTitles
     public function modelAction($actionData = false)
     {
 
-        $numbObits       = 0;
-        $namesList       = false;
-        
+        $numbJobTitles      = 0;
+        $jobTitleList       = false;
+  
         // Check if an ID is supplied
         $id = 0;
         if ( isset( $_REQUEST['id'] ) ) {
@@ -129,7 +129,7 @@ class GlmMembersAdmin_settings_jobTitles extends GlmDataJobTitles
         // Get number of obits
 
         $jobTitles = $this->getList();
-
+//        echo '<pre>', print_r($this), '<pre>';
         // Compile template data
         $templateData = array(
             'jobTitles'      => $jobTitles,
index e175f23..9dc6513 100644 (file)
@@ -29,7 +29,7 @@ CREATE TABLE {prefix}jobs (
     job_expiration TINYTEXT NULL,
     duration TINYTEXT NULL ,
     deadline TINYTEXT NULL ,
-    course_operation TINYTEXT NULL ,
+    company TINYTEXT NULL ,
     position_available TINYTEXT NULL ,
     member INT NULL,
     PRIMARY KEY (id)
@@ -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,
-course_operation,member
-) VALUES ( 1, 'TITLE',"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'CONTACT NAME', '453-3443', NOW(), false,
+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',
-'COURSE OPERATION', 1
+'COMPANY', 1
 );
\ No newline at end of file
index 8c4e429..9c46898 100644 (file)
@@ -63,9 +63,9 @@ $glmMembersjobsAddOnValidActions = array(
             'index' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
             'list'  => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
         ),
-    ),
-    'settings' => array(
-        'jobTitles' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
+        'settings' => array(
+            'jobTitles' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
+        ),
     ),
     'frontActions' => array(
         'jobs' => array( 
index d9d72ff..ab8ea32 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>
+        <!-- JOB TITLE -->
         <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 class="glm-small-12 glm-medium-4 glm-columns admin-job-input">
+                <select id="job_title" data-id="title" name="title">
+                    <option value="">Select a date range</option>
+                    {foreach from=$jobTitles item=j}
+                        {if 'fieldData'|array_key_exists:$job}
+                            <option value="{$job.id}" {if $job.fieldData.title.name == {$j.job_title}} selected="selected"{/if}>
+                        {else if}
+                            <option value="{$j.id}">
+                        {/if}
+                            {$j.job_title}
+                        </option>
+                    {/foreach}
+                </select>
+            </div>
+            <div class="glm-small-12 glm-medium-4 glm-columns admin-job-input">
+                <input type='text' name="title">
             </div>
         </div>
+        <!-- MEMBER -->
         <div class="glm-job-row glm-row">
             <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
                     
@@ -50,6 +66,7 @@
                 <input type="text" name="position_available">
             </div>
         </div>
+        <!-- POSITON AVAILABLE -->
         <div class="glm-job-row glm-row">
             <div class="glm-small-12 glm-medium-4 glm-columns admin-job-label">
                     
@@ -58,6 +75,7 @@
                 <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">
                     
index 866ba80..6aa0b36 100644 (file)
@@ -6,25 +6,23 @@
         <tr>
             <td class="add-Job"><a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=add">New Job</a></td>
         </tr>
-
     </table>
-    {$jobData}
     {if $jobData}
-        yes there is
             <table class="glm-admin-table">
                 <tr>
-
+                   
                 </tr>
             {foreach $jobData as $job=>$data}
                 <tr>
-                    <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>
+                    {$data.title}{$data.company}{$data.post_date.timestamp|date_format:"%Y-%m-%d"}
+                    <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}
             </table>
         
         <script>
             jQuery(document).ready(function($) {
-                console.log("test");
+              
             });
         </script>
     {else if}
index c627c24..2a4ec87 100644 (file)
-<!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>
+{include file='admin/management/header.html'}
+
+<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+    <a href="{$thisUrl}?page=glm-members-admin-menu-settings&glm_action=jobTitles" class="glm-settings-tab nav-tab nav-tab-active">Job Titles</a>
+</h2>
+<table class="glm-admin-table glm-settings-table" style="width: 90%;">
+    <tr><td colspan="2">
+        <!-- Add Registration Payment Code Button and Dialog Box -->
+        <div id="newJobTitleButton" class="button button-primary glm-right">Add a Job Title</div>
+        <div id="newJobTitleDialog" class="glm-dialog-box" title="Ener a Job Title">
+            <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+                <input type="hidden" name="glm_action" value="jobTitles">
+                <input type="hidden" name="option" value="addNew">
+
+                <!-- This is only temporary until we reinstate the "Used With" selection below -->
+                <table class="glm-admin-table">
+                    <tr>
+                        <th class="glm-required">Job Title: </th>
+                        <td>
+                            <input id="edit-name" data-id="job_title" type="text" name="job_title" class="glm-form-text-input">
+                        </td>
+                    </tr>
+                </table>
+                <p><span class="glm-required">*</span> Required</p>
+                <a id="newJobTitleCancel" class="button button-primary glm-right">Cancel</a>
+                <input type="submit" value="Add new Job Title" class="button button-primary">
+                
+            </form>
+        </div>
+
+        <!-- Delete Job Title Button -->
+        <div id="deleteJobTitleDialog" class="glm-dialog-box" title="Delete Job Title">
+            <center>
+                <p>Are you sure you want to delete this Newspaper?</p>
+                <p><div id="deleteJobTitleConfirm" class="button button-primary">Yes, delete this Job Title</div></p>
+                <p><div id="deleteJobitleCancel" class="button button-primary">Cancel</div></p>
+            </center>
+        </div>
+
+        <!-- Edit Job Title -->
+        <div id="editJobTitleDialog" class="glm-dialog-box" title="Edit This Job Title">
+            <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+                <input type="hidden" name="glm_action" value="jobTitles">
+                <input type="hidden" name="option" value="update">
+                <input id="editJobTitleID" type="hidden" name="id" value="">
+
+                <!-- This is only temporary until we reinstate the "Used With" selection below -->
+                <table class="glm-admin-table">
+                      <tr>
+                        <th class="glm-required">Job Title:</th>
+                        <td>
+                            <input id="edit-job-title" data-id="job_title" type="text" name="job_title" class="glm-form-text-input">
+                        </td>
+                    </tr>
+                    <tr>
+                </table>
+                <p><span class="glm-required">*</span> Required</p>
+                <a id="editJobTitleCancel" class="button button-primary glm-right">Cancel</a>
+                <input type="submit" value="Update this Job Ttile">
+
+            </form>
+        </div>
+
+        <table class="wp-list-table wideFat fixed posts glm-admin-table" style="width: 90%;">
+            <thead>
+                <tr>
+                    <th> Job Title </th>
+                    <th>&nbsp;</th>
+                </tr>
+            </thead>
+            <tbody>
+               
+            {if $jobTitles}
+                {assign var="i" value="0"}
+                {foreach $jobTitles as $job}
+                    {if $i++ is odd by 1}
+                        <tr>
+                    {else}
+                        <tr class="alternate">
+                    {/if}
+                            <td>
+                                <div class="jobTitle-record" id="jobTitle_{$job.id}" data-jobTitleID="{$job.id}" >{$job.job_title}</div>
+                                <div class="editJobTitleButton editJobTitle button button-secondary glm-button-small glm-right" data-jobTitleID="{$job.id}">Edit</div> 
+                                <div class="deleteJobTitleButton button button-secondary glm-button-small glm-right" data-jobTitleID="{$job.id}">Delete</div>
+                            </td>
+                        </tr>
+                  
+                {/foreach}
+            {else}
+                <tr class="alternate"><td colspan="2">(No Job Titles Listed)</td></tr>
+            {/if}
+            </tbody>
+        </table>
+    </tr>
+</table>
+
+<script type="text/javascript">
+    jQuery(document).ready(function($) {
+
+        $("#newJobTitleDialog").dialog({
+            autoOpen: false,
+            minWidth: 400,
+            dialogClass: "glm-dialog-no-close"
+        });
+        $("#editJobTitleDialog").dialog({
+            autoOpen: false,
+            minWidth: 400,
+            dialogClass: "glm-dialog-no-close"
+        });
+        $("#deleteJobTitleDialog").dialog({
+            autoOpen: false,
+            minWidth: 400,
+            dialogClass: "glm-dialog-no-close"
+        });
+
+        $('#newJobTitleButton').click( function() {
+            $("#newJobTitleDialog").dialog("open");
+        });
+        $('.editJobTitle').click( function() {
+            var newspaperID        = $(this).attr('data-jobTitleID');
+
+            $('#editJobTitleID').val(newspaperID);
+
+            $("#editJobTitleDialog").dialog("open");
+        });
+        $('#editJobTitleCancel').click( function() {
+            $("#editJobTitleDialog").dialog("close");
+        });
+        $('#newJobTitleCancel').click( function() {
+            $("#newJobTitleDialog").dialog("close");
+        });
+
+        var id = false;
+        $('.deleteJobTitleButton').click( function() {
+            id = $(this).attr('data-jobTitleID');
+            $("#deleteJobTitleDialog").dialog("open");
+        });
+        $('#deleteJobTitleConfirm').click( function() {
+            $("#deleteJobTitleDialog").dialog("close");
+            window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=jobTitles&option=delete&id=" + id;
+        });
+        $('#deleteJobTitleCancel').click( function() {
+            $("#deleteJobTitleDialog").dialog("close");
+        });
+
+        /*
+         * Edit area tabs
+         */
+        $('.glm-settings-tab').click( function() {
+
+            // Clear tabl highlights and hide all tables
+            $('.glm-settings-tab').removeClass('nav-tab-active');
+            $('.glm-settings-table').addClass('glm-hidden');
+
+            // Highlight selected tab
+            $(this).addClass('nav-tab-active');
+
+            // Show selected table
+            var table = $(this).attr('data-show-table');
+            $('#' + table).removeClass('glm-hidden');
+
+        });
+
+    });
+</script>
+