private static function convertFeed($eventFeed) { $convertedFeed = array(); foreach ($eventFeed as $event) { preg_match("/full\\/(.*)\$/i", $event->getId()->getText(), $matches); $id = $matches[1]; $when = $event->getWhen(); $startTime = $when[0]->startTime; $endTime = $when[0]->endTime; $date_str = strftime('%A, %B %e, %Y', strtotime($startTime)); $date_str_for_storage = strftime('%D', strtotime($startTime)); $date_str_for_compare = strftime('%Y%m%d', strtotime($startTime)); // Reset the time used in templates since not all events specify a start time $time_of_day = ''; if (!(strlen($startTime) == 10)) { $time_of_day = strftime('%l:%M%P', trim(strtotime($startTime))); if ($endTime != '') { $time_of_day .= " - " . strftime('%l:%M%P', trim(strtotime($endTime))); } } $title = $event->getTitleValue(); $description = $event->getContent()->getText(); // the following getExtraData is specific to WVU's implementation with Google Calendar list($description, $event_link) = getExtraData($description, 'link', true); list($description, $contact_phone) = getExtraData($description, 'contact_phone', false); list($description, $contact_email) = getExtraData($description, 'contact_email', false); list($description, $contact_name) = getExtraData($description, 'contact_name', false); $where = $event->getWhere(); $where = $where[0]->getValueString(); $convertedFeed[] = array('id' => $id, 'title' => $title, 'starttime' => $startTime, 'endtime' => $endTime, 'datefull' => $date_str, 'timefull' => $time_of_day, 'datestorage' => $date_str_for_storage, 'datecompare' => $date_str_for_compare, 'where' => $where, 'description' => $description, 'link' => $event_link, 'contactphone' => $contact_phone, 'contactemail' => $contact_email, 'contactname' => $contact_name); } return $convertedFeed; }
<th>Medals</th> <th>Country</th> <th class="searchTH"> <form class="searchForm" onsubmit="submitForm(event)"> <div class="input-append"> <input type="text" class="span3" id="search" style="margin: 0 auto;" data-provide="typeahead" data-items="8" placeholder="Search"><button id="searchBTN" data-loading-text="Erm..." class="btn"><i class="icon-search"></i></button> </div> </form> </th> </tr> </thead> <tbody> <?php require "include/include.php"; $medals = getMedalData(); $extraData = getExtraData(); foreach (array_keys($medals) as $name) { $medals[$name]["place"] = $extraData[$name][40]; } $medals = arraySortTwoDimByValueKey($medals, 'place', 'asc'); //var_dump($medals); foreach (array_keys($medals) as $name) { $placename = $medals[$name]["name"]; if ($medals[$name]["place"] != NULL) { $fact = $medals[$name]["place"]; } $id = $fact; echo "\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<!--{$name}-->\n\t\t\t\t\t\t\t<td class=\"id\">\n\t\t\t\t\t\t\t\t<a href=\"#\" class=\"btn btn-danger pop\" data-content=\"<a href='#'><h3>Gold</h3></a><a href='#'><h3>Silver</h3></a><a href='#'><h3>Bronze</h3></a>\" data-original-title=\"Select a category\">{$id}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"medals\">\n\t\t\t\t\t\t\t\t<img src=\"medal.php?type=gold&c={$name}\" alt=\"gold-" . strtolower($name) . "\">\n\t\t\t\t\t\t\t\t<img src=\"medal.php?type=silver&c={$name}\" alt=\"silver-" . strtolower($name) . "\"> \n\t\t\t\t\t\t\t\t<img src=\"medal.php?type=bronze&c={$name}\" alt=\"bronze-" . strtolower($name) . "\">\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td colspan=\"2\" class=\"countryName\">{$placename}</td>\n\t\t\t\t\t\t</tr>\n"; } ?> </tbody>
try { $url = 'http://www.google.com/calendar/feeds/' . $calendars[$_REQUEST['cal']]['user'] . '/private/full/_' . $_REQUEST['id']; $event = $gdataCal->getCalendarEventEntry($url); } catch (Exception $e) { $error = true; } if ($error == true) { // need to create an error handler class echo "<div class='error'>Error for details" . $url . "</div>" . $e; exit; } else { $when = $event->getWhen(); $startTime = $when[0]->startTime; $endTime = $when[0]->endTime; $date_str = strftime('%A, %B %e, %Y', strtotime($startTime)); $date_str_for_storage = strftime('%D', strtotime($startTime)); $date_str_for_compare = strftime('%Y%m%d', strtotime($startTime)); if (!(strlen($startTime) == 10)) { $time_of_day = strftime('%l:%M%P', strtotime($startTime)); if ($endTime != '') { $time_of_day .= "-" . strftime('%l:%M%P', strtotime($endTime)); } } $description = $event->getContent()->text; list($description, $event_link) = getExtraData($description, 'link', true); list($description, $contact_phone) = getExtraData($description, 'contact_phone', false); list($description, $contact_email) = getExtraData($description, 'contact_email', false); list($description, $contact_name) = getExtraData($description, 'contact_name', false); } require "templates/{$prefix}/detail.html"; $page->output();