Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/socialnetwork/lib/item/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage socialnetwork * @copyright 2001-2012 Bitrix */ namespace Bitrix\Socialnetwork\Item; use Bitrix\Main\Loader; use Bitrix\Socialnetwork\UserWelltoryTable; class UserWelltory { public static function getAccess(array $fields = []) { $userId = ( isset($fields['userId']) ? intval($fields['userId']) : 0 ); if ($userId <= 0) { return false; } $value = \CUserOptions::getOption( 'socialnetwork', self::getAccessOptionName(), 'N', $userId ); return ($value == 'Y' ? 'Y' : 'N'); } public static function setAccess(array $fields = []) { $userId = ( isset($fields['userId']) ? intval($fields['userId']) : 0 ); $value = ( isset($fields['value']) && $fields['value'] == 'Y' ? 'Y' : 'N' ); return (\CUserOptions::setOption( 'socialnetwork', self::getAccessOptionName(), $value, false, $userId ) ? $value : false ); } public static function getHistoricData(array $fields = []) { $result = []; $userId = ( isset($fields['userId']) ? intval($fields['userId']) : 0 ); $limit = ( isset($fields['limit']) ? intval($fields['limit']) : 1 ); $intranetInstalled = Loader::includeModule('intranet'); $res = UserWelltoryTable::getList([ 'filter' => [ '=USER_ID' => $userId ], 'order' => [ 'DATE_MEASURE' => 'desc' ], 'select' => [ 'ID', 'DATE_MEASURE', 'STRESS', 'STRESS_TYPE', 'STRESS_COMMENT', 'HASH' ], 'limit' => $limit ]); while ($dataFields = $res->fetch()) { $item = [ 'id' => $dataFields['ID'], 'date' => $dataFields['DATE_MEASURE'], 'value' => intval($dataFields['STRESS']), 'type' => ($dataFields['STRESS_TYPE'] <> '' ? $dataFields['STRESS_TYPE'] : ''), 'typeDescription' => ($intranetInstalled ? : ''), 'comment' => ($dataFields['STRESS_COMMENT'] <> '' ? $dataFields['STRESS_COMMENT'] : ''), 'hash' => ($dataFields['HASH'] <> '' ? $dataFields['HASH'] : '') ]; $item['typeDescription'] = ($intranetInstalled ? \Bitrix\Intranet\Component\UserProfile\StressLevel::getTypeDescription($item['type'], $item['value']) : ''); $result[] = $item; } return $result; } private static function getAccessOptionName() { return "welltory_access"; } }