adding valid actions and shortcode function for the search action
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 3 Mar 2017 21:53:38 +0000 (16:53 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 3 Mar 2017 21:53:38 +0000 (16:53 -0500)
css/front.css [new file with mode: 0644]
models/front/obits/search.php [new file with mode: 0644]
setup/shortcodes.php
setup/validActions.php
views/front/obits/search.html [new file with mode: 0644]

diff --git a/css/front.css b/css/front.css
new file mode 100644 (file)
index 0000000..0440fdc
--- /dev/null
@@ -0,0 +1,27 @@
+body .search-row{    
+    margin: 0 15px;
+    padding: 10px 0;
+}
+.search-container{
+    width: 50%;
+    margin: 0 auto;
+}
+
+@media (min-width: 640px) and (max-width: 1024px){
+    .search-container{
+        width: 60%;
+        margin: 0 auto;
+    }
+}
+@media (max-width: 640px){
+    .search-container{
+        width: 100%;
+        margin: 0 auto;
+    }
+}
+@media (min-width: 320px) and (max-width: 640px){
+    .search-container{
+        width: 100%;
+        margin: 0 auto;
+    }
+}
\ No newline at end of file
diff --git a/models/front/obits/search.php b/models/front/obits/search.php
new file mode 100644 (file)
index 0000000..0a5c5e9
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Obits Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Obits data abstract
+require_once GLM_MEMBERS_OBITS_PLUGIN_CLASS_PATH.'/data/dataObits.php';
+require_once GLM_MEMBERS_OBITS_PLUGIN_CLASS_PATH.'/obitSupportFunctions.php';
+
+class GlmMembersFront_obits_search extends GlmDataObits
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Obit ID
+     *
+     * @var $obitID
+     * @access public
+     */
+    public $obitID = false;
+
+    /**
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        /*
+         * Run constructor for the Obits data class
+         *
+         * Note, the third parameter is a flag that indicates to the Contacts
+         * data class that it should flag a group of fields as 'view_only'.
+         */
+        parent::__construct(false, false, true);
+
+    }
+
+    public function modelAction($actionData = false)
+    {
+        $year_ranges        = new glmObitSupportFunctions($this->wpdb, $this->config);
+        $birth_death_range  = array('birth' => $year_ranges->getObitYearRange(BIRTH_YEAR_START), 'death' => $year_ranges->getObitYearRange(DEATH_YEAR_START));
+        $logic_dropdown     = array('equals','starts','contains', 'more than', 'less than', 'between', '')
+        $form_data = $_REQUEST;
+        
+        // Compile template data
+        $templateData = array(
+            'birth_death_range' => $birth_death_range
+        );
+             // Return status, any suggested view, and any data to controller
+        return array(
+            'status'        => true,
+            'modelRedirect' => false,
+            'view'          => 'front/obits/search.html',
+            'data'          => $templateData
+        );
+
+    }
+
+
+}
index 70df302..2c41dfb 100644 (file)
  */
 
 $glmMembersObitsShortcodes = array(
+    'glm-members-obits-search' => array(
+        'plugin'     => GLM_MEMBERS_OBITS_PLUGIN_SLUG,
+        'menu'       => 'obits',
+        'action'     => 'search',
+        'table'      => false,
+        'attributes' => array(
+            'type'     => 'all',
+            'order'    => 'title',
+            'member'   => false,
+            'template' => false,
+            'limit'    => null,
+            'featured' => null,
+            'current'  => null,
+        )
+    ),
 );
-
 $glmMembersObitsShortcodesDescription = '';
 
index d496f24..f9a0d2c 100644 (file)
@@ -68,6 +68,11 @@ $glmMembersObitsAddOnValidActions = array(
         ),
     ),
     'frontActions' => array(
+        'obits' => array(
+            'search'   => GLM_MEMBERS_OBITS_PLUGIN_SLUG, 
+            'list'     => GLM_MEMBERS_OBITS_PLUGIN_SLUG,
+            'detail'   => GLM_MEMBERS_OBITS_PLUGIN_SLUG,
+        )
     )
 );
 
diff --git a/views/front/obits/search.html b/views/front/obits/search.html
new file mode 100644 (file)
index 0000000..5e7688c
--- /dev/null
@@ -0,0 +1,133 @@
+<div class="search-container">
+    <form action="{$thisUrl}" method="post" enctype="multipart/form-data" name="obits-search" id="obits-search">
+        <div class="row search-row">
+            <div class="small-12 medium-3 columns">
+                Last Name: 
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <input type="text" name="last-name">
+            </div>
+        </div>
+        <div class="row search-row">
+            <div class="small-12 medium-3 columns">
+                First Name &amp; Middle Initial: 
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <input type="text" name="first-middle">
+            </div>
+        </div>
+        <div class="row search-row">
+           <div class="small-12 medium-3 columns">
+                Birth Year: 
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <input type="text" name="birth-year">
+            </div>
+        </div>
+        <div class="row search-row">
+            <div class="small-12 medium-3 columns">
+                Birth Year Range:
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+               <select name="birth-range" id="">
+                {foreach from=$birth_death_range.birth item=r}
+                   <option value="{$r.start}">{$r.start} - {$r.end}</option>
+                {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="row search-row">
+            <div class="small-12 medium-3 columns">
+                Death Year: 
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <input type="text" name="death-year">
+            </div>
+        </div>
+        <div class="row search-row">
+            <div class="small-12 medium-3 columns">
+               Death Year Range: 
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <select name="death-range" id="">
+                {foreach from=$birth_death_range.death item=r}
+                   <option value="{$r.start}">{$r.start} - {$r.end}</option>
+                {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="row search-row">
+            <div class="small-12 medium-3 columns">
+                Maiden or Other Name:
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <input type="text" name="maiden">
+            </div>
+        </div>
+        <div class="row search-row">
+           <div class="small-12 medium-3 columns">
+                Spouse / Partner Name: 
+            </div>
+            <div class="small-3 large-2 columns">
+               <label for="not-search">Not</label>
+               <input type="checkbox" id="not-search">
+            </div>
+            <div class="small-4 medium-3 large-3 columns">
+                <select name="" id=""></select>
+            </div>
+            <div class="small-12 medium-3 large-4 columns">
+                <input type="text" name="spouse">
+            </div>
+        </div>
+        <input id="input" class="search-button" name="searchButton" value="Search" type="submit">
+    </form>
+</div>
\ No newline at end of file