本文整理汇总了PHP中Bitrix\Main\SiteTable::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteTable::getList方法的具体用法?PHP SiteTable::getList怎么用?PHP SiteTable::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\SiteTable
的用法示例。
在下文中一共展示了SiteTable::getList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDefaultSiteId
public static function getDefaultSiteId()
{
static $result = null;
if ($result === null) {
$res = \Bitrix\Main\SiteTable::getList(array('filter' => array('DEF' => 'Y'), 'select' => array('LID')));
if ($item = $res->fetch()) {
$result = $item['LID'];
}
}
return $result;
}
示例2: acrit_exportpro
function acrit_exportpro()
{
require __DIR__ . '/version.php';
$path = str_replace("\\", "/", __FILE__);
$path = substr($path, 0, strlen($path) - strlen("/index.php"));
include $path . "/version.php";
if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)) {
$this->MODULE_VERSION = $arModuleVersion["VERSION"];
$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
}
$this->MODULE_NAME = GetMessage('ACRIT_EXPORTPRO_MODULE_NAME');
$this->MODULE_DESCRIPTION = GetMessage('ACRIT_EXPORTPRO_MODULE_DESC');
$this->PARTNER_NAME = GetMessage("ACRIT_EXPORTPRO_PARTNER_NAME");
$this->PARTNER_URI = GetMessage("ACRIT_EXPORTPRO_PARTNER_URI");
$app = \Bitrix\Main\Application::getInstance();
$dbSite = \Bitrix\Main\SiteTable::getList();
while ($arSite = $dbSite->Fetch()) {
if (!$arSite['DOC_ROOT']) {
$this->siteArray[$arSite['LID']] = $app->getDocumentRoot() . $arSite['DIR'];
} else {
$this->siteArray[$arSite['LID']] = $arSite['DOC_ROOT'];
}
$this->siteArray[$arSite['LID']] = \Bitrix\Main\IO\Path::normalize($this->siteArray[$arSite['LID']]);
}
}
示例3: getList
/**
* @param string $dbName
* @return array List of all sites & their params
*/
public static function getList($dbName = false)
{
if (!$dbName) {
$connection = \Bitrix\Main\Application::getConnection();
$dbName = $connection->getDbName();
}
$result = array();
$shellAdapter = new ShellAdapter();
$execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/bx-sites -o json -a list -d " . $dbName);
$sitesData = $shellAdapter->getLastOutput();
if ($execRes) {
$arData = json_decode($sitesData, true);
if (isset($arData["params"])) {
$result = $arData["params"];
}
$rsSite = \Bitrix\Main\SiteTable::getList();
while ($site = $rsSite->fetch()) {
foreach ($result as $siteId => $siteInfo) {
$docRoot = strlen($site["DOC_ROOT"]) > 0 ? $site["DOC_ROOT"] : \Bitrix\Main\Application::getDocumentRoot();
if ($siteInfo["DocumentRoot"] == $docRoot) {
$result[$siteId]["NAME"] = $site["NAME"] . " (" . $site["LID"] . ") ";
} else {
$result[$siteId]["NAME"] = $siteId;
}
}
}
}
return $result;
}
示例4: getParamsStructure
public static function getParamsStructure()
{
$siteList = array();
$rsSite = \Bitrix\Main\SiteTable::getList();
while ($site = $rsSite->fetch()) {
$siteList[$site["LID"]] = $site["NAME"] . " (" . $site["LID"] . ")";
}
return array("SITE_ID" => array("TYPE" => "ENUM", 'MULTIPLE' => 'Y', "DEFAULT" => SITE_ID, "LABEL" => Loc::getMessage("SALE_DLVR_RSTR_BY_SITE_SITE_ID"), "OPTIONS" => $siteList));
}
示例5: installBitrix24MailService
public function installBitrix24MailService()
{
if (CModule::IncludeModule("mail")) {
$result = \Bitrix\Main\SiteTable::getList();
while (($site = $result->fetch()) !== false) {
if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite($site['LID'])) {
continue;
}
\Bitrix\Mail\MailServicesTable::add(array('SITE_ID' => $site['LID'], 'ACTIVE' => 'Y', 'NAME' => 'bitrix24', 'SERVICE_TYPE' => 'controller'));
}
}
}
示例6: delete
public static function delete($id)
{
//We know for sure that languages and sites can refer to the culture.
//Other entities should place CultureOnBeforeDelete event handler.
$result = new Entity\DeleteResult();
$res = LanguageTable::getList(array('filter' => array('=CULTURE_ID' => $id)));
while ($language = $res->fetch()) {
$result->addError(new Entity\EntityError(Loc::getMessage("culture_err_del_lang", array("#LID#" => $language["LID"]))));
}
$res = \Bitrix\Main\SiteTable::getList(array('filter' => array('=CULTURE_ID' => $id)));
while ($site = $res->fetch()) {
$result->addError(new Entity\EntityError(Loc::getMessage("culture_err_del_site", array("#LID#" => $site["LID"]))));
}
if (!$result->isSuccess()) {
return $result;
}
return parent::delete($id);
}
示例7: initializeSite
protected function initializeSite()
{
$request = $this->getRequest();
$currentDirectory = $request->getRequestedPageDirectory();
$currentDomain = $request->getHttpHost(false);
$site = SiteTable::getByDomainAndPath($currentDomain, $currentDirectory);
if ($site === false) {
$siteList = SiteTable::getList(array('filter' => array('ACTIVE' => 'Y'), 'order' => array('DEF' => 'DESC', 'SORT' => 'ASC'), 'select' => array('*', 'ID' => 'LID')));
$site = $siteList->fetch();
}
if ($site === false) {
throw new SystemException("Site not found");
}
$culture = Context\Culture::wakeUp($site["CULTURE_ID"]);
if ($culture === null) {
$culture = new Context\Culture();
}
$this->site = new Context\Site($site);
$this->site->setCulture($culture);
$this->setContextCulture($culture, $this->site->getLanguage());
}
示例8: getBitrixStatuses
/**
* @return array Order's statuses & flags.
*/
public static function getBitrixStatuses($siteId)
{
$result = array("CANCELED" => Loc::getMessage("SALE_EBAY_HLP_FLAG_CANCELED"), "ALLOW_DELIVERY" => Loc::getMessage("SALE_EBAY_HLP_FLAG_DELIVERY"), "PAYED" => Loc::getMessage("SALE_EBAY_HLP_FLAG_PAYED"), "DEDUCTED" => Loc::getMessage("SALE_EBAY_HLP_FLAG_DEDUCTED"));
if (strlen($siteId) <= 0) {
throw new ArgumentNullException("siteId");
}
$dbRes = SiteTable::getList(array('filter' => array('LID' => $siteId), 'select' => array("LANGUAGE_ID")));
if ($site = $dbRes->fetch()) {
$langId = $site["LANGUAGE_ID"];
} else {
throw new SystemException("Site with id: \"" . $siteId . "\" not found!");
}
$dbRes = StatusLangTable::getList(array('filter' => array('LID' => $langId, 'STATUS.TYPE' => 'O'), 'order' => array("STATUS.SORT" => "ASC", "NAME" => "ASC"), 'select' => array("ID" => "STATUS.ID", "NAME")));
while ($row = $dbRes->fetch()) {
$result[$row['ID']] = Loc::getMessage("SALE_EBAY_HLP_STATUS") . " " . $row['NAME'] . ' [' . $row['ID'] . ']';
}
return $result;
}
示例9: clearComponentCache
/**
* Function clears entire component cache.
*
* <p>Note: parameters must exactly match to startResultCache call.</p>
* @param string $componentName
* @param string $siteId
* @return void
*
*/
public static final function clearComponentCache($componentName, $siteId = "")
{
/** @global CCacheManager $CACHE_MANAGER */
global $CACHE_MANAGER;
$componentRelativePath = CComponentEngine::MakeComponentPath($componentName);
if ($componentRelativePath != "") {
$obCache = new CPHPCache();
$obCache->CleanDir($componentRelativePath, "cache");
BXClearCache(true, $componentRelativePath);
if ($siteId == "") {
$rsSite = \Bitrix\Main\SiteTable::getList(array('order' => array('SORT' => 'ASC')));
while ($site = $rsSite->fetch()) {
$componentCachePath = "/" . $site["LID"] . $componentRelativePath;
$obCache = new CPHPCache();
$obCache->CleanDir($componentCachePath, "cache");
BXClearCache(true, $componentCachePath);
}
} else {
$componentCachePath = "/" . $siteId . $componentRelativePath;
$obCache = new CPHPCache();
$obCache->CleanDir($componentCachePath, "cache");
BXClearCache(true, $componentCachePath);
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$CACHE_MANAGER->ClearByTag($componentName);
}
}
}
示例10: InstallDB
function InstallDB()
{
global $APPLICATION;
global $DB;
global $errors;
$bitrix24 = ModuleManager::isModuleInstalled('bitrix24');
if (!$DB->Query("SELECT 'x' FROM b_catalog_group", true)) {
$errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/db/" . strtolower($DB->type) . "/install.sql");
}
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
ModuleManager::registerModule('catalog');
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->registerEventHandler('sale', 'onBuildCouponProviders', 'catalog', '\\Bitrix\\Catalog\\DiscountCouponTable', 'couponManager');
RegisterModuleDependences("iblock", "OnIBlockDelete", "catalog", "CCatalog", "OnIBlockDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogProduct", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CPrice", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogStoreProduct", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogDocs", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalogDocs", "OnBeforeIBlockElementDelete");
RegisterModuleDependences("currency", "OnCurrencyDelete", "catalog", "CPrice", "OnCurrencyDelete");
RegisterModuleDependences("main", "OnGroupDelete", "catalog", "CCatalogProductGroups", "OnGroupDelete");
RegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "catalog", "CCatalogProduct", "OnAfterIBlockElementUpdate");
RegisterModuleDependences("currency", "OnModuleUnInstall", "catalog", "", "CurrencyModuleUnInstallCatalog");
RegisterModuleDependences("iblock", "OnBeforeIBlockDelete", "catalog", "CCatalog", "OnBeforeCatalogDelete", 300);
RegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalog", "OnBeforeIBlockElementDelete", 10000);
RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "catalog", "CCatalogEvent", "GetAuditTypes");
RegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildGlobalMenu');
RegisterModuleDependences('main', 'OnAdminListDisplay', 'catalog', 'CCatalogAdmin', 'OnAdminListDisplay');
RegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildSaleMenu');
RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlGroup", "GetControlDescr", 100);
RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockFields", "GetControlDescr", 200);
RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockProps", "GetControlDescr", 300);
RegisterModuleDependences("catalog", "OnDocumentBarcodeDelete", "catalog", "CCatalogStoreDocsElement", "OnDocumentBarcodeDelete");
RegisterModuleDependences("catalog", "OnBeforeDocumentDelete", "catalog", "CCatalogStoreDocsBarcode", "OnBeforeDocumentDelete");
RegisterModuleDependences("catalog", "OnCatalogStoreDelete", "catalog", "CCatalogDocs", "OnCatalogStoreDelete");
RegisterModuleDependences("iblock", "OnBeforeIBlockPropertyDelete", "catalog", "CCatalog", "OnBeforeIBlockPropertyDelete");
RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductFields", "GetControlDescr", 1100);
RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductProps", "GetControlDescr", 1200);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductFields", "GetControlDescr", 1200);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductProps", "GetControlDescr", 1300);
RegisterModuleDependences("sale", "OnExtendBasketItems", "catalog", "CCatalogDiscount", "ExtendBasketItems", 100);
RegisterModuleDependences('iblock', 'OnModuleUnInstall', 'catalog', 'CCatalog', 'OnIBlockModuleUnInstall');
if (!$bitrix24) {
CAgent::AddAgent('\\Bitrix\\Catalog\\CatalogViewedProductTable::clearAgent();', 'catalog', 'N', (int) COption::GetOptionString("catalog", "viewed_period") * 24 * 3600);
}
$this->InstallTasks();
$arCount = $DB->Query("select count(ID) as COUNT from b_catalog_measure", true)->Fetch();
if (is_array($arCount) && isset($arCount['COUNT']) && intval($arCount['COUNT']) <= 0) {
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(6, 'm', 'MTR', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(112, 'l', 'LTR', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(163, 'g', 'GRM', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(166, 'kg', 'KGM', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(796, 'pc. 1', 'PCE. NMB', 'Y')", true);
}
if (!$bitrix24) {
$languageID = '';
$siteIterator = SiteTable::getList(array('select' => array('LID', 'LANGUAGE_ID'), 'filter' => array('=DEF' => 'Y', '=ACTIVE' => 'Y')));
if ($site = $siteIterator->fetch()) {
$languageID = (string) $site['LANGUAGE_ID'];
}
if ($languageID == '') {
$languageID = 'en';
}
if ($languageID == 'ru') {
$mess = Loc::getMessage('CATALOG_INSTALL_PROFILE_IRR2', null, 'ru');
if ($mess == '') {
$mess = 'irr.ru';
}
$strQuery = "select COUNT(CE.ID) as CNT from b_catalog_export CE where CE.IS_EXPORT = 'Y' and CE.FILE_NAME ='yandex' and CE.NAME = '" . $DB->ForSql($mess) . "'";
$rsProfiles = $DB->Query($strQuery, true);
if (false !== $rsProfiles) {
$arProfile = $rsProfiles->Fetch();
if ((int) $arProfile['CNT'] == 0) {
$arFields = array('FILE_NAME' => 'yandex', 'NAME' => $mess, 'DEFAULT_PROFILE' => 'N', 'IN_MENU' => 'N', 'IN_AGENT' => 'N', 'IN_CRON' => 'N', 'NEED_EDIT' => 'Y', 'IS_EXPORT' => 'Y');
$arInsert = $DB->PrepareInsert("b_catalog_export", $arFields);
$strQuery = "INSERT INTO b_catalog_export(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
$DB->Query($strQuery, true);
}
}
}
}
return true;
}
示例11: GetFilterHiddens
$contextMenuItems[] = array("SEPARATOR" => "Y");
$contextMenuItems[] = array("TEXT" => GetMessage("BT_SALE_DISCOUNT_EDIT_MESS_NEW_DISCOUNT"), "LINK" => "/bitrix/admin/sale_discount_edit.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_"), "ICON" => "btn_new");
$contextMenuItems[] = array("TEXT" => GetMessage("BT_SALE_DISCOUNT_EDIT_MESS_COPY_DISCOUNT"), "LINK" => '/bitrix/admin/sale_discount_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $discountID . '&action=copy&' . GetFilterParams('filter_'), "ICON" => "btn_copy");
$contextMenuItems[] = array("TEXT" => GetMessage("BT_SALE_DISCOUNT_EDIT_MESS_DELETE_DISCOUNT"), "LINK" => "javascript:if(confirm('" . GetMessageJS("BT_SALE_DISCOUNT_EDIT_MESS_DELETE_DISCOUNT_CONFIRM") . "')) window.location='/bitrix/admin/sale_discount.php?lang=" . LANGUAGE_ID . "&ID=" . $discountID . "&action=delete&" . bitrix_sessid_get() . "';", "WARNING" => "Y", "ICON" => "btn_delete");
}
}
$contextMenu = new CAdminContextMenu($contextMenuItems);
$contextMenu->Show();
unset($contextMenu, $contextMenuItems);
if (!empty($errors)) {
$errorMessage = new CAdminMessage(array("DETAILS" => implode('<br>', $errors), "TYPE" => "ERROR", "MESSAGE" => GetMessage("BT_SALE_DISCOUNT_EDIT_MESS_SAVE_ERROR"), "HTML" => true));
echo $errorMessage->Show();
unset($errorMessage);
}
$arSiteList = array();
$siteIterator = Main\SiteTable::getList(array('select' => array('LID', 'NAME'), 'order' => array('SORT' => 'ASC')));
while ($site = $siteIterator->fetch()) {
$arSiteList[$site['LID']] = '(' . $site['LID'] . ') ' . $site['NAME'];
}
unset($site, $siteIterator);
$control->BeginPrologContent();
CJSCore::Init(array('date'));
$control->EndPrologContent();
$control->BeginEpilogContent();
echo GetFilterHiddens("filter_");
?>
<input type="hidden" name="Update" value="Y">
<input type="hidden" name="lang" value="<?php
echo LANGUAGE_ID;
?>
">
示例12: sendInternal
/**
* @param $mailingChainId
* @param array $params
* @return string
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\DB\Exception
*/
protected static function sendInternal($mailingChainId, array $params)
{
if (static::$currentMailingChainFields !== null) {
if (static::$currentMailingChainFields['ID'] != $mailingChainId) {
static::$currentMailingChainFields = null;
}
}
if (static::$currentMailingChainFields === null) {
$mailingChainDb = MailingChainTable::getList(array('select' => array('*', 'SITE_ID' => 'MAILING.SITE_ID'), 'filter' => array('ID' => $mailingChainId)));
if (!($mailingChain = $mailingChainDb->fetch())) {
return PostingRecipientTable::SEND_RESULT_ERROR;
}
$charset = false;
$siteDb = \Bitrix\Main\SiteTable::getList(array('select' => array('SERVER_NAME', 'NAME', 'CULTURE_CHARSET' => 'CULTURE.CHARSET'), 'filter' => array('LID' => $mailingChain['SITE_ID'])));
if ($site = $siteDb->fetch()) {
$charset = $site['CULTURE_CHARSET'];
$serverName = $site['SERVER_NAME'];
} else {
throw new \Bitrix\Main\DB\Exception(Loc::getMessage('SENDER_POSTING_MANAGER_ERR_SITE', array('#SITE_ID#' => $mailingChain['SITE_ID'])));
}
if (!$charset) {
throw new \Bitrix\Main\DB\Exception(Loc::getMessage('SENDER_POSTING_MANAGER_ERR_CHARSET', array('#SITE_ID#' => "[" . $mailingChain['SITE_ID'] . "]" . $site['NAME'])));
}
$attachmentList = array();
$attachmentDb = \Bitrix\Sender\MailingAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('CHAIN_ID' => $mailingChainId)));
while ($attachment = $attachmentDb->fetch()) {
$attachmentList[] = $attachment['FILE_ID'];
}
static::$currentMailingChainFields = array();
static::$currentMailingChainFields['EVENT'] = array('FILE' => $attachmentList);
static::$currentMailingChainFields['ID'] = $mailingChain['ID'];
static::$currentMailingChainFields['MESSAGE'] = array('BODY_TYPE' => 'html', 'EMAIL_FROM' => $mailingChain['EMAIL_FROM'], 'EMAIL_TO' => '#EMAIL_TO#', 'SUBJECT' => $mailingChain['SUBJECT'], 'MESSAGE' => $mailingChain['MESSAGE'], 'MESSAGE_PHP' => \Bitrix\Main\Mail\Internal\EventMessageTable::replaceTemplateToPhp($mailingChain['MESSAGE']));
static::$currentMailingChainFields['SITE'] = array($mailingChain['SITE_ID']);
static::$currentMailingChainFields['CHARSET'] = $charset;
static::$currentMailingChainFields['SERVER_NAME'] = $serverName;
static::$currentMailingChainFields['LINK_PROTOCOL'] = \Bitrix\Main\Config\Option::get("sender", "link_protocol", 'http');
}
$messageParams = array('EVENT' => static::$currentMailingChainFields['EVENT'], 'FIELDS' => $params['FIELDS'], 'MESSAGE' => static::$currentMailingChainFields['MESSAGE'], 'SITE' => static::$currentMailingChainFields['SITE'], 'CHARSET' => static::$currentMailingChainFields['CHARSET']);
if (!empty($params['FIELDS']['UNSUBSCRIBE_LINK'])) {
if (substr($params['FIELDS']['UNSUBSCRIBE_LINK'], 0, 4) !== 'http') {
if (!empty(static::$currentMailingChainFields['SERVER_NAME'])) {
$serverName = static::$currentMailingChainFields['SERVER_NAME'];
} else {
$serverName = \Bitrix\Main\Config\Option::get("main", "server_name", $GLOBALS["SERVER_NAME"]);
}
$linkProtocol = static::$currentMailingChainFields['LINK_PROTOCOL'];
$params['FIELDS']['UNSUBSCRIBE_LINK'] = $linkProtocol . '://' . $serverName . $params['FIELDS']['UNSUBSCRIBE_LINK'];
}
}
$message = Mail\EventMessageCompiler::createInstance($messageParams);
$message->compile();
$mailHeaders = $message->getMailHeaders();
if (!empty($params['FIELDS']['UNSUBSCRIBE_LINK'])) {
$unsubUrl = $params['FIELDS']['UNSUBSCRIBE_LINK'];
$mailHeaders['List-Unsubscribe'] = '<' . $unsubUrl . '>';
}
// send mail
$result = Mail\Mail::send(array('TO' => $message->getMailTo(), 'SUBJECT' => $message->getMailSubject(), 'BODY' => $message->getMailBody(), 'HEADER' => $mailHeaders, 'CHARSET' => $message->getMailCharset(), 'CONTENT_TYPE' => $message->getMailContentType(), 'MESSAGE_ID' => '', 'ATTACHMENT' => $message->getMailAttachment(), 'LINK_PROTOCOL' => static::$currentMailingChainFields['LINK_PROTOCOL'], 'LINK_DOMAIN' => static::$currentMailingChainFields['SERVER_NAME'], 'TRACK_READ' => isset($params['TRACK_READ']) ? $params['TRACK_READ'] : null, 'TRACK_CLICK' => isset($params['TRACK_CLICK']) ? $params['TRACK_CLICK'] : null));
if ($result) {
return PostingRecipientTable::SEND_RESULT_SUCCESS;
} else {
return PostingRecipientTable::SEND_RESULT_ERROR;
}
}
示例13: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
/*
"GROUPS" => array(
"FILTER_SETTINGS" => array(
"NAME" => GetMessage("T_IBLOCK_DESC_FILTER_SETTINGS"),
),
*/
$arComponentParameters = array("PARAMETERS" => array("ID" => array("NAME" => Loc::getMessage("SALE_SLS_ID_PARAMETER"), "PARENT" => "BASE", "TYPE" => "STRING", "MULTIPLE" => "N"), "CODE" => array("NAME" => Loc::getMessage("SALE_SLS_CODE_PARAMETER"), "PARENT" => "BASE", "TYPE" => "STRING", "MULTIPLE" => "N"), "INPUT_NAME" => array("NAME" => Loc::getMessage("SALE_SLS_INPUT_NAME_PARAMETER"), "PARENT" => "BASE", "TYPE" => "STRING", "DEFAULT" => "LOCATION"), "PROVIDE_LINK_BY" => array("NAME" => Loc::getMessage("SALE_SLS_PROVIDE_LINK_BY_PARAMETER"), "PARENT" => "BASE", "TYPE" => "LIST", "VALUES" => array('id' => Loc::getMessage("SALE_SLS_PROVIDE_LINK_BY_PARAMETER_ID"), 'code' => Loc::getMessage("SALE_SLS_PROVIDE_LINK_BY_PARAMETER_CODE")), "DEFAULT" => "id"), "FILTER_BY_SITE" => array("NAME" => Loc::getMessage("SALE_SLS_FILTER_BY_SITE_PARAMETER"), "PARENT" => "DATA_SOURCE", "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"), "SHOW_DEFAULT_LOCATIONS" => array("NAME" => Loc::getMessage("SALE_SLS_SHOW_DEFAULT_LOCATIONS_PARAMETER"), "PARENT" => "DATA_SOURCE", "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"), "JS_CONTROL_GLOBAL_ID" => array("NAME" => Loc::getMessage("SALE_SLS_JSCONTROL_GLOBAL_ID_PARAMETER"), "PARENT" => "ADDITIONAL", "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => ""), "JS_CALLBACK" => array("NAME" => Loc::getMessage("SALE_SLS_JS_CALLBACK"), "PARENT" => "ADDITIONAL", "TYPE" => "STRING"), "CACHE_TIME" => array("DEFAULT" => 36000000)));
if ($arCurrentValues['FILTER_BY_SITE'] == 'Y' || $arCurrentValues['SHOW_DEFAULT_LOCATIONS'] == 'Y') {
$res = \Bitrix\Main\SiteTable::getList(array('filter' => array('=ACTIVE' => 'Y')));
$sites = array();
while ($item = $res->Fetch()) {
$sites[$item['LID']] = '[' . $item['LID'] . '] ' . $item['NAME'];
}
$arComponentParameters["PARAMETERS"]["FILTER_SITE_ID"] = array("NAME" => Loc::getMessage("SALE_SLS_FILTER_SITE_ID_PARAMETER"), "PARENT" => "DATA_SOURCE", "TYPE" => "LIST", "VALUES" => array_merge(array('current' => Loc::getMessage("SALE_SLS_FILTER_SITE_ID_CURRENT")), $sites));
}
示例14: foreach
case "L":
// list
/** @var CDatabase $DB */
global $DB;
foreach ($variants as $variant) {
$lastId = $list[$variant] = CIBlockPropertyEnum::Add(array('PROPERTY_ID' => $idProperty, 'VALUE' => $variant));
if (!$lastId) {
throw new Exception($DB->db_Error);
}
}
break;
case "E":
// Привязка к элементу
$arSourceIblockData = CIBlock::GetArrayByID($idIBlock);
$sites = array();
$rsSites = \Bitrix\Main\SiteTable::getList();
while ($arSite = $rsSites->fetch()) {
$sites[] = $arSite['LID'];
}
$iblock = new CIBlock();
$handbookIblockId = $iblock->Add(array("ACTIVE" => 'Y', "NAME" => $propertyData['NAME'], "SITE_ID" => $sites, "IBLOCK_TYPE_ID" => $arSourceIblockData['IBLOCK_TYPE_ID']));
if (!$handbookIblockId) {
throw new Exception($iblock->LAST_ERROR);
}
$iblockElement = new CIBlockElement();
$arPropertyId = array();
foreach ($variants as $variant) {
$lastId = $list[$variant] = $iblockElement->Add(array("ACTIVE" => "Y", 'IBLOCK_ID' => $handbookIblockId, 'NAME' => $variant));
if (!$lastId) {
throw new Exception($iblockElement->LAST_ERROR);
}
示例15: handleEvent
/**
* @return string
*/
public static function handleEvent(array $arEvent)
{
if (!isset($arEvent['FIELDS']) && isset($arEvent['C_FIELDS'])) {
$arEvent['FIELDS'] = $arEvent['C_FIELDS'];
}
if (!is_array($arEvent['FIELDS'])) {
throw new \Bitrix\Main\ArgumentTypeException("FIELDS");
}
$flag = static::SEND_RESULT_TEMPLATE_NOT_FOUND;
// no templates
$arResult = array("Success" => false, "Fail" => false, "Was" => false);
$trackRead = null;
$trackClick = null;
if (array_key_exists('TRACK_READ', $arEvent)) {
$trackRead = $arEvent['TRACK_READ'];
}
if (array_key_exists('TRACK_CLICK', $arEvent)) {
$trackClick = $arEvent['TRACK_CLICK'];
}
$arSites = explode(",", $arEvent["LID"]);
if (count($arSites) <= 0) {
return $flag;
}
// get charset and server name for languages of event
$charset = false;
$serverName = null;
$siteDb = Main\SiteTable::getList(array('select' => array('SERVER_NAME', 'CULTURE_CHARSET' => 'CULTURE.CHARSET'), 'filter' => array('LID' => $arSites)));
if ($arSiteDb = $siteDb->fetch()) {
$charset = $arSiteDb['CULTURE_CHARSET'];
$serverName = $arSiteDb['SERVER_NAME'];
}
if (!$charset) {
return $flag;
}
// get filter for list of message templates
$arEventMessageFilter = array();
$MESSAGE_ID = intval($arEvent["MESSAGE_ID"]);
if ($MESSAGE_ID > 0) {
$eventMessageDb = MailInternal\EventMessageTable::getById($MESSAGE_ID);
if ($eventMessageDb->Fetch()) {
$arEventMessageFilter['ID'] = $MESSAGE_ID;
$arEventMessageFilter['ACTIVE'] = 'Y';
}
}
if (count($arEventMessageFilter) == 0) {
$arEventMessageFilter = array('ACTIVE' => 'Y', 'EVENT_NAME' => $arEvent["EVENT_NAME"], 'EVENT_MESSAGE_SITE.SITE_ID' => $arSites);
}
// get list of message templates of event
$messageDb = MailInternal\EventMessageTable::getList(array('select' => array('ID'), 'filter' => $arEventMessageFilter, 'group' => array('ID')));
while ($arMessage = $messageDb->fetch()) {
$eventMessage = MailInternal\EventMessageTable::getRowById($arMessage['ID']);
$eventMessage['FILES'] = array();
$attachmentDb = MailInternal\EventMessageAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('EVENT_MESSAGE_ID' => $arMessage['ID'])));
while ($arAttachmentDb = $attachmentDb->fetch()) {
$eventMessage['FILE'][] = $arAttachmentDb['FILE_ID'];
}
$arFields = $arEvent['FIELDS'];
foreach (GetModuleEvents("main", "OnBeforeEventSend", true) as $event) {
if (ExecuteModuleEventEx($event, array(&$arFields, &$eventMessage)) === false) {
continue 2;
}
}
// get message object for send mail
$arMessageParams = array('EVENT' => $arEvent, 'FIELDS' => $arFields, 'MESSAGE' => $eventMessage, 'SITE' => $arSites, 'CHARSET' => $charset);
$message = EventMessageCompiler::createInstance($arMessageParams);
$message->compile();
// send mail
$result = Main\Mail\Mail::send(array('TO' => $message->getMailTo(), 'SUBJECT' => $message->getMailSubject(), 'BODY' => $message->getMailBody(), 'HEADER' => $message->getMailHeaders(), 'CHARSET' => $message->getMailCharset(), 'CONTENT_TYPE' => $message->getMailContentType(), 'MESSAGE_ID' => $message->getMailId(), 'ATTACHMENT' => $message->getMailAttachment(), 'TRACK_READ' => $trackRead, 'TRACK_CLICK' => $trackClick, 'LINK_PROTOCOL' => \Bitrix\Main\Config\Option::get("main", "mail_link_protocol", ''), 'LINK_DOMAIN' => $serverName));
if ($result) {
$arResult["Success"] = true;
} else {
$arResult["Fail"] = true;
}
$arResult["Was"] = true;
}
if ($arResult["Was"]) {
if ($arResult["Success"]) {
if ($arResult["Fail"]) {
$flag = static::SEND_RESULT_PARTLY;
} else {
$flag = static::SEND_RESULT_SUCCESS;
}
// all sent
} else {
if ($arResult["Fail"]) {
$flag = static::SEND_RESULT_ERROR;
}
// all templates failed
}
}
return $flag;
}