本文整理汇总了PHP中Date_Calc::getCalendarWeek方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::getCalendarWeek方法的具体用法?PHP Date_Calc::getCalendarWeek怎么用?PHP Date_Calc::getCalendarWeek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::getCalendarWeek方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cal_work_day_conv
function cal_work_day_conv($val)
{
global $locale_char_set;
$wk = Date_Calc::getCalendarWeek(null, null, null, "%a", LOCALE_FIRST_DAY);
$day_name = $wk[($val - LOCALE_FIRST_DAY) % 7];
if ($locale_char_set == "utf-8" && function_exists("utf8_encode")) {
$day_name = utf8_encode($day_name);
}
return htmlentities($day_name, ENT_COMPAT, $locale_char_set);
}
示例2: cal_work_day_conv
function cal_work_day_conv($val)
{
global $locale_char_set;
setlocale(LC_ALL, 'en_AU' . ($locale_char_set ? '.' . $locale_char_set : '.utf8'));
$wk = Date_Calc::getCalendarWeek(null, null, null, "%a", LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$day_name = $wk[($val - LOCALE_FIRST_DAY) % 7];
if ($locale_char_set == "utf-8" && function_exists("utf8_encode")) {
$day_name = utf8_encode($day_name);
}
return htmlentities($day_name, ENT_COMPAT, $locale_char_set);
}
示例3: cal_work_day_conv
function cal_work_day_conv($val)
{
global $locale_char_set, $AppUI;
setlocale(LC_TIME, 'en');
$wk = Date_Calc::getCalendarWeek(null, null, null, '%a', LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$day_name = $AppUI->_($wk[($val - LOCALE_FIRST_DAY) % 7]);
if ($locale_char_set == 'utf-8' && function_exists('utf8_encode')) {
$day_name = utf8_encode($day_name);
}
return htmlspecialchars($day_name, ENT_COMPAT, $locale_char_set);
}
示例4: _drawDays
/**
* CMonthCalendar::_drawDays()
*
* { Description }
*
* @return string Returns table a row with the day names
*/
function _drawDays()
{
global $AppUI;
setlocale(LC_TIME, 'en_AU');
$wk = Date_Calc::getCalendarWeek(null, null, null, '%a', LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$s = $this->showWeek ? "\n\t\t" . '<th> </th>' : '';
foreach ($wk as $day) {
$s .= "\n\t\t" . '<th width="14%">' . $AppUI->_($day) . '</th>';
}
return "\n<tr>" . $s . "\n</tr>";
}
示例5: _drawDays
/**
* CMonthCalendar::_drawDays()
*
* { Description }
*
* @return string Returns table a row with the day names
*/
function _drawDays()
{
global $locale_char_set;
$bow = Date_Calc::beginOfWeek(null, null, null, null, LOCALE_FIRST_DAY);
$y = substr($bow, 0, 4);
$m = substr($bow, 4, 2);
$d = substr($bow, 6, 2);
$wk = Date_Calc::getCalendarWeek($d, $m, $y, "%a", LOCALE_FIRST_DAY);
$s = $this->showWeek ? "\n\t\t<th> </th>" : "";
foreach ($wk as $day) {
$s .= "\n\t\t<th width=\"14%\">" . htmlentities(utf8_encode($day), ENT_COMPAT, $locale_char_set) . "</th>";
}
return "\n<tr>{$s}\n</tr>";
}
示例6: EVLIST_weekview
/**
* Create a weekly view.
*
* @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
* @param integer $cal Calendar to show
* @return string HTML for calendar page
*/
function EVLIST_weekview($year = 0, $month = 0, $day = 0, $cat = 0, $cal = 0, $opt = '')
{
global $_CONF, $_EV_CONF, $LANG_MONTH, $LANG_EVLIST;
USES_class_date();
EVLIST_setViewSession('week', $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;
// Get the events
$calendarView = Date_Calc::getCalendarWeek($day, $month, $year, '%Y-%m-%d');
$start_date = $calendarView[0];
$end_date = $calendarView[6];
$calendars_used = array();
$dtStart = new Date(strtotime($start_date), $_CONF['timezone']);
$dtToday = $dtStart;
// used to update date strings each day
$week_secs = 86400 * 7;
$dtPrev = new Date($dtStart->toUnix() - $week_secs, $_CONF['timezone']);
$dtNext = new Date($dtStart->toUnix() + $week_secs, $_CONF['timezone']);
// Set up next and previous week links
list($sYear, $sMonth, $sDay) = explode('-', $start_date);
$tpl = 'weekview';
$T = new Template(EVLIST_PI_PATH . '/templates/weekview');
if ($opt == 'print') {
$tpl .= '_print';
} elseif ($_EV_CONF['cal_tmpl'] == 'json') {
$tpl .= '_json';
}
$T->set_file(array('week' => $tpl . '.thtml'));
$daynames = EVLIST_getDayNames();
$events = EVLIST_getEvents($start_date, $end_date, array('cat' => $cat, 'cal' => $cal));
$start_mname = $LANG_MONTH[(int) $sMonth];
$last_date = getdate($dtStart->toUnix() + 86400 * 6);
$end_mname = $LANG_MONTH[$last_date['mon']];
$end_ynum = $last_date['year'];
$end_dnum = sprintf('%02d', $last_date['mday']);
$date_range = $start_mname . ' ' . $sDay;
if ($year != $end_ynum) {
$date_range .= ', ' . $year . ' - ';
} else {
$date_range .= ' - ';
}
if ($start_mname != $end_mname) {
$date_range .= $end_mname . ' ';
}
$date_range .= "{$end_dnum}, {$end_ynum}";
$T->set_var('date_range', $date_range);
$T->set_block('week', 'dayBlock', 'dBlk');
foreach ($calendarView as $idx => $weekData) {
list($curyear, $curmonth, $curday) = explode('-', $weekData);
$dtToday->setDateTimestamp($curyear, $curmonth, $curday, 0, 0, 0);
$T->clear_var('eBlk');
if ($weekData == $_EV_CONF['_today']) {
$T->set_var('dayclass', 'weekview-curday');
} else {
$T->set_var('dayclass', 'weekview-offday');
}
$monthname = $LANG_MONTH[(int) $curmonth];
$T->set_var('dayinfo', $daynames[$idx] . ', ' . COM_createLink($dtToday->format($_CONF['shortdate']), EVLIST_URL . "/index.php?view=day&day={$curday}" . "&cat={$cat}&cal={$cal}" . "&month={$curmonth}&year={$curyear}"));
if ($_EV_CONF['_can_add']) {
$T->set_var(array('can_add' => 'true', 'curday' => $curday, 'curmonth' => $curmonth, 'curyear' => $curyear));
}
if (!isset($events[$weekData])) {
// Make sure it's a valid but empty array if no events today
$events[$weekData] = array();
}
$T->set_block('week', 'eventBlock', 'eBlk');
foreach ($events[$weekData] as $A) {
//$fgstyle = 'color:' . $A['fgcolor'].';';
if ($A['allday'] == 1 || $A['rp_date_start'] < $weekData && $A['rp_date_end'] > $weekData) {
$event_time = $LANG_EVLIST['allday'];
/*$event_div = '<div class="monthview_allday"
style="background-color:'. $event['bgcolor'].';">';*/
} else {
if ($A['rp_date_start'] == $weekData) {
$startstamp = strtotime($weekData . ' ' . $A['rp_time_start1']);
$starttime = date('g:i a', $startstamp);
} else {
$starttime = ' ... ';
//.........这里部分代码省略.........
示例7: postcalendar_userapi_buildView
//.........这里部分代码省略.........
// Week View is a bit of a pain in the ass, so we need to
// do some extra setup for that view. This section will
// find the correct starting and ending dates for a given
// seven day period, based on the day of the week the
// calendar is setup to run under (Sunday, Saturday, Monday)
//=================================================================
$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) {
示例8: _drawDays
/**
* CMonthCalendar::_drawDays()
*
* { Description }
*
* @return string Returns table a row with the day names
*/
private function _drawDays()
{
global $AppUI, $locale_char_set;
setlocale(LC_TIME, 'en');
$wk = Date_Calc::getCalendarWeek(null, null, null, '%a', LOCALE_FIRST_DAY);
setlocale(LC_ALL, $AppUI->user_lang);
$s = $this->showWeek ? '<th> </th>' : '';
foreach ($wk as $day) {
$s .= '<th width="14%">' . $AppUI->_($day) . '</th>';
}
return '<tr>' . $s . '</tr>';
}
示例9: cal_work_day_conv
function cal_work_day_conv($val)
{
global $locale_char_set;
$wk = Date_Calc::getCalendarWeek(null, null, null, "%a", LOCALE_FIRST_DAY);
return htmlentities($wk[$val], ENT_COMPAT, $locale_char_set);
}
示例10: w2PfindImage
<td>
<a href="<?php
echo '?m=holiday&date=' . $next_year;
?>
"><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
示例11: _drawDays
/**
* CMonthCalendar::_drawDays()
*
* { Description }
*
* @return string Returns table a row with the day names
*/
function _drawDays()
{
global $AppUI, $locale_char_set;
$wk = Date_Calc::getCalendarWeek(null, null, null, '%a', LOCALE_FIRST_DAY);
$s = $this->showWeek ? "\n\t\t" . '<th> </th>' : '';
foreach ($wk as $day) {
$s .= "\n\t\t" . '<th width="14%">' . $AppUI->_($day) . '</th>';
}
return "\n<tr>" . $s . "\n</tr>";
}
示例12: compare
compare(28, Date_Calc::daysInMonth(2, 2001), 'daysInMonth 4');
compare(30, Date_Calc::daysInMonth(11, 2000), 'daysInMonth 5');
compare(28, Date_Calc::daysInMonth('02', 1900), 'daysInMonth 1 str');
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');