本文整理汇总了PHP中CIntranetUtils::InitImage方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::InitImage方法的具体用法?PHP CIntranetUtils::InitImage怎么用?PHP CIntranetUtils::InitImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::InitImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _FormatUser
function _FormatUser(&$arUser, $arPath)
{
global $USER, $CACHE_ABSENCE;
if ($arUser['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
}
if ($arPath['DETAIL_URL']) {
$arUser['DETAIL_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['DETAIL_URL']);
}
$arUser["canViewProfile"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arUser["canMessage"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "message", CSocNetUser::IsCurrentUserModuleAdmin());
if ($arPath['MESSAGES_CHAT_URL']) {
$arUser['MESSAGES_CHAT_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['MESSAGES_CHAT_URL']);
}
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arUser['IS_ONLINE'] = CSocNetUser::IsOnLine($arUser['ID']);
if ($arUser['IS_ABSENT']) {
$maxAbsence = 0;
foreach ($CACHE_ABSENCE[$arUser["ID"]] as $arAbsence) {
if (MakeTimeStamp($arAbsence["DATE_TO"]) > $maxAbsence) {
$arUser['ABSENT_TILL'] = $arAbsence["DATE_TO"];
}
}
}
$arFilter = array("TO_USER_ID" => $arUser['ID'], "MESSAGE_TYPE" => SONET_MESSAGE_PRIVATE, "FROM_USER_ID" => $USER->GetID());
$dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "DESC"), $arFilter, false, array("nTopCount" => 1), array("ID", "DATE_CREATE"));
if ($arMessages = $dbMessages->GetNext()) {
$arUser['LAST_CHAT'] = $arMessages["DATE_CREATE"];
}
return true;
}
示例2: trim
}
}
$arResult["STRUCTURE_FILTER"] = trim($arParams["STRUCTURE_FILTER"]);
if (strlen($arResult["STRUCTURE_FILTER"]) <= 0) {
$arResult["STRUCTURE_FILTER"] = "structure";
}
$bSoNet = CModule::IncludeModule('socialnetwork');
$arDepCache = array();
$arDepCacheValue = array();
foreach ($arResult["SEARCH"] as $i => $arItem) {
if ($arItem["MODULE_ID"] === "intranet" && substr($arItem["ITEM_ID"], 0, 1) === "U") {
$rsUser = CUser::GetList($by = '', $ord = '', array("ID_EQUAL_EXACT" => substr($arItem["ITEM_ID"], 1)), array('SELECT' => array('UF_*')));
$arUser = $rsUser->Fetch();
if ($arUser) {
if ($arUser['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 100);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
}
$arDep = array();
if (is_array($arUser['UF_DEPARTMENT']) && count($arUser['UF_DEPARTMENT']) > 0) {
$arNewDep = array_diff($arUser['UF_DEPARTMENT'], $arDepCache);
if (count($arNewDep) > 0) {
$dbRes = CIBlockSection::GetList(array('SORT' => 'ASC'), array('ID' => $arNewDep));
while ($arSect = $dbRes->Fetch()) {
$arDepCache[] = $arSect['ID'];
$arDepCacheValue[$arSect['ID']] = $arSect['NAME'];
}
}
foreach ($arUser['UF_DEPARTMENT'] as $key => $sect) {
$arDep[$sect] = $arDepCacheValue[$sect];
}
示例3: CTimeManUser
$user_url = COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $_REQUEST['site_id']);
$obUser = new CTimeManUser($arRes['USER_ID']);
$obUser->SITE_ID = $_REQUEST['site_id'];
$bReturnRes = true;
$dbRes = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $arRes['USER_ID']), array('SELECT' => array('UF_*')));
$arCurrentUser = $dbRes->GetNext();
$arCurrentUser['PHOTO'] = $arCurrentUser['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arCurrentUser['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
$arManagers = CTimeMan::GetUserManagers($arRes['USER_ID']);
if (!is_array($arManagers) || count($arManagers) <= 0) {
$arManagers = array($arRes['USER_ID']);
}
$user_url = COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $_REQUEST['site_id']);
$dbManagers = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arManagers)));
$arCurrentUserManagers = array();
while ($manager = $dbManagers->Fetch()) {
$manager['PHOTO'] = $manager['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($manager['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
$arCurrentUserManagers[] = array('ID' => $manager['ID'], 'LOGIN' => $manager['LOGIN'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), $manager, true, false), 'URL' => str_replace(array('#ID#', '#USER_ID#'), $manager['ID'], $user_url), 'WORK_POSITION' => $manager['WORK_POSITION'], 'PHOTO' => $manager['PHOTO']['CACHE']['src']);
}
$arRes['DATE_START'] = MakeTimeStamp($arRes['DATE_START']) - CTimeZone::GetOffset();
$arRes['DATE_FINISH'] = MakeTimeStamp($arRes['DATE_FINISH']) - CTimeZone::GetOffset();
$arInfo = array('INFO' => $arRes, 'DATE_TEXT' => FormatDate('j F Y', $arRes['DATE_START']), 'CALENDAR_ENABLED' => CBXFeatures::IsFeatureEnabled('Calendar'), 'TASKS_ENABLED' => CBXFeatures::IsFeatureEnabled('Tasks') && IsModuleInstalled('tasks'));
$cur_info = $obUser->GetCurrentInfo();
if ($cur_info['ID'] == $ID) {
$arInfo['STATE'] = $obUser->State();
$arInfo['EXPIRED_DATE'] = $obUser->GetExpiredRecommendedDate();
} else {
$arInfo['STATE'] = 'CLOSED';
}
$res = array('FROM' => array('ID' => $arCurrentUser['ID'], 'LOGIN' => $arCurrentUser['LOGIN'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), $arCurrentUser, true, false), 'URL' => str_replace(array('#ID#', '#USER_ID#'), $arCurrentUser['ID'], $user_url), 'WORK_POSITION' => $arCurrentUser['WORK_POSITION'], 'PHOTO' => $arCurrentUser['PHOTO']['CACHE']['src']), 'TO' => array_values($arCurrentUserManagers), 'INFO' => $arInfo, 'REPORT' => '', 'CAN_EDIT' => $bCanEdit ? 'Y' : 'N', 'REPORTS' => array());
if (count($res['TO']) <= 0) {
$res['TO'] = array($res['FROM']);
示例4: GetReportData
public function GetReportData($force = false)
{
$arResult = array("REPORT_INFO" => array(), "REPORT_DATA" => array());
$date = $arResult["REPORT_INFO"] = $this->GetReportInfo();
if ($date["IS_REPORT_DAY"] == "N") {
return $arResult;
} elseif ($date["IS_REPORT_DAY"] == "Y") {
if ($date["IS_DELAY"] == "Y" && MakeTimeStamp($date["DELAY_TIME"], TM_FULL_FORMAT) < time()) {
$date["IS_DELAY"] = "N";
}
if (($date["IS_DELAY"] == "Y" || $date["SHOW_REPORT_FORM"] == "N") && !$force) {
return $arResult;
}
}
$datefomat = CSite::GetDateFormat("SHORT", SITE_ID);
$USER_ID = $this->USER_ID;
$arManagers = CTimeMan::GetUserManagers($USER_ID);
$arManagers[] = $USER_ID;
$user_url = COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', SITE_ID);
$dbManagers = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arManagers)));
$arCurrentUserManagers = array();
$arCurrentUser = array();
while ($manager = $dbManagers->GetNext()) {
$manager['PHOTO'] = $manager['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($manager['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
$userData = array('ID' => $manager['ID'], 'LOGIN' => $manager['LOGIN'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), $manager, true, false), 'URL' => str_replace(array('#ID#', '#USER_ID#'), $manager['ID'], $user_url), 'WORK_POSITION' => $manager['WORK_POSITION'], 'PHOTO' => $manager['PHOTO']['CACHE']['src']);
if ($userData["ID"] == $this->USER_ID) {
$arCurrentUser = $userData;
} else {
$arCurrentUserManagers[] = $userData;
}
}
if (count($arCurrentUserManagers) == 0) {
$arCurrentUserManagers[] = $arCurrentUser;
}
$arInfo = CTimeMan::GetRuntimeInfo(true);
$dbReports = CTimeManReport::GetList(array('ID' => 'ASC'), array('ENTRY_ID' => $arInfo["ID"], 'REPORT_TYPE' => 'REPORT'));
if ($Report = $dbReports->Fetch()) {
$RTReport = $Report["REPORT"];
}
$dbReport = CTimeManReportFull::GetList(array("DATE_FROM" => "DESC"), array("USER_ID" => $USER_ID, "ACTIVE" => "N"), array(), array("nTopCount" => 1));
if ($arReport = $dbReport->Fetch()) {
$arInfo["REPORT_DATE_FROM"] = MakeTimeStamp($arReport["DATE_FROM"], $datefomat);
$arInfo["REPORT_DATE_TO"] = MakeTimeStamp($arReport["DATE_TO"], $datefomat);
//$arInfo["TASKS"] = unserialize($arReport["TASKS"]);
$arInfo["REPORT"] = $arReport["REPORT"];
$arInfo["PLANS"] = $arReport["PLANS"];
if ($arReport["FILES"]) {
$arInfo["FILES"] = unserialize($arReport["FILES"]);
}
$arInfo["REPORT_ID"] = $arReport["ID"];
if ($arInfo["REPORT_DATE_FROM"] != $arInfo["REPORT_DATE_TO"]) {
$arInfo['DATE_TEXT'] = FormatDate('j F', $arInfo["REPORT_DATE_FROM"]) . " - " . FormatDate('j F', $arInfo["REPORT_DATE_TO"]);
} else {
$arInfo['DATE_TEXT'] = FormatDate('j F', $arInfo["REPORT_DATE_TO"]);
}
} else {
if (isset($_SESSION['report_files']) && is_array($_SESSION['report_files'])) {
$arInfo["FILES"] = $_SESSION['report_files'];
}
$arInfo["REPORT_DATE_FROM"] = MakeTimeStamp($date["DATE_FROM"], TM_SHORT_FORMAT);
$arInfo["REPORT_DATE_TO"] = MakeTimeStamp($date["DATE_TO"], TM_SHORT_FORMAT);
}
$date_to = $date["DATE_TO"] ? $date["DATE_TO"] : $arReport["DATE_TO"];
$date_to = MakeTimeStamp($date_to, CSite::GetDateFormat("SHORT", SITE_ID));
$today = CTimeMan::RemoveHoursTS(time());
if ($date_to < $today) {
$arInfo["TASKS"] = array();
$arInfo["EVENTS"] = array();
}
$arLastTasks = array();
$arFilter = array(">=REPORT_DATE" => $date["DATE_FROM"] ? $date["DATE_FROM"] : $arReport["DATE_FROM"], "<=REPORT_DATE" => $date["DATE_TO"] ? $date["DATE_TO"] : $arReport["DATE_TO"], "USER_ID" => $USER_ID);
$arTaskIDs = array();
$arEventIDs = array();
if (is_array($arInfo['PLANNER'])) {
$arInfo = array_merge($arInfo, $arInfo['PLANNER']['DATA']);
unset($arInfo['PLANNER']);
}
if (is_array($arInfo["TASKS"])) {
foreach ($arInfo["TASKS"] as $task) {
$arTaskIDs[] = $task["ID"];
}
}
if (is_array($arInfo["EVENTS"])) {
foreach ($arInfo["EVENTS"] as $event) {
$arEventIDs[] = $event["ID"];
}
}
$res = CTimeManReportDaily::GetList(array(), $arFilter);
while ($day = $res->Fetch()) {
$arDayTasks = unserialize($day["TASKS"]);
$arDayEvents = unserialize($day["EVENTS"]);
if (is_array($arDayTasks)) {
foreach ($arDayTasks as $task) {
if (!in_array($task["ID"], $arTaskIDs)) {
$arInfo["TASKS"][] = $task;
$arTaskIDs[] = $task["ID"];
} else {
foreach ($arInfo["TASKS"] as $key => $cur_task) {
if ($cur_task["ID"] == $task["ID"]) {
$arInfo["TASKS"][$key]["TIME"] += $task["TIME"];
//.........这里部分代码省略.........
示例5: tasksGetLastSelected
function tasksGetLastSelected($arManagers, $bSubordinateOnly = false, $nameTemplate = "")
{
static $arLastUsers;
global $USER;
if (!isset($arLastUsers)) {
$arSubDeps = CTasks::GetSubordinateDeps();
if (!class_exists('CUserOptions')) {
include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
}
$arLastSelected = CUserOptions::GetOption("tasks", "user_search", array());
if (is_array($arLastSelected) && strlen($arLastSelected['last_selected']) > 0) {
$arLastSelected = array_unique(explode(',', $arLastSelected['last_selected']));
} else {
$arLastSelected = false;
}
if (is_array($arLastSelected)) {
$currentUser = array_search($USER->GetID(), $arLastSelected);
if ($currentUser !== false) {
unset($arLastSelected[$currentUser]);
}
array_unshift($arLastSelected, $USER->GetID());
} else {
$arLastSelected[] = $USER->GetID();
}
$arFilter = array('ACTIVE' => 'Y');
if ($bSubordinateOnly) {
$arFilter["UF_DEPARTMENT"] = $arSubDeps;
} else {
$arFilter['!UF_DEPARTMENT'] = false;
}
$arFilter['ID'] = is_array($arLastSelected) ? implode('|', array_slice($arLastSelected, 0, 10)) : '-1';
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => array('UF_DEPARTMENT')));
$arLastUsers = array();
while ($arRes = $dbRes->GetNext()) {
$arPhoto = array('IMG' => '');
if (!$arRes['PERSONAL_PHOTO']) {
switch ($arRes['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRes['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, isset($arParams['SITE_ID']) ? $arParams['SITE_ID'] : SITE_ID);
}
if ($arRes['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arRes['PERSONAL_PHOTO'], 30, 0, BX_RESIZE_IMAGE_EXACT);
}
$arLastUsers[$arRes['ID']] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat() : $nameTemplate, $arRes, true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => htmlspecialcharsBack($arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION']), 'PHOTO' => isset($arPhoto['CACHE']['src']) ? $arPhoto['CACHE']['src'] : "", 'HEAD' => false, 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
}
return $arLastUsers;
}
示例6: intval
}
$arResult['PHOTO'] = false;
$rsUser = CUser::GetByID($arParams['TASK']["RESPONSIBLE_ID"]);
if ($arResult['USER'] = $rsUser->Fetch()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arResult["USER"]["ID"]));
}
if (!$arResult['USER']['PERSONAL_PHOTO']) {
switch ($arResult['USER']['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arResult['USER']['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
if ($arResult['USER']['PERSONAL_PHOTO'] > 0 && CModule::IncludeModule("intranet")) {
$arResult['PHOTO'] = CIntranetUtils::InitImage($arResult['USER']['PERSONAL_PHOTO'], $arParams["AVATAR_SIZE"], 0, BX_RESIZE_IMAGE_EXACT);
}
$arResult['PATH_TO_USER'] = CComponentEngine::MakePathFromTemplate(strlen($arParams["PATH_TO_USER"]) > 0 ? $arParams["PATH_TO_USER"] : COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/'), array("USER_ID" => $arResult['USER']["ID"], "user_id" => $arResult['USER']["ID"]));
}
if ($arParams['TASK']["DESCRIPTION"]) {
if ($arParams['TASK']["~DESCRIPTION"]) {
$arParams['TASK']["DESCRIPTION"] = $arParams['TASK']["~DESCRIPTION"];
}
}
$this->IncludeComponentTemplate();
示例7: GetFormHtml
public function GetFormHtml($arParams = false)
{
global $USER;
if (!$USER->IsAuthorized()) {
return false;
}
$elements = '';
$arElement = array();
$arElements = array();
$arLRU = CAccess::GetLastRecentlyUsed($this->id);
if (!empty($arLRU)) {
$arFinderParams = array('PROVIDER' => $this->id, 'TYPE' => 3);
$arLast = array();
$arLastID = array();
foreach ($arLRU as $val) {
if (substr($val, 0, 2) == 'DR') {
$id = substr($val, 2);
$arLast['DR'][] = $id;
$arLastID[$id] = $id;
} else {
if (substr($val, 0, 1) == 'D') {
$id = substr($val, 1);
$arLast['D'][] = $id;
$arLastID[$id] = $id;
} else {
if (substr($val, 0, 2) == 'IU') {
$arLast['U'][] = substr($val, 2);
}
}
}
}
$dbRes = CIBlockSection::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_structure'), 'ID' => $arLastID), false, array('ID', 'NAME'));
while ($arSection = $dbRes->Fetch()) {
$arElement[$arSection['ID']] = $arSection;
}
if (!empty($arLast['DR'])) {
foreach ($arLast['DR'] as $value) {
$arItem = array("ID" => 'DR' . $arElement[$value]['ID'], "NAME" => $arElement[$value]['NAME'] . ': ' . GetMessage("authprov_check_dr"), "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png');
$arElements['DR' . $value] = CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
if (!empty($arLast['D'])) {
foreach ($arLast['D'] as $value) {
$arItem = array("ID" => 'D' . $arElement[$value]['ID'], "NAME" => $arElement[$value]['NAME'] . ': ' . GetMessage("authprov_check_d"), "AVATAR" => '/bitrix/js/main/core/images/access/avatar-user-everyone.png');
$arElements['D' . $value] = CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
if (!empty($arLast['U'])) {
//be careful with field list because of CUser::FormatName()
$res = CUser::GetList($by = "LAST_NAME", $order = "asc", array("ID" => implode("|", $arLast['U'])), array("FIELDS" => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'WORK_POSITION', 'PERSONAL_PROFESSION')));
while ($arUser = $res->Fetch()) {
$arPhoto = array('IMG' => '');
if (!$arUser['PERSONAL_PHOTO']) {
switch ($arUser['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUser['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
if ($arUser['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
}
$arItem = array("ID" => "IU" . $arUser["ID"], "NAME" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false), "AVATAR" => $arPhoto['CACHE']['src'], "DESC" => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : $arUser['PERSONAL_PROFESSION']);
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
foreach ($arLRU as $val) {
$elements .= $arElements[$val];
}
}
$arFinderParams = array('PROVIDER' => 'intranet', 'TYPE' => 'structure');
$obCache = new CPHPCache();
$IBlockID = COption::GetOptionInt('intranet', 'iblock_structure');
$arSecFilter = array('IBLOCK_ID' => $IBlockID);
$arStructure = array();
$arSections = array();
if (!CModule::IncludeModule('extranet') || CExtranet::IsIntranetUser()) {
$cache_id = md5(serialize($arSecFilter));
$cacheDir = '/intranet';
if ($obCache->InitCache(30 * 86400, $cache_id, $cacheDir)) {
$vars = $obCache->GetVars();
$arSections = $vars["SECTIONS"];
$arStructure = $vars["STRUCTURE"];
} elseif ($obCache->StartDataCache()) {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($cacheDir);
$CACHE_MANAGER->RegisterTag("iblock_id_" . $IBlockID);
$dbRes = CIBlockSection::GetTreeList($arSecFilter);
while ($arRes = $dbRes->Fetch()) {
$iblockSectionID = intval($arRes['IBLOCK_SECTION_ID']);
if (!is_array($arStructure[$iblockSectionID])) {
$arStructure[$iblockSectionID] = array($arRes['ID']);
} else {
$arStructure[$iblockSectionID][] = $arRes['ID'];
//.........这里部分代码省略.........
示例8: foreach
continue;
}
// skip already pushed users
$arListedUniqueUsers[] = $arUserData;
$arAlreadyPushedUsersIds[] = (int) $arUserData['ID'];
}
foreach ($arListedUniqueUsers as $arRes) {
$arPhoto = array('IMG' => '');
if (!$arRes['PERSONAL_PHOTO']) {
switch ($arRes['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRes['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $arParams['SITE_ID']);
}
if ($arRes['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arRes['PERSONAL_PHOTO'], 30, 0, BX_RESIZE_IMAGE_EXACT);
}
$arResult["CURRENT_USERS"][] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($arParams["NAME_TEMPLATE"], $arRes, true, false), '~NAME' => CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arRes["~NAME"], "LAST_NAME" => $arRes["~LAST_NAME"], "LOGIN" => $arRes["~LOGIN"], "SECOND_NAME" => $arRes["~SECOND_NAME"]), true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => htmlspecialcharsBack($arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION']), 'PHOTO' => isset($arPhoto['CACHE']['src']) ? $arPhoto['CACHE']['src'] : "", 'HEAD' => false, 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
}
$arResult["CURRENT_USERS"] = array_values(array_filter($arResult["CURRENT_USERS"], "FilterViewableUsers"));
$arResult["LAST_USERS"] = array_values(array_filter($arResult["LAST_USERS"], "FilterViewableUsers"));
$APPLICATION->AddHeadScript($this->GetPath() . '/templates/.default/users.js');
$this->IncludeComponentTemplate();
示例9: is_array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CBXFeatures::IsFeatureEnabled('timeman') || !CModule::IncludeModule('timeman')) {
return;
}
if (intval($arParams["AVATAR_SIZE"]) <= 0) {
$arParams["AVATAR_SIZE"] = is_array($arParams["PARAMS"]) && $arParams["PARAMS"]["MOBILE"] == "Y" ? 58 : 39;
}
$arParams['USER']['PHOTO'] = $arParams['USER']['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arParams['USER']['PERSONAL_PHOTO'], $arParams["AVATAR_SIZE"], 0, BX_RESIZE_IMAGE_EXACT) : array();
$arParams['MANAGER']['PHOTO'] = $arParams['MANAGER']['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arParams['MANAGER']['PERSONAL_PHOTO'], $arParams["AVATAR_SIZE"], 0, BX_RESIZE_IMAGE_EXACT) : array();
$arParams['USER']['PHOTO'] = $arParams['USER']['PHOTO']['CACHE']['src'];
$arParams['MANAGER']['PHOTO'] = $arParams['MANAGER']['PHOTO']['CACHE']['src'];
$this->IncludeComponentTemplate();
示例10: TasksGetDepartmentUsers
function TasksGetDepartmentUsers($SECTION_ID, $SITE_ID, $arSubDeps, $arManagers, $ynShowInactiveUsers, $nameTemplate)
{
static $arCacheUsers = array();
$cacheKey = (string) $SECTION_ID . '|' . (string) $SITE_ID . '|' . serialize($arSubDeps) . '|' . serialize($arManagers) . '|' . $ynShowInactiveUsers;
static $arCUserRequestedFields = array('ID', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'LOGIN', 'EMAIL', 'WORK_POSITION', 'PERSONAL_PROFESSION', 'UF_DEPARTMENT', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'EMAIL');
// Precache data, if need
if (!array_key_exists($cacheKey, $arCacheUsers)) {
$arFilter = array();
$filterACTIVE = 'Y';
if ($ynShowInactiveUsers === 'Y') {
$filterACTIVE = '';
} else {
$arFilter['CONFIRM_CODE'] = false;
}
$arFilter['ACTIVE'] = $filterACTIVE;
// Prevent using users, that doesn't activate it's account
// http://jabber.bx/view.php?id=29118
if (IsModuleInstalled('bitrix24')) {
$arFilter['!LAST_LOGIN'] = false;
}
if ($SECTION_ID == "extranet") {
$arFilter['GROUPS_ID'] = array(COption::GetOptionInt("extranet", "extranet_group", ""));
// $arFilter['UF_DEPARTMENT'] = false;
} else {
$arFilter['UF_DEPARTMENT'] = $SECTION_ID;
}
$arUsers = array();
if ($SECTION_ID != "extranet") {
$dbRes = CIBlockSection::GetList(array('ID' => 'ASC'), array('ID' => $SECTION_ID, 'IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_structure')), false, array('UF_HEAD'));
if (($arSection = $dbRes->Fetch()) && $arSection['UF_HEAD'] > 0) {
$dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => $arSection['UF_HEAD'], 'ACTIVE' => $filterACTIVE), array('SELECT' => $arCUserRequestedFields));
if ($arRes = $dbUsers->Fetch()) {
$arFilter['!ID'] = $arRes['ID'];
$arPhoto = array('IMG' => '');
if (!$arRes['PERSONAL_PHOTO']) {
switch ($arRes['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRes['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $SITE_ID);
}
if ($arRes['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arRes['PERSONAL_PHOTO'], 30, 0, BX_RESIZE_IMAGE_EXACT);
}
$arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, $arRes), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => htmlspecialcharsBack($arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION']), 'PHOTO' => $arPhoto['CACHE']['src'], 'HEAD' => true, 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
}
}
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => $arCUserRequestedFields));
while ($arRes = $dbRes->GetNext()) {
$arPhoto = array('IMG' => '');
if (!$arRes['PERSONAL_PHOTO']) {
switch ($arRes['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRes['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $SITE_ID);
}
if ($arRes['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arRes['PERSONAL_PHOTO'], 30, 0, BX_RESIZE_IMAGE_EXACT);
}
$arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, $arRes, true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => htmlspecialcharsBack($arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION']), 'PHOTO' => $arPhoto['CACHE']['src'], 'HEAD' => false, 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
$arCacheUsers[$cacheKey] = array_values(array_filter($arUsers, "FilterViewableUsers"));
}
return $arCacheUsers[$cacheKey];
}
示例11: forumTextParser
if ($arParams["FORUM_ID"]) {
$FORUM_TOPIC_ID = 0;
if ($arParams["REPORT_ID"]) {
$dbReport = CTimeManReportFull::GetByID($arParams["REPORT_ID"]);
$arReport = $dbReport->Fetch();
$FORUM_TOPIC_ID = $arReport["FORUM_TOPIC_ID"];
} else {
if ($arParams['ENTRY_ID']) {
$dbRes = CTimeManEntry::GetByID($arParams['ENTRY_ID']);
$arEntry = $dbRes->Fetch();
$FORUM_TOPIC_ID = $arEntry["FORUM_TOPIC_ID"];
}
}
if ($FORUM_TOPIC_ID > 0) {
CModule::IncludeModule("forum");
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures(CForumNew::GetByID($arParams["FORUM_ID"]));
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $FORUM_TOPIC_ID));
while ($ar_res = $db_res->Fetch()) {
$dbAuthor = CUser::GetByID($ar_res["AUTHOR_ID"]);
$arAuthor = $dbAuthor->Fetch();
$ar_res["AUTHOR_PHOTO"] = $arAuthor['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arAuthor['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
$ar_res["AUTHOR_URL"] = str_replace(array('#ID#', '#USER_ID#'), $ar_res["AUTHOR_ID"], $user_url);
$ar_res["POST_MESSAGE_HTML"] = $parser->convert(COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $ar_res["POST_MESSAGE_FILTER"] : $ar_res["POST_MESSAGE"], $allow, "html");
$arResult["COMMENTS"][] = $ar_res;
}
}
$this->IncludeComponentTemplate();
}
// *****************************************************************************************
// *****************************************************************************************
示例12: array
$arPhoto = array('IMG' => '');
if (!$arRes['PERSONAL_PHOTO']) {
switch ($arRes['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRes['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $SITE_ID);
}
if ($arRes['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arRes['PERSONAL_PHOTO'], 30);
}
$arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, $arRes, true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION'], 'PHOTO' => $arPhoto['IMG'], 'HEAD' => false);
}
$APPLICATION->RestartBuffer();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
?>
BXShowEmployees('<?php
echo $SECTION_ID;
?>
', <?php
echo CUtil::PhpToJsObject($arUsers);
?>
);
<?php
if ($SECTION_ID == 'last') {
示例13: switch
if (!$arUser['PERSONAL_PHOTO']) {
switch ($arUser['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUser['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $arParams['SITE_ID']);
}
$arResult['USER'] = array('ID' => $arUser['ID'], 'LOGIN' => $arUser['LOGIN'], 'NAME' => $arUser['NAME'], 'LAST_NAME' => $arUser['LAST_NAME'], 'SECOND_NAME' => $arUser['SECOND_NAME'], 'PERSONAL_PROFESSION' => $arUser['PERSONAL_PROFESSION'], 'PERSONAL_PHOTO' => $arUser['PERSONAL_PHOTO'], 'WORK_POSITION' => $arUser['WORK_POSITION'], 'UF_DEPARTMENT' => $arUser['UF_DEPARTMENT'], 'DETAIL_URL' => str_replace(array('#ID#', '#USER_ID#'), $arUser['ID'], $arParams['DETAIL_URL']));
if ($arResult['USER']['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arResult['USER']['PERSONAL_PHOTO'], 100);
$arResult['USER']['PERSONAL_PHOTO'] = $arImage['IMG'];
}
if (is_array($arResult['USER']['UF_DEPARTMENT']) && count($arResult['USER']['UF_DEPARTMENT']) > 0) {
$dbRes = CIBlockSection::GetList(array('SORT' => 'ASC'), array('ID' => $arResult['USER']['UF_DEPARTMENT']));
$arResult['USER']['UF_DEPARTMENT'] = array();
while ($arSect = $dbRes->Fetch()) {
$arResult['USER']['UF_DEPARTMENT'][] = array('ID' => $arSect['ID'], 'NAME' => $arSect['NAME']);
}
}
$APPLICATION->RestartBuffer();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject(array('USER' => $arResult['USER'], 'ENTRY' => $arResult['ENTRY']));
}
}
die;
示例14: executeComponent
public function executeComponent()
{
global $APPLICATION;
$APPLICATION->SetTitle(GetMessage('TASKS_TITLE_TASKS'));
if (!CModule::IncludeModule('tasks')) {
ShowError(GetMessage('TASKS_MODULE_NOT_FOUND'));
return 0;
}
if (!CModule::IncludeModule('intranet')) {
return 0;
}
$this->arResult['DEPARTMENTS'] = array();
$this->processParams();
// preparw arResult
if (!($this->arResult['LOGGED_IN_USER'] >= 1)) {
return 0;
}
$nameTemplate = $this->arResult['NAME_TEMPLATE'];
$startFromDepartments = $this->getInitDepartmentsIds();
$arDepartmentsData = CIntranetUtils::GetDepartmentsData($startFromDepartments);
if (!is_array($arDepartmentsData) || empty($arDepartmentsData)) {
$this->IncludeComponentTemplate();
return 0;
}
$allUsersIds = array();
$arSubDepartmentsUsers = array();
foreach ($arDepartmentsData as $departmentId => $departmentName) {
$departmentHead = CIntranetUtils::GetDepartmentManagerID($departmentId);
$arSubDepartmentsIds = CIntranetUtils::getSubDepartments($departmentId);
$this->arResult['DEPARTMENTS'][$departmentId] = array('~TITLE' => $departmentName, 'TITLE' => htmlspecialcharsbx($departmentName), 'HEAD_USER_ID' => $departmentHead, 'RESPONSIBLES_TOTAL_TASKS' => 0, 'RESPONSIBLES_NOTICED_TASKS' => 0, 'ACCOMPLICES_TOTAL_TASKS' => 0, 'ACCOMPLICES_NOTICED_TASKS' => 0, 'ORIGINATORS_TOTAL_TASKS' => 0, 'ORIGINATORS_NOTICED_TASKS' => 0, 'AUDITORS_TOTAL_TASKS' => 0, 'AUDITORS_NOTICED_TASKS' => 0, 'USERS' => array(), 'SUBDEPARTMENTS' => array());
$rsUsers = CTaskIntranetTools::getDepartmentsUsers(array($departmentId), array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'WORK_POSITION'));
$arUsers = array();
$arDepartmentUsersIds = array();
while ($arUser = $rsUsers->getNext()) {
$arUser['USER_IN_SUBDEPS'] = false;
$arUsers[] = $arUser;
$arDepartmentUsersIds[] = (int) $arUser['ID'];
}
if ($departmentHead > 0) {
$arImmediateEmployees = CTaskIntranetTools::getImmediateEmployees($departmentHead, array($departmentId));
if (is_array($arImmediateEmployees) && !empty($arImmediateEmployees)) {
// Remove immediate manager's employees in subdeps, if they are already in current department
$arImmediateEmployees = array_diff($arImmediateEmployees, $arDepartmentUsersIds);
if (!empty($arImmediateEmployees)) {
$rsUsers = CUser::GetList($by = 'ID', $order = 'ASC', array('ACTIVE' => 'Y', 'ID' => implode('|', array_unique($arImmediateEmployees))), array('SELECT' => array('UF_DEPARTMENT'), 'FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'WORK_POSITION')));
while ($arUser = $rsUsers->getNext()) {
$arUser['USER_IN_SUBDEPS'] = true;
$arUsers[] = $arUser;
}
}
}
}
foreach ($arUsers as $arUser) {
$userId = (int) $arUser['ID'];
$allUsersIds[] = $userId;
$userPhoto = false;
if ($arUser['PERSONAL_PHOTO'] > 0) {
$userPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30, 0, BX_RESIZE_IMAGE_EXACT);
}
$tasksHref = CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_USER_TASKS'], array('user_id' => $userId));
$this->arResult['DEPARTMENTS'][$departmentId]['USERS'][] = array('ID' => $userId, 'PHOTO' => $userPhoto, 'DEPARTMENT_HEAD' => $departmentHead == $userId ? 'Y' : 'N', 'USER_IN_SUBDEPS' => $arUser['USER_IN_SUBDEPS'] ? 'Y' : 'N', 'FORMATTED_NAME' => CUser::FormatName($nameTemplate, array('NAME' => $arUser['~NAME'], 'LAST_NAME' => $arUser['~LAST_NAME'], 'SECOND_NAME' => $arUser['~SECOND_NAME'], 'LOGIN' => $arUser['~LOGIN']), true, true), 'WORK_POSITION' => $arUser['WORK_POSITION'], '~WORK_POSITION' => $arUser['~WORK_POSITION'], 'NAME' => $arUser['NAME'], 'LAST_NAME' => $arUser['LAST_NAME'], 'SECOND_NAME' => $arUser['SECOND_NAME'], '~NAME' => $arUser['~NAME'], '~LAST_NAME' => $arUser['~LAST_NAME'], '~SECOND_NAME' => $arUser['~SECOND_NAME'], 'HREF' => CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_USER'], array('user_id' => $userId)), 'RESPONSIBLES_TOTAL_TASKS' => 0, 'RESPONSIBLES_NOTICED_TASKS' => 0, 'ACCOMPLICES_TOTAL_TASKS' => 0, 'ACCOMPLICES_NOTICED_TASKS' => 0, 'ORIGINATORS_TOTAL_TASKS' => 0, 'ORIGINATORS_NOTICED_TASKS' => 0, 'AUDITORS_TOTAL_TASKS' => 0, 'AUDITORS_NOTICED_TASKS' => 0, 'RESPONSIBLES_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sR400', 'RESPONSIBLES_NOTICED_HREF' => null, 'ACCOMPLICES_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sR800', 'ACCOMPLICES_NOTICED_HREF' => null, 'ORIGINATORS_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sRg00', 'ORIGINATORS_NOTICED_HREF' => null, 'AUDITORS_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sRc00', 'AUDITORS_NOTICED_HREF' => null);
}
if (is_array($arSubDepartmentsIds)) {
$arSubDepartmentsData = CIntranetUtils::GetDepartmentsData($arSubDepartmentsIds);
foreach ($arSubDepartmentsIds as $subDepartmentId) {
$title = '';
if (array_key_exists($subDepartmentId, $arSubDepartmentsData)) {
$title = $arSubDepartmentsData[$subDepartmentId];
}
$this->arResult['DEPARTMENTS'][$departmentId]['SUBDEPARTMENTS'][$subDepartmentId] = array('ID' => $subDepartmentId, '~TITLE' => $title, 'TITLE' => htmlspecialcharsbx($title), 'COUNTERS' => array('RESPONSIBLES_TOTAL_TASKS' => 0, 'RESPONSIBLES_NOTICED_TASKS' => 0, 'ACCOMPLICES_TOTAL_TASKS' => 0, 'ACCOMPLICES_NOTICED_TASKS' => 0, 'ORIGINATORS_TOTAL_TASKS' => 0, 'ORIGINATORS_NOTICED_TASKS' => 0, 'AUDITORS_TOTAL_TASKS' => 0, 'AUDITORS_NOTICED_TASKS' => 0), 'HREF' => '?DEP_ID=' . (int) $subDepartmentId);
$arSubDepartmentsUsers[$subDepartmentId] = array();
}
$rsUsers = CIntranetUtils::GetDepartmentEmployees($arSubDepartmentsIds, $bRecursive = false, $bSkipSelf = false);
while ($arUser = $rsUsers->fetch()) {
if (is_array($arUser['UF_DEPARTMENT'])) {
$userId = (int) $arUser['ID'];
$allUsersIds[] = $userId;
foreach ($arUser['UF_DEPARTMENT'] as $subDepartmentId) {
if ($subDepartmentId > 0) {
$arSubDepartmentsUsers[$subDepartmentId][] = $userId;
}
}
}
}
}
usort($this->arResult['DEPARTMENTS'][$departmentId]['USERS'], function ($a, $b) {
if ($a['USER_IN_SUBDEPS'] !== $b['USER_IN_SUBDEPS']) {
if ($a['USER_IN_SUBDEPS'] === 'N') {
return -1;
} else {
return 1;
}
}
if ($a['DEPARTMENT_HEAD'] !== $b['DEPARTMENT_HEAD']) {
if ($a['DEPARTMENT_HEAD'] === 'Y') {
return -1;
} else {
return 1;
}
}
//.........这里部分代码省略.........
示例15: resizePersonalPhoto
/**
* Resize users photo. Time is limited.
* @param array $arUser
* @return bool If modify photo
*/
protected function resizePersonalPhoto(array &$arUser)
{
static $startTime = null;
if ($startTime === null) {
$startTime = getmicrotime();
}
//photo for current user not resized. Do it!
if (empty($arUser['PERSONAL_PHOTO_RESIZED'])) {
if (!$arUser['PERSONAL_PHOTO']) {
$arUser['PERSONAL_PHOTO'] = $this->getDefaultPictureSonet($arUser['PERSONAL_GENDER']);
}
if (empty($arUser['PERSONAL_PHOTO_SOURCE'])) {
$arUser['PERSONAL_PHOTO_SOURCE'] = $arUser['PERSONAL_PHOTO'];
}
//if not run resize photo or we resize photo long time and we want stop it
if (round(getmicrotime() - $startTime, 3) > static::MAX_EXEC_RESIZE_TIME) {
$arUser['PERSONAL_PHOTO'] = CFile::ShowImage($arUser['PERSONAL_PHOTO_SOURCE'], 9999, 100);
$arUser['PERSONAL_PHOTO_RESIZED'] = false;
return false;
}
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO_SOURCE'], 100);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
$arUser['PERSONAL_PHOTO_RESIZED'] = true;
return true;
}
return false;
}