本文整理汇总了PHP中CIBlockElement::GetProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::GetProperty方法的具体用法?PHP CIBlockElement::GetProperty怎么用?PHP CIBlockElement::GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::GetProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetProductInfo
public static function GetProductInfo($intOfferID, $intIBlockID = 0)
{
$intOfferID = (int) $intOfferID;
if ($intOfferID <= 0) {
return false;
}
$intIBlockID = (int) $intIBlockID;
if ($intIBlockID <= 0) {
$intIBlockID = (int) CIBlockElement::GetIBlockByID($intOfferID);
}
if ($intIBlockID <= 0) {
return false;
}
if (!isset(self::$arOfferCache[$intIBlockID])) {
$arSkuInfo = CCatalogSKU::GetInfoByOfferIBlock($intIBlockID);
} else {
$arSkuInfo = self::$arOfferCache[$intIBlockID];
}
if (empty($arSkuInfo) || empty($arSkuInfo['SKU_PROPERTY_ID'])) {
return false;
}
$rsItems = CIBlockElement::GetProperty($intIBlockID, $intOfferID, array(), array('ID' => $arSkuInfo['SKU_PROPERTY_ID']));
if ($arItem = $rsItems->Fetch()) {
$arItem['VALUE'] = (int) $arItem['VALUE'];
if ($arItem['VALUE'] > 0) {
return array('ID' => $arItem['VALUE'], 'IBLOCK_ID' => $arSkuInfo['PRODUCT_IBLOCK_ID'], 'OFFER_IBLOCK_ID' => $intIBlockID, 'SKU_PROPERTY_ID' => $arSkuInfo['SKU_PROPERTY_ID']);
}
}
return false;
}
示例2: GetProductInfo
public function GetProductInfo($intOfferID, $intIBlockID = 0)
{
$intOfferID = intval($intOfferID);
if (0 >= $intOfferID) {
return false;
}
$intIBlockID = intval($intIBlockID);
if (0 >= $intIBlockID) {
$rsItems = CIBlockElement::GetList(array(), array("ID" => $intOfferID, "SHOW_HISTORY" => "Y"), false, false, array('ID', 'IBLOCK_ID'));
if ($arItem = $rsItems->Fetch()) {
$intIBlockID = intval($arItem['IBLOCK_ID']);
}
}
if (0 >= $intIBlockID) {
return false;
}
$arSkuInfo = CCatalogSKU::GetInfoByOfferIBlock($intIBlockID);
if (empty($arSkuInfo) || empty($arSkuInfo['SKU_PROPERTY_ID'])) {
return false;
}
$rsItems = CIBlockElement::GetProperty($intIBlockID, $intOfferID, array(), array('ID' => $arSkuInfo['SKU_PROPERTY_ID']));
if ($arItem = $rsItems->Fetch()) {
$arItem['VALUE'] = intval($arItem['VALUE']);
if (0 < $arItem['VALUE']) {
return array('ID' => $arItem['VALUE'], 'IBLOCK_ID' => $arSkuInfo['PRODUCT_IBLOCK_ID']);
}
}
return false;
}
示例3: Add
public static function Add($arFields)
{
$dbRes = CIBlockElement::GetProperty($arFields['IBLOCK_ID'], $arFields['ID'], array(), array('CODE' => 'OWSHIDDENVERSION'));
if ($arRes = $dbRes->Fetch()) {
return $GLOBALS['DB']->Insert('b_intranet_sharepoint_log', array('IBLOCK_ID' => "'" . intval($arFields['IBLOCK_ID']) . "'", 'ELEMENT_ID' => "'" . intval($arFields['ID']) . "'", 'VERSION' => "'" . intval($arRes['VALUE']) . "'"), "", false, "", true);
}
}
示例4: Execute
public function Execute()
{
if (!CModule::IncludeModule("forum")) {
return CBPActivityExecutionStatus::Closed;
}
if (!CModule::IncludeModule("iblock")) {
return CBPActivityExecutionStatus::Closed;
}
$forumId = intval($this->ForumId);
if ($forumId <= 0) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$iblockId = $this->IBlockId;
$dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
$arResult = $dbResult->Fetch();
if (!$arResult) {
$obProperty = new CIBlockProperty();
$obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum topic", "CODE" => "FORUM_TOPIC_ID"));
$obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum message count", "CODE" => "FORUM_MESSAGE_CNT"));
$dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
$arResult = $dbResult->Fetch();
}
$forumTopicId = intval($arResult["VALUE"]);
$arForumUserTmp = $this->ForumUser;
$arForumUser = CBPHelper::ExtractUsers($arForumUserTmp, $documentId, true);
$forumUserId = 1;
$forumUserName = "Admin";
if ($arForumUser != null) {
$forumUserId = $arForumUser;
$dbResult = CUser::GetByID($forumUserId);
if ($arResult = $dbResult->Fetch()) {
$forumUserName = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arResult, true);
}
}
$newTopic = "N";
if ($forumTopicId <= 0) {
$documentService = $this->workflow->GetService("DocumentService");
$document = $documentService->GetDocument($documentId);
$newTopic = "Y";
$arFields = array("TITLE" => $document["NAME"], "FORUM_ID" => $forumId, "USER_START_ID" => $forumUserId, "USER_START_NAME" => $forumUserName, "LAST_POSTER_NAME" => $forumUserName, "APPROVED" => "Y");
$forumTopicId = CForumTopic::Add($arFields);
CIBlockElement::SetPropertyValues($documentId[2], $iblockId, $forumTopicId, "FORUM_TOPIC_ID");
}
$arFields = array("POST_MESSAGE" => $this->ForumPostMessage, "AUTHOR_ID" => $forumUserId, "AUTHOR_NAME" => $forumUserName, "FORUM_ID" => $forumId, "TOPIC_ID" => $forumTopicId, "APPROVED" => "Y", "NEW_TOPIC" => $newTopic, "PARAM2" => $documentId[2]);
$forumMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
return CBPActivityExecutionStatus::Closed;
}
示例5: BeforeIndexHandler
public static function BeforeIndexHandler($arFields)
{
if ($arFields['MODULE_ID'] == 'iblock' && $arFields['PARAM2'] == NEWS_ID && !empty($arFields['ITEM_ID']) && \Bitrix\Main\Loader::includeModule('iblock')) {
$db = CIBlockElement::GetProperty($arFields['PARAM2'], $arFields['ITEM_ID'], array(), array('CODE' => 'TAGS'));
while ($row = $db->Fetch()) {
if (is_array($row['VALUE'])) {
foreach ($row['VALUE'] as $val) {
$arFields['BODY'] .= 'tag_search_' . $val;
}
} else {
$arFields['BODY'] .= 'tag_search_' . $row['VALUE'];
}
}
}
return $arFields;
}
示例6: GetProductSkuProps
static function GetProductSkuProps($ID, $IBLOCK_ID = '')
{
$arSkuProps = array();
if (CModule::IncludeModule('iblock') && CModule::IncludeModule('catalog'))
{
$res = CIBlockElement::GetList(
array(),
array(
"ID" => $ID,
"ACTIVE" => "Y",
),
false,
false,
array(
"ID",
"IBLOCK_ID",
)
);
$arElement = $res->Fetch();
if ($arElement)
{
$IBLOCK_ID = $arElement["IBLOCK_ID"];
$arParent = CCatalogSku::GetProductInfo($ID);
if ($arParent)
{
$rsOffers = CIBlockElement::GetProperty(
$IBLOCK_ID,
$ID
);
while ($arOffer = $rsOffers->GetNext())
{
if ($arOffer["XML_ID"] != "CML2_LINK")
{
if ($arOffer["PROPERTY_TYPE"] == "L")
$arSkuProps[$arOffer["NAME"]] = $arOffer["VALUE_ENUM"];
else
$arSkuProps[$arOffer["NAME"]] = $arOffer["VALUE"];
}
}
}
}
}
return $arSkuProps;
}
示例7: BeforeIndexHandler
function BeforeIndexHandler($arFields)
{
if (!CModule::IncludeModule("iblock")) {
return $arFields;
}
if ($arFields["MODULE_ID"] == "iblock") {
if ($arFields["PARAM2"] == IBLOCK_ID_CATALOG) {
$db_props = CIBlockElement::GetProperty($arFields["PARAM2"], $arFields["ITEM_ID"], array("sort" => "asc"), array("CODE" => "CML2_ARTICLE"));
if ($ar_props = $db_props->Fetch()) {
$arFields["TITLE"] .= " @" . $ar_props["VALUE"];
}
$db_props2 = CIBlockElement::GetProperty($arFields["PARAM2"], $arFields["ITEM_ID"], array("sort" => "asc"), array("CODE" => "KOD2"));
if ($ar_props2 = $db_props2->Fetch()) {
$arFields["TITLE"] .= " @" . $ar_props2["VALUE"];
}
}
}
return $arFields;
}
示例8: __construct
function __construct($id)
{
$arSelect = array("ID", "NAME", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO", "PREVIEW_TEXT", "PREVIEW_PICTURE", "PROPERTY_STEP", "PROPERTY_START_RATE", "PROPERTY_RATE_HISTORY", "PROPERTY_WINNER", "DETAIL_PAGE_URL");
$arFilter = array("IBLOCK_TYPE" => self::getIBType(), "IBLOCK_CODE" => self::getIBPointsTable(), "ACTIVE" => "Y", "ID" => $id);
$res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
if ($arRes = $res->GetNext()) {
//print_r($arFilter);
$img = CFile::GetFileArray($arRes["PREVIEW_PICTURE"]);
$this->id = $arRes["ID"];
$this->name = $arRes["NAME"];
$this->rate_history = array_filter(explode(";", $arRes["PROPERTY_RATE_HISTORY_VALUE"]));
$this->start_rate = $arRes["PROPERTY_START_RATE_VALUE"];
$this->step = $arRes["PROPERTY_STEP_VALUE"];
$this->description = $arRes["PREVIEW_TEXT"];
$this->picture = $img["SRC"];
$this->start_time = $arRes["DATE_ACTIVE_FROM"];
$this->finish_time = $arRes["DATE_ACTIVE_TO"];
$this->current_rate = $this->currentRate();
$this->winner = intval($arRes["PROPERTY_WINNER_VALUE"]);
$this->detail_page = $arRes["DETAIL_PAGE_URL"];
if ($this->winner <= 0) {
$finish = MakeTimeStamp($this->finish_time, "DD.MM.YYYY HH:MI:SS");
$now = time();
if ($now > $finish) {
$key = 778;
$seg = sem_get($key);
sem_acquire($seg);
$log = new CLoger("construct");
$ib_code = getIbIDByCode(self::getIBPointsTable());
$win_prop = CIBlockElement::GetProperty($ib_code, $id, array("sort" => "asc"), array("CODE" => "WINNER"))->GetNext();
$log->Add("win_prop", $win_prop);
if ($win_prop["VALUE"] <= 0) {
//sleep(10);
$win_id = $this->winner();
CIBlockElement::SetPropertyValues($id, $ib_code, $win_id, "WINNER");
}
sem_release($seg);
}
}
}
}
示例9: CPHPCache
</noindex>
<?php
if ($arParams["USE_CATEGORIES"] == "Y" && $ElementID) {
global $arCategoryFilter;
$obCache = new CPHPCache();
$strCacheID = $componentPath . LANG . $arParams["IBLOCK_ID"] . $ElementID . $arParams["CATEGORY_CODE"];
if (($tzOffset = CTimeZone::GetOffset()) != 0) {
$strCacheID .= "_" . $tzOffset;
}
if ($arParams["CACHE_TYPE"] == "N" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "N") {
$CACHE_TIME = 0;
} else {
$CACHE_TIME = $arParams["CACHE_TIME"];
}
if ($obCache->StartDataCache($CACHE_TIME, $strCacheID, $componentPath)) {
$rsProperties = CIBlockElement::GetProperty($arParams["IBLOCK_ID"], $ElementID, "sort", "asc", array("ACTIVE" => "Y", "CODE" => $arParams["CATEGORY_CODE"]));
$arCategoryFilter = array();
while ($arProperty = $rsProperties->Fetch()) {
if (is_array($arProperty["VALUE"]) && count($arProperty["VALUE"]) > 0) {
foreach ($arProperty["VALUE"] as $value) {
$arCategoryFilter[$value] = true;
}
} elseif (!is_array($arProperty["VALUE"]) && strlen($arProperty["VALUE"]) > 0) {
$arCategoryFilter[$arProperty["VALUE"]] = true;
}
}
$obCache->EndDataCache($arCategoryFilter);
} else {
$arCategoryFilter = $obCache->GetVars();
}
if (count($arCategoryFilter) > 0) {
示例10: UpdateOWSVersion
function UpdateOWSVersion($IBLOCK_ID, $ID, $value = null)
{
if (!defined('INTR_WS_OUTLOOK_UPDATE')) {
if (null === $value) {
$dbRes = CIBlockElement::GetProperty($IBLOCK_ID, $ID, 'sort', 'asc', array('CODE' => 'VERSION'));
$arProperty = $dbRes->Fetch();
if ($arProperty) {
$value = intval($arProperty['VALUE']);
if (!$value) {
$value = 1;
}
$value++;
}
}
if (null !== $value) {
CIBlockElement::SetPropertyValues($ID, $IBLOCK_ID, $value, 'VERSION');
}
}
}
示例11: GetProperties
//.........这里部分代码省略.........
if (is_array($val) || strlen($val) > 0) {
if (is_array($arProp["VALUE"])) {
$arProp["~VALUE"][] = $arListTilda[$key];
if ($arProp["PROPERTY_TYPE"] == "N") {
$val = htmlspecialcharsex(CIBlock::NumberFormat($val));
}
$arProp["VALUE"][] = $val;
$arProp["~DESCRIPTION"][] = $arDescTilda[$key];
$arProp["DESCRIPTION"][] = $arDesc[$key];
} else {
$arProp["~VALUE"] = array($arListTilda[$key]);
if ($arProp["PROPERTY_TYPE"] == "N") {
$val = htmlspecialcharsex(CIBlock::NumberFormat($val));
}
$arProp["VALUE"] = array($val);
$arProp["~DESCRIPTION"] = array($arDescTilda[$key]);
$arProp["DESCRIPTION"] = array($arDesc[$key]);
}
}
}
}
}
$arAllProps[$PIND] = $arProp;
}
return $arAllProps;
}
if (array_key_exists("ID", $arFilter) && !is_numeric(substr($arFilter["ID"], 0, 1))) {
$arFilter["CODE"] = $arFilter["ID"];
unset($arFilter["ID"]);
}
if (!array_key_exists("ACTIVE", $arFilter)) {
$arFilter["ACTIVE"] = "Y";
}
$props = CIBlockElement::GetProperty($this->fields["IBLOCK_ID"], $this->fields["ID"], $arOrder, $arFilter);
$arAllProps = array();
while ($arProp = $props->Fetch()) {
if (strlen(trim($arProp["CODE"])) > 0) {
$PIND = $arProp["CODE"];
} else {
$PIND = $arProp["ID"];
}
if ($arProp["PROPERTY_TYPE"] == "L") {
$arProp["VALUE_ENUM_ID"] = $arProp["VALUE"];
$arProp["VALUE"] = $arProp["VALUE_ENUM"];
}
if (is_array($arProp["VALUE"]) || strlen($arProp["VALUE"]) > 0) {
$arProp["~VALUE"] = $arProp["VALUE"];
if (is_array($arProp["VALUE"]) || preg_match("/[;&<>\"]/", $arProp["VALUE"])) {
$arProp["VALUE"] = htmlspecialcharsex($arProp["VALUE"]);
}
$arProp["~DESCRIPTION"] = $arProp["DESCRIPTION"];
if (preg_match("/[;&<>\"]/", $arProp["DESCRIPTION"])) {
$arProp["DESCRIPTION"] = htmlspecialcharsex($arProp["DESCRIPTION"]);
}
} else {
$arProp["VALUE"] = $arProp["~VALUE"] = "";
$arProp["DESCRIPTION"] = $arProp["~DESCRIPTION"] = "";
}
if ($arProp["MULTIPLE"] == "Y") {
if (array_key_exists($PIND, $arAllProps)) {
$arTemp =& $arAllProps[$PIND];
if ($arProp["VALUE"] !== "") {
if (is_array($arTemp["VALUE"])) {
$arTemp["VALUE"][] = $arProp["VALUE"];
$arTemp["~VALUE"][] = $arProp["~VALUE"];
$arTemp["DESCRIPTION"][] = $arProp["DESCRIPTION"];
示例12: htmlspecialcharsex
else
{
$row->AddCalendarField("DATE_ACTIVE_FROM", false);
$row->AddCalendarField("DATE_ACTIVE_TO", false);
$row->AddViewField("WF_STATUS_ID", htmlspecialcharsex($arWFStatusAll[$arRes['WF_STATUS_ID']]));
if (array_key_exists("TAGS", $arVisibleColumnsMap))
$row->AddViewField("TAGS", $f_TAGS);
}
}
$row->AddViewField("ID", '<a href="'.($f_TYPE=="S"?$sec_edit_url:$el_edit_url).'" title="'.GetMessage("IBLIST_A_EDIT").'">'.$f_ID.'</a>');
$arProperties = array();
if($f_TYPE=="E" && count($arSelectedProps)>0)
{
$rsProperties = CIBlockElement::GetProperty($IBLOCK_ID, $arRes["ID"]);
while($ar = $rsProperties->GetNext())
{
if(!array_key_exists($ar["ID"], $arProperties))
$arProperties[$ar["ID"]] = array();
$arProperties[$ar["ID"]][$ar["PROPERTY_VALUE_ID"]] = $ar;
}
foreach($arSelectedProps as $aProp)
{
$arViewHTML = array();
$arEditHTML = array();
if(strlen($aProp["USER_TYPE"])>0)
$arUserType = CIBlockProperty::GetUserType($aProp["USER_TYPE"]);
else
$arUserType = array();
示例13: 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") {
//.........这里部分代码省略.........
示例14: RecoverDocumentFromHistory
/**
* ћетод восстанавливает указанный документ из массива. ћассив создаетс¤ методом RecoverDocumentFromHistory.
*
* @param string $documentId - код документа.
* @param array $arDocument - массив.
*/
public function RecoverDocumentFromHistory($documentId, $arDocument)
{
$documentId = intval($documentId);
if ($documentId <= 0) {
throw new CBPArgumentNullException("documentId");
}
$arFields = $arDocument["FIELDS"];
if (strlen($arFields["PREVIEW_PICTURE"]) > 0) {
$arFields["PREVIEW_PICTURE"] = CFile::MakeFileArray($arFields["PREVIEW_PICTURE"]);
}
if (strlen($arFields["DETAIL_PICTURE"]) > 0) {
$arFields["DETAIL_PICTURE"] = CFile::MakeFileArray($arFields["DETAIL_PICTURE"]);
}
$arFields["PROPERTY_VALUES"] = array();
$dbProperties = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("IBLOCK_ID" => $arFields["IBLOCK_ID"]));
while ($arProperty = $dbProperties->Fetch()) {
if (strlen(trim($arProperty["CODE"])) > 0) {
$key = $arProperty["CODE"];
} else {
$key = $arProperty["ID"];
}
if (!array_key_exists($key, $arDocument["PROPERTIES"])) {
continue;
}
$documentValue = $arDocument["PROPERTIES"][$key]["VALUE"];
if (strlen($arProperty["USER_TYPE"]) <= 0 && $arProperty["PROPERTY_TYPE"] == "F") {
$arFields["PROPERTY_VALUES"][$key] = array();
//Mark files to be deleted
$rsFiles = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $documentId, array("ID" => $arProperty["ID"], "EMPTY" => "N"));
while ($arFile = $rsFiles->Fetch()) {
if ($arFile["PROPERTY_VALUE_ID"] > 0) {
$arFields["PROPERTY_VALUES"][$key][$arFile["PROPERTY_VALUE_ID"]] = array("VALUE" => array("del" => "Y"), "DESCRIPTION" => "");
}
}
//Restore from history
$io = CBXVirtualIo::GetInstance();
if (is_array($documentValue)) {
$n = 0;
foreach ($documentValue as $i => $v) {
if (strlen($v) > 0) {
$arFields["PROPERTY_VALUES"][$key]["n" . $n++] = array("VALUE" => CFile::MakeFileArray($io->GetPhysicalName($v)), "DESCRIPTION" => $arDocument["PROPERTIES"][$key]["DESCRIPTION"][$i]);
}
}
} else {
if (strlen($documentValue) > 0) {
$arFields["PROPERTY_VALUES"][$key]["n0"] = array("VALUE" => CFile::MakeFileArray($io->GetPhysicalName($documentValue)), "DESCRIPTION" => $arDocument["PROPERTIES"][$key]["DESCRIPTION"]);
}
}
} else {
if (is_array($documentValue)) {
$n = 0;
foreach ($documentValue as $i => $v) {
if (strlen($v) > 0) {
$arFields["PROPERTY_VALUES"][$key]["n" . $n++] = array("VALUE" => $v, "DESCRIPTION" => $arDocument["PROPERTIES"][$key]["DESCRIPTION"][$i]);
}
}
} else {
if (strlen($documentValue) > 0) {
$arFields["PROPERTY_VALUES"][$key]["n0"] = array("VALUE" => $documentValue, "DESCRIPTION" => $arDocument["PROPERTIES"][$key]["DESCRIPTION"]);
}
}
}
}
$iblockElement = new CIBlockElement();
$res = $iblockElement->Update($documentId, $arFields);
if (intVal($arFields["WF_STATUS_ID"]) > 1 && intVal($arFields["WF_PARENT_ELEMENT_ID"]) <= 0) {
self::UnpublishDocument($documentId);
}
if (!$res) {
throw new Exception($iblockElement->LAST_ERROR);
}
return true;
}
示例15: ExecuteModuleEventEx
$arParams = ExecuteModuleEventEx($arEvent, array($arItems["ID"], $arParams));
}
$arParams = "var el" . $arItems["ID"] . " = " . $arParams;
$act = '<script type="text/javascript">' . $arParams . '</script><input class="addBtn" type="button" onClick="SelEl(el' . $arItems["ID"] . ', ' . $arItems["ID"] . ')" name="btn_select_' . $arItems["ID"] . '" id="btn_select_' . $arItems["ID"] . '" value="' . GetMessage("SPS_SELECT") . '">';
$countField = '<input type="text" name="quantity_' . $arItems["ID"] . '" id="quantity_' . $arItems["ID"] . '" value="1" size="3">';
} else {
$act = GetMessage("SPS_CAN_BUY_NOT_PRODUCT");
$countField = " ";
}
$active = $arItems["ACTIVE"] == 'Y' ? GetMEssage('SPS_PRODUCT_ACTIVE') : GetMEssage('SPS_PRODUCT_NO_ACTIVE');
$row->AddField("ACT", $act);
$row->AddField("QUANTITY", $countField);
$row->AddField("ACTIVE", $active);
$arProperties = array();
if (!empty($arSelectedProps)) {
$rsProperties = CIBlockElement::GetProperty($iblockId, $arItems["ID"]);
while ($ar = $rsProperties->Fetch()) {
if (!array_key_exists($ar["ID"], $arProperties)) {
$arProperties[$ar["ID"]] = array();
}
if ($ar["PROPERTY_TYPE"] === "L") {
$arProperties[$ar["ID"]][$ar["PROPERTY_VALUE_ID"]] = $ar["VALUE_ENUM"];
} else {
$arProperties[$ar["ID"]][$ar["PROPERTY_VALUE_ID"]] = $ar["VALUE"];
}
}
}
foreach ($arSelectedProps as $aProp) {
$v = '';
foreach ($arProperties[$aProp['ID']] as $property_value_id => $property_value) {
$res = '';