+++ /dev/null
-<?php
-require_once '../../setup.phtml';
-require_once 'event_setup.inc';
-$dbh = Toolkit_Database::getInstance();
-
-$pageUrl
- = MEDIA_BASE_URL . 'admin/Events/editEvent.php';
-$params = array();
-if ($_GET['archived']) {
- $params[] = 'archived=' . $_GET['archived'];
-}
-if ($_GET['pending']) {
- $params[] = 'pending=' . $_GET['pending'];
-}
-if ($_GET['start']) {
- $params[] = 'start=' . $_GET['start'];
-}
-if ($_GET['Query']) {
- $params[] = 'Query=' . urlencode($_GET['Query']);
-}
-if ($_GET['date_search_to']) {
- $params[] = 'date_search_to=' . $_GET['date_search_to'];
-}
-if ($_GET['date_search_from']) {
- $params[] = 'date_search_from=' . $_GET['date_search_from'];
-}
-if (!empty($params)) {
- $pageUrl
- .= '?'
- . implode('&', $params);
-}
-$form = new Toolkit_Events_Forms_Admin_EditEvent(
- $dbh,
- 'edit_event',
- 'post',
- $pageUrl
-);
-
-$form->configureForm($dbh);
-$formOut = $form->toHtml($dbh);
-echo GLM_TOOLBOX::top('Edit Event', '');
-echo event_nav($lnav);
-echo $formOut;
-echo GLM_TOOLBOX::footer();
+++ /dev/null
-<?php
-require_once '../../setup.phtml';
-require_once 'event_setup.inc';
-$dbh = Toolkit_Database::getInstance();
-
-$config = new Config;
-$root =& $config->parseConfig(
- BASE . 'Toolkit/Toolbox/config.ini',
- 'IniFile'
-);
-
-$form = new Toolkit_Events_Forms_Admin_EditTopics(
- $dbh,
- 'edit_event',
- 'post',
- MEDIA_BASE_URL . "admin/Events/editTopics.php"
-);
-
-$formOut = $form->toHtml($dbh);
-echo GLM_TOOLBOX::top('Edit Categories', '');
-echo event_nav($lnav);
-echo $formOut;
-echo GLM_TOOLBOX::footer();
+++ /dev/null
-/* temp*/
-body {padding-left: 50px;}
-.clearer {
- height:1px;
- overflow:hidden;
- margin-top:-1px;
- clear:left;
-}
-h1 {font-family: arial, helvetica, sans-serif; font-size: 18px; color: #777;}
-/* end temp */
-
-/* MAIN PAGE PROPERTIES */
-#topic-list,
-#event-list,
-#event-edit {font-family: arial, helvetica, sans-serif; padding: 20px;font-size: 12px; }
-#topic-list {width: 400px;}
-/*The Row*/
-.topic-row {clear: left;margin: 3px 0; padding: 3px; background-color: #eee; border: 1px solid #ddd; font-size: 12px;}
-.topic-row table {width: 100%;}
-
-/*The Color Picker Square*/
-.colorsquare {height: 18px; width: 18px; border: 1px solid #333; cursor: pointer;}
-/*Name, Edit, Delete*/
-.topic-name { margin: 3px 0 0 6px; font-size: 12px;}
-.topic-name input {width: 200px; }
-.topic-save { margin-left: 5px;}
-.topic-delete { margin-left: 5px;}
-/*Palette ID\'s*/
-/* The Color Palette*/
-.colorbox {top: -21px; left:-100px; clear: left;}
-.colorbox table {width: auto;}
-.colorbox table{
- border: 1px solid #333;
- border-collapse: collapse;
-}
-.colorbox table td {
- border: 1px solid #333;
- border-collapse: collapse;
- height: 19px;
- width: 19px;
- cursor: pointer;
- padding: 0;
-}
-.color1 {background-color: #FFCCCC;}
-.color2 {background-color: #CC9999;}
-.color3 {background-color: #FF9999;}
-.color4 {background-color: #FFCCFF;}
-.color5 {background-color: #CC99CC;}
-
-.color6 {background-color: #FF99FF;}
-.color7 {background-color: #CCCCFF;}
-.color8 {background-color: #9999CC;}
-.color9 {background-color: #9999FF;}
-.color10 {background-color: #CCFFFF;}
-
-.color11 {background-color: #99CCCC;}
-.color12 {background-color: #99FFFF;}
-.color13 {background-color: #CCFFCC;}
-.color14 {background-color: #99CC99;}
-.color15 {background-color: #99FF99;}
-
-.color16 {background-color: #FFFFCC;}
-.color17 {background-color: #CCCC99;}
-.color18 {background-color: #FFFF99;}
-.color19 {background-color: #FFCC99;}
-.color20 {background-color: #FF99CC;}
-
-.color21 {background-color: #CC99FF;}
-.color22 {background-color: #99CCFF;}
-.color23 {background-color: #99FFCC;}
-.color24 {background-color: #CCFF99;}
-.color25 {background-color: #CCCCCC;}
-
-/* events admin */
-ul.event_nav
-{
-margin: 0;
-padding: 0 0 20px 0px;
-border-bottom: 1px solid #000;
-font-family: arial, helvetica, sans-serif;
-margin-bottom: 20px;
-font-size: 12px;}
-
-ul.event_nav, ul.event_nav li
-{
-margin: 0;
-padding: 0;
-display: inline;
-list-style-type: none;
-}
-
-ul.event_nav a:link, ul.event_nav a:visited {
-float: left;
-line-height: 12px;
-font-weight: bold;
-margin: 0 10px 4px 10px;
-text-decoration: none;
-color: #999;
-border-bottom: 2px solid #999;}
-
-ul.event_nav a:hover { border-bottom: 2px solid #000; color: #000; }
-
-/* event-list-table */
-#event-list-table {
- clear:left;
- font-family: arial, helvetica, sans-serif;
- border: 2px solid #ccc;
- border-collapse: collapse;
- font-size: 12px;
- }
-#event-list-table td {
- border: 2px solid #ccc;
- border-collapse: collapse;
- background: #eee;
- padding: 4px;}
-#event-list-table img {border: 0; text-align: center; margin: 0 auto; display: block;}
-#event-list-table a:link {color: #666;}
-#event-list-table a:visited {color: #666;}
-#event-list-table a:active {color: #666;}
-#event-list-table a:hover {color: #000;}
-
-/*event-edit-table */
-#event-edit-table {
- clear:left;
- font-family: arial, helvetica, sans-serif;
- border: 2px solid #ccc;
- border-collapse: collapse;
- font-size: 12px;
- }
-#event-edit-table td {
- border: 2px solid #ccc;
- border-collapse: collapse;
- background: #eee; padding: 4px;}
-#event-edit-table table td {border:none;margin:0;padding:0;}
-#event-edit-table td select,
-#event-edit-table td option,
-#event-edit-table td input {font-size: 8pt;}
-
-#event-list-table td select,
-#event-list-table td option,
-#event-list-table td input {font-size:8pt;}
-
+++ /dev/null
-function grabcolor( letter, newcolor )
-{
- document.getElementById('square'+letter).style.backgroundColor= newcolor;
- document.getElementById('colorbox-'+letter).style.display = 'none';
- document.getElementById('topiccolor'+letter).value = newcolor;
-}
-function myDelete( myForm )
-{
- myForm.Action.value = 'Delete Topic';
- myForm.submit();
-}
+++ /dev/null
-<?php
-extract($_REQUEST);
-/**
- * About the $fields array
- * Please only add the req part if you want javascript written for it
- * Notice the hide,date,datetime,radio,and cat types aren't req
- * you'll have to right your own javascript for selects :(
- *
- * For the rest req => 1 will require the input of the field
- * and req => 0 will not.
- */
-$topinfo["idfield"] = "id";
-$topinfo["field"] = "descr";
-$topinfo["table"] = "topic";
-$topinfo["sfield"] = "descr";
-
-$fields[] = array('name' => "id", 'title' => "id", 'type' => "hide");
-$fields[] = array('name' => "topicid", 'title' => "Topic", 'type' => "topic", 'info'=>$topinfo,'req' => 0);
-$fields[] = array('name' => "visable", 'title' => "Visible", 'type' => "radio", 'req' => 0);
-$fields[] = array('name' => "bdate", 'title' => "Begin Date", 'type' => "date", 'req' => 1);
-$fields[] = array('name' => "edate", 'title' => "End Date", 'type' => "date", 'req' => 1);
-$fields[] = array('name' => "", 'title' => "All Day Event", 'type' => "alldayevent");
-$fields[] = array('name' => "btime", 'title' => "Begin Time", 'type' => "time", 'req' => 0);
-$fields[] = array('name' => "etime", 'title' => "End Time", 'type' => "time", 'req' => 0);
-$fields[] = array('name' => "reacur", 'title' => "Recurring event", 'type' => "reacur");
-$fields[] = array('name' => "", 'title' => "Recurring Event", 'type' => "recurevent");
-$fields[] = array('name' => "loc", 'title' => "Location", 'type' => "text", 'req' => 0);
-$fields[] = array('name' => "header", 'title' => "Header", 'type' => "text", 'req' => 1);
-$fields[] = array('name' => "descr", 'title' => "Description", 'type' => "desc", 'req' => 0);
-$fields[] = array('name' => "img", 'title' => "Image 1", 'type' => "img", 'req' => 0);
-$fields[] = array('name' => "url", 'title' => "Url", 'type' => "text", 'req' => 0);
-$fields[] = array('name' => "email", 'title' => "Email", 'type' => "text", 'req' => 0);
-$fields[] = array('name' => "contact", 'title' => "Contact", 'type' => "text", 'req' => 0);
-$fields[] = array('name' => "phone", 'title' => "Phone", 'type' => "text", 'req' => 0);
-$fields[] = array('name' => "file", 'title' => "File", 'type' => "file", 'req' => 0);
-$fields[] = array('name' => "filename",'title' => "File Name", 'type' => "text", 'req' => 0);
-// navigation array
-$lnav = array(
- "Edit Categories" => "editTopics.php",
- "Create New Event" => "editEvent.php",
- "List Events" => "list_events.phtml"
-);
-// set the cache option from $GLOBALS
-$cacheOptions = $GLOBALS['cacheOptions'];
-// redo the cachDir
-$cacheOptions['cacheDir'] = BASE . 'cache/';
-// create a new instance of Cache_Lite
-$cache = new Cache_Lite($cacheOptions);
-// Functions for the Events Admin
-/**
- * Function add_topic
- *
- * Add a new topic to database checking first if it is already in topic table.
- *
- * @param string $topicname
- * @return int $id of topic new or old with that name.
- */
-function add_topic($topicname)
-{
- $dbh = Toolkit_Database::getInstance();
- $query = "
- SELECT id
- FROM topic
- WHERE descr = '$topicname'";
- $dres = $dbh->query($query);
- if ($dres->columnCount == 0) {
- $query = "
- INSERT INTO topic
- (descr)
- VALUES
- (:topicname)
- RETURNING id";
- $stmt = $dbh->prepare($query);
- $stmt->bindParam(":topicname", $topicname, PDO::PARAM_STR);
- $stmt->execuce();
- return $stmt->fetchColumn();
- } else {
- return $dres->fetchColumn();
- }
-}
-/**
- * return html for navigation
- *
- * @param string $nav HTML of the event navigation
- *
- * @return string
- */
-function event_nav($nav)
-{
- if (is_array($nav)) {
- $out = '<ul class="admin_nav">';
- foreach ($nav as $link => $url) {
- $out .= '<li><a href="'.$url.'">'.$link.'</a></li>';
- }
- $out .= '</ul>';
- }
- return $out;
-}
-/**
- * return the input string of a date format to remove the year part
- *
- * @param string $date date string in MM/DD/YY format
- *
- * @return string
- */
-function strip_year_part($date)
-{
- $pattern = "/([0-9]*)[\/-]([0-9]*)[\/-]([0-9]*)/";
- if (preg_match($pattern, $date, $temp)) {
- $out = $temp[1].'/'.$temp[2].'/'.substr($temp[3],2,2);
- }
- return $out;
-}
-/**
- * event_top
- *
- * @return string html heaoder for the event admin page.
- */
-function event_top()
-{
- $out = '
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-"http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Untitled</title>
-<meta http-equiv="content-type" content="text/html;charset=utf-8">
-<link rel="stylesheet" type="text/css" href="../main.css">
-<link rel="stylesheet" type="text/css" href="./event.css">
-<script type="text/javascript" src="event.js"></script>
-<script type="text/javascript" src="'.MEDIA_APP_BASE_URL.'libjs/jquery/jquery-1.4.2.min.js"></script>
-<script type="text/javascript" src="'.CKEDITOR_JS.'"></script>
-<script>
-var Events =
-{
- init: function()
- {
- if ($("#descr").length) {
- // Only try to replace the textarea if the
- // CKEditor is compatible w/ the browser.
- if (CKEDITOR.env.isCompatible) {
- CKEDITOR.replace("descr",
- {
- toolbar : "Default",
- width : 570,
- height : 400,
- filebrowserImageBrowseUrl : "../../Toolkit/CKImages/browser.php?folder=1",
- filebrowserImageUploadUrl : "../../Toolkit/CKImages/controller.php?command=Upload",
- filebrowserImageWindowWidth : "760",
- filebrowserImageWindowHeight : "500"
- });
- }
- }
- }
-};
-
-$(document).ready(Events.init);
-</script>
- </head>
-<body>
-';
- return $out;
-}
-/**
- * return html for the footer of the event page
- *
- * @return string
- */
-function event_footer()
-{
- $out = '
- </body>
- </html>
- ';
- return $out;
-}
+++ /dev/null
-CREATE TABLE "event" (
-"id" SERIAL,
-"topicid" int4 DEFAULT 0,
-"bdate" date,
-"edate" date,
-"loc" text,
-"header" text,
-"descr" text,
-"img" text,
-"url" text,
-"contact" text,
-"phone" text,
-"email" text,
-"btime" text,
-"etime" text,
-"visable" bool DEFAULT 'f',
-"home" bool DEFAULT 'f',
-"ds" timestamp,
-"daysow" int,
-"dayom" int,
-"reacur" bool DEFAULT 'f',
-"weekom" text,
-"all_day" bool DEFAULT 'f',
-"file" text,
-"filename" text,
-"member_id" int4);
-
-REVOKE ALL on "event" from PUBLIC;
-
-GRANT ALL on "event" to "nobody";
-
-CREATE TABLE "topic" (
-"id" SERIAL,
-"descr" text,
-"topiccolor" text);
-
-REVOKE ALL on "topic" from PUBLIC;
-
-GRANT ALL on "topic" to "nobody";
-GRANT ALL on "topic_id_seq" to "nobody";
-GRANT ALL on "event_id_seq" to "nobody";
-
-CREATE UNIQUE INDEX event_id_indx on event(id);
-CREATE INDEX event_bdate_indx on event(bdate);
-CREATE INDEX event_edate_indx on event(edate);
-
-CREATE TABLE event_recur
-(id SERIAL,
- event_id INTEGER
- REFERENCES event(id)
- ON DELETE CASCADE,
- event_day DATE);
-
-GRANT ALL ON event_recur TO nobody;
-GRANT ALL ON event_recur_id_seq TO nobody;
+++ /dev/null
-<?php
-require_once '../../setup.phtml';
-class importEvents
-{
- protected $db1h;
- protected $db2h;
- function __construct()// {{{
- {
- // db1h is devsys2 database that data will be imported into
- $this->db1h = Toolkit_Database::getInstance();
- // db2h is ds1 database that we're pulling data from (export)
- try {
- $dsn = 'pgsql:host=ds1.gaslightmedia.com dbname=stignace user=nobody';
- $driverOptions = array(
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
- );
- $this->db2h = new PDO($dsn, null, null, $driverOptions);
- $this->db2h->setAttribute(
- PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION
- );
- } catch (PDOException $e) {
- Toolkit_Common::handleError($e);
- }
- $this->getLiveData();
- $this->importData();
- echo '<pre>'.print_r($this->topicData, true).'</pre>';
- echo '<pre>'.print_r($this->eventData[0], true).'</pre>';
- }// }}}
- function convertEncoding(&$var)// {{{
- {
- return iconv('windows-1251', 'utf-8', $var);
- }// }}}
- function getLiveData()// {{{
- {
- // getting the topics
- try {
- $sql = "
- SELECT *
- FROM topic
- ORDER BY id";
- $intData = $this->db2h->query($sql)->fetchAll();
- if ($intData) {
- $this->topicData =& $intData;
- }
- } catch (PDOException $e) {
- Toolkit_Common::handleError($e);
- }
- // getting the events
- try {
- $sql = "
- SELECT *
- FROM event
- WHERE edate >= current_date
- ORDER BY id";
- $cData = $this->db2h->query($sql)->fetchAll();
- if ($cData) {
- $this->eventData =& $cData;
- }
- } catch (PDOException $e) {
- Toolkit_Common::handleError($e);
- }
- }// }}}
- function importData()// {{{
- {
- // start up transaction
- $this->db1h->beginTransaction();
- // build prepare statement for insert of interest types
- $sql = "
- INSERT INTO topic
- (id,descr)
- VALUES
- (:id,:descr)";
- $topicInsert = $this->db1h->prepare($sql);
- if (is_array($this->topicData)) {
- foreach ($this->topicData as $iRow) {
- try {
- $topicInsert->bindParam(":id", $iRow['id'], PDO::PARAM_INT);
- $topicInsert->bindParam(":descr", $iRow['descr'], PDO::PARAM_STR);
- $topicInsert->execute();
- } catch (PDOException $e) {
- Toolkit_Common::handleError($e);
- }
- }
- }
- // build prepare statement for insert of event
- $sql = "
- INSERT INTO event
- (id,topicid,bdate,edate,loc,header,descr,img,url,contact,phone,email,
- btime,etime,visable,home,ds,daysow,dayom,reacur,weekom)
- VALUES
- (:id,:topicid,:bdate,:edate,:loc,:header,:descr,:img,:url,:contact,:phone,:email,
- :btime,:etime,:visable,:home,:ds,:daysow,:dayom,:reacur,:weekom)";
- $eventInsert = $this->db1h->prepare($sql);
- if (is_array($this->eventData)) {
- foreach ($this->eventData as $cKey => &$cRow) {
- try {
- $eventInsert->bindParam(":id", $cRow['id'], PDO::PARAM_INT);
- $eventInsert->bindParam(":topicid", $cRow['topicid'], PDO::PARAM_INT);
- $eventInsert->bindParam(":bdate", $cRow['bdate'], PDO::PARAM_STR);
- $eventInsert->bindParam(":edate", $cRow['edate'], PDO::PARAM_STR);
- $eventInsert->bindParam(":loc", $this->convertEncoding($cRow['loc']), PDO::PARAM_STR);
- $eventInsert->bindParam(":header", $this->convertEncoding($cRow['header']), PDO::PARAM_STR);
- $eventInsert->bindParam(":descr", $this->convertEncoding($cRow['descr']), PDO::PARAM_STR);
- $eventInsert->bindParam(":img", $this->convertEncoding($cRow['img']), PDO::PARAM_STR);
- $eventInsert->bindParam(":url", $this->convertEncoding($cRow['url']), PDO::PARAM_STR);
- $eventInsert->bindParam(":contact", $this->convertEncoding($cRow['contact']), PDO::PARAM_STR);
- $eventInsert->bindParam(":phone", $this->convertEncoding($cRow['phone']), PDO::PARAM_STR);
- $eventInsert->bindParam(":email", $this->convertEncoding($cRow['email']), PDO::PARAM_STR);
- $eventInsert->bindParam(":btime", $this->convertEncoding($cRow['btime']), PDO::PARAM_STR);
- $eventInsert->bindParam(":etime", $this->convertEncoding($cRow['etime']), PDO::PARAM_STR);
- $visable = ($cRow['visable']) ? 1: 0;
- $eventInsert->bindParam(":visable", $visable, PDO::PARAM_BOOL);
- $home = ($cRow['home']) ? 1: 0;
- $eventInsert->bindParam(":home", $home, PDO::PARAM_BOOL);
- $eventInsert->bindParam(":ds", $cRow['ds'], PDO::PARAM_STR);
- $eventInsert->bindParam(":daysow", $cRow['daysow'], PDO::PARAM_INT);
- $eventInsert->bindParam(":dayom", $cRow['dayom'], PDO::PARAM_INT);
- $reacur = ($cRow['reacur']) ? 1: 0;
- $eventInsert->bindParam(":reacur", $reacur, PDO::PARAM_BOOL);
- $eventInsert->bindParam(":weekom", $this->convertEncoding($cRow['weekom']), PDO::PARAM_STR);
-
- $eventInsert->execute();
- //echo '<p>Importing to event ...</p>';
- } catch (PDOException $e) {
- echo '<pre>';
- var_dump($cRow['zip']);
- var_dump($this->convertEncoding(&$cRow['zip']));
- echo '</pre>';
- echo '<pre>'.print_r($cRow, true).'</pre>';
- Toolkit_Common::handleError($e);
- }
- }
- }
- // end transaction
- //$this->db1h->rollBack();
- echo 'done';
- $this->db1h->commit();
- }// }}}
-}
-$importer = new importEvents();
-?>
+++ /dev/null
-<?header("Location: list_events.phtml")?>
+++ /dev/null
-<?php
-include_once '../../setup.phtml';
-include_once 'event_setup.inc';
-if (!$start) {
- $start = 0;
-}
-$pagelength = 10;
-// days array
-$days[1] = "Sun";
-$days[2] = "Mon";
-$days[4] = "Tue";
-$days[8] = "Wed";
-$days[16] = "Thu";
-$days[32] = "Fri";
-$days[64] = "Sat";
-echo event_top("Events Calendar (List Events)", HELP_BASE."events.phtml?key=list");
-$colspan
- = (defined('HOME_EVENTS') && HOME_EVENTS)
- ? 9
- : 8;
-$dbh = Toolkit_Database::getInstance();
-if ($_REQUEST['Command'] == 'Delete' && is_numeric($_REQUEST['id'])) {
- try {
- $sql = "
- DELETE
- FROM event
- WHERE id = :id";
- $del = $dbh->prepare($sql);
- $del->bindParam(':id', $_REQUEST['id'], PDO::PARAM_INT);
- $del->execute();
- } catch(PDOException $e) {
- die($e->getMessage($e));
- }
-}
-?>
-<script type="text/javascript" src="../wm.js"></script>
-<script type="text/javascript" src="../msg.js"></script>
-<div id="event-list">
-<h1>Manage Events (list)</h1>
-<?php
-if (isset($_REQUEST['home'])) {
- $nh = ($_REQUEST['home']) ? 0: 1;
-
- $qs = "
- UPDATE event
- SET home = :home
- WHERE id = :id";
- $stmt = $dbh->prepare($qs);
- $stmt->bindParam(":home", $nh, PDO::PARAM_BOOL);
- $stmt->bindParam(":id", $id, PDO::PARAM_INT);
- $stmt->execute();
- $cache->clean('HomeEvents');
-}
-
-if (isset($_REQUEST['visable'])) {
- $nv = ($_REQUEST['visable']) ? 0: 1;
-
- $qs = "
- UPDATE event
- SET visable = :visable
- WHERE id = :id";
- $stmt = $dbh->prepare($qs);
- $stmt->bindParam(":visable", $nv, PDO::PARAM_BOOL);
- $stmt->bindParam(":id", $id, PDO::PARAM_INT);
- $stmt->execute();
- $cache->clean('HomeEvents');
-}
-function sortByField(&$params, $var)
-{
- if ($GLOBALS[$var["field"]]) {
- $params[] = $var["field"]."=".$GLOBALS[$var["field"]];
- if ($GLOBALS[$var["field"]] == "D") {
- $GLOBALS["order_by"] = $var["fname"]." ASC";
- $GLOBALS[$var["field"]] = "A";
- $GLOBALS[$var["image"]] = "down";
- } else {
- $GLOBALS["order_by"] = $var["fname"]." DESC";
- $GLOBALS[$var["field"]] = "D";
- $GLOBALS[$var["image"]] = "up";
- }
- } else {
- $GLOBALS[$var["field"]] = "A";
- }
-}
-function addUpdateParams($sort, $params)
-{
- parse_str($params, $parsedParams);
- if ($_GET[$sort['field']]) {
- $pattern = "/&".$sort['field']."=([A-Z]{1,2})/";
- return preg_replace($pattern, '', $params);
- } else {
- $add = '&V=&HM=&T=&B=&E=&D=&C=&H=';
- $pattern = "/&".$sort['field']."=/";
- $add = preg_replace($pattern, '', $add);
- return $params . $add;
- }
-}
-// params to passthrough the urls
-$urlParamArray = array();
-// sorting fields
-$sortField[] = array("field"=>"V", "image"=>"V_img", "fname"=>"event.visable");
-$sortField[] = array("field"=>"HM", "image"=>"HM_img", "fname"=>"event.home");
-$sortField[] = array("field"=>"H", "image"=>"H_img", "fname"=>"event.header");
-$sortField[] = array("field"=>"T", "image"=>"T_img", "fname"=>"event.btime");
-$sortField[] = array("field"=>"B", "image"=>"B_img", "fname"=>"event.bdate");
-$sortField[] = array("field"=>"E", "image"=>"E_img", "fname"=>"event.edate");
-$sortField[] = array("field"=>"D", "image"=>"D_img", "fname"=>"event.daysow");
-$sortField[] = array("field"=>"C", "image"=>"C_img", "fname"=>"topic.descr");
-if (is_array($sortField)) {
- foreach ($sortField as $var) {
- sortByField($urlParamArray, $var);
- }
-}
-
-if (!$order_by) {
- $order_by = "event.bdate ASC,event.btime ASC";
-}
-$order = " ORDER BY $order_by";
-
-$select_part = "event.id,event.bdate,event.edate,event.header,topic.descr as topic,
- event.visable,event.home,event.btime,event.etime,event.daysow,event.all_day";
-$from_part = "event LEFT OUTER JOIN topic ON (topic.id = event.topicid)";
-$where_part = '';
-$Where = 'where';
-$queryInput = filter_input(INPUT_GET, 'Query', FILTER_SANITIZE_STRING);
-if ($queryInput) {
- $where_part = " $Where header ilike '%$Query%'";
- $Where = 'and';
- $urlParamArray[] = 'Query='.urlencode($Query);
-}
-// check to see if the dates are different
-if ($_REQUEST['date_search_from'] && $_REQUEST['date_search_to']) {
- $date_search_to = $_REQUEST['date_search_to'];
- list($to_month, $to_day, $to_year) = explode("/", $date_search_to);
- $date_search_from = $_REQUEST['date_search_from'];
- list($from_month, $from_day, $from_year) = explode("/", $date_search_from);
-} else if ($_GET['to_month'] && $_GET['from_month']) {
- $date_search_to_time = mktime(0, 0, 1, $_GET['to_month'], $_GET['to_day'], $_GET['to_year']);
- $date_search_from_time = mktime(0, 0, 1, $_GET['from_month'], $_GET['from_day'], $_GET['from_year']);
- $date_search_to = date("m/d/Y", $date_search_to_time);
- $date_search_from = date("m/d/Y", $date_search_from_time);
-}
-if ($date_search_to && $date_search_from) {
- $urlParamArray[] = 'date_search_from='.urlencode($date_search_from);
- $urlParamArray[] = 'date_search_to='.urlencode($date_search_to);
- $where_part .= " $Where edate >= '$date_search_from' and bdate <= '$date_search_to'";
- $Where = 'and';
-}
-if ($archived == 't') {
- $urlParamArray[] = 'archived='.$archived;
- $where_part .= " $Where edate < current_date";
- $Where = 'and';
-} elseif ($pending == 't') {
- $urlParamArray[] = 'pending='.$pending;
- $where_part .= " $Where visable = 'f'";
- $Where = 'and';
-} elseif (!isset($_GET['Query']) && !$_REQUEST['date_search_to'] && !$_REQUEST['to_month']) {
- $where_part .= " $Where edate >= current_date";
- $Where = 'and';
-}
-$qs = "select $select_part from $from_part $where_part";
-//echo '<p>'.$qs.$order.'</p>';
-
-$stmt = $dbh->query($qs.$order." LIMIT $pagelength OFFSET $start");
-$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
-$num = count($data);
-$qs1 = "SELECT count(*) as total FROM $from_part $where_part";
-$total = $dbh->query($qs1)->fetchColumn();
-$params
- = (!empty($urlParamArray))
- ? '&'.implode("&", $urlParamArray)
- : '';
-$links = GLM_TOOLBOX::create_page_links($total,$num,$start,$params,$pagelength);
-
-echo event_nav($lnav);
-// from date
-$date_fields1 = GLM_TOOLBOX::date_entry($from_month, $from_day, $from_year,
- 'from_month', 'from_day', 'from_year');
-// to date
-$date_fields2 = GLM_TOOLBOX::date_entry($to_month, $to_day, $to_year,
- 'to_month', 'to_day', 'to_year');
-if ( $archived != 't' ) {
- $archived_link = '<a href="list_events.phtml?archived=t">Archived Events</a>';
-} else {
- $archived_link = '<a href="list_events.phtml">Current Events</a>';
-}
-echo '<table id="event-list-table">';
- ?>
- <tr>
- <td colspan="<?php echo $colspan?>"><?php echo $links?>
- <a href="list_events.phtml?pending=t">Pending Events</a>
- <?php echo $archived_link;?>
- </td>
- </tr>
- <tr>
- <td colspan="<?php echo $colspan?>">
- <form action="list_events.phtml">
- <input type="" name="Query" value="<?php echo htmlspecialchars($queryInput);?>">
- <input type="submit" value="Event Name Search">
- </form>
- </td>
- </tr>
- <tr>
- <td colspan="<?php echo $colspan?>">
- <form action="list_events.phtml">
- <div style="display:inline;">
- From:<?php echo $date_fields1;?>
- </div>
- <div style="display:inline;">
- To:<?php echo $date_fields2;?>
- </div>
- <input type="submit" value="Event Date Search">
- </form>
- </td>
- </tr>
- <?php
-if ($num > 0) {
- $parsedParams = array();
- foreach ($sortField as $sort) {
- $parsedParams[$sort['field']] = addUpdateParams($sort, $params);
- }
- ?>
- <tr>
- <th>Function</th>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?V='.$V.$parsedParams['V']?>">On/Off</a>
- <?php if($V_img) echo '<img src="'.$V_img.'.gif">'?>
- </th>
- <?php if (defined('HOME_EVENTS') && HOME_EVENTS) {?>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?HM='.$HM.$parsedParams['HM']?>">Home.</a>
- <?php if($HM_img) echo '<img src="'.$HM_img.'.gif">'?>
- </th>
- <?php }?>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?H='.$H.$parsedParams['H']?>">Title</a>
- <?php if($H_img) echo '<img src="'.$H_img.'.gif">'?>
- </th>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?C='.$C.$parsedParams['C']?>">Category</a>
- <?php if($C_img) echo '<img src="'.$C_img.'.gif">'?>
- </th>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?T='.$T.$parsedParams['T']?>">Times</a>
- <?if($T_img) echo '<img src="'.$T_img.'.gif">'?>
- </th>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?D='.$D.$parsedParams['D']?>">Days</a>
- <?if($D_img) echo '<img src="'.$D_img.'.gif">'?>
- </th>
- <th>
- <a class="headerlink" href="<?php echo $PHP_SELF.'?B='.$B.$parsedParams['B']?>">Start</a>
- <?if($B_img) echo '<img src="'.$B_img.'.gif">'?>
- </th>
- <th >
- <a class="headerlink" href="<?php echo $PHP_SELF.'?E='.$E.$parsedParams['E']?>">End</a>
- <?if($E_img) echo '<img src="'.$E_img.'.gif">'?>
- </th>
- </tr>
- <tbody>
- <?php
-}
-for ($i = 0; $i < $num; $i++) {
- $row = $data[$i];
- if (!$row['id']) {
- html_error(DB_ERROR_MSG, 1);
- }
-
- $btime = $row["btime"];
- $etime = $row["etime"];
- ?>
- <tr>
- <td >
- <a href="editEvent.php?id=<?php echo $row['id']?>&edit=1&start=<?php echo $start;?><?php echo $params;?>">Edit</a>
- <a href="list_events.phtml?Command=Delete&id=<?php echo $row['id'];?>&start=<?php echo $start;?><?php echo $params;?>" onClick="
- return(confirm('You are about to delete this listing!'));
- ">Delete</a>
- </td>
- <td >
- <a href="<?php echo $PHP_SELF."?visable=$row[visable]&id=$row[id]"?>"><?php
- if($row[visable] == "t") {
- echo "<img src=\"".MEDIA_BASE_URL
- ."images/grnball.gif\" alt=\"On\"></a>";
- } else {
- echo "<img src=\"".MEDIA_BASE_URL
- ."images/redball.gif\" alt=\"Off\"></a>";
- }
-
- ?>
-
- </td>
- <?php if (defined('HOME_EVENTS') && HOME_EVENTS) {?>
- <td>
- <a href="<?php echo $PHP_SELF."?home=$row[home]&id=$row[id]"?>"><?php
- if($row['home'] == "t") {
- echo "<img src=\"".MEDIA_BASE_URL
- ."images/grnball.gif\" alt=\"Don't display on Home Page\"></a>";
- } else {
- echo "<img src=\"".MEDIA_BASE_URL
- ."images/redball.gif\" alt=\"Display on Home Page\"></a>";
- }
- ?>
-</td><?php }?>
- <td><?php echo $row['header']?></td>
- <td><?php echo $row['topic']?></td>
- <td><?php echo (($row['all_day'] == 't')?'All Day':$btime." - ".$etime);?></td>
- <td><?php
- if ($row['daysow']) {
- $ri = 1;
- for ($r=1;$r<8;$r++) {
- if ($row["daysow"]&$ri)
- echo $days[$ri];
- $ri = $ri << 1;
- }
- }
- else
- echo " ";
- ?></td>
- <td><?php echo strip_year_part($row['bdate']);?></td>
- <td><?php echo strip_year_part($row['edate']);?></td>
- </tr>
- <?php
-}
-echo "</tbody></table></div>\n";
-echo event_footer();
-?>
+++ /dev/null
-<?php
-
-require_once '../../setup.phtml';
-
-function ordinalDay($ord, $day, $month, $year)
-{
- $firstOfMonth = mktime(0, 0, 30, $month, 1, $year);
- $lastOfMonth = $firstOfMonth + date("t", $firstOfMonth) * 86400;
- $dayOccurs = 0;
-
- for ($i = $firstOfMonth; $i < $lastOfMonth; $i += 86400) {
- if (date("w", $i) == $day) {
- $dayOccurs++;
- if ($dayOccurs == $ord) {
- $ordDay = $i;
- }
- }
- }
- return $ordDay;
-}
-
-function getEventDates($starttime, $endtime, $recur, $format = 'm/d/Y')
-{
- if (!is_array($recur)) {
- return;
- }
- if ($starttime == $endtime) {
- return;
- }
- if (is_array($recur['dow'])) {
- $daysow = array_sum($recur['dow']);
- } else {
- $daysow = $recur['dow'];
- }
- if ($recur['recur_week'] == 9) {
- $fWeekNum = date("W", $starttime);
- if (date('w', $starttime) == 0) {
- $fWeekNum++;
- }
- $lWeekNum = date("W", $endtime);
- if (date('w', $endtime) == 0) {
- $lWeekNum++;
- }
- for ($fi = $fWeekNum; $fi <= $lWeekNum; $fi = $fi + 2) {
- $eWeeks[] = $fi;
- }
- }
- for ($i = $starttime; $i <= $endtime; $i += 86400) {
- if ($recur['recur_week'] != '') {
- if ($daysow) {
- $ri = 1;
- for ($r = 0; $r < 7; $r++) {
- if ($daysow & $ri) {
- $ord = ordinalDay($recur['recur_week'], $r, date('n', $i), date('Y', $i));
- }
- $ri = $ri << 1;
- }
- } else {
- $ord = null;
- }
- } else {
- $ord = null;
- }
- if ($recur['dom']) {
- if (date("j", $i) == $recur['dom']) {
- $events[] = date($format, $i);
- }
- } elseif ($daysow) {
- $cur_dow = date("w", $i);
- switch ($cur_dow) {
- case 0:
- $cur_dow = 1;
- break;
- case 1:
- $cur_dow = 2;
- break;
- case 2:
- $cur_dow = 4;
- break;
- case 3:
- $cur_dow = 8;
- break;
- case 4:
- $cur_dow = 16;
- break;
- case 5:
- $cur_dow = 32;
- break;
- case 6:
- $cur_dow = 64;
- break;
- }
- if ((int) $cur_dow & $daysow) {
- $cDateWeek = date("W", $i);
- if (date('w', $i) == 0) {
- $cDateWeek++;
- }
- if ($recur['recur_week'] == 9) {
- if (in_array($cDateWeek, $eWeeks)) {
- $events[] = date($format, $i);
- }
- } elseif ($recur['recur_week'] != '') {
- if ($recur['recur_week'] && $i && $ord) {
- $day1 = date('z', $i);
- $day2 = date('z', $ord);
- if ($day1 == $day2) {
- $events[] = date($format, $i);
- }
- }
- } else {
- $events[] = date($format, $i);
- }
- }
- }
- }
- return $events;
-}
-
-$dbh = Toolkit_Database::getInstance();
-$dbh->query(
- "DELETE FROM event_recur"
-);
-$sql = "
-SELECT *
- FROM event
- WHERE edate >= current_date
- AND bdate <= current_date
- AND reacur = true";
-try {
- $stmt = $dbh->query($sql);
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- var_dump($row);
- if ($row['reacur']) {
- $recur['dow'] = $row['daysow'];
- $recur['dom'] = $row['dayom'];
- if ($recur['dow']) {
- $recur['recur_week'] = ($row['weekom'])
- ? $row['weekom']
- : null;
- } else {
- $recur['recur_week'] = null;
- }
- }
- $eventDates = getEventDates(
- strtotime($row['bdate']),
- strtotime($row['edate']),
- $recur
- );
- $fields = array('event_id', 'event_day');
- $eventSql = Toolkit_Common::createSQLInsert(
- 'event_recur',
- $fields
- );
- var_dump($eventDates);
- var_dump($eventSql);
- if (isset($eventDates) && is_array($eventDates)) {
- foreach ($eventDates as $eventDay) {
- $eventValues = array(
- 'event_id' => $row['id'],
- 'event_day' => $eventDay
- );
- $stmt2 = Toolkit_Common::prepareQuery(
- $dbh,
- 'event_recur',
- $eventSql,
- $eventValues
- );
- $stmt2->execute();
- }
- }
- }
-} catch (PDOException $e) {
- Toolkit_Common::handleError($e);
-}
-
+++ /dev/null
-<?php
-require_once '../../setup.phtml';
-$dbh = Toolkit_Database::getInstance();
-switch ($Action) {
-case "Add Topic":
- $query = "
- SELECT id
- FROM topic
- WHERE descr = '$topic';";
- if (!$data = $dbh->query($query)->fetchAll(PDO::FETCH_ASSOC)) {
- $query = "
- INSERT INTO topic
- (descr)
- VALUES
- ('$topic');";
- $dbh->query($query);
- }
- break;
-
-case "Delete Topic":
- $query = "
- DELETE FROM topic
- WHERE id = ".$_POST['id'];
- $dbh->query($query);
- break;
-
-case "Update Topic":
- $query = "
- UPDATE topic
- SET topiccolor = '".$_POST['topiccolor']."',
- descr = '".$_POST['descr']."'
- WHERE id = ".$_POST['id'].";";
- $dbh->query($query);
- break;
-
-}
-header('Location: edit_topic.phtml');
-?>
\ No newline at end of file