/** * Sets the 'actualDate' field of the MyCalendar object * @param none * @return datestamp of the viewed date */ function get_calendar_actual_date() { if (isset($_GET['date'])) { $date_split = explode('-', $_GET['date']); } else { $date_split = explode('-', date('m-d-Y', Time::getAdjustedTime(mktime(), date('H') * 60))); } return mktime(0, 0, 0, $date_split[0], $date_split[1], $date_split[2]); }
function formatReminder() { $builder = new StringBuilder(); if ($this->_reservation->reminder_minutes_prior != 0) { $reminder_time = $this->_reservation->start + $this->_reservation->start * 60 - $this->_reservation->reminder_minutes_prior * 60; $adjusted = Time::getAdjustedTime($reminder_time); $builder->append(sprintf("DALARM:%sT%sZ\r\n", date('Ymd', $adjusted), date('His', $adjusted))); } return $builder->toString(); }
function formatSettings() { $builder = new StringBuilder(); $builder->append("UID:{$this->_reservation->id}\r\n"); $adjusted = Time::getAdjustedTime(mktime()); $builder->append(sprintf("DTSTAMP:%sT%sZ\r\n", date('Ymd', $adjusted), date('His', $adjusted))); $adjusted_start = Time::getAdjustedMinutes($this->_reservation->start); $builder->append(sprintf("DTSTART:%sT%s%s00Z\r\n", date('Ymd', Time::getAdjustedDate($this->_reservation->start_date, $this->_reservation->start)), Time::getHours($adjusted_start), Time::getMinutes($adjusted_start))); $adjusted_end = Time::getAdjustedMinutes($this->_reservation->end); $builder->append(sprintf("DTEND:%sT%s%s00Z\r\n", date('Ymd', Time::getAdjustedDate($this->_reservation->end_date, $this->_reservation->end)), Time::getHours($adjusted_end), Time::getMinutes($adjusted_end))); $adjusted = Time::getAdjustedTime($this->_reservation->created); $builder->append(sprintf("CREATED:%sT%sZ\r\n", date('Ymd', $adjusted), date('His', $adjusted))); if (!empty($this->_reservation->modified)) { $adjusted = Time::getAdjustedTime($this->_reservation->modified); $builder->append(sprintf("LAST-MODIFIED:%sT%sZ\r\n", date('Ymd', $adjusted), date('His', $adjusted))); } return $builder->toString(); }
/** * Print the actual calendar and jump functions * * This function prints out the calendar and calls all * the associated functions to print the calendar, * links and forms used to jump to a new month * * (This is the only function that needs to be called * after a Calendar has been created) * @param none */ function printCalendar($current_date) { $today = getdate(Time::getAdjustedTime(mktime())); $selected_date_array = getdate($current_date); $this->printCalendarBody($today, $selected_date_array); if ($this->isPopup) { $this->printJumpForm(); } }
/** * Gets the timezone adjusted datestamp for the current user with 0 hour/minute/second * @param int $timestamp the timestamp to adjust * @param int $res_time the reservation starttime or endtime as minutes * @param bool $to_server_time if this is going to server time or user time * @return the timezone adjusted timestamp for the current user, or the server timestamp if user is not logged in */ function getAdjustedDate($timestamp, $res_time = null, $to_server_time = false) { $tmp = getdate(Time::getAdjustedTime($timestamp, $res_time, $to_server_time)); return mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']); }