From: Steve Sutton Date: Fri, 17 Feb 2017 20:08:35 +0000 (-0500) Subject: Setting up database tables and menu. X-Git-Tag: v1.0.0~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=b4717ab5b39b82c64c00e760511cd69805c6bad7;p=WP-Plugins%2Fglm-member-db-obits.git Setting up database tables and menu. Adding the tables for obits and newspapers. Adding menu item for obits. --- diff --git a/classes/data/dataObits.php b/classes/data/dataObits.php new file mode 100644 index 0000000..e607f73 --- /dev/null +++ b/classes/data/dataObits.php @@ -0,0 +1,269 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataObitss.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * GlmDataObits class + * + * PHP version 5 + * + * @category Data + * @package GLM Member DB + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataObitsManagement 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; + /** + * MemberInfo DB object + * + * @var $MemberInfo + * @access public + */ + public $MemberInfo; + + /** + * 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_OBITS_PLUGIN_DB_PREFIX . 'obits'; + + /* + * Table Data Fields + */ + + $this->fields = array ( + + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + 'last_name' => array( + 'field' => 'last_name', + 'type' => 'text', + 'required' => true, + 'use' => 'a', + ), + + 'first_mid' => array( + 'field' => 'first_mid', + 'type' => 'text', + 'required' => true, + 'use' => 'a', + ), + + 'b_year' => array( + 'field' => 'b_year', + 'type' => 'integer', + 'required' => true, + 'use' => 'a', + ), + + 'b_yr_range' => array( + 'field' => 'b_yr_range', + 'type' => 'integer', + 'default' => true, + 'use' => 'a', + ), + + 'd_year' => array( + 'field' => 'd_year', + 'type' => 'integer', + 'required' => true, + 'use' => 'a', + ), + + 'd_yr_range' => array( + 'field' => 'd_yr_range', + 'type' => 'integer', + 'required' => false, + 'use' => 'a', + ), + + 'maiden_other' => array( + 'field' => 'maiden_other', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + + 'spouse_partner' => array( + 'field' => 'spouse_partner', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + + 'obit_article' => array( + 'field' => 'obit_article', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + + 'article_a' => array( + 'field' => 'article_a', + 'type' => 'text', + 'default' => false, + 'use' => 'a', + ), + + 'article_b' => array( + 'field' => 'article_b', + 'type' => 'text', + 'default' => false, + 'use' => 'a', + ), + + 'article_c' => array( + 'field' => 'article_c', + 'type' => 'text', + 'default' => false, + 'use' => 'a', + ), + + 'newspaper' => array( + 'field' => 'newspaper', + 'type' => 'text', + 'required' => true, + 'use' => 'a', + ), + + 'newspaper_date' => array( + 'field' => 'newspaper_date', + 'type' => 'text', + 'required' => true, + 'use' => 'a', + ), + + 'father_name' => array( + 'field' => 'father_name', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + + 'mother_name' => array( + 'field' => 'mother_name', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + + 'misc_info' => array( + 'field' => 'misc_info', + 'type' => 'text', + 'required' => false, + '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 member result and also sort by member 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; + } + +} + +?> diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 08d01ee..32a56c5 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -50,3 +50,19 @@ * */ +add_submenu_page( + 'glm-members-admin-menu-members', + 'Obits', + 'Obits', + 'edit_posts', + 'glm-members-admin-menu-obits-list', + function(){$this->controller('obits', 'list');} +); +add_submenu_page( + 'glm-members-admin-menu-members', + 'Obits List', + '    List', + 'edit_posts', + 'glm-members-admin-menu-obits-list', + function(){$this->controller('obits', 'list');} +); diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql index e69de29..eff0892 100644 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -0,0 +1,45 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 2017-02-07 +-- Database Version: 0.0.1 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most recent database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + + +-- Obits Table +CREATE TABLE {prefix}obits ( + id INT NOT NULL AUTO_INCREMENT, + last_name TINYTEXT NOT NULL DEFAULT '', + first_mid TINYTEXT NOT NULL DEFAULT '', + b_year TINYINT NOT NULL DEFAULT 0, -- Birth Year + b_yr_range TINYINT NOT NULL DEFAULT 0, -- Birth Year Range (use the start of the decade like 2010 or 2000) + d_year TINYINT NOT NULL DEFAULT 0, -- Death Year + d_yr_range TINYINT NOT NULL DEFAULT 0, -- Death Year Range (use the start of the decade like 2010 or 2000) + maiden_other TINYTEXT NULL DEFAULT '', + spouse_partner TINYTEXT NULL DEFAULT '', + obit_article TINYTEXT NULL DEFAULT '', + article_a TINYTEXT NULL DEFAULT '', + article_b TINYTEXT NULL DEFAULT '', + article_c TINYTEXT NULL DEFAULT '', + newspaper INT NOT NULL DEFAULT 0, + newspaper_date TINYTEXT NOT NULL DEFAULT '', + father_name TINYTEXT NULL DEFAULT '', + mother_name TINYTEXT NULL DEFAULT '', + misc_info LONGTEXT NULL DEFAULT '', + PRIMARY KEY (id) +); + +---- + +-- Newspapers +CREATE TABLE {prefix}newspapers ( + id INT NOT NULL AUTO_INCREMENT, + name TINYTEXT NOT NULL DEFAULT '', + PRIMARY KEY (id) +); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php new file mode 100644 index 0000000..1851396 --- /dev/null +++ b/setup/databaseScripts/dbVersions.php @@ -0,0 +1,19 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +$glmMembersObitsDbVersions = array( + '0.0.1' => array('version' => '0.0.1', 'tables' => 2), +); +