示例#1
0
 public function fetch()
 {
     global $db;
     $sql = 'SELECT es.id, es.message, es.start, es.duration, es.icon FROM event_schedule es WHERE es.event = :event ORDER BY start';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':event', $this->eventId, Database::PARAM_INT);
     $stmt->execute();
     $ret = array();
     foreach ($stmt->fetchAll() as $scheduleItem) {
         $scheduleItem['actions'] = array();
         if (Session::hasPriv('SCHEDULE_CHANGE')) {
             $scheduleItem['actions'][] = '<a href = "?action=delete&amp;schId=' . $scheduleItem['id'] . '&amp;id=' . $this->eventId . '">Delete</a>';
         }
         $scheduleItem['actions'] = implode(', ', $scheduleItem['actions']);
         $scheduleItem['start'] = formatDtString($scheduleItem['start']);
         if (!empty($scheduleItem['icon'])) {
             $scheduleItem['iconUrl'] = 'resources/images/icons/games/' . $scheduleItem['icon'];
         } else {
             $scheduleItem['iconUrl'] = null;
         }
         $ret[] = $scheduleItem;
     }
     return $ret;
 }
示例#2
0
 public static function getAllUpcommingEvents()
 {
     global $db;
     $sql = 'SELECT e.id, e.published, e.name, e.date, e.duration, v.name "venue" FROM events e, venues v WHERE e.venue = v.id AND date > curdate() ORDER BY date ASC ';
     $result = $db->query($sql);
     $result = $result->fetchAll();
     foreach ($result as $k => $event) {
         // Calculate event ending time.
         $finish = date_create($event['date']);
         $finish->modify('+' . $event['duration'] . ' hours');
         $result[$k]['date'] = formatDtString($result[$k]['date']);
         $result[$k]['finish'] = formatDt($finish);
     }
     return $result;
 }
示例#3
0
function formatDtIso($date)
{
    $isoStandard = 'Y-m-d H:i';
    if (is_string($date)) {
        return formatDtString($date, $isoStandard);
    } else {
        return formatDt($date, $isoStandard);
    }
}