本文整理汇总了PHP中Bitrix\Main\Loader::IncludeModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::IncludeModule方法的具体用法?PHP Loader::IncludeModule怎么用?PHP Loader::IncludeModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Loader
的用法示例。
在下文中一共展示了Loader::IncludeModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
/**
* @param $config
* @throws Exception
* @throws \Bitrix\Main\LoaderException
*/
function __construct($config)
{
# load highloadblock module
if (!Loader::includeModule('highloadblock')) {
throw new \Exception("highloadblock module not exists");
}
# load iblock module
if (!Loader::IncludeModule("iblock")) {
throw new \Exception("iblock module not exists");
}
# set highloadblock code
$this->_table_name = isset($config['table_name']) && !empty($config['table_name']) ? $config['table_name'] : null;
$this->_table_code = isset($config['table_code']) && !empty($config['table_code']) ? $config['table_code'] : null;
$this->_table_id = isset($config['table_id']) && !empty($config['table_id']) ? $config['table_id'] : null;
}
示例2: processActionCheckDataElementCreation
protected function processActionCheckDataElementCreation()
{
if ($_POST["save"] != "Y" && $_POST["changePostFormTab"] != "lists" && !check_bitrix_sessid()) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
}
if (!Loader::IncludeModule('bizproc')) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_BIZPROC'))));
}
if (!Loader::includeModule('iblock')) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
}
$this->iblockId = intval($this->request->getPost('IBLOCK_ID'));
$this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
$this->checkPermissionElement();
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$templateId = intval($_POST['TEMPLATE_ID']);
$documentType = BizprocDocument::generateDocumentComplexType(COption::GetOptionString("lists", "livefeed_iblock_type_id"), $this->iblockId);
if (!empty($templateId)) {
if (CModule::IncludeModule('bizproc')) {
if (!CBPWorkflowTemplateLoader::isConstantsTuned($templateId)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_CONSTANTS_TUNED_NEW'))));
$this->sendJsonErrorResponse();
}
}
} else {
if (CModule::IncludeModule("bizproc")) {
$templateObject = CBPWorkflowTemplateLoader::getTemplatesList(array('ID' => 'DESC'), array('DOCUMENT_TYPE' => $documentType, 'AUTO_EXECUTE' => CBPDocumentEventType::Create), false, false, array('ID'));
$template = $templateObject->fetch();
if (!empty($template)) {
if (!CBPWorkflowTemplateLoader::isConstantsTuned($template["ID"])) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_CONSTANTS_TUNED_NEW'))));
$this->sendJsonErrorResponse();
}
} else {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_NOT_BIZPROC_TEMPLATE'))));
$this->sendJsonErrorResponse();
}
}
}
$list = new CList($this->iblockId);
$fields = $list->getFields();
$elementData = array("IBLOCK_ID" => $this->iblockId, "NAME" => $_POST["NAME"]);
$props = array();
foreach ($fields as $fieldId => $field) {
if ($fieldId == "PREVIEW_PICTURE" || $fieldId == "DETAIL_PICTURE") {
$elementData[$fieldId] = $_FILES[$fieldId];
if (isset($_POST[$fieldId . "_del"]) && $_POST[$fieldId . "_del"] == "Y") {
$elementData[$fieldId]["del"] = "Y";
}
} elseif ($fieldId == "PREVIEW_TEXT" || $fieldId == "DETAIL_TEXT") {
if (isset($field["SETTINGS"]) && is_array($field["SETTINGS"]) && $field["SETTINGS"]["USE_EDITOR"] == "Y") {
$elementData[$fieldId . "_TYPE"] = "html";
} else {
$elementData[$fieldId . "_TYPE"] = "text";
}
$elementData[$fieldId] = $_POST[$fieldId];
} elseif ($fieldId == 'ACTIVE_FROM' || $fieldId == 'ACTIVE_TO') {
$elementData[$fieldId] = array_shift($_POST[$fieldId]);
} elseif ($list->is_field($fieldId)) {
$elementData[$fieldId] = $_POST[$fieldId];
} elseif ($field["PROPERTY_TYPE"] == "F") {
if (isset($_POST[$fieldId . "_del"])) {
$deleteArray = $_POST[$fieldId . "_del"];
} else {
$deleteArray = array();
}
$props[$field["ID"]] = array();
$files = $this->unEscape($_FILES);
CFile::ConvertFilesToPost($files[$fieldId], $props[$field["ID"]]);
foreach ($props[$field["ID"]] as $fileId => $file) {
if (isset($deleteArray[$fileId]) && (!is_array($deleteArray[$fileId]) && $deleteArray[$fileId] == "Y" || is_array($deleteArray[$fileId]) && $deleteArray[$fileId]["VALUE"] == "Y")) {
if (isset($props[$field["ID"]][$fileId]["VALUE"])) {
$props[$field["ID"]][$fileId]["VALUE"]["del"] = "Y";
} else {
$props[$field["ID"]][$fileId]["del"] = "Y";
}
}
}
} elseif ($field["PROPERTY_TYPE"] == "N") {
if (is_array($_POST[$fieldId]) && !array_key_exists("VALUE", $_POST[$fieldId])) {
$props[$field["ID"]] = array();
foreach ($_POST[$fieldId] as $key => $value) {
if (is_array($value)) {
if (strlen($value["VALUE"])) {
$value = str_replace(" ", "", str_replace(",", ".", $value["VALUE"]));
if (!is_numeric($value)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
$this->sendJsonErrorResponse();
}
$props[$field["ID"]][$key] = doubleval($value);
}
} else {
if (strlen($value)) {
$value = str_replace(" ", "", str_replace(",", ".", $value));
if (!is_numeric($value)) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
$this->sendJsonErrorResponse();
}
//.........这里部分代码省略.........
示例3: ltrim
<?php
/**
* @global \CMain $APPLICATION
*/
\Bitrix\Main\Localization\Loc::loadMessages(__FILE__);
if (!\Bitrix\Main\Loader::IncludeModule("iblock")) {
$APPLICATION->ThrowException(GetMessage('RR_ERROR_IBLOCK_NOT_INSTALLED'));
return false;
}
/** PSR-0 autoloader */
spl_autoload_register(function ($className) {
$className = ltrim($className, '\\');
if (!($className = preg_replace('/^RetailRocket\\\\/', '', $className))) {
return false;
}
$fileName = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
$fileName = __DIR__ . '/lib/' . $fileName;
if (is_readable($fileName)) {
require_once $fileName;
return true;
}
return false;
});
示例4: getIblockId
<?php
/**
* Набор функций для работы с инфоблоками
* @link https://bitbucket.org/notagency/notagency.base
* @author Dmitry Savchenkov <ds@notagency.ru>
* @copyright Copyright © 2016 NotAgency
*/
namespace Notagency\Base;
\Bitrix\Main\Loader::IncludeModule('iblock');
class IblockTools
{
private static $iblockId = [];
private static $iblockPropertyEnumId = [];
/**
* Получить ID инфоблока по коду
*
* @param string $code
* @return int|bool
*/
public static function getIblockId($code)
{
if (!empty(self::$iblockId[$code])) {
return self::$iblockId[$code];
}
if ($iblock = \CIBlock::GetList([], ['CODE' => $code])->fetch()) {
self::$iblockId[$code] = $iblock['ID'];
return $iblock['ID'];
}
return false;
示例5: htmlspecialcharsbx
return htmlspecialcharsbx($_REQUEST[$param]);
}
}
/*Очищаем переменные сессии, чтобы сортировка восстанавливалась с учетом $table_id */
/** @global CMain $APPLICATION */
global $APPLICATION;
$uniq = md5($APPLICATION->GetCurPage());
if (isset($_SESSION["SESS_SORT_BY"][$uniq])) {
unset($_SESSION["SESS_SORT_BY"][$uniq]);
}
if (isset($_SESSION["SESS_SORT_ORDER"][$uniq])) {
unset($_SESSION["SESS_SORT_ORDER"][$uniq]);
}
$module = getRequestParams('module');
$view = getRequestParams('view');
if (!$module or !$view or !Loader::IncludeModule($module)) {
include $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/admin/404.php';
}
list($helper, $interface) = AdminBaseHelper::getGlobalInterfaceSettings($module, $view);
if (!$helper or !$interface) {
include $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/admin/404.php';
}
$isPopup = isset($_REQUEST['popup']) and $_REQUEST['popup'] == 'Y';
$fields = isset($interface['FIELDS']) ? $interface['FIELDS'] : array();
$tabs = isset($interface['TABS']) ? $interface['TABS'] : array();
$helperType = false;
if (is_subclass_of($helper, 'DigitalWand\\AdminHelper\\Helper\\AdminEditHelper')) {
$helperType = 'edit';
/** @var AdminEditHelper $adminHelper */
$adminHelper = new $helper($fields, $tabs);
} else {
示例6: listOfActions
<?php
use Bitrix\Lists\Internals\Error\Error;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\Loader;
use Bitrix\Lists\Internals\Controller;
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if (!Loader::IncludeModule('lists') || !\Bitrix\Main\Application::getInstance()->getContext()->getRequest()->getQuery('action')) {
return;
}
Loc::loadMessages(__FILE__);
class ListsAjaxController extends Controller
{
/** @var int */
protected $iblockId;
/** @var string */
protected $iblockTypeId;
protected $listPerm;
protected function listOfActions()
{
return array('setLiveFeed' => array('method' => array('POST')), 'createDefaultProcesses' => array('method' => array('POST')));
}
protected function processActionSetLiveFeed()
{
$this->checkRequiredPostParams(array('iblockId', 'checked'));
$this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
$this->checkPermission();
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$this->iblockId = intval($this->request->getPost('iblockId'));
示例7: array
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_before.php';
use Bitrix\Conversion\RateManager;
use Bitrix\Conversion\AttributeManager;
use Bitrix\Conversion\AttributeGroupManager;
use Bitrix\Conversion\ReportContext;
use Bitrix\Main\Loader;
use Bitrix\Main\SiteTable;
use Bitrix\Main\Type\Date;
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
Loader::IncludeModule('conversion');
if ($APPLICATION->GetGroupRight('conversion') < 'W') {
$APPLICATION->AuthForm(Loc::getMessage('ACCESS_DENIED'));
}
$userOptions = CUserOptions::GetOption('conversion', 'filter', array());
// PERIOD
$from = ($d = $_GET['from'] ?: $userOptions['from']) && Date::isCorrect($d) ? new Date($d) : Date::createFromPhp(new DateTime('first day of last month'));
$to = ($d = $_GET['to'] ?: $userOptions['to']) && Date::isCorrect($d) ? new Date($d) : Date::createFromPhp(new DateTime('last day of this month'));
// RATES
if (!($rateTypes = RateManager::getTypes())) {
die('No rates available!');
}
$rateName = $_GET['rate'] ?: $userOptions['rate'];
if (!($rateType = $rateTypes[$rateName])) {
list($rateName, $rateType) = each($rateTypes);
}
// SITES
$sites = array();
$result = SiteTable::getList(array('select' => array('LID', 'NAME'), 'order' => array('DEF' => 'DESC', 'SORT' => 'ASC')));
示例8: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
\Bitrix\Main\Loader::IncludeModule("bq.options");
use Bq\Options;
global $arWatermark, $arWatermark2;
if (in_array("project", $arResult["PROPERTIES"]["PTYPE"]["VALUE_XML_ID"])) {
$arResult["PROPERTIES"]["PTYPE"]["VALUE_XML_ID"] = false;
$arResult["PROPERTIES"]["PTYPE"]["VALUE"] = false;
}
$arPlan = false;
foreach ($arResult["PROPERTIES"]["PLAN"]["VALUE"] as $k => $plan) {
$arPlan[$k]["NAME"] = $arResult["PROPERTIES"]["PLAN"]["DESCRIPTION"][$k];
if ($arPlan[$k]["NAME"] == "") {
$arPlan[$k]["NAME"] = "План #" . ($k + 1);
}
$arPlan[$k]["ID"] = $plan;
$arPlan[$k]["FILE"] = CFile::GetFileArray($plan);
$resize = CFile::ResizeImageGet($plan, array("width" => 400, "height" => 350), BX_RESIZE_IMAGE_PROPORTIONAL, false, array($arWatermark, $arWatermark2));
$arPlan[$k]["SRC"] = $resize["src"];
$resize = CFile::ResizeImageGet($plan, array("width" => 800, "height" => 800), BX_RESIZE_IMAGE_PROPORTIONAL, false, array($arWatermark, $arWatermark2));
$arPlan[$k]["FULL_PLAN"] = $resize["src"];
}
$arExplication = false;
$planFields = array('fc' => 'PLAN_TSOKOL', 'f1' => 'PLAN_1F', 'f2' => 'PLAN_2F', 'f3' => 'PLAN_3F', 'f4' => 'PLAN_4F', 'fm' => 'PLAN_MANS');
foreach ($planFields as $planField) {
if (!$arResult["PROPERTIES"][$planField]["VALUE"]) {
continue;
}
示例9: array
* "IBLOCK_ID" - инфоблок
* "DETAIL_PAGE_URL" - страница детального просмотра товара
* "PRICE" - базовая цена
* "PRICE_WITH_DISCOUNT" - цена с учетом скидки
* "PRODUCT_ID" - ИД товара
* "ARTNUMBER" - артикул
* "IMAGE" - путь к изображению
* "REVIEW_COUNT" - количество коментариев к товару
* ]
* ]
*/
use Bitrix\Main;
use Bitrix\Iblock;
use Bitrix\Catalog;
if ($this->StartResultCache()) {
if (!Main\Loader::IncludeModule("iblock") || !Main\Loader::includeModule('catalog') || !Main\Loader::includeModule('sale') || !Main\Loader::includeModule('blog')) {
$this->AbortResultCache();
return;
}
$arFilterV["SITE_ID"] = SITE_ID;
$arFilterV["FUSER_ID"] = CSaleBasket::GetBasketUserID();
$viewedIterator = \Bitrix\Catalog\CatalogViewedProductTable::getList(array('order' => array("DATE_VISIT" => "DESC"), 'filter' => $arFilterV, 'select' => array("ELEMENT_ID", "PRODUCT_ID"), 'limit' => $arParams["PAGE_ELEMENT_COUNT"]));
while ($arItems = $viewedIterator->fetch()) {
$arResult[$arItems["ELEMENT_ID"]] = $arItems["PRODUCT_ID"];
}
unset($arItems, $viewedIterator);
if (!empty($arResult)) {
$arIblockId = array();
$strImageStorePath = COption::GetOptionString("main", "upload_dir", "upload");
$arSelect = array("ID", "NAME", "IBLOCK_SECTION_ID", "IBLOCK_TYPE_ID", "IBLOCK_ID", "DETAIL_PAGE_URL", "CATALOG_GROUP_RETAIL", "PREVIEW_PICTURE", "DETAIL_PICTURE");
$elementIterator = CIBlockElement::GetList(array(), array("ID" => array_keys($arResult), "IBLOCK_TYPE_ID" => $arParams["IBLOCK_TYPE_ID"]), false, array(), $arSelect);
示例10: autoload
/**
* @throws \Bitrix\Main\LoaderException
*/
public function autoload()
{
\Bitrix\Main\Loader::IncludeModule('shantilab.bxecho');
}
示例11: OnBuildGlobalMenuHandler
<?php
/*
* This file is part of the Studio Fact package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
//define('IBLOCK_CATALOG', 2);
use Bitrix\Main\Loader;
Loader::includeModule('iblock');
Loader::IncludeModule('highloadblock');
Loader::registerAutoLoadClasses('citfact.tools', array('Citfact\\Tools' => 'lib/tools.php'));
class CitfactToolsEventsHandler
{
public function OnBuildGlobalMenuHandler(&$aGlobalMenu, &$aModuleMenu)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$APPLICATION->SetAdditionalCSS('/bitrix/themes/.default/citfact_tools.css');
$aGlobalMenu['global_menu_citfact'] = array('menu_id' => 'citfact', 'page_icon' => 'citfact_title_icon', 'index_icon' => 'citfact_page_icon', 'text' => 'Студия «Факт»', 'title' => 'Студия «Факт»', 'sort' => '70', 'items_id' => 'global_menu_citfact', 'help_section' => 'citfact', 'items' => array());
//echo "<pre style=\"display:none;\">"; print_r($aGlobalMenu); echo "</pre>";
//echo "<pre style=\"display:none;\">"; print_r($aModuleMenu); echo "</pre>";
}
}
示例12: array
<?php
/**
* @global \CMain $APPLICATION
* @global \CUser $USER
* @var string $mid
*/
if (($moduleRight = $APPLICATION->GetGroupRight(\RetailRocket\Config::MODULE_ID)) < 'R') {
return;
}
\Bitrix\Main\Localization\Loc::loadMessages($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/options.php');
\Bitrix\Main\Localization\Loc::loadMessages(__FILE__);
\Bitrix\Main\Loader::IncludeModule("retailrocket");
$aTabs = array(array('DIV' => 'edit1', 'TAB' => GetMessage('MAIN_TAB_SET'), 'ICON' => 'ib_settings', 'TITLE' => GetMessage('MAIN_TAB_TITLE_SET')), array('DIV' => 'edit2', 'TAB' => GetMessage('MAIN_TAB_RIGHTS'), 'ICON' => 'ib_settings', 'TITLE' => GetMessage('MAIN_TAB_TITLE_RIGHTS')));
$tabControl = new CAdminTabControl('tabControl', $aTabs);
if ($_POST && check_bitrix_sessid()) {
if (isset($_POST['option_partner_id'])) {
\RetailRocket\Config::setPartnerId($_POST['option_partner_id']);
}
}
$tabControl->Begin();
?>
<form method='post' action='<?php
echo $APPLICATION->GetCurPage();
?>
?mid=<?php
echo $mid;
?>
&lang=<?php
echo LANGUAGE_ID;
?>
示例13: define
<?php
define('NO_AGENT_CHECK', true);
define('STOP_STATISTICS', true);
include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
\Bitrix\Main\Loader::IncludeModule("iblock");
\Bitrix\Main\Loader::IncludeModule("sale");
\Bitrix\Main\Loader::IncludeModule("catalog");
$ID = (int) $_REQUEST["id"];
$arBasketItems = array();
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL", "ID" => $ID), false, false, array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT"));
while ($arItems = $dbBasketItems->Fetch()) {
#var_dump($arItems);
}
//
示例14: Date
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_before.php';
\Bitrix\Main\Loader::IncludeModule('conversion');
use Bitrix\Conversion\RateManager;
use Bitrix\Conversion\AttributeManager;
use Bitrix\Conversion\ReportContext;
use Bitrix\Main\Type\Date;
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
// PERIOD
$from = ($d = $_GET['from']) && Date::isCorrect($d) ? new Date($d) : Date::createFromPhp(new DateTime('first day of last month'));
$to = ($d = $_GET['to']) && Date::isCorrect($d) ? new Date($d) : Date::createFromPhp(new DateTime('last day of this month'));
// RATES
if (!($rateTypes = RateManager::getTypes())) {
die('No rates!');
}
$rateName = $_GET['rate'];
if (!($rateType = $rateTypes[$rateName])) {
list($rateName, $rateType) = each($rateTypes);
}
// ATTRIBUTES
if (!($attributeTypes = AttributeManager::getTypes())) {
die('No attributes!');
}
$splitByAttribute = ($s = $_GET['split']) && $attributeTypes[$s] ? $s : null;
// FILTER
$filter = array('lang' => LANGUAGE_ID, 'from' => $from, 'to' => $to, 'rate' => $rateName, 'split' => &$splitByAttribute);
call_user_func(function () use($from, $to, &$attributeTypes, &$filter, &$splitByAttribute) {
foreach ($attributeTypes as $name => &$type) {
$values =& $type['VALUES'];
示例15: getPropertyByCode
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
global $USER;
use Bitrix\Main, Bitrix\Main\Loader, Bitrix\Main\Config\Option, Bitrix\Sale, Bitrix\Sale\Order, Bitrix\Sale\DiscountCouponsManager;
if (!Loader::IncludeModule('sale')) {
die;
}
function getPropertyByCode($propertyCollection, $code)
{
foreach ($propertyCollection as $property) {
if ($property->getField('CODE') == $code) {
return $property;
}
}
}
$siteId = \Bitrix\Main\Context::getCurrent()->getSite();
$fio = 'Пупкин Василий';
$phone = '9511111111';
$email = 'pupkin@mail.ru';
$currencyCode = Option::get('sale', 'default_currency', 'RUB');
DiscountCouponsManager::init();
$order = Order::create($siteId, \CSaleUser::GetAnonymousUserID());
$order->setPersonTypeId(1);
$basket = Sale\Basket::loadItemsForFUser(\CSaleBasket::GetBasketUserID(), $siteId)->getOrderableItems();
/* Действия над товарами
$basketItems = $basket->getBasketItems();
foreach ($basketItems as $basketItem) {
}
*/