本文整理汇总了PHP中CIBlockElement::GetElementGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::GetElementGroups方法的具体用法?PHP CIBlockElement::GetElementGroups怎么用?PHP CIBlockElement::GetElementGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::GetElementGroups方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroupsIds
protected static function getGroupsIds(array $productIds)
{
$groupsIds = array();
$res = \CIBlockElement::GetElementGroups($productIds, true, array('ID'));
while ($group = $res->Fetch()) {
if (!in_array($group['ID'], $groupsIds)) {
$groupsIds[] = $group['ID'];
}
}
return $groupsIds;
}
示例2: SendRemindEventAgent
function SendRemindEventAgent($iblockId, $taskId, $pathTemplate)
{
if (!CModule::IncludeModule("socialnetwork") && !CModule::IncludeModule("iblock")) {
return;
}
$iblockId = IntVal($iblockId);
$taskId = IntVal($taskId);
if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"])) {
$bTmpUser = True;
$GLOBALS["USER"] = new CUser();
}
$arTasksCustomProps = array();
$dbTasksCustomProps = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $iblockId, "CHECK_PERMISSIONS" => "N"));
while ($arTasksCustomProp = $dbTasksCustomProps->Fetch()) {
$ind = StrLen($arTasksCustomProp["CODE"]) > 0 ? $arTasksCustomProp["CODE"] : $arTasksCustomProp["ID"];
$arTasksCustomProps[StrToUpper($ind)] = $arTasksCustomProp;
}
$dbTasksList = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "ID" => $taskId, "CHECK_PERMISSIONS" => "N"), false, false, array("ID", "NAME", "IBLOCK_ID", "CREATED_BY", "PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"]));
while ($arTask = $dbTasksList->GetNext()) {
$ar = array();
$dbElementSections = CIBlockElement::GetElementGroups($arTask["ID"]);
while ($arElementSection = $dbElementSections->Fetch()) {
if ($arElementSection["IBLOCK_ID"] == $iblockId) {
$ar[] = $arElementSection["ID"];
}
}
if (Count($ar) <= 0) {
continue;
}
$taskType = "";
$taskOwnerId = 0;
$dbSectionsChain = CIBlockSection::GetNavChain($iblockId, $ar[0]);
if ($arSect = $dbSectionsChain->Fetch()) {
$taskType = $arSect["XML_ID"] == "users_tasks" ? "user" : "group";
$taskOwnerId = IntVal($taskType == "user" ? $arTask["PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"] . "_VALUE"] : $arSect["XML_ID"]);
}
if (!In_Array($taskType, array("user", "group")) || $taskOwnerId <= 0) {
continue;
}
$path2view = ($GLOBALS["APPLICATION"]->IsHTTPS() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . CComponentEngine::MakePathFromTemplate($pathTemplate, array("owner_id" => $taskOwnerId, "task_id" => $arTask["ID"], "action" => "view"));
$arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $arTask["CREATED_BY"], "TO_USER_ID" => $arTask["PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"] . "_VALUE"], "MESSAGE" => str_replace(array("#URL_VIEW#", "#NAME#"), array($path2view, $arTask["NAME"]), GetMessage("INTE_REMIND_TASK_MESSAGE")));
CSocNetMessages::Add($arMessageFields);
//CIBlockElement::SetPropertyValueCode($arTask["ID"], $arTasksCustomProps["TASKREMIND"]["ID"], false);
}
if ($bTmpUser) {
unset($GLOBALS["USER"]);
}
//return "CIntranetTasks::SendRemindEventAgent($iblockId, $taskId, \"$pathTemplate\");";
}
示例3: __InTaskDeleteTask
function __InTaskDeleteTask($delTaskId, $iblockId, $taskType, $ownerId, $arParams)
{
$delTaskId = IntVal($delTaskId);
$iblockId = IntVal($iblockId);
$ownerId = IntVal($ownerId);
if ($delTaskId <= 0 || $iblockId <= 0 || $ownerId <= 0) {
return "";
}
$errorMessage = "";
if (StrLen($errorMessage) <= 0) {
$sectionId = 0;
$dbElementSections = CIBlockElement::GetElementGroups($delTaskId);
while ($arElementSection = $dbElementSections->Fetch()) {
if ($arElementSection["IBLOCK_ID"] == $iblockId) {
$sectionId = $arElementSection["ID"];
break;
}
}
if ($sectionId <= 0) {
$errorMessage .= GetMessage("INTL_TASK_NOT_FOUND") . ".";
}
}
if (StrLen($errorMessage) <= 0) {
$dbSectionsChain = CIBlockSection::GetNavChain($iblockId, $sectionId);
if ($arSect = $dbSectionsChain->GetNext()) {
if ($taskType == 'group' && $arSect["XML_ID"] != $ownerId) {
$errorMessage .= GetMessage("INTL_TASK_INTERNAL_ERROR") . " GTK003" . ". ";
} elseif ($taskType != 'group' && $arSect["XML_ID"] != "users_tasks") {
$errorMessage .= GetMessage("INTL_TASK_INTERNAL_ERROR") . " GTK004" . ". ";
}
} else {
$errorMessage .= GetMessage("INTL_FOLDER_NOT_FOUND") . ". ";
}
}
if (StrLen($errorMessage) <= 0) {
if (!CIBlockElement::Delete($delTaskId)) {
$errorMessage .= GetMessage("INTL_ERROR_DELETE_TASK") . ". ";
}
CAgent::RemoveAgent("CIntranetTasks::SendRemindEventAgent(" . $iblockId . ", " . $delTaskId . ", \"" . $arParams[$taskType == "user" ? "PATH_TO_USER_TASKS_TASK" : "PATH_TO_GROUP_TASKS_TASK"] . "\");", "intranet");
}
return $errorMessage;
}
示例4: PublishDocument
/**
* ћетод публикует документ. “о есть делает его доступным в публичной части сайта.
*
* @param string $documentId - код документа.
*/
public function PublishDocument($documentId)
{
global $DB;
$ID = intval($documentId);
$db_element = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_HISTORY" => "Y"), false, false, array("ID", "TIMESTAMP_X", "MODIFIED_BY", "DATE_CREATE", "CREATED_BY", "IBLOCK_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "SORT", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "WF_STATUS_ID", "WF_PARENT_ELEMENT_ID", "WF_NEW", "WF_COMMENTS", "IN_SECTIONS", "CODE", "TAGS", "XML_ID", "TMP_ID"));
if ($ar_element = $db_element->Fetch()) {
$PARENT_ID = intval($ar_element["WF_PARENT_ELEMENT_ID"]);
if ($PARENT_ID) {
// TODO: ≈сли в документе $documentId поле WF_PARENT_ELEMENT_ID не NULL, то при публикации нужно перенести данные
// (скопировать документ) из документа $documentId в документ WF_PARENT_ELEMENT_ID,
$obElement = new CIBlockElement();
$ar_element["WF_PARENT_ELEMENT_ID"] = false;
if ($ar_element["PREVIEW_PICTURE"]) {
$ar_element["PREVIEW_PICTURE"] = CFile::MakeFileArray($ar_element["PREVIEW_PICTURE"]);
} else {
$ar_element["PREVIEW_PICTURE"] = array("tmp_name" => "", "del" => "Y");
}
if ($ar_element["DETAIL_PICTURE"]) {
$ar_element["DETAIL_PICTURE"] = CFile::MakeFileArray($ar_element["DETAIL_PICTURE"]);
} else {
$ar_element["DETAIL_PICTURE"] = array("tmp_name" => "", "del" => "Y");
}
$ar_element["IBLOCK_SECTION"] = array();
if ($ar_element["IN_SECTIONS"] == "Y") {
$rsSections = CIBlockElement::GetElementGroups($ar_element["ID"], true, array('ID', 'IBLOCK_ELEMENT_ID'));
while ($arSection = $rsSections->Fetch()) {
$ar_element["IBLOCK_SECTION"][] = $arSection["ID"];
}
}
$ar_element["PROPERTY_VALUES"] = array();
$arProps =& $ar_element["PROPERTY_VALUES"];
//Delete old files
$rsProps = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $PARENT_ID, array("value_id" => "asc"), array("PROPERTY_TYPE" => "F", "EMPTY" => "N"));
while ($arProp = $rsProps->Fetch()) {
if (!array_key_exists($arProp["ID"], $arProps)) {
$arProps[$arProp["ID"]] = array();
}
$arProps[$arProp["ID"]][$arProp["PROPERTY_VALUE_ID"]] = array("VALUE" => array("tmp_name" => "", "del" => "Y"), "DESCRIPTION" => false);
}
//Add new proiperty values
$rsProps = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $ar_element["ID"], array("value_id" => "asc"));
$i = 0;
while ($arProp = $rsProps->Fetch()) {
$i++;
if (!array_key_exists($arProp["ID"], $arProps)) {
$arProps[$arProp["ID"]] = array();
}
if ($arProp["PROPERTY_VALUE_ID"]) {
if ($arProp["PROPERTY_TYPE"] == "F") {
$arProps[$arProp["ID"]]["n" . $i] = array("VALUE" => CFile::MakeFileArray($arProp["VALUE"]), "DESCRIPTION" => $arProp["DESCRIPTION"]);
} else {
$arProps[$arProp["ID"]]["n" . $i] = array("VALUE" => $arProp["VALUE"], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
}
}
$obElement->Update($PARENT_ID, $ar_element);
// вызвать CBPDocument::MergeDocuments(WF_PARENT_ELEMENT_ID, $documentId) дл¤ переноса состо¤ний и истории Ѕѕ,
CBPDocument::MergeDocuments(array("lists", "BizprocDocument", $PARENT_ID), array("lists", "BizprocDocument", $documentId));
// грохнуть документ $documentId,
CIBlockElement::Delete($ID);
// опубликовать документ WF_PARENT_ELEMENT_ID
CIBlockElement::WF_CleanUpHistoryCopies($PARENT_ID, 0);
$strSql = "update b_iblock_element set WF_STATUS_ID='1', WF_NEW=NULL WHERE ID=" . $PARENT_ID . " AND WF_PARENT_ELEMENT_ID IS NULL";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
CIBlockElement::UpdateSearch($PARENT_ID);
return $PARENT_ID;
} else {
// ≈сли WF_PARENT_ELEMENT_ID равно NULL, то все как раньше.
CIBlockElement::WF_CleanUpHistoryCopies($ID, 0);
$strSql = "update b_iblock_element set WF_STATUS_ID='1', WF_NEW=NULL WHERE ID=" . $ID . " AND WF_PARENT_ELEMENT_ID IS NULL";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br>LINE: " . __LINE__);
CIBlockElement::UpdateSearch($ID);
return $ID;
}
}
return false;
}
示例5: array
$arValues = "";
}
}
} else {
$arValues = "";
}
} else {
$arValues = $arProperty["~VALUE"];
}
$arPropsValues[$arProperty["ID"]] = $arValues;
}
}
$arResSections = array();
if ($bNeedGroups) {
$i = 0;
$rsSections = CIBlockElement::GetElementGroups($arIBlockElement["ID"], false, array('ID', 'ADDITIONAL_PROPERTY_ID'));
while ($arSection = $rsSections->Fetch()) {
if (0 < intval($arSection['ADDITIONAL_PROPERTY_ID'])) {
continue;
}
if (!isset($arCacheChains[$arSection['ID']])) {
$arPath = array();
$j = 0;
$rsPath = CIBlockSection::GetNavChain($IBLOCK_ID, $arSection["ID"]);
while ($arPathSection = $rsPath->Fetch()) {
if (!empty($arGroupProps[$j])) {
foreach ($arGroupProps[$j] as &$key) {
$field = $arAvailGroupFields_names[$key]['field'];
if ('IC_PICTURE' == $key || 'IC_DETAIL_PICTURE' == $key) {
if ('Y' == $export_files) {
$arPathSection[$field] = __CSVExportFile($arPathSection[$field], $strExportPath, $strFilePath);
示例6: GetGroups
function GetGroups()
{
$res = CIBlockElement::GetElementGroups($this->fields["ID"]);
return $res;
}
示例7: GetProductSections
public static function GetProductSections($ID)
{
global $stackCacheManager;
$ID = intval($ID);
if (0 >= $ID)
return false;
$cacheTime = CATALOG_CACHE_DEFAULT_TIME;
if (defined("CATALOG_CACHE_TIME"))
$cacheTime = intval(CATALOG_CACHE_TIME);
$arProductSections = array();
$dbElementSections = CIBlockElement::GetElementGroups($ID, false, array("ID", "ADDITIONAL_PROPERTY_ID"));
while ($arElementSections = $dbElementSections->Fetch())
{
if (0 < intval($arElementSections['ADDITIONAL_PROPERTY_ID']))
continue;
$arSectionsTmp = array();
$strCacheKey = "p".$arElementSections["ID"];
$stackCacheManager->SetLength("catalog_group_parents", 50);
$stackCacheManager->SetTTL("catalog_group_parents", $cacheTime);
if ($stackCacheManager->Exist("catalog_group_parents", $strCacheKey))
{
$arSectionsTmp = $stackCacheManager->Get("catalog_group_parents", $strCacheKey);
}
else
{
$dbSection = CIBlockSection::GetList(
array(),
array('ID' => $arElementSections["ID"]),
false,
$arSelect = array(
'ID',
'IBLOCK_ID',
'LEFT_MARGIN',
'RIGHT_MARGIN',
)
);
if ($arSection = $dbSection->Fetch())
{
$dbSectionTree = CIBlockSection::GetList(
array("LEFT_MARGIN" => "DESC"),
array(
"IBLOCK_ID" => $arSection["IBLOCK_ID"],
"ACTIVE" => "Y",
"GLOBAL_ACTIVE" => "Y",
"IBLOCK_ACTIVE" => "Y",
"<=LEFT_BORDER" => $arSection["LEFT_MARGIN"],
">=RIGHT_BORDER" => $arSection["RIGHT_MARGIN"]
)
);
while ($arSectionTree = $dbSectionTree->Fetch())
{
if (!in_array($arSectionTree["ID"], $arProductSections))
$arSectionsTmp[] = $arSectionTree["ID"];
}
}
$stackCacheManager->Set("catalog_group_parents", $strCacheKey, $arSectionsTmp);
}
$arProductSections = array_merge($arProductSections, $arSectionsTmp);
}
$arProductSections = array_unique($arProductSections);
return $arProductSections;
}
示例8: exportElementFields
function exportElementFields($arElement, $SECTION_MAP)
{
fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_NAME") . ">" . htmlspecialcharsbx($arElement["NAME"]) . "</" . GetMessage("IBLOCK_XML2_NAME") . ">\n");
if ($this->bExtended) {
fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_BX_TAGS") . ">" . htmlspecialcharsbx($arElement["TAGS"]) . "</" . GetMessage("IBLOCK_XML2_BX_TAGS") . ">\n");
}
$arSections = array();
$rsSections = CIBlockElement::GetElementGroups($arElement["ID"], true);
while ($arSection = $rsSections->Fetch()) {
if (array_key_exists($arSection["ID"], $SECTION_MAP)) {
$arSections[] = $SECTION_MAP[$arSection["ID"]];
}
}
fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_GROUPS") . ">\n");
foreach ($arSections as $xml_id) {
fwrite($this->fp, "\t\t\t\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($xml_id) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
}
fwrite($this->fp, "\t\t\t\t</" . GetMessage("IBLOCK_XML2_GROUPS") . ">\n");
if (!$this->bExtended) {
fwrite($this->fp, "\t\t\t\t<" . GetMessage("IBLOCK_XML2_DESCRIPTION") . ">" . htmlspecialcharsbx(FormatText($arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT_TYPE"])) . "</" . GetMessage("IBLOCK_XML2_DESCRIPTION") . ">\n");
}
fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_PICTURE"), $this->ExportFile($arElement["DETAIL_PICTURE"])));
}
示例9: Update
function Update($ID, $arFields, $bWorkFlow = false, $bUpdateSearch = true, $bResizePictures = false, $bCheckDiskQuota = true)
{
global $DB, $USER;
$ID = intval($ID);
$db_element = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_HISTORY" => "Y"), false, false, array("ID", "TIMESTAMP_X", "MODIFIED_BY", "DATE_CREATE", "CREATED_BY", "IBLOCK_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "SORT", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "WF_STATUS_ID", "WF_PARENT_ELEMENT_ID", "WF_NEW", "WF_COMMENTS", "IN_SECTIONS", "CODE", "TAGS", "XML_ID", "TMP_ID"));
if (!($ar_element = $db_element->Fetch())) {
return false;
}
$arIBlock = CIBlock::GetArrayByID($ar_element["IBLOCK_ID"]);
$bWorkFlow = $bWorkFlow && is_array($arIBlock) && $arIBlock["WORKFLOW"] != "N" && CModule::IncludeModule("workflow");
$ar_wf_element = $ar_element;
$LAST_ID = 0;
if ($bWorkFlow) {
$LAST_ID = CIBlockElement::WF_GetLast($ID);
if ($LAST_ID != $ID) {
$db_element = CIBlockElement::GetByID($LAST_ID);
if (!($ar_wf_element = $db_element->Fetch())) {
return false;
}
}
$arFields["WF_PARENT_ELEMENT_ID"] = $ID;
if (!array_key_exists("PROPERTY_VALUES", $arFields) || !is_array($arFields["PROPERTY_VALUES"])) {
$arFields["PROPERTY_VALUES"] = array();
}
$bFieldProps = array();
foreach ($arFields["PROPERTY_VALUES"] as $k => $v) {
$bFieldProps[$k] = true;
}
$arFieldProps =& $arFields['PROPERTY_VALUES'];
$props = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $ar_wf_element["ID"]);
while ($arProp = $props->Fetch()) {
$pr_val_id = $arProp['PROPERTY_VALUE_ID'];
if ($arProp['PROPERTY_TYPE'] == 'F' && strlen($pr_val_id) > 0) {
if (strlen($arProp["CODE"]) > 0 && is_set($arFieldProps, $arProp["CODE"])) {
$pr_id = $arProp["CODE"];
} else {
$pr_id = $arProp['ID'];
}
if (array_key_exists($pr_id, $arFieldProps) && array_key_exists($pr_val_id, $arFieldProps[$pr_id]) && is_array($arFieldProps[$pr_id][$pr_val_id])) {
$new_value = $arFieldProps[$pr_id][$pr_val_id];
if (strlen($new_value['name']) <= 0 && $new_value['del'] != "Y" && strlen($new_value['VALUE']['name']) <= 0 && $new_value['VALUE']['del'] != "Y") {
if (array_key_exists('DESCRIPTION', $new_value) && $new_value['DESCRIPTION'] != $arProp['DESCRIPTION']) {
$p = array("VALUE" => CFile::MakeFileArray($arProp['VALUE']));
$p["DESCRIPTION"] = $new_value["DESCRIPTION"];
$p["MODULE_ID"] = "iblock";
$arFieldProps[$pr_id][$pr_val_id] = $p;
} elseif ($arProp['VALUE'] > 0) {
$arFieldProps[$pr_id][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
}
} else {
$arFieldProps[$pr_id][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
continue;
}
if (strlen($pr_val_id) <= 0 || array_key_exists($arProp["ID"], $bFieldProps) || strlen($arProp["CODE"]) > 0 && array_key_exists($arProp["CODE"], $bFieldProps)) {
continue;
}
$arFieldProps[$arProp["ID"]][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
if ($ar_wf_element["IN_SECTIONS"] == "Y") {
$ar_wf_element["IBLOCK_SECTION"] = array();
$rsSections = CIBlockElement::GetElementGroups($ar_element["ID"], true, array('ID', 'IBLOCK_ELEMENT_ID'));
while ($arSection = $rsSections->Fetch()) {
$ar_wf_element["IBLOCK_SECTION"][] = $arSection["ID"];
}
}
unset($ar_wf_element["DATE_ACTIVE_FROM"]);
unset($ar_wf_element["DATE_ACTIVE_TO"]);
unset($ar_wf_element["EXTERNAL_ID"]);
unset($ar_wf_element["TIMESTAMP_X"]);
unset($ar_wf_element["ID"]);
$arFields = $arFields + $ar_wf_element;
}
$arFields["WF"] = $bWorkFlow ? "Y" : "N";
$bBizProc = is_array($arIBlock) && $arIBlock["BIZPROC"] == "Y" && IsModuleInstalled("bizproc");
if (array_key_exists("BP_PUBLISHED", $arFields)) {
if ($bBizProc) {
if ($arFields["BP_PUBLISHED"] == "Y") {
$arFields["WF_STATUS_ID"] = 1;
$arFields["WF_NEW"] = false;
} else {
$arFields["WF_STATUS_ID"] = 2;
$arFields["WF_NEW"] = "Y";
$arFields["BP_PUBLISHED"] = "N";
}
} else {
$arFields["WF_NEW"] = false;
unset($arFields["BP_PUBLISHED"]);
}
} else {
$arFields["WF_NEW"] = false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "PREVIEW_TEXT_TYPE") && $arFields["PREVIEW_TEXT_TYPE"] != "html") {
$arFields["PREVIEW_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "DETAIL_TEXT_TYPE") && $arFields["DETAIL_TEXT_TYPE"] != "html") {
//.........这里部分代码省略.........
示例10: intval
$new_section = intval($_REQUEST["section_to_move"]);
if ($new_section >= 0) {
if ($TYPE == "S") {
if (CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $new_section, "section_section_bind")) {
$obS = new CIBlockSection();
if (!$obS->Update($ID, array("IBLOCK_SECTION_ID" => $new_section))) {
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SAVE_ERROR", array("#ID#" => $ID, "#ERROR_MESSAGE#" => $obS->LAST_ERROR)), $TYPE . $ID);
}
} else {
$lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE . $ID);
}
} elseif ($TYPE == "E") {
if (CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit") && CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $new_section, "section_element_bind")) {
$obE = new CIBlockElement();
$arSections = array();
$rsSections = $obE->GetElementGroups($ID, true);
while ($ar = $rsSections->Fetch()) {
$arSections[$ar["ID"]] = $ar["ID"];
}
if ($_REQUEST['action'] == "section") {
$arSections[$section_id] = $new_section;
} else {
$arSections[$new_section] = $new_section;
}
if (!$obE->Update($ID, array("IBLOCK_SECTION" => $arSections))) {
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SAVE_ERROR", array("#ID#" => $ID, "#ERROR_MESSAGE#" => $obE->LAST_ERROR)), $TYPE . $ID);
}
} else {
$lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE . $ID);
}
}
示例11: ExportElements
function ExportElements($PROPERTY_MAP, $SECTION_MAP, $start_time, $INTERVAL, $counter_limit = 0, $arElementFilter = false)
{
$counter = 0;
$arSelect = array(
"ID",
"IBLOCK_ID",
"XML_ID",
"ACTIVE",
"CODE",
"NAME",
"PREVIEW_TEXT",
"PREVIEW_TEXT_TYPE",
"ACTIVE_FROM",
"ACTIVE_TO",
"SORT",
"TAGS",
"DETAIL_TEXT",
"DETAIL_TEXT_TYPE",
"PREVIEW_PICTURE",
"DETAIL_PICTURE",
);
if(is_array($arElementFilter))
{
$arFilter = $arElementFilter;
}
else
{
if($arElementFilter === "none")
return 0;
$arFilter = array (
"IBLOCK_ID"=> $this->arIBlock["ID"],
"ACTIVE" => "Y",
">ID" => $this->next_step["LAST_ID"],
);
if($arElementFilter === "all")
unset($arFilter["ACTIVE"]);
}
$arOrder = array(
"ID" => "ASC",
);
$arPropOrder = array(
"sort" => "asc",
"id" => "asc",
"enum_sort" => "asc",
"value_id" => "asc",
);
$rsElements = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect);
while($arElement = $rsElements->Fetch())
{
if($this->next_step["catalog"])
fwrite($this->fp, "\t\t\t<".GetMessage("IBLOCK_XML2_OFFER").">\n");
else
fwrite($this->fp, "\t\t\t<".GetMessage("IBLOCK_XML2_POSITION").">\n");
if(strlen($arElement["XML_ID"])>0)
$xml_id = $arElement["XML_ID"];
else
$xml_id = $arElement["ID"];
if($this->PRODUCT_IBLOCK_ID > 0)
{
$rsLink = CIBlockElement::GetProperty($this->arIBlock["ID"], $arElement["ID"], $arPropOrder, array("ACTIVE"=>"Y", "CODE" => "CML2_LINK"));
$arLink = $rsLink->Fetch();
if(is_array($arLink) && !is_array($arLink["VALUE"]) && $arLink["VALUE"] > 0)
$xml_id = $this->GetElementXML_ID($this->PRODUCT_IBLOCK_ID, $arLink["VALUE"])."#".$xml_id;
}
fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_ID").">".htmlspecialcharsbx($xml_id)."</".GetMessage("IBLOCK_XML2_ID").">\n");
if(!$this->only_price)
{
fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_NAME").">".htmlspecialcharsbx($arElement["NAME"])."</".GetMessage("IBLOCK_XML2_NAME").">\n");
if($this->bExtended)
fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_BX_TAGS").">".htmlspecialcharsbx($arElement["TAGS"])."</".GetMessage("IBLOCK_XML2_BX_TAGS").">\n");
$arSections = array();
$rsSections = CIBlockElement::GetElementGroups($arElement["ID"], true);
while($arSection = $rsSections->Fetch())
if(array_key_exists($arSection["ID"], $SECTION_MAP))
$arSections[] = $SECTION_MAP[$arSection["ID"]];
fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_GROUPS").">\n");
foreach($arSections as $xml_id)
fwrite($this->fp, "\t\t\t\t\t<".GetMessage("IBLOCK_XML2_ID").">".htmlspecialcharsbx($xml_id)."</".GetMessage("IBLOCK_XML2_ID").">\n");
fwrite($this->fp, "\t\t\t\t</".GetMessage("IBLOCK_XML2_GROUPS").">\n");
if(!$this->bExtended)
fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_DESCRIPTION").">".htmlspecialcharsbx(FormatText($arElement["DETAIL_TEXT"], $arElement["DETAIL_TEXT_TYPE"]))."</".GetMessage("IBLOCK_XML2_DESCRIPTION").">\n");
fwrite($this->fp, $this->formatXMLNode(4, GetMessage("IBLOCK_XML2_PICTURE"), $this->ExportFile($arElement["DETAIL_PICTURE"])));
fwrite($this->fp, "\t\t\t\t<".GetMessage("IBLOCK_XML2_PROPERTIES_VALUES").">\n");
if($this->bExtended)
{
$this->ExportPropertyValue("CML2_ACTIVE", ($arElement["ACTIVE"]=="Y"? "true": "false"));
$this->ExportPropertyValue("CML2_CODE", $arElement["CODE"]);
//.........这里部分代码省略.........
示例12: __GetSectionList
protected function __GetSectionList($intIBlockID, $intProductID)
{
$mxResult = false;
$intIBlockID = intval($intIBlockID);
$intProductID = intval($intProductID);
if (0 < $intIBlockID && 0 < $intProductID) {
$mxResult = array();
$rsSections = CIBlockElement::GetElementGroups($intProductID, true);
while ($arSection = $rsSections->Fetch()) {
$mxResult[] = intval($arSection['ID']);
if (0 < intval($arSection['IBLOCK_SECTION_ID'])) {
$rsParents = CIBlockSection::GetNavChain($intIBlockID, $arSection['ID']);
while ($arParent = $rsParents->Fetch()) {
$mxResult[] = intval($arParent["ID"]);
}
}
}
if (!empty($mxResult)) {
$mxResult = array_values(array_unique($mxResult));
sort($mxResult);
}
}
return $mxResult;
}
示例13: SetProductSectionsCache
public static function SetProductSectionsCache($arItemIDs)
{
if (empty($arItemIDs) || !is_array($arItemIDs)) {
return;
}
CatalogClearArray($arItemIDs);
if (empty($arItemIDs)) {
return;
}
if (empty(self::$arCacheProductSections)) {
self::$arCacheProductSections = array_fill_keys($arItemIDs, array());
} else {
foreach ($arItemIDs as &$intOneID) {
self::$arCacheProductSections[$intOneID] = array();
}
unset($intOneID);
}
$rsSections = CIBlockElement::GetElementGroups($arItemIDs, true, array("ID", "IBLOCK_SECTION_ID", "IBLOCK_ELEMENT_ID"));
while ($arSection = $rsSections->Fetch()) {
$arSection['ID'] = (int) $arSection['ID'];
$arSection['IBLOCK_SECTION_ID'] = (int) $arSection['IBLOCK_SECTION_ID'];
$arSection['IBLOCK_ELEMENT_ID'] = (int) $arSection['IBLOCK_ELEMENT_ID'];
self::$arCacheProductSections[$arSection['IBLOCK_ELEMENT_ID']][] = $arSection;
}
unset($arSection, $rsSections);
}
示例14: basket_items
//.........这里部分代码省略.........
$arResult["VAT_SUM"] += roundEx($arItem["VAT_VALUE"] * $arItem["QUANTITY"], SALE_VALUE_PRECISION);
}
$arItem["PRICE_FORMATED"] = SaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
$arItem["WEIGHT_FORMATED"] = roundEx(DoubleVal($arItem["WEIGHT"]/$arResult["WEIGHT_KOEF"]), SALE_WEIGHT_PRECISION)." ".$arResult["WEIGHT_UNIT"];
if($arItem["DISCOUNT_PRICE"] > 0)
{
$arItem["DISCOUNT_PRICE_PERCENT"] = $arItem["DISCOUNT_PRICE"]*100 / ($arItem["DISCOUNT_PRICE"] + $arItem["PRICE"]);
$arItem["DISCOUNT_PRICE_PERCENT_FORMATED"] = roundEx($arItem["DISCOUNT_PRICE_PERCENT"], 0)."%";
}
$arItem["PROPS"] = Array();
$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "ID" => "ASC"), Array("BASKET_ID" => $arItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
while($arProp = $dbProp -> GetNext())
{
if (array_key_exists('BASKET_ID', $arProp))
{
unset($arProp['BASKET_ID']);
}
if (array_key_exists('~BASKET_ID', $arProp))
{
unset($arProp['~BASKET_ID']);
}
$arProp = array_filter($arProp, array("CSaleBasketHelper", "filterFields"));
$arItem["PROPS"][] = $arProp;
}
if (!CSaleBasketHelper::isSetItem($arItem))
{
$DISCOUNT_PRICE_ALL += $arItem["DISCOUNT_PRICE"] * $arItem["QUANTITY"];
$arItem["DISCOUNT_PRICE"] = roundEx($arItem["DISCOUNT_PRICE"], SALE_VALUE_PRECISION);
$arResult["ORDER_PRICE"] += $arItem["PRICE"] * $arItem["QUANTITY"];
}
$arResult["ORDER_WEIGHT"] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
if (CSaleBasketHelper::isSetItem($arItem))
$arSetParentWeight[$arItem["SET_PARENT_ID"]] += $arItem["WEIGHT"] * $arItem['QUANTITY'];
//get product section
$db_groups = CIBlockElement::GetElementGroups($arItem["PRODUCT_ID"], true);
while($ar_group = $db_groups->Fetch())
$arItem["IBLOCK_SECTION_ID"][] = $ar_group["ID"];
if(!$arItem["IBLOCK_SECTION_ID"]){
$arItem["PARENT"] = CCatalogSku::GetProductInfo(
$arItem["PRODUCT_ID"]
);
$db_groups = CIBlockElement::GetElementGroups($arItem["PARENT"]["ID"], true);
while($ar_group = $db_groups->Fetch())
$arItem["IBLOCK_SECTION_ID"][] = $ar_group["ID"];
}
if($arItem["IBLOCK_SECTION_ID"]){
foreach($arItem["IBLOCK_SECTION_ID"] as $section){
$res_1 = CIBlockSection::GetByID($section);
if($ar_res_1 = $res_1->GetNext()){
$arItem["SECTION_NAME"][] = $ar_res_1["NAME"];
}
}
}
$arResult["BASKET_ITEMS"][] = $arItem;
}
$arResult["PRICE_WITHOUT_DISCOUNT"] = SaleFormatCurrency($arResult["ORDER_PRICE"] + $DISCOUNT_PRICE_ALL, $allCurrency);
// count weight for set parent products
foreach ($arResult["BASKET_ITEMS"] as &$arItem)
{
if (CSaleBasketHelper::isSetParent($arItem))
{
$arItem["WEIGHT"] = $arSetParentWeight[$arItem["ID"]] / $arItem["QUANTITY"];
$arItem["WEIGHT_FORMATED"] = roundEx(doubleval($arItem["WEIGHT"] / $arResult["WEIGHT_KOEF"]), SALE_WEIGHT_PRECISION)." ".$arResult["WEIGHT_UNIT"];
}
}
$arResult["ORDER_WEIGHT_FORMATED"] = roundEx(DoubleVal($arResult["ORDER_WEIGHT"]/$arResult["WEIGHT_KOEF"]), SALE_WEIGHT_PRECISION)." ".$arResult["WEIGHT_UNIT"];
$arResult["ORDER_PRICE_FORMATED"] = SaleFormatCurrency($arResult["ORDER_PRICE"], $arResult["BASE_LANG_CURRENCY"]);
$arResult["VAT_SUM_FORMATED"] = SaleFormatCurrency($arResult["VAT_SUM"], $arResult["BASE_LANG_CURRENCY"]);
$arElementId[] = $arItem["PRODUCT_ID"];
if ($bUseCatalog)
{
$arParent = CCatalogSku::GetProductInfo($arItem["PRODUCT_ID"]);
if ($arParent)
{
$arElementId[] = $arParent["ID"];
$arSku2Parent[$arItem["PRODUCT_ID"]] = $arParent["ID"];
}
}
unset($arItem);
}
return $arResult["BASKET_ITEMS"];
}
示例15: array
foreach ($arResult["DOCUMENT"]["FIELDS"] as $k => $v)
${"str_".$k} = $v;
}
else
{
$result = CIBlockElement::GetByID($WF_ID);
if($arElement = $result->ExtractFields("str_"))
{
if($str_IN_SECTIONS=="N")
{
$str_IBLOCK_ELEMENT_SECTION[] = 0;
}
else
{
$result = CIBlockElement::GetElementGroups($WF_ID, true, array('ID', 'IBLOCK_ELEMENT_ID'));
while($ar = $result->Fetch())
$str_IBLOCK_ELEMENT_SECTION[] = $ar["ID"];
}
$ipropTemlates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($IBLOCK_ID, $WF_ID);
}
else
{
$WF_ID=0;
$ID=0;
if(is_array($IBLOCK_SECTION_ID))
{
foreach($IBLOCK_SECTION_ID as $id)
if($id > 0)
$str_IBLOCK_ELEMENT_SECTION[] = $id;
}