From c43a5a4b3116f5de7b5638f20ed2d88d993434e4 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 31 May 2016 14:38:04 -0400 Subject: [PATCH] WIP for Time.ly Imports Start by setting up a new tab under event management import --- models/admin/management/events.php | 1989 ++++++++++++++-------------- models/front/events/baseAction.php | 457 ++++--- views/admin/management/events.html | 368 ++--- 3 files changed, 1431 insertions(+), 1383 deletions(-) diff --git a/models/admin/management/events.php b/models/admin/management/events.php index bf0990c..cdeb99b 100644 --- a/models/admin/management/events.php +++ b/models/admin/management/events.php @@ -7,10 +7,10 @@ * * @category glmWordPressPlugin * @package glmMembersDatabase - * @author Chuck Scott + * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia * @release events.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ - * @link http://dev.gaslightmedia.com/ + * @link http://dev.gaslightmedia.com/ */ // Load Management Events data abstract @@ -25,997 +25,1020 @@ require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php'); * * @category Model * @package GLM Member DB - * @author Chuck Scott + * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott - * Exp $ + * @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ */ class GlmMembersAdmin_management_events extends GlmDataEventsManagement { - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * dbh Postgres database connection - * - * @var mixed - * @access public - */ - public $dbh; - /** - * settings used for the schema and tablenames - * - * @var mixed - * @access public - */ - public $settings = array(); - /** - * categories - * - * @var bool - * @access public - */ - public $categories = array(); - public $oldCatMap = array(); - /** - * events - * - * @var bool - * @access public - */ - public $events = array(); - public $image_owner; - - /** - * 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 members data class - parent::__construct(false, false); - - } - - public function importEventImages() - { - require_once(GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php'); - $ImageUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config); - // get all events with images - $sql = " - SELECT id,image,old_event_id - FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events - WHERE image != '' AND image IS NOT NULL"; - $results = $this->wpdb->get_results($sql, ARRAY_A); - $out = '
$results: ' . print_r($results, true) . '
'; - $imgUrl = 'http://is0.gaslightmedia.com/' . $this->image_owner . '/original/'; - foreach ( $results as $event ) { - $imageFullUrl = $imgUrl . $event['image']; - $res = $ImageUpload->storeImage($imageFullUrl); - - if ( $res['newFileName'] ) { - $this->wpdb->update( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events', - array( - 'image' => $res['newFileName'] - ), - array( 'id' => $event['id'] ), - array( '%s' ), - array( '%d' ) - ); - } - } - return $out; - } - - public function importEventFiles() - { - // get all events with images - $sql = " - SELECT id,file1,file2_descr,old_event_id - FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events - WHERE file1 != '' AND file1 IS NOT NULL"; - $results = $this->wpdb->get_results($sql, ARRAY_A); - $fileUrl = 'http://is0.gaslightmedia.com/' . $this->image_owner . '/original/'; - $out = '
$results: ' . print_r($results, true) . '
'; - //exit; - foreach ( $results as $event ) { - $fileFullUrl = $fileUrl . $event['image']; - $fp = fopen( GLM_MEMBERS_PLUGIN_FILES_PATH . '/' . $event['file1'], 'w+' ); - $ch = curl_init( $fileUrl . $event['file1'] ); - 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_FILES_PATH . '/' . $event['file1'], 0660 ); - umask($oldUmask); - } - return $out; - } - - /** - * modelAction - * - * @param bool $actionData - * @access public - * @return void - */ - public function modelAction($actionData = false) - { - - $option = false; - $testResult = false; - $importResult = false; - $settingsUpdated = false; - $settingsUpdateError = false; - $eventsSettings = false; - - if (isset($_REQUEST['option'])) { - $option = $_REQUEST['option']; - } - - switch ($option) { - - case 'tests': - - $test = false; - if (isset($_REQUEST['test'])) { - $test = $_REQUEST['test']; - } - - switch ($test) { - - case 'recurrence': - - $testResult = $this->testRecurrence(); - - break; - - default: - break; - } - - break; - - case 'eventImagesImport': - - $this->image_owner = filter_var($_REQUEST['img_owner_id'], FILTER_SANITIZE_STRING); - - if ( $this->image_owner ) { - $this->importEventImages(); - $this->importEventFiles(); - $importResult = '

All images and files imported

'; - } else { - $importResult = '
Failure: Not given owner id.
'; - } - - - break; - - case 'eventFilesImport': - - - break; - - case 'eventimport': - - $import = false; - if (isset($_REQUEST['import'])) { - $import = filter_var( $_REQUEST['import'], FILTER_VALIDATE_BOOLEAN ); - } - switch ($import) { - case 'true': - $importResult = '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; - $db_host = filter_var( $_REQUEST['db_host'], FILTER_SANITIZE_STRING ); - $db_name = filter_var( $_REQUEST['db_name'], FILTER_SANITIZE_STRING ); - $db_user = filter_var( $_REQUEST['db_user'], FILTER_SANITIZE_STRING ); - $db_password = filter_var( $_REQUEST['db_password'], FILTER_SANITIZE_STRING ); - $this->connectPostgresDb($db_host, $db_name, $db_user, $db_password); - - $this->settings = filter_var_array( - $_REQUEST, - array( - 'schema' => FILTER_SANITIZE_STRING, - 'cattablename' => FILTER_SANITIZE_STRING, - 'tablename' => FILTER_SANITIZE_STRING, - 'sdate' => array( - 'filter' => FILTER_VALIDATE_REGEXP, - 'options' => array( - 'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%' - ) - ) - - ) - ); - $importResult .= '
$this->settings: ' . print_r($this->settings, true) . '
'; - $this->addCategories(); - $importResult .= $this->addEvents(); - - $importResult .= '
$this->categories: ' . print_r($this->categories, true) . '
'; - - - break; - default: - break; - } - break; - - case 'settings': - - default: - - // Make sure option is set if default - $option = 'settings'; - - // Determine if current user can edit configurations - if (!current_user_can('glm_members_management')) { - return array( - 'status' => false, - 'menuItemRedirect' => 'error', - 'modelRedirect' => 'index', - 'view' => 'admin/error/index.html', - 'data' => array( - 'reason' => 'User does not have rights to make configuration changes.' - ) - ); - } - - // Check for submission option - $option2 = ''; - if (isset($_REQUEST['option2'])) { - $option2 = $_REQUEST['option2']; - } - - switch($option2) { - - // Update the settings and redisplay the form - case 'submit': - - // Update the event management settings - $eventsSettings = $this->updateEntry(1); - if ($eventsSettings['status']) { - $settingsUpdated = true; - } else { - $settingsUpdateError = true; - } - - break; - - // Default is to get the current settings and display the form - default: - - // Try to get the first (should be only) entry for general settings. - $eventsSettings = $this->editEntry(1); - - if ($eventsSettings === false) { - - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("  /models/admin/management/events.php: Unable to load events management settings.", 'Alert'); - } - - } - - break; - - } - - break; - - } - - // Compile template data - $templateData = array( - 'option' => $option, - 'testResult' => $testResult, - 'importResult' => $importResult, - 'settingsUpdated' => $settingsUpdated, - 'settingsUpdateError' => $settingsUpdateError, - 'eventsSettings' => $eventsSettings - ); - - // Return status, suggested view, and data to controller - return array( - 'status' => true, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/management/events.html', - 'data' => $templateData - ); - - - } - - /** - * connectPostgresDb - * - * Make a connection to the given database for the site. (postgres) - * Sets the $this->dbh with the postgers database connection - * - * @param mixed $db_host - * @param mixed $db_name - * @param mixed $db_user - * @param mixed $db_password - * @access public - * @return void - */ - public function connectPostgresDb($db_host, $db_name, $db_user, $db_password) - { - $connStr = "pgsql:"; - if ( $db_host ) { - $connPart[] = "host={$db_host}"; - } - if ( $db_name ) { - $connPart[] = "dbname={$db_name}"; - } - if ( $db_user ) { - $connPart[] = "user={$db_user}"; - } - if ( $db_password ) { - $connPart[] = "password={$db_password}"; - } - if ( !empty($connPart) ) { - $connStr .= implode( " ", $connPart ); - } - $driverOptions = array( - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_BOTH, - ); - try { - $this->dbh = new PDO($connStr, null, null, $driverOptions); - $this->dbh->setAttribute( - PDO::ATTR_ERRMODE, - PDO::ERRMODE_EXCEPTION - ); - } catch(PDOException $e) { - echo '
$e: ' . print_r($e, true) . '
'; - wp_die(); - } - } - - /** - * Test Recurrance Calculation of Dates - * - * @return test Text of test results - */ - public function testRecurrence() - { - - $res = ''; - - // Load recurrences class - require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php'; - $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config); - - // Create sample recurrence entry - $start_time = '2016/2/27 08:00:00'; - $res .= "First event start date/time: $start_time
"; - $end_time = '2016/2/28 17:00:00'; - $res .= "First event end date/time: $end_time
"; - $from_date = '2016/2/1'; - $res .= "From date: $from_date
"; - $to_date = '2017/3/31'; - $res .= "To date: $to_date
"; - - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', - array( - 'event' => 999999999, - 'start_time' => $start_time, - 'end_time' => $end_time, - 'from_date' => $from_date, - 'to_date' => $to_date, - 'all_day' => false, - 'month_of_year' => - pow(2, $this->config['month_bit']['January']) + - pow(2, $this->config['month_bit']['June']), - 'week_of_month' => - pow(2, $this->config['week_bit']['Third']) + - pow(2, $this->config['week_bit']['First']), - 'day_of_week' => - pow(2, $this->config['day_bit']['Wednesday']) + - pow(2, $this->config['day_bit']['Friday']), - 'day_of_month' => - pow(2, 1) + pow(2, 13) + pow(2, 26) + pow(2, 30), - 'last_day_of_month' => true, - 'holiday' => 0, - 'holiday_offset' => 0 - ), - array( - '%d', - '%s', - '%s', - '%s', - '%s', - '%d', - '%d', - '%d', - '%d', - '%d', - '%d', - '%d', - '%d' - ) - ); - $recurID = $this->wpdb->insert_id; - if (!$recurID) { - return 'Error inserting recurrence entry!'; - } - - // Run recurrence time function - $Recurrences->optionIncludeSelectListData = false; - $times = $Recurrences->createRecurrenceTimesEntries($recurID, true, true); - - // Delete test recurrence - $this->wpdb->delete( GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', array( 'ID' => $recurID ) ); - $this->wpdb->delete( GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'times', array( 'recur_id' => $recurID ) ); - - $res .= "

Times Entries Generated

".print_r($times,1)."
"; - - return $res; - - } - - /** - * addCategories - * - * Checks to see if there's an Event Category already in the database. - * If not it will create the entry. - * Sets up the class variables - * $this->categories (contains all the categories that get added keyed with - * category id) - * $this->oldCatMap (map of the old category id to new category ids) - * - * @access public - * @return void - */ - public function addCategories() - { - $return = ''; - $sql = " - SELECT * - FROM {$this->settings['schema']}.{$this->settings['cattablename']} - ORDER BY id"; - $return .= '
$sql: ' . print_r($sql, true) . '
'; - try { - $categories = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); - $return .= '
$categories: ' . print_r($categories, true) . '
'; - foreach ( $categories as $category ) { - // first check to see if the category is already there - $sql = " - SELECT id - FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "categories - WHERE name = '" . esc_sql( trim($category['name']) ) . "'"; - $return .= '
$sql: ' . print_r($sql, true) . '
'; - $found = $this->wpdb->get_row($sql, ARRAY_A); - $return .= '
$found: ' . print_r($found, true) . '
'; - if ( !isset($found) ) { - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'categories', - array( - 'name' => trim($category['name']), - 'parent' => 0 - ), - array( - '%s', - '%d' - ) - ); - $catid = $this->wpdb->insert_id; - $this->categories[$catid] = trim($category['name']); - $this->oldCatMap[$category['id']] = $catid; - } else { - $this->categories[$found['id']] = trim($category['name']); - $this->oldCatMap[$category['id']] = $found['id']; - } - } - } catch(PDOException $e) { - echo '
$e: ' . print_r($e, true) . '
'; - die('end here'); - } - return $return; - } - - /** - * getTime - * - * Given a time string return the the following format of time - * H:i - * hour and minute - * - * @param mixed $time String with any time format - * - * @access public - * @return void - */ - public function getTime($time) - { + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * dbh Postgres database connection + * + * @var mixed + * @access public + */ + public $dbh; + /** + * settings used for the schema and tablenames + * + * @var mixed + * @access public + */ + public $settings = array(); + /** + * categories + * + * @var bool + * @access public + */ + public $categories = array(); + public $oldCatMap = array(); + /** + * events + * + * @var bool + * @access public + */ + public $events = array(); + public $image_owner; + + /** + * 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 members data class + parent::__construct(false, false); + + } + + public function importEventImages() + { + require_once(GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php'); + $ImageUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config); + // get all events with images + $sql = " + SELECT id,image,old_event_id + FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events + WHERE image != '' AND image IS NOT NULL"; + $results = $this->wpdb->get_results($sql, ARRAY_A); + $out = '
$results: ' . print_r($results, true) . '
'; + $imgUrl = 'http://is0.gaslightmedia.com/' . $this->image_owner . '/original/'; + foreach ( $results as $event ) { + $imageFullUrl = $imgUrl . $event['image']; + $res = $ImageUpload->storeImage($imageFullUrl); + + if ( $res['newFileName'] ) { + $this->wpdb->update( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events', + array( + 'image' => $res['newFileName'] + ), + array( 'id' => $event['id'] ), + array( '%s' ), + array( '%d' ) + ); + } + } + return $out; + } + + public function importEventFiles() + { + // get all events with images + $sql = " + SELECT id,file1,file2_descr,old_event_id + FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events + WHERE file1 != '' AND file1 IS NOT NULL"; + $results = $this->wpdb->get_results($sql, ARRAY_A); + $fileUrl = 'http://is0.gaslightmedia.com/' . $this->image_owner . '/original/'; + $out = '
$results: ' . print_r($results, true) . '
'; + //exit; + foreach ( $results as $event ) { + $fileFullUrl = $fileUrl . $event['image']; + $fp = fopen( GLM_MEMBERS_PLUGIN_FILES_PATH . '/' . $event['file1'], 'w+' ); + $ch = curl_init( $fileUrl . $event['file1'] ); + 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_FILES_PATH . '/' . $event['file1'], 0660 ); + umask($oldUmask); + } + return $out; + } + + /** + * modelAction + * + * @param bool $actionData + * @access public + * @return void + */ + public function modelAction($actionData = false) + { + + $option = false; + $testResult = false; + $importResult = false; + $settingsUpdated = false; + $settingsUpdateError = false; + $eventsSettings = false; + + if (isset($_REQUEST['option'])) { + $option = $_REQUEST['option']; + } + + switch ($option) { + case 'timelyImport': + $import = false; + if (isset($_REQUEST['import'])) { + $import = filter_var( $_REQUEST['import'], FILTER_VALIDATE_BOOLEAN ); + } + $importResult = $this->importFromTimely(); + break; + + case 'tests': + + $test = false; + if (isset($_REQUEST['test'])) { + $test = $_REQUEST['test']; + } + + switch ($test) { + + case 'recurrence': + + $testResult = $this->testRecurrence(); + + break; + + default: + break; + } + + break; + + case 'eventImagesImport': + + $this->image_owner = filter_var($_REQUEST['img_owner_id'], FILTER_SANITIZE_STRING); + + if ( $this->image_owner ) { + $this->importEventImages(); + $this->importEventFiles(); + $importResult = '

All images and files imported

'; + } else { + $importResult = '
Failure: Not given owner id.
'; + } + + + break; + + case 'eventFilesImport': + + + break; + + case 'eventimport': + + $import = false; + if (isset($_REQUEST['import'])) { + $import = filter_var( $_REQUEST['import'], FILTER_VALIDATE_BOOLEAN ); + } + switch ($import) { + case 'true': + $importResult = '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; + $db_host = filter_var( $_REQUEST['db_host'], FILTER_SANITIZE_STRING ); + $db_name = filter_var( $_REQUEST['db_name'], FILTER_SANITIZE_STRING ); + $db_user = filter_var( $_REQUEST['db_user'], FILTER_SANITIZE_STRING ); + $db_password = filter_var( $_REQUEST['db_password'], FILTER_SANITIZE_STRING ); + $this->connectPostgresDb($db_host, $db_name, $db_user, $db_password); + + $this->settings = filter_var_array( + $_REQUEST, + array( + 'schema' => FILTER_SANITIZE_STRING, + 'cattablename' => FILTER_SANITIZE_STRING, + 'tablename' => FILTER_SANITIZE_STRING, + 'sdate' => array( + 'filter' => FILTER_VALIDATE_REGEXP, + 'options' => array( + 'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%' + ) + ) + + ) + ); + $importResult .= '
$this->settings: ' . print_r($this->settings, true) . '
'; + $this->addCategories(); + $importResult .= $this->addEvents(); + + $importResult .= '
$this->categories: ' . print_r($this->categories, true) . '
'; + + + break; + default: + break; + } + break; + + case 'settings': + + default: + + // Make sure option is set if default + $option = 'settings'; + + // Determine if current user can edit configurations + if (!current_user_can('glm_members_management')) { + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'User does not have rights to make configuration changes.' + ) + ); + } + + // Check for submission option + $option2 = ''; + if (isset($_REQUEST['option2'])) { + $option2 = $_REQUEST['option2']; + } + + switch($option2) { + + // Update the settings and redisplay the form + case 'submit': + + // Update the event management settings + $eventsSettings = $this->updateEntry(1); + if ($eventsSettings['status']) { + $settingsUpdated = true; + } else { + $settingsUpdateError = true; + } + + break; + + // Default is to get the current settings and display the form + default: + + // Try to get the first (should be only) entry for general settings. + $eventsSettings = $this->editEntry(1); + + if ($eventsSettings === false) { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("  /models/admin/management/events.php: Unable to load events management settings.", 'Alert'); + } + + } + + break; + + } + + break; + + } + + // Compile template data + $templateData = array( + 'option' => $option, + 'testResult' => $testResult, + 'importResult' => $importResult, + 'settingsUpdated' => $settingsUpdated, + 'settingsUpdateError' => $settingsUpdateError, + 'eventsSettings' => $eventsSettings + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => true, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/management/events.html', + 'data' => $templateData + ); + + + } + + /** + * connectPostgresDb + * + * Make a connection to the given database for the site. (postgres) + * Sets the $this->dbh with the postgers database connection + * + * @param mixed $db_host + * @param mixed $db_name + * @param mixed $db_user + * @param mixed $db_password + * @access public + * @return void + */ + public function connectPostgresDb($db_host, $db_name, $db_user, $db_password) + { + $connStr = "pgsql:"; + if ( $db_host ) { + $connPart[] = "host={$db_host}"; + } + if ( $db_name ) { + $connPart[] = "dbname={$db_name}"; + } + if ( $db_user ) { + $connPart[] = "user={$db_user}"; + } + if ( $db_password ) { + $connPart[] = "password={$db_password}"; + } + if ( !empty($connPart) ) { + $connStr .= implode( " ", $connPart ); + } + $driverOptions = array( + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_BOTH, + ); + try { + $this->dbh = new PDO($connStr, null, null, $driverOptions); + $this->dbh->setAttribute( + PDO::ATTR_ERRMODE, + PDO::ERRMODE_EXCEPTION + ); + } catch(PDOException $e) { + echo '
$e: ' . print_r($e, true) . '
'; + wp_die(); + } + } + + /** + * Test Recurrance Calculation of Dates + * + * @return test Text of test results + */ + public function testRecurrence() + { + + $res = ''; + + // Load recurrences class + require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php'; + $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config); + + // Create sample recurrence entry + $start_time = '2016/2/27 08:00:00'; + $res .= "First event start date/time: $start_time
"; + $end_time = '2016/2/28 17:00:00'; + $res .= "First event end date/time: $end_time
"; + $from_date = '2016/2/1'; + $res .= "From date: $from_date
"; + $to_date = '2017/3/31'; + $res .= "To date: $to_date
"; + + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', + array( + 'event' => 999999999, + 'start_time' => $start_time, + 'end_time' => $end_time, + 'from_date' => $from_date, + 'to_date' => $to_date, + 'all_day' => false, + 'month_of_year' => + pow(2, $this->config['month_bit']['January']) + + pow(2, $this->config['month_bit']['June']), + 'week_of_month' => + pow(2, $this->config['week_bit']['Third']) + + pow(2, $this->config['week_bit']['First']), + 'day_of_week' => + pow(2, $this->config['day_bit']['Wednesday']) + + pow(2, $this->config['day_bit']['Friday']), + 'day_of_month' => + pow(2, 1) + pow(2, 13) + pow(2, 26) + pow(2, 30), + 'last_day_of_month' => true, + 'holiday' => 0, + 'holiday_offset' => 0 + ), + array( + '%d', + '%s', + '%s', + '%s', + '%s', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d' + ) + ); + $recurID = $this->wpdb->insert_id; + if (!$recurID) { + return 'Error inserting recurrence entry!'; + } + + // Run recurrence time function + $Recurrences->optionIncludeSelectListData = false; + $times = $Recurrences->createRecurrenceTimesEntries($recurID, true, true); + + // Delete test recurrence + $this->wpdb->delete( GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', array( 'ID' => $recurID ) ); + $this->wpdb->delete( GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'times', array( 'recur_id' => $recurID ) ); + + $res .= "

Times Entries Generated

".print_r($times,1)."
"; + + return $res; + + } + + /** + * addCategories + * + * Checks to see if there's an Event Category already in the database. + * If not it will create the entry. + * Sets up the class variables + * $this->categories (contains all the categories that get added keyed with + * category id) + * $this->oldCatMap (map of the old category id to new category ids) + * + * @access public + * @return void + */ + public function addCategories() + { + $return = ''; + $sql = " + SELECT * + FROM {$this->settings['schema']}.{$this->settings['cattablename']} + ORDER BY id"; + $return .= '
$sql: ' . print_r($sql, true) . '
'; + try { + $categories = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); + $return .= '
$categories: ' . print_r($categories, true) . '
'; + foreach ( $categories as $category ) { + // first check to see if the category is already there + $sql = " + SELECT id + FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "categories + WHERE name = '" . esc_sql( trim($category['name']) ) . "'"; + $return .= '
$sql: ' . print_r($sql, true) . '
'; + $found = $this->wpdb->get_row($sql, ARRAY_A); + $return .= '
$found: ' . print_r($found, true) . '
'; + if ( !isset($found) ) { + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'categories', + array( + 'name' => trim($category['name']), + 'parent' => 0 + ), + array( + '%s', + '%d' + ) + ); + $catid = $this->wpdb->insert_id; + $this->categories[$catid] = trim($category['name']); + $this->oldCatMap[$category['id']] = $catid; + } else { + $this->categories[$found['id']] = trim($category['name']); + $this->oldCatMap[$category['id']] = $found['id']; + } + } + } catch(PDOException $e) { + echo '
$e: ' . print_r($e, true) . '
'; + die('end here'); + } + return $return; + } + + /** + * getTime + * + * Given a time string return the the following format of time + * H:i + * hour and minute + * + * @param mixed $time String with any time format + * + * @access public + * @return void + */ + public function getTime($time) + { echo '
$time: ' . print_r($time, true) . '
'; - if (!$time) { - return false; - } - if (!preg_match('%(\d{1,2}):?(\d{2})? ?(\w{1,2})?%', $time, $timeParts)) { - //die('not found'); - return false; - } + if (!$time) { + return false; + } + if (!preg_match('%(\d{1,2}):?(\d{2})? ?(\w{1,2})?%', $time, $timeParts)) { + //die('not found'); + return false; + } echo '
$timeParts: ' . print_r($timeParts, true) . '
'; - //$hour = (!$timeParts[3] || in_array(strtolower(trim($timeParts[3])), array('pm', 'p'))) - // ? ( ((int)$timeParts[1] === 12) ? 12 : (int)$timeParts[1] += 12 ) - // : ( ((int)$timeParts[1] === 12) ? 0 : (int)$timeParts[1] ); + //$hour = (!$timeParts[3] || in_array(strtolower(trim($timeParts[3])), array('pm', 'p'))) + // ? ( ((int)$timeParts[1] === 12) ? 12 : (int)$timeParts[1] += 12 ) + // : ( ((int)$timeParts[1] === 12) ? 0 : (int)$timeParts[1] ); $hour = $timeParts[1]; - // parse the hour from event - $dateTime = new DateTime(); - $dateTime->setTime($hour, (int)$timeParts[2] ); + // parse the hour from event + $dateTime = new DateTime(); + $dateTime->setTime($hour, (int)$timeParts[2] ); echo '
$dateTime: ' . print_r($dateTime, true) . '
'; - return $dateTime->format('H:i'); - } - - /** - * getCityId - * - * Given a city name find and return the id of the city. - * If a city cannot be found then create city with that name. - * - * @param mixed $cityName Name of the city - * - * @access public - * @return id of city - */ - public function getCityId($cityName) - { - $sql = " - SELECT id - FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities - WHERE name like '" . esc_sql( trim( $cityName ) ) . "'"; - $cityId = $this->wpdb->get_row($sql, ARRAY_A); - if ( !$cityId ) { - // then add the city to the city table - $this->wpdb->insert( - GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities', - array( 'name' => trim( $cityName ) ), - array( '%s' ) - ); - return $this->wpdb->insert_id; - } else { - return $cityId['id']; - } - } - - /** - * addEvents - * - * Start with a clean set of event tables. ( delete all event data ) - * Grab all events starting with the given start date. - * Enter them into the new event plugin tables. - * - * @access public - * @return void - */ - public function addEvents() - { - // clear the events tables first - $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events" ); - $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "recurrences" ); - $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times" ); - $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "event_categories" ); - $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations" ); - $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config); - $return = ''; - $oldEventFormat = ($this->settings['tablename'] == 'event'); - if ( $oldEventFormat ) { - $sql = " - SELECT * - FROM {$this->settings['schema']}.{$this->settings['tablename']} - WHERE edate >= '{$this->settings['sdate']}'::DATE"; - } else { - $sql = " - SELECT * - FROM {$this->settings['schema']}.{$this->settings['tablename']} - WHERE ending >= '{$this->settings['sdate']}'::DATE"; - $prepareSql = " - SELECT filename,urltext - FROM {$this->settings['schema']}.files - WHERE event = :eid"; - $getFileData = $this->dbh->prepare($prepareSql); - } - //$sql .=" AND file != '' "; + return $dateTime->format('H:i'); + } + + /** + * getCityId + * + * Given a city name find and return the id of the city. + * If a city cannot be found then create city with that name. + * + * @param mixed $cityName Name of the city + * + * @access public + * @return id of city + */ + public function getCityId($cityName) + { + $sql = " + SELECT id + FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities + WHERE name like '" . esc_sql( trim( $cityName ) ) . "'"; + $cityId = $this->wpdb->get_row($sql, ARRAY_A); + if ( !$cityId ) { + // then add the city to the city table + $this->wpdb->insert( + GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities', + array( 'name' => trim( $cityName ) ), + array( '%s' ) + ); + return $this->wpdb->insert_id; + } else { + return $cityId['id']; + } + } + + /** + * addEvents + * + * Start with a clean set of event tables. ( delete all event data ) + * Grab all events starting with the given start date. + * Enter them into the new event plugin tables. + * + * @access public + * @return void + */ + public function addEvents() + { + // clear the events tables first + $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events" ); + $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "recurrences" ); + $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times" ); + $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "event_categories" ); + $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations" ); + $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config); + $return = ''; + $oldEventFormat = ($this->settings['tablename'] == 'event'); + if ( $oldEventFormat ) { + $sql = " + SELECT * + FROM {$this->settings['schema']}.{$this->settings['tablename']} + WHERE edate >= '{$this->settings['sdate']}'::DATE"; + } else { + $sql = " + SELECT * + FROM {$this->settings['schema']}.{$this->settings['tablename']} + WHERE ending >= '{$this->settings['sdate']}'::DATE"; + $prepareSql = " + SELECT filename,urltext + FROM {$this->settings['schema']}.files + WHERE event = :eid"; + $getFileData = $this->dbh->prepare($prepareSql); + } + //$sql .=" AND file != '' "; //$sql .= " AND id = 5"; - $this->wpdb->show_errors(); - echo '
$sql: ' . print_r($sql, true) . '
'; - try { - $events = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); - $return .= '
$events: ' . print_r($events, true) . '
'; - foreach ( $events as $event ) { - $foundMemberId = $refType = null; - $memberId = (isset($event['member_id'])) ? $event['member_id'] : $event['member']; - if ( $memberId ) { - // get the new member id - $sql = " - SELECT id - FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members - WHERE old_member_id = " . esc_sql( trim($memberId) ); - $foundMemberId = $this->wpdb->get_row($sql, ARRAY_A); - if ( $foundMemberId ) { - $foundMemberId = $foundMemberId['id']; - $refType = $this->config['ref_type_numb']['Member']; - } - } - if ( $oldEventFormat ) { - $intro = substr(strip_tags($event['descr']), 0, 250); - $eventData = array( - 'status' => (($event['visable'] == '1') - ? $this->config['status_numb']['Active'] - : $this->config['status_numb']['Inactive']), - 'created' => $event['create_date'], - 'updated' => $event['create_date'], - 'approved' => $event['approved_date'], - 'name' => $event['header'], - 'intro' => $intro, - 'descr' => $event['descr'], - 'image' => $event['img'], - 'file1' => $event['file'], - 'file1_descr' => $event['filename'], - 'cost' => $event['cost'], - 'url' => $event['url'], - 'old_event_id' => $event['id'], - 'ref_type' => $refType, - 'ref_dest' => $foundMemberId, - 'admin_name' => $event['admin_contact_name'], - 'admin_org' => $event['admin_org_name'], - 'admin_email' => $event['admin_email'], - 'admin_phone' => $event['admin_phone'], - 'contact_email' => $event['email'], - 'contact_name' => $event['contact'], - 'contact_phone' => $event['phone'], - 'notes' => $event['notes'], - 'hide_address' => $event['hide_address'], - ); - $eventDataFormat = array( - '%d', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%d', - '%d', - '%d', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%d', - ); - } else { - $getFileData->bindParam(':eid', $event['id'], PDO::PARAM_INT); - $getFileData->execute(); - $file = $filename = ''; - $fileData = $getFileData->fetch(PDO::FETCH_ASSOC); - if ($fileData ) { - $file = $fileData['filename']; - $filename = $fileData['urltext']; - } - $intro = ($event['intro']) - ? substr(strip_tags($event['intro']), 0, 250) - : substr(strip_tags($event['description']), 0, 250); - $eventData = array( - 'status' => (($event['active'] == '1') - ? $this->config['status_numb']['Active'] - : $this->config['status_numb']['Inactive']), - 'created' => $event['created'], - 'updated' => $event['updated'], - 'approved' => $event['approved'], - 'name' => $event['header'], - 'intro' => $intro, - 'descr' => $event['description'], - 'image' => $event['image'], - 'file1' => $file, - 'file1_descr' => $filename, - 'cost' => $event['cost'], - 'url' => $event['website'], - 'old_event_id' => $event['id'], - 'ref_type' => $refType, - 'ref_dest' => $foundMemberId, - 'admin_name' => $event['admin_contact'], - 'admin_org' => $event['admin_org'], - 'admin_email' => $event['admin_email'], - 'admin_phone' => $event['admin_phone'], - 'contact_email' => $event['contact_email'], - 'contact_name' => $event['contact_name'], - 'contact_phone' => $event['contact_phone'], - 'notes' => $event['notes'], - 'hide_address' => $event['hide_address'], - 'use_member_location' => $event['use_memberloc'] - ); - $eventDataFormat = array( - '%d', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%d', - '%d', - '%d', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%d', - '%d', - ); - } - - echo '
$eventData: ' . print_r($eventData, true) . '
'; - echo ''; - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events', - $eventData, - $eventDataFormat - ); - $eventId = $this->wpdb->insert_id; - var_dump( $eventId ); - echo '
$eventId: from insert ' . print_r($eventId, true) . '
'; - if ( !$eventId ) { - echo '
SQL Error: ' . $this->wpdb->last_error . '
'; - echo '
SQL Error: ' . $this->wpdb->print_error() . '
'; - } - // checking for $eventId - //echo '
$eventId: ' . print_r($eventId, true) . '
'; - if (!$eventId) { - die('something is wrong no eventId'); - } - // generate the slug name for this new event - $eventAbstract = new GlmDataEvents($this->wpdb, $this->config); - $eventAbstract->updateSlug($eventId); - // category for event - if ( $event['topicid'] ) { - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories', - array( - 'event' => $eventId, - 'category' => $this->oldCatMap[$event['topicid']] - ), - array( - '%d', - '%d' - ) - ); - } - if ( $event['category'] ) { - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories', - array( - 'event' => $eventId, - 'category' => $this->oldCatMap[$event['category']] - ), - array( - '%d', - '%d' - ) - ); - } - // recurrences for the event - if (isset($event['reacur'])) { - $recurringEvent = $event['reacur']; - if ( $recurringEvent && ( $event['bdate'] == $event['edate'] ) ) { - $recurringEvent = 0; - } - } else { - $recurringEvent = $event['recurr']; - if ( $recurringEvent && ( $event['starting'] == $event['ending'] ) ) { - $recurringEvent = 0; - } - } - $dayOfWeek = - $monthOfYear = - $weekOfMonth = - $byDayOfMonth = - $lastDayOfMonth = null; - if ( $recurringEvent ) { - if ( $event['daysow'] ) { - $dayOfWeek = $event['daysow']; - } else { - $dayOfWeek = 127; - } - if ( $event['weekom'] ) { - switch ($event['weekom']) { - case '1': - $weekOfMonth = 1; - break; - case '2': - $weekOfMonth = 2; - break; - case '3': - $weekOfMonth = 4; - break; - case '4': - $weekOfMonth = 8; - break; - case '5': - $weekOfMonth = 16; - break; - } - } else { - $weekOfMonth = 63; - } - $monthOfYear = 4095; - } - if ( isset($event['btime']) ) { - $btime = $this->getTime($event['btime']); - $etime = $this->getTime($event['etime']); - } else { - $btime = $this->getTime($event['starthour']); - $etime = $this->getTime($event['endhour']); - } - $startTimeOnly = ($btime && !$etime); - if ( $startTimeOnly ) { - $etime = $btime; - } - if ( isset($event['all_day']) ) { - $allDay = ( $event['all_day'] || !$btime ); - } else { - $allDay = ( $event['allday'] || !$btime ); - } - if (isset($event['bdate'])) { - $fromDate = $event['bdate']; - $toDate = $event['edate']; - } else { - $fromDate = $event['starting']; - $toDate = $event['ending']; - } - $recurData =array( - 'event' => $eventId, - 'name' => 'Imported Event Schedule', - 'start_time' => $btime, - 'end_time' => $etime, - 'start_time_only' => $startTimeOnly, - 'from_date' => $fromDate, - 'to_date' => $toDate, - 'all_day' => $allDay, - 'recurring' => $recurringEvent, - 'month_of_year' => $monthOfYear, - 'week_of_month' => $weekOfMonth, - 'day_of_week' => $dayOfWeek, - 'by_day_of_month' => $byDayOfMonth, - 'last_day_of_month' => $lastDayOfMonth - ); - //echo '
' . print_r( $recurData, true) . '
'; - echo '
$recurData: ' . print_r($recurData, true) . '
'; - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', - $recurData, - array( - '%d', - '%s', - '%s', - '%s', - '%s', - '%s', - '%s', - '%d', - '%d', - '%d', - '%d', - '%d', - '%d', - '%d', - ) - ); - $recurId = $this->wpdb->insert_id; - $Recurrences->createRecurrenceTimesEntries( $recurId, true, true ); - // location for the event - $hasLocation = ($event['loc'] || $event['place']); - if ( $hasLocation ) { - $locationData = $locationFormat = array(); - $locationData['event'] = $eventId; - $locationFormat[] = '%d'; - if ($event['place']) { - $locationData['name'] = $event['place']; - $locationFormat[] = '%s'; - } - if ($event['loc']) { - $locationData['name'] = $event['loc']; - $locationFormat[] = '%s'; - } - if ($event['address']) { - $locationData['address'] = $event['address']; - $locationFormat[] = '%s'; - } - if ($event['city']) { - $locationData['city'] = $this->getCityId( $event['city'] ); - $locationFormat[] = '%s'; - } - if ($event['state']) { - $locationData['state'] = $event['state']; - $locationFormat[] = '%s'; - } - if ($event['zip']) { - $locationData['zip'] = $event['zip']; - $locationFormat[] = '%s'; - } - if ($event['lat']) { - $locationData['lat'] = $event['lat']; - $locationFormat[] = '%s'; - } - if ($event['lon']) { - $locationData['lon'] = $event['lon']; - $locationFormat[] = '%s'; - } - $this->wpdb->insert( - GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'locations', - $locationData, - $locationFormat - ); - $locationId = $this->wpdb->insert_id; - if ( !$locationId ) { - echo '
$locationData: ' . print_r($locationData, true) . '
'; - die('no return id for location'); - } - } - } - } catch(PDOException $e) { - echo '
$e: ' . print_r($e, true) . '
'; - die('end here'); - } - return $return; - } + $this->wpdb->show_errors(); + echo '
$sql: ' . print_r($sql, true) . '
'; + try { + $events = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); + $return .= '
$events: ' . print_r($events, true) . '
'; + foreach ( $events as $event ) { + $foundMemberId = $refType = null; + $memberId = (isset($event['member_id'])) ? $event['member_id'] : $event['member']; + if ( $memberId ) { + // get the new member id + $sql = " + SELECT id + FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members + WHERE old_member_id = " . esc_sql( trim($memberId) ); + $foundMemberId = $this->wpdb->get_row($sql, ARRAY_A); + if ( $foundMemberId ) { + $foundMemberId = $foundMemberId['id']; + $refType = $this->config['ref_type_numb']['Member']; + } + } + if ( $oldEventFormat ) { + $intro = substr(strip_tags($event['descr']), 0, 250); + $eventData = array( + 'status' => (($event['visable'] == '1') + ? $this->config['status_numb']['Active'] + : $this->config['status_numb']['Inactive']), + 'created' => $event['create_date'], + 'updated' => $event['create_date'], + 'approved' => $event['approved_date'], + 'name' => $event['header'], + 'intro' => $intro, + 'descr' => $event['descr'], + 'image' => $event['img'], + 'file1' => $event['file'], + 'file1_descr' => $event['filename'], + 'cost' => $event['cost'], + 'url' => $event['url'], + 'old_event_id' => $event['id'], + 'ref_type' => $refType, + 'ref_dest' => $foundMemberId, + 'admin_name' => $event['admin_contact_name'], + 'admin_org' => $event['admin_org_name'], + 'admin_email' => $event['admin_email'], + 'admin_phone' => $event['admin_phone'], + 'contact_email' => $event['email'], + 'contact_name' => $event['contact'], + 'contact_phone' => $event['phone'], + 'notes' => $event['notes'], + 'hide_address' => $event['hide_address'], + ); + $eventDataFormat = array( + '%d', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%d', + '%d', + '%d', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%d', + ); + } else { + $getFileData->bindParam(':eid', $event['id'], PDO::PARAM_INT); + $getFileData->execute(); + $file = $filename = ''; + $fileData = $getFileData->fetch(PDO::FETCH_ASSOC); + if ($fileData ) { + $file = $fileData['filename']; + $filename = $fileData['urltext']; + } + $intro = ($event['intro']) + ? substr(strip_tags($event['intro']), 0, 250) + : substr(strip_tags($event['description']), 0, 250); + $eventData = array( + 'status' => (($event['active'] == '1') + ? $this->config['status_numb']['Active'] + : $this->config['status_numb']['Inactive']), + 'created' => $event['created'], + 'updated' => $event['updated'], + 'approved' => $event['approved'], + 'name' => $event['header'], + 'intro' => $intro, + 'descr' => $event['description'], + 'image' => $event['image'], + 'file1' => $file, + 'file1_descr' => $filename, + 'cost' => $event['cost'], + 'url' => $event['website'], + 'old_event_id' => $event['id'], + 'ref_type' => $refType, + 'ref_dest' => $foundMemberId, + 'admin_name' => $event['admin_contact'], + 'admin_org' => $event['admin_org'], + 'admin_email' => $event['admin_email'], + 'admin_phone' => $event['admin_phone'], + 'contact_email' => $event['contact_email'], + 'contact_name' => $event['contact_name'], + 'contact_phone' => $event['contact_phone'], + 'notes' => $event['notes'], + 'hide_address' => $event['hide_address'], + 'use_member_location' => $event['use_memberloc'] + ); + $eventDataFormat = array( + '%d', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%d', + '%d', + '%d', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%d', + '%d', + ); + } + + echo '
$eventData: ' . print_r($eventData, true) . '
'; + echo ''; + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events', + $eventData, + $eventDataFormat + ); + $eventId = $this->wpdb->insert_id; + var_dump( $eventId ); + echo '
$eventId: from insert ' . print_r($eventId, true) . '
'; + if ( !$eventId ) { + echo '
SQL Error: ' . $this->wpdb->last_error . '
'; + echo '
SQL Error: ' . $this->wpdb->print_error() . '
'; + } + // checking for $eventId + //echo '
$eventId: ' . print_r($eventId, true) . '
'; + if (!$eventId) { + die('something is wrong no eventId'); + } + // generate the slug name for this new event + $eventAbstract = new GlmDataEvents($this->wpdb, $this->config); + $eventAbstract->updateSlug($eventId); + // category for event + if ( $event['topicid'] ) { + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories', + array( + 'event' => $eventId, + 'category' => $this->oldCatMap[$event['topicid']] + ), + array( + '%d', + '%d' + ) + ); + } + if ( $event['category'] ) { + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories', + array( + 'event' => $eventId, + 'category' => $this->oldCatMap[$event['category']] + ), + array( + '%d', + '%d' + ) + ); + } + // recurrences for the event + if (isset($event['reacur'])) { + $recurringEvent = $event['reacur']; + if ( $recurringEvent && ( $event['bdate'] == $event['edate'] ) ) { + $recurringEvent = 0; + } + } else { + $recurringEvent = $event['recurr']; + if ( $recurringEvent && ( $event['starting'] == $event['ending'] ) ) { + $recurringEvent = 0; + } + } + $dayOfWeek = + $monthOfYear = + $weekOfMonth = + $byDayOfMonth = + $lastDayOfMonth = null; + if ( $recurringEvent ) { + if ( $event['daysow'] ) { + $dayOfWeek = $event['daysow']; + } else { + $dayOfWeek = 127; + } + if ( $event['weekom'] ) { + switch ($event['weekom']) { + case '1': + $weekOfMonth = 1; + break; + case '2': + $weekOfMonth = 2; + break; + case '3': + $weekOfMonth = 4; + break; + case '4': + $weekOfMonth = 8; + break; + case '5': + $weekOfMonth = 16; + break; + } + } else { + $weekOfMonth = 63; + } + $monthOfYear = 4095; + } + if ( isset($event['btime']) ) { + $btime = $this->getTime($event['btime']); + $etime = $this->getTime($event['etime']); + } else { + $btime = $this->getTime($event['starthour']); + $etime = $this->getTime($event['endhour']); + } + $startTimeOnly = ($btime && !$etime); + if ( $startTimeOnly ) { + $etime = $btime; + } + if ( isset($event['all_day']) ) { + $allDay = ( $event['all_day'] || !$btime ); + } else { + $allDay = ( $event['allday'] || !$btime ); + } + if (isset($event['bdate'])) { + $fromDate = $event['bdate']; + $toDate = $event['edate']; + } else { + $fromDate = $event['starting']; + $toDate = $event['ending']; + } + $recurData =array( + 'event' => $eventId, + 'name' => 'Imported Event Schedule', + 'start_time' => $btime, + 'end_time' => $etime, + 'start_time_only' => $startTimeOnly, + 'from_date' => $fromDate, + 'to_date' => $toDate, + 'all_day' => $allDay, + 'recurring' => $recurringEvent, + 'month_of_year' => $monthOfYear, + 'week_of_month' => $weekOfMonth, + 'day_of_week' => $dayOfWeek, + 'by_day_of_month' => $byDayOfMonth, + 'last_day_of_month' => $lastDayOfMonth + ); + //echo '
' . print_r( $recurData, true) . '
'; + echo '
$recurData: ' . print_r($recurData, true) . '
'; + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences', + $recurData, + array( + '%d', + '%s', + '%s', + '%s', + '%s', + '%s', + '%s', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + ) + ); + $recurId = $this->wpdb->insert_id; + $Recurrences->createRecurrenceTimesEntries( $recurId, true, true ); + // location for the event + $hasLocation = ($event['loc'] || $event['place']); + if ( $hasLocation ) { + $locationData = $locationFormat = array(); + $locationData['event'] = $eventId; + $locationFormat[] = '%d'; + if ($event['place']) { + $locationData['name'] = $event['place']; + $locationFormat[] = '%s'; + } + if ($event['loc']) { + $locationData['name'] = $event['loc']; + $locationFormat[] = '%s'; + } + if ($event['address']) { + $locationData['address'] = $event['address']; + $locationFormat[] = '%s'; + } + if ($event['city']) { + $locationData['city'] = $this->getCityId( $event['city'] ); + $locationFormat[] = '%s'; + } + if ($event['state']) { + $locationData['state'] = $event['state']; + $locationFormat[] = '%s'; + } + if ($event['zip']) { + $locationData['zip'] = $event['zip']; + $locationFormat[] = '%s'; + } + if ($event['lat']) { + $locationData['lat'] = $event['lat']; + $locationFormat[] = '%s'; + } + if ($event['lon']) { + $locationData['lon'] = $event['lon']; + $locationFormat[] = '%s'; + } + $this->wpdb->insert( + GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'locations', + $locationData, + $locationFormat + ); + $locationId = $this->wpdb->insert_id; + if ( !$locationId ) { + echo '
$locationData: ' . print_r($locationData, true) . '
'; + die('no return id for location'); + } + } + } + } catch(PDOException $e) { + echo '
$e: ' . print_r($e, true) . '
'; + die('end here'); + } + return $return; + } + public function importFromTimely() { + $sql = "SELECT * FROM " . $this->wpdb->prefix . "posts WHERE post_type = 'ai1ec_event'"; + $results = $this->wpdb->get_results( $sql, ARRAY_A ); + echo '

Total events: ' . count( $results ) . '

'; + if ( !empty( $results ) ) { + foreach ( $results as $post ) { + // use the posts table data + if ( has_post_thumbnail( $post['ID'] ) ) { + $thumbnail_id = get_post_thumbnail_id( $post['ID'] ); + $thumb_src = wp_get_attachment_image_src( $thumbnail_id, 'large' ); + echo '
$thumbnail: ' . print_r($thumb_src, true) . '
'; + var_dump( $thumb_src[0] ); + } + } + } + } } ?> diff --git a/models/front/events/baseAction.php b/models/front/events/baseAction.php index 9e77a85..1beb214 100644 --- a/models/front/events/baseAction.php +++ b/models/front/events/baseAction.php @@ -14,259 +14,254 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEventCategories.p /** * GlmMembersFront_events_list * - * @uses GlmDataEvents + * @uses GlmDataEvents * @package GlmMemberEvents * @version 0.0.1 * @copyright Copyright (c) 2010 All rights reserved. - * @author Steve Sutton + * @author Steve Sutton * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} */ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents { - public $wpdb; - public $config; + public $wpdb; + public $config; - /** - * __construct - * - * @param mixed $wpdb The main Word Press DB Object - * @param mixed $config The main Config - * - * @access public - * @return void - */ - public function __construct($wpdb, $config) - { - $this->wpdb = $wpdb; - $this->config = $config; + /** + * __construct + * + * @param mixed $wpdb The main Word Press DB Object + * @param mixed $config The main Config + * + * @access public + * @return void + */ + public function __construct( $wpdb, $config ) { + $this->wpdb = $wpdb; + $this->config = $config; - parent::__construct(false, false); - } + parent::__construct( false, false ); + } - public function printEvents() - { - echo 'hello'; - //include '/var/www/localhost/htdocs/pdfTest/index.php'; - } + public function printEvents() { + echo 'hello'; + //include '/var/www/localhost/htdocs/pdfTest/index.php'; + } - /** - * getCategories - * - * Grab all of the categories for the events - * - * @access public - * @return array categories - */ - public function getCategories() - { - $categoryData = new GlmDataEventsCategories( $this->wpdb, $this->config ); - return $categoryData->getCategoriesWithCurrentEvents(); - } + /** + * getCategories + * + * Grab all of the categories for the events + * + * @access public + * @return array categories + */ + public function getCategories() { + $categoryData = new GlmDataEventsCategories( $this->wpdb, $this->config ); + return $categoryData->getCategoriesWithCurrentEvents(); + } - /** - * getModelEventsData - * - * Return the array of events. - * - * @param integer $categoryId Id of the category for filtering events (optional) - * @param integer $limit Number of events to return (optional) - * @param integer $memberID Member ID if filtering by member - * - * @access public - * @return array events - */ - public function getModelEventsData($categoryId = null, $limit = null, $memberId = null) - { + /** + * getModelEventsData + * + * Return the array of events. + * + * @param integer $categoryId Id of the category for filtering events (optional) + * @param integer $limit Number of events to return (optional) + * @param integer $memberID Member ID if filtering by member + * + * @access public + * @return array events + */ + public function getModelEventsData($categoryId = null, $limit = null, $memberId = null) { - $this->postAddTimes = true; - $where = ''; + $this->postAddTimes = true; + $where = ''; - if ($memberId = filter_var( $memberId, FILTER_VALIDATE_INT )) { - $where .= "T.ref_type = ".$this->config['ref_type_numb']['Member']." and T.ref_dest = $memberId AND "; - } + if ($memberId = filter_var( $memberId, FILTER_VALIDATE_INT ) ) { + $where .= "T.ref_type = ".$this->config['ref_type_numb']['Member']." and T.ref_dest = $memberId AND "; + } - // If a catgegory ID is supplied - if ($catId = filter_var( $categoryId, FILTER_VALIDATE_INT )) { - $events = $this->getEventsByCategory( $catId, $limit ); + // If a catgegory ID is supplied + if ($catId = filter_var( $categoryId, FILTER_VALIDATE_INT ) ) { + $events = $this->getEventsByCategory( $catId, $limit ); - // Else if a category name is supplied - } else if ($term = filter_var( $categoryId, FILTER_SANITIZE_STRING )) { - $searchTerm = $this->wpdb->esc_like( $term ); - $where .= "T.name like '%" . $searchTerm . "%' - AND T.status = " . $this->config['status_numb']['Active'] . " - AND T.id IN ( - SELECT event - FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET - WHERE active - AND " . $this->dateRange . " - ) - "; - $order = "T.id"; - $order .= " LIMIT 2 OFFSET 0"; - $events = $this->getList($where, $order); + // Else if a category name is supplied + } else if ($term = filter_var( $categoryId, FILTER_SANITIZE_STRING ) ) { + $searchTerm = $this->wpdb->esc_like( $term ); + $where .= "T.name like '%" . $searchTerm . "%' + AND T.status = " . $this->config['status_numb']['Active'] . " + AND T.id IN ( + SELECT event + FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET + WHERE active + AND " . $this->dateRange . " + ) + "; + $order = "T.id"; + $order .= " LIMIT 2 OFFSET 0"; + $events = $this->getList($where, $order); - // Otherwise get all categories - } else { + // Otherwise get all categories + } else { - $where .= "T.status = " . $this->config['status_numb']['Active'] . " - AND T.id IN ( - SELECT event - FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET - WHERE active - AND " . $this->dateRange . " - ) - "; - $events = $this->getList($where); - } + $where .= "T.status = " . $this->config['status_numb']['Active'] . " + AND T.id IN ( + SELECT event + FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET + WHERE active + AND " . $this->dateRange . " + ) + "; + $events = $this->getList($where); + } - //echo '
$events: ' . print_r($events, true) . '
'; - if ( !empty($events) ) { - foreach ( $events as &$event ) { - // grab the first from times and see if it's ongoing or not - if ($event['times']) { - reset($event['times']); - $firstKey = key($event['times']); - reset($event['times']); - } - $event['dates'] = $this->getEventDate( - strtotime($event['starting_date']), - strtotime($event['ending_date']), - 'timestamp' - ); - } - } - $this->postAddTimes = false; - return $events; - } + //echo '
$events: ' . print_r($events, true) . '
'; + if ( !empty($events) ) { + foreach ( $events as &$event ) { + // grab the first from times and see if it's ongoing or not + if ($event['times']) { + reset($event['times']); + $firstKey = key($event['times']); + reset($event['times']); + } + $event['dates'] = $this->getEventDate( + strtotime($event['starting_date']), + strtotime($event['ending_date']), + 'timestamp' + ); + } + } + $this->postAddTimes = false; + return $events; + } - /** - * getModelEventData - * - * Return the event using given eventId - * - * @param mixed $eventId Event Id for the entry - * - * @access public - * @return array The event - */ - public function getModelEventData($eventId) - { - $this->postAddTimes = true; - $this->postAddLocations = true; - $event = $this->getEntry($eventId); - if ( $event['url'] ) { - if ( !preg_match( '/^http:|https:/', $event['url'] ) ) { - $event['url'] = 'http://' . $event['url']; - } - } - $event['dates'] = $this->getEventDate( - strtotime($event['starting_date']), - strtotime($event['ending_date']), - 'timestamp' - ); - $this->postAddTimes = false; - $this->postAddLocations = false; - return $event; - } + /** + * getModelEventData + * + * Return the event using given eventId + * + * @param mixed $eventId Event Id for the entry + * + * @access public + * @return array The event + */ + public function getModelEventData($eventId) { + $this->postAddTimes = true; + $this->postAddLocations = true; + $event = $this->getEntry($eventId); + if ( $event['url'] ) { + if ( !preg_match( '/^http:|https:/', $event['url'] ) ) { + $event['url'] = 'http://' . $event['url']; + } + } + $event['dates'] = $this->getEventDate( + strtotime($event['starting_date']), + strtotime($event['ending_date']), + 'timestamp' + ); + $this->postAddTimes = false; + $this->postAddLocations = false; + return $event; + } - /** - * modelAction - * - * @param bool $actionData Action Data passed to the modelAction - * - * @access public - * @return void - */ - abstract public function modelAction($actionData = false); + /** + * modelAction + * + * @param bool $actionData Action Data passed to the modelAction + * + * @access public + * @return void + */ + abstract public function modelAction($actionData = false); - /** - * get_event_date: make the event date human readable - * - * @param string $sdate start date - * @param string $edate end date - * @param string $dateType dateType Postgres,etc - * @param boolean $microFormat use microformating on output - * - * @return string - * @access public - */ - function getEventDate( - $sdate, - $edate, - $dateType, - $microFormat = false - ) { - switch($dateType) { - case "Postgres": - $postgresPattern = "/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/"; - if (preg_match($postgresPattern, $sdate, $spt)) { - $mon = $spt[1]; - $day = $spt[2]; - $yr = $spt[3]; - } + /** + * get_event_date: make the event date human readable + * + * @param string $sdate start date + * @param string $edate end date + * @param string $date_type date_type Postgres,etc + * @param boolean $micro_format use microformating on output + * + * @return string + * @access public + */ + function getEventDate( + $sdate, + $edate, + $date_type, + $micro_format = false + ) { + switch($date_type) { + case "Postgres": + $postgresPattern = "/([0-9]{1,2})[/-]([0-9]{1,2})[/-]([0-9]{4})/"; + if (preg_match( $postgresPattern, $sdate, $spt ) ) { + $mon = $spt[1]; + $day = $spt[2]; + $yr = $spt[3]; + } - if (preg_match($postgresPattern, $edate, $ept)) { - $mon2 = $ept[1]; - $day2 = $ept[2]; - $yr2 = $ept[3]; - } - break; - case "eventstamp": - case "timestamp": - $mon = date("m",$sdate); - $day = date("d",$sdate); - $yr = date("Y",$sdate); - $mon2 = date("m",$edate); - $day2 = date("d",$edate); - $yr2 = date("Y",$edate); - break; - } + if (preg_match( $postgresPattern, $edate, $ept ) ) { + $mon2 = $ept[1]; + $day2 = $ept[2]; + $yr2 = $ept[3]; + } + break; + case "eventstamp": + case "timestamp": + $mon = date( 'm', $sdate ); + $day = date( 'd', $sdate ); + $yr = date( 'Y', $sdate ); + $mon2 = date( 'm', $edate ); + $day2 = date( 'd', $edate ); + $yr2 = date( 'Y', $edate ); + break; + } - $start = mktime(0,0,0,$mon,$day,$yr); - $end = mktime(0,0,0,$mon2,$day2,$yr2); - if ($day == $day2 && $mon == $mon2 && $yr == $yr2) { - $dateparam = "M j, Y"; - $dateBegin = date($dateparam, $start) ; - $dateEnd = ""; - } elseif ($day == $day2 AND $mon == $mon2 AND $yr != $yr2) { - $dateparam1 = "M j, Y -"; - $dateparam2 = "Y"; - $dateBegin = date($dateparam1, $start); - $dateEnd = date($dateparam2, $end); - } elseif ($day != $day2 AND $mon == $mon2 AND $yr == $yr2) { - $dateparam1 = "M j -"; - $dateparam2 = "j, Y"; - $dateBegin = date($dateparam1, $start); - $dateEnd = date($dateparam2, $end); - } elseif ($day != $day2 AND $mon == $mon2 AND $yr != $yr2) { - $dateparam1 = "M j, Y -"; - $dateparam2 = "M j, Y"; - $dateBegin = date($dateparam1, $start); - $dateEnd = date($dateparam2, $end); - } elseif ($yr == $yr2) { - $dateparam1 = "M j -"; - $dateparam2 = "M j, Y"; - $dateBegin = date($dateparam1, $start); - $dateEnd = date($dateparam2, $end); - } else { - $dateparam1 = "M j, Y -"; - $dateparam2 = "M j, Y"; - $dateBegin = date($dateparam1, $start); - $dateEnd = date($dateparam2, $end); - } - if ($microFormat) { - $dateBegin = ' - ' . - $dateBegin . ' - '; - $dateEnd - = ($dateEnd) - ? ' - ' . - $dateEnd . ' - ' - : ''; - } - return $dateBegin." ".$dateEnd; - } + $start = mktime( 0, 0, 0, $mon, $day, $yr ); + $end = mktime( 0, 0, 0, $mon2, $day2, $yr2 ); + if ( $day == $day2 && $mon == $mon2 && $yr == $yr2 ) { + $dateparam = 'M j, Y'; + $date_begin = date( $dateparam, $start ) ; + $date_end = ''; + } elseif ( $day == $day2 AND $mon == $mon2 AND $yr != $yr2 ) { + $dateparam1 = 'M j, Y -'; + $dateparam2 = 'Y'; + $date_begin = date( $dateparam1, $start ); + $date_end = date( $dateparam2, $end ); + } elseif ( $day != $day2 AND $mon == $mon2 AND $yr == $yr2 ) { + $dateparam1 = 'M j -'; + $dateparam2 = 'j, Y'; + $date_begin = date( $dateparam1, $start ); + $date_end = date( $dateparam2, $end ); + } elseif ( $day != $day2 AND $mon == $mon2 AND $yr != $yr2 ) { + $dateparam1 = 'M j, Y -'; + $dateparam2 = 'M j, Y'; + $date_begin = date ($dateparam1, $start ); + $date_end = date( $dateparam2, $end ); + } elseif ( $yr == $yr2 ) { + $dateparam1 = 'M j -'; + $dateparam2 = 'M j, Y'; + $date_begin = date( $dateparam1, $start ); + $date_end = date( $dateparam2, $end ); + } else { + $dateparam1 = 'M j, Y -'; + $dateparam2 = 'M j, Y'; + $date_begin = date( $dateparam1, $start ); + $date_end = date( $dateparam2, $end ); + } + if ($micro_format) { + $date_begin = ' + ' . + $date_begin . ' + '; + $date_end + = ($date_end) + ? ' + ' . + $date_end . ' + ' + : ''; + } + return $date_begin . ' ' . $date_end; + } } diff --git a/views/admin/management/events.html b/views/admin/management/events.html index f51585b..f421901 100644 --- a/views/admin/management/events.html +++ b/views/admin/management/events.html @@ -1,181 +1,211 @@ {include file='admin/management/header.html'} - - - - - - - - - - - -
- {if $settingsUpdated}

Settings Updated

{/if} - {if $settingsUpdateError}Settings Update Error{/if} -

Management Settings

-
-
- - - - - - - - - - - - - - - - -
Event Detail Page Permalink Name: - - {if $eventsSettings.fieldFail.canonical_event_page}

{$eventsSettings.fieldFail.canonical_event_page}

{/if} -
Logo for Event PDF: - {if $eventsSettings.fieldData.pdf_logo} -
- Delete PDF Logo

- {$eventsSettings.fieldData.pdf_logo}
- {/if} - -
Use 800 x 114 px For the PDF logo size
- {if $eventsSettings.fieldFail.pdf_logo}

{$eventsSettings.fieldFail.pdf_logo}

{/if} -
Footer text for PDF (no html, or the PDF will break) - - {if $eventsSettings.fieldFail.footer_text}

{$eventsSettings.fieldFail.footer_text}

{/if} -
- -
-
- - - - + + + + +
+ + + + + + +
+ {if $settingsUpdated}

Settings Updated

{/if} + {if $settingsUpdateError}Settings Update Error{/if} +

Management Settings

+
+
+ + + + + + + + + + + + + + + + +
Event Detail Page Permalink Name: + + {if $eventsSettings.fieldFail.canonical_event_page}

{$eventsSettings.fieldFail.canonical_event_page}

{/if} +
Logo for Event PDF: + {if $eventsSettings.fieldData.pdf_logo} +
+ Delete PDF Logo

+ {$eventsSettings.fieldData.pdf_logo}
+ {/if} + +
Use 800 x 114 px For the PDF logo size
+ {if $eventsSettings.fieldFail.pdf_logo}

{$eventsSettings.fieldFail.pdf_logo}

{/if} +
Footer text for PDF (no html, or the PDF will break) + + {if $eventsSettings.fieldFail.footer_text}

{$eventsSettings.fieldFail.footer_text}

{/if} +
+ +
+
+ + + + {if $testResult} - - - - + + + + {else} - - - + + + {/if} -
Return to Test List
- {$testResult} -
Return to Test List
+ {$testResult} +
- -
+ +
+ - - - + + +
{if $importResult} - - - - + + + + {else} - - + + + + - - - - + + + + + + + + + {/if} +
Return to Import Events
- {$importResult} -
Return to Import Events
+ {$importResult} +
-
- - - - -
-
- Database to import from: - - - - - - - - -
-
-
-
- Settings: - - - - - - - - -
+

Import from Gaslight Events

+ + + + + +
+
+ Database to import from: + + + + + + + + +
+
+
+
+ Settings: + + + + + + + + +
- -
- -
-
- - - -
-
- Image Style Owner: - - -
- - -
-
-
+
+ + + +
+
+ Image Style Owner: + + +
+ +
+
+
+ + {if $importResult} + + + + + {else} + + + + + + {/if} -
Return to Time.ly Import
+ {$importResult} +

Import Time.ly Events

+
+ + + + +
+ +
+
+
- - + // Flash certain elements for a short time after display + $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500); + + }); + -- 2.17.1