setting up database data and data classes
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 8 Sep 2017 19:08:00 +0000 (15:08 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 8 Sep 2017 19:08:00 +0000 (15:08 -0400)
classes/data/dataJobTitles.php [new file with mode: 0644]
classes/data/dataJobs.php
setup/databaseScripts/create_database_V0.0.1.sql

diff --git a/classes/data/dataJobTitles.php b/classes/data/dataJobTitles.php
new file mode 100644 (file)
index 0000000..1e805be
--- /dev/null
@@ -0,0 +1,167 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Job Titles
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataConditions.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**********************************************************************
+ *  NOTE: THIS IS A Job Postings FILE - DO NOT USE UNMODIFIED
+ *
+ *  Please change all references to conditions, Conditions, or CONDITIONS to a name
+ *  appropriate for your new Add-On.
+ *
+ *  Data fields in this file are conditions only.
+ *
+ *  Remove this message before using this file in production!
+ **********************************************************************/
+
+/**
+ * GlmDatajobsTitles class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author  Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDatajobTitles extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Data Table Name
+     *
+     * @var $table
+     * @access public
+     */
+    public $table;
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+    
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    public function __construct($wpdb, $config, $limitedEdit = false)
+    {
+
+        // If this class is not being extended along with existing $wpdb and $config
+        if (!$this->wpdb) {
+
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
+
+            // Save plugin configuration object
+            $this->config = $config;
+
+        }
+
+        /*
+         * Table Name
+         */
+        
+        $this->table = GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'reports';
+
+        //        -- Conditions Table
+        //CREATE TABLE {prefix}conditions (
+        //  id INT NOT NULL AUTO_INCREMENT,
+        //  name TEXT NOT NULL,
+        //  descr_short TEXT NULL,
+        //  descr TEXT NULL,
+        //  last_update DATE NULL,
+        //  PRIMARY KEY (id)
+        //);
+        
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'use' => 'a'
+            ),
+            'job_title' => array (
+                'field' => 'title',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+        );
+    }
+
+    /*
+     * Entry Post Processing Call-Back Method
+     *
+     * Perform post-processing for all result entries.
+     *
+     * In this case we're using it to append an array of category
+     * data to each row result and also sort by name.
+     *
+     * @param array $r Array of field result data for a single entry
+     * @param string $a Action being performed (l, i, g, ...)
+     *
+     * @return object Class object
+     *
+     */
+    public function entryPostProcessing($r, $a)
+    {
+        return $r;
+    }
+
+}
+
+?>
\ No newline at end of file
index 7849c25..8f9ce9a 100644 (file)
@@ -133,180 +133,104 @@ class GlmDatajobs extends GlmDataAbstract
             'id' => array (
                 'field' => 'id',
                 'type' => 'integer',
-                'view_only' => true,
                 'use' => 'a'
             ),
-            'report_active' => array (
-                'field' => 'report_active',
-                'type' => 'checkbox',
-                'default' => false,
+            'title' => array (
+                'field' => 'title',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'jobs_titles',
+                    'p_field' => 'job_title',
+                    'p_orderby' => 'job_Title',
                 'use' => 'a'
             ),
-            'report_date' => array (
-                'field' => 'report_date',
-                'type' => 'date',
-                'default' => false,
-                'use' => 'a'
-            ),
-            'report_notes' => array (
-                'field' => 'report_notes',
+            'descr' => array (
+                'field' => 'descr',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'big_bay_cond' => array (
-                'field' => 'big_bay_cond',
+            'salary' => array (
+                'field' => 'salary',
                 'type' => 'text',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'big_bay_name' => array (
-                'field' => 'big_bay_name',
-                'type' => 'text',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'big_bay_groom' => array (
-                'field' => 'big_bay_groom',
-                'type' => 'date',
-                'required' => true,
                 'use' => 'a'
             ),
-            'big_bay_base' => array (
-                'field' => 'big_bay_base',
+            'location' => array (
+                'field' => 'location',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'big_bay_notes' => array (
-                'field' => 'big_bay_notes',
+            'contactname' => array (
+                'field' => 'contactname',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'alston_name' => array (
-                'field' => 'alston_name',
+            'contactphone' => array (
+                'field' => 'contactphone',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'alston_cond' => array (
-                'field' => 'alston_cond',
-                'type' => 'text',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'alston_groom' => array (
-                'field' => 'alston_groom',
+            'post_date' => array (
+                'field' => 'post_date',
                 'type' => 'date',
-                'required' => true,
                 'use' => 'a'
             ),
-            'alston_base' => array (
-                'field' => 'alston_base',
-                'type' => 'text',
-                'required' => true,
+            'visible' => array (
+                'field' => 'visible',
+                'type' => 'boolean',
                 'use' => 'a'
             ),
-            'alston_notes' => array (
-                'field' => 'alston_notes',
+            'facility_operation' => array (
+                'field' => 'facility_operation',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'nestoria_cond' => array (
-                'field' => 'nestoria_cond',
+            'requirements' => array (
+                'field' => 'requirements',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'nestoria_name' => array (
-                'field' => 'nestoria_groom',
-                'type' => 'date',
-                'required' => true,
-                'use' => 'a'
-            ),
-            
-            'nestoria_groom' => array (
-                'field' => 'nestoria_groom',
-                'type' => 'date',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'nestoria_base' => array (
-                'field' => 'nestoria_base',
-                'type' => 'text',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'nestoria_notes' => array (
-                'field' => 'nestoria_notes',
-                'type' => 'text',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'chassell_cond' => array (
-                'field' => 'chassell_cond',
+            'benefits' => array (
+                'field' => 'benefits',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'chassell_name' => array (
-                'field' => 'chassell_name',
-                'type' => 'text',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'chassell_groom' => array (
-                'field' => 'chassell_groom',
-                'type' => 'date',
-                'required' => true,
+            'job_location' => array (
+                'field' => 'job_location',
+                'type' => 'tex',
                 'use' => 'a'
             ),
-            'chassell_base' => array (
-                'field' => 'chassell_base',
+            'job_expiration' => array (
+                'field' => 'job_expiration',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'chassell_notes' => array (
-                'field' => 'chassell_notes',
+            'duration' => array (
+                'field' => 'duration',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'pinery_name' => array (
-                'field' => 'pinery_name',
+            'deadline' => array (
+                'field' => 'deadline',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'pinery_base' => array (
-                'field' => 'pinery_base',
+            'course_operation' => array (
+                'field' => 'course_operation',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'pinery_notes' => array (
-                'field' => 'pinery_notes',
+            'position_available' => array (
+                'field' => 'position_available',
                 'type' => 'text',
-                'required' => true,
                 'use' => 'a'
             ),
-            'pinery_groom' => array (
-                'field' => 'pinery_groom',
-                'type' => 'date',
-                'required' => true,
-                'use' => 'a'
-            ),
-            'report_blurb' => array (
-                'field' => 'report_blurb',
-                'type' => 'text',
-                'required' => true,
+            'member' => array (
+                'field' => 'member',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_MEMBERS_PLUGIN_DB_PREFIX . 'members',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
                 'use' => 'a'
             ),
-            
         );
     }
 
index 6295955..31fe7ed 100644 (file)
 
 -- Conditions Table
 CREATE TABLE {prefix}jobs (
-  id INT NOT NULL AUTO_INCREMENT,
-
-  PRIMARY KEY (id)
+    id INT NOT NULL AUTO_INCREMENT,
+    title TINYINT NULL DEFAULT '',
+    descr TEXT NULL DEFAULT '',
+    salary TINYTEXT NULL DEFAULT '',
+    location TINYTEXT NULL DEFAULT '',
+    contactname TINYTEXT NULL DEFAULT '',
+    contactphone TINYTEXT NULL DEFAULT '',
+    post_date DATETIME NULL DEFAULT '',
+    visible BOOL NULL DEFAULT '',
+    facility_operation TEXT NULL DEFAULT '',
+    requirements TEXT NULL DEFAULT '',
+    benefits TEXT NULL DEFAULT '',
+    joblocation TINYTEXT NULL DEFAULT '',
+    post TINYTEXT NULL DEFAULT '30 days',
+    duration TINYTEXT NULL DEFAULT '',
+    deadline TINYTEXT NULL DEFAULT '',
+    course_operation TINYTEXT NULL DEFAULT '',
+    position_available TINYTEXT NULL DEFAULT '',
+    member INT NULL DEFAULT '',
+    PRIMARY KEY (id)
 );
 
-----
\ No newline at end of file
+----
+
+-- Job Titles
+CREATE TABLE {prefix}job_titles (
+  id INT NOT NULL AUTO_INCREMENT,
+  job_title TINYTEXT NULL DEFAULT '',
+  PRIMARY KEY (id)
+);
\ No newline at end of file