本文整理汇总了PHP中Date_Calc::getCalendarMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::getCalendarMonth方法的具体用法?PHP Date_Calc::getCalendarMonth怎么用?PHP Date_Calc::getCalendarMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::getCalendarMonth方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _drawMain
/**
* CMonthCalendar::_drawMain()
*
* { Description }
*
*/
function _drawMain()
{
global $AppUI;
$today = new CDate();
$today = $today->format('%Y%m%d%w');
$date = $this->this_month;
$this_day = intval($date->getDay());
$this_month = intval($date->getMonth());
$this_year = intval($date->getYear());
setlocale(LC_TIME, 'en_AU');
$cal = Date_Calc::getCalendarMonth($this_month, $this_year, '%Y%m%d%w', LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$df = $AppUI->getPref('SHDATEFORMAT');
$html = '';
foreach ($cal as $week) {
$html .= "\n<tr>";
if ($this->showWeek) {
$html .= "\n\t" . '<td class="week">';
$html .= $this->dayFunc ? '<a href="javascript:' . $this->weekFunc . "('" . $week[0] . "')" . '">' : '';
$html .= dPshowImage(dPfindImage('view.week.gif'), 16, 15, $AppUI->_('Week View'));
$html .= $this->dayFunc ? '</a>' : '';
$html .= "</td>";
}
foreach ($week as $day) {
$this_day = new CDate($day);
$y = intval(substr($day, 0, 4));
$m = intval(substr($day, 4, 2));
$d = intval(substr($day, 6, 2));
$dow = intval(substr($day, 8, 1));
if ($m != $this_month) {
$class = 'empty';
} else {
if ($day == $today) {
$class = 'today';
} else {
if ($dow == 0 || $dow == 6) {
$class = 'weekend';
} else {
$class = 'day';
}
}
}
$day = substr($day, 0, 8);
$html .= "\n\t" . '<td class="' . $class . '"';
if ($this->showHighlightedDays && isset($this->highlightedDays[$day])) {
$html .= ' style="border: 1px solid ' . $this->highlightedDays[$day] . '"';
}
$html .= ' onclick="' . $this->dayFunc . "('" . $day . "','" . $this_day->format($df) . "')" . '">';
if ($m == $this_month) {
if ($this->dayFunc) {
$html .= '<a href="javascript:' . $this->dayFunc . "('" . $day . "','" . $this_day->format($df) . "')" . '" class="' . $class . '">';
}
$html .= $d . ($this->dayFunc ? '</a>' : '');
if ($this->showEvents) {
$html .= $this->_drawEvents(substr($day, 0, 8));
}
}
$html .= "</td>";
}
$html .= "\n</tr>";
}
return $html;
}
示例2: EVLIST_smallmonth
/**
* Display a small monthly calendar for the current month.
* Dates that have events scheduled are highlighted.
*
* @param integer $year Year to display, default is current year
* @param integer $month Starting month
* @return string HTML for calendar page
*/
function EVLIST_smallmonth($year = 0, $month = 0, $opts = array())
{
global $_CONF, $_EV_CONF, $LANG_MONTH, $_SYSTEM;
$retval = '';
// Default to the current year
if ($year == 0) {
$year = date('Y');
}
if ($month == 0) {
$month = date('m');
}
$monthnum_str = sprintf("%02d", (int) $month);
// Get all the dates in the period
$starting_date = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year));
$ending_date = date('Y-m-d', mktime(23, 59, 59, $month, 31, $year));
$calendarView = Date_Calc::getCalendarMonth($month, $year, '%Y-%m-%d');
$events = EVLIST_getEvents($starting_date, $ending_date, $opts);
$T = new Template(EVLIST_PI_PATH . '/templates');
$T->set_file(array('smallmonth' => 'phpblock_month.thtml'));
$T->set_var('thisyear', $year);
$T->set_var('month', $month);
$T->set_var('monthname', $LANG_MONTH[(int) $month]);
// Set each day column header to the first letter of the day name
$T->set_block('smallmonth', 'daynames', 'nBlock');
$daynames = EVLIST_getDayNames(1);
foreach ($daynames as $key => $dayname) {
$T->set_var('dayname', $dayname);
$T->parse('nBlock', 'daynames', true);
}
$T->set_block('smallmonth', 'week', 'wBlock');
USES_class_date();
$dt = new Date('now', $_CONF['timezone']);
foreach ($calendarView as $weeknum => $weekdata) {
list($weekYear, $weekMonth, $weekDay) = explode('-', $weekdata[0]);
$T->set_var(array('weekyear' => $weekYear, 'weekmonth' => $weekMonth, 'weekday' => $weekDay));
$T->set_block('smallmonth', 'day', 'dBlock');
foreach ($weekdata as $daynum => $daydata) {
list($y, $m, $d) = explode('-', $daydata);
$T->clear_var('no_day_link');
if ($daydata == $_EV_CONF['_today']) {
$dayclass = 'monthtoday';
} elseif ($m == $monthnum_str) {
$dayclass = 'monthon';
} else {
$T->set_var('no_day_link', 'true');
$dayclass = 'monthoff';
}
$popup = '';
if (isset($events[$daydata])) {
// Create the tooltip hover text
$daylinkclass = $dayclass == 'monthoff' ? 'nolink-events' : 'day-events';
foreach ($events[$daydata] as $event) {
// Show event titles on different lines if more than one
if (!empty($popup)) {
$popup .= EVLIST_tooltip_newline();
}
// Don't show a time for all-day events
if ($event['allday'] == 0 && $event['rp_date_start'] == $event['rp_date_end']) {
$dt->setTimestamp(strtotime($event['rp_date_start'] . ' ' . $event['rp_time_start1']));
// Time is a localized string, not a timestamp, so
// don't adjust for the timezone
$popup .= $dt->format($_CONF['timeonly'], false) . ': ';
}
$popup .= htmlentities($event['title']);
}
$T->set_var('popup', $popup);
} else {
$daylinkclass = 'day-noevents';
$T->clear_var('popup');
}
$T->set_var(array('daylinkclass' => $daylinkclass, 'dayclass' => $dayclass, 'day' => substr($daydata, 8, 2), 'pi_url' => EVLIST_URL));
$T->parse('dBlock', 'day', true);
}
$T->parse('wBlock', 'week', true);
$T->clear_var('dBlock');
}
$T->parse('output', 'smallmonth');
return $T->finish($T->get_var('output'));
}
示例3: getCalendarYear
/**
* Return a set of arrays to construct a calendar year for
* the given date.
*
* @param string year in format CCYY, default current local year
* @param string format for returned date
*
* @access public
*
* @return array $year[$month][$row][$col]
*/
function getCalendarYear($year = "", $format = "%Y%m%d")
{
if (empty($year)) {
$year = Date_Calc::dateNow("%Y");
}
$year_array = array();
for ($curr_month = 0; $curr_month <= 11; $curr_month++) {
$year_array[$curr_month] = Date_Calc::getCalendarMonth(sprintf("%02d", $curr_month + 1), $year, $format);
}
return $year_array;
}
示例4: _drawMain
/**
* CMonthCalendar::_drawMain()
*
* { Description }
*
*/
function _drawMain()
{
global $AppUI;
$today = new CDate();
$today = $today->format("%Y%m%d%w");
$date = $this->this_month;
$this_day = intval($date->getDay());
$this_month = intval($date->getMonth());
$this_year = intval($date->getYear());
$cal = Date_Calc::getCalendarMonth($this_month, $this_year, "%Y%m%d%w", LOCALE_FIRST_DAY);
$df = $AppUI->getPref('SHDATEFORMAT');
$html = '';
foreach ($cal as $week) {
$html .= "\n<tr>";
if ($this->showWeek) {
$html .= "\n\t<td class=\"week\">";
$html .= $this->dayFunc ? "<a href=\"javascript:{$this->weekFunc}('{$week['0']}')\">" : '';
$html .= '<img src="./images/view.week.gif" width="16" height="15" border="0" alt="Week View" /></a>';
$html .= $this->dayFunc ? "</a>" : '';
$html .= "\n\t</td>";
}
foreach ($week as $day) {
$this_day = new CDate($day);
$y = intval(substr($day, 0, 4));
$m = intval(substr($day, 4, 2));
$d = intval(substr($day, 6, 2));
$dow = intval(substr($day, 8, 1));
if ($m != $this_month) {
$class = 'empty';
} else {
if ($day == $today) {
$class = 'today';
} else {
if ($dow == 0 || $dow == 6) {
$class = 'weekend';
} else {
$class = 'day';
}
}
}
$day = substr($day, 0, 8);
$html .= "\n\t<td class=\"{$class}\"";
if ($this->showHighlightedDays && isset($this->highlightedDays[$day])) {
$html .= " style=\"border: 1px solid " . $this->highlightedDays[$day] . "\"";
}
$html .= ">";
if ($m == $this_month) {
if ($this->dayFunc) {
$html .= "<a href=\"javascript:{$this->dayFunc}('{$day}','" . $this_day->format($df) . "')\" class=\"{$class}\">";
$html .= "{$d}";
$html .= "</a>";
} else {
$html .= "{$d}";
}
if ($this->showEvents) {
$html .= $this->_drawEvents(substr($day, 0, 8));
}
}
$html .= "\n\t</td>";
}
$html .= "\n</tr>";
}
return $html;
}
示例5: getCalendarYear
/**
* Return a set of arrays to construct a calendar year for the given date
*
* @param int $year the year in four digit format, default current
* local year
* @param string $format the string indicating how to format the output
*
* @return array $year[$month][$row][$col]
* @access public
* @static
*/
function getCalendarYear($year = null, $format = DATE_CALC_FORMAT)
{
if (is_null($year)) {
$year = Date_Calc::dateNow('%Y');
}
$year_array = array();
for ($curr_month = 0; $curr_month <= 11; $curr_month++) {
$year_array[$curr_month] = Date_Calc::getCalendarMonth($curr_month + 1, $year, $format);
}
return $year_array;
}
示例6: _drawMain
/**
* CMonthCalendar::_drawMain()
*
* { Description }
*
*/
private function _drawMain()
{
global $AppUI;
$today = new w2p_Utilities_Date();
$today = $today->format('%Y%m%d%w');
$date = $this->this_month;
$this_day = intval($date->getDay());
$this_month = intval($date->getMonth());
$this_year = intval($date->getYear());
setlocale(LC_TIME, 'en');
$cal = Date_Calc::getCalendarMonth($this_month, $this_year, '%Y%m%d%w', LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$df = $AppUI->getPref('SHDATEFORMAT');
$html = '';
foreach ($cal as $week) {
$html .= '<tr>';
if ($this->showWeek) {
$html .= '<td class="week">';
$html .= $this->dayFunc ? "<a href=\"javascript:{$this->weekFunc}('{$week['0']}')\">" : '';
$html .= '<img src="' . w2PfindImage('view.week.gif') . '" width="16" height="15" border="0" alt="Week View" /></a>';
$html .= $this->dayFunc ? '</a>' : '';
$html .= '</td>';
}
foreach ($week as $day) {
$this_day = new w2p_Utilities_Date($day);
$y = intval(substr($day, 0, 4));
$m = intval(substr($day, 4, 2));
$d = intval(substr($day, 6, 2));
$dow = intval(substr($day, 8, 1));
$cday = intval(substr($day, 0, 8));
//If we are on minical mode and we find tasks or events for this day then lets color code the cell depending on that
if (array_key_exists($cday, $this->events) && $this->styleMain == 'minical') {
$nr_tasks = 0;
$nr_events = 0;
//lets count tasks and events
foreach ($this->events[$cday] as $record) {
if ($record['task']) {
++$nr_tasks;
} else {
++$nr_events;
}
}
if ($nr_events && $nr_tasks) {
//if we find both
$class = 'eventtask';
} elseif ($nr_events) {
//if we just find events
$class = 'event';
} elseif ($nr_tasks) {
//if we just find tasks
$class = 'task';
}
if ($day == $today) {
$class .= 'today';
}
} elseif ($m != $this_month) {
$class = 'empty';
} elseif ($day == $today) {
$class = 'today';
} elseif ($dow == 0 || $dow == 6) {
$class = 'weekend';
} else {
$class = 'day';
}
$day = substr($day, 0, 8);
$html .= '<td class="' . $class . '"';
if ($this->showHighlightedDays && isset($this->highlightedDays[$day])) {
$html .= ' style="border: 1px solid ' . $this->highlightedDays[$day] . '"';
}
$html .= ' onclick="' . $this->dayFunc . '(\'' . $day . '\',\'' . $this_day->format($df) . '\')' . '">';
if ($this->dayFunc) {
$html .= "<a href=\"javascript:{$this->dayFunc}('{$day}','" . $this_day->format($df) . "')\" class=\"{$class}\">";
$html .= $d;
$html .= '</a>';
} else {
$html .= $d;
}
if ($this->showEvents) {
$html .= $this->_drawEvents(substr($day, 0, 8));
}
$html .= '</td>';
}
$html .= '</tr>';
}
return $html;
}
示例7: _drawMain
/**
* CMonthCalendar::_drawMain()
*
* { Description }
*
*/
function _drawMain()
{
global $AppUI;
$today = new CDate();
$today = $today->format("%Y%m%d%w");
$date = $this->this_month;
$this_day = intval($date->getDay());
$this_month = intval($date->getMonth());
$this_year = intval($date->getYear());
$cal = Date_Calc::getCalendarMonth($this_month, $this_year, "%Y%m%d%w", LOCALE_FIRST_DAY);
$df = $AppUI->getPref('SHDATEFORMAT');
$q = new DBQuery();
$q->addTable('holidays');
$q->addQuery('hdate, description');
$q->addOrder('hdate');
$holidays = $q->loadHashList();
$html = '';
foreach ($cal as $week) {
$html .= '<tr>';
if ($this->showWeek) {
$html .= '<td class="week' . ($this->weekFunc ? ' clickable" title="Week View" onclick="' . $this->weekFunc . '(' . $week[0] . ')"' : '"') . '>';
$html .= '<img src="images/view.week.gif"/></td>';
}
foreach ($week as $day) {
$this_day = new CDate($day);
$y = intval(substr($day, 0, 4));
$m = intval(substr($day, 4, 2));
$d = intval(substr($day, 6, 2));
$dow = intval(substr($day, 8, 1));
$description = $dd = $this->showWeek ? $holidays[$this_day->format('%Y-%m-%d')] : '';
if ($description != '') {
$class = 'holiday';
$description = '<br/><b>' . str_replace("\n", '<br/>', $description) . '</b><br/><br/>';
} else {
if ($dow == 0 || $dow == 6) {
$class = 'weekend';
} else {
if ($m != $this_month) {
$class = 'empty';
} else {
if ($day == $today) {
$class = 'today';
} else {
$class = 'day';
}
}
}
}
$day = substr($day, 0, 8);
$html .= '<td class="' . $class . ' clickable" ' . ($this->dayFunc ? 'onclick="' . $this->dayFunc . "('" . ($this->isHolidayControl ? $d . '/' . $m . '/' . $y . "', '" . rawurlencode($dd) : $day) . "', this)" . '"' : '');
if ($this->showHighlightedDays && isset($this->highlightedDays[$day])) {
$html .= ' style="border: 1px solid ' . $this->highlightedDays[$day] . '"';
}
$html .= '>';
if ($m == $this_month) {
$html .= '<span class="day_number">' . $d . '</span>' . $description;
if ($this->showEvents) {
$html .= $this->_drawEvents(substr($day, 0, 8), $day == $today);
}
} else {
if ($this->showWeek) {
$html .= '<span class="day_number2">' . $d . '</span>' . $description;
}
}
$html .= '</td>';
}
$html .= '</tr>';
}
return $html;
}
示例8: postcalendar_calendarblock_display
//.........这里部分代码省略.........
$the_last_day = $last_day;
}
break;
case _IS_SATURDAY:
$pc_array_pos = 6;
$first_day = date('w', mktime(0, 0, 0, $the_month, 2, $the_year));
$end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year));
if ($end_dow == 6) {
$the_last_day = $last_day + 6;
} elseif ($end_dow != 5) {
$the_last_day = $last_day + (5 - $end_dow);
} else {
$the_last_day = $last_day;
}
break;
case _IS_SUNDAY:
default:
$pc_array_pos = 0;
$first_day = date('w', mktime(0, 0, 0, $the_month, 1, $the_year));
$end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year));
if ($end_dow != 6) {
$the_last_day = $last_day + (6 - $end_dow);
} else {
$the_last_day = $last_day;
}
break;
}
$month_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, 1, $the_year));
$month_view_end = date('Y-m-t', mktime(0, 0, 0, $the_month, 1, $the_year));
$today_date = postcalendar_today('%Y-%m-%d');
$starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, 1 - $first_day, $the_year));
$ending_date = date('m/t/Y', mktime(0, 0, 0, $the_month + $pcbeventsrange, 1, $the_year));
$eventsByDate =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'pcGetEvents', array('start' => $starting_date, 'end' => $ending_date));
$calendarView = Date_Calc::getCalendarMonth($the_month, $the_year, '%Y-%m-%d');
$sdaynames = array();
$numDays = count($pc_short_day_names);
for ($i = 0; $i < $numDays; $i++) {
if ($pc_array_pos >= $numDays) {
$pc_array_pos = 0;
}
array_push($sdaynames, $pc_short_day_names[$pc_array_pos]);
$pc_array_pos++;
}
$daynames = array();
$numDays = count($pc_long_day_names);
for ($i = 0; $i < $numDays; $i++) {
if ($pc_array_pos >= $numDays) {
$pc_array_pos = 0;
}
array_push($daynames, $pc_long_day_names[$pc_array_pos]);
$pc_array_pos++;
}
$dates = array();
while ($starting_date <= $ending_date) {
array_push($dates, $starting_date);
list($m, $d, $y) = explode('/', $starting_date);
$starting_date = Date_Calc::nextDay($d, $m, $y, '%m/%d/%Y');
}
$categories =& pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
if (isset($calendarView)) {
$tpl->assign_by_ref('CAL_FORMAT', $calendarView);
}
$tpl->assign_by_ref('A_MONTH_NAMES', $pc_month_names);
$tpl->assign_by_ref('A_LONG_DAY_NAMES', $pc_long_day_names);
$tpl->assign_by_ref('A_SHORT_DAY_NAMES', $pc_short_day_names);
$tpl->assign_by_ref('S_LONG_DAY_NAMES', $daynames);
示例9: EVLIST_monthview
/**
* Display a monthly calendar.
* Dates that have events scheduled are highlighted.
*
* @param integer $year Year to display, default is current year
* @param integer $month Starting month
* @param integer $day Starting day
* @param integer $cat Event category
* @plaram integer $cal Calendar ID
* @return string HTML for calendar page
*/
function EVLIST_monthview($year = 0, $month = 0, $day = 0, $cat = 0, $cal = 0, $opt = '')
{
global $_CONF, $_EV_CONF, $LANG_MONTH;
EVLIST_setViewSession('month', $year, $month, $day);
$retval = '';
list($currentyear, $currentmonth, $currentday) = explode('-', $_EV_CONF['_today']);
// Default to the current month
if ($year == 0) {
$year = $currentyear;
}
if ($month == 0) {
$month = $currentmonth;
}
if ($day == 0) {
$day = $currentday;
}
$cat = (int) $cat;
$cal = (int) $cal;
// Set the calendar header. Done early because the _can_add value is
// set by this function
$cal_header = EVLIST_calHeader($year, $month, $day, 'month', $cat, $cal);
// Get all the dates in the month
$calendarView = Date_Calc::getCalendarMonth($month, $year, '%Y-%m-%d');
$x = count($calendarView) - 1;
$y = count($calendarView[$x]) - 1;
$starting_date = $calendarView[0][0];
$ending_date = $calendarView[$x][$y];
$daynames = EVLIST_getDayNames();
$events = EVLIST_getEvents($starting_date, $ending_date, array('cat' => $cat, 'cal' => $cal));
$nextmonth = $month + 1;
$nextyear = $year;
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear = $year + 1;
}
$prevmonth = $month - 1;
$prevyear = $year;
if ($prevmonth < 1) {
$prevmonth = 12;
$prevyear = $year - 1;
}
$tplpath = EVLIST_PI_PATH . '/templates/monthview';
$tpl = 'monthview';
if ($opt == 'print') {
$tpl .= '_print';
} elseif ($_EV_CONF['cal_tmpl'] == 'json') {
$tpl .= '_json';
}
$T = new Template($tplpath);
$T->set_file(array('monthview' => $tpl . '.thtml', 'allday_event' => 'event_allday.thtml', 'timed_event' => 'event_timed.thtml'));
foreach ($daynames as $key => $dayname) {
$T->set_var('dayname' . $key, $dayname);
}
list($y, $m, $d) = explode('-', $starting_date);
$weekOfYear = Date_Calc::weekOfYear($d, $m, $y);
$calendars_used = array();
$i = 0;
$T->set_block('monthview', 'weekBlock', 'wBlock');
foreach ($calendarView as $weeknum => $weekdata) {
list($weekYear, $weekMonth, $weekDay) = explode('-', $weekdata[0]);
$T->set_var(array('wyear' => $weekYear, 'wmonth' => $weekMonth, 'wday' => $weekDay, 'urlfilt_cat' => $cat, 'urlfilt_cal' => $cal, 'weeknum' => $weekOfYear, $tplx => 'true'));
$weekOfYear++;
foreach ($weekdata as $daynum => $daydata) {
list($y, $m, $d) = explode('-', $daydata);
if ($daydata == $_EV_CONF['_today']) {
$dayclass = 'today';
} elseif ($m == $month) {
$dayclass = 'on';
} else {
$dayclass = 'off';
}
$T->set_var('cal_day_anchortags', COM_createLink(sprintf("%02d", $d), EVLIST_URL . '/index.php?view=day&' . "cat={$cat}&cal={$cal}" . "&day={$d}&month={$m}&year={$y}", array('class' => 'cal-date')));
if (!isset($events[$daydata])) {
// Just to avoid foreach() errors
$events[$daydata] = array();
}
$dayentries = '';
$T->clear_var('cal_day_entries');
$T->set_block('monthview', 'dayBlock', 'dBlock');
foreach ($events[$daydata] as $event) {
if (empty($event['title'])) {
continue;
}
$ev_hover = '';
// Sanitize fields for display. No HTML in the popup.
$title = htmlentities(strip_tags($event['title']));
$summary = htmlentities(strip_tags($event['summary']));
// add the calendar to the array to create the JS checkboxes
$calendars_used[$event['cal_id']] = array('cal_name' => $event['cal_name'], 'cal_ena_ical' => $event['cal_ena_ical'], 'cal_id' => $event['cal_id'], 'fgcolor' => $event['fgcolor'], 'bgcolor' => $event['bgcolor']);
//.........这里部分代码省略.........
示例10: postcalendar_userapi_buildView
//.........这里部分代码省略.........
//=================================================================
$first_day_of_week = sprintf('%02d', $the_day - $week_day);
$week_first_day = date('m/d/Y', mktime(0, 0, 0, $the_month, $first_day_of_week, $the_year));
list($week_first_day_month, $week_first_day_date, $week_first_day_year) = explode('/', $week_first_day);
$week_first_day_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $week_first_day_month, $week_first_day_date, $week_first_day_year)));
$week_last_day = date('m/d/Y', mktime(0, 0, 0, $the_month, $first_day_of_week + 6, $the_year));
list($week_last_day_month, $week_last_day_date, $week_last_day_year) = explode('/', $week_last_day);
$week_last_day_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $week_last_day_month, $week_last_day_date, $week_last_day_year)));
$week_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, $first_day_of_week, $the_year));
$week_view_end = date('Y-m-d', mktime(0, 0, 0, $the_month, $first_day_of_week + 6, $the_year));
//=================================================================
// Setup some information so we know the actual month's dates
// also get today's date for later use and highlighting
//=================================================================
$month_view_start = date('Y-m-d', mktime(0, 0, 0, $the_month, 1, $the_year));
$month_view_end = date('Y-m-t', mktime(0, 0, 0, $the_month, 1, $the_year));
$today_date = postcalendar_today('%Y-%m-%d');
//=================================================================
// Setup the starting and ending date ranges for pcGetEvents()
//=================================================================
switch ($viewtype) {
case 'day':
$starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, $the_day, $the_year));
$ending_date = date('m/d/Y', mktime(0, 0, 0, $the_month, $the_day, $the_year));
break;
case 'week':
$starting_date = "{$week_first_day_month}/{$week_first_day_date}/{$week_first_day_year}";
$ending_date = "{$week_last_day_month}/{$week_last_day_date}/{$week_last_day_year}";
$calendarView = Date_Calc::getCalendarWeek($week_first_day_date, $week_first_day_month, $week_first_day_year, '%Y-%m-%d');
break;
case 'month':
$starting_date = date('m/d/Y', mktime(0, 0, 0, $the_month, 1 - $first_day, $the_year));
$ending_date = date('m/d/Y', mktime(0, 0, 0, $the_month, $the_last_day, $the_year));
$calendarView = Date_Calc::getCalendarMonth($the_month, $the_year, '%Y-%m-%d');
break;
case 'year':
$starting_date = date('m/d/Y', mktime(0, 0, 0, 1, 1, $the_year));
$ending_date = date('m/d/Y', mktime(0, 0, 0, 1, 1, $the_year + 1));
$calendarView = Date_Calc::getCalendarYear($the_year, '%Y-%m-%d');
break;
}
//=================================================================
// Identify the Providers whose schedules we should load
//=================================================================
//==================================
//FACILITY FILTERING (CHEMED)
if ($_SESSION['pc_facility']) {
$provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']);
} else {
$provinfo = getProviderInfo();
}
//EOS FACILITY FILTERING (CHEMED)
//==================================
$single = array();
$provIDs = array();
// array of numeric provider IDs
// filter the display on the requested username, the provinfo array is
// used to build columns in the week view.
foreach ($provinfo as $provider) {
if (is_array($pc_username)) {
foreach ($pc_username as $uname) {
if (!empty($pc_username) && $provider['username'] == $uname) {
array_push($single, $provider);
array_push($provIDs, $provider['id']);
}
}
示例11: generateTable
/**
* Generate the HTML_Table object of the calendar
*
* @param day day of the calendar to generate, null = today's day
* @param month month of the calendar to generate, null = today's month
* @param year year of the calendar to generate, null = today's year
*
* @access public
* @return the HTML_Table object of the calendar
*/
function generateTable($day = null, $month = null, $year = null)
{
if (empty($year)) {
$year = Date_Calc::dateNow('%Y');
}
if (empty($month)) {
$month = Date_Calc::dateNow('%m');
}
if (empty($day)) {
$day = Date_Calc::dateNow('%d');
}
$year = sprintf('%04d', $year);
$month = sprintf('%02d', $month);
$day = sprintf('%02d', $day);
// get month structure for generating calendar
$month_cal = Date_Calc::getCalendarMonth($month, $year, '%E');
$this->_todayDays = Date_Calc::dateFormat(null, null, null, '%E');
$this->_thisMonth = Date_Calc::dateFormat($day, $month, $year, '%m');
$row = 0;
$table = new HTML_Table($this->_attributes['table']);
$table->addRow(array($this->drawTitle($day, $month, $year)));
$table->setRowAttributes($row, $this->_attributes['title']);
$row++;
for ($col = 0; $col < 7; $col++) {
$table->setCellContents($row, $col, $this->drawWeekDayText($col), 'TH');
}
$table->setRowAttributes($row++, $this->_attributes['weekday']);
for ($week = 0; $week < count($month_cal); $week++) {
for ($col = 0; $col < 7; $col++) {
$table->setCellContents($row, $col, $this->drawCell($month_cal[$week][$col], $week, $col));
$type = $this->getType($month_cal[$week][$col]);
$table->setCellAttributes($row, $col, $this->_attributes['cell']);
$table->updateCellAttributes($row, $col, $this->_attributes['cell_' . $type]);
}
$row++;
}
return $table;
}
示例12: w2PfindImage
?>
"><img src="<?php
echo w2PfindImage('next.gif');
?>
" width="16" height="16" alt="next" title="next" border="0"></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
$wk = Date_Calc::getCalendarWeek(null, null, null, '%a', LOCALE_FIRST_DAY);
for ($m = 1; $m <= 12; $m++) {
$monthname = Date_Calc::getMonthFullname($m);
$cal = Date_Calc::getCalendarMonth($m, $year, '%Y%m%d%w', LOCALE_FIRST_DAY);
?>
<div class="holiday-calendar-month">
<span class="holiday-calendar-monthname"><?php
echo $AppUI->_($monthname, UI_CASE_UPPERFIRST) . ' ';
?>
</span>
<ol class="selectable">
<?php
foreach ($wk as $day) {
?>
<li class="ui-dayname"><?php
$d = $AppUI->_($day);
echo strtoupper($d[0]);
?>
示例13: compare
compare(29, Date_Calc::daysInMonth('02', 1996), 'daysInMonth 2 str');
compare(29, Date_Calc::daysInMonth('02', 2000), 'daysInMonth 3 str');
compare(28, Date_Calc::daysInMonth('02', 2001), 'daysInMonth 4 str');
compare(30, Date_Calc::daysInMonth('11', '2000'), 'daysInMonth 5 str');
compare(5, Date_Calc::weeksInMonth(11, 2000), 'weeksInMonth');
compare(5, Date_Calc::weeksInMonth('11', '2000'), 'weeksInMonth str');
$exp = array('19000226', '19000227', '19000228', '19000301', '19000302', '19000303', '19000304');
compare($exp, Date_Calc::getCalendarWeek(27, 2, 1900), 'getCalendarWeek 1');
$exp = array('20000228', '20000229', '20000301', '20000302', '20000303', '20000304', '20000305');
compare($exp, Date_Calc::getCalendarWeek(28, 2, 2000), 'getCalendarWeek 2');
$exp = array('20001127', '20001128', '20001129', '20001130', '20001201', '20001202', '20001203');
compare($exp, Date_Calc::getCalendarWeek(27, 11, 2000), 'getCalendarWeek 3');
compare($exp, Date_Calc::getCalendarWeek('27', '11', '2000'), 'getCalendarWeek 3 str');
$exp = array(array('20001030', '20001031', '20001101', '20001102', '20001103', '20001104'), array('20001105', '20001106', '20001107', '20001108', '20001109', '20001110', '20001111'), array('20001112', '20001113', '20001114', '20001115', '20001116', '20001117', '20001118'), array('20001119', '20001121', '20001122', '20001123', '20001124', '20001125', '20001126'), array('20001127', '20001128', '20001129', '20001130', '20001201', '20001202', '20001203'));
compare($exp, Date_Calc::getCalendarMonth(11, 2000), 'getCalendarMonth');
compare($exp, Date_Calc::getCalendarMonth('11', '2000'), 'getCalendarMonth str');
// I don't feel like dealing with this right now...
//compare('', Date_Calc::getCalendarYear(2000), 'getCalendarYear');
compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay');
compare('20001123', Date_Calc::nextDay(22, 11, 2000), 'nextDay');
compare('20001121', Date_Calc::prevDay(22, 11, 2000), 'prevDay str');
compare('20001123', Date_Calc::nextDay('22', '11', '2000'), 'nextDay str');
compare('20001117', Date_Calc::prevWeekday('19', '11', '2000'), 'prevWeekday 1 str');
compare('20001117', Date_Calc::prevWeekday(19, 11, 2000), 'prevWeekday 1');
compare('20001121', Date_Calc::prevWeekday(22, 11, 2000), 'prevWeekday 2');
compare('20001123', Date_Calc::nextWeekday(22, 11, 2000), 'nextWeekday 1');
compare('20001127', Date_Calc::nextWeekday(24, 11, 2000), 'nextWeekday 2');
compare('20001127', Date_Calc::nextWeekday('24', '11', '2000'), 'nextWeekday 2 str');
compare('20001121', Date_Calc::prevDayOfWeek('2', '22', '11', '2000'), 'prevDayOfWeek 1 str');
compare('20001121', Date_Calc::prevDayOfWeek(2, 22, 11, 2000), 'prevDayOfWeek 1');
compare('20001115', Date_Calc::prevDayOfWeek(3, 22, 11, 2000), 'prevDayOfWeek 2');
示例14: _drawMain
/**
* CMonthCalendar::_drawMain()
*
* { Description }
*
*/
function _drawMain()
{
global $AppUI, $locale_char_set;
$today = new CDate();
$today = $today->format('%Y%m%d%w');
$date = $this->this_month;
$this_day = intval($date->getDay());
$this_month = intval($date->getMonth());
$this_year = intval($date->getYear());
$AppUI->setBaseLocale(LC_ALL);
$cal = Date_Calc::getCalendarMonth($this_month, $this_year, '%Y:%m:%d:%w', LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$df = $AppUI->getPref('SHDATEFORMAT');
$html = '';
foreach ($cal as $week) {
$html .= "\n<tr>";
if ($this->showWeek) {
list($y, $m, $d, $dow) = explode(':', $week[0]);
$firstday = sprintf("%04d%02d%02d", $y, $m, $d);
$html .= "\n\t" . '<td class="week">';
$html .= $this->dayFunc ? '<a href="javascript:' . $this->weekFunc . "('" . $firstday . "')" . '">' : '';
$html .= dPshowImage(dPfindImage('view.week.gif'), 16, 15, $AppUI->_('Week View'));
$html .= $this->dayFunc ? '</a>' : '';
$html .= "</td>";
}
foreach ($week as $day) {
list($y, $m, $d, $dow) = explode(':', $day);
$day = sprintf("%04d%02d%02d", $y, $m, $d);
if ($m != $this_month) {
$class = 'empty';
} else {
if ($day == $today) {
$class = 'today';
} else {
if ($dow == 0 || $dow == 6) {
$class = 'weekend';
} else {
$class = 'day';
}
}
}
$day = mb_substr($day, 0, 8);
$this_day = new CDate($day);
$html .= "\n\t" . '<td class="' . $class . '"';
if ($this->showHighlightedDays && isset($this->highlightedDays[$day])) {
$html .= ' style="border: 1px solid ' . $this->highlightedDays[$day] . '"';
}
$html .= ' onclick="' . $this->dayFunc . "('" . $day . "','" . $this_day->format($df) . "')" . '">';
if ($m == $this_month) {
if ($this->dayFunc) {
$html .= '<a href="javascript:' . $this->dayFunc . "('" . $day . "','" . $this_day->format($df) . "')" . '" class="' . $class . '">';
}
$html .= $d . ($this->dayFunc ? '</a>' : '');
if ($this->showWeek) {
$html .= $this->_drawBirthdays($day);
}
if ($this->showEvents) {
$html .= $this->_drawEvents($day);
}
}
$html .= "</td>";
}
$html .= "\n</tr>";
}
return $html;
}