• Модуль: vote
  • Путь к файлу: ~/bitrix/modules/vote/classes/general/channel.php
  • Класс: CAllVoteChannel
  • Вызов: CAllVoteChannel::Add
static function Add($arFields)
{
	global $DB;

	if (!self::CheckFields("ADD", $arFields))
		return false;
/***************** Event onBeforeMessageAdd ************************/
	foreach (GetModuleEvents("vote", "onBeforeVoteChannelAdd", true) as $arEvent)
		if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false)
			return false;
/***************** /Event ******************************************/
	if ($DB->type == "ORACLE")
		$arFields["ID"] = $DB->NextID("SQ_B_VOTE_CHANNEL");

	$arInsert = $DB->PrepareInsert("b_vote_channel", $arFields);

	$strSql = "INSERT INTO b_vote_channel (".$arInsert[0].", TIMESTAMP_X) ".
		"VALUES(".$arInsert[1].", ".$DB->GetNowFunction().")";

	$DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__); $ID = intval($DB->type == "ORACLE" ? $arFields["ID"] : $DB->LastID()); if ($ID > 0) { 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", "onAfterVoteChannelAdd", true) as $arEvent) ExecuteModuleEventEx($arEvent, array($ID, $arFields)); /***************** /Events *****************************************/ return $ID; }