當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DateTime::isCorrect方法代碼示例

本文整理匯總了PHP中Bitrix\Main\Type\DateTime::isCorrect方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateTime::isCorrect方法的具體用法?PHP DateTime::isCorrect怎麽用?PHP DateTime::isCorrect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bitrix\Main\Type\DateTime的用法示例。


在下文中一共展示了DateTime::isCorrect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generateInitialData

 public static function generateInitialData(Date $from)
 {
     if (($to = Option::get('conversion', 'START_DATE_TIME', 'undefined')) != 'undefined' && DateTime::isCorrect($to, 'Y-m-d H:i:s') && ($to = new DateTime($to, 'Y-m-d H:i:s')) && $to->format('Y-m-d H:i:s') > $from->format('Y-m-d H:i:s') && Option::get('conversion', 'GENERATE_INITIAL_DATA', 'undefined') == 'undefined') {
         Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated');
         $context = new self();
         // generate data
         $data = array();
         foreach (EventManager::getInstance()->findEventHandlers('conversion', 'OnGenerateInitialData') as $handler) {
             $result = ExecuteModuleEventEx($handler, array($from, $to));
             // TODO validate
             foreach ($result as $row) {
                 $context->id = null;
                 $context->attributes = array();
                 $context->setAttributes($row['ATTRIBUTES']);
                 $context->save();
                 if ($dayCounters =& $data[$context->id]) {
                     self::appendDayCounters($dayCounters, $row['DAY_COUNTERS']);
                 } else {
                     $dayCounters = $row['DAY_COUNTERS'];
                 }
             }
         }
         unset($dayCounters);
         // save data to database
         $numerators = CounterManager::getTypes(array('GROUP' => 'day'));
         unset($numerators['conversion_visit_day']);
         foreach ($data as $id => $dayCounters) {
             $context->id = $id;
             foreach ($dayCounters as $day => $counters) {
                 $day = new Date($day, 'Y-m-d');
                 $visitSum = 0;
                 $visitQuantity = 0;
                 unset($counters['conversion_visit_day']);
                 foreach ($counters as $name => $value) {
                     $context->addCounter($day, $name, $value);
                     if ($numerators[$name]) {
                         $visitSum += $value;
                         $visitQuantity += 1;
                     }
                 }
                 $context->addCounter($day, 'conversion_visit_day', $visitQuantity ? round($visitSum / $visitQuantity * 100) + 1 : 1);
             }
         }
     }
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:45,代碼來源:generatorcontext.php

示例2: IncludeModuleLangFile

    $templateListHtml = \Bitrix\Sender\Preset\Template::getTemplateListHtml();
}
if ($step == 'chain_send_type') {
    $ID = $MAILING_CHAIN_ID;
    IncludeModuleLangFile(dirname(__FILE__) . "/mailing_chain_edit.php");
    $DAYS_OF_WEEK = empty($DAYS_OF_WEEK) ? '' : implode(',', $DAYS_OF_WEEK);
    if ($REQUEST_METHOD == "POST" && !$isPostedFormProcessed && check_bitrix_sessid()) {
        $arFields = array("REITERATE" => "N", "AUTO_SEND_TIME" => "", "DAYS_OF_WEEK" => "", "DAYS_OF_MONTH" => "", "TIMES_OF_DAY" => "");
        switch ($SEND_TYPE) {
            case 'MANUAL':
                break;
            case 'TIME':
                if (empty($AUTO_SEND_TIME)) {
                    $arError[] = GetMessage("sender_chain_edit_error_empty_time");
                }
                if (!\Bitrix\Main\Type\DateTime::isCorrect($AUTO_SEND_TIME)) {
                    $arError[] = GetMessage("sender_chain_edit_error_time_format");
                } else {
                    $arFields["AUTO_SEND_TIME"] = new \Bitrix\Main\Type\DateTime($AUTO_SEND_TIME);
                }
                if ($ID <= 0) {
                    $arFields["STATUS"] = \Bitrix\Sender\MailingChainTable::STATUS_SEND;
                } else {
                    $arMailingChainOld = \Bitrix\Sender\MailingChainTable::getRowById(array('ID' => $ID));
                    if ($arMailingChainOld['STATUS'] == \Bitrix\Sender\MailingChainTable::STATUS_NEW) {
                        $arFields["STATUS"] = \Bitrix\Sender\MailingChainTable::STATUS_SEND;
                    }
                }
                break;
            case 'REITERATE':
                if (empty($DAYS_OF_WEEK) && empty($DAYS_OF_MONTH)) {
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:mailing_wizard.php


注:本文中的Bitrix\Main\Type\DateTime::isCorrect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。