本文整理汇总了PHP中CBitrixComponent类的典型用法代码示例。如果您正苦于以下问题:PHP CBitrixComponent类的具体用法?PHP CBitrixComponent怎么用?PHP CBitrixComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CBitrixComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getComponentTemplatePath
/**
* По Битрикс-имени шаблона возвращает путь к его файлу
*
* @param string $name
* @return string
* @throws \Twig_Error_Loader
*/
private function getComponentTemplatePath($name)
{
$name = $this->normalizeName($name);
list($namespace, $component, $template, $file) = explode(':', $name);
$componentName = "{$namespace}:{$component}";
$component = new \CBitrixComponent();
$component->InitComponent($componentName, $template);
$component->__templatePage = $file;
$obTemplate = new \CBitrixComponentTemplate();
$obTemplate->Init($component);
$templatePath = $_SERVER['DOCUMENT_ROOT'] . $obTemplate->GetFile();
if (!file_exists($templatePath)) {
throw new \Twig_Error_Loader("Не удалось найти шаблон '{$name}'");
}
return $templatePath;
}
示例2: __construct
function __construct($component = null)
{
parent::__construct($component);
CModule::IncludeModule('iblock');
CModule::IncludeModule('aqw.shop');
CBitrixComponent::includeComponentClass('aqw:store.product');
}
示例3: __bx_share_get_handlers
function __bx_share_get_handlers($template = false)
{
if (trim($template) == ".default") {
$template = "";
}
$arBookmarkHandlerDropdown = array();
$arBookmarkHandlerDropdownDefault = array();
$shareComponent = new CBitrixComponent();
$shareComponent->InitComponent("bitrix:main.share", $template);
$shareComponent->InitComponentTemplate($template);
if (strlen($shareComponent->__template->__folder) > 0) {
$path2Handlers = $_SERVER["DOCUMENT_ROOT"] . "/" . $shareComponent->__template->__folder . "/handlers/";
CheckDirPath($path2Handlers);
$arHandlers = array();
if ($handle = opendir($path2Handlers)) {
while (($file = readdir($handle)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
if (is_file($path2Handlers . $file) && strtoupper(substr($file, strlen($file) - 4)) == ".PHP") {
$name = $title = $icon_url_template = "";
$sort = 0;
include $path2Handlers . $file;
if (strlen($name) > 0) {
$arHandlers[$name] = array("TITLE" => $title, "ICON" => $icon_url_template, "SORT" => intval($sort));
}
}
}
}
foreach ($arHandlers as $name => $arSystem) {
if (strlen($arSystem["TITLE"]) > 0) {
$arBookmarkHandlerDropdown[$name] = $arSystem["TITLE"];
}
}
$arBookmarkHandlerDropdownTmp = $arBookmarkHandlerDropdown;
if (LANGUAGE != 'ru') {
if (array_key_exists("vk", $arBookmarkHandlerDropdownTmp)) {
unset($arBookmarkHandlerDropdownTmp["vk"]);
}
if (array_key_exists("mailru", $arBookmarkHandlerDropdownTmp)) {
unset($arBookmarkHandlerDropdownTmp["mailru"]);
}
}
$arBookmarkHandlerDropdownDefault = array_keys($arBookmarkHandlerDropdownTmp);
}
return array("HANDLERS" => $arBookmarkHandlerDropdown, "HANDLERS_DEFAULT" => $arBookmarkHandlerDropdownDefault);
}
示例4:
/**
* @param string $type
* @param CBitrixComponent $obMenuComponent
* @return string
*/
function __GetMenuString($type = "left", $obMenuComponent)
{
/** @var CMenuCustom*/
global $BX_MENU_CUSTOM;
$sReturn = "";
if ($GLOBALS["APPLICATION"]->buffer_manual) {
$arMenuCustom = $BX_MENU_CUSTOM->GetItems($type);
if (is_array($arMenuCustom)) {
$obMenuComponent->arResult = array_merge($obMenuComponent->arResult, $arMenuCustom);
}
ob_start();
$obMenuComponent->IncludeComponentTemplate();
$sReturn = ob_get_contents();
ob_end_clean();
}
return $sReturn;
}
示例5: includeComponentClass
/**
* Function includes class of the component by component name bitrix:component.base
*
* @param string $componentName
* @return string
*
*/
final public static function includeComponentClass($componentName)
{
$component = new CBitrixComponent;
$component->initComponent($componentName);
}
示例6: OnAfterIndexAdd
function OnAfterIndexAdd($ID, $arFields)
{
if (isset($arFields["PARAMS"]) && isset($arFields["PARAMS"]["socnet_group"])) {
CBitrixComponent::clearComponentCache("bitrix:search.tags.cloud");
}
}
示例7: __construct
public function __construct($component = null)
{
parent::__construct($component);
\Bitrix\Main\Loader::includeModule("forum");
$this->componentId = $this->isAjaxRequest() ? randString(7) : $this->randString();
$this->errorCollection = new ErrorCollection();
}
示例8: executeComponent
public function executeComponent()
{
$this->IBLOCK_ID = $this->arParams["IBLOCK_ID"];
$this->SECTION_ID = $this->arParams["SECTION_ID"];
$this->FILTER_NAME = $this->arParams["FILTER_NAME"];
$this->SAFE_FILTER_NAME = htmlspecialcharsbx($this->FILTER_NAME);
if (self::$catalogIncluded === null)
self::$catalogIncluded = Loader::includeModule('catalog');
if (self::$catalogIncluded)
{
$arCatalog = CCatalogSKU::GetInfoByProductIBlock($this->IBLOCK_ID);
if (!empty($arCatalog))
{
$this->SKU_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
$this->SKU_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
}
}
/*DEMO CODE for "pure" class.php component
$this->arResult["FFF"] = "ggg";
$this->includeComponentTemplate();
return $this->ELEMENT_ID;
*/
return parent::executeComponent();
}
示例9: setTemplateEpilog
/**
* Function saves component epilog environment
*
* @param array[string]mixed $arEpilogInfo
* @return void
*
*/
public final function setTemplateEpilog($arEpilogInfo)
{
$this->__component_epilog = $arEpilogInfo;
//Check if parent component exists and plug epilog it to it's "collection"
if ($this->__parent) {
$this->__parent->addChildEpilog($this->__component_epilog);
}
}
示例10: __construct
public function __construct($component = null)
{
parent::__construct($component);
$this->helper = new CCrmProductSectionCrumbsHelper();
$this->componentId = $this->randString();
$this->errors = array();
$this->catalogId = 0;
$this->sectionId = 0;
}
示例11: __construct
public function __construct($component = null)
{
parent::__construct($component);
$this->scope = self::STATUS_SCOPE_WEB;
if (is_callable(array('\\Bitrix\\MobileApp\\Mobile', 'getApiVersion')) && \Bitrix\MobileApp\Mobile::getApiVersion() >= 1 && defined("BX_MOBILE") && BX_MOBILE === true) {
$this->scope = self::STATUS_SCOPE_MOBILE;
}
if ($this->isWeb()) {
$this->setTemplateName(".default");
} else {
$this->setTemplateName("mobile_app");
}
}
示例12: executeComponent
public function executeComponent()
{
parent::setFramemode(false);
$this->userId = $this->arParams["USER_ID"];
$this->fUserId = $this->arParams["FUSER_ID"];
$this->weightKoef = $this->arParams["WEIGHT_KOEF"];
$this->weightUnit = $this->arParams["WEIGHT_UNIT"];
$this->columns = $this->arParams["COLUMNS_LIST"];
$this->offersProps = $this->arParams["OFFERS_PROPS"];
$this->quantityFloat = $this->arParams["QUANTITY_FLOAT"];
$this->countDiscount4AllQuantity = $this->arParams["COUNT_DISCOUNT_4_ALL_QUANTITY"];
$this->priceVatShowValue = $this->arParams["PRICE_VAT_SHOW_VALUE"];
$this->hideCoupon = $this->arParams["HIDE_COUPON"];
$this->usePrepayment = $this->arParams["USE_PREPAYMENT"];
$this->pathToOrder = $this->arParams["PATH_TO_ORDER"];
return parent::executeComponent();
}
示例13: onPrepareComponentParams
public function onPrepareComponentParams($params)
{
$params = parent::onPrepareComponentParams($params);
if (!isset($this->arParams["WIDTH"])) {
$this->arParams["WIDTH"] = 400;
}
if (!isset($this->arParams["HEIGHT"])) {
$this->arParams["HEIGHT"] = 400;
}
if (!isset($this->arParams["SELECTED_STORE"])) {
$this->arParams["SELECTED_STORE"] = 0;
if (isset($params["STORES_LIST"]) && is_array($params["STORES_LIST"])) {
reset($params["STORES_LIST"]);
$this->arParams["SELECTED_STORE"] = key($params["STORES_LIST"]);
}
}
return $params;
}
示例14: __construct
public function __construct($component = null)
{
parent::__construct($component);
\Bitrix\Main\Loader::includeModule("forum");
$this->componentId = $this->isAjaxRequest() ? randString(7) : $this->randString();
$this->errorCollection = new ErrorCollection();
$this->prepareMobileData = IsModuleInstalled("mobile");
$this->scope = self::STATUS_SCOPE_WEB;
if (is_callable(array('\\Bitrix\\MobileApp\\Mobile', 'getApiVersion')) && \Bitrix\MobileApp\Mobile::getApiVersion() >= 1 && defined("BX_MOBILE") && BX_MOBILE === true) {
$this->scope = self::STATUS_SCOPE_MOBILE;
}
self::$index++;
if ($this->isWeb()) {
$this->setTemplateName(".default");
} else {
$this->setTemplateName("mobile_app");
}
}
示例15: executeComponent
public function executeComponent()
{
$this->IBLOCK_ID = $this->arParams["IBLOCK_ID"];
$this->SECTION_ID = $this->arParams["SECTION_ID"];
$this->FILTER_NAME = $this->arParams["FILTER_NAME"];
if (CModule::IncludeModule("catalog")) {
$arCatalog = CCatalog::GetSkuInfoByProductID($this->IBLOCK_ID);
if (is_array($arCatalog)) {
$this->SKU_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
$this->SKU_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
}
}
/*DEMO CODE for "pure" class.php component
$this->arResult["FFF"] = "ggg";
$this->includeComponentTemplate();
return $this->ELEMENT_ID;
*/
return parent::executeComponent();
}