adding email notification management and html email formatting
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 31 May 2016 17:33:50 +0000 (13:33 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 31 May 2016 17:33:50 +0000 (13:33 -0400)
classes/data/dataManagement.php
index.php
models/admin/management/events.php
models/front/events/frontAdd.php
setup/databaseScripts/create_database_V0.0.17.sql [deleted file]
setup/databaseScripts/create_database_V0.0.18.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V0.0.18.sql [new file with mode: 0644]
views/admin/management/events.html
views/front/events/ownerEmail.html [new file with mode: 0644]

index 834d1e6..faa7fd1 100644 (file)
@@ -143,6 +143,27 @@ class GlmDataEventsManagement extends GlmDataAbstract
                 'type'     => 'text',
                 'required' => false,
                 'use'      => 'a'
+            ),
+            // Recipient Email 
+            'to_email' => array(
+                'field'    => 'to_email',
+                'type'     => 'text',
+                'required' => false,
+                'use'      => 'a'
+            ),
+            // Sender Email
+            'from_email' => array(
+                'field'    => 'from_email',
+                'type'     => 'text',
+                'required' => false,
+                'use'      => 'a'
+            ),
+            // Email Notification
+            'email_notification' => array(
+                'field'    => 'email_notification',
+                'type'     => 'text',
+                'required' => false,
+                'use'      => 'a'
             )
 
          );
index 7c58c7d..87454b0 100644 (file)
--- a/index.php
+++ b/index.php
@@ -39,7 +39,7 @@
  *  version from this plugin.
  */
 define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.0.1');
-define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.17');
+define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.18');
 
 // 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');
index bf0990c..9570a50 100644 (file)
@@ -191,7 +191,7 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
         if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
         }
-
+        
         switch ($option) {
 
             case 'tests':
@@ -316,7 +316,6 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement
                         } else {
                             $settingsUpdateError = true;
                         }
-
                         break;
 
                     // Default is to get the current settings and display the form
index 1f31ca9..039e782 100644 (file)
@@ -11,6 +11,7 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataCategories.php';
 require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php';
 require_once GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php';
 require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php';
+require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataManagement.php';
 
 /**
  * GLmMembersFront_event_fontAdd
@@ -96,6 +97,24 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
          $view = 'frontAdd';
         // populate category dropdown
         $categories = new GlmDataEventsCategories($this->wpdb, $this->config);
+        $emailInfo = new GlmDataEventsManagement($this->wpdb, $this->config);
+        $emailInfo = $emailInfo->getEntry(1);
+        
+        // get and validate recipient email address, put into an array to pass to wp_mail
+        $toEmail = $emailInfo['to_email'];
+        $toEmail = explode(',', $toEmail);
+        foreach($toEmail as $email){
+            $email = trim($email);
+//            $email = filter_var($email, FILTER_VALIDATE_EMAIL);
+            $to_email[] = $email;
+        }
+        
+        // get the sender's email address and validate it
+        $fromEmail = trim(filter_var($emailInfo['from_email'], FILTER_VALIDATE_EMAIL));
+
+        // get the email notification message
+        $emailNotification = $emailInfo['email_notification'];
+
         $cats = $categories->getList();
         foreach($cats as $cat){
             $eventCategories[] = $cat;
@@ -426,21 +445,50 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
                         )
                     );
 
+        $smarty = new smartyTemplateSupport();
+
+        $eventsList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index&glm_action=index";
+        $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
+        $smarty->template->setTemplateDir($viewPath);
+        $smarty->templateAssign('eventUrlBase', get_bloginfo('url') . '/add-an-event/');
+        $smarty->templateAssign('title', 'Events');
+        $smarty->templateAssign('link', 'main_event_page_url');
+        $smarty->templateAssign('description', 'Calendar of Events');
+        $smarty->templateAssign('pubDate', date('r'));
+        $smarty->templateAssign('to_email', $to_email);
+        $smarty->templateAssign('from_email', $fromEmail);
+        $smarty->templateAssign('emailNotification', $emailNotification);
+        $smarty->templateAssign('pendingEvents', $eventsList);
+        
+        $eventsList = GLM_MEMBERS_EVENTS_PLUGIN_ADMIN_URL ."?page=glm-members-admin-menu-events-index&glm_action=index";
+        $smarty->templateAssign('items', $events);
+
+        // Add standard parameters
+        require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+
+        $viewFile = 'front/events/ownerEmail.html';
+
+        // Generate output from model data and view
+        $htmlMessage = $smarty->template->fetch($viewFile);
+  
+        function set_content_type(){
+            return "text/html";
+        }
+        // Send confirmation email, set the content type to allow html by using this filter
+        add_filter( 'wp_mail_content_type', 'set_content_type' );
+
+        $to      = $to_email;
+        $subject = 'Event Form Submission';
+        $message = $htmlMessage;
+        $headers = 'From:'. $fromEmail . "\r\n";
+
+        wp_mail($to, $subject, $message, $headers);
 
-            // Send confirmation email
-//            $to      = 'anthony@localhost';
-//            $subject = 'Event Form Submission';
-//            $message = "Thank you for submitting your event! \r\n". "Event Name: " . $name . "\r\n" .
-//                       "Scheduled for: " . $starting ;
-//            $headers = 'From: webmaster@example.com' . "\r\n" .
-//                        'Reply-To: webmaster@example.com' . "\r\n" .
-//                        'X-Mailer: PHP/' . phpversion();
-//
-//            mail($to, $subject, $message, $headers);
-              $view = 'confirmation';
-         }
-
-//        echo '<pre>', print_r($cats), '</pre>';
+        // remove the filter to avoid conflicts
+        remove_filter( 'wp_mail_content_type', 'set_content_type' );
+
+        $view = 'confirmation';
+    }
         // Compile template data
         $templateData = array(
             'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL,
@@ -450,6 +498,9 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
             'event'       => $newEvent,
             'permalink'   => $permalink,
             'title'       => $title,
+            'to_email'    => $to_email,
+            'from_email'  => $fromEmail,
+            'notification'=> $emailNotification,
             'mainImgUrl'  => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/'
         );
 
diff --git a/setup/databaseScripts/create_database_V0.0.17.sql b/setup/databaseScripts/create_database_V0.0.17.sql
deleted file mode 100644 (file)
index 89432a8..0000000
+++ /dev/null
@@ -1,182 +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 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
-
--- 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
-  name TINYTEXT NULL,                                   -- Name of this recurrence schedule - used on admin calendar
-  start_time TIME NULL,                                 -- Start time of day for event
-  start_time_only BOOLEAN NULL,                         -- Use end of first occurrence flag
-  end_time TIME NULL,                                   -- End time of day for event - If less than start time, assume a date boundry
-  all_day BOOLEAN NULL,                                 -- Flag indicating if this is an all-day event (informational only)
-  start_date DATE NULL,                                 -- Starting Date (if all_day is selected) Used instead of start_time
-  from_date DATE NULL,                                  -- From Date for recurrences
-  to_date DATE NULL,                                    -- To Date for recurrences
-  recurring BOOLEAN NULL,                               -- Flag indicating that event recurs on a schedule rather than all dates
-  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
-  specific_dates TEXT NULL,                             -- Serialized array of specific dates added to the recurrence
-  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 recurrence entry
-  active BOOLEAN NULL,                                  -- Active flag - normally set but used to temporarily disable 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 referenced 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 abbreviation
-  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
-  file1 TINYTEXT NULL,                                  -- File name for a single uploaded file #1
-  file1_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #1 
-  file2 TINYTEXT NULL,                                  -- File name for a single uploaded file #2
-  file2_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #2 
-  file3 TINYTEXT NULL,                                  -- File name for a single uploaded file #3
-  file3_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #3 
-  url TINYTEXT NULL,                                    -- Event URL
-  ticket_url TINYTEXT NULL,                             -- Ticket URL
-  cost TINYTEXT NULL,                                   -- Description of event cost
-  admin_ref_type INT NULL,                              -- Type of admin contact if using a member contact
-  admin_ref_dest INT NULL,                              -- Pointer to admin contact record if using a member contact
-  admin_name TINYTEXT NULL,                             -- Admin Contact Name if not using a member contact
-  admin_org TINYTEXT NULL,                              -- Admin Contact Organization if not using a member contact
-  admin_email TINYTEXT NULL,                            -- Admin Contact E-Mail if not using a member contact
-  admin_phone TINYTEXT NULL,                            -- Admin Contact Phone if not using a member contact
-  free BOOLEAN NULL,                                    -- Event is Free
-  contact_email TINYTEXT NULL,                          -- Contact E-mail address
-  contact_name TINYTEXT NULL,                           -- Contact name
-  contact_phone TINYTEXT NULL,                          -- Event Phone
-  use_member_location BOOLEAN NULL,                     -- Use location of the member (if provided) rather than location table data
-  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
-  pdf_logo TINYTEXT NULL,             -- Image for the Top of the PDF
-  footer_text TINYTEXT NULL,          -- Image for the Top of the PDF
-  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.18.sql b/setup/databaseScripts/create_database_V0.0.18.sql
new file mode 100644 (file)
index 0000000..47dac5b
--- /dev/null
@@ -0,0 +1,185 @@
+-- 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 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
+
+-- 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
+  name TINYTEXT NULL,                                   -- Name of this recurrence schedule - used on admin calendar
+  start_time TIME NULL,                                 -- Start time of day for event
+  start_time_only BOOLEAN NULL,                         -- Use end of first occurrence flag
+  end_time TIME NULL,                                   -- End time of day for event - If less than start time, assume a date boundry
+  all_day BOOLEAN NULL,                                 -- Flag indicating if this is an all-day event (informational only)
+  start_date DATE NULL,                                 -- Starting Date (if all_day is selected) Used instead of start_time
+  from_date DATE NULL,                                  -- From Date for recurrences
+  to_date DATE NULL,                                    -- To Date for recurrences
+  recurring BOOLEAN NULL,                               -- Flag indicating that event recurs on a schedule rather than all dates
+  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
+  specific_dates TEXT NULL,                             -- Serialized array of specific dates added to the recurrence
+  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 recurrence entry
+  active BOOLEAN NULL,                                  -- Active flag - normally set but used to temporarily disable 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 referenced 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 abbreviation
+  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
+  file1 TINYTEXT NULL,                                  -- File name for a single uploaded file #1
+  file1_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #1 
+  file2 TINYTEXT NULL,                                  -- File name for a single uploaded file #2
+  file2_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #2 
+  file3 TINYTEXT NULL,                                  -- File name for a single uploaded file #3
+  file3_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #3 
+  url TINYTEXT NULL,                                    -- Event URL
+  ticket_url TINYTEXT NULL,                             -- Ticket URL
+  cost TINYTEXT NULL,                                   -- Description of event cost
+  admin_ref_type INT NULL,                              -- Type of admin contact if using a member contact
+  admin_ref_dest INT NULL,                              -- Pointer to admin contact record if using a member contact
+  admin_name TINYTEXT NULL,                             -- Admin Contact Name if not using a member contact
+  admin_org TINYTEXT NULL,                              -- Admin Contact Organization if not using a member contact
+  admin_email TINYTEXT NULL,                            -- Admin Contact E-Mail if not using a member contact
+  admin_phone TINYTEXT NULL,                            -- Admin Contact Phone if not using a member contact
+  free BOOLEAN NULL,                                    -- Event is Free
+  contact_email TINYTEXT NULL,                          -- Contact E-mail address
+  contact_name TINYTEXT NULL,                           -- Contact name
+  contact_phone TINYTEXT NULL,                          -- Event Phone
+  use_member_location BOOLEAN NULL,                     -- Use location of the member (if provided) rather than location table data
+  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
+  pdf_logo TINYTEXT NULL,             -- Image for the Top of the PDF
+  footer_text TINYTEXT NULL,          -- Image for the Top of the PDF
+  to_email TINYTEXT NULL,             -- Email address of the recipient
+  from_email TINYTEXT NULL,           -- Email address of the sender
+  email_notification TEXT NULL,       -- Email notification message
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event management entry
+INSERT INTO {prefix}management
+    ( id, canonical_event_page )
+   VALUES
+    ( 1, 'event-detail' )
+;
+
index 212bf88..c2382c2 100644 (file)
@@ -28,6 +28,7 @@ $glmMembersEventsDbVersions = array(
     '0.0.12' => array('version' => '0.0.12', 'tables' => 7),
     '0.0.15' => array('version' => '0.0.15', 'tables' => 7, 'date' => '4/11/2016'),
     '0.0.16' => array('version' => '0.0.16', 'tables' => 7, 'date' => '4/11/2016'),
-    '0.0.17' => array('version' => '0.0.17', 'tables' => 7, 'date' => '5/5/2016')
+    '0.0.17' => array('version' => '0.0.17', 'tables' => 7, 'date' => '5/5/2016'),
+    '0.0.18' => array('version' => '0.0.18', 'tables' => 7, 'date' => '5/26/2016')
 );
 
diff --git a/setup/databaseScripts/update_database_V0.0.18.sql b/setup/databaseScripts/update_database_V0.0.18.sql
new file mode 100644 (file)
index 0000000..42ec184
--- /dev/null
@@ -0,0 +1,21 @@
+-- Gaslight Media Members Database  - Events Add-On
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.18
+-- 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 recipient email address
+ALTER TABLE {prefix}management ADD COLUMN to_email TINYTEXT;
+
+----
+
+-- Add sender email address
+ALTER TABLE {prefix}management ADD COLUMN from_email TINYTEXT;
+
+----
+
+-- Add notification message
+ALTER TABLE {prefix}management ADD COLUMN email_notification TEXT;
index f51585b..d246464 100644 (file)
@@ -13,7 +13,7 @@
             <td colspan="2">
                 {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
                 {if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
-                <h2>Management Settings</h2>
+                <h1>Management Settings</h1>
             </td>
         </tr>
         <tr>
                                 {if $eventsSettings.fieldFail.footer_text}<p>{$eventsSettings.fieldFail.footer_text}</p>{/if}
                             </td>
                         </tr>
+                        <tr>
+                            <td>
+                                <h1> E-Mail Notification Settings </h1>
+                            </td>
+                        </tr>
+                        <tr>
+                        </tr>
+                        <tr>
+                            <th class="emailLabel"> Sender Email Address </th>
+                            <td><input class="glm-form-text-input-medium" name="from_email" id="fromEmailAddress" type="text" value="{$eventsSettings.fieldData.from_email}"></td>
+                        </tr>
+                        <tr>
+                            <th class="emailLabel"> Recipient Email Address (comma separated) </th>
+                            <td><input class="glm-form-text-input-medium" name="to_email" id="toEmailAddress" type="text" value="{$eventsSettings.fieldData.to_email}"></td>
+                        </tr>
+                        <tr>
+                            <th>Email Notification</th>
+                            <td>
+                                <textarea rows="3" cols="90" name="email_notification" id="emailNotification">{$eventsSettings.fieldData.email_notification} </textarea>
+                            </td>
+                        </tr>
+                        <tr>
+
                     </table>
                     <input type="submit" value="Update Settings" class="button-primary">
                 </form>
         </tr>
   {/if}
     </table>
+    <table id="glm-table-emailNotification" class="glm-admin-table glm-settings-table{if $option!='emailNotification'} glm-hidden{/if}">
+
+            <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+                <input type="hidden" name="glm_action" value="events">
+                <input type="hidden" name="option3" value="submit">
+                <input type="hidden" name="option" value="emailNotification">
+                
+            </form>
+        </table>
         
     <script type="text/javascript">
         
diff --git a/views/front/events/ownerEmail.html b/views/front/events/ownerEmail.html
new file mode 100644 (file)
index 0000000..5af8c83
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta http-equiv="content-type" content="text/html;charset=utf-8">
+        <title>Event Submission Confirmation</title>
+    </head>
+    <body>
+        <div id="emailMessage">
+            {$emailNotification}
+        </div>
+        <p>A new Event has been added to your Website from your &quot;Add Your Event&quot; page.</p>
+        <p>To approve it, please go to the <a href="{$pendingEvents}"> events </a> page in your admin.</p>
+    </body>
+</html>
\ No newline at end of file