本文整理汇总了PHP中ExecuteModuleEventEx函数的典型用法代码示例。如果您正苦于以下问题:PHP ExecuteModuleEventEx函数的具体用法?PHP ExecuteModuleEventEx怎么用?PHP ExecuteModuleEventEx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ExecuteModuleEventEx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Fetch
function Fetch()
{
static $arSite = array();
$r = parent::Fetch();
if ($r) {
$site_id = $r["SITE_ID"];
if (!isset($arSite[$site_id])) {
$rsSite = CSite::GetList($b, $o, array("ID" => $site_id));
$arSite[$site_id] = $rsSite->Fetch();
}
$r["DIR"] = $arSite[$site_id]["DIR"];
$r["SERVER_NAME"] = $arSite[$site_id]["SERVER_NAME"];
if (strlen($r["SITE_URL"]) > 0) {
$r["URL"] = $r["SITE_URL"];
}
if (substr($r["URL"], 0, 1) == "=") {
foreach (GetModuleEvents("search", "OnSearchGetURL", true) as $arEvent) {
$r["URL"] = ExecuteModuleEventEx($arEvent, array($r));
}
}
$r["URL"] = str_replace(array("#LANG#", "#SITE_DIR#", "#SERVER_NAME#"), array($r["DIR"], $r["DIR"], $r["SERVER_NAME"]), $r["URL"]);
$r["URL"] = preg_replace("'(?<!:)/+'s", "/", $r["URL"]);
unset($r["SITE_URL"]);
}
return $r;
}
示例2: Delete
function Delete($ID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
$rsUser2UserOld = $DB->Query("SELECT * FROM b_sonet_user_relations WHERE ID = " . $ID . "");
if ($arUser2UserOld = $rsUser2UserOld->Fetch()) {
CSocNetSearch::OnUserRelationsChange($arUser2UserOld["FIRST_USER_ID"]);
CSocNetSearch::OnUserRelationsChange($arUser2UserOld["SECOND_USER_ID"]);
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetUserRelationsDelete");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
$events = GetModuleEvents("socialnetwork", "OnSocNetUserRelationsDelete");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
if ($bSuccess) {
$arRelation = CSocNetUserRelations::GetByID($ID);
$bSuccess = $DB->Query("DELETE FROM b_sonet_user_relations WHERE ID = " . $ID . "", true);
}
if ($bSuccess) {
if ($arRelation && $arRelation["RELATION"] == SONET_RELATIONS_FRIEND) {
$GLOBALS["DB"]->Query("DELETE FROM b_sonet_event_user_view WHERE\n\t\t\t\t\tENTITY_TYPE = '" . SONET_ENTITY_USER . "'\n\t\t\t\t\tAND (\n\t\t\t\t\t\t(USER_ID = " . $arRelation["FIRST_USER_ID"] . " AND ENTITY_ID = " . $arRelation["SECOND_USER_ID"] . ")\n\t\t\t\t\t\tOR (USER_ID = " . $arRelation["SECOND_USER_ID"] . " AND ENTITY_ID = " . $arRelation["FIRST_USER_ID"] . ")\n\t\t\t\t\t\tOR (ENTITY_ID = " . $arRelation["FIRST_USER_ID"] . " AND USER_IM_ID = " . $arRelation["SECOND_USER_ID"] . ")\n\t\t\t\t\t\tOR (ENTITY_ID = " . $arRelation["SECOND_USER_ID"] . " AND USER_IM_ID = " . $arRelation["FIRST_USER_ID"] . ")\n\t\t\t\t\t\tOR (USER_ID = " . $arRelation["FIRST_USER_ID"] . " AND USER_IM_ID = " . $arRelation["SECOND_USER_ID"] . ")\n\t\t\t\t\t\tOR (USER_ID = " . $arRelation["SECOND_USER_ID"] . " AND USER_IM_ID = " . $arRelation["FIRST_USER_ID"] . ")\n\t\t\t\t\t\t)", true);
}
}
return $bSuccess;
}
示例3: Update
public static function Update($id, $arFields)
{
global $DB;
$id = intval($id);
if ($id <= 0) {
throw new Exception("id");
}
self::ParseFields($arFields, $id);
$strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
$strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (is_set($arFields, "USERS")) {
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
CUserCounter::ClearByTag($id, 'bp_tasks', '**');
$ar = array();
foreach ($arFields["USERS"] as $userId) {
$userId = intval($userId);
if (in_array($userId, $ar)) {
continue;
}
$DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ") ");
CUserCounter::Increment($userId, 'bp_tasks', '**');
$ar[] = $userId;
}
}
$events = GetModuleEvents("bizproc", "OnTaskUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($id, $arFields));
}
return $id;
}
示例4: Update
public static function Update($ID, $arFields)
{
global $DB;
$e = GetModuleEvents('timeman', 'OnBeforeTMReportUpdate');
while ($a = $e->Fetch()) {
if (false === ExecuteModuleEventEx($a, array($arFields))) {
return false;
}
}
if (!self::CheckFields('UPDATE', $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate('b_timeman_reports', $arFields);
$query = 'UPDATE b_timeman_reports SET ' . $strUpdate . ' WHERE ID=\'' . intval($ID) . '\'';
if (($dbRes = $DB->Query($query)) && $dbRes->AffectedRowsCount() > 0) {
if (isset($arFields['REPORT'])) {
$DB->QueryBind($query, array('REPORT' => $arFields['REPORT']));
}
$e = GetModuleEvents('timeman', 'OnAfterTMReportUpdate');
while ($a = $e->Fetch()) {
ExecuteModuleEventEx($a, array($ID, $arFields));
}
return $ID;
}
return false;
}
示例5: Delete
public static function Delete($id)
{
global $DB, $APPLICATION;
self::ClearErrors();
$id = intval($id);
if ($id <= 0) {
self::AddError(GetMessage("MN_SU_NO_ID"));
return false;
}
foreach (GetModuleEvents("main", "OnBeforeShortUriDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($id)) === false) {
if ($ex = $APPLICATION->GetException()) {
$err = $ex->GetString();
} else {
$err = GetMessage("MN_SU_DELETE_ERROR");
}
self::AddError($err);
return false;
}
}
$fl = $DB->Query("DELETE FROM b_short_uri WHERE ID = " . $id, true);
if (!$fl) {
self::AddError(GetMessage("MN_SU_DELETE_ERROR"));
return false;
}
return true;
}
示例6: AddNewUser
function AddNewUser($SITE_ID, $arFields, &$strError)
{
$ID_ADDED = 0;
$iDepartmentId = intval($arFields["DEPARTMENT_ID"]);
$bExtranet = $iDepartmentId <= 0;
$strEmail = trim($arFields["ADD_EMAIL"]);
$strName = trim($arFields["ADD_NAME"]);
$strLastName = trim($arFields["ADD_LAST_NAME"]);
$strPosition = trim($arFields["ADD_POSITION"]);
$strPassword = self::GeneratePassword($SITE_ID, $bExtranetUser);
self::setSendPassword($arFields["ADD_SEND_PASSWORD"] == "Y");
if (strlen($strEmail) <= 0) {
if (!isset($arFields["ADD_MAILBOX_ACTION"]) || !in_array($arFields["ADD_MAILBOX_ACTION"], array("create", "connect")) || strlen($arFields['ADD_MAILBOX_USER']) <= 0 || strlen($arFields['ADD_MAILBOX_DOMAIN']) <= 0) {
$strError = GetMessage("BX24_INVITE_DIALOG_ERROR_EMPTY_EMAIL");
} else {
// email from mailbox
$strEmail = $arFields['ADD_MAILBOX_USER'] . "@" . $arFields['ADD_MAILBOX_DOMAIN'];
}
}
if (!$strError) {
$arUser = array("LOGIN" => $strEmail, "NAME" => $strName, "LAST_NAME" => $strLastName, "EMAIL" => $strEmail, "PASSWORD" => $strPassword, "GROUP_ID" => CIntranetInviteDialog::getUserGroups($SITE_ID, $bExtranet), "WORK_POSITION" => $strPosition, "UF_DEPARTMENT" => $iDepartmentId > 0 ? array($iDepartmentId) : array(0));
if (!self::getSendPassword()) {
$arUser["CONFIRM_CODE"] = randString(8);
}
$obUser = new CUser();
$ID_ADDED = $obUser->Add($arUser);
if (!$ID_ADDED) {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$strError = $e->GetString();
} else {
$strError = $obUser->LAST_ERROR;
}
} else {
if (self::getSendPassword()) {
$db_events = GetModuleEvents("main", "OnUserInitialize", true);
foreach ($db_events as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID_ADDED, $arUser));
}
}
$SiteIdToSend = $bExtranet && CModule::IncludeModule("extranet") ? CExtranet::GetExtranetSiteID() : CSite::GetDefSite();
$rsSites = CSite::GetByID($SiteIdToSend);
$arSite = $rsSites->Fetch();
$serverName = strlen($arSite["SERVER_NAME"]) > 0 ? $arSite["SERVER_NAME"] : (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
$event = new CEvent();
if (self::getSendPassword()) {
$url = (CMain::IsHTTPS() ? "https" : "http") . "://" . $serverName . $arSite["DIR"];
$event->SendImmediate("INTRANET_USER_ADD", $SITE_ID, array("EMAIL_TO" => $arUser["EMAIL"], "LINK" => $url, "PASSWORD" => $strPassword, "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
} else {
$dbUser = CUser::GetByID($ID_ADDED);
$arUser = $dbUser->Fetch();
if (IsModuleInstalled("bitrix24")) {
$event->SendImmediate("BITRIX24_USER_INVITATION", $SITE_ID, array("EMAIL_FROM" => $GLOBALS["USER"]->GetEmail(), "EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $ID_ADDED . "&checkword=" . urlencode($arUser["CONFIRM_CODE"]), $serverName), "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
} else {
$event->SendImmediate("INTRANET_USER_INVITATION", $SITE_ID, array("EMAIL_TO" => $arUser["EMAIL"], "LINK" => CHTTP::URN2URI("/bitrix/tools/intranet_invite_dialog.php?user_id=" . $ID_ADDED . "&checkword=" . urlencode($arUser["CONFIRM_CODE"]), $serverName), "USER_TEXT" => GetMessage("BX24_INVITE_DIALOG_INVITE_MESSAGE_TEXT")));
}
}
}
}
return $ID_ADDED;
}
示例7: OnModuleInstalledEvent
function OnModuleInstalledEvent($id)
{
foreach(GetModuleEvents("main", "OnModuleInstalled", true) as $arEvent)
{
ExecuteModuleEventEx($arEvent, array($id));
}
}
示例8: DeleteByWorkflow
public static function DeleteByWorkflow($workflowId)
{
global $DB;
$workflowId = trim($workflowId);
if (strlen($workflowId) <= 0)
throw new Exception("workflowId");
$dbRes = $DB->Query(
"SELECT ID ".
"FROM b_bp_task ".
"WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' "
);
while ($arRes = $dbRes->Fetch())
{
$taskId = intval($arRes["ID"]);
$dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = ".$taskId." ");
while ($arResUser = $dbResUser->Fetch())
CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = ".$taskId." ", true);
foreach (GetModuleEvents("bizproc", "OnTaskDelete", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array($taskId));
}
$DB->Query(
"DELETE FROM b_bp_task ".
"WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' ",
true
);
}
示例9: Delete
/**
* <p>Метод удаляет файл из таблицы зарегистрированных файлов (b_file) и с диска. Статичный метод.</p>
*
*
* @param int $id Цифровой идентификатор файла.
*
* @return mixed
*
* <h4>Example</h4>
* <pre>
* <?
* // удаляем изображение формы
* $arFilter = array("ID" => 1, "ID_EXACT_MATCH" => "Y");
* $rsForm = CForm::GetList($by, $order, $arFilter, $is_filtered);
* if ($arForm = $rsForm->Fetch())
* {
* if (intval($arForm["IMAGE_ID"])>0) <b>CFile::Delete</b>($arForm["IMAGE_ID"]);
* }
* ?>
* </pre>
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/file/deletedirfiles.php">DeleteDirFiles</a> </li>
* <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/file/deletedirfilesex.php">DeleteDirFilesEx</a> </li>
* </ul><a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/main/reference/cfile/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
$io = CBXVirtualIo::GetInstance();
$ID = intval($ID);
if ($ID <= 0) {
return;
}
$res = CFile::GetByID($ID);
if ($res = $res->Fetch()) {
$delete_size = 0;
$upload_dir = COption::GetOptionString("main", "upload_dir", "upload");
$dname = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/" . $res["SUBDIR"];
$fname = $dname . "/" . $res["FILE_NAME"];
$file = $io->GetFile($fname);
if ($file->isExists() && $file->unlink()) {
$delete_size += $res["FILE_SIZE"];
}
$delete_size += CFile::ResizeImageDelete($res);
$DB->Query("DELETE FROM b_file WHERE ID = " . $ID);
$directory = $io->GetDirectory($dname);
if ($directory->isExists() && $directory->isEmpty()) {
$directory->rmdir();
}
CFile::CleanCache($ID);
foreach (GetModuleEvents("main", "OnFileDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($res));
}
/****************************** QUOTA ******************************/
if ($delete_size > 0 && COption::GetOptionInt("main", "disk_space") > 0) {
CDiskQuota::updateDiskQuota("file", $delete_size, "delete");
}
/****************************** QUOTA ******************************/
}
}
示例10: tags_prepare
function tags_prepare($sText, $site_id = false)
{
static $arEvents = false;
if ($arEvents === false) {
$arEvents = array();
$rsEvents = GetModuleEvents("search", "OnSearchGetTag");
while ($arEvent = $rsEvents->Fetch()) {
$arEvents[] = $arEvent;
}
}
$arResult = array();
$arTags = explode(",", $sText);
foreach ($arTags as $tag) {
$tag = trim($tag);
if (strlen($tag)) {
foreach ($arEvents as $arEvent) {
$tag = ExecuteModuleEventEx($arEvent, array($tag));
}
if (strlen($tag)) {
$arResult[$tag] = $tag;
}
}
}
return $arResult;
}
示例11: Update
function Update($RIGHT_ID, $GROUP_CODE)
{
global $DB;
$RIGHT_ID = intval($RIGHT_ID);
if (is_array($GROUP_CODE))
{
foreach($GROUP_CODE as $GROUP_CODE_TMP)
CSocNetLogRights::Update($RIGHT_ID, $GROUP_CODE_TMP);
return false;
}
else
{
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogRightsUpdate");
while ($arEvent = $db_events->Fetch())
if (ExecuteModuleEventEx($arEvent, array($RIGHT_ID, &$GROUP_CODE))===false)
return false;
$strUpdate = $DB->PrepareUpdate("b_sonet_log_right", array(
"GROUP_CODE" => $GROUP_CODE
));
$DB->Query("UPDATE b_sonet_log_right SET ".$strUpdate." WHERE ID = ".$RIGHT_ID);
return $RIGHT_ID;
}
}
示例12: GetDBUpdaters
static function GetDBUpdaters()
{
$rsHandlers = GetModuleEvents("forum", "CollectDBUpdater");
while ($arHandler = $rsHandlers->Fetch()) {
ExecuteModuleEventEx($arHandler, array());
}
}
示例13: OnModuleInstalledEvent
function OnModuleInstalledEvent($id)
{
$db_events = GetModuleEvents("main", "OnModuleInstalled");
while ($arEvent = $db_events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($id));
}
}
示例14: FireEvent
/**
* @return void
*/
public static function FireEvent($eventName, $eventParams)
{
$events = GetModuleEvents('learning', $eventName);
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($eventParams));
}
}
示例15: Add
/**
* <p>Метод добавляет остаток товара, в соответствии с данными из массива arFields.</p>
*
*
*
*
* @param array $arFields Ассоциативный массив параметров, ключами в котором являются
* названия параметров, а значениями - соответствующие значения.
* Допустимые ключи: <br><ul> <li>PRODUCT_ID - ID товара;</li> <li>STORE_ID - ID склада;</li>
* <li>AMOUNT - количество товара;</li> </ul>
*
*
*
* @return mixed <p>Возвращает <i>ID</i> записи, если добавление совершено, в противном
* случае - <i>false</i>.</p><a name="examples"></a>
*
*
* <h4>Example</h4>
* <pre>
* $arFields = Array(
* "PRODUCT_ID" => 71,
* "STORE_ID" => 1,
* "AMOUNT" => 50,
* );
*
* $ID = CCatalogStoreProduct::Add($arFields);
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogstoreproduct/add.php
* @author Bitrix
*/
public static function Add($arFields)
{
global $DB;
foreach(GetModuleEvents("catalog", "OnBeforeStoreProductAdd", true) as $arEvent)
if(ExecuteModuleEventEx($arEvent, array(&$arFields)) === false)
return false;
if (!self::CheckFields('ADD',$arFields))
return false;
$arInsert = $DB->PrepareInsert("b_catalog_store_product", $arFields);
$strSql = "INSERT INTO b_catalog_store_product (".$arInsert[0].") VALUES(".$arInsert[1].")";
$res = $DB->Query($strSql, true, "File: ".__FILE__."<br>Line: ".__LINE__);
if(!$res)
return false;
$lastId = intval($DB->LastID());
foreach(GetModuleEvents("catalog", "OnStoreProductAdd", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array($lastId, $arFields));
return $lastId;
}