本文整理汇总了PHP中Date_Calc::getCalendarYear方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::getCalendarYear方法的具体用法?PHP Date_Calc::getCalendarYear怎么用?PHP Date_Calc::getCalendarYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::getCalendarYear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EVLIST_yearview
/**
* Display a yearly 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 Category to show
* @param integer $cal Calendar to show
* @return string HTML for calendar page
*/
function EVLIST_yearview($year = 0, $month = 0, $day = 0, $cat = 0, $cal = 0, $opt = '')
{
global $_CONF, $_EV_CONF, $LANG_MONTH;
EVLIST_setViewSession('year', $year, $month, $day);
$retval = '';
// Default to the current year
if ($year == 0) {
$year = date('Y');
}
if ($month == 0) {
$month = date('m');
}
if ($day == 0) {
$day = date('d');
}
$cat = (int) $cat;
$cal = (int) $cal;
// Get all the dates in the year
$starting_date = date('Y-m-d', mktime(0, 0, 0, 1, 1, $year));
$ending_date = date('Y-m-d', mktime(0, 0, 0, 1, 1, $year + 1));
$calendarView = Date_Calc::getCalendarYear($year, '%Y-%m-%d');
$daynames = EVLIST_getDayNames(1);
$events = EVLIST_getEvents($starting_date, $ending_date, array('cat' => $cat, 'cal' => $cal));
$T = new Template(EVLIST_PI_PATH . '/templates/yearview');
$tpl = 'yearview';
if ($opt == 'print') {
$tpl .= '_print';
} elseif ($_EV_CONF['cal_tmpl'] == 'json') {
$tpl .= '_json';
}
$T->set_file(array('yearview' => $tpl . '.thtml'));
$count = 0;
$T->set_block('yearview', 'month', 'mBlock');
foreach ($calendarView as $monthnum => $monthdata) {
$monthnum_str = sprintf("%02d", $monthnum + 1);
$count++;
if (($count - 1) % 4 == 0) {
$T->set_var('st_row', 'true');
} else {
$T->clear_var('st_row');
}
$M = new Template($_CONF['path'] . 'plugins/evlist/templates/yearview');
$M->set_file(array('smallmonth' => 'smallmonth.thtml'));
$M->set_var('thisyear', $year);
$M->set_var('month', $monthnum + 1);
$M->set_var('monthname', $LANG_MONTH[$monthnum + 1]);
$M->set_block('smallmonth', 'daynames', 'nBlock');
for ($i = 0; $i < 7; $i++) {
$M->set_var('dayname', $daynames[$i]);
$M->parse('nBlock', 'daynames', true);
}
$M->set_block('smallmonth', 'week', 'wBlock');
foreach ($monthdata as $weeknum => $weekdata) {
list($weekYear, $weekMonth, $weekDay) = explode('-', $weekdata[0]);
$M->set_var(array('weekyear' => $weekYear, 'weekmonth' => $weekMonth, 'weekday' => $weekDay, 'urlfilt_cat' => $cat, 'urlfilt_cal' => $cal));
$M->set_block('smallmonth', 'day', 'dBlock');
foreach ($weekdata as $daynum => $daydata) {
list($y, $m, $d) = explode('-', $daydata);
$M->clear_var('no_day_link');
if ($daydata == $_EV_CONF['_today']) {
$dayclass = 'today';
} elseif ($m == $monthnum_str) {
$dayclass = 'on';
} else {
$M->set_var('no_day_link', 'true');
$dayclass = 'off';
}
if (isset($events[$daydata])) {
// Create the mootip hover text
$popup = '';
$daylinkclass = $dayclass == 'off' ? 'nolink-events' : 'day-events';
foreach ($events[$daydata] as $event) {
// Separate events by a line (if more than one)
if (!empty($popup)) {
$popup .= '<hr />' . LB;
}
// Don't show a time for all-day events
if ($event['allday'] == 0) {
$popup .= date($_CONF['timeonly'], strtotime($event['date_start'] . ' ' . $event['time_start1'])) . ': ';
}
$popup .= htmlentities($event['title']);
}
$M->set_var('popup', $popup);
} else {
$daylinkclass = 'day-noevents';
$M->clear_var('popup');
}
$M->set_var(array('daylinkclass' => $daylinkclass, 'dayclass' => $dayclass, 'day' => substr($daydata, 8, 2), 'pi_url' => EVLIST_URL, 'urlfilt_cat' => $cat, 'urlfilt_cal' => $cal));
$M->parse('dBlock', 'day', true);
//.........这里部分代码省略.........
示例2: postcalendar_userapi_buildView
//.........这里部分代码省略.........
$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']);
}
}
} else {
if (!empty($pc_username) && $provider['username'] == $pc_username) {
array_push($single, $provider);
array_push($provIDs, $provider['id']);
}