$row["PERSONAL_PHOTO_resized"] = CFile::ResizeImageGet($row["PERSONAL_PHOTO_file"], array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_EXACT, false); if ($row["PERSONAL_PHOTO_resized"] !== false) { $row['AVATAR_SRC'] = $row["PERSONAL_PHOTO_resized"]["src"]; $row["PERSONAL_PHOTO_img"] = CFile::ShowImage($row["PERSONAL_PHOTO_resized"]["src"], 42, 42, "border=0 align='right'"); } } // full name $row['FULL_NAME'] = $row['NAME'] . "\n" . $row['LAST_NAME']; if (!strlen(trim($row['FULL_NAME']))) { $row['FULL_NAME'] = $row['LOGIN']; } $usersInfo[$row['ID']] = $row; } $compareWithMyself = false; // myself if BY_ID is not me. let's compare if ($arParams['USER_ID'] != $USER->getId()) { $compareWithMyself = true; $selfData = \Bitrix\Intranet\UStat\UStat::getUsersGraphData($USER->getId(), $fromDate, $toDate, $interval, $sectionField); foreach ($selfData['data'] as $k => $_selfData) { $data[$k]['self_activity'] = $_selfData[$sectionField]; } } // if user has a right to tell about servies $allowTellAbout = false; if ($USER->IsAdmin() || CModule::IncludeModule("bitrix24") && CBitrix24::IsPortalAdmin($USER->GetID()) || in_array((int) $USER->getId(), \Bitrix\Intranet\UStat\UStat::getHeadsOfDepartments(), true)) { $allowTellAbout = true; } // done! $arResult = array('SECTION' => $sectionField, 'INTERVAL' => $interval, 'SUM_ACTIVITY' => $sumActivity, 'SUM_AVG_COMPANY_ACTIVITY' => $sumAvgCompanyActivity, 'SUM_AVG_DEPARTMENT_ACTIVITY' => $sumAvgDepartmentActivity, 'TOP_POSITION' => $rawData['rating']['position'], 'USERS_INFO' => $usersInfo, 'DEPARTMENT_TITLE' => $departmentTitle, 'ALLOW_TELL_ABOUT' => $allowTellAbout, 'SECTION_DATA' => $sectionData, 'DATA' => array_values($data), 'COMPARE_WITH_MYSELF' => $compareWithMyself); //var_dump($arResult, $rawData, $arParams); $this->IncludeComponentTemplate();
} ?> <!-- --></div><!-- --></td> <td class="pulse-info-cell pulse-info-cell-center"> <span class="pulse-info-index-text"> <?php echo GetMessage('INTRANET_USTAT_COMPANY_ACTIVITY_TITLE'); ?> <span class="pulse-info-index-info" id="pulse-company-activity-help-icon"></span> </span> <span class="pulse-info-index"> <?php foreach (UStat::getFormattedNumber($arResult['SUM_ACTIVITY']) as $number) { ?> <!-- --><span class="pulse-num pulse-num-<?php echo $number['code']; ?> "><?php echo $number['char']; ?> </span><!-- --><?php } ?> </span> </td> <td class="pulse-info-cell pulse-info-cell-center">
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } /** @var CBitrixComponent $this */ /** @var array $arParams */ /** @var array $arResult */ /** @var string $componentPath */ /** @var string $componentName */ /** @var string $componentTemplate */ /** @global CDatabase $DB */ /** @global CUser $USER */ /** @global CMain $APPLICATION */ if ($this->startResultCache(600)) { if (!CModule::IncludeModule('intranet')) { $this->abortResultCache(); return; } $arResult['STATUS_INFO'] = \Bitrix\Intranet\UStat\UStat::getStatusInformation(); $this->IncludeComponentTemplate(); } $APPLICATION->SetAdditionalCSS('/bitrix/components/bitrix/intranet.ustat/style.css'); return $arResult['STATUS_INFO'];
$toDate = Type\DateTime::createFromTimestamp(mktime(23, 59, 59)); // day, because we need empty records for all users $interval = 'day'; $dateFormat = 'Y-m-d H:00:00'; $axisDateFormat = "H"; $axisCursorDateFormat = array("today" => "today, " . (IsAmPmMode() ? "g:i a" : "H:i")); } $sectionField = empty($arParams['SECTION']) ? 'TOTAL' : $arParams['SECTION']; $arParams['NON_INVOLVED'] = isset($arParams['NON_INVOLVED']) && $arParams['NON_INVOLVED'] || isset($_REQUEST['LIST']) && $_REQUEST['LIST'] === 'involve'; if (!isset($arParams['OFFSET'])) { $arParams['OFFSET'] = isset($_REQUEST['OFFSET']) ? (int) $_REQUEST['OFFSET'] : 0; } if (!isset($arParams['TOP_ACTIVITY']) && isset($_REQUEST['TOP_ACTIVITY'])) { $arParams['TOP_ACTIVITY'] = $_REQUEST['TOP_ACTIVITY']; } $data = \Bitrix\Intranet\UStat\UStat::getUsersTop(1, 0, $fromDate, $toDate, $interval, $sectionField, $arParams['NON_INVOLVED'], $arParams['OFFSET'], 20); $topUserIds = array(); foreach ($data as $_data) { $topUserIds[] = $_data['USER_ID']; } $result = CUser::GetList($dummy = '', $dummy = '', array("ID" => join('|', $topUserIds)), array("FIELDS" => array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "PERSONAL_GENDER"))); $usersInfo = array(); while ($row = $result->fetch()) { if (!empty($row["PERSONAL_PHOTO"])) { $row["PERSONAL_PHOTO_file"] = CFile::GetFileArray($row["PERSONAL_PHOTO"]); $row["PERSONAL_PHOTO_resized"] = CFile::ResizeImageGet($row["PERSONAL_PHOTO_file"], array("width" => 42, "height" => 42), BX_RESIZE_IMAGE_EXACT, false); if ($row["PERSONAL_PHOTO_resized"] !== false) { $row['AVATAR_SRC'] = $row["PERSONAL_PHOTO_resized"]["src"]; $row["PERSONAL_PHOTO_img"] = CFile::ShowImage($row["PERSONAL_PHOTO_resized"]["src"], 42, 42, "border=0 align='right'"); } }
<div class="pulse-popup-bar-wrap"> <span class="pulse-popup-bar"> <span class="pulse-popup-bar-inner" style="width: <?php echo $topActivity ? round($data['ACTIVITY'] / $topActivity * 100) : 0; ?> %;"></span> <span class="pulse-popup-bar-caption"><?php if (!$arParams['SECTION']) { echo $data['SERVICES_COUNT'] . ' ' . getNumberEnding($data['SERVICES_COUNT'], array(GetMessage('INTRANET_USTAT_RATING_SERVICE_COUNT_1'), GetMessage('INTRANET_USTAT_RATING_SERVICE_COUNT_2'), GetMessage('INTRANET_USTAT_RATING_SERVICE_COUNT_5'))); } ?> </span> </span> <?php $activity = ''; $formattedAcitivty = \Bitrix\Intranet\UStat\UStat::getFormattedNumber($data['ACTIVITY']); foreach ($formattedAcitivty as $numPart) { $activity .= $numPart['char']; } ?> <span class="pulse-popup-bar-size"><?php echo $activity; ?> </span> </div> </div> </div> <?php } ?>