First bulk commit
authorLaury GvR <laury@gaslightmedia.com>
Fri, 14 Oct 2016 21:11:26 +0000 (17:11 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 14 Oct 2016 21:11:26 +0000 (17:11 -0400)
24 files changed:
classes/data/dataConditions.php [new file with mode: 0644]
classes/data/dataCurrentCondition.php [new file with mode: 0644]
classes/data/dataSample.php [deleted file]
config/plugin.ini
css/admin.css [new file with mode: 0644]
defines.php
models/admin/conditions/index.php
models/admin/conditions/more.php [deleted file]
models/front/conditions/current.php [new file with mode: 0644]
setup/databaseScripts/DNUupdate_database_V0.0.1.sql [new file with mode: 0644]
setup/databaseScripts/DNUupdate_database_V0.0.2.sql [new file with mode: 0644]
setup/databaseScripts/create_database_V0.0.1.sql
setup/databaseScripts/dbVersions.php
setup/databaseScripts/drop_database_V0.0.1.sql [new file with mode: 0644]
setup/frontHooks.php
setup/shortcodes.php
setup/validActions.php
views/admin/conditions/edit.html [new file with mode: 0644]
views/admin/conditions/index.html
views/admin/conditions/more.html [deleted file]
views/front/conditions/front.html [new file with mode: 0644]
views/front/conditions/inside.html [new file with mode: 0644]
views/front/conditions/side.html [new file with mode: 0644]
views/front/index.html [new file with mode: 0644]

diff --git a/classes/data/dataConditions.php b/classes/data/dataConditions.php
new file mode 100644 (file)
index 0000000..6f3069e
--- /dev/null
@@ -0,0 +1,204 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Conditions
+ *
+ * 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 CONDITIONS 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!
+ **********************************************************************/
+
+/**
+ * GlmDataConditions 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 GlmDataConditions 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_CONDITIONS_PLUGIN_DB_PREFIX . 'conditions';
+
+        //        -- 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',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Active flag
+            'name' => array (
+                'field' => 'name',
+                'type' => 'checkbox',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            'descr_short' => array (
+                'field' => 'descr_short',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'a'
+            ),
+            
+            'descr' => array (
+                'field' => 'descr',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'a'
+            ),
+            
+            'last_update' => array (
+                'field' => 'last_update',
+                'type' => 'date',
+                'required' => true,
+                'use' => 'a'
+            ),
+            
+            // Condition
+//            'condition' => array (
+//                'field' => 'condition',
+//                'type' => 'list',
+//                'list' => $this->config['condition'],
+//                'required' => true,
+//                'default' => $this->config['condition'][0],
+//                '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
diff --git a/classes/data/dataCurrentCondition.php b/classes/data/dataCurrentCondition.php
new file mode 100644 (file)
index 0000000..44b86ee
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Conditions
+ *
+ * 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 CONDITIONS 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!
+ **********************************************************************/
+
+/**
+ * GlmDataConditions 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 GlmDataCurrentCondition 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_CONDITIONS_PLUGIN_DB_PREFIX . 'current_condition';
+
+        //        -- 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',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Active flag
+            'cond_id' => array (
+                'field' => 'cond_id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+            
+            'special' => array (
+                'field' => 'descr_short',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'a'
+            ),
+            
+            'last_update' => array (
+                'field' => 'descr',
+                'type' => 'date',
+                'default' => time(),
+                'required' => true,
+                '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
diff --git a/classes/data/dataSample.php b/classes/data/dataSample.php
deleted file mode 100644 (file)
index fd774de..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-/**
- * GLM Member-DB WordPress Add-On Plugin
- * Data Class Conditions
- *
- * 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 CONDITIONS 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!
- **********************************************************************/
-
-/**
- * GlmDataConditions 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 GlmDataConditions 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_CONDITIONS_PLUGIN_DB_PREFIX . 'conditionstable';
-
-        /*
-         * Table Data Fields
-         */
-
-        $this->fields = array (
-
-            'id' => array (
-                'field' => 'id',
-                'type' => 'integer',
-                'view_only' => true,
-                'use' => 'a'
-            ),
-
-            // Active flag
-            'active' => array (
-                'field' => 'active',
-                'type' => 'checkbox',
-                'default' => true,
-                '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 1069061..4c03778 100644 (file)
@@ -6,3 +6,15 @@
 ;
 
 [common]
+cond_type[0]  = ''
+cond_type[10] = 'High Wind Warning'
+cond_type[11] = 'Falling Ice Warning'
+cond_type[12] = 'Fog Warning'
+cond_type[13] = 'Blowing Snow Warning'
+cond_type[20] = 'Wind Escort'
+cond_type[30] = 'Partial Bridge Closure'
+cond_type[31] = 'Bridge Closed - General'
+cond_type[32] = 'Bridge Closed - High Winds'
+cond_type[33] = 'Bridge Closed - Weather'
+cond_type[34] = 'Bridge Closed - Falling Ice'
+cond_type[99] = 'Special Condition'
\ No newline at end of file
diff --git a/css/admin.css b/css/admin.css
new file mode 100644 (file)
index 0000000..0f51854
--- /dev/null
@@ -0,0 +1,3 @@
+#editConditionDesc {
+    width: 400px;
+}
index 1c7be4c..e5a4b86 100644 (file)
@@ -48,6 +48,7 @@ $WPUploadDir = wp_upload_dir();
 
 // URLs
 define('GLM_MEMBERS_CONDITIONS_SITE_BASE_URL', home_url('/') );
+define('GLM_MEMBERS_CONDITIONS_SITE_THEME_URL', get_template_directory_uri() );
 define('GLM_MEMBERS_CONDITIONS_PLUGIN_URL', plugin_dir_url(__FILE__));
 define('GLM_MEMBERS_CONDITIONS_PLUGIN_ADMIN_URL', admin_url('admin.php'));
 define('GLM_MEMBERS_CONDITIONS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_CONDITIONS_PLUGIN_SLUG);
index dddc03e..1c69fe3 100644 (file)
@@ -14,9 +14,9 @@
  */
 
 // Load Contacts data abstract
-//require_once GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php';
+require_once GLM_MEMBERS_CONDITIONS_PLUGIN_CLASS_PATH.'/data/dataConditions.php';
 
-class GlmMembersAdmin_conditions_index // extends GlmDataContacts
+class GlmMembersAdmin_conditions_index extends GlmDataConditions
 {
 
     /**
@@ -103,23 +103,110 @@ class GlmMembersAdmin_conditions_index // extends GlmDataContacts
 
     public function modelAction($actionData = false)
     {
-
-        $displayData = 'Hello, World! This is the Conditions Add-On "conditions" model talking to you from inside WordPress.';
+        $success_message = "";
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+        
+        $selected_condition = 0;
+        if (isset($_REQUEST['selected_condition']) && trim($_REQUEST['selected_condition']) != '') {
+            $selected_condition = $_REQUEST['selected_condition'];
+        }
+        
+        $cond_id = 0;
+        if (isset($_REQUEST['cond_id']) && trim($_REQUEST['cond_id']) != '') {
+            $cond_id = $_REQUEST['cond_id'];
+        }
+        $view_file = 'index';
+        switch ($option) {
+
+            case "edit":
+                $view_file = 'edit';
+                $sql = "SELECT C.*
+                          FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."conditions C
+                         WHERE C.id = $cond_id
+                ";
+                $selected_condition = $this->wpdb->get_results( $sql, ARRAY_A );
+                $success_message = "Update Successful";
+                break;
+            
+            default:
+                if (isset($_POST['condition_edit']) && trim($_REQUEST['condition_edit']) != '') {
+                    if (isset($_REQUEST['condition_name']) && trim($_REQUEST['condition_name']) != '') {
+                        $condition_name = $_REQUEST['condition_name'];
+                    }
+                    if (isset($_REQUEST['condition_descr']) && trim($_REQUEST['condition_descr']) != '') {
+                        $condition_descr = $_REQUEST['condition_descr'];
+                    }
+                    if (isset($_REQUEST['condition_descr_short']) && trim($_REQUEST['condition_descr_short']) != '') {
+                        $condition_descr_short = $_REQUEST['condition_descr_short'];
+                    }
+                    if (isset($_REQUEST['condition_id']) && trim($_REQUEST['condition_id']) != '') {
+                        $cond_id = $_REQUEST['condition_id'];
+                    }
+
+                    $sql = "UPDATE ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."conditions C
+                               SET C.name='$condition_name', C.descr='$condition_descr', C.descr_short='$condition_descr_short'
+                             WHERE C.id = $cond_id
+                    ";
+                    $this->wpdb->get_results( $sql );
+                    $success_message = "Update Successful";
+                    break;
+                }
+                
+                if (isset($_POST['condition_update']) && trim($_POST['condition_selected']) != '') {
+                    if (isset($_REQUEST['condition_selected']) && trim($_REQUEST['condition_selected']) != '') {
+                        $selected_condition = $_REQUEST['condition_selected'];
+                    }
+                    if (isset($_REQUEST['condition_current_special']) && trim($_REQUEST['condition_current_special']) != '') {
+                        $condition_current_special = $_REQUEST['condition_current_special'];
+                    }
+                    $sql = "UPDATE ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."current_condition CC
+                               SET CC.cond_id='$selected_condition', CC.special='$condition_current_special'
+                             WHERE CC.id = 1
+                    ";
+                    $this->wpdb->get_results( $sql );
+                    $success_message = "Update Successful";
+                }
+                
+                $sql = "SELECT C.*
+                        FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."conditions C
+                        WHERE C.id = (
+                            SELECT CC.id
+                            FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."current_condition CC
+                        )";
+                $selected_condition = $this->wpdb->get_results( $sql, ARRAY_A );
+                break;
+        }
+        
+        $sql = "
+            SELECT C.*
+            FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."conditions C
+        ";
+        $condition_list = $this->wpdb->get_results( $sql, ARRAY_A );
+        
+        $sql = "SELECT CC.*
+        FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."current_condition CC
+        ";
+        $current_condition = $this->wpdb->get_results( $sql, ARRAY_A );
 
         // Compile template data
         $templateData = array(
-            'displayData' => $displayData
+            'conditionList' => $condition_list,
+            'currentCondition' => $current_condition[0],
+            'selectedCondition' => $selected_condition[0],
+            'successMessage' => $success_message
         );
 
         // Return status, any suggested view, and any data to controller
         return array(
                 'status' => true,
                 'modelRedirect' => false,
-                'view' => 'admin/conditions/index.html',
+                'view' => 'admin/conditions/'.$view_file.'.html',
                 'data' => $templateData
         );
 
     }
 
-
 }
diff --git a/models/admin/conditions/more.php b/models/admin/conditions/more.php
deleted file mode 100644 (file)
index 40c5719..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Member User Profile
- *
- * 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 Contacts data abstract
-// require_once GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php';
-
-class GlmMembersAdmin_conditions_more // extends GlmDataContacts
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Contact Info
-     *
-     * @var $contactInfo
-     * @access public
-     */
-    public $contactInfo = false;
-    /**
-     * Member ID
-     *
-     * @var $memberID
-     * @access public
-     */
-    public $memberID = false;
-    /**
-     * Contact ID
-     *
-     * @var $contactID
-     * @access public
-     */
-    public $contactID = 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 Contacts 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)
-    {
-
-        $displayData = 'Welcome to more information!<br>This is the Conditions Add-On "conditions" model with action "more" talking to you from inside WordPress.';
-
-        // Compile template data
-        $templateData = array(
-            'displayData' => $displayData
-        );
-
-        // Return status, any suggested view, and any data to controller
-        return array(
-                'status' => true,
-                'modelRedirect' => false,
-                'view' => 'admin/conditions/more.html',
-                'data' => $templateData
-        );
-
-    }
-
-
-}
diff --git a/models/front/conditions/current.php b/models/front/conditions/current.php
new file mode 100644 (file)
index 0000000..7be40b5
--- /dev/null
@@ -0,0 +1,88 @@
+<?php 
+/**
+ * list.php
+ *
+ * This the Member Social plugin model for front end output of members social urls
+ */
+require_once(GLM_MEMBERS_CONDITIONS_PLUGIN_CLASS_PATH.'/data/dataCurrentCondition.php');
+class GlmMembersFront_conditions_current extends GlmDataCurrentCondition
+{
+    public $wpdb;
+    public $config;
+
+    /**
+     * __construct
+     *
+     * @param mixed $wpdb   The main Word Press DB Object
+     * @param mixed $config The main Config
+     *
+     * @access public
+     * @return void
+     */
+    public function __construct($wpdb, $config)
+    {
+        $this->wpdb = $wpdb;
+        $this->config = $config;
+
+        parent::__construct(false, false);
+    }
+
+    /**
+     * modelAction
+     *
+     * @param bool $actionData Action Data passed to the modelAction
+     *
+     * @access public
+     * @return void
+     */
+    public function modelAction($actionData = false)
+    {
+        $status = null;
+        $settings = $current_condition = array();
+
+        $sql = "SELECT CC.*
+        FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."current_condition CC
+        ";
+        $current_condition = $this->wpdb->get_results( $sql, ARRAY_A );
+        
+        $sql = "SELECT C.*
+        FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."conditions C
+        WHERE C.id = (
+            SELECT CC.cond_id
+            FROM ".GLM_MEMBERS_CONDITIONS_PLUGIN_DB_PREFIX."current_condition CC
+        )";
+        $selected_condition = $this->wpdb->get_results( $sql, ARRAY_A );
+
+        $todays_date = date("l, M d") . "th";
+        $time_now = date("g:i A");
+        
+        $view = "front";
+        if (isset($actionData['request']['view']) && $actionData['request']['view'] != "" ) {
+            $view = strtolower($actionData['request']['view']);
+        }
+        
+        $site_base_url = GLM_MEMBERS_CONDITIONS_SITE_THEME_URL;
+        
+        $conditions_url = esc_url( home_url( '/' ) ) . "conditions";
+        
+        // Compile template data
+        $templateData = array(
+            'currentCondition'  => $current_condition[0],
+            'selectedCondition' => $selected_condition[0],
+            'todaysDate' => $todays_date,
+            'timeNow' => $time_now,
+            'conditionsUrl' => $conditions_url,
+            'siteBaseUrl' => $site_base_url
+        );
+        
+        error_reporting(E_ALL ^ E_NOTICE);
+        return array(
+            'status'           => $status,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => 'front/conditions/'.$view.'.html',
+            'data'             => $templateData,
+            'settings'         => $settings
+        );
+    }
+}
diff --git a/setup/databaseScripts/DNUupdate_database_V0.0.1.sql b/setup/databaseScripts/DNUupdate_database_V0.0.1.sql
new file mode 100644 (file)
index 0000000..a338a6d
--- /dev/null
@@ -0,0 +1,55 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.3
+-- Database Update From Previous Version Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+
+DROP TABLE IF EXISTS
+    {prefix}conditions,
+    {prefix}current_condition
+;
+
+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)
+);
+
+----
+
+-- Current Conditions Table
+CREATE TABLE {prefix}current_condition (
+  id INT NOT NULL AUTO_INCREMENT,
+  cond_id INT NOT NULL,
+  special TEXT NULL,
+  last_update DATE NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Conditions default entries in table
+INSERT INTO {prefix}conditions ( id, name, last_update, descr_short, descr ) VALUES
+( 1, 'All Clear, Have a Pleasant Trip!', NOW(), "Currently there are no significant weather conditions to report to motorists planning to cross the Mackinac Bridge.", "Currently there are no significant weather conditions to report to motorists planning to cross the Mackinac Bridge. When you are traveling in the Straits area, please tune to AM radio 530 or 1610 for condition updates and for information about things to see and do.\n We hope that your trip is enjoyable and that you'll visit the Straits of Mackinac often.   Have a safe and pleasant trip!" ),
+( 2, 'High Wind Warning', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to issue a warning to all motorists preparing to cross the Mackinac Bridge.", "Currently we are experiencing winds of sufficient force in the Straits area to issue a warning to all motorists preparing to cross the Mackinac Bridge.\nExamples of vehicles which are especially vulnerable to high winds are pickup trucks with campers, motor homes, vehicles pulling trailers and enclosed semi-truck trailers.  Motorists are instructed to reduce their speed to a maximum of 20 miles per hour, turn on their four way flashers, and utilize the outside lane.  Motorists are asked to exercise appropriate caution.The Mackinac Bridge Authority is monitoring wind speeds at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates. " ),
+( 3, 'Wind Escort', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to require an escort of certain "high profile" vehicles across the Mackinac Bridge.", "Currently we are experiencing winds of sufficient force in the Straits area to require an escort of certain "high profile" vehicles across the Mackinac Bridge.\nExamples of high profile vehicles include pickup trucks with campers; cars with small boats, bicycles or luggage attached to the roof; Ryder or U-Haul trucks; any vehicle pulling a boat; semi-tractors with enclosed trailers and all trailers with side walls over two feet in height. High profile vehicles must be escorted.\nMotorists are asked to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions regarding how and when to proceed across the bridge.\nAll vehicles must exercise appropriate caution.  The Mackinac Bridge Authority is monitoring wind speeds at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 4, 'Partial Bridge Closure', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles except passenger cars, passenger vans, and empty pickup trucks.", "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles except passenger cars, passenger vans, and empty pickup trucks.  Winds are blowing across the bridge surface in excess of 50 miles per hour.\nMotorists  are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions regarding how and when to proceed across the bridge.\nPassenger cars, passenger vans, and pick-up trucks without campers are being permitted to cross, but drivers are asked to exercise appropriate caution.  Strong winds are blowing across the surface of the bridge.  Motorists are asked to drive 20 miles per hour or less.\nThe Mackinac Bridge Authority is monitoring wind speeds at  various points along the structure.  Additional steps will be implemented if conditions change.  When conditions improve,  the bridge will be reopened to all vehicles, although certain vehicles may still require an escort.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates. " ),
+( 5, 'Bridge Closed - High Winds', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles. ", "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles.  Winds are blowing across the bridge surface in excess of 65 miles per hour.\nMotorists are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring wind conditions at various points along the structure.  When conditions improve, the bridge will be reopened.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 6, 'Bridge Closed - General', NOW(), "Currently the Mackinac Bridge is closed to all traffic.", "Currently the Mackinac Bridge is closed to all traffic.\nMotorists  are instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 7, 'Bridge Closed - Weather', NOW(), "Due to the current weather conditions, the Mackinac Bridge is closed to all traffic.", "Due to the current weather conditions, the Mackinac Bridge is closed to all traffic.\nMotorists are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 8, 'Falling Ice Warning', NOW(), "Currently we are experiencing falling ice from the cables and towers on the Mackinac Bridge.", "Currently we are experiencing falling ice from the cables and towers on the Mackinac Bridge.\nMotorists are advised to reduce their speed to a maximum of 20 miles per hour, be alert and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring the current conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610." ),
+( 9, 'Bridge Closed - Falling Ice', NOW(), "Currently the Mackinac Bridge is closed to all traffic.  We are experiencing falling ice from the cables and towers on the bridge.","Currently the Mackinac Bridge is closed to all traffic.  We are experiencing falling ice from the cables and towers on the bridge.\nMotorists are advised to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring the conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610." ),
+( 10, 'Fog Warning', NOW(),"Currently we are experiencing fog in the Straits area.  ","Currently we are experiencing fog in the Straits area.  Due to limited visibility, motorists crossing the Mackinac Bridge are advised to reduce their speed to a maximum of 20 miles per hour, turn on their low-beam headlights, and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610 for updates. \n" ),
+( 11, 'Blowing Snow Warning', NOW(), "Currently we are experiencing blowing snow in the Straits area.", "Currently we are experiencing blowing snow in the Straits area.  Due to limited visibility it is necessary to issue a warning to all motorists preparing to cross the Mackinac Bridge.  In addition to limited visibility, the road surface may be slippery.\nMotorists are instructed to reduce their speed to a maximum of 20 miles per hour, turn on your low-beam headlights, and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 12, 'Special Condition', NOW(),"Special Condition information","Special Condition information" )
+;
+
+----
+
+INSERT INTO {prefix}current_condition ( id, cond_id, last_update ) VALUES ( 1, 1, NOW() );
\ No newline at end of file
diff --git a/setup/databaseScripts/DNUupdate_database_V0.0.2.sql b/setup/databaseScripts/DNUupdate_database_V0.0.2.sql
new file mode 100644 (file)
index 0000000..447064b
--- /dev/null
@@ -0,0 +1,53 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.2
+-- Database Update From Previous Version Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+UPDATE {prefix}conditions SET descr_short="Currently there are no significant weather conditions to report to motorists planning to cross the Mackinac Bridge.", descr="Currently there are no significant weather conditions to report to motorists planning to cross the Mackinac Bridge. When you are traveling in the Straits area, please tune to AM radio 530 or 1610 for condition updates and for information about things to see and do.\n We hope that your trip is enjoyable and that you'll visit the Straits of Mackinac often.   Have a safe and pleasant trip!" WHERE id='1';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing winds of sufficient force in the Straits area to issue a warning to all motorists preparing to cross the Mackinac Bridge.", descr="Currently we are experiencing winds of sufficient force in the Straits area to issue a warning to all motorists preparing to cross the Mackinac Bridge.\nExamples of vehicles which are especially vulnerable to high winds are pickup trucks with campers, motor homes, vehicles pulling trailers and enclosed semi-truck trailers.  Motorists are instructed to reduce their speed to a maximum of 20 miles per hour, turn on their four way flashers, and utilize the outside lane.  Motorists are asked to exercise appropriate caution.The Mackinac Bridge Authority is monitoring wind speeds at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates. " WHERE id='2';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing winds of sufficient force in the Straits area to require an escort of certain 'high profile' vehicles across the Mackinac Bridge.", descr="Currently we are experiencing winds of sufficient force in the Straits area to require an escort of certain 'high profile' vehicles across the Mackinac Bridge.\nExamples of high profile vehicles include pickup trucks with campers; cars with small boats, bicycles or luggage attached to the roof; Ryder or U-Haul trucks; any vehicle pulling a boat; semi-tractors with enclosed trailers and all trailers with side walls over two feet in height. High profile vehicles must be escorted.\nMotorists are asked to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions regarding how and when to proceed across the bridge.\nAll vehicles must exercise appropriate caution.  The Mackinac Bridge Authority is monitoring wind speeds at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." WHERE id='3';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles except passenger cars, passenger vans, and empty pickup trucks.", descr="Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles except passenger cars, passenger vans, and empty pickup trucks.  Winds are blowing across the bridge surface in excess of 50 miles per hour.\nMotorists  are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions regarding how and when to proceed across the bridge.\nPassenger cars, passenger vans, and pick-up trucks without campers are being permitted to cross, but drivers are asked to exercise appropriate caution.  Strong winds are blowing across the surface of the bridge.  Motorists are asked to drive 20 miles per hour or less.\nThe Mackinac Bridge Authority is monitoring wind speeds at  various points along the structure.  Additional steps will be implemented if conditions change.  When conditions improve,  the bridge will be reopened to all vehicles, although certain vehicles may still require an escort.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates. " WHERE id='4';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles. ", descr="Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles.  Winds are blowing across the bridge surface in excess of 65 miles per hour.\nMotorists are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring wind conditions at various points along the structure.  When conditions improve, the bridge will be reopened.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." WHERE id='5';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently the Mackinac Bridge is closed to all traffic.", descr="Currently the Mackinac Bridge is closed to all traffic.\nMotorists  are instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." WHERE id='6';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Due to the current weather conditions, the Mackinac Bridge is closed to all traffic.", descr="Due to the current weather conditions, the Mackinac Bridge is closed to all traffic.\nMotorists are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." WHERE id='7';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing falling ice from the cables and towers on the Mackinac Bridge.", descr="Currently we are experiencing falling ice from the cables and towers on the Mackinac Bridge.\nMotorists are advised to reduce their speed to a maximum of 20 miles per hour, be alert and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring the current conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610." WHERE id='8';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently the Mackinac Bridge is closed to all traffic.  We are experiencing falling ice from the cables and towers on the bridge.", descr="Currently the Mackinac Bridge is closed to all traffic.  We are experiencing falling ice from the cables and towers on the bridge.\nMotorists are advised to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring the conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610." WHERE id='9';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing fog in the Straits area.  ", descr="Currently we are experiencing fog in the Straits area.  Due to limited visibility, motorists crossing the Mackinac Bridge are advised to reduce their speed to a maximum of 20 miles per hour, turn on their low-beam headlights, and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610 for updates." WHERE id='10';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Currently we are experiencing blowing snow in the Straits area.", descr="Currently we are experiencing blowing snow in the Straits area.  Due to limited visibility it is necessary to issue a warning to all motorists preparing to cross the Mackinac Bridge.  In addition to limited visibility, the road surface may be slippery.\nMotorists are instructed to reduce their speed to a maximum of 20 miles per hour, turn on your low-beam headlights, and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." WHERE id='11';
+
+----
+
+UPDATE {prefix}conditions SET descr_short="Special Condition information", descr="Special Condition information" WHERE id='12';
\ No newline at end of file
index fbbf1cd..a7b5480 100644 (file)
@@ -35,19 +35,19 @@ CREATE TABLE {prefix}current_condition (
 ----
 
 -- Conditions default entries in table
-INSERT INTO {prefix}conditions ( id, name, last_update ) VALUES
-( 1, 'All Clear, Have a Pleasant Trip!', NOW() ),
-( 2, 'High Wind Warning', NOW() ),
-( 3, 'Wind Escort', NOW() ),
-( 4, 'Partial Bridge Closure', NOW() ),
-( 5, 'Bridge Closed - High Winds', NOW() ),
-( 6, 'Bridge Closed - General', NOW() ),
-( 7, 'Bridge Closed - Weather', NOW() ),
-( 8, 'Falling Ice Warning', NOW() ),
-( 9, 'Bridge Closed - Falling Ice', NOW() ),
-( 10, 'Fog Warning', NOW() ),
-( 11, 'Blowing Snow Warning', NOW() ),
-( 12, 'Special Condition', NOW() )
+INSERT INTO {prefix}conditions ( id, name, last_update, descr_short, descr ) VALUES
+( 1, 'All Clear, Have a Pleasant Trip!', NOW(), "Currently there are no significant weather conditions to report to motorists planning to cross the Mackinac Bridge.", "Currently there are no significant weather conditions to report to motorists planning to cross the Mackinac Bridge. When you are traveling in the Straits area, please tune to AM radio 530 or 1610 for condition updates and for information about things to see and do.\n We hope that your trip is enjoyable and that you'll visit the Straits of Mackinac often.   Have a safe and pleasant trip!" ),
+( 2, 'High Wind Warning', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to issue a warning to all motorists preparing to cross the Mackinac Bridge.", "Currently we are experiencing winds of sufficient force in the Straits area to issue a warning to all motorists preparing to cross the Mackinac Bridge.\nExamples of vehicles which are especially vulnerable to high winds are pickup trucks with campers, motor homes, vehicles pulling trailers and enclosed semi-truck trailers.  Motorists are instructed to reduce their speed to a maximum of 20 miles per hour, turn on their four way flashers, and utilize the outside lane.  Motorists are asked to exercise appropriate caution.The Mackinac Bridge Authority is monitoring wind speeds at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates. " ),
+( 3, 'Wind Escort', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to require an escort of certain 'high profile' vehicles across the Mackinac Bridge.", "Currently we are experiencing winds of sufficient force in the Straits area to require an escort of certain 'high profile' vehicles across the Mackinac Bridge.\nExamples of high profile vehicles include pickup trucks with campers; cars with small boats, bicycles or luggage attached to the roof; Ryder or U-Haul trucks; any vehicle pulling a boat; semi-tractors with enclosed trailers and all trailers with side walls over two feet in height. High profile vehicles must be escorted.\nMotorists are asked to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions regarding how and when to proceed across the bridge.\nAll vehicles must exercise appropriate caution.  The Mackinac Bridge Authority is monitoring wind speeds at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 4, 'Partial Bridge Closure', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles except passenger cars, passenger vans, and empty pickup trucks.", "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles except passenger cars, passenger vans, and empty pickup trucks.  Winds are blowing across the bridge surface in excess of 50 miles per hour.\nMotorists  are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions regarding how and when to proceed across the bridge.\nPassenger cars, passenger vans, and pick-up trucks without campers are being permitted to cross, but drivers are asked to exercise appropriate caution.  Strong winds are blowing across the surface of the bridge.  Motorists are asked to drive 20 miles per hour or less.\nThe Mackinac Bridge Authority is monitoring wind speeds at  various points along the structure.  Additional steps will be implemented if conditions change.  When conditions improve,  the bridge will be reopened to all vehicles, although certain vehicles may still require an escort.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates. " ),
+( 5, 'Bridge Closed - High Winds', NOW(), "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles. ", "Currently we are experiencing winds of sufficient force in the Straits area to close the Mackinac Bridge to all vehicles.  Winds are blowing across the bridge surface in excess of 65 miles per hour.\nMotorists are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring wind conditions at various points along the structure.  When conditions improve, the bridge will be reopened.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 6, 'Bridge Closed - General', NOW(), "Currently the Mackinac Bridge is closed to all traffic.", "Currently the Mackinac Bridge is closed to all traffic.\nMotorists  are instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 7, 'Bridge Closed - Weather', NOW(), "Due to the current weather conditions, the Mackinac Bridge is closed to all traffic.", "Due to the current weather conditions, the Mackinac Bridge is closed to all traffic.\nMotorists are being instructed to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 8, 'Falling Ice Warning', NOW(), "Currently we are experiencing falling ice from the cables and towers on the Mackinac Bridge.", "Currently we are experiencing falling ice from the cables and towers on the Mackinac Bridge.\nMotorists are advised to reduce their speed to a maximum of 20 miles per hour, be alert and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring the current conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610." ),
+( 9, 'Bridge Closed - Falling Ice', NOW(), "Currently the Mackinac Bridge is closed to all traffic.  We are experiencing falling ice from the cables and towers on the bridge.","Currently the Mackinac Bridge is closed to all traffic.  We are experiencing falling ice from the cables and towers on the bridge.\nMotorists are advised to reduce their speed to 20 miles per hour as they approach the bridge and be prepared to stop.  Bridge personnel are stationed at both ends of the structure to provide instructions.\nThe Mackinac Bridge Authority is monitoring the conditions at various points along the structure.  When conditions improve, the bridge will be reopened to traffic.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610." ),
+( 10, 'Fog Warning', NOW(),"Currently we are experiencing fog in the Straits area.  ","Currently we are experiencing fog in the Straits area.  Due to limited visibility, motorists crossing the Mackinac Bridge are advised to reduce their speed to a maximum of 20 miles per hour, turn on their low-beam headlights, and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM 530 or 1610 for updates. \n" ),
+( 11, 'Blowing Snow Warning', NOW(), "Currently we are experiencing blowing snow in the Straits area.", "Currently we are experiencing blowing snow in the Straits area.  Due to limited visibility it is necessary to issue a warning to all motorists preparing to cross the Mackinac Bridge.  In addition to limited visibility, the road surface may be slippery.\nMotorists are instructed to reduce their speed to a maximum of 20 miles per hour, turn on your low-beam headlights, and exercise appropriate caution.\nThe Mackinac Bridge Authority is monitoring conditions at various points along the structure.  Additional steps will be implemented if conditions change.  If you are planning to travel to the Straits area, please tune to AM radio 530 or 1610 for updates." ),
+( 12, 'Special Condition', NOW(),"Special Condition information","Special Condition information" )
 ;
 
 ----
index 0347305..4682429 100644 (file)
@@ -36,4 +36,3 @@
 $glmMembersConditionsDbVersions = array(
     '0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '10/10/2016'),
 );
-
diff --git a/setup/databaseScripts/drop_database_V0.0.1.sql b/setup/databaseScripts/drop_database_V0.0.1.sql
new file mode 100644 (file)
index 0000000..f604b87
--- /dev/null
@@ -0,0 +1,11 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.1
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+
+DROP TABLE IF EXISTS
+    {prefix}conditions,
+    {prefix}current_condition
+;
+
index 5f30428..156c804 100644 (file)
  *
  *  *** Also note that parameters will be in the context of the main front controller constructor. ***
  */
+
+
+add_filter('bridge-conditions-frontpage', function($content) {
+        $conditionsData = do_shortcode('[glm-members-conditions-current view="front"]');
+        $content .= $conditionsData;
+        return $content;
+    },
+    10,
+    2
+);
+    
+add_filter('bridge-conditions-inside', function($content) {
+        $conditionsData = do_shortcode('[glm-members-conditions-current view="inside"]');
+        $content .= $conditionsData;
+        return $content;
+    },
+    10,
+    2
+);
+    
+add_filter('bridge-conditions-sidebar', function($content) {
+        $conditionsData = do_shortcode('[glm-members-conditions-current view="side"]');
+        $content .= $conditionsData;
+        return $content;
+    },
+    10,
+    2
+);
\ No newline at end of file
index f1bfb89..315c4a9 100644 (file)
  */
 
 $glmMembersConditionsShortcodes = array(
+    'glm-members-conditions-current' => array(
+        'plugin'     => GLM_MEMBERS_CONDITIONS_PLUGIN_SLUG,
+        'menu'       => 'conditions',
+        'action'     => 'current',
+        'table'      => false,
+        'attributes' => array(
+            'view' => false
+        )
+    ),
 );
 
-$glmMembersConditionsShortcodesDescription = '';
+$glmMembersConditionsShortcodesDescription = '
+    <tr><th>Shortcode</th><th>Attribute</th><th>Description</th></tr>
+    <tr>
+    
+        <th>[glm-members-conditions-current]</th>
+        <td>&nbsp;</td>
+        <td width="50%">
+            Displays the current condition.
+        </td>
+    </tr>
+';
 
index ce31a3d..b3e503f 100644 (file)
@@ -58,12 +58,10 @@ $glmMembersConditionsAddOnValidActions = array(
         )
     ),
     'frontActions' => array(
-/*
         'conditions' => array(
-            'list' => GLM_MEMBERS_CONDITIONS_PLUGIN_SLUG,
-            'detail' => GLM_MEMBERS_CONDITIONS_PLUGIN_SLUG
+            'current' => GLM_MEMBERS_CONDITIONS_PLUGIN_SLUG
         )
-*/
+
     )
 );
 
diff --git a/views/admin/conditions/edit.html b/views/admin/conditions/edit.html
new file mode 100644 (file)
index 0000000..602855a
--- /dev/null
@@ -0,0 +1,50 @@
+<div class="wrap">
+    <div id="glm-admin-content-container">
+        <h3>Edit Condition Form</h3>
+        
+        <form id="condition-edit-form" action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+            <table>
+            
+                {if $selectedCondition}
+                <tr>
+                    <td>
+                        <span>Condition Name:</span> <br>
+                        <input type="text" name="condition_name" value="{$selectedCondition.name}">
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <span>Condition Short Description: </span><br>
+                        <textarea name="condition_descr_short" cols="70" rows="3">{$selectedCondition.descr_short}</textarea>
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <span>Condition Description: </span> <br>
+                        <textarea name="condition_descr" cols="70" rows="20">{$selectedCondition.descr}</textarea>
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <input type="hidden" name="condition_id" value="{$selectedCondition.id}">
+                    </td>
+                </tr>
+<!--                <tr>
+                    <td class="glm-member-db-condition-management-name">
+                        <a class="editCondition" data-conditionID="{$s.id}" data-conditionActive="{$s.active.value}">{$s.name}</a>
+                    </td>
+                </tr>-->
+                {else}
+                    Something went wrong (error code 105). Please contact your website administrator. 
+                {/if}
+            
+            </table>
+            <input id="updateCancel" name="condition_cancel" type="submit" value="Cancel">
+            <input id="editCondition" name="condition_edit" type="submit" value="Save Changes">
+        </form>
+    </div>    
+    
+</div>
+
+<script type="text/javascript">
+</script>
\ No newline at end of file
index f1b78d1..392c331 100644 (file)
@@ -1,7 +1,41 @@
 <div class="wrap">
     <div id="glm-admin-content-container">
-        <h3>Conditions Model</h3>
-        <p>{$displayData}</p>
-        <a href="{$thisUrl}?page={$thisPage}&glm_action=more">Click me to see more!</a>
-    </div>
+        <h4>{$successMessage}</h4>
+        <h3>Conditions</h3>
+        <p>Click on any condition to edit it. To set a condition, click on its radio button, then click "Select Condition"</p>
+        
+        <form id="condition-edit-form" action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+            <table>
+            {foreach from=$conditionList item=condition}
+                {if $condition}
+                <tr>
+                    <td>
+                        <input type="radio" name="condition_selected" value="{$condition.id}" {if $condition.id == $currentCondition.cond_id} checked {/if}>
+                        
+                        <span class="hidden"></span>
+                        <a class="editCondition" href="{$thisUrl}?page={$thisPage}&cond_id={$condition.id}&option=edit" data-conditionID="{$condition.id}">
+                            {$condition.name}
+                        </a>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="glm-member-db-condition-management-name">
+                        <a class="editCondition" data-conditionID="{$s.id}" data-conditionActive="{$s.active.value}">{$s.name}</a>
+                    </td>
+                </tr>
+                {/if}
+            {/foreach}
+            {if $currentCondition}
+                <tr>
+                    <td>
+                        <span>Special Condition Information:</span> <br>
+                        <textarea name="condition_current_special" rows="8" cols="35">{$currentCondition.special}</textarea>
+                    </td>
+                </tr>
+            {/if}
+            </table>
+            
+            <input id="updateCondition" name="condition_update" type="submit" value="Update Condition">
+        </form>
+    </div>        
 </div>
\ No newline at end of file
diff --git a/views/admin/conditions/more.html b/views/admin/conditions/more.html
deleted file mode 100644 (file)
index c768b5d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="wrap">
-    <div id="glm-admin-content-container">
-        <h3>Conditions Model - More Information</h3>
-        <p>{$displayData}</p>
-    </div>
-</div>
\ No newline at end of file
diff --git a/views/front/conditions/front.html b/views/front/conditions/front.html
new file mode 100644 (file)
index 0000000..120a192
--- /dev/null
@@ -0,0 +1,16 @@
+{if $selectedCondition}
+    <div class="action-item" id="condition-{$selectedCondition.id}">
+        <a class="click-container" href="{$conditionsUrl}">
+            <img src="http://localhost/wordpress/mackinacbridge/wp-content/themes/mackinacbridge/assets/bridge-conditions-lrg.jpg" alt="Bridge Conditions">
+        </a>
+        
+        <div class="content-container text-center">
+            <a href="{$conditionsUrl}" class="click-container">
+                <span class="date">{$todaysDate}</span>
+                <span class="status">{$selectedCondition.name}</span>
+                <span>{$selectedCondition.descr_short}</span>
+            </a>
+            <a href="{$conditionsUrl}">Full condition report</a>
+        </div>
+    </div>
+{/if}
diff --git a/views/front/conditions/inside.html b/views/front/conditions/inside.html
new file mode 100644 (file)
index 0000000..49bf8ab
--- /dev/null
@@ -0,0 +1,11 @@
+{if $selectedCondition}
+    <!--<img src="http://localhost/wordpress/mackinacbridge/wp-content/themes/mackinacbridge/assets/bridge-conditions-lrg.jpg" alt="Bridge Conditions">-->
+    <h2 class="status">Status:</h2>
+    <h3 class="status">{$selectedCondition.name}</h3>
+    <div class="date">{$todaysDate}{$timeNow}</div><br>
+    <div class="" id="condition-{$selectedCondition.id}">
+        <div>
+            <span>{$selectedCondition.descr|nl2br}</span>
+        </div>
+    </div>
+{/if}
diff --git a/views/front/conditions/side.html b/views/front/conditions/side.html
new file mode 100644 (file)
index 0000000..2b5d6af
--- /dev/null
@@ -0,0 +1,12 @@
+{if $selectedCondition}
+    <div class="action-item" id="condition-{$selectedCondition.id}">
+        <img src="{$siteBaseUrl}/assets/bridge-conditions-sm.jpg" alt="Bridge Conditions">
+        <div class="content-container text-center">
+            <a href="{$conditionsUrl}" class="click-container">
+                <span class="date">{$todaysDate}</span>
+                <span class="status">{$selectedCondition.name}</span>
+            </a>
+            <a href="{$conditionsUrl}">Full condition report</a>
+        </div>
+    </div>
+{/if}
diff --git a/views/front/index.html b/views/front/index.html
new file mode 100644 (file)
index 0000000..a01d458
--- /dev/null
@@ -0,0 +1,40 @@
+<div class="wrap">
+    <div id="glm-admin-content-container">
+        <h3>Conditions</h3>
+        <p>Click on any condition to edit it. To set a condition, click on its radio button, then click "Select Condition"</p>
+        
+        <form id="condition-edit-form" action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+            <table>
+            {foreach from=$conditionList item=condition}
+                {if $condition}
+                <tr>
+                    <td>
+                        <input type="radio" name="condition_selected" value="{$condition.id}" {if $condition.id == $currentCondition.cond_id} checked {/if}>
+                        
+                        <span class="hidden"></span>
+                        <a class="editCondition" href="{$thisUrl}?page={$thisPage}&cond_id={$condition.id}&option=edit" data-conditionID="{$condition.id}">
+                            {$condition.name}
+                        </a>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="glm-member-db-condition-management-name">
+                        <a class="editCondition" data-conditionID="{$s.id}" data-conditionActive="{$s.active.value}">{$s.name}</a>
+                    </td>
+                </tr>
+                {/if}
+            {/foreach}
+            {if $currentCondition}
+                <tr>
+                    <td>
+                        <span>Special Condition Information:</span> <br>
+                        <textarea name="condition_current_special" rows="8" cols="35">{$currentCondition.special}</textarea>
+                    </td>
+                </tr>
+            {/if}
+            </table>
+            
+            <input id="updateCondition" name="condition_update" type="submit" value="Update Condition">
+        </form>
+    </div>        
+</div>
\ No newline at end of file