本文整理汇总了PHP中CSocNetFeaturesPerms::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeaturesPerms::Update方法的具体用法?PHP CSocNetFeaturesPerms::Update怎么用?PHP CSocNetFeaturesPerms::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetFeaturesPerms
的用法示例。
在下文中一共展示了CSocNetFeaturesPerms::Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetPerm
function SetPerm($featureID, $operation, $perm)
{
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
$featureID = IntVal($featureID);
$operation = Trim($operation);
$perm = Trim($perm);
$dbResult = CSocNetFeaturesPerms::GetList(array(), array("FEATURE_ID" => $featureID, "OPERATION_ID" => $operation), false, false, array("ID", "FEATURE_ENTITY_TYPE", "FEATURE_ENTITY_ID", "FEATURE_FEATURE", "OPERATION_ID", "ROLE"));
if ($arResult = $dbResult->Fetch()) {
$r = CSocNetFeaturesPerms::Update($arResult["ID"], array("ROLE" => $perm));
} else {
$r = CSocNetFeaturesPerms::Add(array("FEATURE_ID" => $featureID, "OPERATION_ID" => $operation, "ROLE" => $perm));
}
if (!$r) {
$errorMessage = "";
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage = $e->GetString();
}
if (StrLen($errorMessage) <= 0) {
$errorMessage = GetMessage("SONET_GF_ERROR_SET") . ".";
}
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_SET_RECORD");
return false;
} else {
if (!$arResult) {
$arFeature = CSocNetFeatures::GetByID($featureID);
$entity_type = $arFeature["ENTITY_TYPE"];
$entity_id = $arFeature["ENTITY_ID"];
$feature = $arFeature["FEATURE"];
} else {
$entity_type = $arResult["FEATURE_ENTITY_TYPE"];
$entity_id = $arResult["FEATURE_ENTITY_ID"];
$feature = $arResult["FEATURE_FEATURE"];
}
if (empty($arResult) || $arResult["ROLE"] != $perm) {
if ($arResult && $arResult["ROLE"] != $perm) {
CSocNetSearch::SetFeaturePermissions($entity_type, $entity_id, $feature, $arResult["OPERATION_ID"], $perm);
} else {
CSocNetSearch::SetFeaturePermissions($entity_type, $entity_id, $feature, $operation, $perm);
}
}
if (!in_array($feature, array("tasks", "files", "blog")) && is_array($arSocNetFeaturesSettings[$feature]["subscribe_events"])) {
$arEventsTmp = array_keys($arSocNetFeaturesSettings[$feature]["subscribe_events"]);
$rsLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => $arEventsTmp), false, false, array("ID", "EVENT_ID"));
while ($arLog = $rsLog->Fetch()) {
CSocNetLogRights::DeleteByLogID($arLog["ID"]);
CSocNetLogRights::SetForSonet($arLog["ID"], $entity_type, $entity_id, $feature, $arSocNetFeaturesSettings[$feature]["subscribe_events"][$arLog["EVENT_ID"]]["OPERATION"]);
}
}
}
return $r;
}