本文整理汇总了PHP中CSocNetFeaturesPerms::CheckFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeaturesPerms::CheckFields方法的具体用法?PHP CSocNetFeaturesPerms::CheckFields怎么用?PHP CSocNetFeaturesPerms::CheckFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetFeaturesPerms
的用法示例。
在下文中一共展示了CSocNetFeaturesPerms::CheckFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
/**
* <p>Создает новое право.</p> <p><b>Примечание</b>: для установки параметров права может так же использоваться метод <a href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/SetPerm.php">CSocNetFeaturesPerms::SetPerm</a>.</p>
*
*
*
*
* @param array $arFields Массив значений параметров. Допустимые ключи:<br> FEATURE_ID - код
* дополнительного функционала,<br> OPERATION_ID - код операции,<br> ROLE - роль.
*
*
*
* @return int <p>Код вставленной записи.</p>
*
*
* <h4>See Also</h4>
* <ul> <li><a
* href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/SetPerm.php">CSocNetFeaturesPerms::SetPerm</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/Update.php">CSocNetFeaturesPerms::Update</a></li>
* </ul>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetFeaturesPerms/Add.php
* @author Bitrix
*/
public static function Add($arFields)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value)
{
if (substr($key, 0, 1) == "=")
{
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetFeaturesPerms::CheckFields("ADD", $arFields))
return false;
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetFeaturesPermsAdd");
while ($arEvent = $db_events->Fetch())
if (ExecuteModuleEventEx($arEvent, array($arFields))===false)
return false;
$arInsert = $DB->PrepareInsert("b_sonet_features2perms", $arFields);
foreach ($arFields1 as $key => $value)
{
if (strlen($arInsert[0]) > 0)
$arInsert[0] .= ", ";
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0)
$arInsert[1] .= ", ";
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0)
{
$strSql =
"INSERT INTO b_sonet_features2perms(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
$events = GetModuleEvents("socialnetwork", "OnSocNetFeaturesPermsAdd");
while ($arEvent = $events->Fetch())
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
if (
intval($arFields["FEATURE_ID"]) > 0
&& defined("BX_COMP_MANAGED_CACHE")
)
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_feature_".$arFields["FEATURE_ID"]);
}
return $ID;
}
示例2: Update
function Update($ID, $arFields)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetFeaturesPerms::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetFeaturesPermsUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, $arFields)) === false) {
return false;
}
}
$strUpdate = $DB->PrepareUpdate("b_sonet_features2perms", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_sonet_features2perms SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$events = GetModuleEvents("socialnetwork", "OnSocNetFeaturesPermsUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_features2perms_" . $ID);
} else {
$dbGroupFeaturePerm = CSocNetFeaturesPerms::GetList(array(), array("ID" => $ID), false, false, array("FEATURE_ENTITY_TYPE", "FEATURE_ENTITY_ID"));
if ($arGroupFeaturePerm = $dbGroupFeaturePerm->Fetch()) {
$cache = new CPHPCache();
$cache->CleanDir("/sonet/features_perms/" . $arGroupFeaturePerm["FEATURE_ENTITY_TYPE"] . "_" . $arGroupFeaturePerm["FEATURE_ENTITY_ID"] . "/");
}
}
} else {
$ID = False;
}
return $ID;
}