本文整理汇总了PHP中GetModuleEvents函数的典型用法代码示例。如果您正苦于以下问题:PHP GetModuleEvents函数的具体用法?PHP GetModuleEvents怎么用?PHP GetModuleEvents使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetModuleEvents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
);
}
示例2: OnModuleInstalledEvent
function OnModuleInstalledEvent($id)
{
$db_events = GetModuleEvents("main", "OnModuleInstalled");
while ($arEvent = $db_events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($id));
}
}
示例3: Add
public static function Add($arFields)
{
global $DB;
self::ClearErrors();
if (!self::ParseFields($arFields))
return false;
$arInsert = $DB->PrepareInsert("b_short_uri", $arFields);
$strSql =
"INSERT INTO b_short_uri (".$arInsert[0].", MODIFIED) ".
"VALUES(".$arInsert[1].", ".$DB->CurrentTimeFunction().")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$taskId = intval($DB->LastID());
$arFields["ID"] = $taskId;
foreach (GetModuleEvents("main", "OnAfterShortUriAdd", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array($arFields));
return $taskId;
}
示例4: 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;
}
示例5: add
/** Add new store in table b_catalog_store_barcode,
* @static
* @param $arFields
* @return bool|int
*/
static function add($arFields)
{
global $DB;
foreach (GetModuleEvents("catalog", "OnBeforeCatalogStoreBarCodeAdd", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if (array_key_exists('DATE_CREATE', $arFields)) {
unset($arFields['DATE_CREATE']);
}
if (array_key_exists('DATE_MODIFY', $arFields)) {
unset($arFields['DATE_MODIFY']);
}
$arFields['~DATE_MODIFY'] = $DB->GetNowFunction();
$arFields['~DATE_CREATE'] = $DB->GetNowFunction();
if (!self::CheckFields('ADD', $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_catalog_store_barcode", $arFields);
$strSql = "INSERT INTO b_catalog_store_barcode (" . $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", "OnCatalogStoreBarCodeAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($lastId, $arFields));
}
return $lastId;
}
示例6: FireEvent
/**
* @return void
*/
public static function FireEvent($eventName, $eventParams)
{
$events = GetModuleEvents('learning', $eventName);
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($eventParams));
}
}
示例7: GetDBUpdaters
static function GetDBUpdaters()
{
$rsHandlers = GetModuleEvents("forum", "CollectDBUpdater");
while ($arHandler = $rsHandlers->Fetch()) {
ExecuteModuleEventEx($arHandler, array());
}
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: Delete
function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0) {
return False;
}
$db_events = GetModuleEvents("sale", "OnBeforeUserAccountDelete");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
$arOldUserAccount = CSaleUserAccount::GetByID($ID);
$dbTrans = CSaleUserTransact::GetList(array(), array("USER_ID" => $arOldUserAccount["USER_ID"], "CURRENCY" => $arOldUserAccount["CURRENCY"]), false, false, array("ID", "USER_ID"));
while ($arTrans = $dbTrans->Fetch()) {
CSaleUserTransact::Delete($arTrans["ID"]);
}
unset($GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE_" . $ID]);
unset($GLOBALS["SALE_USER_ACCOUNT"]["SALE_USER_ACCOUNT_CACHE1_" . $arOldUserAccount["USER_ID"] . "_" . $arOldUserAccount["CURRENCY"]]);
$res = $DB->Query("DELETE FROM b_sale_user_account WHERE ID = " . $ID . " ", true);
$dbEvents = GetModuleEvents("sale", "OnAfterUserAccountDelete");
while ($arEvent = $dbEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
return $res;
}
示例13: 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;
}
示例14: 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;
}
示例15: initClassesList
public static function initClassesList()
{
if (static::$classes !== null) {
return true;
}
$classes = array('\\Bitrix\\Sale\\Delivery\\ExtraServices\\Enum' => 'lib/delivery/extra_services/enum.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store' => 'lib/delivery/extra_services/store.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\String' => 'lib/delivery/extra_services/string.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Checkbox' => 'lib/delivery/extra_services/checkbox.php');
\Bitrix\Main\Loader::registerAutoLoadClasses('sale', $classes);
unset($classes['\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store']);
static::$classes = array_keys($classes);
foreach (GetModuleEvents("sale", "onSaleDeliveryExtraServicesClassesCustom", true) as $arHandler) {
$classes = ExecuteModuleEventEx($arHandler);
if (!is_array($classes)) {
throw new SystemException('Handler of onSaleDeliveryExtraServicesClassesCustom must return Bitrix\\Sale\\Delivery\\ExtraServices\\Base[]');
}
foreach ($classes as $class) {
if (!class_exists($class)) {
throw new SystemException('onSaleDeliveryExtraServicesClassesCustom class doesn\'t exist: "' . $class . '"');
}
if (in_array($class, static::$classes)) {
throw new SystemException('onSaleDeliveryExtraServicesClassesCustom class with such name alredy exists: "' . $class . '"');
}
static::$classes[] = $class;
}
}
return true;
}