本文整理汇总了PHP中CVote::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CVote::Delete方法的具体用法?PHP CVote::Delete怎么用?PHP CVote::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVote
的用法示例。
在下文中一共展示了CVote::Delete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_intersect_key
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLog::Update($arRes["ID"], $arSonetFields);
CSocNetLogRights::SetForSonet($arRes["ID"], $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
} else {
$dbRes = CSocNetLogComments::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// message/comment
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLogComments::Update($arRes["ID"], $arSonetFields);
}
}
}
$url = ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"], "MID" => intVal($arParams["MID"]), "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"])), array("result" => $arNote["code"]));
LocalRedirect($url);
} elseif (intVal($arFieldsG["PARAM2"]) > 0 && $arFieldsG["PARAM1"] == "VT") {
CVote::Delete($arFieldsG["PARAM2"]);
}
}
if (!empty($strErrorMessage)) {
$arError[] = array("id" => $arParams["MESSAGE_TYPE"], "text" => $strErrorMessage);
}
} elseif ($arResult["VIEW"] == "Y") {
$bVarsFromForm = true;
$arFields = array("FORUM_ID" => intVal($arParams["FID"]), "TOPIC_ID" => intVal($arParams["TID"]), "MESSAGE_ID" => intVal($arParams["MID"]), "USER_ID" => intVal($GLOBALS["USER"]->GetID()));
$arFiles = array();
$arFilesExists = array();
$res = array();
foreach ($_FILES as $key => $val) {
if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
$arFiles[] = $_FILES[$key];
}
示例2: VoteVoteEditFromArray
//.........这里部分代码省略.........
$e = new CAdminException(array_reverse($aMsg));
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
} elseif (empty($arFieldsQuestions) && $VOTE_ID <= 0) {
return true;
} elseif ($params["bOnlyCheck"] == "Y") {
return true;
}
/************** Check Data/*****************************************/
/************** Main actions with return ***************************/
if (empty($arFieldsVote["TITLE"])) {
$q = reset($arFieldsQuestions);
$arFieldsVote["TITLE"] = null;
do {
if ($q["DEL"] != "Y") {
$arFieldsVote["TITLE"] = $q["QUESTION"];
break;
}
} while ($q = next($arFieldsQuestions));
reset($arFieldsQuestions);
}
if (empty($arVote)) {
$arFieldsVote["UNIQUE_TYPE"] = $params["UNIQUE_TYPE"];
$arFieldsVote["DELAY"] = $params["DELAY"];
$arFieldsVote["DELAY_TYPE"] = $params["DELAY_TYPE"];
$arVote["ID"] = intval(CVote::Add($arFieldsVote));
} else {
CVote::Update($VOTE_ID, $arFieldsVote);
}
if ($iQuestions > 0 && $arVote["ID"] > 0) {
$iQuestions = 0;
foreach ($arFieldsQuestions as $arQuestion) {
if ($arQuestion["DEL"] == "Y") {
CVoteQuestion::Delete($arQuestion["ID"]);
continue;
} elseif ($arQuestion["ID"] > 0) {
$arQuestion["C_SORT"] = ($iQuestions + 1) * 10;
CVoteQuestion::Update($arQuestion["ID"], $arQuestion);
} else {
$arQuestion["C_SORT"] = ($iQuestions + 1) * 10;
$arQuestion["VOTE_ID"] = $arVote["ID"];
$arQuestion["ID"] = intVal(CVoteQuestion::Add($arQuestion));
if ($arQuestion["ID"] <= 0) {
continue;
}
}
$iQuestions++;
$iAnswers = 0;
foreach ($arQuestion["ANSWERS"] as $arAnswer) {
if ($arAnswer["DEL"] == "Y") {
CVoteAnswer::Delete($arAnswer["ID"]);
continue;
}
if ($arAnswer["ID"] > 0) {
$arAnswer["C_SORT"] = $iAnswers * 10;
CVoteAnswer::Update($arAnswer["ID"], $arAnswer);
} else {
$arAnswer["QUESTION_ID"] = $arQuestion["ID"];
$arAnswer["C_SORT"] = ($iAnswers + 1) * 10;
$arAnswer["ID"] = intVal(CVoteAnswer::Add($arAnswer));
if ($arAnswer["ID"] <= 0) {
continue;
}
}
$iAnswers++;
}
示例3: Delete
public static function Delete($ID)
{
global $DB;
$err_mess = CAllVoteChannel::err_mess() . "<br>Function: Delete<br>Line: ";
$ID = intval($ID);
if ($ID <= 0) {
return true;
}
/***************** Event onBeforeVoteChannelDelete ******************/
foreach (GetModuleEvents("vote", "onBeforeVoteChannelDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false) {
return false;
}
}
/***************** /Event ******************************************/
// drop votes
$z = $DB->Query("SELECT ID FROM b_vote WHERE CHANNEL_ID='{$ID}'", false, $err_mess . __LINE__);
while ($zr = $z->Fetch()) {
CVote::Delete($zr["ID"]);
}
$DB->Query("DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID=" . $ID, false, $err_mess . __LINE__);
$DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=" . $ID, false, $err_mess . __LINE__);
$res = $DB->Query("DELETE FROM b_vote_channel WHERE ID=" . $ID, false, $err_mess . __LINE__);
/***************** Event onAfterVoteChannelDelete ******************/
foreach (GetModuleEvents("vote", "onAfterVoteChannelDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
/***************** /Event ******************************************/
return $res;
}
示例4: Delete
function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$arMessage = array();
if ($ID > 0) {
$arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
}
if (empty($arMessage)) {
return false;
}
/***************** Event onBeforeMessageAdd ************************/
foreach (GetModuleEvents("forum", "onBeforeMessageDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage)) === false) {
return false;
}
}
/***************** /Event ******************************************/
$AUTHOR_ID = intVal($arMessage["AUTHOR_ID"]);
$TOPIC_ID = intVal($arMessage["TOPIC_ID"]);
$FORUM_ID = intVal($arMessage["FORUM_ID"]);
$DB->StartTransaction();
// delete votes
if ($arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0 && IsModuleInstalled("vote")) {
CModule::IncludeModule("vote");
CVote::Delete($arMessage["PARAM2"]);
}
// delete files
CForumFiles::Delete(array("MESSAGE_ID" => $ID), array("DELETE_MESSAGE_FILE" => "Y"));
// delete message
$DB->Query("DELETE FROM b_forum_message WHERE ID=" . $ID);
// after delete
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID), false, 1);
$res = false;
if (!($db_res && ($res = $db_res->Fetch()))) {
CForumTopic::Delete($TOPIC_ID);
} else {
// if deleted message was first
if ($arMessage["NEW_TOPIC"] == "Y") {
$DB->Update('b_forum_message', array('NEW_TOPIC' => '"Y"'), "WHERE ID=" . $res["ID"]);
}
CForumTopic::SetStat($TOPIC_ID);
}
$DB->Commit();
$GLOBALS["USER_FIELD_MANAGER"]->Delete("FORUM_MESSAGE", $ID);
if ($AUTHOR_ID > 0) {
CForumUser::SetStat($AUTHOR_ID);
}
CForumNew::SetStat($FORUM_ID);
/***************** Event onBeforeMessageAdd ************************/
foreach (GetModuleEvents("forum", "onAfterMessageDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arMessage));
}
/***************** /Event ******************************************/
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("forum", $ID);
if (is_array($res) && !empty($res)) {
CForumMessage::Reindex($res["ID"], $res);
}
}
return true;
}
示例5: Delete
function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$bCanDelete = true;
/***************** Event OnBeforeForumDelete ***********************/
foreach (GetModuleEvents("forum", "OnBeforeForumDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false) {
$bCanDelete = false;
break;
}
}
/***************** /Event ******************************************/
if (!$bCanDelete) {
return false;
}
/***************** Event OnForumDelete *****************************/
foreach (GetModuleEvents("forum", "OnForumDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$ID));
}
/***************** /Event ******************************************/
/***************** Cleaning cache **********************************/
unset($GLOBALS["FORUM_CACHE"]["FORUM"][$ID]);
if (CACHED_b_forum !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum");
}
if (CACHED_b_forum_perms !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_perms");
}
if (CACHED_b_forum2site !== false) {
$GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum2site");
}
/***************** Cleaning cache/**********************************/
/***************** Search module ***********************************/
set_time_limit(0);
if (CModule::IncludeModule("search")) {
CSearch::DeleteIndex("forum", false, $ID);
}
CForumFiles::Delete(array("FORUM_ID" => $ID), array("DELETE_FORUM_FILE" => "Y"));
$DB->StartTransaction();
// Update USER statistic
$arProcAuth = array();
$db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "!AUTHOR_ID" => 0));
while ($res = $db_res->Fetch()) {
$res["AUTHOR_ID"] = intVal($res["AUTHOR_ID"]);
if (!in_array($res["AUTHOR_ID"], $arProcAuth)) {
$arProcAuth[] = intVal($res["AUTHOR_ID"]);
}
}
if (IsModuleInstalled("vote")) {
$db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "PARAM1" => "VT", "!PARAM2" => 0));
if ($db_res && ($res = $db_res->Fetch())) {
CModule::IncludeModule("vote");
do {
CVote::Delete($res["PARAM2"]);
} while ($res = $db_res->Fetch());
}
}
if (!$DB->Query("DELETE FROM b_forum_subscribe WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum_message WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum_topic WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum_perms WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum2site WHERE FORUM_ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
if (!$DB->Query("DELETE FROM b_forum WHERE ID=" . $ID, true)) {
$DB->Rollback();
return false;
}
// Update USER statistic
foreach ($arProcAuth as $i => $procAuth) {
CForumUser::SetStat($procAuth);
}
$DB->Commit();
/***************** Event OnAfterForumDelete ************************/
foreach (GetModuleEvents("forum", "OnAfterForumDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
/***************** /Event ******************************************/
return true;
}
示例6: Delete
function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$arTopic = CForumTopic::GetByID($ID);
if (empty($arTopic)) {
return false;
}
/***************** Event onBeforeTopicDelete ***********************/
$events = GetModuleEvents("forum", "onBeforeTopicDelete");
while ($arEvent = $events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$ID, $arTopic)) === false) {
return false;
}
}
/***************** /Event ******************************************/
$arAuthor = array();
$arVotes = array();
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $ID));
while ($res = $db_res->Fetch()) {
if (intVal($res["AUTHOR_ID"]) > 0) {
$arAuthor[intVal($res["AUTHOR_ID"])] = $res["AUTHOR_ID"];
}
if ($res["PARAM1"] == "VT" && intVal($res["PARAM2"]) > 0) {
$arVotes[] = intVal($res["PARAM2"]);
}
}
if (!empty($arVotes) && IsModuleInstalled("vote") && CModule::IncludeModule("vote")) {
foreach ($arVotes as $res) {
CVote::Delete($res);
}
}
// $DB->StartTransaction();
CForumFiles::Delete(array("TOPIC_ID" => $ID), array("DELETE_TOPIC_FILE" => "Y"));
$DB->Query("DELETE FROM b_forum_subscribe WHERE TOPIC_ID = " . $ID . "");
$DB->Query("DELETE FROM b_forum_message WHERE TOPIC_ID = " . $ID . "");
$DB->Query("DELETE FROM b_forum_user_topic WHERE TOPIC_ID = " . $ID . "");
$DB->Query("DELETE FROM b_forum_topic WHERE ID = " . $ID . "");
$DB->Query("DELETE FROM b_forum_topic WHERE TOPIC_ID = " . $ID . "");
$DB->Query("DELETE FROM b_forum_stat WHERE TOPIC_ID = " . $ID . "");
// $DB->Commit();
unset($GLOBALS["FORUM_CACHE"]["TOPIC"][$ID]);
unset($GLOBALS["FORUM_CACHE"]["TOPIC_FILTER"][$ID]);
foreach ($arAuthor as $key) {
CForumUser::SetStat($key);
}
CForumNew::SetStat($arTopic["FORUM_ID"]);
if (IsModuleInstalled("search") && CModule::IncludeModule("search")) {
CSearch::DeleteIndex("forum", false, $arTopic["FORUM_ID"], $ID);
}
/***************** Event onAfterTopicDelete ************************/
$events = GetModuleEvents("forum", "onAfterTopicDelete");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$ID, $arTopic));
}
/***************** /Event ******************************************/
return true;
}
示例7: array
if ($_REQUEST['action_target'] == 'selected') {
$arID = array();
$rsData = CVote::GetList($by, $order, $arFilter, $is_filtered);
while ($arRes = $rsData->Fetch()) {
$arID[] = $arRes['ID'];
}
}
$arID = is_array($arID) ? $arID : array($arID);
foreach ($arID as $ID) {
$ID = intVal($ID);
if ($ID <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
CVote::Delete($ID);
break;
case "activate":
case "deactivate":
if (!CVote::Update($ID, array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N"))) {
if ($ex = $GLOBALS['APPLICATION']->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(GetMessage("VOTE_SAVE_ERROR"), $ID);
}
}
break;
}
}
}
/********************************************************************
示例8: Delete
/**
* <p>Удаляет сообщение с кодом <i>ID</i>.</p> <p><b>Примечание</b>. Метод использует внутреннюю транзакцию. Если у вас используется <b>MySQL</b> и <b>InnoDB</b>, и ранее была открыта транзакция, то ее необходимо закрыть до подключения метода.</p>
*
*
*
*
* @param int $ID Код сообщения, которое необходимо удалить.
*
*
*
* @return bool
*
*
* <h4>See Also</h4>
* <ul><li>Перед удалением сообщения следует проверить возможность
* удаления методом <a
* href="http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/canuserdeletemessage.php">CForumMessage::CanUserDeleteMessage</a>
* </li></ul>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
$ID = intVal($ID);
$arMessage = array();
if ($ID > 0)
$arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
if (empty($arMessage))
return false;
/***************** Event onBeforeMessageAdd ************************/
$events = GetModuleEvents("forum", "onBeforeMessageDelete");
while ($arEvent = $events->Fetch())
{
if (ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage)) === false)
return false;
}
/***************** /Event ******************************************/
$AUTHOR_ID = intVal($arMessage["AUTHOR_ID"]);
$TOPIC_ID = intVal($arMessage["TOPIC_ID"]);
$FORUM_ID = intVal($arMessage["FORUM_ID"]);
$DB->StartTransaction();
// delete votes
if ($arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0 && IsModuleInstalled("vote")):
CModule::IncludeModule("vote");
CVote::Delete($arMessage["PARAM2"]);
endif;
// delete files
CForumFiles::Delete(array("MESSAGE_ID" => $ID), array("DELETE_MESSAGE_FILE" => "Y"));
// delete message
$DB->Query("DELETE FROM b_forum_message WHERE ID=".$ID);
// after delete
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID), false, 1);
$res = false;
if (!($db_res && $res = $db_res->Fetch())):
CForumTopic::Delete($TOPIC_ID);
else:
// if deleted message was first
if ($arMessage["NEW_TOPIC"] == "Y"):
$DB->Query("UPDATE b_forum_message SET NEW_TOPIC='Y' WHERE ID=".$res["ID"]);
endif;
CForumTopic::SetStat($TOPIC_ID);
endif;
$DB->Commit();
$GLOBALS["USER_FIELD_MANAGER"]->Delete("FORUM_MESSAGE", $ID);
if ($AUTHOR_ID > 0):
CForumUser::SetStat($AUTHOR_ID);
endif;
CForumNew::SetStat($FORUM_ID);
/***************** Event onBeforeMessageAdd ************************/
$events = GetModuleEvents("forum", "onAfterMessageDelete");
while ($arEvent = $events->Fetch())
ExecuteModuleEventEx($arEvent, array($ID, $arMessage));
/***************** /Event ******************************************/
if (CModule::IncludeModule("search"))
{
CSearch::DeleteIndex("forum", $ID);
}
return true;
}
示例9: Delete
public static function Delete($ID)
{
global $DB, $CACHE_MANAGER;
$err_mess = (CAllVoteChannel::err_mess())."<br>Function: Delete<br>Line: ";
$ID = intval($ID);
if ($ID <= 0):
return true;
endif;
/***************** Event onBeforeVoteChannelDelete ******************/
$events = GetModuleEvents("vote", "onBeforeVoteChannelDelete");
while ($arEvent = $events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false)
return false; }
/***************** /Event ******************************************/
// drop votes
$strSql = "SELECT ID FROM b_vote WHERE CHANNEL_ID='$ID'";
$z = $DB->Query($strSql, false, $err_mess.__LINE__);
while ($zr = $z->Fetch()) CVote::Delete($zr["ID"]);
$DB->Query("DELETE FROM b_vote_channel_2_group WHERE CHANNEL_ID=".$ID, false, $err_mess.__LINE__);
$DB->Query("DELETE FROM b_vote_channel_2_site WHERE CHANNEL_ID=".$ID, false, $err_mess.__LINE__);
$res = $DB->Query("DELETE FROM b_vote_channel WHERE ID=".$ID, false, $err_mess.__LINE__);
/***************** Event onAfterVoteChannelDelete ******************/
$events = GetModuleEvents("vote", "onAfterVoteChannelDelete");
while ($arEvent = $events->Fetch())
ExecuteModuleEventEx($arEvent, array($ID));
/***************** /Event ******************************************/
return $res;
}