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


PHP CIntranetUtils::IsDateTime方法代码示例

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


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

示例1: tasksTaskEditAjaxHandler

function tasksTaskEditAjaxHandler()
{
    global $DB;
    if (isset($_POST['NAME_TEMPLATE'])) {
        $nameTemplate = $_POST['NAME_TEMPLATE'];
    } else {
        $nameTemplate = CSite::getNameFormat(false);
    }
    if (!check_bitrix_sessid()) {
        die;
    }
    switch ($_POST['action']) {
        case 'tasks_isUserMemberOfGroup':
            if (!CModule::IncludeModule('socialnetwork')) {
                throw new Exception($_POST['action'] . ': socialnetwork module failed to load.');
            }
            if (!isset($_POST['groupId']) || !isset($_POST['userId']) || $_POST['groupId'] < 0 || $_POST['userId'] < 0) {
                throw new Exception($_POST['action'] . ': invalid userId or groupId');
            }
            $rc = CSocNetUserToGroup::GetUserRole((int) $_POST['userId'], (int) $_POST['groupId']);
            if ($rc === false || $rc == SONET_ROLES_REQUEST) {
                echo 'N';
            } else {
                echo 'Y';
            }
            break;
        case 'getWarnings':
            if (isset($_POST['TASK']['RESPONSIBLE_ID'])) {
                $responsibleId = (int) $_POST['TASK']['RESPONSIBLE_ID'];
                $responsibleName = '#unknown user#';
                $rsUser = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $responsibleId), array('FIELDS' => array('NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN')));
                if ($arUser = $rsUser->fetch()) {
                    $responsibleName = CUser::FormatName($nameTemplate, array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"], "LOGIN" => $arUser["LOGIN"]), true, false);
                }
                if (isset($_POST['TASK']['GROUP_ID']) && $_POST['TASK']['GROUP_ID']) {
                    if (CModule::IncludeModule('socialnetwork')) {
                        $rc = CSocNetUserToGroup::GetUserRole($responsibleId, (int) $_POST['TASK']['GROUP_ID']);
                        if ($rc === false || $rc == SONET_ROLES_REQUEST) {
                            $arGroup = CSocNetGroup::GetByID($_POST['TASK']['GROUP_ID']);
                            echo '<div>' . htmlspecialcharsbx(str_replace(array('#FORMATTED_USER_NAME#', '#GROUP_NAME#'), array($responsibleName, $arGroup["NAME"]), GetMessage('TASKS_WARNING_RESPONSIBLE_NOT_IN_TASK_GROUP'))) . "</div>\n";
                        }
                    }
                }
                if (CModule::IncludeModule('intranet')) {
                    $dt = ConvertTimeStamp(false, 'SHORT');
                    $arAbsenceData = CIntranetUtils::GetAbsenceData(array('USERS' => array($responsibleId), 'DATE_START' => $dt, 'DATE_FINISH' => $dt, 'PER_USER' => false), $MODE = BX_INTRANET_ABSENCE_ALL);
                    $curTs = MakeTimeStamp(ConvertTimeStamp(false, 'FULL'));
                    if (isset($arAbsenceData[0])) {
                        if (array_key_exists('DATE_ACTIVE_FROM', $arAbsenceData[0]) && array_key_exists('DATE_ACTIVE_TO', $arAbsenceData[0])) {
                            $fromTs = MakeTimeStamp($arAbsenceData[0]['DATE_ACTIVE_FROM']);
                            $toTs = MakeTimeStamp($arAbsenceData[0]['DATE_ACTIVE_TO']);
                        } else {
                            $fromTs = MakeTimeStamp($arAbsenceData[0]['DATE_FROM']);
                            $toTs = MakeTimeStamp($arAbsenceData[0]['DATE_TO']);
                        }
                        if ($toTs > $curTs) {
                            $from = FormatDate($DB->DateFormatToPhp(CSite::GetDateFormat(CIntranetUtils::IsDateTime($fromTs) ? 'FULL' : 'SHORT')), $fromTs);
                            $to = FormatDate($DB->DateFormatToPhp(CSite::GetDateFormat(CIntranetUtils::IsDateTime($toTs) ? 'FULL' : 'SHORT')), $toTs);
                            echo '<div>' . htmlspecialcharsbx(str_replace(array('#FORMATTED_USER_NAME#', '#DATE_FROM#', '#DATE_TO#', '#ABSCENCE_REASON#'), array($responsibleName, $from, $to, $arAbsenceData[0]['NAME']), GetMessage('TASKS_WARNING_RESPONSIBLE_IS_ABSENCE'))) . '</div>';
                        }
                    }
                }
            }
            break;
        default:
            throw new Exception('Requested action is unknown!');
            break;
    }
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:69,代码来源:ajax.php

示例2: date

         break;
     case 'now':
     default:
         $date_start = $date_finish = date($format);
         break;
 }
 $arFilter = array('CALENDAR_IBLOCK_ID' => $arParams['CALENDAR_IBLOCK_ID'], 'ABSENCE_IBLOCK_ID' => $arParams['IBLOCK_ID'], 'DATE_START' => $date_start, 'DATE_FINISH' => $date_finish, 'USERS' => $USERS, 'PER_USER' => false);
 //echo '<pre>'; print_r($arFilter); echo '</pre>';
 $arResult['ENTRIES'] = CIntranetUtils::GetAbsenceData($arFilter, BX_INTRANET_ABSENCE_ALL);
 $arUserIDs = array();
 foreach ($arResult['ENTRIES'] as $key => $arEntry) {
     $arUserIDs[] = $arEntry['USER_ID'];
     $arResult['ENTRIES'][$key]['DATE_ACTIVE_FROM_TS'] = MakeTimeStamp($arEntry['DATE_FROM'], CSite::GetDateFormat('FULL'));
     $arResult['ENTRIES'][$key]['DATE_ACTIVE_TO_TS'] = MakeTimeStamp($arEntry['DATE_TO'], CSite::GetDateFormat('FULL'));
     $arResult['ENTRIES'][$key]['DATE_FROM'] = FormatDate($arParams['DATE' . (CIntranetUtils::IsDateTime($arResult['ENTRIES'][$key]['DATE_ACTIVE_FROM_TS']) ? '_TIME' : '') . '_FORMAT'], $arResult['ENTRIES'][$key]['DATE_ACTIVE_FROM_TS']);
     $arResult['ENTRIES'][$key]['DATE_TO'] = FormatDate($arParams['DATE' . (CIntranetUtils::IsDateTime($arResult['ENTRIES'][$key]['DATE_ACTIVE_TO_TS']) ? '_TIME' : '') . '_FORMAT'], $arResult['ENTRIES'][$key]['DATE_ACTIVE_TO_TS']);
     if ($arParams['mode'] == 'now') {
         $test1 = $arResult['ENTRIES'][$key]['DATE_ACTIVE_FROM_TS'];
         $test2 = $arResult['ENTRIES'][$key]['DATE_ACTIVE_TO_TS'];
         if (0 == ($test2 + date('Z')) % 86400) {
             $test2 += 86399;
         }
         if ($test1 > time() || $test2 < time()) {
             unset($arResult['ENTRIES'][$key]);
         }
     }
 }
 // foreach ($arResult['ENTRIES'] as $key => $arEntry)
 // echo $arEntry['DATE_FROM'].' - '.$arEntry['DATE_TO'].'<br />';
 usort($arResult['ENTRIES'], array('CIntranetUtils', '__absence_sort'));
 // echo '<hr />';
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例3: array

 } else {
     $arEvent = CCalendarEvent::GetById($arParams['ID']);
     $arResult['ENTRY'] = array('ID' => $arEvent['ID'], 'NAME' => $arEvent['NAME'], 'PREVIEW_TEXT' => '', 'DETAIL_TEXT' => $arEvent['DESCRIPTION'], 'DATE_ACTIVE_FROM' => $arEvent['DT_FROM_TS'] + date('Z') - date('Z', $arEvent['DT_FROM_TS']), 'DATE_ACTIVE_TO' => $arEvent['DT_TO_TS'] + date('Z') - date('Z', $arEvent['DT_TO_TS']), 'USER' => $arEvent['CREATED_BY'], 'PROPERTY_PERIOD_TYPE_VALUE' => 'NONE');
     if ($arEvent['RRULE']) {
         $arRRule = array();
         $arRRuleStr = explode(';', $arEvent['RRULE']);
         foreach ($arRRuleStr as $str) {
             list($param, $value) = explode('=', $str);
             $arRRule[$param] = $value;
         }
         $arResult['ENTRY']['PROPERTY_PERIOD_TYPE_VALUE'] = $arRRule['FREQ'];
     }
 }
 if ($arResult['ENTRY']) {
     $arResult['ENTRY']['DATE_ACTIVE_FROM'] = FormatDate($DB->DateFormatToPhp(CSite::GetDateFormat(CIntranetUtils::IsDateTime($arResult['ENTRY']['DATE_ACTIVE_FROM']) ? 'FULL' : 'SHORT', $arParams['SITE_ID'], true)), $arResult['ENTRY']['DATE_ACTIVE_FROM']);
     $arResult['ENTRY']['DATE_ACTIVE_TO'] = FormatDate($DB->DateFormatToPhp(CSite::GetDateFormat(CIntranetUtils::IsDateTime($arResult['ENTRY']['DATE_ACTIVE_TO']) ? 'FULL' : 'SHORT', $arParams['SITE_ID'], true)), $arResult['ENTRY']['DATE_ACTIVE_TO']);
     if ($arParams['TYPE'] == 1) {
         $arResult['ENTRY']['TYPE'] = is_array($arResult['ABSENCE_TYPES'][$arResult['ENTRY']['PROPERTY_ABSENCE_TYPE_ENUM_ID']]) ? $arResult['ABSENCE_TYPES'][$arResult['ENTRY']['PROPERTY_ABSENCE_TYPE_ENUM_ID']]['XML_ID'] : '';
         $dbRes = CUser::GetByID($arResult['ENTRY']['PROPERTY_USER_VALUE']);
     } else {
         $arResult['ENTRY']['TYPE'] = 'PERSONAL';
         if (!$arResult['ENTRY']['USER']) {
             $dbRes = CIBlockSection::GetByID($arResult['ENTRY']['IBLOCK_SECTION_ID']);
             $arSection = $dbRes->Fetch();
             $dbRes = CUser::GetByID($arSection['CREATED_BY']);
         } else {
             $dbRes = CUser::GetByID($arResult['ENTRY']['USER']);
         }
     }
     if ($arUser = $dbRes->Fetch()) {
         if (!is_array($arUser['UF_DEPARTMENT'])) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


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