public function renderSidebar()
 {
     if ($this->shouldNotDisplay()) {
         return;
     }
     startbox();
     $event = Events::nextEvent();
     if ($event['seatingPlan']) {
         echo '<p>The seating plan is now live! Pay, then choose your seat!</p><div style = "text-align: center">';
         echo '<a href = "seatingplan.php?event=' . $event['id'] . '"><img src = "resources/images/seatingPlan.png" alt = "seating plan" /></a></div>';
     }
     if (empty($event)) {
         echo '<p>No events planned!</p>';
     } else {
         $diff = strtotime($event['dateIso']) - time();
         $days = $diff /= 86400;
         $days = floor($days);
         echo '<p><a href = "viewEvent.php?id=' . $event['id'] . '">' . $event['name'] . '</a> starts in <strong>' . $days . '</strong> ' . Inflector::quantify('day', $days) . '.  </p>';
     }
     stopbox('Countdown!');
 }
示例#2
0
 public static function nextEvent()
 {
     global $db;
     $sql = 'SELECT e.id, e.name, e.date, e.duration, v.name as venue, e.seatingPlan FROM events e, venues v WHERE date_add(e.date, INTERVAL 24 HOUR) > now() AND e.venue = v.id AND e.published = 1 ORDER BY date ASC LIMIT 1';
     $result = $db->query($sql);
     if ($result->numRows() == 0) {
         return null;
     } else {
         $nextEvent = $result->fetchRow();
         $nextEvent['endDate'] = date_create($nextEvent['date']);
         $nextEvent['endDate']->modify('+' . $nextEvent['duration'] . ' hours');
         $nextEvent['endDate'] = formatDt($nextEvent['endDate']);
         $nextEvent['dateIso'] = formatDtIso($nextEvent['date']);
         $nextEvent['dateUser'] = formatDtString($nextEvent['date']);
         $nextEvent['date'] = formatDtString($nextEvent['date']);
         // deprecated
         $diff = strtotime($nextEvent['dateIso']) - time();
         $diff /= 86400;
         $diff = floor($diff);
         $nextEvent['countDays'] = $diff;
         $nextEvent['stringDays'] = Inflector::quantify('day', $nextEvent['countDays']);
         return $nextEvent;
     }
 }
示例#3
0
/**
 * FIXME Some scientists say, this function is shit. Rewrite me to to be less
 * shit please.
 */
function breadcrumbs()
{
    $crumbs = func_get_args();
    $countCrumbs = count($crumbs);
    $crumbs2 = array();
    $texts = array_values($crumbs);
    $links = array_keys($crumbs);
    for ($i = 0; $i < $countCrumbs; $i++) {
        if (is_numeric($links[$i])) {
            $links[$i] = $texts[$i];
        }
        if (strpos($texts[$i], '.php')) {
            $texts[$i] = str_replace('.php', null, $texts[$i]);
            $texts[$i] = Inflector::humanize($texts[$i]);
            if (isset($links[$i + 1])) {
                $crumbs2[$links[$i]] = '<a href = "' . $links[$i] . '">' . $texts[$i] . '</a>';
            } else {
                $crumbs2[$links[$i]] = $texts[$i];
            }
        } else {
            $crumbs2[$links[$i]] = $texts[$i];
        }
    }
    return implode(' &raquo; ', $crumbs2);
}