当前位置: 首页>>代码示例>>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;未经允许,请勿转载。