function calendar_user_year() { $data = xarMod::apiFunc('calendar', 'user', 'getUserDateTimeInfo'); $Year = new Calendar_Year($data['cal_year']); $Year->build(); // TODO: find a better way to handle this $data['Year'] =& $Year; $data['cal_sdow'] = CALENDAR_FIRST_DAY_OF_WEEK; return $data; }
$Minute = new Calendar_Minute($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i']); $Second = new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']); ?> <p><b>Set the alarm clock</p></p> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> Year: <input type="text" name="y" value="<?php echo $_POST['y']; ?> " size="4"> Month:<select name="m"> <?php $selection = array($Month); $Year->build($selection); while ($Child =& $Year->fetch()) { if ($Child->isSelected()) { echo "<option value=\"" . $Child->thisMonth() . "\" selected>" . $Child->thisMonth() . "\n"; } else { echo "<option value=\"" . $Child->thisMonth() . "\">" . $Child->thisMonth() . "\n"; } } ?> </select> Day:<select name="d"> <?php $selection = array($Day); $Month->build($selection); while ($Child =& $Month->fetch()) { if ($Child->isSelected()) {
$start = getmicrotime(); if (!@(include 'Calendar/Calendar.php')) { define('CALENDAR_ROOT', '../../'); } require_once CALENDAR_ROOT . 'Year.php'; require_once CALENDAR_ROOT . 'Month/Weeks.php'; define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH_WEEKS); if (!isset($_GET['year'])) { $_GET['year'] = date('Y'); } $week_types = array('n_in_year', 'n_in_month'); if (!isset($_GET['week_type']) || !in_array($_GET['week_type'], $week_types)) { $_GET['week_type'] = 'n_in_year'; } $Year = new Calendar_Year($_GET['year']); $Year->build(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> <?php echo $Year->thisYear(); ?> </title> <style type="text/css"> body { font-family: Georgia, serif; } caption.year { font-weight: bold; font-size: 120%;
/** * Computes the data nececssary for the welcome screen. Automatically put into the request * data array. * * @access private */ function _compute_welcome_data() { setlocale(LC_ALL, 'fi_FI@UTF-8'); // First step of request data: Overall info $year_data = array(); $first_month = $this->_compute_first_month(); $last_month = $this->_compute_last_month(); $this->_request_data['first_month'] =& $first_month; $this->_request_data['last_month'] =& $last_month; $this->_request_data['total_count'] = $this->_compute_events_count_total(); $this->_request_data['year_data'] =& $year_data; if (!$first_month) { return; } // Second step of request data: Years and months. $first_year = $first_month->thisYear(); $last_year = $last_month->thisYear(); for ($year_nr = $first_year; $year_nr <= $last_year; $year_nr++) { $year = new Calendar_Year($year_nr); $year->build(); $year_url = $this->_get_calendar_yearlink($year); $year_count = $this->_compute_events_count_between($year->thisYear('timestamp'), $year->nextYear('timestamp')); $month_data = array(); // Loop over the months, start month is either first posting month // or January in all other cases. $month = null; if ($year_nr == $first_year) { for ($i = 1; $i < $first_month->thisMonth(); $i++) { $month = $year->fetch(); } } while ($month = $year->fetch()) { $month_textual = new Calendar_Decorator_Textual($month); $month_url = $this->_get_calendar_monthlink($month); $month_count = $this->_compute_events_count_between($month->thisMonth('timestamp'), $month->nextMonth('timestamp')); $month_data[$month->thisMonth()] = array('month' => $month_textual, 'name' => $month_textual->thisMonthName(), 'url' => $month_url, 'count' => $month_count); // Check for end month in end year if ($year_nr == $last_year && $month->thisMonth() >= $last_month->thisMonth()) { break; } } $year_data[$year_nr] = array('year' => $year_nr, 'url' => $year_url, 'count' => $year_count, 'month_data' => $month_data); } }