Пример #1
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (isset($arParams["COMPONENT_ENABLE"]) && $arParams["COMPONENT_ENABLE"] === false) {
    return;
}
if (!CModule::IncludeModule("brsoft.wishlist")) {
    return false;
}
$arResult = array();
$arResult["WL_USER_ID"] = CBrWishlist::GetWLUserID();
if ($this->StartResultCache($arParams["CACHE_TIME"])) {
    $dbResult = CBrWishlist::GetList(array("ID" => "ASC"), array("WL_USER_ID" => intval($arResult["WL_USER_ID"])), array("PARAM3"));
    while ($rsResult = $dbResult->GetNext()) {
        $arResult["__RETURN_VALUE"][] = $rsResult["PARAM3"];
    }
}
return $arResult["__RETURN_VALUE"];
Пример #2
0
$arParams["PARAM1"] = "iblock";
///TODO: for all modules
$arParams["PARAM2"] = intval($arParams["PARAM2"]) ?: false;
$arParams["PARAM3"] = intval($arParams["PARAM3"]);
if (!$arParams["PARAM2"]) {
    $arParams["PARAM2"] = CIBlockElement::GetIBlockByID($arParams["PARAM3"]);
    if (!$arParams["PARAM2"]) {
        return;
    }
}
if (empty($arParams["PARAM3"])) {
    return;
}
//не показывать компонент если не указаны к чему он подкреплен (ИД ИБ, ИД елемента ИБ)
//Выбор данных для $arResult
$arResult = array();
$arResult["WL_USER_ID"] = intval(CBrWishlist::GetWLUserID());
$arResult["USER_ID"] = CBrWishlistUser::GetBXUserID($arResult["WL_USER_ID"]);
if ($arResult["WL_USER_ID"] <= 0) {
    return;
}
//не удалось найти/создать текущего пользователя (ощибка самого модуля)
$arExistsFilter = array("WL_USER_ID" => $arResult["WL_USER_ID"], "PARAM1" => $arParams["PARAM1"], "PARAM2" => $arParams["PARAM2"], "PARAM3" => $arParams["PARAM3"]);
$wlElementCount = CBrWishlist::GetCount($arExistsFilter);
$arResult["ELEMENT_EXISTS"] = $wlElementCount > 0 ? "Y" : "N";
$arResult["WISHLIST_ELEMENT_ID"] = false;
$dbWishlistElement = CBrWishlist::GetList(array(), $arExistsFilter);
if ($arWishlistElement = $dbWishlistElement->GetNext()) {
    $arResult["WISHLIST_ELEMENT_ID"] = $arWishlistElement["ID"];
}
$this->IncludeComponentTemplate();
Пример #3
0
            }
            $dbWishlistElement = CBrWishlist::GetList(array(), array("WL_USER_ID" => $WL_USER_ID, "PARAM1" => $param1, "PARAM2" => $param2, "PARAM3" => $param3), array("ID"));
            if ($arWishlistElement = $dbWishlistElement->GetNext()) {
                //element already exists
                $result["WID"] = $arWishlistElement["ID"];
            } else {
                //add element to wishlist
                $result["WID"] = CBrWishlist::Add(array("WL_USER_ID" => $WL_USER_ID, "PARAM1" => $param1, "PARAM2" => $param2, "PARAM3" => $param3));
            }
            $result["result"] = true;
            break;
        case 'CHECK':
            $param1 = $_REQUEST["PARAM1"];
            $param2 = intval($_REQUEST["PARAM2"]) ?: false;
            $param3 = intval($_REQUEST["PARAM3"]);
            $dbWishlistElement = CBrWishlist::GetList(array(), array("WL_USER_ID" => $WL_USER_ID, "PARAM1" => $param1, "PARAM2" => $param2, "PARAM3" => $param3), array("ID"));
            if ($arWishlistElement = $dbWishlistElement->GetNext()) {
                //element already exists
                $result["WID"] = $arWishlistElement["ID"];
                $result["result"] = true;
            }
            break;
        default:
            $result["err_code"] = -2;
            /*unknown action type*/
            break;
    }
} else {
    $result["err_code"] = -1;
    //Модуль не установлен
}
Пример #4
0
    die;
}
if (isset($arParams["COMPONENT_ENABLE"]) && $arParams["COMPONENT_ENABLE"] === false) {
    return;
}
if (!CModule::IncludeModule("brsoft.wishlist")) {
    return false;
}
$arNavParams = array("nPageSize" => $arParams["PAGE_ELEMENT_COUNT"], "bDescPageNumbering" => $arParams["PAGER_DESC_NUMBERING"], "bShowAll" => $arParams["PAGER_SHOW_ALL"]);
$arNavigation = CDBResult::GetNavParams($arNavParams);
if ($arNavigation["PAGEN"] == 0 && $arParams["PAGER_DESC_NUMBERING_CACHE_TIME"] > 0) {
    $arParams["CACHE_TIME"] = $arParams["PAGER_DESC_NUMBERING_CACHE_TIME"];
}
$arResult = array();
$arResult["WL_USER_ID"] = CBrWishlist::GetWLUserID();
if ($this->StartResultCache(false, array($arParams["CACHE_GROUPS"] === "N" ? false : $USER->GetGroups(), $arNavigation))) {
    $arSort = array("ID" => "ASC");
    $arFilter = array("WL_USER_ID" => intval($arResult["WL_USER_ID"]));
    if (intval($arParams["IBLOCK_ID"]) > 0) {
        $arFilter["PARAM2"] = $arParams["IBLOCK_ID"];
    }
    $arSelect = array("PARAM3");
    $dbResult = CBrWishlist::GetList($arSort, $arFilter, $arSelect, $arNavParams);
    while ($rsResult = $dbResult->GetNext()) {
        $arResult["__RETURN_VALUE"][] = $arResult["ITEMS"][] = $rsResult["PARAM3"];
    }
    $arResult["NAV_STRING"] = $dbResult->GetPageNavStringEx($navComponentObject, $arParams["PAGER_TITLE"], $arParams["PAGER_TEMPLATE"], $arParams["PAGER_SHOW_ALWAYS"]);
    $arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
}
$this->IncludeComponentTemplate();
return $arResult["__RETURN_VALUE"];