From f7532a7b90d2815c277245506c63c1d15342e575 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 3 Mar 2017 16:53:38 -0500 Subject: [PATCH] adding valid actions and shortcode function for the search action --- css/front.css | 27 +++++++ models/front/obits/search.php | 111 ++++++++++++++++++++++++++++ setup/shortcodes.php | 16 +++- setup/validActions.php | 5 ++ views/front/obits/search.html | 133 ++++++++++++++++++++++++++++++++++ 5 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 css/front.css create mode 100644 models/front/obits/search.php create mode 100644 views/front/obits/search.html diff --git a/css/front.css b/css/front.css new file mode 100644 index 0000000..0440fdc --- /dev/null +++ b/css/front.css @@ -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 index 0000000..0a5c5e9 --- /dev/null +++ b/models/front/obits/search.php @@ -0,0 +1,111 @@ + + * @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 + ); + + } + + +} diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 70df302..2c41dfb 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -87,7 +87,21 @@ */ $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 = ''; diff --git a/setup/validActions.php b/setup/validActions.php index d496f24..f9a0d2c 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -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 index 0000000..5e7688c --- /dev/null +++ b/views/front/obits/search.html @@ -0,0 +1,133 @@ +
+ +
\ No newline at end of file -- 2.17.1