本文整理汇总了PHP中CSocNetGroup::CanUserViewGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetGroup::CanUserViewGroup方法的具体用法?PHP CSocNetGroup::CanUserViewGroup怎么用?PHP CSocNetGroup::CanUserViewGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetGroup
的用法示例。
在下文中一共展示了CSocNetGroup::CanUserViewGroup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
echo $arResult["TASK"]["GROUP_ID"];
?>
, this)"></span><?php
} else {
echo GetMessage("TASKS_GROUP_ADD");
?>
</a><?php
}
?>
</span></div>
<input id="task-detail-selected-group-id" type="hidden" value="<?php
echo (int) $arResult["TASK"]["GROUP_ID"];
?>
">
<?php
} elseif ($arResult["TASK"]["GROUP_ID"] && CSocNetGroup::CanUserViewGroup($USER->GetID(), $arResult["TASK"]["GROUP_ID"])) {
?>
<div class="task-detail-group"><span class="task-detail-group-label"><?php
echo GetMessage("TASKS_TASK_GROUP");
?>
:</span><span class="task-detail-group-name"><a href="<?php
echo CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["TASK"]["GROUP_ID"]));
?>
" class="task-detail-group-link" target="_top"><?php
echo $arResult["GROUPS"][$arResult["TASK"]["GROUP_ID"]]['NAME'];
?>
</a></span></div>
<?php
}
?>
示例2: array_unique
}
}
}
if (!empty($arTasksIds)) {
$arTasksIds = array_unique(array_filter($arTasksIds));
if (!empty($arTasksIds)) {
$rsTasks = CTasks::GetList(array('ID' => 'ASC'), array('ID' => $arTasksIds), array('ID', 'TITLE'));
while ($arTask = $rsTasks->getNext()) {
$arTask['URL'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_TASKS_TASK'], array('task_id' => $arTask['ID'], 'action' => 'view'));
$arResult['TASKS_DATA'][$arTask['ID']] = $arTask;
}
}
}
}
// check out which sections we need to show
$arResult['DISPLAY_BLOCKS'] = array('CONNECTED_ENTITIES' => false, 'PROPERTIES' => false);
if (!empty($arResult["TASK"]["TAGS"]) || $arResult["TASK"]["GROUP_ID"] && CSocNetGroup::CanUserViewGroup($USER->GetID(), $arResult["TASK"]["GROUP_ID"]) || intval($arResult["TASK"]["BASE_TEMPLATE_ID"]) || intval($arResult["TASK"]["PARENT_ID"])) {
$arResult['DISPLAY_BLOCKS']['CONNECTED_ENTITIES'] = true;
}
if (is_array($arResult["USER_FIELDS"]) && !empty($arResult["USER_FIELDS"])) {
foreach ($arResult["USER_FIELDS"] as $fld) {
if (!empty($fld['VALUE'])) {
if ($arUserField['FIELD_NAME'] == 'UF_TASK_WEBDAV_FILES') {
$arResult['DISPLAY_BLOCKS']['CONNECTED_ENTITIES'] = true;
} else {
$arResult['DISPLAY_BLOCKS']['PROPERTIES'] = true;
}
// other user fields at "PROPERTIES"
}
}
}
示例3: checkUserCanViewGroup
private static function checkUserCanViewGroup($userId, $groupId)
{
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
if (!isset(self::$cache['GROUP_ACCESS'][$groupId][$userId]) || !self::$cacheData) {
self::$cache['GROUP_ACCESS'][$groupId][$userId] = CSocNetGroup::CanUserViewGroup($userId, $groupId);
}
return self::$cache['GROUP_ACCESS'][$groupId][$userId];
}
示例4: array_merge
}
break;
case 'AUDITORS':
case 'ACCOMPLICES':
if ($record['FROM_VALUE']) {
$arUsersIds = array_merge($arUsersIds, explode(',', $record['FROM_VALUE']));
}
if ($record['TO_VALUE']) {
$arUsersIds = array_merge($arUsersIds, explode(',', $record['TO_VALUE']));
}
break;
case 'GROUP_ID':
if ($record['FROM_VALUE'] && !isset($arGroupsIds[(int) $record['FROM_VALUE']]) && CSocNetGroup::CanUserViewGroup($loggedInUserId, $record['FROM_VALUE'])) {
$arGroupsIds[$record['FROM_VALUE']] = (int) $record['FROM_VALUE'];
}
if ($record['TO_VALUE'] && !isset($arGroupsIds[(int) $record['TO_VALUE']]) && CSocNetGroup::CanUserViewGroup($loggedInUserId, $record['TO_VALUE'])) {
$arGroupsIds[$record['FROM_VALUE']] = (int) $record['TO_VALUE'];
}
break;
case 'PARENT_ID':
if ($record['FROM_VALUE']) {
$arTasksIds[] = (int) $record['FROM_VALUE'];
}
if ($record['TO_VALUE']) {
$arTasksIds[] = (int) $record['TO_VALUE'];
}
break;
case 'DEPENDS_ON':
if ($record['FROM_VALUE']) {
$arTasksIds = array_merge($arTasksIds, explode(',', $record['FROM_VALUE']));
}
示例5: sprintf
case "TIME_ESTIMATE":
if ($arResult["TASKS"][$i][$field]) {
$arResult["TASKS"][$i][$field] = sprintf('%02d:%02d:%02d', floor($arResult["TASKS"][$i][$field] / 3600), floor($arResult["TASKS"][$i][$field] / 60) % 60, $arResult["TASKS"][$i][$field] % 60);
} else {
$arResult["TASKS"][$i][$field] = "";
}
break;
case "TIME_SPENT_IN_LOGS":
if ($arResult["TASKS"][$i][$field]) {
$arResult["TASKS"][$i][$field] = sprintf('%02d:%02d:%02d', floor($arResult["TASKS"][$i][$field] / 3600), floor($arResult["TASKS"][$i][$field] / 60) % 60, $arResult["TASKS"][$i][$field] % 60);
} else {
$arResult["TASKS"][$i][$field] = "";
}
break;
case "GROUP_ID":
if ($arResult["TASKS"][$i][$field] && CSocNetGroup::CanUserViewGroup($USER->GetID(), $arResult["TASKS"][$i][$field])) {
$arGroup = CSocNetGroup::GetByID($arResult["TASKS"][$i][$field]);
if ($arGroup) {
$arResult["TASKS"][$i][$field] = $arGroup["NAME"];
}
}
if (!$arResult["TASKS"][$i][$field]) {
$arResult["TASKS"][$i][$field] = "";
}
default:
break;
}
echo '<td>' . $arResult["TASKS"][$i][$field] . '</td>';
}
?>
</tr>
示例6: SendUpdateMessage
//.........这里部分代码省略.........
$tzOffset = (int) CTasksTools::getTimeZoneOffset($userId);
if (!isset($arVolatileDescriptions[$tzOffset])) {
$arVolatileDescriptions[$tzOffset] = array();
}
if (!isset($arVolatileDescriptions[$tzOffset][$placeholder])) {
// Make bitrix timestamps for given user
$bitrixTsFromValue = $utsFromValue + $tzOffset;
$bitrixTsToValue = $utsToValue + $tzOffset;
$description = '';
if ($utsFromValue > 360000) {
$fromValueAsString = FormatDate('^' . CDatabase::DateFormatToPHP(FORMAT_DATETIME), $bitrixTsFromValue);
$description .= $fromValueAsString;
}
$description .= ' --> ';
if ($utsToValue > 360000) {
$toValueAsString = FormatDate('^' . CDatabase::DateFormatToPHP(FORMAT_DATETIME), $bitrixTsToValue);
$description .= $toValueAsString;
}
$arVolatileDescriptions[$tzOffset][$placeholder] = $description;
}
$arRecipientsIDsByTimezone[$tzOffset][] = $userId;
}
break;
case "DESCRIPTION":
$tmpStr .= HTMLToTxt($arFields["DESCRIPTION"]);
break;
case "TAGS":
$tmpStr .= ($value["FROM_VALUE"] ? str_replace(",", ", ", $value["FROM_VALUE"]) . " -> " : "") . ($value["TO_VALUE"] ? str_replace(",", ", ", $value["TO_VALUE"]) : GetMessage("TASKS_MESSAGE_NO_VALUE"));
break;
case "PRIORITY":
$tmpStr .= GetMessage("TASKS_PRIORITY_" . $value["FROM_VALUE"]) . " -> " . GetMessage("TASKS_PRIORITY_" . $value["TO_VALUE"]);
break;
case "GROUP_ID":
if ($value["FROM_VALUE"] && CSocNetGroup::CanUserViewGroup($USER->GetID(), $value["FROM_VALUE"])) {
$arGroupFrom = CSocNetGroup::GetByID($value["FROM_VALUE"]);
if ($arGroupFrom) {
$tmpStr .= $arGroupFrom["NAME"] . " -> ";
}
}
if ($value["TO_VALUE"] && CSocNetGroup::CanUserViewGroup($USER->GetID(), $value["TO_VALUE"])) {
$arGroupTo = CSocNetGroup::GetByID($value["TO_VALUE"]);
if ($arGroupTo) {
$tmpStr .= $arGroupTo["NAME"];
}
} else {
$tmpStr .= GetMessage("TASKS_MESSAGE_NO_VALUE");
}
break;
case "PARENT_ID":
if ($value["FROM_VALUE"]) {
$rsTaskFrom = CTasks::GetList(array(), array("ID" => $value["FROM_VALUE"]), array('ID', 'TITLE'));
if ($arTaskFrom = $rsTaskFrom->GetNext()) {
$tmpStr .= $arTaskFrom["TITLE"] . " -> ";
}
}
if ($value["TO_VALUE"]) {
$rsTaskTo = CTasks::GetList(array(), array("ID" => $value["TO_VALUE"]), array('ID', 'TITLE'));
if ($arTaskTo = $rsTaskTo->GetNext()) {
$tmpStr .= $arTaskTo["TITLE"];
}
} else {
$tmpStr .= GetMessage("TASKS_MESSAGE_NO_VALUE");
}
break;
case "DEPENDS_ON":
$arTasksFromStr = array();
示例7: HasUserReadAccessToGroup
/**
* @param integer $userId
* @param integer $groupId
* @return bool true if user can access group, false otherwise
*/
public static function HasUserReadAccessToGroup($userId, $groupId)
{
// Roles allowed for extranet user to grant access to read task in group
static $arAllowedRoles = array(SONET_ROLES_MODERATOR, SONET_ROLES_USER, SONET_ROLES_OWNER);
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
if (!($userId > 0 && $groupId > 0)) {
return false;
}
if (self::IsIntranetUser($userId)) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
return CSocNetGroup::CanUserViewGroup($userId, $groupId);
}
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$userRole = CSocNetUserToGroup::GetUserRole($userId, $groupId);
if (in_array($userRole, $arAllowedRoles)) {
return true;
}
return false;
}