function process() { $this->template_name = 'pages/slot/day.tpl'; list($year, $month, $day) = preg_split("/[\\/-]/", $_GET['date']); $today = getdate(); $yyyy = is_numeric($year) ? $year : $today['year']; $mm = is_numeric($month) ? $month : $today['mon']; $dd = is_numeric($day) ? $day : $today['mday']; if (!validate_date_input($yyyy, $mm, $dd)) { error_exit('That date is not valid'); } $this->smarty->assign('date', sprintf("%4d/%02d/%02d", $yyyy, $mm, $dd)); $formattedDay = strftime('%A %B %d %Y', mktime(6, 0, 0, $mm, $dd, $yyyy)); $this->title = "Field Availability Report » {$formattedDay}"; $sth = GameSlot::query(array('game_date' => sprintf('%d-%d-%d', $year, $month, $day), '_order' => 'g.game_start, field_code, field_num')); $num_open = 0; $slots = array(); while ($g = $sth->fetch()) { // load game info, if game scheduled if ($g['game_id']) { $g['game'] = Game::load(array('game_id' => $g['game_id'])); } else { $num_open++; } $slots[] = $g; } $this->smarty->assign('slots', $slots); $this->smarty->assign('num_fields', count($slots)); $this->smarty->assign('num_open', $num_open); return true; }
function process() { global $lr_session; $this->title = "{$this->field->fullname} » Bookings"; $this->template_name = 'pages/field/bookings.tpl'; if ($this->field->status != 'open') { error_exit("That field is closed"); } $sth = GameSlot::query(array('fid' => $this->field->fid, '_extra' => 'DATE_SUB(CURDATE(), INTERVAL 1 YEAR) AND DATE_ADD(CURDATE(), INTERVAL 1 YEAR)', '_order' => 'g.game_date, g.game_start')); $slots = array(); while ($slot = $sth->fetchObject('GameSlot')) { if ($slot->game_id) { $slot->game = Game::load(array('game_id' => $slot->game_id)); } $slots[] = $slot; } $this->smarty->assign('slots', $slots); return true; }