- Модуль: vote
- Путь к файлу: ~/bitrix/modules/vote/classes/general/channel.php
- Класс: CAllVoteChannel
- Вызов: CAllVoteChannel::Update
static function Update($ID, $arFields)
{
global $DB;
if (!self::CheckFields("UPDATE", $arFields, $ID))
return false;
$ID = intval($ID);
/***************** Event onBeforeMessageAdd ************************/
foreach (GetModuleEvents("vote", "onBeforeVoteChannelUpdate", true) as $arEvent)
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false)
return false;
/***************** /Event ******************************************/
$strUpdate = $DB->PrepareUpdate("b_vote_channel", $arFields);
$strSql = "UPDATE b_vote_channel SET ".$strUpdate." WHERE ID=".$ID;
$DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__);
if (!empty($arFields["SITE"]))
{
$DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=".$ID, false, "File: ".__FILE__."
Line: ".__LINE__);
foreach ($arFields["SITE"] as $sid)
{
$strSql = "INSERT INTO b_vote_channel_2_site (CHANNEL_ID, SITE_ID) ".
"VALUES ($ID, '".$DB->ForSql($sid, 2)."')";
$DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__);
}
}
if (is_array($arFields["GROUP_ID"]) && !empty($arFields["GROUP_ID"]))
self::SetAccessPermissions($ID, $arFields["GROUP_ID"]);
/***************** Events onAfterMessageAdd ************************/
foreach (GetModuleEvents("vote", "onAfterVoteChannelUpdate", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
/***************** /Events *****************************************/
return $ID;
}