本文整理汇总了PHP中Date_Calc::endOfWeek方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::endOfWeek方法的具体用法?PHP Date_Calc::endOfWeek怎么用?PHP Date_Calc::endOfWeek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date_Calc
的用法示例。
在下文中一共展示了Date_Calc::endOfWeek方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showWeeks
function showWeeks()
{
global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names, $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count, $total_hours_capacity, $total_hours_capacity_all;
$working_days_count = 0;
$allocated_hours_sum = 0;
$ed = new w2p_Utilities_Date(Date_Calc::endOfWeek($end_date->day, $end_date->month, $end_date->year));
$sd = new w2p_Utilities_Date(Date_Calc::beginOfWeek($start_date->day, $start_date->month, $start_date->year));
$week_difference = ceil($ed->workingDaysInSpan($sd) / count(explode(',', w2PgetConfig('cal_working_days'))));
$actual_date = $sd;
$table_header = '<tr><th>' . $AppUI->_('User') . '</th>';
for ($i = 0; $i < $week_difference; $i++) {
$actual_date->addSeconds(168 * 3600);
// + one week
$working_days_count = $working_days_count + count(explode(',', w2PgetConfig('cal_working_days')));
}
$table_header .= '<th nowrap="nowrap" colspan="2">' . $AppUI->_('Allocated') . '</th></tr>';
$table_rows = '';
foreach ($user_list as $user_id => $user_data) {
$user_names[$user_id] = $user_data['contact_first_name'] . ' ' . $user_data['contact_last_name'];
if (isset($user_usage[$user_id])) {
$table_rows .= '<tr><td nowrap="nowrap">(' . $user_data['user_username'] . ') ' . $user_data['contact_first_name'] . ' ' . $user_data['contact_last_name'] . '</td>';
$actual_date = $sd;
$array_sum = array_sum($user_usage[$user_id]);
$average_user_usage = number_format($array_sum / ($week_difference * count(explode(',', w2PgetConfig('cal_working_days'))) * w2PgetConfig('daily_working_hours')) * 100, 2);
$allocated_hours_sum += $array_sum;
$bar_color = 'blue';
if ($average_user_usage > 100) {
$bar_color = 'red';
$average_user_usage = 100;
}
$table_rows .= '<td ><div align="left">' . round($array_sum, 2) . ' ' . $AppUI->_('hours') . '</td> <td align="right"> ' . $average_user_usage;
$table_rows .= '%</div>';
$table_rows .= '<div align="left" style="height:2px;width:' . $average_user_usage . '%; background-color:' . $bar_color . '"> </div></td>';
$table_rows .= '</tr>';
}
}
$total_hours_capacity = $working_days_count / 2 * w2PgetConfig('daily_working_hours') * count($user_usage);
$total_hours_capacity_all = $working_days_count / 2 * w2PgetConfig('daily_working_hours') * count($user_list);
}
示例2: showWeeks
function showWeeks()
{
global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names, $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count, $total_hours_capacity, $total_hours_capacity_all;
$working_days_count = 0;
$allocated_hours_sum = 0;
$ed = new CDate(Date_Calc::endOfWeek($end_date->day, $end_date->month, $end_date->year));
$sd = new CDate(Date_Calc::beginOfWeek($start_date->day, $start_date->month, $start_date->year));
$week_difference = ceil($ed->workingDaysInSpan($sd) / count(explode(",", dPgetConfig("cal_working_days"))));
$actual_date = $sd;
$table_header = "<tr><th>" . $AppUI->_("User") . "</th>";
for ($i = 0; $i < $week_difference; $i++) {
$table_header .= "<th>" . Date_Calc::weekOfYear($actual_date->day, $actual_date->month, $actual_date->year) . "<br><table><td style='font-weight:normal; font-size:70%'>" . $actual_date->format($df) . "</td></table></th>";
$actual_date->addSeconds(168 * 3600);
// + one week
}
$table_header .= "<th nowrap='nowrap' colspan='2'>" . $AppUI->_("Allocated") . "</th></tr>";
$table_rows = "";
foreach ($user_list as $user_id => $user_data) {
@($user_names[$user_id] = $user_data["user_username"]);
if (isset($user_usage[$user_id])) {
$table_rows .= "<tr><td nowrap='nowrap'>(" . $user_data["user_username"] . ") " . $user_data["contact_first_name"] . " " . $user_data["contact_last_name"] . "</td>";
$actual_date = $sd;
for ($i = 0; $i < $week_difference; $i++) {
$awoy = $actual_date->year . Date_Calc::weekOfYear($actual_date->day, $actual_date->month, $actual_date->year);
$table_rows .= "<td align='right'>";
if (isset($user_usage[$user_id][$awoy])) {
$hours = number_format($user_usage[$user_id][$awoy], 2);
$table_rows .= $hours;
$percentage_used = round($hours / (dPgetConfig("daily_working_hours") * count(explode(",", dPgetConfig("cal_working_days")))) * 100);
$bar_color = "blue";
if ($percentage_used > 100) {
$bar_color = "red";
$percentage_used = 100;
}
$table_rows .= "<div style='height:2px;width:{$percentage_used}%; background-color:{$bar_color}'> </div>";
} else {
$table_rows .= " ";
}
$table_rows .= "</td>";
$actual_date->addSeconds(168 * 3600);
// + one week
}
$array_sum = array_sum($user_usage[$user_id]);
$average_user_usage = number_format($array_sum / ($week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours")) * 100, 2);
$allocated_hours_sum += $array_sum;
$bar_color = "blue";
if ($average_user_usage > 100) {
$bar_color = "red";
$average_user_usage = 100;
}
$table_rows .= "<td ><div align='left'>" . round($array_sum, 2) . " " . $AppUI->_("hours") . "</td> <td align='right'> " . $average_user_usage;
$table_rows .= "%</div>";
$table_rows .= "<div align='left' style='height:2px;width:{$average_user_usage}%; background-color:{$bar_color}'> </div></td>";
$table_rows .= "</tr>";
}
}
$total_hours_capacity = $week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours") * count($user_usage);
$total_hours_capacity_all = $week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours") * count($user_list);
}
示例3: w2PgetParam
// Using simplified set/get semantics. Doesn't need as much code in the module.
$event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', 'my'), 'EVENTFILTER', 'my');
// get the passed timestamp (today if none)
$date = w2PgetParam($_GET, 'date', null);
$today = new w2p_Utilities_Date();
$today->convertTZ($AppUI->getPref('TIMEZONE'));
$today = $today->format(FMT_TIMESTAMP_DATE);
// establish the focus 'date'
$this_week = new w2p_Utilities_Date($date);
$dd = $this_week->getDay();
$mm = $this_week->getMonth();
$yy = $this_week->getYear();
// prepare time period for 'events'
$first_time = new w2p_Utilities_Date(Date_Calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$first_time->setTime(0, 0, 0);
$last_time = new w2p_Utilities_Date(Date_Calc::endOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$last_time->setTime(23, 59, 59);
$prev_week = new w2p_Utilities_Date(Date_Calc::beginOfPrevWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$next_week = new w2p_Utilities_Date(Date_Calc::beginOfNextWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY));
$links = array();
// assemble the links for the tasks
$links = getTaskLinks($first_time, $last_time, $links, 50, $company_id);
// assemble the links for the events
$links += getEventLinks($first_time, $last_time, $links, 50);
$hooks = new w2p_System_HookHandler($AppUI);
$hooks->links = $links;
$links = $hooks->calendar_links();
// get the list of visible companies
$company = new CCompany();
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
示例4: array
<?php
require_once 'Date.php';
$error = false;
$dates = array(array(array(2003, 3, 17), '20030323', '20030317', '20030324', '20030310'), array(array(2003, 3, 20), '20030323', '20030317', '20030324', '20030310'), array(array(2003, 3, 23), '20030323', '20030317', '20030324', '20030310'));
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::endOfWeek($date[2], $date[1], $date[0]);
if ($res != $d[1]) {
echo "Bug 674 eow: " . $date[0] . $date[1] . $date[2] . " failed\n";
$error = true;
}
}
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::beginOfWeek($date[2], $date[1], $date[0]);
if ($res != $d[2]) {
echo "Bug 674 bow: " . $date[0] . $date[1] . $date[2] . " failed\n";
$error = true;
}
}
foreach ($dates as $d) {
$date = $d[0];
$res = Date_Calc::beginOfNextWeek($date[2], $date[1], $date[0]);
if ($res != $d[3]) {
echo "Bug 674 bonw: " . $date[0] . $date[1] . $date[2] . " failed\n";
$error = true;
}
}
foreach ($dates as $d) {
$date = $d[0];
示例5: showWeeks
function showWeeks()
{
global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names;
global $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count;
global $total_hours_capacity, $total_hours_capacity_all;
$working_days_count = 0;
$allocated_hours_sum = 0;
$AppUI->setBaseLocale();
$ed = new CDate(Date_Calc::endOfWeek($end_date->day, $end_date->month, $end_date->year));
$sd = new CDate(Date_Calc::beginOfWeek($start_date->day, $start_date->month, $start_date->year));
setlocale(LC_ALL, $AppUI->user_lang);
$week_difference = ceil($ed->workingDaysInSpan($sd) / count(explode(',', dPgetConfig('cal_working_days'))));
$actual_date = $sd;
$table_header = '<tr><th>' . $AppUI->_('User') . '</th>';
for ($i = 0; $i < $week_difference; $i++) {
$actual_date->addSeconds(168 * 3600);
// + one week
$working_days_count = $working_days_count + count(explode(',', dPgetConfig('cal_working_days')));
}
$table_header .= '<th nowrap="nowrap" colspan="2">' . $AppUI->_('Allocated') . '</th></tr>';
$table_rows = '';
foreach ($user_list as $user_id => $user_data) {
@($user_names[$user_id] = $user_data['user_username']);
if (isset($user_usage[$user_id])) {
$table_rows .= '<tr><td nowrap="nowrap">(' . $user_data['user_username'] . ') ' . $user_data['contact_first_name'] . ' ' . $user_data['contact_last_name'] . '</td>';
$actual_date = $sd;
/*
for ($i=0; $i<$week_difference; $i++) {
setlocale(LC_ALL, 'en_AU'.(($locale_char_set)? ('.' . $locale_char_set) : '.utf8'));
$awoy = $actual_date->year.Date_Calc::weekOfYear($actual_date->day,$actual_date->month,$actual_date->year);
setlocale(LC_ALL, $AppUI->user_lang);
$table_rows .= '<td align="right">';
if (isset($user_usage[$user_id][$awoy])) {
$hours = number_format($user_usage[$user_id][$awoy],2);
$table_rows .= $hours;
$percentage_used = round(($hours/(dPgetConfig('daily_working_hours')*count(explode(',',dPgetConfig('cal_working_days')))))*100);
$bar_color = 'blue';
if ($percentage_used > 100) {
$bar_color = 'red';
$percentage_used = 100;
}
$table_rows .= '<div style="height:2px;width:' . $percentage_used . '%; background-color:' . $bar_color . '"> </div>';
} else {
$table_rows .= ' ';
}
$table_rows .= '</td>';
$actual_date->addSeconds(168*3600); // + one week
}
*/
$array_sum = array_sum($user_usage[$user_id]);
$average_user_usage = number_format($array_sum / ($week_difference * count(explode(',', dPgetConfig('cal_working_days'))) * dPgetConfig('daily_working_hours')) * 100, 2);
$allocated_hours_sum += $array_sum;
$bar_color = 'blue';
if ($average_user_usage > 100) {
$bar_color = 'red';
$average_user_usage = 100;
}
$table_rows .= '<td><div align="left">' . round($array_sum, 2) . ' ' . $AppUI->_('hours') . '</td> <td align="right"> ' . $average_user_usage;
$table_rows .= '%</div>';
$table_rows .= '<div align="left" style="height:2px;width:' . $average_user_usage . '%; background-color:' . $bar_color . '"> </div></td>';
$table_rows .= '</tr>';
}
}
/*
$total_hours_capacity = $week_difference * count(explode(',',dPgetConfig('cal_working_days'))) * dPgetConfig('daily_working_hours') * count($user_usage);
$total_hours_capacity_all = $week_difference * count(explode(',',dPgetConfig('cal_working_days'))) *dPgetConfig('daily_working_hours') * count($user_list);
*/
$total_hours_capacity = $working_days_count / 2 * dPgetConfig('daily_working_hours') * count($user_usage);
$total_hours_capacity_all = $working_days_count / 2 * dPgetConfig('daily_working_hours') * count($user_list);
}
示例6: array
$order = array(array('key' => 'valutaDate', 'dir' => 'asc'));
foreach ($accountIds as $currentAccountId) {
$currentAccount = $accountManager->getAccountById($currentAccountId);
$filter = getDataGridFilter($currentAccount);
$currentAccount->setFilter($filter);
$currentAccount->setOrder($order);
while ($currentTransaction = $currentAccount->getNextTransaction()) {
$date = $currentTransaction->getValutaDate();
if (is_null($date)) {
continue;
}
switch ($type) {
case 'w':
$dateKey = $date->getYear() . '-' . sprintf('%02d', $date->getWeekOfYear());
$beginDate = new Date(Date_Calc::beginOfWeek($date->getDay(), $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
$endDate = new Date(Date_Calc::endOfWeek($date->getDay(), $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
break;
case 'm':
$dateKey = $date->getYear() . '-' . sprintf('%02d', $date->getMonth());
$beginDate = new Date(Date_Calc::beginOfMonth($date->getMonth(), $date->getYear(), '%Y-%m-%d'));
$endDate = new Date(Date_Calc::endOfMonthBySpan(0, $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
break;
case 'q':
$dateKey = $date->getYear() . '-' . $date->getQuarterOfYear();
switch ($date->getQuarterOfYear()) {
case 1:
$beginDate = new Date($date->getYear() . '-01-01');
$endDate = new Date($date->getYear() . '-03-31');
break;
case 2:
$beginDate = new Date($date->getYear() . '-04-01');
示例7: compare
compare('20001115', Date_Calc::prevDayOfWeek(3, 22, 11, 2000), 'prevDayOfWeek 2');
compare('20001122', Date_Calc::prevDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'prevDayOfWeek 3');
compare('20001122', Date_Calc::nextDayOfWeek(3, 22, 11, 2000, '%Y%m%d', true), 'nextDayOfWeek 1');
compare('20001129', Date_Calc::nextDayOfWeek(3, 22, 11, 2000), 'nextDayOfWeek 2');
compare('20001123', Date_Calc::nextDayOfWeek(4, 22, 11, 2000), 'nextDayOfWeek 3');
compare('20001123', Date_Calc::nextDayOfWeek('4', '22', '11', '2000'), 'nextDayOfWeek 3 str');
compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore('2', '22', '11', '2000'), 'prevDayOfWeekOnOrBefore 1 str');
compare('20001121', Date_Calc::prevDayOfWeekOnOrBefore(2, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 1');
compare('20001122', Date_Calc::prevDayOfWeekOnOrBefore(3, 22, 11, 2000), 'prevDayOfWeekOnOrBefore 2');
compare('20001122', Date_Calc::nextDayOfWeekOnOrAfter(3, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 1');
compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter(4, 22, 11, 2000), 'nextDayOfWeekOnOrAfter 2');
compare('20001123', Date_Calc::nextDayOfWeekOnOrAfter('4', '22', '11', '2000'), 'nextDayOfWeekOnOrAfter 2 str');
compare('20001120', Date_Calc::beginOfWeek('22', '11', '2000'), 'beginOfWeek str');
compare('20001120', Date_Calc::beginOfWeek(22, 11, 2000), 'beginOfWeek');
compare('20001126', Date_Calc::endOfWeek(22, 11, 2000), 'endOfWeek');
compare('20001126', Date_Calc::endOfWeek('22', '11', '2000'), 'endOfWeek str');
compare('20001113', Date_Calc::beginOfPrevWeek(22, 11, 2000), 'beginOfPrevWeek');
compare('20001127', Date_Calc::beginOfNextWeek(22, 11, 2000), 'beginOfNextWeek');
compare('20001113', Date_Calc::beginOfPrevWeek('22', '11', '2000'), 'beginOfPrevWeek str');
compare('20001127', Date_Calc::beginOfNextWeek('22', '11', '2000'), 'beginOfNextWeek str');
compare('20001101', Date_Calc::beginOfMonth(11, 2000), 'beginOfMonth');
compare('20001101', Date_Calc::beginOfMonth('11', '2000'), 'beginOfMonth str');
compare('20001001', Date_Calc::beginOfPrevMonth(22, 11, 2000), 'beginOfPrevMonth');
compare('20001031', Date_Calc::endOfPrevMonth(22, 11, 2000), 'endOfPrevMonth');
compare('20001001', Date_Calc::beginOfPrevMonth('22', '11', '2000'), 'beginOfPrevMonth str');
compare('20001031', Date_Calc::endOfPrevMonth('22', '11', '2000'), 'endOfPrevMonth str');
compare('20001201', Date_Calc::beginOfNextMonth(22, 11, 2000), 'beginOfNextMonth');
compare('20001231', Date_Calc::endOfNextMonth(22, 11, 2000), 'endOfNextMonth');
compare('20001201', Date_Calc::beginOfNextMonth('22', '11', '2000'), 'beginOfNextMonth str');
compare('20001231', Date_Calc::endOfNextMonth('22', '11', '2000'), 'endOfNextMonth str');
compare('19991001', Date_Calc::beginOfMonthBySpan(-13, 11, 2000), 'beginOfMonthBySpan 1');