当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockElement::RecalcSections方法代码示例

本文整理汇总了PHP中CIBlockElement::RecalcSections方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::RecalcSections方法的具体用法?PHP CIBlockElement::RecalcSections怎么用?PHP CIBlockElement::RecalcSections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlockElement的用法示例。


在下文中一共展示了CIBlockElement::RecalcSections方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SetPropertyValues

 function SetPropertyValues($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $PROPERTY_CODE = false)
 {
     global $DB;
     $ELEMENT_ID = intVal($ELEMENT_ID);
     if (!is_array($PROPERTY_VALUES)) {
         $PROPERTY_VALUES = array($PROPERTY_VALUES);
     }
     $arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "N");
     if ($PROPERTY_CODE !== false) {
         if (IntVal($PROPERTY_CODE) > 0) {
             $arFilter["ID"] = IntVal($PROPERTY_CODE);
         } else {
             $arFilter["CODE"] = $PROPERTY_CODE;
         }
     } else {
         $arFilter["ACTIVE"] = "Y";
     }
     $uniq_flt = md5(serialize($arFilter));
     global $BX_IBLOCK_PROP_CACHE;
     if (!is_set($BX_IBLOCK_PROP_CACHE, $IBLOCK_ID)) {
         $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID] = array();
     }
     if (is_set($BX_IBLOCK_PROP_CACHE[$IBLOCK_ID], $uniq_flt)) {
         $ar_prop =& $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt];
     } else {
         $db_prop = CIBlockProperty::GetList(array(), $arFilter);
         $ar_prop = array();
         while ($prop = $db_prop->Fetch()) {
             $ar_prop[] = $prop;
         }
         $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt] =& $ar_prop;
     }
     Reset($ar_prop);
     $bRecalcSections = false;
     $arPROP_ID = array_keys($PROPERTY_VALUES);
     $cacheValues = false;
     if (count($ar_prop) > 1) {
         $cacheValues = array();
         $strSql = "SELECT ep.ID, ep.VALUE, ep.IBLOCK_PROPERTY_ID " . "FROM b_iblock_element_property ep, b_iblock_property p " . "WHERE ep.IBLOCK_ELEMENT_ID=" . $ELEMENT_ID . "\tAND ep.IBLOCK_PROPERTY_ID = p.ID " . "\tAND p.PROPERTY_TYPE <> 'L' " . "\tAND p.PROPERTY_TYPE <> 'G' ";
         $db_res = $DB->Query($strSql);
         while ($res = $db_res->Fetch()) {
             if (!isset($cacheValues[$res["IBLOCK_PROPERTY_ID"]])) {
                 $cacheValues[$res["IBLOCK_PROPERTY_ID"]] = array();
             }
             $cacheValues[$res["IBLOCK_PROPERTY_ID"]][] = $res;
         }
     }
     $ids = "0";
     foreach ($ar_prop as $prop) {
         if ($PROPERTY_CODE) {
             $PROP = $PROPERTY_VALUES;
         } else {
             if (strlen($prop["CODE"]) > 0 && in_array($prop["CODE"], $arPROP_ID, TRUE)) {
                 $PROP = $PROPERTY_VALUES[$prop["CODE"]];
             } else {
                 $PROP = $PROPERTY_VALUES[$prop["ID"]];
             }
         }
         if ($prop["PROPERTY_TYPE"] == "F") {
             if (!is_array($PROP) || is_array($PROP) && (is_set($PROP, "tmp_name") || is_set($PROP, "del")) || count($PROP) == 2 && is_set($PROP, "VALUE") && is_set($PROP, "DESCRIPTION")) {
                 $PROP = array($PROP);
             }
         } elseif (!is_array($PROP) || count($PROP) == 2 && is_set($PROP, "VALUE") && is_set($PROP, "DESCRIPTION")) {
             $PROP = array($PROP);
         }
         if ($prop["USER_TYPE"] != "") {
             $arUserType = CIBlockProperty::GetUserType($prop["USER_TYPE"]);
             if (array_key_exists("ConvertToDB", $arUserType)) {
                 foreach ($PROP as $key => $value) {
                     if (!is_array($value)) {
                         $value = array("VALUE" => $value);
                     } elseif (!array_key_exists("VALUE", $value)) {
                         $value = array("VALUE" => $value);
                     }
                     $PROP[$key] = call_user_func_array($arUserType["ConvertToDB"], array($prop, $value));
                 }
             }
         }
         if ($prop["VERSION"] == 2) {
             if ($prop["MULTIPLE"] == "Y") {
                 $strTable = "b_iblock_element_prop_m" . $prop["IBLOCK_ID"];
             } else {
                 $strTable = "b_iblock_element_prop_s" . $prop["IBLOCK_ID"];
             }
         } else {
             $strTable = "b_iblock_element_property";
         }
         if ($prop["PROPERTY_TYPE"] == "L") {
             $DB->Query(CIBLockElement::DeletePropertySQL($prop, $ELEMENT_ID), false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             if ($prop["VERSION"] == 2 && $prop["MULTIPLE"] == "Y") {
                 $strSql = "\n\t\t\t\t\t\tUPDATE\tb_iblock_element_prop_s" . $prop["IBLOCK_ID"] . "\n\t\t\t\t\t\tSET\tPROPERTY_" . $prop["ID"] . "=NULL, DESCRIPTION_" . $prop["ID"] . "=NULL\n\t\t\t\t\t\tWHERE\tIBLOCK_ELEMENT_ID=" . $ELEMENT_ID . "\n\t\t\t\t\t";
                 $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             }
             $ids = "0";
             foreach ($PROP as $key => $value) {
                 if (is_array($value)) {
                     $value = $value["VALUE"];
                 }
                 if (IntVal($value) <= 0) {
                     continue;
//.........这里部分代码省略.........
开发者ID:spas-viktor,项目名称:books,代码行数:101,代码来源:iblockelement.php

示例2: SetElementSection

 function SetElementSection($ID, $arSections, $bNew = false, $bRightsIBlock = 0, $sectionId = null)
 {
     global $DB;
     $ID = intval($ID);
     $min_old_id = null;
     $min_new_id = null;
     $arToDelete = array();
     $arToInsert = array();
     if (is_array($arSections)) {
         foreach ($arSections as $section_id) {
             $section_id = intval($section_id);
             if ($section_id > 0) {
                 if (!isset($min_new_id) || $section_id < $min_new_id) {
                     $min_new_id = $section_id;
                 }
                 $arToInsert[$section_id] = $section_id;
             }
         }
     } else {
         $section_id = intval($arSections);
         if ($section_id > 0) {
             $arToInsert[$section_id] = $section_id;
             $min_new_id = $section_id;
         }
     }
     $arOldParents = array();
     $arNewParents = $arToInsert;
     $bParentsChanged = false;
     //Read database
     if (!$bNew) {
         $rs = $DB->Query("\n\t\t\t\tSELECT * FROM b_iblock_section_element\n\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ID . "\n\t\t\t\tAND ADDITIONAL_PROPERTY_ID IS NULL\n\t\t\t", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         while ($ar = $rs->Fetch()) {
             $section_id = intval($ar["IBLOCK_SECTION_ID"]);
             $arOldParents[] = $section_id;
             if (!isset($min_old_id) || $section_id < $min_old_id) {
                 $min_old_id = $section_id;
             }
             if (isset($arToInsert[$section_id])) {
                 unset($arToInsert[$section_id]);
                 //This already in DB
             } else {
                 $arToDelete[] = $section_id;
             }
         }
         if (!empty($arToDelete)) {
             $bParentsChanged = true;
             $DB->Query($s = "\n\t\t\t\t\tDELETE FROM b_iblock_section_element\n\t\t\t\t\tWHERE IBLOCK_ELEMENT_ID = " . $ID . "\n\t\t\t\t\tAND ADDITIONAL_PROPERTY_ID IS NULL\n\t\t\t\t\tAND IBLOCK_SECTION_ID in (" . implode(", ", $arToDelete) . ")\n\t\t\t\t", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             //And this should be deleted
         }
     }
     if (!empty($arToInsert)) {
         $bParentsChanged = true;
         $DB->Query("\n\t\t\t\tINSERT INTO b_iblock_section_element(IBLOCK_SECTION_ID, IBLOCK_ELEMENT_ID)\n\t\t\t\tSELECT S.ID, E.ID\n\t\t\t\tFROM b_iblock_section S, b_iblock_element E\n\t\t\t\tWHERE S.IBLOCK_ID = E.IBLOCK_ID\n\t\t\t\tAND S.ID IN (" . implode(", ", $arToInsert) . ")\n\t\t\t\tAND E.ID = " . $ID . "\n\t\t\t");
     }
     if ($bParentsChanged && $bRightsIBlock) {
         $obElementRights = new CIBlockElementRights($bRightsIBlock, $ID);
         if (empty($arOldParents)) {
             $arOldParents[] = 0;
         }
         if (empty($arNewParents)) {
             $arNewParents[] = 0;
         }
         $obElementRights->ChangeParents($arOldParents, $arNewParents);
     }
     if ($sectionId !== null || $min_old_id !== $min_new_id) {
         CIBlockElement::RecalcSections($ID, $sectionId);
     }
     return !empty($arToDelete) || !empty($arToInsert);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:69,代码来源:iblockelement.php

示例3: SetPropertyValues

 function SetPropertyValues($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $PROPERTY_CODE = false)
 {
     global $DB;
     global $BX_IBLOCK_PROP_CACHE;
     $ELEMENT_ID = (int) $ELEMENT_ID;
     $IBLOCK_ID = (int) $IBLOCK_ID;
     if (!is_array($PROPERTY_VALUES)) {
         $PROPERTY_VALUES = array($PROPERTY_VALUES);
     }
     $uniq_flt = $IBLOCK_ID;
     $arFilter = array("IBLOCK_ID" => $IBLOCK_ID, "CHECK_PERMISSIONS" => "N");
     if ($PROPERTY_CODE === false) {
         $arFilter["ACTIVE"] = "Y";
         $uniq_flt .= "|ACTIVE:" . $arFilter["ACTIVE"];
     } elseif ((int) $PROPERTY_CODE > 0) {
         $arFilter["ID"] = (int) $PROPERTY_CODE;
         $uniq_flt .= "|ID:" . $arFilter["ID"];
     } else {
         $arFilter["CODE"] = $PROPERTY_CODE;
         $uniq_flt .= "|CODE:" . $arFilter["CODE"];
     }
     if (!isset($BX_IBLOCK_PROP_CACHE[$IBLOCK_ID])) {
         $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID] = array();
     }
     if (!isset($BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt])) {
         $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt] = array();
         $db_prop = CIBlockProperty::GetList(array(), $arFilter);
         while ($prop = $db_prop->Fetch()) {
             $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt][$prop["ID"]] = $prop;
         }
         unset($prop);
         unset($db_prop);
     }
     $ar_prop =& $BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt];
     reset($ar_prop);
     $bRecalcSections = false;
     //Read current property values from database
     $arDBProps = array();
     if (CIBLock::GetArrayByID($IBLOCK_ID, "VERSION") == 2) {
         $rs = $DB->Query("\n\t\t\t\tselect *\n\t\t\t\tfrom b_iblock_element_prop_m" . $IBLOCK_ID . "\n\t\t\t\twhere IBLOCK_ELEMENT_ID = " . $ELEMENT_ID . "\n\t\t\t\torder by ID asc\n\t\t\t");
         while ($ar = $rs->Fetch()) {
             $property_id = $ar["IBLOCK_PROPERTY_ID"];
             if (!isset($arDBProps[$property_id])) {
                 $arDBProps[$property_id] = array();
             }
             $arDBProps[$property_id][$ar["ID"]] = $ar;
         }
         unset($ar);
         unset($rs);
         $rs = $DB->Query("\n\t\t\t\tselect *\n\t\t\t\tfrom b_iblock_element_prop_s" . $IBLOCK_ID . "\n\t\t\t\twhere IBLOCK_ELEMENT_ID = " . $ELEMENT_ID . "\n\t\t\t");
         if ($ar = $rs->Fetch()) {
             foreach ($ar_prop as $property) {
                 $property_id = $property["ID"];
                 if ($property["MULTIPLE"] == "N" && isset($ar["PROPERTY_" . $property_id]) && strlen($ar["PROPERTY_" . $property_id])) {
                     if (!isset($arDBProps[$property_id])) {
                         $arDBProps[$property_id] = array();
                     }
                     $arDBProps[$property_id][$ELEMENT_ID . ":" . $property_id] = array("ID" => $ELEMENT_ID . ":" . $property_id, "IBLOCK_PROPERTY_ID" => $property_id, "VALUE" => $ar["PROPERTY_" . $property_id], "DESCRIPTION" => $ar["DESCRIPTION_" . $property_id]);
                 }
             }
             if (isset($property)) {
                 unset($property);
             }
         }
         unset($ar);
         unset($rs);
     } else {
         $rs = $DB->Query("\n\t\t\t\tselect *\n\t\t\t\tfrom b_iblock_element_property\n\t\t\t\twhere IBLOCK_ELEMENT_ID = " . $ELEMENT_ID . "\n\t\t\t\torder by ID asc\n\t\t\t");
         while ($ar = $rs->Fetch()) {
             $property_id = $ar["IBLOCK_PROPERTY_ID"];
             if (!isset($arDBProps[$property_id])) {
                 $arDBProps[$property_id] = array();
             }
             $arDBProps[$property_id][$ar["ID"]] = $ar;
         }
         unset($ar);
         unset($rs);
     }
     foreach (GetModuleEvents("iblock", "OnIBlockElementSetPropertyValues", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $PROPERTY_CODE, $ar_prop, $arDBProps));
     }
     if (isset($arEvent)) {
         unset($arEvent);
     }
     $arFilesToDelete = array();
     $arV2ClearCache = array();
     foreach ($ar_prop as $prop) {
         if ($PROPERTY_CODE) {
             $PROP = $PROPERTY_VALUES;
         } else {
             if (strlen($prop["CODE"]) > 0 && array_key_exists($prop["CODE"], $PROPERTY_VALUES)) {
                 $PROP = $PROPERTY_VALUES[$prop["CODE"]];
             } else {
                 $PROP = $PROPERTY_VALUES[$prop["ID"]];
             }
         }
         if (!is_array($PROP) || $prop["PROPERTY_TYPE"] == "F" && (array_key_exists("tmp_name", $PROP) || array_key_exists("del", $PROP)) || count($PROP) == 2 && array_key_exists("VALUE", $PROP) && array_key_exists("DESCRIPTION", $PROP)) {
             $PROP = array($PROP);
         }
         if ($prop["USER_TYPE"] != "") {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockelement.php

示例4: array

								}
								$boolFlagClear = CIBlockOffersTmp::Delete($str_TMP_ID);
								$boolFlagClearAll = CIBlockOffersTmp::DeleteOldID($IBLOCK_ID);
							}
						}
					}

					if (!$res)
					{
						$strWarning .= $bs->LAST_ERROR."<br>";
					}
					else
					{
						$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($IBLOCK_ID, $ID);
						$ipropValues->clearValues();
						CIBlockElement::RecalcSections($ID);
					}

					if ('' == $strWarning && $bCatalog)
					{
						$arCatalogItem = array(
							'IBLOCK_ID' => $IBLOCK_ID,
							'SECTION_ID' => $MENU_SECTION_ID,
							'ID' => $ID,
							'PRODUCT_ID' => CIBlockElement::GetRealElement($ID)
						);
						if ($arShowTabs['catalog'])
						{
							include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/catalog/admin/templates/product_edit_action.php");
						}
						elseif ($arShowTabs['sku'])
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:iblock_element_edit.php

示例5: handleFile

 function handleFile($hash, $photo, &$package, &$upload, &$error)
 {
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     global $USER;
     $arParams = $this->arParams;
     if (!($upload["SECTION_ID"] > 0)) {
         if ($this->post["photo_album_id"] > 0) {
             $upload["SECTION_ID"] = $this->post["photo_album_id"];
         } else {
             $upload["NEW_SECTION_ID"] = $upload["SECTION_ID"] = self::createAlbum($this->arParams, $this->arResult, $this->post["new_album_name"]);
         }
         $this->arParams["SECTION_ID"] = $upload["SECTION_ID"];
         $upload["redirectUrl"] = CComponentEngine::MakePathFromTemplate($this->arParams["~SECTION_URL"], array("USER_ALIAS" => $this->arParams["USER_ALIAS"], "SECTION_ID" => $this->arParams["SECTION_ID"]));
         self::adjustIBlock($this->arParams);
     }
     if (!($upload["SECTION_ID"] > 0)) {
         $error = "Album is not created or does not exist.";
         return false;
     }
     $arParams["bxu"]->checkCanvases($hash, $photo, $arParams['converters'], $this->arWatermark);
     // Props
     $_REQUEST["Public"] = $_REQUEST["Public"] == "N" ? "N" : "Y";
     $Prop = array("REAL_PICTURE" => array("n0" => $photo["files"]["default"]), "PUBLIC_ELEMENT" => array("n0" => $_REQUEST["Public"]), "APPROVE_ELEMENT" => array("n0" => ($arParams["ABS_PERMISSION"] >= "U" || $arParams["APPROVE_BY_DEFAULT"] == "Y") && $_REQUEST["Public"] == "Y" ? "Y" : "X"));
     foreach ($arParams['converters'] as $val) {
         if ($val['code'] != "default" && $val['code'] != "thumbnail") {
             $Prop[strtoupper($val['code'])] = array("n0" => $photo["files"][$val['code']]);
         }
     }
     // Real photo
     $arFields = array("ACTIVE" => $arParams["MODERATION"] == "Y" && $arParams["ABS_PERMISSION"] < "U" ? "N" : "Y", "MODIFIED_BY" => $USER->GetID(), "IBLOCK_SECTION" => $upload['SECTION_ID'], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "NAME" => $photo['name'], "CODE" => $photo['name'], "TAGS" => $photo['tags'], "DETAIL_TEXT" => $photo['description'], "DETAIL_TEXT_TYPE" => "text", "PREVIEW_PICTURE" => $photo["files"]["thumbnail"], "PREVIEW_TEXT" => $photo['description'], "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => $Prop);
     $bs = new CIBlockElement();
     $ID = $bs->Add($arFields);
     if ($ID <= 0) {
         $error = $bs->LAST_ERROR;
         return false;
     }
     $arFields['ID'] = $ID;
     $_SESSION['arUploadedPhotos'][] = $ID;
     CIBlockElement::RecalcSections($ID);
     $arParams['SECTION_ID'] = $upload['SECTION_ID'];
     $arResult = $this->arResult;
     foreach (GetModuleEvents("photogallery", "OnAfterUpload", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arFields, $arParams, $arResult));
     }
     // Add thumbnail only for new album
     if ($upload["NEW_SECTION_ID"] > 0 && !array_key_exists('NEW_SECTION_PICTURE', $upload)) {
         $File = $photo["files"]["default"];
         // Big picture
         $File['~tmp_name'] = $File['tmp_name'];
         $File['tmp_name'] .= "_album_cover.tmp";
         if (CFile::ResizeImageFile($File['tmp_name'], $File['tmp_name_1'], array('width' => $arParams["ALBUM_PHOTO_THUMBS"]["SIZE"], 'height' => $arParams["ALBUM_PHOTO_THUMBS"]["SIZE"]), BX_RESIZE_IMAGE_PROPORTIONAL)) {
             $bs = new CIBlockSection();
             if ($bs->Update($upload["SECTION_ID"], array("PICTURE" => $File), false, false)) {
                 $upload['NEW_SECTION_PICTURE'] = true;
             }
         }
     }
     return $ID;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:61,代码来源:functions.php

示例6: SaveEvent


//.........这里部分代码省略.........
                // It's ok, we successfuly save event to exchange calendar - and save it to DB
                $arFields['XML_ID'] = $exchRes['XML_ID'];
                $arFields['PROPERTY_VALUES']['BXDAVEX_LABEL'] = $exchRes['MODIFICATION_LABEL'];
            }
        }
        if ($bCalDav) {
            $connectionId = CECCalendar::GetCalDAVConnectionId($iblockId, $calendarId);
            if ($connectionId > 0) {
                $calendarCalDAVXmlId = CECCalendar::GetCalDAVXmlId($iblockId, $calendarId);
                if ($arParams['bNew']) {
                    $DAVRes = CDavGroupdavClientCalendar::DoAddItem($connectionId, $calendarCalDAVXmlId, $arFields);
                } else {
                    $eventCalDAVModLabel = CECEvent::GetCalDAVModLabel($iblockId, $arParams['id']);
                    $eventXmlId = CECEvent::GetExchangeXmlId($iblockId, $arParams['id']);
                    $DAVRes = CDavGroupdavClientCalendar::DoUpdateItem($connectionId, $calendarCalDAVXmlId, $eventXmlId, $eventCalDAVModLabel, $arFields);
                }
                if (!is_array($DAVRes) || !array_key_exists("XML_ID", $DAVRes)) {
                    return CEventCalendar::ThrowError(CEventCalendar::CollectCalDAVErros($DAVRes));
                }
                // // It's ok, we successfuly save event to caldav calendar - and save it to DB
                $arFields['XML_ID'] = $DAVRes['XML_ID'];
                $arFields['PROPERTY_VALUES']['BXDAVCD_LABEL'] = $DAVRes['MODIFICATION_LABEL'];
            }
        }
        $bs = new CIBlockElement();
        $res = false;
        if (!$arParams['bNew']) {
            $ID = $arParams['id'];
            if ($ID > 0) {
                $res = $bs->Update($ID, $arFields, false);
            }
        } else {
            //This sets appropriate owner if event created by owner of the meeting and this calendar belongs to guest which is not current user
            if ($ownerType == 'USER' && $ownerId > 0 && $userId != $ownerId) {
                $arFields['CREATED_BY'] = $ownerId;
            }
            $ID = $bs->Add($arFields, false);
            $res = $ID > 0;
        }
        if ($arParams['isMeeting'] && !$bIsInvitingEvent) {
            $this->CheckParentProperty($arParams['userIblockId'], $iblockId);
            $arGuestConfirm = $this->InviteGuests($ID, $arFields, $arParams['guests'], $arParams);
        }
        if (!$res) {
            return CEventCalendar::ThrowError('4' . $bs->LAST_ERROR);
        } else {
            CIBlockElement::RecalcSections($ID);
        }
        if (!$bPeriodic && !$arParams["notDisplayCalendar"]) {
            if ($arParams['bNew']) {
                ?>
<script>window._bx_new_event = {ID: <?php 
                echo $ID;
                ?>
, IBLOCK_ID: '<?php 
                echo $iblockId;
                ?>
', LOC: '<?php 
                echo CUtil::JSEscape($loc_new);
                ?>
', arGuestConfirm: <?php 
                echo CUtil::PhpToJSObject($arGuestConfirm);
                ?>
};</script><?php 
            } else {
                ?>
<script>window._bx_existent_event = {ID: <?php 
                echo intVal($ID);
                ?>
, NAME : '<?php 
                echo CUtil::JSEscape($arParams['name']);
                ?>
', DETAIL_TEXT: '<?php 
                echo CUtil::JSEscape($arParams['desc']);
                ?>
', DATE_FROM : '<?php 
                echo $arParams['dateFrom'];
                ?>
', DATE_TO : '<?php 
                echo $arParams['dateTo'];
                ?>
', LOC: '<?php 
                echo CUtil::JSEscape($loc_new);
                ?>
', arGuestConfirm: <?php 
                echo CUtil::PhpToJSObject($arGuestConfirm);
                ?>
};</script>
<?php 
            }
        }
        $this->ClearCache($this->cachePath . 'events/' . $iblockId . '/');
        if ($bSocNetLog && $ownerType) {
            CEventCalendar::SocNetLog(array('iblockId' => $iblockId, 'ownerType' => $ownerType, 'ownerId' => $ownerId, 'target' => $arParams['bNew'] ? 'add_event' : 'edit_event', 'id' => $ID, 'name' => $arParams['name'], 'desc' => $arParams['desc'], 'from' => $arParams['dateFrom'], 'to' => $arParams['dateTo'], 'calendarId' => $calendarId, 'accessibility' => $arParams["prop"]["ACCESSIBILITY"], 'importance' => $arParams["prop"]["IMPORTANCE"], 'pathToGroupCalendar' => $arParams["pathToGroupCalendar"], 'pathToUserCalendar' => $arParams["pathToUserCalendar"]));
        }
        if (array_key_exists("remind", $arParams)) {
            CECEvent::AddReminder(array('iblockId' => $iblockId, 'ownerType' => $ownerType, 'ownerId' => $ownerId, 'userId' => $userId, 'fullUrl' => $fullUrl, 'id' => $ID, 'dateFrom' => $arParams['dateFrom'], 'remind' => $arParams["remind"], 'bNew' => $arParams['bNew']));
        }
        return $ID;
    }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:event_calendar.php

示例7: handleFile


//.........这里部分代码省略.........
        } elseif ($Params['packageFields']['photo_watermark_use'] == 'Y') {
            $arWatermark = array('type' => $Params['packageFields']['photo_watermark_type'], 'text' => $Params['packageFields']['photo_watermark_text'], 'font' => $arParams['PATH_TO_FONT'], 'position' => $Params['packageFields']['photo_watermark_position'], 'color' => $Params['packageFields']['photo_watermark_color'], 'size' => $Params['packageFields']['photo_watermark_size'], 'fill' => 'resize', 'file' => $_SERVER["DOCUMENT_ROOT"] . $Params['packageFields']['photo_watermark_path'], 'alpha_level' => $Params['packageFields']['photo_watermark_opacity'], 'use_copyright' => $Params['packageFields']["photo_watermark_copyright"] == "Y" ? "Y" : "N");
        }
        if ($arWatermark) {
            // Add watermark here
            foreach ($arFiles as $i => $file) {
                if ($i == 1) {
                    // It's thumbnail skip it
                    continue;
                }
                $size = CFile::GetImageSize($file['tmp_name']);
                $type = $size[2];
                $sourceImage = CFile::CreateImage($file['tmp_name'], $type);
                if ($sourceImage) {
                    $res = CFile::Watermark($sourceImage, $arWatermark);
                    if (file_exists($file['tmp_name'])) {
                        unlink($file['tmp_name']);
                    }
                    switch ($type) {
                        case IMAGETYPE_GIF:
                            imagegif($sourceImage, $file['tmp_name']);
                            break;
                        case IMAGETYPE_PNG:
                            imagealphablending($sourceImage, false);
                            imagesavealpha($sourceImage, true);
                            imagepng($sourceImage, $file['tmp_name']);
                            break;
                        default:
                            if ($arSourceFileSizeTmp[2] == IMAGETYPE_BMP) {
                                $file['tmp_name'] .= ".jpg";
                            }
                            imagejpeg($sourceImage, $file['tmp_name'], 100);
                            break;
                    }
                    if ($sourceImage) {
                        imagedestroy($sourceImage);
                    }
                }
            }
        }
    }
    // Props
    $Prop = array();
    // Additional image copyies
    $ind = -1;
    foreach ($arParams['converters'] as $key => $val) {
        $ind++;
        if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") {
            continue;
        }
        $Prop[strtoupper($val['code'])] = array("n0" => $arFiles[$ind]);
    }
    $_REQUEST["Public"] = $_REQUEST["Public"] == "N" ? "N" : "Y";
    $Prop["PUBLIC_ELEMENT"] = array("n0" => $_REQUEST["Public"]);
    $Prop["APPROVE_ELEMENT"] = array("n0" => ($arParams["ABS_PERMISSION"] >= "U" || $arParams["APPROVE_BY_DEFAULT"] == "Y") && $_REQUEST["Public"] == "Y" ? "Y" : "X");
    // Real photo
    $Prop["REAL_PICTURE"] = array("n0" => $arFiles[0]);
    $arFields = array("ACTIVE" => $arParams["MODERATION"] == "Y" && $arParams["ABS_PERMISSION"] < "U" ? "N" : "Y", "MODIFIED_BY" => $USER->GetID(), "IBLOCK_SECTION" => $savedData['SECTION_ID'], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "NAME" => $Info['name'], "CODE" => $Info['name'], "TAGS" => $Info['tags'], "DETAIL_TEXT" => $Info['description'], "DETAIL_TEXT_TYPE" => "text", "PREVIEW_PICTURE" => $arFiles[1], "PREVIEW_TEXT" => $Info['description'], "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => $Prop);
    //$arFields["NAME"] = (!empty($arFields["NAME"]) ? $arFields["NAME"] : $File["REAL_PICTURE"]["name"]);
    //$arFields["DATE_CREATE"] = (intVal($arRealFile["ExifTimeStamp"]) > 0 ?
    //	ConvertTimeStamp($arRealFile["ExifTimeStamp"], "FULL") : $arFields["DATE_CREATE"]);
    $bs = new CIBlockElement();
    $ID = $bs->Add($arFields);
    if ($ID <= 0) {
        $strError = $bs->LAST_ERROR;
        $arErrors = array();
        $arTmp = explode("<br>", $strError);
        foreach ($arTmp as $er) {
            if (trim($er) != '' && !in_array($er, $arErrors)) {
                $arErrors[] = array("id" => "BXPH_FUNC_002", "text" => $er);
            }
        }
        CImageUploader::SaveError($arErrors);
    } else {
        $arFields['ID'] = $ID;
        $_SESSION['arUploadedPhotos'][] = $ID;
        CIBlockElement::RecalcSections($ID);
        $arParams['SECTION_ID'] = $savedData['SECTION_ID'];
        $arResult = $Params['~arResult'];
        $events = GetModuleEvents("photogallery", "OnAfterUpload");
        while ($arEvent = $events->Fetch()) {
            ExecuteModuleEventEx($arEvent, array(&$arFields, $arParams, $arResult));
        }
        // Add thumbnail only for new album
        if ($savedData['NEW_SECTION_NAME'] && !$savedData['NEW_SECTION_PICTURE']) {
            $File = $arFiles[0];
            // Big picture
            $File['tmp_name_1'] = $File['tmp_name'];
            $File['tmp_name'] = substr($File['tmp_name'], 0, strrpos($File['tmp_name'], ".")) . "_album_cover.tmp";
            if (CFile::ResizeImageFile($File['tmp_name_1'], $File['tmp_name'], array('width' => $arParams["ALBUM_PHOTO_THUMBS"]["SIZE"], 'height' => $arParams["ALBUM_PHOTO_THUMBS"]["SIZE"]), BX_RESIZE_IMAGE_PROPORTIONAL_ALT)) {
                $bs = new CIBlockSection();
                if ($bs->Update($savedData["SECTION_ID"], array("PICTURE" => $File), false, false)) {
                    $savedData['NEW_SECTION_PICTURE'] = true;
                    CImageUploader::SetSavedData($savedData);
                }
            }
        }
    }
    return $ID;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:functions.php

示例8: SetPropertyValues

	function SetPropertyValues($ELEMENT_ID, $IBLOCK_ID, $PROPERTY_VALUES, $PROPERTY_CODE = false)
	{
		global $DB;
		global $BX_IBLOCK_PROP_CACHE;

		$ELEMENT_ID = intVal($ELEMENT_ID);
		$IBLOCK_ID = intval($IBLOCK_ID);

		if (!is_array($PROPERTY_VALUES))
			$PROPERTY_VALUES = array($PROPERTY_VALUES);

		$uniq_flt = $IBLOCK_ID;
		$arFilter = array(
			"IBLOCK_ID" => $IBLOCK_ID,
			"CHECK_PERMISSIONS" => "N",
		);

		if ($PROPERTY_CODE === false)
		{
			$arFilter["ACTIVE"] = "Y";
			$uniq_flt .= "|ACTIVE:".$arFilter["ACTIVE"];
		}
		elseif(intval($PROPERTY_CODE) > 0)
		{
			$arFilter["ID"] = intval($PROPERTY_CODE);
			$uniq_flt .= "|ID:".$arFilter["ID"];
		}
		else
		{
			$arFilter["CODE"] = $PROPERTY_CODE;
			$uniq_flt .= "|CODE:".$arFilter["CODE"];
		}

		if (!isset($BX_IBLOCK_PROP_CACHE[$IBLOCK_ID]))
			$BX_IBLOCK_PROP_CACHE[$IBLOCK_ID] = array();

		if (!isset($BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt]))
		{
			$BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt] = array();

			$db_prop = CIBlockProperty::GetList(array(), $arFilter);
			while($prop = $db_prop->Fetch())
			{
				$BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt][] = $prop;
			}
		}

		$ar_prop = &$BX_IBLOCK_PROP_CACHE[$IBLOCK_ID][$uniq_flt];
		reset($ar_prop);

		$bRecalcSections = false;

		//Read current property values from database
		$arDBProps = array();
		if (CIBLock::GetArrayByID($IBLOCK_ID, "VERSION") == 2)
		{
			$rs = $DB->Query("
				select *
				from b_iblock_element_prop_m".$IBLOCK_ID."
				where IBLOCK_ELEMENT_ID = ".$ELEMENT_ID."
				order by ID asc
			");
			while ($ar = $rs->Fetch())
			{
				$property_id = $ar["IBLOCK_PROPERTY_ID"];
				if (!isset($arDBProps[$property_id]))
					$arDBProps[$property_id] = array();

				$arDBProps[$property_id][$ar["ID"]] = $ar;
			}

			$rs = $DB->Query("
				select *
				from b_iblock_element_prop_s".$IBLOCK_ID."
				where IBLOCK_ELEMENT_ID = ".$ELEMENT_ID."
			");
			if ($ar = $rs->Fetch())
			{
				foreach($ar_prop as $property)
				{
					$property_id = $property["ID"];
					if(
						$property["MULTIPLE"] == "N"
						&& isset($ar["PROPERTY_".$property_id])
						&& strlen($ar["PROPERTY_".$property_id])
					)
					{
						if (!isset($arDBProps[$property_id]))
							$arDBProps[$property_id] = array();

						$arDBProps[$property_id][$pr["ID"]] = array(
							"ID" => $ELEMENT_ID.":".$property_id,
							"IBLOCK_PROPERTY_ID" => $property_id,
							"VALUE" => $ar["PROPERTY_".$property_id],
							"DESCRIPTION" => $ar["DESCRIPTION_".$property_id],
						);
					}
				}
			}
		}
//.........这里部分代码省略.........
开发者ID:nycmic,项目名称:bittest,代码行数:101,代码来源:iblockelement.php

示例9: UpdateDocument

 /**
  * Метод изменяет свойства (поля) указанного документа на указанные значения.
  *
  * @param string $documentId - код документа.
  * @param array $arFields - массив новых значений свойств документа в виде array(код_свойства => значение, ...). Коды свойств соответствуют кодам свойств, возвращаемым методом GetDocumentFields.
  */
 public function UpdateDocument($documentId, $arFields)
 {
     $documentId = intval($documentId);
     if ($documentId <= 0) {
         throw new CBPArgumentNullException("documentId");
     }
     CIBlockElement::WF_CleanUpHistoryCopies($documentId, 0);
     $db = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y"), false, false, array("ID", "IBLOCK_ID"));
     $ar = $db->Fetch();
     if (!$ar) {
         throw new Exception("Task is not found");
     }
     $arFields["PROPERTY_VALUES"] = array();
     $arKeys = array_keys($arFields);
     foreach ($arKeys as $key) {
         if (substr($key, 0, strlen("PROPERTY_")) == "PROPERTY_") {
             $arFields["PROPERTY_VALUES"][substr($key, strlen("PROPERTY_"))] = $arFields[$key];
         }
     }
     $iblockElementObject = new CIBlockElement();
     if (count($arFields["PROPERTY_VALUES"]) > 0) {
         $iblockElementObject->SetPropertyValuesEx($documentId, $ar["IBLOCK_ID"], $arFields["PROPERTY_VALUES"]);
     }
     unset($arFields["PROPERTY_VALUES"]);
     $res = $iblockElementObject->Update($documentId, $arFields);
     if (!$res) {
         throw new Exception($iblockElement->LAST_ERROR);
     }
     CIBlockElement::RecalcSections($documentId);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:tasks_document.php


注:本文中的CIBlockElement::RecalcSections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。