本文整理汇总了PHP中Bitrix\Main\Application类的典型用法代码示例。如果您正苦于以下问题:PHP Application类的具体用法?PHP Application怎么用?PHP Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnInstallFiles
function UnInstallFiles()
{
$rootDir = Application::getDocumentRoot() . '/' . Application::getPersonalRoot();
$adminGatewayFile = '/admin/ws_tools.php';
unlink($rootDir . $adminGatewayFile);
return true;
}
示例2: InstallDB
function InstallDB($install_wizard = true)
{
global $DB, $DBType, $APPLICATION;
$errors = null;
if (!$DB->Query("SELECT 'x' FROM b_disk_storage", true)) {
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/db/" . $DBType . "/install.sql");
}
$this->InstallTasks();
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
$isWebdavInstalled = isModuleInstalled('webdav');
$this->RegisterModuleDependences(!$isWebdavInstalled);
RegisterModule("disk");
$this->InstallUserFields();
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
CAgent::addAgent('\\Bitrix\\Disk\\ExternalLink::removeExpiredWithTypeAuto();', 'disk', 'N');
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
CAgent::addAgent('\\Bitrix\\Disk\\Bitrix24Disk\\UploadFileManager::removeIrrelevant();', 'disk', 'N');
if (!$isWebdavInstalled) {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/lib/configuration.php";
\Bitrix\Main\Config\Option::set('disk', 'successfully_converted', 'Y');
\Bitrix\Main\Config\Option::set('disk', 'disk_revision_api', \Bitrix\Disk\Configuration::REVISION_API);
} else {
\CAdminNotify::add(array("MESSAGE" => Loc::getMessage("DISK_NOTIFY_MIGRATE_WEBDAV", array("#LINK#" => "/bitrix/admin/disk_from_webdav_convertor.php?lang=" . \Bitrix\Main\Application::getInstance()->getContext()->getLanguage())), "TAG" => "disk_migrate_from_webdav", "MODULE_ID" => "disk", "ENABLE_CLOSE" => "N"));
}
return true;
}
示例3: forSql
/**
* Escapes special characters in a string for use in an SQL statement.
*
* @param string $value Value to be escaped.
* @param integer $maxLength Limits string length if set.
*
* @return string
*/
function forSql($value, $maxLength = 0)
{
if ($maxLength <= 0 || $maxLength > 2000) {
$maxLength = 2000;
}
$value = substr($value, 0, $maxLength);
if (\Bitrix\Main\Application::isUtfMode()) {
// From http://w3.org/International/questions/qa-forms-utf-8.html
// This one can crash php with segmentation fault on large input data (over 20K)
// https://bugs.php.net/bug.php?id=60423
if (preg_match_all('%(
[\\x00-\\x7E] # ASCII
|[\\xC2-\\xDF][\\x80-\\xBF] # non-overlong 2-byte
|\\xE0[\\xA0-\\xBF][\\x80-\\xBF] # excluding overlongs
|[\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2} # straight 3-byte
|\\xED[\\x80-\\x9F][\\x80-\\xBF] # excluding surrogates
|\\xF0[\\x90-\\xBF][\\x80-\\xBF]{2} # planes 1-3
|[\\xF1-\\xF3][\\x80-\\xBF]{3} # planes 4-15
|\\xF4[\\x80-\\x8F][\\x80-\\xBF]{2} # plane 16
)+%x', $value, $match)) {
$value = implode(' ', $match[0]);
} else {
return '';
}
//There is no valid utf at all
}
return str_replace("'", "''", $value);
}
示例4: Set
public static function Set($user_id, $page_last_date, $page_size, $page_num = 1, $site_id = SITE_ID, $group_code = '**', $traffic_avg = false, $traffic_cnt = false)
{
global $DB;
$user_id = intval($user_id);
$page_size = intval($page_size);
$page_num = intval($page_num);
$traffic_avg = intval($traffic_avg);
$traffic_cnt = intval($traffic_cnt);
if ($user_id <= 0 || $page_size <= 0 || strlen($page_last_date) <= 0) {
return false;
}
$page_last_date = new \Bitrix\Main\Type\DateTime($page_last_date);
$connection = \Bitrix\Main\Application::getConnection();
$helper = $connection->getSqlHelper();
$arInsertFields = array("USER_ID" => $user_id, "SITE_ID" => $DB->ForSQL($site_id), "GROUP_CODE" => $DB->ForSQL($group_code), "PAGE_SIZE" => $page_size, "PAGE_NUM" => $page_num, "PAGE_LAST_DATE" => $page_last_date);
$arUpdateFields = array("PAGE_LAST_DATE" => $page_last_date);
if ($traffic_cnt) {
$arInsertFields["TRAFFIC_AVG"] = $arUpdateFields["TRAFFIC_AVG"] = $traffic_avg;
$arInsertFields["TRAFFIC_CNT"] = $arUpdateFields["TRAFFIC_CNT"] = $traffic_cnt;
$arInsertFields["TRAFFIC_LAST_DATE"] = $arUpdateFields["TRAFFIC_LAST_DATE"] = new \Bitrix\Main\DB\SqlExpression($helper->getCurrentDateTimeFunction());
}
$merge = $helper->prepareMerge("b_sonet_log_page", array("USER_ID", "SITE_ID", "GROUP_CODE", "PAGE_SIZE", "PAGE_NUM"), $arInsertFields, $arUpdateFields);
if ($merge[0] != "") {
$connection->query($merge[0]);
if ($traffic_cnt) {
CSocNetLogFollow::checkAutoUnfollow($traffic_cnt, $traffic_avg, $user_id);
}
}
}
示例5: 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']]);
}
}
示例6: upsert
/**
* @return void
*/
public static function upsert(array $data)
{
$connection = Main\Application::getConnection();
$sqlHelper = $connection->getSqlHelper();
$srcTypeID = isset($data['SRC_TYPE_ID']) ? (int) $data['SRC_TYPE_ID'] : 0;
$dstTypeID = isset($data['DST_TYPE_ID']) ? (int) $data['DST_TYPE_ID'] : 0;
$dateField = new DatetimeField('D');
$lastUpdated = $sqlHelper->convertToDb(new DateTime(), $dateField);
$data = isset($data['DATA']) ? $sqlHelper->forSql($data['DATA']) : '';
if ($connection instanceof Main\DB\MysqlCommonConnection) {
$connection->queryExecute("INSERT INTO b_crm_conv_map(SRC_TYPE_ID, DST_TYPE_ID, LAST_UPDATED, DATA)\n\t\t\t\t\tVALUES({$srcTypeID}, {$dstTypeID}, {$lastUpdated}, '{$data}')\n\t\t\t\t\tON DUPLICATE KEY UPDATE LAST_UPDATED = {$lastUpdated}, DATA = '{$data}'");
} elseif ($connection instanceof Main\DB\MssqlConnection) {
$dbResult = $connection->query("SELECT 'X' FROM b_crm_conv_map WHERE SRC_TYPE_ID = {$srcTypeID} AND DST_TYPE_ID = {$dstTypeID}");
if (is_array($dbResult->fetch())) {
$connection->queryExecute("UPDATE b_crm_conv_map SET LAST_UPDATED = {$lastUpdated}, DATA = '{$data}'\n\t\t\t\t\t\tWHERE SRC_TYPE_ID = {$srcTypeID} AND DST_TYPE_ID = {$dstTypeID}");
} else {
$connection->queryExecute("INSERT INTO b_crm_conv_map(SRC_TYPE_ID, DST_TYPE_ID, LAST_UPDATED, DATA)\n\t\t\t\t\t\tVALUES({$srcTypeID}, {$dstTypeID}, {$lastUpdated}, '{$data}')");
}
} elseif ($connection instanceof Main\DB\OracleConnection) {
$connection->queryExecute("MERGE INTO b_crm_conv_map USING (SELECT {$srcTypeID} SRC_TYPE_ID, {$dstTypeID} DST_TYPE_ID FROM dual)\n\t\t\t\tsource ON\n\t\t\t\t(\n\t\t\t\t\tsource.SRC_TYPE_ID = b_crm_conv_map.SRC_TYPE_ID\n\t\t\t\t\tAND source.DST_TYPE_ID = b_crm_conv_map.DST_TYPE_ID\n\t\t\t\t)\n\t\t\t\tWHEN MATCHED THEN\n\t\t\t\t\tUPDATE SET b_crm_conv_map.LAST_UPDATED = {$lastUpdated},\n\t\t\t\t\tb_crm_conv_map.DATA = '{$data}'\n\t\t\t\tWHEN NOT MATCHED THEN\n\t\t\t\t\tINSERT (SRC_TYPE_ID, DST_TYPE_ID, LAST_UPDATED, DATA)\n\t\t\t\t\tVALUES({$srcTypeID}, {$dstTypeID}, {$lastUpdated}, '{$data}')");
} else {
$dbType = $connection->getType();
throw new Main\NotSupportedException("The '{$dbType}' is not supported in current context");
}
}
示例7: showTab
public static function showTab($div, $iblockElementInfo)
{
$engineList = array();
if (Option::get('main', 'vendor', '') == '1c_bitrix') {
$engineList[] = array("DIV" => "yandex_direct", "TAB" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT"), "TITLE" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT_TITLE"), "HANDLER" => IO\Path::combine(Application::getDocumentRoot(), BX_ROOT, "/modules/seo/admin/tab/seo_search_yandex_direct.php"));
}
if (count($engineList) > 0) {
$engineTabControl = new \CAdminViewTabControl("engineTabControl", $engineList);
?>
<tr>
<td colspan="2">
<?php
$engineTabControl->begin();
foreach ($engineList as $engineTab) {
$engineTabControl->beginNextTab();
$file = new IO\File($engineTab["HANDLER"]);
if ($file->isExists()) {
require $file->getPath();
}
}
$engineTabControl->end();
?>
</td>
</tr>
<?php
}
}
示例8: __CrmActivityViewPrepareNameForJson
function __CrmActivityViewPrepareNameForJson($string)
{
if (!\Bitrix\Main\Application::getInstance()->isUtfMode()) {
return \Bitrix\Main\Text\Encoding::convertEncodingArray($string, SITE_CHARSET, 'UTF-8');
}
return $string;
}
示例9: __construct
private function __construct()
{
$this->sqlBehavior = self::SQL_SKIP;
$this->memoryBehavior = self::MEMORY_SKIP;
$this->levelReporting = E_ALL | E_STRICT;
$this->connection = Application::getInstance()->getConnection();
}
示例10: send
/**
* @param array $data
* @return Main\Entity\AddResult
*/
public static function send(array $data)
{
$manageCache = Application::getInstance()->getManagedCache();
if (CACHED_b_event !== false && $manageCache->read(CACHED_b_event, "events")) {
$manageCache->clean('events');
}
$arFiles = array();
if (isset($data['FILE'])) {
if (is_array($data['FILE'])) {
$arFiles = $data['FILE'];
}
unset($data['FILE']);
}
$result = MailInternal\EventTable::add($data);
if ($result->isSuccess()) {
$id = $result->getId();
foreach ($arFiles as $file) {
$arFile = \CFile::MakeFileArray($file);
$arFile["MODULE_ID"] = "main";
$fid = \CFile::SaveFile($arFile, "main");
$dataAttachment = array('EVENT_ID' => $id, 'FILE_ID' => $fid);
MailInternal\EventAttachmentTable::add($dataAttachment);
}
}
return $result;
}
示例11: upsert
public static function upsert(array $data)
{
$connection = Main\Application::getConnection();
$sqlHelper = $connection->getSqlHelper();
$entityTypeID = isset($data['ENTITY_TYPE_ID']) ? (int) $data['ENTITY_TYPE_ID'] : 0;
$entityID = isset($data['ENTITY_ID']) ? (int) $data['ENTITY_ID'] : 0;
$typeID = isset($data['TYPE_ID']) ? (int) $data['TYPE_ID'] : 0;
$address1 = isset($data['ADDRESS_1']) && $data['ADDRESS_1'] !== '' ? "'{$sqlHelper->forSql($data['ADDRESS_1'], 255)}'" : 'NULL';
$address2 = isset($data['ADDRESS_2']) && $data['ADDRESS_2'] !== '' ? "'{$sqlHelper->forSql($data['ADDRESS_2'], 255)}'" : 'NULL';
$city = isset($data['CITY']) && $data['CITY'] !== '' ? "'{$sqlHelper->forSql($data['CITY'], 128)}'" : 'NULL';
$postalCode = isset($data['POSTAL_CODE']) && $data['POSTAL_CODE'] !== '' ? "'{$sqlHelper->forSql($data['POSTAL_CODE'], 16)}'" : 'NULL';
$region = isset($data['REGION']) && $data['REGION'] !== '' ? "'{$sqlHelper->forSql($data['REGION'], 128)}'" : 'NULL';
$province = isset($data['PROVINCE']) && $data['PROVINCE'] !== '' ? "'{$sqlHelper->forSql($data['PROVINCE'], 128)}'" : 'NULL';
$country = isset($data['COUNTRY']) && $data['COUNTRY'] !== '' ? "'{$sqlHelper->forSql($data['COUNTRY'], 128)}'" : 'NULL';
$countryCode = isset($data['COUNTRY_CODE']) && $data['COUNTRY_CODE'] !== '' ? "'{$sqlHelper->forSql($data['COUNTRY_CODE'], 100)}'" : 'NULL';
if ($connection instanceof Main\DB\MysqlCommonConnection) {
$connection->queryExecute("INSERT INTO b_crm_addr(ENTITY_TYPE_ID, ENTITY_ID, TYPE_ID, ADDRESS_1, ADDRESS_2, CITY, POSTAL_CODE, REGION, PROVINCE, COUNTRY, COUNTRY_CODE)\n\t\t\t\t\tVALUES({$entityTypeID}, {$entityID}, {$typeID}, {$address1}, {$address2}, {$city}, {$postalCode}, {$region}, {$province}, {$country}, {$countryCode})\n\t\t\t\t\tON DUPLICATE KEY UPDATE ADDRESS_1 = {$address1}, ADDRESS_2 = {$address2}, CITY = {$city}, POSTAL_CODE = {$postalCode}, REGION = {$region}, PROVINCE = {$province}, COUNTRY = {$country}, COUNTRY_CODE = {$countryCode}");
} elseif ($connection instanceof Main\DB\MssqlConnection) {
$dbResult = $connection->query("SELECT 'X' FROM b_crm_addr WHERE ENTITY_TYPE_ID = {$entityTypeID} AND ENTITY_ID = {$entityID} AND TYPE_ID = {$typeID}");
if (is_array($dbResult->fetch())) {
$connection->queryExecute("UPDATE b_crm_addr SET ADDRESS_1 = {$address1}, ADDRESS_2 = {$address2}, CITY = {$city}, POSTAL_CODE = {$postalCode}, REGION = {$region}, PROVINCE = {$province}, COUNTRY = {$country}, COUNTRY_CODE = {$countryCode}\n\t\t\t\t\t\tWHERE ENTITY_TYPE_ID = {$entityTypeID} AND ENTITY_ID = {$entityID} AND TYPE_ID = {$typeID}");
} else {
$connection->queryExecute("INSERT INTO b_crm_addr(ENTITY_TYPE_ID, ENTITY_ID, TYPE_ID, ADDRESS_1, ADDRESS_2, CITY, POSTAL_CODE, REGION, PROVINCE, COUNTRY, COUNTRY_CODE)\n\t\t\t\t\t\tVALUES({$entityTypeID}, {$entityID}, {$typeID}, {$address1}, {$address2}, {$city}, {$postalCode}, {$region}, {$province}, {$country}, {$countryCode})");
}
} elseif ($connection instanceof Main\DB\OracleConnection) {
$connection->queryExecute("MERGE INTO b_crm_addr USING (SELECT {$entityTypeID} ENTITY_TYPE_ID, {$entityID} ENTITY_ID, {$typeID} TYPE_ID FROM dual)\n\t\t\t\tsource ON\n\t\t\t\t(\n\t\t\t\t\tsource.ENTITY_TYPE_ID = b_crm_addr.ENTITY_TYPE_ID\n\t\t\t\t\tAND source.ENTITY_ID = b_crm_addr.ENTITY_ID\n\t\t\t\t\tAND source.TYPE_ID = b_crm_addr.TYPE_ID\n\t\t\t\t)\n\t\t\t\tWHEN MATCHED THEN\n\t\t\t\t\tUPDATE SET b_crm_addr.ADDRESS_1 = {$address1},\n\t\t\t\t\t\tb_crm_addr.ADDRESS_2 = {$address2},\n\t\t\t\t\t\tb_crm_addr.CITY = {$city},\n\t\t\t\t\t\tb_crm_addr.POSTAL_CODE = {$postalCode},\n\t\t\t\t\t\tb_crm_addr.REGION = {$region},\n\t\t\t\t\t\tb_crm_addr.PROVINCE = {$province},\n\t\t\t\t\t\tb_crm_addr.COUNTRY = {$country},\n\t\t\t\t\t\tb_crm_addr.COUNTRY_CODE = {$countryCode}\n\t\t\t\tWHEN NOT MATCHED THEN\n\t\t\t\t\tINSERT (ENTITY_TYPE_ID, ENTITY_ID, TYPE_ID, ADDRESS_1, ADDRESS_2, CITY, POSTAL_CODE, REGION, PROVINCE, COUNTRY, COUNTRY_CODE)\n\t\t\t\t\tVALUES({$entityTypeID}, {$entityID}, {$typeID}, {$address1}, {$address2}, {$city}, {$postalCode}, {$region}, {$province}, {$country}, {$countryCode})");
} else {
$dbType = $connection->getType();
throw new Main\NotSupportedException("The '{$dbType}' is not supported in current context");
}
}
示例12: addProductsFromOrder
/**
* Add products from order or updates existing.
*
* @param $orderId
*
* @return void
*/
public static function addProductsFromOrder($orderId = 0)
{
$orderId = (int) $orderId;
if (Sale\OrderProcessingTable::hasAddedProducts($orderId)) {
return;
}
$connection = Main\Application::getConnection();
$type = $connection->getType();
// Update existing
if ($type == "mysql") {
$sqlUpdate = "UPDATE b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tSET p2p.CNT = p2p.CNT + 1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID";
} elseif ($type == "mssql") {
$sqlUpdate = "UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tFROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID";
} else {
$sqlUpdate = "UPDATE b_sale_product2product\n\t\t\t\tSET CNT = CNT + 1\n\t\t\t\tWHERE ID IN (\n\t\t\t\t\tSELECT p2p.ID FROM b_sale_product2product p2p, b_sale_basket b, b_sale_basket b1\n\t\t\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\t\t\tp2p.PRODUCT_ID = b.PRODUCT_ID AND\n\t\t\t\t\t\tp2p.PARENT_PRODUCT_ID = b1.PRODUCT_ID\n\t\t\t\t\t)";
}
$connection->query($sqlUpdate);
// Insert new
$sqlInsert = "INSERT INTO b_sale_product2product (PRODUCT_ID, PARENT_PRODUCT_ID, CNT)\n\t\t\tSELECT b.PRODUCT_ID, b1.PRODUCT_ID, 1\n\t\t\tFROM b_sale_basket b, b_sale_basket b1\n\t\t\tWHERE b.ORDER_ID = b1.ORDER_ID AND\n\t\t\t\tb.ORDER_ID = {$orderId} AND\n\t\t\t\tb.ID <> b1.ID AND\n\t\t\t\tNOT EXISTS (SELECT 1 FROM b_sale_product2product d WHERE d.PRODUCT_ID = b.PRODUCT_ID AND d.PARENT_PRODUCT_ID = b1.PRODUCT_ID)";
$connection->query($sqlInsert);
Sale\OrderProcessingTable::markProductsAdded($orderId);
if (defined("BX_COMP_MANAGED_CACHE")) {
$app = Main\Application::getInstance();
$app->getTaggedCache()->clearByTag('sale_product_buy');
}
}
示例13: addComment
public function addComment($authorId, array $data)
{
$this->loadBlogPostData();
$commentFields = array("POST_ID" => $this->entityId, "BLOG_ID" => $this->blogPostData['BLOG_ID'], "POST_TEXT" => $data['text'], "DATE_CREATE" => new DateTime(), "PARENT_ID" => false, "AUTHOR_ID" => $authorId, "HAS_PROPS" => 'Y');
if (!empty($data['fileId'])) {
$commentFields['UF_BLOG_COMMENT_FILE'] = array($data['fileId']);
} elseif (!empty($data['versionId'])) {
$commentFields['UF_BLOG_COMMENT_FH'] = $data['versionId'];
}
$comId = \CBlogComment::add($commentFields);
if (!$comId) {
return;
}
if (method_exists("CBlogComment", "addLiveComment")) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
\CBlogComment::addLiveComment($comId, array("MODE" => "PULL_MESSAGE"));
}
BXClearCache(true, "/blog/comment/" . $this->entityId . "/");
if (!Loader::includeModule('socialnetwork')) {
return;
}
$query = \CSocNetLog::getList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $this->entityId), false, false, array("ID", "TMP_ID"));
$row = $query->fetch();
if (!$row) {
return;
}
$fieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $this->blogPostData["AUTHOR_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => Application::getInstance()->getConnection()->getSqlHelper()->getCurrentDateTimeFunction(), "MESSAGE" => "file", "TEXT_MESSAGE" => "file", "URL" => "", "MODULE_ID" => false, "SOURCE_ID" => $comId, "LOG_ID" => $row["ID"], "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $comId, "USER_ID" => $authorId);
\CSocNetLogComments::add($fieldsForSocnet, false, false, false);
}
示例14: clearValues
function clearValues()
{
$connection = \Bitrix\Main\Application::getConnection();
$connection->query("\n\t\t\tDELETE FROM b_iblock_element_iprop\n\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t");
$connection->query("\n\t\t\tDELETE FROM b_iblock_section_iprop\n\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t");
$connection->query("\n\t\t\tDELETE FROM b_iblock_iblock_iprop\n\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t");
}
示例15: getMap
public static function getMap()
{
global $DB, $DBType;
$connection = Main\Application::getConnection();
$helper = $connection->getSqlHelper();
return array('ID' => array('data_type' => 'integer', 'primary' => true, 'autocomplete' => true), 'LID' => array('data_type' => 'string', 'required' => true, 'validation' => array(__CLASS__, 'validateLid')), 'FUSER_ID' => array('data_type' => 'integer', 'required' => true), new Main\Entity\ReferenceField('FUSER', 'Bitrix\\Sale\\Internals\\Fuser', array('=this.FUSER_ID' => 'ref.ID'), array('join_type' => 'INNER')), new Main\Entity\ReferenceField('USER', 'Bitrix\\Main\\User', array('=this.ID' => 'FUSER.USER_ID')), 'ORDER_ID' => array('data_type' => 'integer'), new Main\Entity\ReferenceField('ORDER', 'Bitrix\\Sale\\Internals\\Order', array('=this.ORDER_ID' => 'ref.ID')), 'PRODUCT_ID' => array('data_type' => 'integer', 'required' => true), 'PRODUCT' => array('data_type' => 'Product', 'reference' => array('=this.PRODUCT_ID' => 'ref.ID')), 'PRODUCT_PRICE_ID' => array('data_type' => 'integer'), 'NAME' => array('data_type' => 'string'), new Main\Entity\ExpressionField('NAME_WITH_IDENT', $helper->getConcatFunction("%s", "' ['", "%s", "']'"), array('NAME', 'PRODUCT_ID')), 'PRICE' => array('data_type' => 'float'), 'CURRENCY' => array('data_type' => 'string', 'required' => true, 'validation' => array(__CLASS__, 'validateCurrency')), 'BASE_PRICE' => array('data_type' => 'float'), 'VAT_INCLUDED' => array('data_type' => 'boolean', 'values' => array('Y', 'N')), 'DATE_INSERT' => array('data_type' => 'datetime'), 'DATE_INS' => array('data_type' => 'datetime', 'expression' => array($DB->datetimeToDateFunction('%s'), 'DATE_INSERT')), 'DATE_UPDATE' => array('data_type' => 'datetime'), 'DATE_UPD' => array('data_type' => 'datetime', 'expression' => array($DB->datetimeToDateFunction('%s'), 'DATE_UPDATE')), 'WEIGHT' => array('data_type' => 'float'), 'QUANTITY' => array('data_type' => 'float', 'required' => true), 'DELAY' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'SUMMARY_PRICE' => array('data_type' => 'float', 'expression' => array('(%s * %s)', 'QUANTITY', 'PRICE')), 'CAN_BUY' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'MODULE' => array('data_type' => 'string'), 'PRODUCT_PROVIDER_CLASS' => array('data_type' => 'string'), 'NOTES' => array('data_type' => 'string'), 'DETAIL_PAGE_URL' => array('data_type' => 'string'), 'DISCOUNT_PRICE' => array('data_type' => 'float'), 'CATALOG_XML_ID' => array('data_type' => 'string'), 'PRODUCT_XML_ID' => array('data_type' => 'string'), 'DISCOUNT_NAME' => array('data_type' => 'string', 'validation' => array(__CLASS__, 'validateDiscountName')), 'DISCOUNT_VALUE' => array('data_type' => 'string', 'validation' => array(__CLASS__, 'validateDiscountValue')), 'DISCOUNT_COUPON' => array('data_type' => 'string', 'validation' => array(__CLASS__, 'validateDiscountCoupon')), 'VAT_RATE' => array('data_type' => 'float'), 'VAT_RATE_PRC' => array('data_type' => 'float', 'expression' => array('100 * %s', 'VAT_RATE')), 'SUBSCRIBE' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'N_SUBSCRIBE' => array('data_type' => 'integer', 'expression' => array('CASE WHEN %s = \'Y\' THEN 1 ELSE 0 END', 'SUBSCRIBE')), 'RESERVED' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'RESERVE_QUANTITY' => array('data_type' => 'float'), 'BARCODE_MULTI' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'CUSTOM_PRICE' => array('data_type' => 'boolean', 'values' => array('N', 'Y')), 'DIMENSIONS' => array('serialized' => true, 'data_type' => 'string'), 'TYPE' => array('data_type' => 'integer'), 'SET_PARENT_ID' => array('data_type' => 'integer'), 'MEASURE_CODE' => array('data_type' => 'integer'), 'MEASURE_NAME' => array('data_type' => 'string'), 'CALLBACK_FUNC' => array('data_type' => 'string'), 'ORDER_CALLBACK_FUNC' => array('data_type' => 'string'), 'CANCEL_CALLBACK_FUNC' => array('data_type' => 'string'), 'PAY_CALLBACK_FUNC' => array('data_type' => 'string'), 'RECOMMENDATION' => array('data_type' => 'string'), 'ALL_PRICE' => array('data_type' => 'float', 'expression' => array('(%s + %s)', 'QUANTITY', 'DISCOUNT_PRICE')), 'SUMMARY_PURCHASING_PRICE' => array('data_type' => 'float', 'expression' => array('(%s) * %s', 'PRODUCT.PURCHASING_PRICE_IN_SITE_CURRENCY', 'QUANTITY')), 'GROSS_PROFIT' => array('data_type' => 'float', 'expression' => array('(%s) - (%s)', 'SUMMARY_PRICE', 'SUMMARY_PURCHASING_PRICE')), 'PROFITABILITY' => array('data_type' => 'float', 'expression' => array('CASE WHEN %s is NULL OR %s=0 THEN NULL ELSE (%s) * 100 / (%s) END', 'SUMMARY_PURCHASING_PRICE', 'SUMMARY_PURCHASING_PRICE', 'GROSS_PROFIT', 'SUMMARY_PURCHASING_PRICE')), 'SHIPMENT_ITEM' => array('data_type' => 'ShipmentItem', 'reference' => array('=ref.BASKET_ID' => 'this.ID')), 'SHIPMENT' => array('data_type' => 'Shipment', 'reference' => array('=ref.ID' => 'this.SHIPMENT_ITEM.ORDER_DELIVERY_ID')), 'PAYMENT' => array('data_type' => 'Payment', 'reference' => array('=ref.ORDER_ID' => 'this.ORDER_ID')));
}