public static function NormalizeDateTime($str) { // Add seconds if omitted if (strpos(CSite::GetTimeFormat(), 'SS') !== false && preg_match('/\\d{1,2}\\s*:\\s*\\d{1,2}\\s*:\\s*\\d{1,2}/', $str) !== 1) { $str = preg_replace('/\\d{1,2}\\s*:\\s*\\d{1,2}/', '$0:00', $str); } return $str; }
elseif ($action == "get_comments") { $arResult["arComments"] = array(); $log_tmp_id = $_REQUEST["logid"]; if (intval($log_tmp_id) > 0) { $arParams = array( "PATH_TO_USER" => $_REQUEST["p_user"], "PATH_TO_GROUP" => $_REQUEST["p_group"], "PATH_TO_CONPANY_DEPARTMENT" => $_REQUEST["p_dep"], "NAME_TEMPLATE" => $_REQUEST["nt"], "NAME_TEMPLATE_WO_NOBR" => str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $_REQUEST["nt"]), "SHOW_LOGIN" => $_REQUEST["sl"], "DATE_TIME_FORMAT" => (isset($_REQUEST["dtf"]) ? $_REQUEST["dtf"] : CSite::GetTimeFormat()), "AVATAR_SIZE_COMMENT" => $_REQUEST["as"], "PATH_TO_SMILE" => $_REQUEST["p_smile"] ); $cache_time = 31536000; $cache = new CPHPCache; $arCacheID = array(); $arKeys = array( "AVATAR_SIZE_COMMENT", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT",
return true; } if (CheckFilter()) { if ($arFilter["MODULE_ITEM"] != "") { $arEventFilter["=MODULE_ITEM"] = $arFilter["MODULE_ITEM"]; } if ($arParams["LOG_DATE_FROM"] != "") { $arEventFilter["TIMESTAMP_X_1"] = $arParams["LOG_DATE_FROM"] . " 00.00.00"; } if ($arParams["LOG_DATE_TO"] != "") { $arEventFilter["TIMESTAMP_X_2"] = $arParams["LOG_DATE_TO"] . " 23.59.59"; } $arEventFilter["USER_ID"] = $find != '' && $find_type == "user_id" ? $find : $find_user_id; $nameFormat = CSite::GetNameFormat(false); $dateFormat = CSite::GetDateFormat('SHORT'); $timeFormat = CSite::GetTimeFormat(); $arUsersTmp = array(); $arNavParams = array("nPageSize" => $arParams["PAGE_NUM"], "bShowAll" => false); $results = CEventLog::GetList(array('TIMESTAMP_X' => 'DESC'), $arEventFilter, $arNavParams); $results->NavStart($arNavParams); //page navigation $arResult["NAV"] = $results; while ($row = $results->NavNext()) { if (!isset($arUsersTmp[$row['USER_ID']])) { $arUserInfo = array(); $rsUser = CUser::GetList($by = "", $ord = "", array("ID_EQUAL_EXACT" => intval($row['USER_ID'])), array("FIELDS" => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'PERSONAL_PHOTO'))); if ($arUser = $rsUser->GetNext()) { $arUserInfo["ID"] = $row['USER_ID']; $arUserInfo["FULL_NAME"] = CUser::FormatName($nameFormat, $arUser, true, false); $arUserInfo['avatar'] = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_EXACT, false); $arUsersTmp[$row['USER_ID']] = $arUserInfo;
$arUsersTmp = array(); while ($row = $results->NavNext(true, "a_")) { if (!in_array($row['USER_ID'], array_keys($arUsersTmp))) { $rsUser = CUser::GetByID($row['USER_ID']); if ($arUser = $rsUser->GetNext()) { $arUserInfo["ID"] = $row['USER_ID']; $arUserInfo["FULL_NAME"] = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true); $PersPhoto = $arUser["PERSONAL_PHOTO"]; $arUserInfo['avatar'] = CFile::ResizeImageGet($PersPhoto, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_EXACT, false); $arUsersTmp[$row['USER_ID']] = $arUserInfo; } } else { $arUserInfo = $arUsersTmp[$row['USER_ID']]; } $dateFormated = FormatDateFromDB($row["TIMESTAMP_X"], CSite::GetDateFormat('SHORT')); $time = FormatDateFromDB($row["TIMESTAMP_X"], CSite::GetTimeFormat()); foreach ($arModuleObjects as $key => $val) { if (in_array($row['AUDIT_TYPE_ID'], array_keys($arObjectTypes[$key]))) { $res = $val->GetEventInfo($row, $arParams, $arUserInfo, $arResult["ActiveFeatures"]); $res['time'] = $time; $res['user'] = array("name" => $arUserInfo["FULL_NAME"], "id" => $arUserInfo["ID"], "avatar" => $arUserInfo["avatar"]["src"]); $arResult['EVENT'][$dateFormated][] = $res; break; } } } } } else { $arResult["NO_ACTIVE_FEATURES"] = true; } $this->IncludeComponentTemplate();
$arTmpCommentEvent = array("LOG_DATE" => $arComment["LOG_DATE"], "LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"], "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "MESSAGE" => $arComment["MESSAGE"], "MESSAGE_FORMAT" => $arComment["~MESSAGE"], "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""), "USER_ID" => $arComment["USER_ID"]); $arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]); if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) { $arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, $arParams); $arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]); } $arResult["arCommentFormatted"] = $arTmpCommentEvent; } } } elseif ($action == "get_comments") { $arResult["arComments"] = array(); $log_tmp_id = $_REQUEST["logid"]; $log_entity_type = $entity_type; $arListParams = strpos($log_entity_type, "CRM") === 0 && IsModuleInstalled("crm") ? array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y") : array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N"); if (intval($log_tmp_id) > 0 && ($rsLog = CSocNetLog::GetList(array(), array("ID" => $log_tmp_id), false, false, array("ID", "EVENT_ID", "SOURCE_ID"), $arListParams)) && ($arLog = $rsLog->Fetch())) { $arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "PATH_TO_GROUP" => $_REQUEST["p_group"], "PATH_TO_CONPANY_DEPARTMENT" => $_REQUEST["p_dep"], "PATH_TO_LOG_ENTRY" => $_REQUEST["p_le"], "NAME_TEMPLATE" => $_REQUEST["nt"], "NAME_TEMPLATE_WO_NOBR" => str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $_REQUEST["nt"]), "SHOW_LOGIN" => $_REQUEST["sl"], "DATE_TIME_FORMAT" => isset($_REQUEST["dtf"]) ? $_REQUEST["dtf"] : CSite::GetDateFormat(), "TIME_FORMAT" => isset($_REQUEST["tf"]) ? $_REQUEST["tf"] : CSite::GetTimeFormat(), "AVATAR_SIZE" => $_REQUEST["as"]); $cache_time = 31536000; $cache = new CPHPCache(); $arCacheID = array(); $arKeys = array("AVATAR_SIZE", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT"); foreach ($arKeys as $param_key) { $arCacheID[$param_key] = array_key_exists($param_key, $arParams) ? $arParams[$param_key] : false; } $cache_id = "log_comments_" . $log_tmp_id . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset(); $cache_path = "/sonet/log/" . intval(intval($log_tmp_id) / 1000) . "/" . $log_tmp_id . "/comments/"; if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) { $arCacheVars = $cache->GetVars(); $arResult["arComments"] = $arCacheVars["COMMENTS_FULL_LIST"]; } else { if (is_object($cache)) { $cache->StartDataCache($cache_time, $cache_id, $cache_path);
callback_after: function(value) { tasks_funcOnChangeOfSomeDateFields(BX('task-deadline-hidden')); } }); "<?php } else { echo '"'; } ?> id="task-detail-deadline" style="display:inline; line-height:19px;"><?php if ($arResult["TASK"]["DEADLINE"]) { echo tasksFormatDate($arResult["TASK"]["DEADLINE"]); if (convertTimeToMilitary($arResult["TASK"]["DEADLINE"], CSite::GetDateFormat(), "HH:MI") != "00:00") { echo " " . convertTimeToMilitary($arResult["TASK"]["DEADLINE"], CSite::GetDateFormat(), CSite::GetTimeFormat()); } } else { echo GetMessage("TASKS_SIDEBAR_DEADLINE_NO"); } ?> </span><?php if ($arResult['ALLOWED_ACTIONS']['ACTION_EDIT'] || $arResult['ALLOWED_ACTIONS']['ACTION_CHANGE_DEADLINE']) { ?> <input type="text" style="display:none;" id="task-deadline-hidden" value="<?php echo $arResult["TASK"]["DEADLINE"]; ?> " /><span class="task-deadline-delete"<?php if (!$arResult["TASK"]["DEADLINE"]) {
} else { if ($task["DEADLINE"]) { ?> <span class="task-deadline-datetime"> <span class="task-deadline-date"> <?php echo tasksFormatDate($task["DEADLINE"]); ?> </span> </span> <?php if (convertTimeToMilitary($task["DEADLINE"], CSite::GetDateFormat(), "HH:MI") != "00:00") { ?> <span class="task-deadline-time"><?php echo convertTimeToMilitary($task["DEADLINE"], CSite::GetDateFormat(), CSite::GetTimeFormat()); ?> </span><?php } } else { echo ' '; } } ?> </td> <td class="task-responsible-column"><a class="task-responsible-link" target="_top" href="<?php echo CComponentEngine::MakePathFromTemplate($arPaths["PATH_TO_USER_PROFILE"], array("user_id" => $task["RESPONSIBLE_ID"])); ?> " id="anchor_responsible_<?php
case CTaskColumnList::COLUMN_CLOSED_DATE: if ($task['CLOSED_DATE']) { ?> <span class="task-deadline-datetime"> <span class="task-deadline-date"> <?php echo tasksFormatDate($task['CLOSED_DATE']); ?> </span> </span> <?php if (convertTimeToMilitary($task['CLOSED_DATE'], CSite::GetDateFormat(), 'HH:MI') != '00:00') { ?> <span class="task-deadline-time"><?php echo convertTimeToMilitary($task['CLOSED_DATE'], CSite::GetDateFormat(), CSite::GetTimeFormat()); ?> </span><?php } } else { echo ' '; } break; case CTaskColumnList::COLUMN_ALLOW_TIME_TRACKING: if ($task['ALLOW_TIME_TRACKING'] === 'Y') { echo GetMessage('TASKS_LIST_ITEMS_YES'); } else { echo GetMessage('TASKS_LIST_ITEMS_NO'); } break; case CTaskColumnList::COLUMN_ALLOW_CHANGE_DEADLINE: