本文整理汇总了PHP中CSocNetFeatures::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeatures::Add方法的具体用法?PHP CSocNetFeatures::Add怎么用?PHP CSocNetFeatures::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetFeatures
的用法示例。
在下文中一共展示了CSocNetFeatures::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IntVal
$arGroupsId[$ind] = IntVal($idTmp);
} else {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorString .= $e->GetString();
}
$bSonetError = true;
}
}
}
if (!$bSonetError) {
foreach ($arGroupsId as $ind => $val) {
CSocNetUserToGroup::Add(array("USER_ID" => 1, "GROUP_ID" => $val, "ROLE" => "A", "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER, "INITIATED_BY_USER_ID" => 1, "MESSAGE" => false));
}
foreach ($arGroupsId as $ind => $val) {
CSocNetFeatures::Add(array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $val, "FEATURE" => "forum", "FEATURE_NAME" => GetSocNetMessageLocal("SONET_I_FEATURE_FORUM", $arSite["LANGUAGE_ID"]), "ACTIVE" => "Y", "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction()));
CSocNetFeatures::Add(array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $val, "FEATURE" => "blog", "FEATURE_NAME" => GetSocNetMessageLocal("SONET_I_FEATURE_BLOG", $arSite["LANGUAGE_ID"]), "ACTIVE" => "Y", "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction()));
}
}
}
}
// ------------------ FORUM -------------------------------
$forumID = 0;
if (CModule::IncludeModule("forum")) {
$dbResult = CForumNew::GetListEx(array(), array("SITE_ID" => $arSite["SITE_ID"], "XML_ID" => "car_forum_demo"));
if ($arResult = $dbResult->Fetch()) {
$forumID = $arResult["ID"];
} else {
$arFields = array("NAME" => GetSocNetMessageLocal("SONET_I_FORUM_NAME", $arSite["LANGUAGE_ID"]), "ACTIVE" => "Y", "XML_ID" => "car_forum_demo", "MODERATION" => "N", "SITES" => array($arSite["SITE_ID"] => StrLen($arSite["DIR"]) > 0 ? $arSite["DIR"] : "/"));
$forumID = CForumNew::Add($arFields);
}
}
示例2: SetFeature
function SetFeature($type, $id, $feature, $active, $featureName = false)
{
global $arSocNetAllowedEntityTypes, $APPLICATION;
$type = Trim($type);
if (StrLen($type) <= 0 || !in_array($type, $arSocNetAllowedEntityTypes)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_ENTITY_TYPE"), "ERROR_EMPTY_TYPE");
return false;
}
$id = IntVal($id);
if ($id <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_ENTITY_ID"), "ERROR_EMPTY_ENTITY_ID");
return false;
}
$feature = StrToLower(Trim($feature));
if (StrLen($feature) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_EMPTY_FEATURE_ID"), "ERROR_EMPTY_FEATURE_ID");
return false;
}
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
if (!array_key_exists($feature, $arSocNetFeaturesSettings) || !in_array($type, $arSocNetFeaturesSettings[$feature]["allowed"])) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GF_ERROR_NO_FEATURE_ID"), "ERROR_NO_FEATURE_ID");
return false;
}
$active = $active ? "Y" : "N";
$dbResult = CSocNetFeatures::GetList(array(), array("ENTITY_TYPE" => $type, "ENTITY_ID" => $id, "FEATURE" => $feature), false, false, array("ID", "ACTIVE"));
if ($arResult = $dbResult->Fetch()) {
$r = CSocNetFeatures::Update($arResult["ID"], array("FEATURE_NAME" => $featureName, "ACTIVE" => $active, "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction()));
} else {
$r = CSocNetFeatures::Add(array("ENTITY_TYPE" => $type, "ENTITY_ID" => $id, "FEATURE" => $feature, "FEATURE_NAME" => $featureName, "ACTIVE" => $active, "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction()));
}
if (!$r) {
$errorMessage = "";
if ($e = $APPLICATION->GetException()) {
$errorMessage = $e->GetString();
}
if (StrLen($errorMessage) <= 0) {
$errorMessage = GetMessage("SONET_GF_ERROR_SET") . ".";
}
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_SET_RECORD");
return false;
}
return $r;
}