当前位置: 首页>>代码示例>>PHP>>正文


PHP Date_Calc::beginOfWeek方法代码示例

本文整理汇总了PHP中Date_Calc::beginOfWeek方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::beginOfWeek方法的具体用法?PHP Date_Calc::beginOfWeek怎么用?PHP Date_Calc::beginOfWeek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Date_Calc的用法示例。


在下文中一共展示了Date_Calc::beginOfWeek方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _render

 protected function _render(Horde_Date $day = null)
 {
     $this->_start = new Horde_Date(Date_Calc::beginOfWeek($day->mday, $day->month, $day->year, '%Y%m%d000000'));
     $this->_end = new Horde_Date($this->_start);
     $this->_end->hour = 23;
     $this->_end->min = $this->_end->sec = 59;
     $this->_end->mday += $this->_days - 1;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:8,代码来源:Week.php

示例2: beginOfNextWeek

 /**
  * Find the month day of the beginning of week after given date,
  * using DATE_CALC_BEGIN_WEEKDAY
  *
  * Can return weekday of prev month.
  *
  * @param int    $day    the day of the month, default is current local day
  * @param int    $month  the month, default is current local month
  * @param int    $year   the year in four digit format, default is current
  *                        local year
  * @param string $format the string indicating how to format the output
  *
  * @return   string     the date in the desired format
  * @access   public
  * @static
  */
 function beginOfNextWeek($day = 0, $month = 0, $year = null, $format = DATE_CALC_FORMAT)
 {
     if (is_null($year)) {
         $year = Date_Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow('%d');
     }
     list($hn_pwyear, $hn_pwmonth, $hn_pwday) = explode(" ", Date_Calc::daysToDate(Date_Calc::dateToDays($day, $month, $year) + 7, '%Y %m %d'));
     return Date_Calc::beginOfWeek($hn_pwday, $hn_pwmonth, $hn_pwyear, $format);
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:30,代码来源:Calc.php

示例3: _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>&nbsp;</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>";
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:21,代码来源:calendar.class.php

示例4: 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 . '">&nbsp;</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);
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:39,代码来源:cleanup_functions.php

示例5: beginOfNextWeek

 /**
  * Find the month day of the beginning of week after given date,
  * using DATE_CALC_BEGIN_WEEKDAY
  *
  * Can return weekday of prev month.
  *
  * @param int    $day     the day of the month, default is current local day
  * @param int    $month   the month, default is current local month
  * @param int    $year    the year in four digit format, default is current local year
  * @param string $format  the string indicating how to format the output
  *
  * @return string  the date in the desired format
  *
  * @access public
  * @static
  */
 function beginOfNextWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT)
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow('%d');
     }
     $date = Date_Calc::daysToDate(Date_Calc::dateToDays($day + 7, $month, $year), '%Y%m%d');
     $next_week_year = substr($date, 0, 4);
     $next_week_month = substr($date, 4, 2);
     $next_week_day = substr($date, 6, 2);
     return Date_Calc::beginOfWeek($next_week_day, $next_week_month, $next_week_year, $format);
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:33,代码来源:Calc.php

示例6: array

$endDates = 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:
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:31,代码来源:timespan.php

示例7: getCalendarWeek

 /**
  * Return an array with days in week
  *
  * @param string day in format DD, default is current local day
  * @param string month in format MM, default is current local month
  * @param string year in format CCYY, default is current local year
  * @param string format for returned date
  *
  * @access public
  *
  * @return array $week[$weekday]
  */
 function getCalendarWeek($day = '', $month = '', $year = '', $format = '%Y%m%d')
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow('%d');
     }
     $week_array = array();
     // date for the column of week
     $curr_day = Date_Calc::beginOfWeek($day, $month, $year, '%E');
     for ($counter = 0; $counter <= 6; $counter++) {
         $week_array[$counter] = Date_Calc::daysToDate($curr_day, $format);
         $curr_day++;
     }
     return $week_array;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:32,代码来源:Calc.php

示例8: w2PgetParam

}
$company_id = $AppUI->getState('CalIdxCompany') !== null ? $AppUI->getState('CalIdxCompany') : $AppUI->user_company;
// 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();
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:week_view.php

示例9: w2PgetParam

$company_id = $AppUI->processIntState('CalIdxCompany', $_REQUEST, 'company_id', $AppUI->user_company);
$event_filter = $AppUI->checkPrefState('CalIdxFilter', w2PgetParam($_REQUEST, 'event_filter', ''), 'EVENTFILTER', 'my');
$tab = $AppUI->processIntState('CalDayViewTab', $_GET, 'tab', isset($tab) ? $tab : 0);
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
// get the passed timestamp (today if none)
$ctoday = new w2p_Utilities_Date();
$today = $ctoday->format(FMT_TIMESTAMP_DATE);
$date = (int) w2PgetParam($_GET, 'date', $today);
// establish the focus 'date'
$this_day = new w2p_Utilities_Date($date);
$dd = $this_day->getDay();
$mm = $this_day->getMonth();
$yy = $this_day->getYear();
// get current week
$this_week = Date_Calc::beginOfWeek($dd, $mm, $yy, FMT_TIMESTAMP_DATE, LOCALE_FIRST_DAY);
// prepare time period for 'events'
$first_time = clone $this_day;
$first_time->setTime(0, 0, 0);
$last_time = clone $this_day;
$last_time->setTime(23, 59, 59);
$prev_day = new w2p_Utilities_Date(Date_Calc::prevDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE));
$next_day = new w2p_Utilities_Date(Date_Calc::nextDay($dd, $mm, $yy, FMT_TIMESTAMP_DATE));
// get the list of visible companies
$company = new CCompany();
global $companies;
$companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$companies = arrayMerge(array('0' => $AppUI->_('All')), $companies);
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('Day View', 'icon.png', $m);
$titleBlock->addCrumb('?m=events&a=year_view&date=' . $this_day->format(FMT_TIMESTAMP_DATE), 'year view');
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:day_view.php

示例10: 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];
开发者ID:Artea,项目名称:freebeer,代码行数:31,代码来源:bug674.php

示例11: _getSpanDates

 /**
  * A private method that returns the start and end dates
  * that bound the span, based based on a pre-defined 'friendly'
  * value.
  *
  * See the {@link OA_Admin_DaySpan::setSpanPresetValue()} method
  * for the pre-defined values.
  *
  * @param string $presetValue The preset value string.
  * @return array An array of two elements, "start" and "end",
  *               representing the start and end dates of
  *               the span, respectively.
  */
 function _getSpanDates($presetValue)
 {
     switch ($presetValue) {
         case 'today':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'yesterday':
             $oDateStart = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::prevDay($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'this_week':
             $oDateStart = new Date(Date_Calc::beginOfWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'last_week':
             $oDateStart = new Date(Date_Calc::beginOfPrevWeek($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oSixDaySpan = new Date_Span();
             $oSixDaySpan->setFromDays(6);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             // Now have week start and end when week starts on Sunday
             // Does the user want to start on a different day?
             $beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
             if ($beginOfWeek > 0) {
                 $oRequiredDaysSpan = new Date_Span();
                 $oRequiredDaysSpan->setFromDays($beginOfWeek);
                 $oDateStart->addSpan($oRequiredDaysSpan);
                 $oDateToday = new Date($this->oNowDate->format('%Y-%m-%d'));
                 if ($oDateToday->getDayOfWeek() < $beginOfWeek) {
                     $oDateStart->subtractSpan($oSevenDaySpan);
                 }
             }
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd->copy($oDateStart);
             $oDateEnd->addSpan($oSixDaySpan);
             break;
         case 'last_7_days':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oSevenDaySpan = new Date_Span();
             $oSevenDaySpan->setFromDays(7);
             $oDateStart->subtractSpan($oSevenDaySpan);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date($this->oNowDate->format('%Y-%m-%d'));
             break;
         case 'this_month_full':
             $oDateStart = new Date(Date_Calc::beginOfMonth($this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'this_month_remainder':
             $oDateStart = new Date($this->oNowDate->format('%Y-%m-%d'));
             $oDateEnd = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oOneDaySpan = new Date_Span();
             $oOneDaySpan->setFromDays(1);
             $oDateEnd->subtractSpan($oOneDaySpan);
             break;
         case 'next_month':
             $oDateStart = new Date(Date_Calc::beginOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             $oDateEnd = new Date(Date_Calc::endOfNextMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
             break;
         case 'last_month':
             $oDateStart = new Date(Date_Calc::beginOfPrevMonth($this->oNowDate->format('%d'), $this->oNowDate->format('%m'), $this->oNowDate->format('%Y')));
//.........这里部分代码省略.........
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:DaySpan.php

示例12: MakeRecurrences

 public function MakeRecurrences()
 {
     global $_EV_CONF;
     $days_on = $this->event->rec_data['listdays'];
     $occurrence = $this->dt_start;
     $num_intervals = count($days_on);
     $last_interval = $days_on[$num_intervals - 1];
     // Start by reducing the starting date by one day. Then the for
     // loop can handle all the events.
     list($y, $m, $d) = explode('-', $occurrence);
     $occurrence = Date_Calc::prevDay($d, $m, $y);
     $count = 1;
     while ($occurrence <= $this->event->rec_data['stop'] && $occurrence >= '1971-01-01' && $count < $_EV_CONF['max_repeats']) {
         foreach ($days_on as $dow) {
             list($y, $m, $d) = explode('-', $occurrence);
             $occurrence = Date_Calc::nextDayOfWeek($dow - 1, $d, $m, $y);
             // Stop when we hit the stop date
             if ($occurrence > $this->event->rec_data['stop']) {
                 break;
             }
             $this->storeEvent($occurrence);
             $count++;
             if ($count > $_EV_CONF['max_repeats']) {
                 break;
             }
         }
         // foreach days_on
         if ($this->freq > 1) {
             // Get the beginning of this week, and add $freq weeks to it
             $occurrence = Date_Calc::beginOfWeek($d + 7 * $this->freq, $m, $y);
         }
     }
     // while not at stop date
     return $this->events;
 }
开发者ID:matrox66,项目名称:evlist,代码行数:35,代码来源:evRecur.class.php

示例13: getCalendarWeek

 /**
  * Return an array with days in week
  *
  * @param string year in format CCYY, default current local year
  * @param string month in format MM, default current local month
  * @param string day in format DD, default current local day
  * @param string format for returned date
  *
  * @access public
  *
  * @return array $week[$weekday]
  */
 public static function getCalendarWeek($day = "", $month = "", $year = "", $format = "%Y%m%d", $fdow = 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");
     }
     if ($fdow === null) {
         $fdow = DATE_CALC_BEGIN_WEEKDAY;
     }
     $week_array = array();
     // date for the column of week
     $curr_day = Date_Calc::beginOfWeek($day, $month, $year, "%E", $fdow);
     for ($counter = 0; $counter <= 6; $counter++) {
         $week_array[$counter] = Date_Calc::daysToDate($curr_day, $format);
         $curr_day++;
     }
     return $week_array;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:35,代码来源:Calc.php

示例14: 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 . '">&nbsp;</div>';
            				} else {
            					$table_rows .= '&nbsp;';
            				} 
            				$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 . '">&nbsp;</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);
}
开发者ID:srinivasulurao,项目名称:jonel,代码行数:72,代码来源:allocateduserhours.php

示例15: getCalendarWeek

 /**
  * Return an array with days in week
  *
  * @param string year in format CCYY, default current local year
  * @param string month in format MM, default current local month
  * @param string day in format DD, default current local day
  * @param string format for returned date
  *
  * @access public
  *
  * @return array $week[$weekday]
  */
 function getCalendarWeek($day = "", $month = "", $year = "", $format = "%Y%m%d")
 {
     if (empty($year)) {
         $year = Date_Calc::dateNow("%Y");
     }
     if (empty($month)) {
         $month = Date_Calc::dateNow("%m");
     }
     if (empty($day)) {
         $day = Date_Calc::dateNow("%d");
     }
     $week_array = array();
     // date for the column of week
     $curr_day = Date_Calc::beginOfWeek($day, $month, $year, "%E");
     for ($counter = 0; $counter <= 6; $counter++) {
         $week_array[$counter] = Date_Calc::daysToDate($curr_day, $format);
         $curr_day++;
     }
     return $week_array;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:32,代码来源:Calc.php


注:本文中的Date_Calc::beginOfWeek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。