From 24a7486ec8018fd23ec35a2b5bc1ea5f10e9bf6a Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 10 Mar 2017 16:11:24 -0500 Subject: [PATCH] added detail model and view --- css/front.css | 25 ++ js/front.js | 7 + models/admin/management/obitImport.php | 27 +- models/front/obits/detail.php | 117 +++++++ setup/shortcodes.php | 9 + views/front/obits/detail.html | 80 +++++ views/front/obits/searchResults.html | 418 ++++++++++++------------- 7 files changed, 461 insertions(+), 222 deletions(-) create mode 100644 models/front/obits/detail.php create mode 100644 views/front/obits/detail.html diff --git a/css/front.css b/css/front.css index 7caf9f3..391503d 100644 --- a/css/front.css +++ b/css/front.css @@ -101,4 +101,29 @@ .search-container .results-limit-container { margin-bottom: 20px; } +.detail-record{ + padding: 5px 0px; + +} +.detail-label{ + font-weight: bold; + padding: 2px 0; +} + +.detail-value{ + padding: 2px 0; + +} +.detail-header{ + font-size: 24px; + padding: 5px 0px; + margin-bottom: 15px; + text-align: center; +} +.detail-wrapper{ + +} +.record-row:nth-child(even){ + background-color: #eeeeee; +} diff --git a/js/front.js b/js/front.js index a718b44..9f8c19f 100644 --- a/js/front.js +++ b/js/front.js @@ -1,5 +1,11 @@ $(document).ready(function(){ $(".expand-collapse").on("click", function(e){ + if( $(this).text() === "Show Options" ){ + $(this).text("Hide Options"); + } else if( $(this).text() === "Hide Options" ){ + $(this).text("Show Options"); + } + e.preventDefault(); $('.options-wrapper').slideToggle(500, function () {}); }); @@ -14,6 +20,7 @@ $(document).ready(function(){ console.log("test"); }); + $('#results-limit').on('change', function(){ // $('#obits-search').submit(); }); diff --git a/models/admin/management/obitImport.php b/models/admin/management/obitImport.php index fed623e..c0ab933 100644 --- a/models/admin/management/obitImport.php +++ b/models/admin/management/obitImport.php @@ -172,19 +172,20 @@ class GlmMembersAdmin_management_obitImport if ( !empty($value) ){ $imageFullUrl = $img_src . $value; - $fp = fopen( GLM_MEMBERS_PLUGIN_IMAGES_PATH . '/' . $value, 'w+' ); - $ch = curl_init( $imageFullUrl ); - curl_setopt($ch, CURLOPT_TIMEOUT, 50); - curl_setopt($ch, CURLOPT_FILE, $fp); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - $fileData = curl_exec($ch); - $httpCode = curl_getinfo($ch); - curl_close($ch); - fclose($fp); - // Set correct file permissions - $oldUmask = umask(0); - chmod( GLM_MEMBERS_PLUGIN_IMAGES_PATH_PATH . '/' . $value, 0660 ); - umask($oldUmask); +// $fp = fopen( GLM_MEMBERS_PLUGIN_IMAGES_PATH . '/' . $value, 'w+' ); +// $ch = curl_init( $imageFullUrl ); +// curl_setopt($ch, CURLOPT_TIMEOUT, 50); +// curl_setopt($ch, CURLOPT_FILE, $fp); +// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); +// $fileData = curl_exec($ch); +// $httpCode = curl_getinfo($ch); +// curl_close($ch); +// fclose($fp); +// // Set correct file permissions +// $oldUmask = umask(0); +// chmod( GLM_MEMBERS_PLUGIN_IMAGES_PATH_PATH . '/' . $value, 0660 ); +// umask($oldUmask); +// sleep(1); } } // $insert[$key] = $value; diff --git a/models/front/obits/detail.php b/models/front/obits/detail.php new file mode 100644 index 0000000..ec8a875 --- /dev/null +++ b/models/front/obits/detail.php @@ -0,0 +1,117 @@ + + * @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_detail extends GlmDataObits +{ + public $table; + /** + * 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) + { + $article_url = GLM_MEMBERS_PLUGIN_MEDIA_URL; + + if ( isset( $_GET['obit'] ) ){ + $obit_id = filter_var( $_GET['obit'], FILTER_SANITIZE_STRING ); + } + $where = "id = $obit_id"; + + $obit = $this->getList($where); + + $obit = array_values($obit)[0]; + $article = $article_url . '/files/'.$obit['obit_article']; +// echo '
',print_r($obit), '
'; + + // Compile template data + $templateData = array( + 'obit' => $obit, + 'article' => $article + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => "front/obits/detail.html", + 'data' => $templateData + ); + + } +} diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 2c41dfb..4f30885 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -102,6 +102,15 @@ $glmMembersObitsShortcodes = array( 'current' => null, ) ), + 'glm-members-obits-detail' => array( + 'plugin' => GLM_MEMBERS_OBITS_PLUGIN_SLUG, + 'menu' => 'obits', + 'action' => 'detail', + 'table' => false, + 'attributes' => array( + 'id' => false, + ) + ), ); $glmMembersObitsShortcodesDescription = ''; diff --git a/views/front/obits/detail.html b/views/front/obits/detail.html new file mode 100644 index 0000000..ce81a04 --- /dev/null +++ b/views/front/obits/detail.html @@ -0,0 +1,80 @@ +
+
+
{$obit.last_name}, {$obit.first_mid}
+ +
+
Record ID:
+
{$obit.id}
+
+
+
Last Name:
+
{$obit.last_name}
+
+
+
First , Middle:
+
{$obit.first_mid}
+
+
+
Birth Year:
+
{$obit.b_year}
+
+
+
Birth Year Range:
+
{$obit.b_yr_range}
+
+
+
Death Year:
+
{$obit.d_year}
+
+
+
Death Year Range:
+
{$obit.d_yr_range}
+
+
+
Maiden Name:
+
{$obit.maiden_other}
+
+
+
Spouse / Partner:
+
{$obit.spouse_partner}
+
+
+
Obituary Article:
+ + +
+
+
Article A:
+
{$obit.article_a}
+
+
+
Article B:
+
{$obit.article_b}
+
+
+
Article C:
+
{$obit.article_c}
+
+
+
Newspaper:
+
{$obit.newspaper}
+
+
+
Newspaper Date:
+
{$obit.newspaper_data}
+
+
+
Father Name:
+
{$obit.father_name}
+
+
+
Mother Name:
+
{$obit.mother_name}
+
+
+
Misc Info:
+
{$obit.misc_info}
+
+
+
+ diff --git a/views/front/obits/searchResults.html b/views/front/obits/searchResults.html index 9e7d7a1..c91ecb2 100644 --- a/views/front/obits/searchResults.html +++ b/views/front/obits/searchResults.html @@ -1,267 +1,267 @@
-