From: Chuck Scott Date: Thu, 10 Mar 2016 18:50:45 +0000 (-0500) Subject: Completed adding new features to Recurrenc edit and calendar display X-Git-Tag: v1.0.0^2~170^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=3a328d477c395d1fa71016d3e70a9f1c0af9ce47;p=WP-Plugins%2Fglm-member-db-events.git Completed adding new features to Recurrenc edit and calendar display --- diff --git a/classes/data/dataLocations.php b/classes/data/dataLocations.php index 566910f..5c094d1 100644 --- a/classes/data/dataLocations.php +++ b/classes/data/dataLocations.php @@ -291,24 +291,6 @@ class GlmDataEventsLocations extends GlmDataAbstract ); - // If the Contacts add-on exists - if (isset($this->config['addOns']['glm-member-db-contacts'])) { - - // Contact Reference - Points to Contacts add-on contacts table - $this->fields['contact_addon_id'] = array ( - 'field' => 'contact_addon_id', - 'type' => 'pointer', - 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'contacts', - 'p_field' => 'name', - 'p_orderby' => 'name', - 'p_blank' => true, - // 'force_list' => true, - 'use' => 'a' - ); - - - } - } /* diff --git a/classes/data/dataRecurrences.php b/classes/data/dataRecurrences.php index e3e6b22..731109d 100644 --- a/classes/data/dataRecurrences.php +++ b/classes/data/dataRecurrences.php @@ -181,6 +181,14 @@ class GlmDataEventsRecurrences extends GlmDataAbstract 'use' => 'a' ), + // All Dates Flag + 'all_dates' => array ( + 'field' => 'all_dates', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'a' + ), + // Month of Year - multi-pick (bitmap) 'month_of_year' => array( 'field' => 'month_of_year', @@ -365,45 +373,59 @@ class GlmDataEventsRecurrences extends GlmDataAbstract // Determine time each event starts at $time = $start->format('H:i'); - // For each year in recurrence range - for ($year = $fromYear ; $year <= $toYear ; $year++ ) { + // If this is an All Dates event + if ($recurData['all_dates']['value']) { - // For each month selected - foreach ($recurData['month_of_year']['names'] as $km=>$month) { + // for each date from From through To + for ($date = clone $from ; $date <= $to ; $date->modify('+1 day')) { + $t = new DateTime($date->format('m/d/Y ').$time); + $dates[$t->getTimestamp()] = $t; + } - // If selecting by days of the month - if ($recurData['by_day_of_month']['value']) { + // Otherwise we'll use the rest of the recurrence schedule data + } else { - // For each specified days of the month ($dom is day of month) - foreach ($recurData['day_of_month']['names'] as $kdom=>$dom) { - $t = new DateTime("$month $dom $year $time"); - $dates[$t->getTimestamp()] = $t; - } + // For each year in recurrence range + for ($year = $fromYear ; $year <= $toYear ; $year++ ) { - // If last day of month is selected - if ($recurData['last_day_of_month']['value']) { - $t = new DateTime("last day of $month $year $time"); - $dates[$t->getTimestamp()] = $t; - } + // For each month selected + foreach ($recurData['month_of_year']['names'] as $km=>$month) { - } else { + // If selecting by days of the month + if ($recurData['by_day_of_month']['value']) { - // For each week selected - foreach ($recurData['week_of_month']['names'] as $kw=>$week) { + // For each specified days of the month ($dom is day of month) + foreach ($recurData['day_of_month']['names'] as $kdom=>$dom) { + $t = new DateTime("$month $dom $year $time"); + $dates[$t->getTimestamp()] = $t; + } - // For each day selected - foreach ($recurData['day_of_week']['names'] as $kd=>$day) { - $t = new DateTime("$week $day of $month $year $time"); + // If last day of month is selected + if ($recurData['last_day_of_month']['value']) { + $t = new DateTime("last day of $month $year $time"); $dates[$t->getTimestamp()] = $t; } + } else { + + // For each week selected + foreach ($recurData['week_of_month']['names'] as $kw=>$week) { + + // For each day selected + foreach ($recurData['day_of_week']['names'] as $kd=>$day) { + $t = new DateTime("$week $day of $month $year $time"); + $dates[$t->getTimestamp()] = $t; + } + + } + } - } + } // Month of Year - } // Month of Year + } // Year - } // Year + } // Check if the recurrences caught the "First Occurance" if (!isset($dates[$start->getTimestamp()])) { @@ -427,15 +449,14 @@ class GlmDataEventsRecurrences extends GlmDataAbstract $thisDate = $v->getTimestamp(); - // If date is within from and to range (we didn't check this above) + // If date is within from and to range (we may not have checked this above) if ($thisDate >= $fromTime && $thisDate <= $toTime ) { // Create text start date and time of this instance $thisStartTime = $v->format('Y/m/d').date(' H:i:s', $recurData['start_time']['timestamp']); - $tst = new DateTime($thisStartTime); // Create text end date and time of this instance - $tet = $tst; + $tet = new DateTime($thisStartTime); $tet->add($length); $thisEndTime = $tet->format('Y/m/d H:i:s'); diff --git a/index.php b/index.php index 3ed99fa..b96e615 100644 --- a/index.php +++ b/index.php @@ -39,7 +39,7 @@ * version from this plugin. */ define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.3'); +define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.4'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58'); diff --git a/models/admin/events/list.php b/models/admin/events/list.php index 083a813..dcf2b5f 100644 --- a/models/admin/events/list.php +++ b/models/admin/events/list.php @@ -107,6 +107,9 @@ class GlmMembersAdmin_events_list extends GlmDataEvents $filterPending = false; $eventDeleted = false; $eventDeleteError = false; + $locations = false; + $haveLocations = false; + $numbLocations = 0; $recurrences = false; $haveRecurrences = false; $numbRecurrences = 0; @@ -119,7 +122,12 @@ class GlmMembersAdmin_events_list extends GlmDataEvents $Categories = new GlmDataEventsCategories($this->wpdb, $this->config); $categories = $Categories->getListSortedParentChild(false); - // Load recurrences data class to deal with event times + // Load locations data class to get a blank entry for the template + require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataLocations.php'); + $Locations = new GlmDataEventsLocations($this->wpdb, $this->config); + $newLocation = $Locations->newEntry(); + + // Load recurrences data class to get a blank entry for the template require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php'); $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config); $newRecurrence = $Recurrences->newEntry(); @@ -358,6 +366,10 @@ class GlmMembersAdmin_events_list extends GlmDataEvents 'filterPending' => $filterPending, 'eventDeleted' => $eventDeleted, 'eventDeleteError' => $eventDeleteError, + 'locations' => $locations, + 'haveLocations' => $haveLocations, + 'numbLocations' => $numbLocations, + 'newLocation' => $newLocation, 'recurrences' => $recurrences, 'haveRecurrences' => $haveRecurrences, 'numbRecurrences' => $numbRecurrences, diff --git a/setup/databaseScripts/create_database_V0.0.3.sql b/setup/databaseScripts/create_database_V0.0.3.sql deleted file mode 100644 index b8c6d19..0000000 --- a/setup/databaseScripts/create_database_V0.0.3.sql +++ /dev/null @@ -1,156 +0,0 @@ --- Gaslight Media Members Database - Events Add-On --- File Created: 12/02/15 15:27:15 --- 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 receint 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 - --- Categories - Categories for events -CREATE TABLE {prefix}categories ( - id INT NOT NULL AUTO_INCREMENT, - name TINYTEXT NULL, -- Name of event category - descr TINYTEXT NULL, -- Description of this category - parent INT NULL, -- Parent category, null or 0 if this is a top level category - PRIMARY KEY (id), - INDEX(parent) -); - ----- - --- Event-Category - Categories for specific event records -CREATE TABLE {prefix}event_categories ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to the event - category INT NULL, -- Pointer to the category - PRIMARY KEY (id), - INDEX(event), - INDEX(category) -); - ----- - --- Event Recurrence - Defines how an event recurs -CREATE TABLE {prefix}recurrences ( - id INT NOT NULL AUTO_INCREMENT, - event INTEGER NULL, -- Pointer to event - start_time DATETIME NULL, -- Start of first occurance (date and time) - end_time DATETIME NULL, -- End of first occurance (date and time) - from_date DATE NULL, -- From Date for recurrences - to_date DATE NULL, -- To Date for recurrences - all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (inforational only) - month_of_year SMALLINT UNSIGNED NULL, -- Month of year (bitmap) - week_of_month TINYINT UNSIGNED NULL, -- Week of the month (bitmap) - day_of_week TINYINT UNSIGNED NULL, -- Day of the week (bitmap) - by_day_of_month BOOLEAN NULL, -- Flag indicating if selecting by days of the month - day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap) - last_day_of_month BOOLEAN NULL, -- Last day of the month - holiday INT NULL, -- Pointer to holidays list (for future development) - holiday_offset TINYINT, -- Offset from holiday (from -128 to +127 days) - PRIMARY KEY (id), - INDEX(event) -); - ----- - --- Times - List of actual event times for single and recurring events -CREATE TABLE {prefix}times ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to the primary record for the event - custom_event INT NULL, -- Pointer to a customized copy of the event record (if set) - recur_id INT NULL, -- Pointer to recurrance entry - active BOOLEAN NULL, -- Active flag - normally set but used to temporarily dissable a specific date - start_time DATETIME NULL, -- Date and time event starts - end_time DATETIME NULL, -- Date and time event ends - all_day BOOLEAN NULL, -- All Day flag - PRIMARY KEY (id), - INDEX(event), - INDEX(start_time), - INDEX(end_time) -); - ----- - --- Locations - Locations for event - If there's no location pointing to an event try to use the referernced entity in events table -CREATE TABLE {prefix}locations ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to the primary or custom event record - name TINYTEXT NULL, -- Name of location - address TINYTEXT NULL, -- Street Address - city INT NULL, -- Pointer to city - references main plugin city table - state TINYTEXT NULL, -- Two character state abreviation - zip TINYTEXT NULL, -- ZIP/Postal code - country TINYTEXT NULL, -- Country Code - lat FLOAT NULL, -- Latitude of location - lon FLOAT NULL, -- Longitude of location - region INT NULL, -- Pointer to Region - references main plugin region table - phone TINYTEXT NULL, -- Location Phone # - url TINYTEXT NULL, -- Location URL - email TINYTEXT NULL, -- Location E-Mail Address - contact_addon_id INT NULL, -- ID of Contact from contact add-on (optional and if available) - contact_fname TINYTEXT NULL, -- Contact first name for this location (optional) - contact_lname TINYTEXT NULL, -- Contact last name for this location (optional) - contact_phone TINYTEXT NULL, -- Contact phone for this location (optional) - contact_email TINYTEXT NULL, -- Contact E-Mail address (optional) - PRIMARY KEY (id) -); - ----- - --- Events - Base event information - May also be entries here referenced by the "times" table for a custom date. -CREATE TABLE {prefix}events ( - id INT NOT NULL AUTO_INCREMENT, - status INT NULL, -- Status for this event, see config['status'] - custom_time INT NULL, -- If this is a custom record for a specific instance (date) this points to that times table entry - root_event INT NULL, -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set) - created DATETIME NULL, -- Date/Time event was created or date custom event record was created if custom record - updated DATETIME NULL, -- Date/Time this event record was last updated - approved DATETIME NULL, -- Date/Ttime this event record was approved - ref_type INT NULL, -- Type of entity this contact is associated with - See config['ref_type'] - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with - hide_address BOOLEAN NULL, -- Option to hide address on front-end - featured BOOLEAN NULL, -- Option to mark as featured event - slideshow BOOLEAN NULL, -- Option to mark for use in slide show - major BOOLEAN NULL, -- Option to mark as a major event - name TINYTEXT NULL, -- Name of this event - name_slug TINYTEXT NULL, -- Slug for this event - header TINYTEXT NULL, -- Header text for front-end display - NOT CURRENTLY USED - intro TINYTEXT NULL, -- Intro text for front-end display - descr TEXT NULL, -- Full description text - image TINYTEXT NULL, -- Image file name - url TINYTEXT NULL, -- Event URL - cost TINYTEXT NULL, -- Description of event cost - notes TEXT NULL, -- Internal notes for this event - PRIMARY KEY (id), - INDEX(custom_time), - INDEX(root_event), - INDEX(ref_type), - INDEX(ref_dest), - INDEX(featured), - INDEX(slideshow), - INDEX(major) -); - ----- - --- Event Management Settings -CREATE TABLE {prefix}management ( - id INT NOT NULL AUTO_INCREMENT, - canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail - PRIMARY KEY (id) -); - ----- - --- Set default event management entry -INSERT INTO {prefix}management - ( id, canonical_event_page ) - VALUES - ( 1, 'event-detail' ) -; - diff --git a/setup/databaseScripts/create_database_V0.0.4.sql b/setup/databaseScripts/create_database_V0.0.4.sql new file mode 100644 index 0000000..61a8173 --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.4.sql @@ -0,0 +1,158 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 12/02/15 15:27:15 +-- 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 receint 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 + +-- Categories - Categories for events +CREATE TABLE {prefix}categories ( + id INT NOT NULL AUTO_INCREMENT, + name TINYTEXT NULL, -- Name of event category + descr TINYTEXT NULL, -- Description of this category + parent INT NULL, -- Parent category, null or 0 if this is a top level category + PRIMARY KEY (id), + INDEX(parent) +); + +---- + +-- Event-Category - Categories for specific event records +CREATE TABLE {prefix}event_categories ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to the event + category INT NULL, -- Pointer to the category + PRIMARY KEY (id), + INDEX(event), + INDEX(category) +); + +---- + +-- Event Recurrence - Defines how an event recurs +CREATE TABLE {prefix}recurrences ( + id INT NOT NULL AUTO_INCREMENT, + event INTEGER NULL, -- Pointer to event + start_time DATETIME NULL, -- Start of first occurance (date and time) + end_time DATETIME NULL, -- End of first occurance (date and time) + from_date DATE NULL, -- From Date for recurrences + to_date DATE NULL, -- To Date for recurrences + all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (inforational only) + all_dates BOOLEAN NULL, -- Flag indicating that event recurrs on all dates from from_date through to_date + month_of_year SMALLINT UNSIGNED NULL, -- Month of year (bitmap) + week_of_month TINYINT UNSIGNED NULL, -- Week of the month (bitmap) + day_of_week TINYINT UNSIGNED NULL, -- Day of the week (bitmap) + by_day_of_month BOOLEAN NULL, -- Flag indicating if selecting by days of the month + day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap) + last_day_of_month BOOLEAN NULL, -- Last day of the month + holiday INT NULL, -- Pointer to holidays list (for future development) + holiday_offset TINYINT, -- Offset from holiday (from -128 to +127 days) + PRIMARY KEY (id), + INDEX(event) +); + +---- + +-- Times - List of actual event times for single and recurring events +CREATE TABLE {prefix}times ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to the primary record for the event + custom_event INT NULL, -- Pointer to a customized copy of the event record (if set) + recur_id INT NULL, -- Pointer to recurrance entry + active BOOLEAN NULL, -- Active flag - normally set but used to temporarily dissable a specific date + start_time DATETIME NULL, -- Date and time event starts + end_time DATETIME NULL, -- Date and time event ends + all_day BOOLEAN NULL, -- All Day flag + PRIMARY KEY (id), + INDEX(event), + INDEX(start_time), + INDEX(end_time) +); + +---- + +-- Locations - Locations for event - If there's no location pointing to an event try to use the referernced entity in events table +CREATE TABLE {prefix}locations ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to the primary or custom event record + name TINYTEXT NULL, -- Name of location + address TINYTEXT NULL, -- Street Address + city INT NULL, -- Pointer to city - references main plugin city table + state TINYTEXT NULL, -- Two character state abreviation + zip TINYTEXT NULL, -- ZIP/Postal code + country TINYTEXT NULL, -- Country Code + lat FLOAT NULL, -- Latitude of location + lon FLOAT NULL, -- Longitude of location + region INT NULL, -- Pointer to Region - references main plugin region table + phone TINYTEXT NULL, -- Location Phone # + url TINYTEXT NULL, -- Location URL + email TINYTEXT NULL, -- Location E-Mail Address + contact_addon_id INT NULL, -- ID of Contact from contact add-on (optional and if available) + contact_fname TINYTEXT NULL, -- Contact first name for this location (optional) + contact_lname TINYTEXT NULL, -- Contact last name for this location (optional) + contact_phone TINYTEXT NULL, -- Contact phone for this location (optional) + contact_email TINYTEXT NULL, -- Contact E-Mail address (optional) + PRIMARY KEY (id) +); + +---- + +-- Events - Base event information - May also be entries here referenced by the "times" table for a custom date. +CREATE TABLE {prefix}events ( + id INT NOT NULL AUTO_INCREMENT, + status INT NULL, -- Status for this event, see config['status'] + custom_time INT NULL, -- If this is a custom record for a specific instance (date) this points to that times table entry + root_event INT NULL, -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set) + created DATETIME NULL, -- Date/Time event was created or date custom event record was created if custom record + updated DATETIME NULL, -- Date/Time this event record was last updated + approved DATETIME NULL, -- Date/Ttime this event record was approved + ref_type INT NULL, -- Type of entity this contact is associated with - See config['ref_type'] + ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with + hide_address BOOLEAN NULL, -- Option to hide address on front-end + featured BOOLEAN NULL, -- Option to mark as featured event + slideshow BOOLEAN NULL, -- Option to mark for use in slide show + major BOOLEAN NULL, -- Option to mark as a major event + name TINYTEXT NULL, -- Name of this event + name_slug TINYTEXT NULL, -- Slug for this event + header TINYTEXT NULL, -- Header text for front-end display - NOT CURRENTLY USED + intro TINYTEXT NULL, -- Intro text for front-end display + descr TEXT NULL, -- Full description text + image TINYTEXT NULL, -- Image file name + url TINYTEXT NULL, -- Event URL + cost TINYTEXT NULL, -- Description of event cost + old_event_id INT NULL, -- ID of event from old site for reference + notes TEXT NULL, -- Internal notes for this event + PRIMARY KEY (id), + INDEX(custom_time), + INDEX(root_event), + INDEX(ref_type), + INDEX(ref_dest), + INDEX(featured), + INDEX(slideshow), + INDEX(major) +); + +---- + +-- Event Management Settings +CREATE TABLE {prefix}management ( + id INT NOT NULL AUTO_INCREMENT, + canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail + PRIMARY KEY (id) +); + +---- + +-- Set default event management entry +INSERT INTO {prefix}management + ( id, canonical_event_page ) + VALUES + ( 1, 'event-detail' ) +; + diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index beeccc5..a4254ae 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -16,6 +16,7 @@ $glmMembersEventsDbVersions = array( '0.0.1' => array('version' => '0.0.1', 'tables' => 6), '0.0.2' => array('version' => '0.0.2', 'tables' => 7), - '0.0.3' => array('version' => '0.0.3', 'tables' => 7) + '0.0.3' => array('version' => '0.0.3', 'tables' => 7), + '0.0.4' => array('version' => '0.0.4', 'tables' => 7) ); diff --git a/setup/databaseScripts/examples/create_database_V0.0.1.sql b/setup/databaseScripts/examples/create_database_V0.0.1.sql deleted file mode 100644 index d4598c9..0000000 --- a/setup/databaseScripts/examples/create_database_V0.0.1.sql +++ /dev/null @@ -1,42 +0,0 @@ --- Gaslight Media Members Database - Sample --- File Created: 12/02/15 15:27:15 --- 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 receint 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 - - --- ********************************************************************** --- NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED --- --- Please change all references to sample, Sample, or SAMPLE to a name --- appropriate for your new Add-On. --- --- Tables and queries in this file are sample only. --- --- Remove this message before using this file in production! --- **********************************************************************/ - - --- Sample Table -CREATE TABLE {prefix}sometablename ( - id INT NOT NULL AUTO_INCREMENT, - somefield TINYTEXT NULL, - PRIMARY KEY (id) -); - ----- - --- Sample default entry in table -INSERT INTO {prefix}sometablename - ( id, somefield ) - VALUES - ( 1, 'sample data' ) -; - diff --git a/setup/databaseScripts/examples/dbVersions.php b/setup/databaseScripts/examples/dbVersions.php deleted file mode 100644 index 1b9b48b..0000000 --- a/setup/databaseScripts/examples/dbVersions.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @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/ - */ - - -/********************************************************************** - * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED - * - * Please change all references to sample, Sample, or SAMPLE to a name - * appropriate for your new Add-On. - * - * This file lists all versions of the database tables for this add-on. - * The last entry in the array below should be for the most recent - * version and should match the "create_database_V..." file in this - * directory. - * - * NOTE: When first creating a new add-on with database tables, there - * should only be one line in the array below and there should be no - * "update_database..." files in this directory. - * - * Remove this message before using this file in production! - **********************************************************************/ - - -$glmMembersSampleDbVersions = array( - '0.0.1' => array('version' => '0.0.1', 'tables' => 1), - '0.0.2' => array('version' => '0.0.2', 'tables' => 2) -); - diff --git a/setup/databaseScripts/examples/readme.txt b/setup/databaseScripts/examples/readme.txt deleted file mode 100644 index f4f3b48..0000000 --- a/setup/databaseScripts/examples/readme.txt +++ /dev/null @@ -1,21 +0,0 @@ -DATABASE EXAMPLE FILES ----------------------- - -*** THESE ARE EXAMPLES ONLY *** - -The files in this directory are examples only. Do not use any of these as they are! - -The example here is of a set of one table for the add-on that is initially created -by the create_database_V0.0.1.sql script. That file creates one table and inserts -one entry into that table. - -In this example, the database is later updated by two files. Either of these may -be included separately if only a PHP file is needed to update the database, or -just an SQL script. Sometimes both are needed. - -There is also an entry in the dbVersions.php file that describes the update. - -Note that the number of tables needs to be set to the updated number for each update. - -Also note taht the SQL update scripts are run before the PHP update scripts. - diff --git a/setup/databaseScripts/examples/update_database_V0.0.2.php b/setup/databaseScripts/examples/update_database_V0.0.2.php deleted file mode 100644 index 5b47ba2..0000000 --- a/setup/databaseScripts/examples/update_database_V0.0.2.php +++ /dev/null @@ -1,54 +0,0 @@ -wpdb->get_results('SELECT id, title FROM '.GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename;', ARRAY_A); - -// If there's any records -if ($sampleRecords && count($sampleRecords) > 0) { - - // For each record - foreach ($sampleRecords as $p) { - - // Create a slug from the somefield field - $newData = sanitize_title($p['somefield']).'-'.$p['id']; - - // Store this value back into the record in the new yetanotherfield field - $this->wpdb->update( - GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename', - array( - 'yetanotherfield' => $slug - ), - array( 'id' => $p['id'] ), - array( '%s' ), - array( '%d') - ); - } - -} diff --git a/setup/databaseScripts/examples/update_database_V0.0.2.sql b/setup/databaseScripts/examples/update_database_V0.0.2.sql deleted file mode 100644 index c8f89af..0000000 --- a/setup/databaseScripts/examples/update_database_V0.0.2.sql +++ /dev/null @@ -1,21 +0,0 @@ --- 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 - --- A sample database update script -CREATE TABLE {prefix}anothertablename ( - id INT NOT NULL AUTO_INCREMENT, - anotherfield TINYTEXT NULL, - PRIMARY KEY (id) -); - ----- - -ALTER TABLE {prefix}sometablename ADD COLUMN yetanotherfield TINYTEXT; - - - diff --git a/setup/databaseScripts/update_database_V0.0.4.sql b/setup/databaseScripts/update_database_V0.0.4.sql new file mode 100644 index 0000000..090bf25 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.4.sql @@ -0,0 +1,21 @@ +-- Gaslight Media Members Database - Events Add-On +-- 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 + + +-- Add all_dates field +ALTER TABLE {prefix}recurrences ADD COLUMN all_dates BOOLEAN; + +---- + +-- Add old_event_id field +ALTER TABLE {prefix}events ADD COLUMN old_event_id INTEGER; + + + + + diff --git a/views/admin/events/edit.html b/views/admin/events/edit.html index 3e798f4..84bce9d 100644 --- a/views/admin/events/edit.html +++ b/views/admin/events/edit.html @@ -1,17 +1,17 @@ {include file='admin/events/header.html'} - + {if apply_filters('glm_members_permit_admin_members_packaging_edit_package', true)} Return to Events List {if $option == 'edit'} Delete this Event - +

Edit Event

{else}

Add new Event

{/if} - +
@@ -34,373 +34,21 @@ {if $eventAdded}Event Added{/if} {if $eventAddError}Event Add Error{/if} - + - - - - - - - {if $haveEvent} - - - - - - - - - - - - - - - - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event Name: - - {if $event.fieldFail.name}

{$event.fieldFail.name}

{/if}
-
Name for URLs:{$event.fieldData.name_slug}
Created:{$event.fieldData.created.datetime}
Last Updated:{$event.fieldData.updated.datetime}
Last Approved:{$event.fieldData.approved.datetime}
Status: - - {if $event.fieldFail.status}

{$event.fieldFail.status}

{/if} -
Hide Member Address: - -
Featured Event: - -
Include in Slideshow: - -
Major Event: - -
Categories - - - -
Add a new Category
-
- - - - - - - - - -
Category Name: - -
-
Parent Category: - -
OR
- -
-

* Required

- Cancel - -
- - - -    Select a category to add to box below.
-
- - {if isset($event.fieldData.categories) && $event.fieldData.categories} - {foreach $event.fieldData.categories as $c} -
- {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} - X - -
- {/foreach} - {/if} -
-
Intro Text: - - {if $event.fieldFail.intro}

{$event.fieldFail.intro}

{/if} -
Description: - {php} - wp_editor('{$event.fieldData.descr|escape:quotes}', 'glm_descr', array( - // 'media_buttons' => true, - // 'quicktags' => false, - // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. - 'textarea_name' => 'descr', - 'editor_height' => 200, // Height in px, overrides editor_rows - // 'textarea_rows' => 8 - )); - {/php} - {if $event.fieldFail.descr}

{$event.fieldFail.descr}

{/if} -
Image: - - {if $event.fieldData.image} - - - - - {/if} - -
-
- -
-
- Delete Image
- {$event.fieldData.image}
-
New image:
-
- {if $event.fieldFail.image}

{$event.fieldFail.image}

{/if} -
Web Address (URL): - - {if $event.fieldFail.url}

{$event.fieldFail.url}

{/if}
-
Description of Cost: - - {if $event.fieldFail.cost}

{$event.fieldFail.cost}

{/if}
-
Notes: - - {if $event.fieldFail.notes}

{$event.fieldFail.notes}

{/if} -
- + {include file='admin/events/editStatus.html'} + - - - - - - -
A parameterLocations data goes here along with a big map
- + + {include file='admin/events/editLocation.html'} + - - - - - - - - -
- Add an Event Schedule -
- - - {if $recurrences} - {foreach $recurrences as $r} - - - - - - - - - {/foreach} - {else} - - {/if} -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
First occurrence of event
All Day Event: - -
Start Date & Time: - -
End Date & Time: - -
Event Date: - -

Date range over which recurring event can take place

From Date: - -
To Date: - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Delete this Event Schedule - When the event recurrs -
Months - - - {foreach $r.month_of_year.bitmap as $v} - {if $v.value==6} - - {/if} - - {/foreach} - -
{$v.name}  
-
 
Days of month: - Check to select specific days of the month. -
Week of the Month - - - {foreach $r.week_of_month.bitmap as $v} - - {/foreach} - -
{$v.name}  
-
Day of the Week - - - {foreach $r.day_of_week.bitmap as $v} - - {/foreach} - -
{$v.name}
-
Day of the Month - - - {foreach $r.day_of_month.bitmap as $v} - {if in_array($v.value, array(7, 14, 21, 28))} - - {/if} - - {/foreach} - - -
- {$v.name} - - Last day of the month -
-
-
(Add event schedules here)
-
- + + {include file='admin/events/editSchedule.html'} + - +
@@ -408,21 +56,21 @@
- +
- + {else} - +
Name:{$event.fieldData.name}
- + {/if} - +

Cancel

@@ -431,7 +79,7 @@

WARNING:

- Clicking the "Delete this Event" button above will + Clicking the "Delete this Event" button above will delete all of the data and images associated with this event.

@@ -445,169 +93,29 @@
- - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
New ScheduleFirst ocurrence of event
All Day Event: - -
Start Date & Time: - -
End Date & Time: - -
Event Date: - - -

Date range over which recurring event can take place

From Date: - -
To Date: - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Delete this Event Schedule - When the event recurrs -
Months - - - {foreach $newRecurrence.fieldData.month_of_year.bitmap as $v} - {if $v.value==6} - - {/if} - - {/foreach} - -
{$v.name}  
-
 
Days of month: - Check to select specific days of the month. -
Week of the Month - - - {foreach $newRecurrence.fieldData.week_of_month.bitmap as $v} - - {/foreach} - -
{$v.name}  
-
Day of the Week - - - {foreach $newRecurrence.fieldData.day_of_week.bitmap as $v} - - {/foreach} - -
{$v.name}
-
Day of the Month - - - {foreach $newRecurrence.fieldData.day_of_month.bitmap as $v} - {if in_array($v.value, array(7, 14, 21, 28))} - - {/if} - - {/foreach} - - -
- {$v.name} - - Last day of the month -
-
-
- - + {include file='admin/footer.html'} diff --git a/views/admin/events/editLocation.html b/views/admin/events/editLocation.html new file mode 100644 index 0000000..e5da32b --- /dev/null +++ b/views/admin/events/editLocation.html @@ -0,0 +1,65 @@ + + + + + + + + + + + +
+ Add a Location +
+ + +{if $locations} + {foreach $locations as $loc} + + + + + + + + + + + + {/foreach} +{/if} +
Location Name: + +
Address: + +
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
Location Name: + +
Address: + +
+
\ No newline at end of file diff --git a/views/admin/events/editSchedule.html b/views/admin/events/editSchedule.html new file mode 100644 index 0000000..de25a08 --- /dev/null +++ b/views/admin/events/editSchedule.html @@ -0,0 +1,319 @@ + + + + + + + + + + +
+ Add an Event Schedule +
+ + +{if $recurrences} + {foreach $recurrences as $r} + + + + + + + + + {/foreach} +{else} + +{/if} +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
First occurrence of event
All Day Event: + +
Start Date & Time: + +
End Date & Time: + +
Event Date: + +

Date range over which recurring event can take place

From Date: + +
To Date: + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Delete this Event Schedule + When the event recurrs +
Ongoing Event: + + Check to have event recurr every day from the "From Date" through the "To Date". +
Months + + + {foreach $r.month_of_year.bitmap as $v} + {if $v.value==6} + + {/if} + + {/foreach} + + +
{$v.name}    
All
None
+
 
Days of month: + Check to select specific days of the month. +
Week of the Month + + + {foreach $r.week_of_month.bitmap as $v} + + {/foreach} + + +
{$v.name}    
All
None
+
Day of the Week + + + {foreach $r.day_of_week.bitmap as $v} + + {/foreach} + + +
{$v.name}  
All
None
+
Day of the Month + + + {foreach $r.day_of_month.bitmap as $v} + {if in_array($v.value, array(7, 14, 21, 28))} + + {/if} + + {/foreach} + + + +
+ {$v.name} + + Last day of the month +
All
None
+
+
(Add event schedules here)
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New ScheduleFirst ocurrence of event
All Day Event: + +
Start Date & Time: + +
End Date & Time: + +
Event Date: + + +

Date range over which recurring event can take place

From Date: + +
To Date: + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Delete this Event Schedule + When the event recurrs +
Ongoing Event: + + Check to have event recurr every day from the "From Date" through the "To Date". +
Months + + + {foreach $newRecurrence.fieldData.month_of_year.bitmap as $v} + {if $v.value==6} + + {/if} + + {/foreach} + + +
{$v.name}    
All
None
+
 
Days of month: + Check to select specific days of the month. +
Week of the Month + + + {foreach $newRecurrence.fieldData.week_of_month.bitmap as $v} + + {/foreach} + + +
{$v.name}    
All
None
+
Day of the Week + + + {foreach $newRecurrence.fieldData.day_of_week.bitmap as $v} + + {/foreach} + + +
{$v.name}  
All
None
+
Day of the Month + + + {foreach $newRecurrence.fieldData.day_of_month.bitmap as $v} + {if in_array($v.value, array(7, 14, 21, 28))} + + {/if} + + {/foreach} + + + +
+ {$v.name} + + Last day of the month +
All
None
+
+
+ + \ No newline at end of file diff --git a/views/admin/events/editStatus.html b/views/admin/events/editStatus.html new file mode 100644 index 0000000..5812fb7 --- /dev/null +++ b/views/admin/events/editStatus.html @@ -0,0 +1,200 @@ + + + + + + + + +{if $haveEvent} + + + + + + + + + + + + + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event Name: + + {if $event.fieldFail.name}

{$event.fieldFail.name}

{/if}
+
Name for URLs:{$event.fieldData.name_slug}
Created:{$event.fieldData.created.datetime}
Last Updated:{$event.fieldData.updated.datetime}
Last Approved:{$event.fieldData.approved.datetime}
Status: + + {if $event.fieldFail.status}

{$event.fieldFail.status}

{/if} +
Hide Member Address: + +
Featured Event: + +
Include in Slideshow: + +
Major Event: + +
Categories + + + +
Add a new Category
+
+ + + + + + + + + +
Category Name: + +
+
Parent Category: + +
OR
+ +
+

* Required

+ Cancel + +
+ + + +    Select a category to add to box below.
+
+ + {if isset($event.fieldData.categories) && $event.fieldData.categories} + {foreach $event.fieldData.categories as $c} +
+ {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} + X + +
+ {/foreach} + {/if} +
+
Intro Text: + + {if $event.fieldFail.intro}

{$event.fieldFail.intro}

{/if} +
Description: + {php} + wp_editor('{$event.fieldData.descr|escape:quotes}', 'glm_descr', array( + // 'media_buttons' => true, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'descr', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php} + {if $event.fieldFail.descr}

{$event.fieldFail.descr}

{/if} +
Image: + + {if $event.fieldData.image} + + + + + {/if} + +
+
+ +
+
+ Delete Image
+ {$event.fieldData.image}
+
New image:
+
+ {if $event.fieldFail.image}

{$event.fieldFail.image}

{/if} +
Web Address (URL): + + {if $event.fieldFail.url}

{$event.fieldFail.url}

{/if}
+
Description of Cost: + + {if $event.fieldFail.cost}

{$event.fieldFail.cost}

{/if}
+
Notes: + + {if $event.fieldFail.notes}

{$event.fieldFail.notes}

{/if} +