";
print_r($str);
print "";
}
function printStyle() {
?>
}
function printSctipt() {
global $gmt_offset_id;
?>
}
function getEvent2($db) {
?>
$sql = "SELECT et.eventid as 'et_eventid', e.name as 'e_name', et.eventdate as'et_eventdate', et.eventtime as 'et_eventtime' FROM eventtime et left join event e on e.id = et.eventid";
$db->open($sql);
$index = -1;
while($row = $db->row()) {
$index++;
?>
= $row['et_eventid'] ?>
= $row['e_name'] ?>
= $row['et_eventdate'] ?>
= $row['et_eventtime'] ?>
}
?>
}
function printSchedule() {
global $gmt_offset_id, $gmt_offset, $db, $db2;
?>
printSctipt();
?>
printStyle();
?>
Make sure you adjust the Time Zone for Your Time Zone
}
// returns time stamp
function makeMyDay($dayname, $time) {
list($hour, $min, $sec) = explode(":", $time);
return strtotime($dayname) + ($hour*60*60) + ($min*60);
}
// gets all the events to an array
function getEvents($db, $timezone=2) {
global $gmt_offset;
$events = array();
$i = -1;
while($row = $db->row()) {
$i++;
$dbDay = $row['day'];
$dbHour = $row['hour'];
$newDate = date("Y-m-d H:i:s", TZConvert(makeMyDay($dbDay, $row['time']), 2, $gmt_offset));
preg_match("/(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/", $newDate, $splitted);
list($all,$year,$month,$day,$hour,$min,$sec) = $splitted;
$hour = (int)$hour;
$dayname = calculateDayOffset("$year-$month-$day $hour:$min", $gmt_offset);
$events[$dayname][$hour][$i]['id'] = $row['id'];
$events[$dayname][$hour][$i]['name'] = $row['name'];
$events[$dayname][$hour][$i]['date'] = "$year-$month-$day";
$events[$dayname][$hour][$i]['time'] = "$hour:$min";
$events[$dayname][$hour][$i]['day'] = $dayname;
$events[$dayname][$hour][$i]['hour'] = $hour;
}
return $events;
}
// pics all events for certgain hour
function getEvent($events, $day, $hour) {
$days = array(
1 => "Sunday",
2 => "Monday",
3 => "Tuesday",
4 => "Wednesday",
5 => "Thursday",
6 => "Friday",
7 => "Saturday"
);
// $day 4 = wed
// $hour 10 = 10:00
$event = "";
if(isset($events[$days[$day]][$hour])) {
$event = $events[$days[$day]][$hour];
}
return $event;
}
function calculateDayOffset($mysqlDate, $gmt_offset) {
global $db2;
$days = array(
1 => "Sunday",
2 => "Monday",
3 => "Tuesday",
4 => "Wednesday",
5 => "Thursday",
6 => "Friday",
7 => "Saturday"
);
//$sql = "SELECT DATE_FORMAT('" . date('Y-m-d H:i:s', TZConvert(strtotime($mysqlDate), 2, $gmt_offset)) . "', '%W') as 'daynum'";
$sql = "SELECT DATE_FORMAT('" . date('Y-m-d H:i:s', strtotime($mysqlDate)) . "', '%W') as 'daynum'";
//prent($sql);
$db2->open($sql);
$row = $db2->row();
return $row['daynum'];
}
function connect() {
global $config;
$db = new DBTable($config);
$db->ReadXMLConfig($config['config_file']);
$samlogin = $db->login;
$db->connect();
return $db;
}
function TZConvert($fromTimeStamp, $fromOffset, $toOffset) {
$newtt = null;
$dir = null;
$hour = 60 * 60;
$from = $fromOffset * $hour;
$to = $toOffset * $hour;
$fromtt = $fromTimeStamp;
if($from < $to) {
$newtt = $fromtt + ($to - $from);
} else if($from > $to) {
$newtt = $fromtt + ($to - $from);
} else {
$newtt = $fromtt;
}
return $newtt;
}
print("Server time: " . date('l dS \of F Y h:i:s A') . " ");
function getTimezoneList() {
?>
(GMT-12:00) International Date Line West
(GMT-11:00) Midway Island Samoa
(GMT-10:00) Hawaii
(GMT-09:00) Alaska
(GMT-08:00) Pacific Time (US & Canada); Tijuana
(GMT-07:00) Arizona
(GMT-07:00) Chihuahua, La Paz, Mazatlan
(GMT-07:00) Mountain Time (US & Canada)
(GMT-06:00) Central America
(GMT-06:00) Central Time (US & Canada)
(GMT-06:00) Guadalajara, Mexico City, Monterrey
(GMT-06:00) Saskatchewan
(GMT-05:00) Bogota, Lime, Quito
(GMT-05:00) Eastern Time (US & Canada)
(GMT-05:00) Indiana (East)
(GMT-04:00) Atlantic Time (Canada)
(GMT-04:00) Caracas, La Paz
(GMT-04:00) Santiago
(GMT-03:30) Newfoundland
(GMT-03:00) Brasilia
(GMT-03:00) Buenos Aires, Georgetown
(GMT-03:00) Greenland
(GMT-02:00) Mid-Atlantic
(GMT-01:00) Azores
(GMT-01:00) Cape Verde Is.
(GMT) Casablanca, Monrovia
(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
(GMT+01:00) Brussels, Copenhagen, Madrid, Paris
(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb
(GMT+01:00) West Central Africa
(GMT+02:00) Athens, Istanbul, Minsk
(GMT+02:00) Bucharest
(GMT+02:00) Cairo
(GMT+02:00) Harare, Pretoria
(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
(GMT+02:00) Jerusalem
(GMT+03:00) Baghdad
(GMT+03:00) Kuwait, Riyadh
(GMT+03:00) Moscow, St. Petersburg, Volgograd
(GMT+03:00) Nairobi
(GMT+03:30) Tehran
(GMT+04:00) Abu Dhabi, Muscat
(GMT+04:00) Baku, Tbilisi, Yerevan
(GMT+04:30) Kabul
(GMT+05:00) Ekaterinburg
(GMT+05:00) Islamabad, Karachi, Tashkent
(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
(GMT+05:45) Kathmandu
(GMT+06:00) Almaty, Novosibirsk
(GMT+06:00) Astana, Dhaka
(GMT+06:00) Sri Jayawardenepura
(GMT+06:30) Rangoon
(GMT+07:00) Bangkok, Hanoi, Jakarta
(GMT+07:00) Krasnoyarsk
(GMT+08:00) Beijing, Chongging, Hong Kong, Urumgi
(GMT+08:00) Irkutsk, Ulaan Bataar
(GMT+08:00) Kuala Lumpur, Singapore
(GMT+08:00) Perth
(GMT+08:00) Taipei
(GMT+09:00) Osaka, Sapporo, Tokyo
(GMT+09:00) Seoul
(GMT+09:00) Yakutsk
(GMT+09:30) Adelaide
(GMT+09:30) Darwin
(GMT+10:00) Brisbane
(GMT+10:00) Canberra, Melbourne, Sydney
(GMT+10:00) Guam, Port Moresby
(GMT+10:00) Hobart
(GMT+10:00) Vladivostok
(GMT+11:00) Magadan, Solomon Is., New Caledonia
(GMT+12:00) Auckland, Wellington
(GMT+12:00) Figi, Kamchatka, Marshall Is.
(GMT+13:00) Nuku'alofa
}
?>