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


PHP Date_Calc::beginOfNextMonth方法代码示例

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


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

示例1: setDate

 /**
  * CMonthCalendar::setDate()
  *
  * { Description }
  *
  * @param [type] $date
  */
 function setDate($date = null)
 {
     $this->this_month = new CDate($date);
     $d = $this->this_month->getDay();
     $m = $this->this_month->getMonth();
     $y = $this->this_month->getYear();
     $this->prev_year = new CDate($date);
     $this->prev_year->setYear($this->prev_year->getYear() - 1);
     $this->next_year = new CDate($date);
     $this->next_year->setYear($this->next_year->getYear() + 1);
     setlocale(LC_TIME, 'en_AU');
     $date = Date_Calc::beginOfPrevMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     setlocale(LC_ALL, $AppUI->user_lang);
     $this->prev_month = new CDate($date);
     setlocale(LC_TIME, 'en_AU');
     $date = Date_Calc::beginOfNextMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     setlocale(LC_ALL, $AppUI->user_lang);
     $this->next_month = new CDate($date);
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:26,代码来源:calendar.class.php

示例2: db_message_is_message_list4date

/**
 * 指定された年月にメッセージを送受信した日のリストを返す
 */
function db_message_is_message_list4date($u, $year, $month, $box)
{
    include_once 'Date/Calc.php';
    if ($box == 'inbox' || !$box) {
        $where = "c_member_id_to = ?" . " AND is_deleted_to = 0" . " AND is_send = 1";
    } elseif ($box == 'outbox') {
        $where = "c_member_id_from = ?" . " AND is_deleted_from = 0" . " AND is_send = 1";
    } else {
        return null;
    }
    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
        $sql = "SELECT DISTINCT date_part('day', r_datetime) FROM c_message" . " WHERE {$where}" . ' AND is_send=1 AND r_datetime >= ? AND r_datetime < ?';
    } else {
        $sql = 'SELECT DISTINCT DAYOFMONTH(r_datetime) FROM c_message' . " WHERE {$where}" . ' AND is_send=1 AND r_datetime >= ? AND r_datetime < ?';
    }
    $date_format = '%Y-%m-%d 00:00:00';
    $thismonth = Date_Calc::beginOfMonth($month, $year, $date_format);
    $nextmonth = Date_Calc::beginOfNextMonth(0, $month, $year, $date_format);
    $params = array(intval($u), $thismonth, $nextmonth);
    return db_get_col($sql, $params);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:24,代码来源:message.php

示例3: postcalendar_calendarblock_display

/**
 * display block
 */
function postcalendar_calendarblock_display($blockinfo)
{
    // You supposed to be here?
    if (!pnSecAuthAction(0, 'PostCalendar:calendarblock:', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) {
        return false;
    }
    // find out what view we're using
    $template_view = pnVarCleanFromInput('tplview');
    if (!isset($template_view)) {
        $template_view = 'default';
    }
    // find out what template we're using
    $template_name = _SETTING_TEMPLATE;
    if (!isset($template_name) || empty($template_name)) {
        $template_name = 'default';
    }
    // What is today's correct date
    $Date =& postcalendar_getDate();
    // Get variables from content block
    $vars = unserialize($blockinfo['content']);
    $showcalendar = $vars['pcbshowcalendar'];
    $showevents = $vars['pcbeventoverview'];
    $eventslimit = $vars['pcbeventslimit'];
    $nextevents = $vars['pcbnextevents'];
    $pcbshowsslinks = $vars['pcbshowsslinks'];
    $pcbeventsrange = $vars['pcbeventsrange'];
    // Let's setup the info to build this sucka!
    $the_year = substr($Date, 0, 4);
    $the_month = substr($Date, 4, 2);
    $the_day = substr($Date, 6, 2);
    $uid = pnUserGetVar('uid');
    $cacheid1 = $cacheid2 = $cacheid3 = '';
    $theme = pnUserGetTheme();
    pnThemeLoad($theme);
    global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
    global $textcolor1, $textcolor2;
    // 20021125 - rraymond :: we have to do this to make it work with envolution
    $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
    $pcDir = pnVarPrepForOS($pcModInfo['directory']);
    require_once "modules/{$pcDir}/pnincludes/Smarty/Config_File.class.php";
    unset($pcModInfo);
    // set up Smarty
    $tpl =& new pcSmarty();
    // setup the Smarty cache id
    $templates_cached = true;
    if ($showcalendar) {
        $cacheid1 = md5($Date . 'M' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme);
        if (!$tpl->is_cached($template_name . '/views/calendarblock/month_view.html', $cacheid1)) {
            $templates_cached = false;
        }
    }
    if ($showevents) {
        $cacheid2 = md5($Date . 'T' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme);
        if (!$tpl->is_cached($template_name . '/views/calendarblock/todays_events.html', $cacheid2)) {
            $templates_cached = false;
        }
    }
    if ($nextevents) {
        $cacheid3 = md5($Date . 'U' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme);
        if (!$tpl->is_cached($template_name . '/views/calendarblock/upcoming_events.html', $cacheid3)) {
            $templates_cached = false;
        }
    }
    // start the output container
    $output = pnModAPIFunc(__POSTCALENDAR__, 'user', 'pageSetup');
    // if one of the templates is not cached, we need to run the following
    if (!$templates_cached) {
        // set up the next and previous months to move to
        $prev_month = Date_Calc::beginOfPrevMonth(1, $the_month, $the_year, '%Y%m%d');
        $next_month = Date_Calc::beginOfNextMonth(1, $the_month, $the_year, '%Y%m%d');
        $last_day = Date_Calc::daysInMonth($the_month, $the_year);
        $pc_prev = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $prev_month));
        $pc_next = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $next_month));
        $pc_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $the_month, $the_day, $the_year)));
        $month_link_url = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => date('Ymd', mktime(0, 0, 0, $the_month, 1, $the_year))));
        $month_link_text = $pc_month_name . ' ' . $the_year;
        //*******************************************************************
        //  Here we get the events for the current month view
        //*******************************************************************
        $day_of_week = 1;
        $pc_month_names = array(_CALJAN, _CALFEB, _CALMAR, _CALAPR, _CALMAY, _CALJUN, _CALJUL, _CALAUG, _CALSEP, _CALOCT, _CALNOV, _CALDEC);
        $pc_short_day_names = array(_CALSUNDAYSHORT, _CALMONDAYSHORT, _CALTUESDAYSHORT, _CALWEDNESDAYSHORT, _CALTHURSDAYSHORT, _CALFRIDAYSHORT, _CALSATURDAYSHORT);
        $pc_long_day_names = array(_CALSUNDAY, _CALMONDAY, _CALTUESDAY, _CALWEDNESDAY, _CALTHURSDAY, _CALFRIDAY, _CALSATURDAY);
        switch (_SETTING_FIRST_DAY_WEEK) {
            case _IS_MONDAY:
                $pc_array_pos = 1;
                $first_day = date('w', mktime(0, 0, 0, $the_month, 0, $the_year));
                $end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year));
                if ($end_dow != 0) {
                    $the_last_day = $last_day + (7 - $end_dow);
                } else {
                    $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));
//.........这里部分代码省略.........
开发者ID:juggernautsei,项目名称:openemr,代码行数:101,代码来源:calendar.php

示例4: setDate

 /**
  * CMonthCalendar::setDate()
  *
  * { Description }
  *
  * @param [type] $date
  */
 function setDate($date = null)
 {
     $this->this_month = new CDate($date);
     $d = $this->this_month->getDay();
     $m = $this->this_month->getMonth();
     $y = $this->this_month->getYear();
     //$date = Date_Calc::beginOfPrevMonth( $d, $m, $y-1, FORMAT_ISO );
     $this->prev_year = new CDate($date);
     $this->prev_year->setYear($this->prev_year->getYear() - 1);
     $this->next_year = new CDate($date);
     $this->next_year->setYear($this->next_year->getYear() + 1);
     $date = Date_Calc::beginOfPrevMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     $this->prev_month = new CDate($date);
     $date = Date_Calc::beginOfNextMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     $this->next_month = new CDate($date);
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:23,代码来源:calendar.class.php

示例5: postcalendar_userapi_buildView


//.........这里部分代码省略.........
        //=================================================================
        if ($viewtype != 'year') {
            $eventsByDate =& postcalendar_userapi_pcGetEvents(array('start' => $starting_date, 'end' => $ending_date, 'viewtype' => $viewtype, 'provider_id' => $provIDs));
        } else {
            $eventsByDate = array();
        }
        //=================================================================
        //  Create an array with the day names in the correct order
        //=================================================================
        $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++;
        }
        unset($numDays);
        $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++;
        }
        unset($numDays);
        //=================================================================
        //  Prepare some values for the template
        //=================================================================
        $prev_month = Date_Calc::beginOfPrevMonth(1, $the_month, $the_year, '%Y%m%d');
        $next_month = Date_Calc::beginOfNextMonth(1, $the_month, $the_year, '%Y%m%d');
        $pc_prev = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $prev_month, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $pc_next = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $next_month, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $prev_day = Date_Calc::prevDay($the_day, $the_month, $the_year, '%Y%m%d');
        $next_day = Date_Calc::nextDay($the_day, $the_month, $the_year, '%Y%m%d');
        $pc_prev_day = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $prev_day, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $pc_next_day = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $next_day, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $prev_week = date('Ymd', mktime(0, 0, 0, $week_first_day_month, $week_first_day_date - 7, $week_first_day_year));
        $next_week = date('Ymd', mktime(0, 0, 0, $week_last_day_month, $week_last_day_date + 1, $week_last_day_year));
        $pc_prev_week = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'week', 'Date' => $prev_week, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $pc_next_week = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'week', 'Date' => $next_week, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $prev_year = date('Ymd', mktime(0, 0, 0, 1, 1, $the_year - 1));
        $next_year = date('Ymd', mktime(0, 0, 0, 1, 1, $the_year + 1));
        $pc_prev_year = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'year', 'Date' => $prev_year, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        $pc_next_year = pnModURL(__POSTCALENDAR__, 'user', 'view', array('viewtype' => 'year', 'Date' => $next_year, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic));
        //=================================================================
        //  Populate the template
        //=================================================================
        $all_categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
        if (isset($calendarView)) {
            $tpl->assign_by_ref('CAL_FORMAT', $calendarView);
        }
        if ($viewtype == "week") {
            $last_blocks = array();
            foreach ($eventsByDate as $cdate => $day) {
                $tblock = array_reverse($day['blocks']);
                $last_blocks[$cdate] = count($tblock) - 1;
                for ($i = 0; $i < count($tblock); $i++) {
                    if (!empty($tblock[$i])) {
                        $last_blocks[$cdate] = count($tblock) - $i;
                        break;
                    }
                }
开发者ID:bradymiller,项目名称:openemr,代码行数:67,代码来源:pnuserapi.php

示例6: _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

示例7: setDate

 /**
  * CMonthCalendar::setDate()
  *
  * { Description }
  *
  * @param [type] $date
  */
 function setDate($date = null)
 {
     global $AppUI, $locale_char_set;
     $this->this_month = new CDate($date);
     $d = $this->this_month->getDay();
     $m = $this->this_month->getMonth();
     $y = $this->this_month->getYear();
     $this->prev_year = new CDate($date);
     $this->prev_year->setYear($this->prev_year->getYear() - 1);
     $this->next_year = new CDate($date);
     $this->next_year->setYear($this->next_year->getYear() + 1);
     setlocale(LC_ALL, 'en_AU' . ($locale_char_set ? '.' . $locale_char_set : '.utf8'));
     $date = Date_Calc::beginOfPrevMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     setlocale(LC_ALL, $AppUI->user_lang);
     $this->prev_month = new CDate($date);
     setlocale(LC_ALL, 'en_AU' . ($locale_char_set ? '.' . $locale_char_set : '.utf8'));
     $date = Date_Calc::beginOfNextMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     setlocale(LC_ALL, $AppUI->user_lang);
     $this->next_month = new CDate($date);
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:27,代码来源:calendar.class.php

示例8: getConversions

 /**
  * Returns an array of conversions.
  *
  * @param array $aParams
  * @return array
  */
 function getConversions($aParams)
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $oDbh =& OA_DB::singleton();
     $where = '';
     if (!empty($aParams['day'])) {
         $aParams['day_begin'] = $aParams['day_end'] = $aParams['day'];
     }
     if (!empty($aParams['day_begin'])) {
         $oStart = new Date($aParams['day_begin']);
         $oStart->setHour(0);
         $oStart->setMinute(0);
         $oStart->setSecond(0);
         $oStart->toUTC();
         $where .= ' AND ac.tracker_date_time >= ' . $oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
     }
     if (!empty($aParams['day_end'])) {
         $oEnd = new Date($aParams['day_end']);
         $oEnd->setHour(23);
         $oEnd->setMinute(59);
         $oEnd->setSecond(59);
         $oEnd->toUTC();
         $where .= ' AND ac.tracker_date_time <= ' . $oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
     }
     if (!empty($aParams['month'])) {
         $oStart = new Date("{$aParams['month']}-01");
         $oStart->setHour(0);
         $oStart->setMinute(0);
         $oStart->setSecond(0);
         $oEnd = new Date(Date_Calc::beginOfNextMonth($oStart->getDay(), $oStart->getMonth, $oStart->getYear(), '%Y-%m-%d'));
         $oEnd->setHour(0);
         $oEnd->setMinute(0);
         $oEnd->setSecond(0);
         $oEnd->subtractSeconds(1);
         $oStart->toUTC();
         $oEnd->toUTC();
         $where .= ' AND ac.tracker_date_time >= ' . $oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
         $where .= ' AND ac.tracker_date_time <= ' . $oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
     }
     if (!empty($aParams['day_hour'])) {
         $oStart = new Date("{$aParams['day_hour']}:00:00");
         $oStart->setMinute(0);
         $oStart->setSecond(0);
         $oEnd = new Date($oStart);
         $oStart->setMinute(59);
         $oStart->setSecond(59);
         $where .= ' AND ac.tracker_date_time >= ' . $oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
         $where .= ' AND ac.tracker_date_time <= ' . $oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
     }
     if (!empty($aParams['agency_id'])) {
         $where .= ' AND c.agencyid=' . $oDbh->quote($aParams['agency_id'], 'integer');
     }
     if (!empty($aParams['clientid'])) {
         $where .= ' AND c.clientid=' . $oDbh->quote($aParams['clientid'], 'integer');
     }
     if (isset($aParams['zonesIds'])) {
         $where .= ' AND ac.zone_id IN (' . $oDbh->escape(implode(',', $aParams['zonesIds'])) . ")";
     }
     if (!empty($aParams['campaignid'])) {
         $where .= ' AND m.campaignid=' . $oDbh->quote($aParams['campaignid'], 'integer');
     }
     if (!empty($aParams['bannerid'])) {
         $where .= ' AND d.bannerid=' . $oDbh->quote($aParams['bannerid'], 'integer');
     }
     if (!empty($aParams['statuses'])) {
         $where .= ' AND ac.connection_status IN (' . $oDbh->escape(implode(',', $aParams['statuses'])) . ')';
     }
     if (isset($aParams['startRecord']) && is_numeric($aParams['startRecord']) && is_numeric($aParams['perPage'])) {
         $limit = ' LIMIT ' . $oDbh->quote($aParams['perPage'], 'text', false) . ' OFFSET ' . $oDbh->quote($aParams['startRecord'], 'text', false);
     } elseif (!empty($aParams['perPage'])) {
         $limit = ' LIMIT ' . $oDbh->quote($aParams['perPage'], 'integer', false) . ' OFFSET 0';
     } else {
         $limit = '';
     }
     $query = "SELECT\n            ac.data_intermediate_ad_connection_id as connection_id,\n            c.clientid,\n            m.campaignid,\n            m.campaignname AS campaignname,\n            ac.tracker_id as tracker_id,\n            ac.connection_status,\n            ac.connection_date_time AS connection_date_time,\n            ac.tracker_date_time as date_time,\n            t.trackername,\n            ac.tracker_ip_address,\n            ac.tracker_country,\n            ac.connection_action,\n            t.type AS connection_type,\n            ac.tracker_country,\n            ac.ad_id,\n            ac.creative_id,\n            ac.zone_id,\n            ac.comments\n        FROM\n            {$conf['table']['prefix']}{$conf['table']['clients']} AS c,\n            {$conf['table']['prefix']}{$conf['table']['data_intermediate_ad_connection']} AS ac,\n            {$conf['table']['prefix']}{$conf['table']['banners']} AS d,\n            {$conf['table']['prefix']}{$conf['table']['campaigns']} AS m,\n            {$conf['table']['prefix']}{$conf['table']['trackers']} AS t\n        WHERE\n            c.clientid=m.clientid\n            AND m.campaignid=d.campaignid\n            AND d.bannerid=ac.ad_id\n            AND t.trackerid=ac.tracker_id\n            AND ac.inside_window = 1\n            " . $where . "\n        ORDER BY\n            ac.tracker_date_time\n        {$limit}";
     $aStats = $oDbh->queryAll($query, null, MDB2_FETCHMODE_DEFAULT, true);
     $oNow = new Date();
     foreach (array_keys($aStats) as $k) {
         $oDate = new Date($aStats[$k]['date_time']);
         $oDate->setTZbyID('UTC');
         $oDate->convertTZ($oNow->tz);
         $aStats[$k]['date_time'] = $oDate->format('%Y-%m-%d %H:%M:%S');
         $oDate = new Date($aStats[$k]['connection_date_time']);
         $oDate->setTZbyID('UTC');
         $oDate->convertTZ($oNow->tz);
         $aStats[$k]['connection_date_time'] = $oDate->format('%Y-%m-%d %H:%M:%S');
     }
     return $aStats;
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:95,代码来源:Admin_DA.php

示例9: drawTitle

 /**
  * Draw the calendar's title bar
  *
  * @param day
  * @param month
  * @param year
  *
  * @access public
  * @return string of the rendered HTML
  */
 function drawTitle($day, $month, $year)
 {
     $rv = '';
     if ($this->_navLinks) {
         $path = $this->_path;
         if (!strchr($path, '?') && !strchr($this->_query, '?')) {
             $path .= '?';
         }
         $rv .= sprintf("<a href='%s'\n>&lt;&lt;</a>&nbsp;", $path . Date_Calc::beginOfMonth($month, $year - 1, $this->_query));
         $rv .= sprintf("<a href='%s'\n>&lt;</a>&nbsp;", $path . Date_Calc::beginOfPrevMonth($day, $month, $year, $this->_query));
     }
     $rv .= Date_Calc::dateFormat($day, $month, $year, $this->_options['title_format']);
     if ($this->_navLinks) {
         $rv .= sprintf("&nbsp;<a href='%s'\n>&gt;</a>", $path . Date_Calc::beginOfNextMonth($day, $month, $year, $this->_query));
         $rv .= sprintf("&nbsp;<a href='%s'\n>&gt;&gt;</a>", $path . Date_Calc::beginOfMonth($month, $year + 1, $this->_query));
     }
     return $rv;
 }
开发者ID:Artea,项目名称:freebeer,代码行数:28,代码来源:Calendar.php

示例10: b_weblog_calendar_show

 function b_weblog_calendar_show($options)
 {
     global $xoopsDB, $xoopsUser;
     global $xoopsConfig, $xoopsTpl;
     $mydirname = $options[0];
     include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/PEAR/Date/Calc.php';
     $currentuid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'E') : 0;
     if (is_object($xoopsUser)) {
         $useroffset = $xoopsUser->timezone() - $xoopsConfig['server_TZ'];
     } else {
         $useroffset = $xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ'];
     }
     // set when month
     $date = isset($_GET['date']) && strlen(intval($_GET['date'])) >= 6 ? intval($_GET['date']) : '';
     if ($date > 0) {
         $month = substr($date, 0, 6);
     } else {
         $month = date('Ym', time() + $useroffset * 3600);
     }
     // get next/previous month and year
     $this_year = substr(strval($month), 0, 4);
     $this_month = substr(strval($month), 4, 6);
     $month_next = Date_Calc::beginOfNextMonth('1', $this_month, $this_year, $format = '%Y%m');
     $month_prev = Date_Calc::beginOfPrevMonth('1', $this_month, $this_year, $format = '%Y%m');
     $year_next = strval($this_year + 1) . $this_month;
     $year_prev = strval($this_year - 1) . $this_month;
     if (file_exists(XOOPS_ROOT_PATH . '/language/' . $xoopsConfig["language"] . '/calendar.php')) {
         require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig["language"] . '/calendar.php';
     } else {
         require_once XOOPS_ROOT_PATH . '/language/english/calendar.php';
     }
     $month_arr = array(1 => _CAL_JANUARY, 2 => _CAL_FEBRUARY, 3 => _CAL_MARCH, 4 => _CAL_APRIL, 5 => _CAL_MAY, 6 => _CAL_JUNE, 7 => _CAL_JULY, 8 => _CAL_AUGUST, 9 => _CAL_SEPTEMBER, 10 => _CAL_OCTOBER, 11 => _CAL_NOVEMBER, 12 => _CAL_DECEMBER);
     $week_arr = array(_MB_WEBLOG_LANG_SUNDAY, _MB_WEBLOG_LANG_MONDAY, _MB_WEBLOG_LANG_TUESDAY, _MB_WEBLOG_LANG_WEDNESDAY, _MB_WEBLOG_LANG_THURSDAY, _MB_WEBLOG_LANG_FRIDAY, _MB_WEBLOG_LANG_SATURDAY);
     // get one month calendar array
     include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/class/class.calendar.php';
     $mycalendar = new MyCalendar($month);
     $calendar = $mycalendar->dispCalendar();
     $calendar['lang_monthPrev'] = _MB_WEBLOG_LANG_PREVMONTH;
     $calendar['lang_monthNext'] = _MB_WEBLOG_LANG_NEXTMONTH;
     $calendar['lang_yearPrev'] = _MB_WEBLOG_LANG_PREVYEAR;
     $calendar['lang_yearNext'] = _MB_WEBLOG_LANG_NEXTYEAR;
     $calendar['lang_month'] = $month_arr[intval($calendar['month'])];
     $calendar['lang_ShowPrevMonth'] = _MB_WEBLOG_LANG_PREVMONTH_TITLE;
     $calendar['lang_ShowNextMonth'] = _MB_WEBLOG_LANG_NEXTMONTH_TITLE;
     $calendar['lang_ShowPrevYear'] = _MB_WEBLOG_LANG_PREVYEAR_TITLE;
     $calendar['lang_ShowNextYear'] = _MB_WEBLOG_LANG_NEXTYEAR_TITLE;
     $calendar['lang_ShowThisMonth'] = _MB_WEBLOG_LANG_THIS_MONTH_TITLE;
     $calendar['dayofweek'] = $week_arr;
     // override
     $calendar['monthThis'] = $this_year . $this_month;
     $calendar['monthPrev'] = $month_prev;
     $calendar['monthNext'] = $month_next;
     $calendar['yearPrev'] = $year_prev;
     $calendar['yearNext'] = $year_next;
     // add xoops_block_header for css file
     $xoops_block_header = $xoopsTpl->get_template_vars('xoops_block_header');
     $xoops_block_header .= '<link rel="stylesheet" type="text/css" media="screen" href="' . XOOPS_URL . '/modules/' . $mydirname . '/weblog_block.css" />';
     $xoopsTpl->assign('xoops_block_header', $xoops_block_header);
     if (!empty($_SERVER['QUERY_STRING'])) {
         if (ereg("^calMonth=[0-9]{10}\$", $_SERVER['QUERY_STRING'])) {
             $query_string = "?";
         } else {
             $query_string = "?" . preg_replace("/(.*)\\&calMonth=[0-9]{10}\$/", "\$1", $_SERVER['QUERY_STRING']) . "&";
         }
     } else {
         $query_string = "?";
     }
     $calendar['action_url'] = $_SERVER['PHP_SELF'] . $query_string;
     // set the month
     $yearmonth = date('Ym', $calendar['monthThis']);
     $calendar['yearmonth'] = $yearmonth;
     // get entries of the month
     $sql = "select FROM_UNIXTIME(created+" . $useroffset * 3600 . ", '%d') as day, blog_id from " . $xoopsDB->prefix($mydirname);
     $sql .= " where (FROM_UNIXTIME(created+" . $useroffset * 3600 . ", '%Y%m') = " . $month . ") ";
     $sql .= " AND (private='N' or (private='Y' and user_id={$currentuid}))";
     $sql .= " group by day ";
     $sql .= " order by day ASC";
     //echo $sql ;
     $lines = $xoopsDB->query($sql);
     $entries = array();
     if ($lines) {
         while (list($day, $blog_id) = $xoopsDB->fetchRow($lines)) {
             //			$entries[$blog_id] = intval($day);
             $entries[intval($day)] = $this_year . $this_month . $day;
         }
     } else {
         return $block['calendar'] = $calendar;
     }
     $days = array_keys($entries);
     // make array of day
     //	$counts = array_count_values($days);	// make day=>count array
     //	$entries = array_flip($entries);		// make day=>blog_id array
     // week number of 1st day of this month
     $firstcol = date("w", mktime(0, 0, 0, $this_month, 1, $this_year));
     // insert entry count corresponding to the day
     foreach ($entries as $day => $yyyymmdd) {
         $row = ceil(($day + $firstcol) / 7) - 1;
         $col = date("w", mktime(0, 0, 0, $this_month, $day, $this_year));
         $calendar['details'][$row][$col] = $yyyymmdd;
     }
//.........这里部分代码省略.........
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:101,代码来源:weblog_archive.php

示例11: p_h_diary_is_diary_written_list4date

/**
 * 指定された年月に日記を書いている日のリストを返す
 */
function p_h_diary_is_diary_written_list4date($year, $month, $c_member_id, $u = null)
{
    include_once 'Date/Calc.php';
    $pf_cond = db_diary_public_flag_condition($c_member_id, $u);
    if ($GLOBALS['_OPENPNE_DSN_LIST']['main']['dsn']['phptype'] == 'pgsql') {
        $sql = "SELECT DISTINCT date_part('day', r_datetime) FROM c_diary" . " WHERE c_member_id = ? AND r_datetime >= ? AND r_datetime < ?" . $pf_cond;
    } else {
        $sql = 'SELECT DISTINCT DAYOFMONTH(r_datetime) FROM c_diary' . ' WHERE c_member_id = ? AND r_datetime >= ? AND r_datetime < ?' . $pf_cond;
    }
    $date_format = '%Y-%m-%d 00:00:00';
    $thismonth = Date_Calc::beginOfMonth($month, $year, $date_format);
    $nextmonth = Date_Calc::beginOfNextMonth(0, $month, $year, $date_format);
    $params = array(intval($c_member_id), $thismonth, $nextmonth);
    return db_get_col($sql, $params);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:18,代码来源:diary.php

示例12: setDate

 /**
  * CMonthCalendar::setDate()
  *
  * { Description }
  *
  * @param [type] $date
  */
 function setDate($date = null)
 {
     global $AppUI, $locale_char_set;
     $this->this_month = new CDate($date);
     $d = $this->this_month->getDay();
     $m = $this->this_month->getMonth();
     $y = $this->this_month->getYear();
     $this->prev_year = new CDate($date);
     $this->prev_year->setYear($this->prev_year->getYear() - 1);
     $this->next_year = new CDate($date);
     $this->next_year->setYear($this->next_year->getYear() + 1);
     $date = Date_Calc::beginOfPrevMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     $this->prev_month = new CDate($date);
     $date = Date_Calc::beginOfNextMonth($d, $m, $y, FMT_TIMESTAMP_DATE);
     $this->next_month = new CDate($date);
 }
开发者ID:slawekmikula,项目名称:dotproject,代码行数:23,代码来源:calendar.class.php

示例13: compare

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');
compare('20001001', Date_Calc::beginOfMonthBySpan(-1, 11, 2000), 'beginOfMonthBySpan 2');
compare('20001101', Date_Calc::beginOfMonthBySpan(0, 11, 2000), 'beginOfMonthBySpan 3');
compare('20001201', Date_Calc::beginOfMonthBySpan(1, 11, 2000), 'beginOfMonthBySpan 4');
compare('20011201', Date_Calc::beginOfMonthBySpan(13, 11, 2000), 'beginOfMonthBySpan 5');
compare('19990101', Date_Calc::beginOfMonthBySpan('-13', '02', '2000'), 'beginOfMonthBySpan 6 str');
compare('19990101', Date_Calc::beginOfMonthBySpan(-13, 2, 2000), 'beginOfMonthBySpan 6');
compare('20000101', Date_Calc::beginOfMonthBySpan(-1, 2, 2000), 'beginOfMonthBySpan 7');
compare('20000201', Date_Calc::beginOfMonthBySpan(0, 2, 2000), 'beginOfMonthBySpan 8');
compare('20000301', Date_Calc::beginOfMonthBySpan(1, 2, 2000), 'beginOfMonthBySpan 9');
compare('20010301', Date_Calc::beginOfMonthBySpan(13, 2, 2000), 'beginOfMonthBySpan 10');
compare('20010301', Date_Calc::beginOfMonthBySpan('13', '02', '2000'), 'beginOfMonthBySpan 10 str');
compare('19991031', Date_Calc::endOfMonthBySpan(-13, 11, 2000), 'endOfMonthBySpan 1');
compare('20001031', Date_Calc::endOfMonthBySpan(-1, 11, 2000), 'endOfMonthBySpan 2');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php


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