Esempio n. 1
0
 function __IRM_InitReservation($iblockId)
 {
     $arResult = array();
     $arResult["ALLOWED_FIELDS"] = array("ID" => array("NAME" => GetMessage("INAF_F_ID"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "int", "IS_FIELD" => true), "NAME" => array("NAME" => GetMessage("INAF_F_NAME"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "string", "IS_FIELD" => true), "DESCRIPTION" => array("NAME" => GetMessage("INAF_F_DESCRIPTION"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "text", "IS_FIELD" => true), "UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "string", "IS_FIELD" => false));
     $arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockId . "_SECTION", 0, LANGUAGE_ID);
     $arKeys = Array_Keys($arResult["ALLOWED_FIELDS"]);
     foreach ($arKeys as $key) {
         if (!$arResult["ALLOWED_FIELDS"][$key]["IS_FIELD"]) {
             if (!Array_Key_Exists($key, $arUserFields)) {
                 $arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arResult["ALLOWED_FIELDS"][$key]["TYPE"]);
                 $obUserField = new CUserTypeEntity();
                 $obUserField->Add($arFields);
             }
         }
     }
     $arResult["ALLOWED_ITEM_PROPERTIES"] = array("UF_PERSONS" => array("NAME" => GetMessage("INTASK_C29_UF_PERSONS"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "UF_PERSONS", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "UF_RES_TYPE" => array("NAME" => GetMessage("INTASK_C29_UF_RES_TYPE"), "ACTIVE" => "Y", "SORT" => 200, "CODE" => "UF_RES_TYPE", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEA"), "DEF" => "Y", "SORT" => 100, "XML_ID" => "A"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEB"), "DEF" => "N", "SORT" => 200, "XML_ID" => "B"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEC"), "DEF" => "N", "SORT" => 200, "XML_ID" => "C"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPED"), "DEF" => "N", "SORT" => 300, "XML_ID" => "D"))), "UF_PREPARE_ROOM" => array("NAME" => GetMessage("INTASK_C29_UF_PREPARE_ROOM"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "UF_PREPARE_ROOM", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_TYPE" => array("NAME" => GetMessage("INTASK_C29_PERIOD_TYPE"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_TYPE", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "NONE", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_COUNT" => array("NAME" => GetMessage("INTASK_C29_PERIOD_COUNT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_COUNT", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "EVENT_LENGTH" => array("NAME" => GetMessage("INTASK_C29_EVENT_LENGTH"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "EVENT_LENGTH", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_ADDITIONAL" => array("NAME" => GetMessage("INTASK_C29_PERIOD_ADDITIONAL"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_ADDITIONAL", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
     $dbIBlockProps = CIBlock::GetProperties($iblockId);
     while ($arIBlockProps = $dbIBlockProps->Fetch()) {
         if (Array_Key_Exists($arIBlockProps["CODE"], $arResult["ALLOWED_ITEM_PROPERTIES"])) {
             $arResult["ALLOWED_ITEM_PROPERTIES"][$arIBlockProps["CODE"]]["ID"] = $arIBlockProps["ID"];
         }
     }
     $keys = Array_Keys($arResult["ALLOWED_ITEM_PROPERTIES"]);
     foreach ($keys as $key) {
         if (IntVal($arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"]) <= 0) {
             $ibp = new CIBlockProperty();
             $arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"] = $ibp->Add($arResult["ALLOWED_ITEM_PROPERTIES"][$key]);
         }
     }
     return $arResult;
 }
Esempio n. 2
0
function onBeforeUpload($Params)
{
    CModule::IncludeModule("iblock");
    $_SESSION['arUploadedPhotos'] = array();
    $arParams = $Params['arParams'];
    $savedData = CImageUploader::GetSavedData();
    $savedData['UPLOADING_START'] = "Y";
    CImageUploader::SetSavedData($savedData);
    if ($savedData["SECTION_ID"] <= 0) {
        $arParams["SECTION_ID"] = GetAlbumId(array('id' => $Params['packageFields']['photo_album_id'], 'name' => $Params['packageFields']['new_album_name'], 'arParams' => $arParams, '~arResult' => $Params['~arResult']));
        $savedData = CImageUploader::GetSavedData();
        $savedData["SECTION_ID"] = $arParams["SECTION_ID"];
    } else {
        $arParams["SECTION_ID"] = $savedData["SECTION_ID"];
    }
    // Check and create properties
    if (count($savedData['arError']) == 0) {
        $arPropertiesNeed = array();
        // Array of properties needed to create
        foreach ($arParams['converters'] as $key => $val) {
            if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") {
                continue;
            }
            $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $val['code']));
            if (!($db_res && ($res = $db_res->Fetch()))) {
                $arPropertiesNeed[] = $val['code'];
            }
        }
        if (count($arPropertiesNeed) > 0) {
            $obProperty = new CIBlockProperty();
            foreach ($arPropertiesNeed as $key) {
                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($key))) > 0 ? GetMessage("P_" . strToUpper($key)) : strToUpper($key), "CODE" => strToUpper($key), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg"));
            }
        }
        // Check Public property
        $arPropertiesNeed = array();
        foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) {
            $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
            if (!$db_res || !($res = $db_res->Fetch())) {
                $arPropertiesNeed[] = $key;
            }
        }
        if (count($arPropertiesNeed) > 0) {
            $obProperty = new CIBlockProperty();
            foreach ($arPropertiesNeed as $key) {
                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . $key)) > 0 ? GetMessage("P_" . $key) : $key, "DEFAULT_VALUE" => "N", "CODE" => $key));
            }
        }
    }
    CImageUploader::SetSavedData($savedData);
    return true;
}
Esempio n. 3
0
			   
				if ( isset( $arforRequest [ $propertyID ] ) ){
					array_push( $arforRequest [ $propertyID ], $values );
				}else{
					$arforRequest [ $propertyID ] = $values;
				}
			}

			if ($arResult["ELEMENT_PROPERTIES"][$propertyID][0]["VALUE"]!=""){
				$arOrder = array("NAME"=>"ACS");
				$arFilter = array("IBLOCK_ID"=>$arResult["PROPERTY_LIST_FULL"][$propertyID]["LINK_IBLOCK_ID"], "ID"=>$arforRequest[$propertyID]);
				$arSelectFields = array("IBLOCK_ID", "ID", "NAME");
				if ($arParams["ADD_BUTTON"][$propertyID]["VIEW_FILED"])
				{
						
						$res = CIBlock::GetProperties($arResult["PROPERTY_LIST_FULL"][$propertyID]["LINK_IBLOCK_ID"], Array(), Array("ID"=>$arParams["ADD_BUTTON"][$propertyID]["VIEW_FILED"]));
						if($res_arr = $res->Fetch())
						{
							$SrcPropID = $res_arr["CODE"];
							
						}
						else
							$SrcPropID = "NAME";
						if ($SrcPropID && $SrcPropID!="NAME")
						{
							$arSelectFields[]="PROPERTY_".$SrcPropID;
						}
				}
				$dbEl = CIBlockElement::GetList( $arOrder, $arFilter, false, false, $arSelectFields );
				$value = array ();
Esempio n. 4
0
 function __InTaskPrepareIBlock($iblockId)
 {
     $iblockId = IntVal($iblockId);
     if ($iblockId <= 0) {
         return;
     }
     $dbIBlock = CIBlock::GetList(array(), array("ID" => $iblockId, "ACTIVE" => "Y"));
     if ($arIBlock = $dbIBlock->Fetch()) {
         $arIBlockProperties = array();
         $dbIBlockProps = CIBlock::GetProperties($iblockId);
         while ($arIBlockProps = $dbIBlockProps->Fetch()) {
             $ind = StrLen($arIBlockProps["CODE"]) > 0 ? $arIBlockProps["CODE"] : $arIBlockProps["ID"];
             $arIBlockProperties[StrToUpper($ind)] = $arIBlockProps;
         }
         $arTasksProps = array("TASKPRIORITY" => array("NAME" => GetMessage("INTI_TASKPRIORITY"), "ACTIVE" => "Y", "SORT" => 100, "CODE" => "TaskPriority", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => "   " . GetMessage("INTI_TASKPRIORITY_1"), "DEF" => "N", "SORT" => 100, "XML_ID" => "1"), array("VALUE" => "  " . GetMessage("INTI_TASKPRIORITY_2"), "DEF" => "Y", "SORT" => 200, "XML_ID" => "2"), array("VALUE" => " " . GetMessage("INTI_TASKPRIORITY_3"), "DEF" => "N", "SORT" => 300, "XML_ID" => "3"))), "TASKSTATUS" => array("NAME" => GetMessage("INTI_TASKSTATUS"), "ACTIVE" => "Y", "SORT" => 200, "CODE" => "TaskStatus", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => GetMessage("INTI_TASKSTATUS_1"), "DEF" => "Y", "SORT" => 100, "XML_ID" => "NotAccepted"), array("VALUE" => GetMessage("INTI_TASKSTATUS_2"), "DEF" => "N", "SORT" => 200, "XML_ID" => "NotStarted"), array("VALUE" => GetMessage("INTI_TASKSTATUS_3"), "DEF" => "N", "SORT" => 300, "XML_ID" => "InProgress"), array("VALUE" => GetMessage("INTI_TASKSTATUS_4"), "DEF" => "N", "SORT" => 400, "XML_ID" => "Completed"), array("VALUE" => GetMessage("INTI_TASKSTATUS_5"), "DEF" => "N", "SORT" => 500, "XML_ID" => "Waiting"), array("VALUE" => GetMessage("INTI_TASKSTATUS_6"), "DEF" => "N", "SORT" => 600, "XML_ID" => "Deferred"))), "TASKCOMPLETE" => array("NAME" => GetMessage("INTI_TASKCOMPLETE"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskComplete", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKASSIGNEDTO" => array("NAME" => GetMessage("INTI_TASKASSIGNEDTO"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskAssignedTo", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKALERT" => array("NAME" => GetMessage("INTI_TASKALERT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "TaskAlert", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZE" => array("NAME" => GetMessage("INTI_TASKSIZE"), "ACTIVE" => "Y", "SORT" => 600, "CODE" => "TaskSize", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZEREAL" => array("NAME" => GetMessage("INTI_TASKSIZEREAL"), "ACTIVE" => "Y", "SORT" => 700, "CODE" => "TaskSizeReal", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFINISH" => array("NAME" => GetMessage("INTI_TASKFINISH"), "ACTIVE" => "Y", "SORT" => 800, "CODE" => "TaskFinish", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFILES" => array("NAME" => GetMessage("INTI_TASKFILES"), "ACTIVE" => "Y", "SORT" => 900, "CODE" => "TaskFiles", "PROPERTY_TYPE" => "F", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREPORT" => array("NAME" => GetMessage("INTI_TASKREPORT"), "ACTIVE" => "Y", "SORT" => 1000, "CODE" => "TaskReport", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREMIND" => array("NAME" => GetMessage("INTI_TASKREMIND"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskRemind", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "VERSION" => array("NAME" => GetMessage("INTI_VERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "VERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
         foreach ($arTasksProps as $propKey => $arProp) {
             if (!Array_Key_Exists($propKey, $arIBlockProperties)) {
                 $ibp = new CIBlockProperty();
                 $ibp->Add($arProp);
             }
         }
     }
 }
				$xPropNode = $props[$j];

				$PROP_XML_ID = $xPropNode->GetAttribute($nameUTF['ID']);
				$PROP_TYPE = $xPropNode->GetAttribute($nameUTF['DataType']);
				$PROP_MULTIPLE = ($xPropNode->GetAttribute($nameUTF['Multiple'])=="1"?"Y":"N");
				$PROP_NAME = $xPropNode->GetAttribute($nameUTF['Name']);
				$PROP_DEF = $xPropNode->GetAttribute($nameUTF['DefaultValue']);
				if($PROP_TYPE == "enumeration")
					$PROP_TYPE = "L";
				else
					$PROP_TYPE = "S";

				if($arPriceType[$IBLOCK_XML_ID]==$PROP_XML_ID)
					continue;

				$res = CIBlock::GetProperties($IBLOCK_ID, array(), Array("IBLOCK_ID"=>$IBLOCK_ID, "XML_ID"=>$PROP_XML_ID));
				$bNewRecord_tmp = False;
				if($res_arr = $res->Fetch())
				{
					$PROP_ID = $res_arr["ID"];
					$res = $ibp->Update($PROP_ID,
							Array(
								"NAME" => $PROP_NAME,
								"TYPE" => $PROP_TYPE,
								"MULTIPLE" => $PROP_MULTIPLE,
								"DEFAULT_VALUE" => $PROP_DEF,
								"TMP_ID"		=> $tmpid
							)
						);
				}
				else
Esempio n. 6
0
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
$APPLICATION->SetTitle("GeekCon");
?>

<?php 
if (CModule::IncludeModule("iblock")) {
    if ($_GET["delete"] == "Y") {
        if (CIBlockElement::Delete($_GET["CODE"])) {
            LocalRedirect("/profile/");
        }
    }
}
$res = CIBlock::GetProperties("10", array(), array());
$idCity = 0;
$idMember = 0;
while ($arItem = $res->GetNext()) {
    if ($arItem["CODE"] == "CITY") {
        $idCity = $arItem["ID"];
    }
    if ($arItem["CODE"] == "MEMBER") {
        $idMember = $arItem["ID"];
    }
}
?>


<?php 
$APPLICATION->IncludeComponent("bitrix:iblock.element.add.form", "team", array("SEF_MODE" => "Y", "IBLOCK_TYPE" => "comand", "IBLOCK_ID" => "10", "PROPERTY_CODES" => array("NAME", "DETAIL_PICTURE", "ACTIVE", $idMember, $idCity), "PROPERTY_CODES_REQUIRED" => array("NAME"), "GROUPS" => array("1", "2"), "STATUS_NEW" => "2", "STATUS" => array("2"), "LIST_URL" => "", "ELEMENT_ASSOC" => "CREATED_BY", "ELEMENT_ASSOC_PROPERTY" => "", "MAX_USER_ENTRIES" => "100000", "MAX_LEVELS" => "100000", "LEVEL_LAST" => "Y", "USE_CAPTCHA" => "N", "USER_MESSAGE_EDIT" => "", "USER_MESSAGE_ADD" => "", "DEFAULT_INPUT_SIZE" => "30", "RESIZE_IMAGES" => "Y", "MAX_FILE_SIZE" => "0", "PREVIEW_TEXT_USE_HTML_EDITOR" => "Y", "DETAIL_TEXT_USE_HTML_EDITOR" => "Y", "CUSTOM_TITLE_NAME" => "", "CUSTOM_TITLE_TAGS" => "", "CUSTOM_TITLE_DATE_ACTIVE_FROM" => "", "CUSTOM_TITLE_DATE_ACTIVE_TO" => "", "CUSTOM_TITLE_IBLOCK_SECTION" => "", "CUSTOM_TITLE_PREVIEW_TEXT" => "", "CUSTOM_TITLE_PREVIEW_PICTURE" => "", "CUSTOM_TITLE_DETAIL_TEXT" => "", "CUSTOM_TITLE_DETAIL_PICTURE" => "", "SEF_FOLDER" => "/", "VARIABLE_ALIASES" => array()));
?>
Esempio n. 7
0
                echo GetMessage("IB_E_PROP_CODE_SHORT");
                ?>
</td>
					<td><?php 
                echo GetMessage("IB_E_PROP_MODIFY_SHORT");
                ?>
</td>
					<td><?php 
                echo GetMessage("IB_E_PROP_DELETE_SHORT");
                ?>
</td>
				</tr>
				<?php 
                $arOFPropList = array();
                if (0 < intval($str_OF_IBLOCK_ID)) {
                    $rsProps = CIBlock::GetProperties($str_OF_IBLOCK_ID, array("SORT" => "ASC", 'ID' => 'ASC'));
                    while ($arProp = $rsProps->Fetch()) {
                        ConvProp($arProp, $arHiddenPropFields);
                        if ($bVarsFromForm) {
                            $intPropID = $arProp['ID'];
                            $arTempo = GetPropertyInfo($strPREFIX_OF_PROPERTY, $intPropID, false, $arHiddenPropFields);
                            if (is_array($arTempo)) {
                                $arProp = $arTempo;
                            }
                            $arProp['ID'] = $intPropID;
                        }
                        $arProp = ConvertToSafe($arProp, $arDisabledPropFields);
                        $arProp['SHOW_DEL'] = 'Y';
                        $arOFPropList[$arProp['ID']] = $arProp;
                    }
                }
Esempio n. 8
0
 public static function GetSetItems($productID, $intType, $arProducInfo = array())
 {
     $arProductId = array();
     static $proxyCatalogProductSet = array();
     static $proxyCatalogSkuData = array();
     static $proxyCatalogProduct = array();
     static $proxyIblockProperty = array();
     static $proxyProductProperty = array();
     $proxyCatalogProductSetKey = $productID . "|" . $intType;
     if (!empty($proxyCatalogProductSet[$proxyCatalogProductSetKey]) && is_array($proxyCatalogProductSet[$proxyCatalogProductSetKey])) {
         $arSets = $proxyCatalogProductSet[$proxyCatalogProductSetKey];
     } else {
         $arSets = CCatalogProductSet::getAllSetsByProduct($productID, $intType);
         if (!empty($arSets) && is_array($arSets)) {
             $proxyCatalogProductSet[$proxyCatalogProductSetKey] = $arSets;
         }
     }
     if (is_array($arSets)) {
         foreach ($arSets as $k => $arSet) {
             foreach ($arSet["ITEMS"] as $k1 => $item) {
                 $arItem = self::GetProductData(array("PRODUCT_ID" => $item["ITEM_ID"], "QUANTITY" => $item["QUANTITY"], "CHECK_QUANTITY" => "N", "CHECK_PRICE" => "N"));
                 if (array_key_exists('QUANTITY_TRACE', $arItem)) {
                     unset($arItem['QUANTITY_TRACE']);
                 }
                 $arItem["PRODUCT_ID"] = $item["ITEM_ID"];
                 $arItem["MODULE"] = "catalog";
                 $arItem["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
                 if ($intType == CCatalogProductSet::TYPE_SET) {
                     $arItem['SET_DISCOUNT_PERCENT'] = $item['DISCOUNT_PERCENT'] == '' ? false : (double) $item['DISCOUNT_PERCENT'];
                 }
                 $arProductId[] = $item["ITEM_ID"];
                 $arItem["PROPS"] = array();
                 if (!empty($proxyCatalogSkuData[$item["ITEM_ID"]]) && is_array($proxyCatalogSkuData[$item["ITEM_ID"]])) {
                     $arParentSku = $proxyCatalogSkuData[$item["ITEM_ID"]];
                 } else {
                     if ($arParentSku = CCatalogSku::GetProductInfo($item["ITEM_ID"])) {
                         $proxyCatalogSkuData[$item["ITEM_ID"]] = $arParentSku;
                     }
                 }
                 if (!empty($arParentSku)) {
                     $arPropsSku = array();
                     if (!($arProduct = static::getHitCache('IBLOCK_ELEMENT', $item["ITEM_ID"]))) {
                         $dbProduct = CIBlockElement::GetList(array(), array("ID" => $item["ITEM_ID"]), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'IBLOCK_SECTION_ID'));
                         if ($arProduct = $dbProduct->Fetch()) {
                             static::setHitCache('IBLOCK_ELEMENT', $item["ITEM_ID"], $arProduct);
                         }
                     }
                     if (!($arPropsSku = static::getHitCache('IBLOCK_PROPERTY', $arProduct["IBLOCK_ID"]))) {
                         $dbOfferProperties = CIBlock::GetProperties($arProduct["IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
                         while ($arOfferProperties = $dbOfferProperties->Fetch()) {
                             $arPropsSku[] = $arOfferProperties["CODE"];
                         }
                         static::setHitCache('IBLOCK_PROPERTY', $arProduct["IBLOCK_ID"], $arPropsSku);
                     }
                     $proxyProductPropertyKey = $item["ITEM_ID"] . "_" . $arParentSku["IBLOCK_ID"] . "_" . md5(join('|', $arPropsSku));
                     if (!($product_properties = static::getHitCache('PRODUCT_PROPERTY', $proxyProductPropertyKey))) {
                         $product_properties = CIBlockPriceTools::GetOfferProperties($item["ITEM_ID"], $arParentSku["IBLOCK_ID"], $arPropsSku);
                         static::setHitCache('PRODUCT_PROPERTY', $proxyProductPropertyKey, $product_properties);
                     }
                     foreach ($product_properties as $propData) {
                         $arItem["PROPS"][] = array("NAME" => $propData["NAME"], "CODE" => $propData["CODE"], "VALUE" => $propData["VALUE"], "SORT" => $propData["SORT"]);
                     }
                 }
                 $arSets[$k]["ITEMS"][$k1] = array_merge($item, $arItem);
             }
         }
         if (!($productList = static::getHitCache('IBLOCK_ELEMENT_LIST', $productID))) {
             $rsProducts = CIBlockElement::GetList(array(), array('ID' => $arProductId), false, false, array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "IBLOCK_TYPE_ID", "XML_ID"));
             while ($arProduct = $rsProducts->GetNext()) {
                 $productList[] = $arProduct;
             }
             if (!empty($productList) && is_array($productList)) {
                 static::setHitCache('IBLOCK_ELEMENT_LIST', $productID, $productList);
             }
         }
         if (!empty($productList) && is_array($productList)) {
             foreach ($productList as $arProduct) {
                 foreach ($arSets as $k => $arSet) {
                     foreach ($arSet["ITEMS"] as $k1 => $item) {
                         if ($item["ITEM_ID"] == $arProduct["ID"]) {
                             $arProps = array();
                             $strIBlockXmlID = strval(CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID'));
                             if ($strIBlockXmlID != "") {
                                 $arProps[] = array("NAME" => "Catalog XML_ID", "CODE" => "CATALOG.XML_ID", "VALUE" => $strIBlockXmlID);
                             }
                             $arProps[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arProduct["XML_ID"]);
                             $arSets["{$k}"]["ITEMS"][$k1]["IBLOCK_ID"] = $arProduct["IBLOCK_ID"];
                             $arSets["{$k}"]["ITEMS"][$k1]["IBLOCK_SECTION_ID"] = $arProduct["IBLOCK_SECTION_ID"];
                             $arSets["{$k}"]["ITEMS"][$k1]["PREVIEW_PICTURE"] = $arProduct["PREVIEW_PICTURE"];
                             $arSets["{$k}"]["ITEMS"][$k1]["DETAIL_PICTURE"] = $arProduct["DETAIL_PICTURE"];
                             $arSets["{$k}"]["ITEMS"][$k1]["PROPS"] = array_merge($arSets["{$k}"]["ITEMS"][$k1]["PROPS"], $arProps);
                         }
                     }
                 }
             }
         }
     }
     foreach (GetModuleEvents("sale", "OnGetSetItems", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$arSets));
     }
     return $arSets;
 }
Esempio n. 9
0
 /**
  * Adds new properties in block
  * @param $arParams
  * @return bool
  */
 public static function adjustIBlock($arParams)
 {
     $arPropertiesNeed = array();
     // Array of properties needed to create
     foreach ($arParams['converters'] as $key => $val) {
         if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") {
             continue;
         }
         $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $val['code']));
         if (!($db_res && ($res = $db_res->Fetch()))) {
             $arPropertiesNeed[] = $val['code'];
         }
     }
     if (count($arPropertiesNeed) > 0) {
         $obProperty = new CIBlockProperty();
         foreach ($arPropertiesNeed as $key) {
             $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($key))) > 0 ? GetMessage("P_" . strToUpper($key)) : strToUpper($key), "CODE" => strToUpper($key), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg"));
         }
     }
     // Check Public property
     $arPropertiesNeed = array();
     foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) {
         $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
         if (!$db_res || !($res = $db_res->Fetch())) {
             $arPropertiesNeed[] = $key;
         }
     }
     if (count($arPropertiesNeed) > 0) {
         $obProperty = new CIBlockProperty();
         foreach ($arPropertiesNeed as $key) {
             $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . $key)) > 0 ? GetMessage("P_" . $key) : $key, "DEFAULT_VALUE" => "N", "CODE" => $key));
         }
     }
     return true;
 }
Esempio n. 10
0
ini_set('display_errors', 1);
/*	
	require_once( $_SERVER["DOCUMENT_ROOT"]."/service/contract/c_search_form.php" );
*/
$include_file = getenv("DOCUMENT_ROOT") . '/bitrix/templates/work_copy/class/class_search_form.php';
include_once $include_file;
global $APPLICATION;
//$APPLICATION->ShowHeadStrings();
//$APPLICATION->ShowHead();
/* */
// $APPLICATION -> AddHeadScript ( '/js/service/event-listner-message.js', false );
$arShowFields = array("vhcl_vin", "vhcl_chassis", "vhcl_engine", "vhcl_regnum", "vhcl_type");
$arHiddenFields = array("vhcl_type");
CModule::IncludeModule('iblock');
$SrcPropID = array("vhcl_chassis", "vhcl_regnum");
$res = CIBlock::GetProperties(IBLOCK_SK_CHASSIS_ID, array(), array("ID" => $_REQUEST["show"]));
/* // update 18/08/2015 task CAR_BY_ACTION
	$SrcPropID = "vhcl_chassis";
	if($res_arr = $res->Fetch()){
		$SrcPropID = $res_arr["CODE"];
	}else{
		$SrcPropID = "vhcl_chassis";
	}
*/
if ($res_arr = $res->Fetch()) {
    //$SrcPropID = $res_arr["CODE"];
    array_unshift($SrcPropID, $res_arr["CODE"]);
}
$sub_filter = array();
// Получаю Ид Т/С с активными договорами
$carIDs = array();
Esempio n. 11
0
 function InitializeIBlock($taskType, $ownerId, $forumId)
 {
     $iblockId = COption::GetOptionInt("intranet", "iblock_tasks", 0);
     if ($iblockId <= 0) {
         return 0;
     }
     $forumId = intval($forumId);
     $arTasksConverted2BP = array();
     $keyTasksConverted2BP = $iblockId . "_" . $taskType . ($taskType == "group" ? "_" . $ownerId : "");
     global $CACHE_MANAGER;
     if ($CACHE_MANAGER->Read(2592000, "IntranetTasksConverted2BP")) {
         $arTasksConverted2BP = $CACHE_MANAGER->Get("IntranetTasksConverted2BP");
         if (array_key_exists($keyTasksConverted2BP, $arTasksConverted2BP)) {
             return $arTasksConverted2BP[$keyTasksConverted2BP];
         }
     }
     $globalParentSectionId = 0;
     $dbIBlock = CIBlock::GetList(array(), array("ID" => $iblockId, "ACTIVE" => "Y"));
     if ($arIBlock = $dbIBlock->Fetch()) {
         $arIBlockProperties = array();
         $dbIBlockProps = CIBlock::GetProperties($iblockId);
         while ($arIBlockProps = $dbIBlockProps->Fetch()) {
             $ind = StrLen($arIBlockProps["CODE"]) > 0 ? $arIBlockProps["CODE"] : $arIBlockProps["ID"];
             $arIBlockProperties[StrToUpper($ind)] = $arIBlockProps;
         }
         $arTasksProps = array("TASKPRIORITY" => array("NAME" => GetMessage("INTI_TASKPRIORITY"), "ACTIVE" => "Y", "SORT" => 100, "CODE" => "TaskPriority", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => "   " . GetMessage("INTI_TASKPRIORITY_1"), "DEF" => "N", "SORT" => 100, "XML_ID" => "1"), array("VALUE" => "  " . GetMessage("INTI_TASKPRIORITY_2"), "DEF" => "Y", "SORT" => 200, "XML_ID" => "2"), array("VALUE" => " " . GetMessage("INTI_TASKPRIORITY_3"), "DEF" => "N", "SORT" => 300, "XML_ID" => "3"))), "TASKCOMPLETE" => array("NAME" => GetMessage("INTI_TASKCOMPLETE"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskComplete", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKASSIGNEDTO" => array("NAME" => GetMessage("INTI_TASKASSIGNEDTO"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskAssignedTo", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKTRACKERS" => array("NAME" => GetMessage("INTI_TASKTRACKERS"), "ACTIVE" => "Y", "SORT" => 400, "CODE" => "TaskTrackers", "PROPERTY_TYPE" => "S", "USER_TYPE" => "UserID", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKALERT" => array("NAME" => GetMessage("INTI_TASKALERT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "TaskAlert", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZE" => array("NAME" => GetMessage("INTI_TASKSIZE"), "ACTIVE" => "Y", "SORT" => 600, "CODE" => "TaskSize", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKSIZEREAL" => array("NAME" => GetMessage("INTI_TASKSIZEREAL"), "ACTIVE" => "Y", "SORT" => 700, "CODE" => "TaskSizeReal", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFINISH" => array("NAME" => GetMessage("INTI_TASKFINISH"), "ACTIVE" => "Y", "SORT" => 800, "CODE" => "TaskFinish", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKFILES" => array("NAME" => GetMessage("INTI_TASKFILES"), "ACTIVE" => "Y", "SORT" => 900, "CODE" => "TaskFiles", "PROPERTY_TYPE" => "F", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "Y", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREPORT" => array("NAME" => GetMessage("INTI_TASKREPORT"), "ACTIVE" => "Y", "SORT" => 1000, "CODE" => "TaskReport", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "ROW_COUNT" => 10, "COL_COUNT" => 60, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKREMIND" => array("NAME" => GetMessage("INTI_TASKREMIND"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "TaskRemind", "PROPERTY_TYPE" => "S", "USER_TYPE" => "DateTime", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "VERSION" => array("NAME" => GetMessage("INTI_VERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "VERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "TASKVERSION" => array("NAME" => GetMessage("INTI_TASKVERSION"), "ACTIVE" => "Y", "SORT" => 1100, "CODE" => "TASKVERSION", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 10, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
         foreach ($arTasksProps as $propKey => $arProp) {
             if (!array_key_exists($propKey, $arIBlockProperties)) {
                 $ibp = new CIBlockProperty();
                 $ibp->Add($arProp);
             }
         }
         $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => $taskType == "group" ? $ownerId : "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
         if ($arSection = $dbSectionsList->GetNext()) {
             $globalParentSectionId = $arSection["ID"];
         }
         if ($globalParentSectionId <= 0) {
             if ($taskType == "group") {
                 $folderName = "-";
                 $folderXmlId = $ownerId;
                 if ($arGroup = CSocNetGroup::GetByID($ownerId)) {
                     $folderName = $arGroup["NAME"] . " [" . $ownerId . "]";
                     $folderXmlId = $ownerId;
                 }
             } else {
                 $folderName = "User Tasks";
                 $folderXmlId = "users_tasks";
             }
             $arFields = array("IBLOCK_ID" => $iblockId, "IBLOCK_SECTION_ID" => 0, "ACTIVE" => "Y", "NAME" => $folderName, "XML_ID" => $folderXmlId);
             $iblockSection = new CIBlockSection();
             $globalParentSectionId = $iblockSection->Add($arFields, true);
             CIntranetTasks::InstallDefaultViews($taskType, $ownerId);
         }
         $db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("intranet", "CIntranetTasksDocument", "x" . $iblockId)), false, false, array("ID"));
         //			while ($ar = $db->Fetch())
         //			{
         //				try
         //				{
         //					CBPWorkflowTemplateLoader::Delete($ar["ID"]);
         //				}
         //				catch(Exception $e)
         //				{
         //					CBPWorkflowTemplateLoader::Update($ar["ID"], array("AUTO_EXECUTE" => 0));
         //				}
         //			}
         $workflowTemplateId = 0;
         if ($ar = $db->Fetch()) {
             $workflowTemplateId = $ar["ID"];
         } else {
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/classes/general/tasks_wf_template.php";
             $workflowTemplateId = CBPWorkflowTemplateLoader::Add($arFields);
         }
         $arTaskStatusTmp = array();
         $arTaskStatusTmpAlt = array();
         $dbRes = CIBlockProperty::GetPropertyEnum("TaskStatus", array("SORT" => "ASC"), array("IBLOCK_ID" => $iblockId));
         while ($arRes = $dbRes->Fetch()) {
             $arTaskStatusTmp[StrToUpper($arRes["XML_ID"])] = $arRes["ID"];
             $arTaskStatusTmpAlt[$arRes["ID"]] = $arRes["XML_ID"];
         }
         $dbResult = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockId, "INCLUDE_SUBSECTIONS" => "Y", "!PROPERTY_TASKVERSION" => 2), false, false, array("ID", "PROPERTY_TASKSTATUS", "PROPERTY_TASKASSIGNEDTO", "IBLOCK_SECTION_ID"));
         if ($arResult = $dbResult->Fetch()) {
             $arOldTasksWFs = array();
             $arOldTasksSTs = array();
             require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/classes/general/tasks_wf_template1.php";
             $arOldTasksWFsTmp = array();
             foreach ($arOldTasksWFs as $t1 => $t2) {
                 if (array_key_exists($t1, $arTaskStatusTmp)) {
                     $arOldTasksWFsTmp[$arTaskStatusTmp[$t1]] = $t2;
                 }
             }
             $arOldTasksSTsTmp = array();
             foreach ($arOldTasksSTs as $t1 => $t2) {
                 if (array_key_exists($t1, $arTaskStatusTmp)) {
                     $arOldTasksSTsTmp[$arTaskStatusTmp[$t1]] = $t2;
                 }
             }
             do {
                 $taskTypeTmp = "";
                 $ownerIdTmp = "";
                 $v = CIntranetTasks::PrepareSectionForPrint($arResult["IBLOCK_SECTION_ID"]);
                 foreach ($v as $k1 => $v1) {
                     $taskTypeTmp = $v1["XML_ID"] == "users_tasks" ? "user" : "group";
                     $ownerIdTmp = $taskTypeTmp == "user" ? $arResult["PROPERTY_TASKASSIGNEDTO_VALUE"] : $v1["XML_ID"];
                     break;
                 }
                 if ($taskTypeTmp == "group") {
                     $pathTemplate = str_replace(array("#GROUP_ID#", "#TASK_ID#"), array($ownerIdTmp, "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_group_entry", "/workgroups/group/#GROUP_ID#/tasks/task/view/#TASK_ID#/"));
                 } else {
                     $pathTemplate = str_replace(array("#USER_ID#", "#TASK_ID#"), array($ownerIdTmp, "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_user_entry", "/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/"));
                 }
                 $pathTemplate = str_replace('#HTTP_HOST#', $_SERVER['HTTP_HOST'], "http://#HTTP_HOST#" . $pathTemplate);
                 $workflowId = uniqid("", true);
                 if (array_key_exists($arResult["PROPERTY_TASKSTATUS_ENUM_ID"], $arOldTasksWFsTmp)) {
                     $v = $arOldTasksWFsTmp[$arResult["PROPERTY_TASKSTATUS_ENUM_ID"]];
                     $v = str_replace(array("#TPT_TASK_ID_LEN#", "#TPT_TASK_ID#", "#TPT_WORKFLOW_ID_LEN#", "#TPT_WORKFLOW_ID#", "#TPT_DOCUMENT_LEN1#", "#TPT_DOCUMENT_LEN2#", "#TPT_DOCUMENT_LEN3#", "#TPT_DOCUMENT_ROOT#", "#TPT_OWNER_ID#", "#TPT_TASK_TYPE_LEN#", "#TPT_TASK_TYPE#", "#TPT_PATH_TEMPLATE_LEN#", "#TPT_PATH_TEMPLATE#", "#TPT_FORUM_ID#", "#TPT_IBLOCKID_ID#"), array(strlen($arResult["ID"]), $arResult["ID"], strlen($workflowId), $workflowId, 25 + strlen($_SERVER["DOCUMENT_ROOT"]), 25 + strlen($_SERVER["DOCUMENT_ROOT"]), 34 + strlen($_SERVER["DOCUMENT_ROOT"]), $_SERVER["DOCUMENT_ROOT"], $ownerIdTmp, strlen($taskTypeTmp), $taskTypeTmp, strlen($pathTemplate), $pathTemplate, $forumId, $iblockId), $v);
                     CBPWorkflowPersister::__InsertWorkflowHack($workflowId, $v);
                 }
                 if (array_key_exists($arResult["PROPERTY_TASKSTATUS_ENUM_ID"], $arOldTasksSTsTmp)) {
                     CBPStateService::__InsertStateHack($workflowId, "intranet", "CIntranetTasksDocument", $arResult["ID"], $workflowTemplateId, $arOldTasksSTsTmp[$arResult["PROPERTY_TASKSTATUS_ENUM_ID"]]["STATE"], $arOldTasksSTsTmp[$arResult["PROPERTY_TASKSTATUS_ENUM_ID"]]["STATE_TITLE"], $arOldTasksSTsTmp[$arResult["PROPERTY_TASKSTATUS_ENUM_ID"]]["PARAMS"], $arOldTasksSTsTmp[$arResult["PROPERTY_TASKSTATUS_ENUM_ID"]]["PERMS"]);
                 } else {
                     CBPStateService::__InsertStateHack($workflowId, "intranet", "CIntranetTasksDocument", $arResult["ID"], $workflowTemplateId, $arOldTasksSTs["COMPLETED"]["STATE"], $arOldTasksSTs["COMPLETED"]["STATE_TITLE"], $arOldTasksSTs["COMPLETED"]["PARAMS"], $arOldTasksSTs["COMPLETED"]["PERMS"]);
                 }
                 CIBlockElement::SetPropertyValues($arResult["ID"], $iblockId, 2, "TASKVERSION");
             } while ($arResult = $dbResult->Fetch());
         }
         $arTasksConverted2BP[$keyTasksConverted2BP] = $globalParentSectionId;
         $CACHE_MANAGER->Clean("IntranetTasksConverted2BP");
         $CACHE_MANAGER->Read(2592000, "IntranetTasksConverted2BP");
         $CACHE_MANAGER->Set("IntranetTasksConverted2BP", $arTasksConverted2BP);
     }
     return $globalParentSectionId;
 }
Esempio n. 12
0
<?
	if(count($error) > 0)
	{
		echo CAdminMessage::ShowMessage(array(
			"MESSAGE" 			=> $error['message'],
			"DETAILS" 			=> "#PROGRESS_BAR#",
			"HTML" 				=> true,
			"TYPE" 				=> "PROGRESS",
			"PROGRESS_TOTAL" 	=> 100,
			"PROGRESS_VALUE" 	=> $error['progress'],
		));
	}
	else
	{
		echo '<ul class="pr_sortable">';
		$PROPS_ESTATE 	= CIBlock::GetProperties($RECRM->getIBId('estate'), Array('SORT'=>'ASC'), Array());
		while ($P = $PROPS_ESTATE->Fetch())
		{
			echo '
			<li id="'.$P['ID'].'">
			'.GetMessage("PR_RECRM_PROPS_NAME").': <input type="text" name="IB_P_NAME['.$P['ID'].']" value="'.htmlspecialcharsEx($P['NAME']).'"/>
			'.GetMessage("PR_RECRM_PROPS_HINT").': <input type="text" name="IB_P_HINT['.$P['ID'].']" value="'.htmlspecialcharsEx($P['HINT']).'"/>
			'.GetMessage("PR_RECRM_PROPS_SORT").': <input type="text" name="IB_P_SORT['.$P['ID'].']" class="s_sort" value="'.intval($P['SORT']).'" style="width: 20px"/>
			</li>';
		}
		echo '</ul>';
	}
?>

<?
/* Tab Cron */
Esempio n. 13
0
while ($arFields = $rsGroup->GetNext())
{
	$arModGroups[] = array(
		"ID" => $arFields['ID'],
		"REFERENCE" => $arFields['REFERENCE'],
		"SELECTED" => in_array($arFields['ID'], $arGroups) ? "selected" : "",
	);
}

$restGroup = COption::GetOptionString($MODULE_ID, 'restricted_property');
$rsIblock = CIBlock::GetList(array(), array());
$arPropsRes = array();

while ($arIblock = $rsIblock->GetNext())
{
	$resProp = CIBlock::GetProperties($arIblock["ID"], array(), array("PROPERTY_TYPE" => "L"));
	while ($arProp = $resProp->GetNext())
	{
		$arPropsRes[] = array(
			"CODE" => $arProp["CODE"],
			"NAME" => $arProp["NAME"],
			"SELECTED" => ($restGroup == $arProp["CODE"]) ? "selected" : ""
		);
	}
}
?>

<form method="post" enctype="multipart/form-data" action="<?php 
echo $APPLICATION->GetCurPage();
?>
?mid=<?php 
Esempio n. 14
0
	public function getIBAllProps($type = '')
	{
		$ARR 	= array();
		$IB_ID 	= $this->getIBId($type);
		$PROPS 	= CIBlock::GetProperties($IB_ID, Array('SORT'=>'ASC'), Array());
		while ($PROP = $PROPS->Fetch())
		{
			$ARR[] = $PROP['CODE'];
		}
		return $ARR;
	}
Esempio n. 15
0
     }
     $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
     if (!($db_res && ($res = $db_res->Fetch()))) {
         $arPropertiesNeed[] = $key;
     }
 }
 if (!empty($arPropertiesNeed)) {
     $obProperty = new CIBlockProperty();
     foreach ($arPropertiesNeed as $Property) {
         $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($Property))) > 0 ? GetMessage("P_" . strToUpper($Property)) : strToUpper($Property), "CODE" => strToUpper($Property), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg"));
     }
 }
 // Check Public property
 $arPropertiesNeed = array();
 foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) {
     $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
     if (!$db_res || !($res = $db_res->Fetch())) {
         $arPropertiesNeed[] = $key;
     }
 }
 if (!empty($arPropertiesNeed)) {
     $obProperty = new CIBlockProperty();
     foreach ($arPropertiesNeed as $Property) {
         $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($Property))) > 0 ? GetMessage("P_" . $Property) : $Property, "DEFAULT_VALUE" => "N", "CODE" => $Property));
     }
 }
 // Additional properties
 /*		$arPropertiesNeed = array();
 		foreach (array("EXIF") as $key): 
 			$db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
 			if (!$db_res || !($res = $db_res->Fetch())):
Esempio n. 16
0
 $priceMin = 0;
 $arItems = $arViewed[$arElements["ID"]];
 $arItems["IBLOCK_ID"] = $arElements["IBLOCK_ID"];
 if (!is_set($arCacheOffersIblock[$arElements["IBLOCK_ID"]])) {
     $mxResult = CCatalogSKU::GetInfoByProductIBlock($arElements["IBLOCK_ID"]);
     if (is_array($mxResult)) {
         $arOffersIblock["OFFERS_IBLOCK_ID"] = $mxResult["IBLOCK_ID"];
         $arCacheOffersIblock[$arElements["IBLOCK_ID"]] = $arOffersIblock;
     }
 } else {
     $arOffersIblock = $arCacheOffersIblock[$arElements["IBLOCK_ID"]];
 }
 if (IntVal($arOffersIblock["OFFERS_IBLOCK_ID"]) > 0) {
     static $arCacheOfferProperties = array();
     if (!is_set($arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]])) {
         $dbOfferProperties = CIBlock::GetProperties($arOffersIblock["OFFERS_IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
         while ($arOfferProperties = $dbOfferProperties->Fetch()) {
             $arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]][] = $arOfferProperties["CODE"];
         }
     }
     $arIblockOfferPropsFilter = $arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]];
     $arIblockOfferProps = array();
     $arIblockOfferPropsFilter = array();
     foreach ($arIblockOfferPropsFilter as $val) {
         $arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
         $arIblockOfferPropsFilter[] = $val["CODE"];
     }
     static $arCacheResultPrices = array();
     if (!is_set($arCacheResultPrices[$arElements["IBLOCK_ID"]])) {
         $dbPriceType = CCatalogGroup::GetList(array(), array('NAME_LANG' => $arItems['NOTES'], 'CAN_BUY' => 'Y'), false, false, array('NAME', 'ID'));
         $arPriceType = $dbPriceType->Fetch();
Esempio n. 17
0
         $arViews['PRODUCT_ID'] = $arProduct["ID"];
         $arViews['MODULE'] = "catalog";
         $arViews["LID"] = $LID;
     }
 } else {
     $dbViewsList = CSaleViewedProduct::GetList(array(), array("FUSER_ID" => $arFuserItems["ID"], "PRODUCT_ID" => $PRODUCT_ID), false, false);
     $arViews = $dbViewsList->Fetch();
 }
 if (strlen($viewedError) <= 0) {
     $arFields = array("PROPS" => array());
     $arParentSku = CCatalogSku::GetProductInfo($PRODUCT_ID);
     if ($arParentSku && count($arParentSku) > 0) {
         $arPropsSku = array();
         $dbProduct = CIBlockElement::GetList(array(), array("ID" => $PRODUCT_ID), false, false, array('IBLOCK_ID'));
         $arProduct = $dbProduct->Fetch();
         $dbOfferProperties = CIBlock::GetProperties($arProduct["IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
         while ($arOfferProperties = $dbOfferProperties->Fetch()) {
             $arPropsSku[] = $arOfferProperties["CODE"];
         }
         $arFields["PROPS"] = CIBlockPriceTools::GetOfferProperties($PRODUCT_ID, $arParentSku["IBLOCK_ID"], $arPropsSku);
     }
     $arFields["USER_ID"] = $ID;
     $arFields["PRODUCT_ID"] = $PRODUCT_ID;
     $arFields["PRICE"] = $arViews["PRICE"];
     $arFields["CURRENCY"] = $arViews["CURRENCY"];
     $arFields["QUANTITY"] = 1;
     $arFields["LID"] = $arViews["LID"];
     $arFields["DETAIL_PAGE_URL"] = $arViews["DETAIL_PAGE_URL"];
     $arFields["NAME"] = $arViews["NAME"];
     $arFields["CAN_BUY"] = "Y";
     $arFields["TYPE"] = $arViews["TYPE"];
Esempio n. 18
0
 /**
  * get sku for product.
  *
  * @param integer $USER_ID				User.
  * @param string  $LID					Site.
  * @param integer $PRODUCT_ID			Product id.
  * @param string  $PRODUCT_NAME			Product name.
  * @param string CURRENCY				Currency.
  * @param array $arProduct				Iblock list.
  * @return array|false
  */
 function GetProductSku($USER_ID, $LID, $PRODUCT_ID, $PRODUCT_NAME = '', $CURRENCY = '', $arProduct = array())
 {
     $USER_ID = (int) $USER_ID;
     $PRODUCT_ID = (int) $PRODUCT_ID;
     if ($PRODUCT_ID <= 0) {
         return false;
     }
     $LID = trim($LID);
     if ($LID == '') {
         return false;
     }
     $PRODUCT_NAME = trim($PRODUCT_NAME);
     $arResult = array();
     $arOffers = array();
     static $arCacheGroups = array();
     if (!is_set($arCacheGroups[$USER_ID])) {
         $arCacheGroups[$USER_ID] = CUser::GetUserGroup($USER_ID);
     }
     $arGroups = $arCacheGroups[$USER_ID];
     if (empty($arProduct)) {
         $arProduct = CSaleProduct::GetProductListIblockInfo(array($PRODUCT_ID));
     }
     static $arOffersIblock = array();
     if (!is_set($arOffersIblock[$arProduct["IBLOCK_ID"]])) {
         $mxResult = CCatalogSKU::GetInfoByProductIBlock($arProduct["IBLOCK_ID"]);
         if (is_array($mxResult)) {
             $arOffersIblock[$arProduct["IBLOCK_ID"]] = $mxResult["IBLOCK_ID"];
         }
     }
     if ($arOffersIblock[$arProduct["IBLOCK_ID"]] > 0) {
         static $arCacheOfferProperties = array();
         if (!is_set($arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]])) {
             $dbOfferProperties = CIBlock::GetProperties($arOffersIblock[$arProduct["IBLOCK_ID"]], array(), array("!XML_ID" => "CML2_LINK"));
             while ($arOfferProperties = $dbOfferProperties->Fetch()) {
                 $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]][] = $arOfferProperties;
             }
         }
         $arOfferProperties = $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]];
         $arIblockOfferProps = array();
         $arIblockOfferPropsFilter = array();
         if (is_array($arOfferProperties)) {
             foreach ($arOfferProperties as $val) {
                 $arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
                 $arIblockOfferPropsFilter[] = $val["CODE"];
             }
         }
         $arOffers = CIBlockPriceTools::GetOffersArray($arProduct["IBLOCK_ID"], $PRODUCT_ID, array("ID" => "DESC"), array("NAME"), $arIblockOfferPropsFilter, 0, array(), 1, array(), $USER_ID, $LID);
         $arSku = array();
         $minItemPrice = 0;
         $minItemPriceFormat = "";
         $arSkuId = array();
         $arImgSku = array();
         foreach ($arOffers as $arOffer) {
             $arSkuId[] = $arOffer['ID'];
         }
         if (!empty($arSkuId)) {
             $res = CIBlockElement::GetList(array(), array("ID" => $arSkuId), false, false, array("ID", "IBLOCK_ID", "NAME", "PREVIEW_PICTURE", "DETAIL_PICTURE", "DETAIL_PAGE_URL"));
             while ($arOfferImg = $res->GetNext()) {
                 $arImgSku[$arOfferImg["ID"]] = $arOfferImg;
             }
         }
         foreach ($arOffers as $arOffer) {
             $arPrice = CCatalogProduct::GetOptimalPrice($arOffer['ID'], 1, $arGroups, "N", array(), $LID);
             if (empty($arPrice)) {
                 break;
             } elseif (strlen($CURRENCY) > 0) {
                 $arPrice["PRICE"]["PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["PRICE"]["PRICE"], $arPrice["PRICE"]["CURRENCY"], $CURRENCY);
                 if ($arPrice["DISCOUNT_PRICE"] > 0) {
                     $arPrice["DISCOUNT_PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"], $CURRENCY);
                 }
                 $arPrice["PRICE"]["CURRENCY"] = $CURRENCY;
             }
             $arSkuTmp = array();
             $arOffer["CAN_BUY"] = "N";
             $arCatalogProduct = CCatalogProduct::GetByID($arOffer['ID']);
             if (!empty($arCatalogProduct)) {
                 if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) {
                     $arOffer["CAN_BUY"] = "N";
                 } else {
                     $arOffer["CAN_BUY"] = "Y";
                 }
             }
             $arSkuTmp["ImageUrl"] = '';
             if ($arOffer["CAN_BUY"] == "Y") {
                 $productImg = "";
                 if (isset($arImgSku[$arOffer['ID']]) && !empty($arImgSku[$arOffer['ID']])) {
                     if ('' == $PRODUCT_NAME) {
                         $PRODUCT_NAME = $arImgSku[$arOffer['ID']]["~NAME"];
                     }
                     if ($arImgSku[$arOffer['ID']]["PREVIEW_PICTURE"] != "") {
                         $productImg = $arImgSku[$arOffer['ID']]["PREVIEW_PICTURE"];
                     } elseif ($arImgSku[$arOffer['ID']]["DETAIL_PICTURE"] != "") {
                         $productImg = $arImgSku[$arOffer['ID']]["DETAIL_PICTURE"];
                     }
                     if ($productImg == "") {
                         if ($arProduct["PREVIEW_PICTURE"] != "") {
                             $productImg = $arProduct["PREVIEW_PICTURE"];
                         } elseif ($arProduct["DETAIL_PICTURE"] != "") {
                             $productImg = $arProduct["DETAIL_PICTURE"];
                         }
                     }
                     if ($productImg != "") {
                         $arFile = CFile::GetFileArray($productImg);
                         $productImg = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
                         $arSkuTmp["ImageUrl"] = $productImg["src"];
                     }
                 }
             }
             if ($minItemPrice === 0 || $arPrice["DISCOUNT_PRICE"] < $minItemPrice) {
                 $minItemPrice = $arPrice["DISCOUNT_PRICE"];
                 $minItemPriceFormat = SaleFormatCurrency($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"]);
             }
             foreach ($arIblockOfferProps as $arCode) {
                 if (array_key_exists($arCode["CODE"], $arOffer["PROPERTIES"])) {
                     if (is_array($arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"])) {
                         $arSkuTmp[] = implode("/", $arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"]);
                     } else {
                         $arSkuTmp[] = $arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"];
                     }
                 }
             }
             if (!empty($arCatalogProduct)) {
                 $arSkuTmp["BALANCE"] = $arCatalogProduct["QUANTITY"];
                 $arSkuTmp["WEIGHT"] = $arCatalogProduct["WEIGHT"];
                 $arSkuTmp["BARCODE_MULTI"] = $arCatalogProduct["BARCODE_MULTI"];
             } else {
                 $arSkuTmp["BALANCE"] = 0;
                 $arSkuTmp["WEIGHT"] = 0;
                 $arSkuTmp["BARCODE_MULTI"] = 'N';
             }
             $urlEdit = CIBlock::GetAdminElementEditLink($arOffer["IBLOCK_ID"], $arOffer['ID'], array('find_section_section' => 0, 'WF' => 'Y'));
             $discountPercent = 0;
             $arSkuTmp["USER_ID"] = $USER_ID;
             $arSkuTmp["ID"] = $arOffer["ID"];
             $arSkuTmp["NAME"] = CUtil::JSEscape($arOffer["NAME"]);
             $arSkuTmp["PRODUCT_NAME"] = CUtil::JSEscape($PRODUCT_NAME);
             $arSkuTmp["PRODUCT_ID"] = $PRODUCT_ID;
             $arSkuTmp["LID"] = CUtil::JSEscape($LID);
             $arSkuTmp["MIN_PRICE"] = $minItemPriceFormat;
             $arSkuTmp["URL_EDIT"] = $urlEdit;
             $arSkuTmp["DISCOUNT_PRICE"] = '';
             $arSkuTmp["DISCOUNT_PRICE_FORMATED"] = '';
             $arSkuTmp["PRICE"] = $arPrice["PRICE"]["PRICE"];
             $arSkuTmp["PRICE_FORMATED"] = CCurrencyLang::CurrencyFormat($arPrice["PRICE"]["PRICE"], $arPrice["PRICE"]["CURRENCY"], false);
             $arPriceType = GetCatalogGroup($arPrice["PRICE"]["CATALOG_GROUP_ID"]);
             $arSkuTmp["PRICE_TYPE"] = $arPriceType["NAME_LANG"];
             $arSkuTmp["VAT_RATE"] = $arPrice["PRICE"]["VAT_RATE"];
             if (count($arPrice["DISCOUNT"]) > 0) {
                 $discountPercent = IntVal($arPrice["DISCOUNT"]["VALUE"]);
                 $arSkuTmp["DISCOUNT_PRICE"] = $arPrice["DISCOUNT_PRICE"];
                 $arSkuTmp["DISCOUNT_PRICE_FORMATED"] = CCurrencyLang::CurrencyFormat($arPrice["DISCOUNT_PRICE"], $arPrice["PRICE"]["CURRENCY"], false);
             }
             $arCurFormat = CCurrencyLang::GetCurrencyFormat($arPrice["PRICE"]["CURRENCY"]);
             $arSkuTmp["VALUTA_FORMAT"] = str_replace("#", '', $arCurFormat["FORMAT_STRING"]);
             $arSkuTmp["DISCOUNT_PERCENT"] = $discountPercent;
             $arSkuTmp["CURRENCY"] = $arPrice["PRICE"]["CURRENCY"];
             $arSkuTmp["CAN_BUY"] = $arOffer["CAN_BUY"];
             $arSku[] = $arSkuTmp;
         }
         if ((!is_array($arIblockOfferProps) || empty($arIblockOfferProps)) && is_array($arSku) && !empty($arSku)) {
             $arIblockOfferProps[0] = array("CODE" => "TITLE", "NAME" => GetMessage("SKU_TITLE"));
             foreach ($arSku as $key => $val) {
                 $arSku[$key][0] = $val["NAME"];
             }
         }
         $arResult["SKU_ELEMENTS"] = $arSku;
         $arResult["SKU_PROPERTIES"] = $arIblockOfferProps;
         $arResult["OFFERS_IBLOCK_ID"] = $arOffersIblock[$arProduct["IBLOCK_ID"]];
     }
     //if OFFERS_IBLOCK_ID > 0
     return $arResult;
 }
	public static function GetSetItems($productID, $intType, $arProducInfo = array())
	{
		$arProductId = array();
		$arSets = CCatalogProductSet::getAllSetsByProduct($productID, $intType);

		if (is_array($arSets))
		{
			foreach ($arSets as $k => $arSet)
			{
				foreach ($arSet["ITEMS"] as $k1 => $item)
				{
					$arItem = self::GetProductData(array("PRODUCT_ID" => $item["ITEM_ID"], "QUANTITY" => $item["QUANTITY"], "CHECK_QUANTITY" => "N", "CHECK_PRICE" => "N"));

					$arItem["PRODUCT_ID"] = $item["ITEM_ID"];
					$arItem["MODULE"] = "catalog";
					$arItem["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
					if ($intType == CCatalogProductSet::TYPE_SET)
					{
						$arItem['SET_DISCOUNT_PERCENT'] = ($item['DISCOUNT_PERCENT'] == '' ? false : (float)$item['DISCOUNT_PERCENT']);
					}

					$arProductId[] = $item["ITEM_ID"];

					$arItem["PROPS"] = array();
					$arParentSku = CCatalogSku::GetProductInfo($item["ITEM_ID"]);
					if (!empty($arParentSku))
					{
						$arPropsSku = array();

						$dbProduct = CIBlockElement::GetList(array(), array("ID" => $item["ITEM_ID"]), false, false, array('IBLOCK_ID', 'IBLOCK_SECTION_ID'));
						$arProduct = $dbProduct->Fetch();

						$dbOfferProperties = CIBlock::GetProperties($arProduct["IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
						while($arOfferProperties = $dbOfferProperties->Fetch())
							$arPropsSku[] = $arOfferProperties["CODE"];

						$product_properties = CIBlockPriceTools::GetOfferProperties(
							$item["ITEM_ID"],
							$arParentSku["IBLOCK_ID"],
							$arPropsSku
						);

						foreach ($product_properties as $propData)
						{
							$arItem["PROPS"][] = array(
								"NAME" => $propData["NAME"],
								"CODE" => $propData["CODE"],
								"VALUE" => $propData["VALUE"],
								"SORT" => $propData["SORT"]
							);
						}
					}

					$arSets[$k]["ITEMS"][$k1] = array_merge($item, $arItem);
				}
			}

			$rsProducts = CIBlockElement::GetList(
				array(),
				array('ID' => $arProductId),
				false,
				false,
				array("ID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "PREVIEW_PICTURE", "DETAIL_PICTURE", "IBLOCK_TYPE_ID", "XML_ID")
			);
			while ($arProduct = $rsProducts->GetNext())
			{
				foreach ($arSets as $k => $arSet)
				{
					foreach ($arSet["ITEMS"] as $k1 => $item)
					{
						if ($item["ITEM_ID"] == $arProduct["ID"])
						{
							$arProps = array();
							$strIBlockXmlID = strval(CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID'));
							if ($strIBlockXmlID != "")
							{
								$arProps[] = array(
									"NAME" => "Catalog XML_ID",
									"CODE" => "CATALOG.XML_ID",
									"VALUE" => $strIBlockXmlID
								);
							}

							$arProps[] = array(
								"NAME" => "Product XML_ID",
								"CODE" => "PRODUCT.XML_ID",
								"VALUE" => $arProduct["XML_ID"]
							);

							$arSets["$k"]["ITEMS"][$k1]["IBLOCK_ID"] = $arProduct["IBLOCK_ID"];
							$arSets["$k"]["ITEMS"][$k1]["IBLOCK_SECTION_ID"] = $arProduct["IBLOCK_SECTION_ID"];
							$arSets["$k"]["ITEMS"][$k1]["PREVIEW_PICTURE"] = $arProduct["PREVIEW_PICTURE"];
							$arSets["$k"]["ITEMS"][$k1]["DETAIL_PICTURE"] = $arProduct["DETAIL_PICTURE"];
							$arSets["$k"]["ITEMS"][$k1]["PROPS"] = array_merge($arSets["$k"]["ITEMS"][$k1]["PROPS"], $arProps);
						}
					}
				}
			}
		}

		foreach(GetModuleEvents("sale", "OnGetSetItems", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$arSets));

		return $arSets;
	}
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$curSkuView = COption::GetOptionString("eshop", "catalogDetailSku", "select", SITE_ID);
if (is_array($arResult["OFFERS"]) && !empty($arResult["OFFERS"])) {
    $pricesCount = count($arResult["CAT_PRICES"]);
    $arOffersIblock = CIBlockPriceTools::GetOffersIBlock($arResult["IBLOCK_ID"]);
    $OFFERS_IBLOCK_ID = is_array($arOffersIblock) ? $arOffersIblock["OFFERS_IBLOCK_ID"] : 0;
    $dbOfferProperties = CIBlock::GetProperties($OFFERS_IBLOCK_ID, array(), array("!XML_ID" => "CML2_LINK"));
    $arIblockOfferProps = array();
    $offerPropsExists = false;
    while ($arOfferProperties = $dbOfferProperties->Fetch()) {
        if (!in_array($arOfferProperties["CODE"], $arParams["OFFERS_PROPERTY_CODE"])) {
            continue;
        }
        $arIblockOfferProps[] = array("CODE" => $arOfferProperties["CODE"], "NAME" => $arOfferProperties["NAME"]);
        $offerPropsExists = true;
    }
    foreach ($arIblockOfferProps as $key => $arCode) {
        $emptyProp = true;
        foreach ($arResult["OFFERS"] as $key2 => $arOffer) {
            if (array_key_exists($arCode["CODE"], $arOffer["PROPERTIES"]) && !empty($arOffer["PROPERTIES"][$arCode["CODE"]]["VALUE"])) {
                $emptyProp = false;
            }
        }
        if ($emptyProp) {
            unset($arIblockOfferProps[$key]);
        }
    }
Esempio n. 21
0
 function __Init()
 {
     if (!$this->bInited) {
         $this->bInited = true;
         $this->error = null;
         if (CModule::IncludeModule('extranet') && defined("IS_EXTRANET") && IS_EXTRANET == "Y") {
             $CurrentSiteID = CExtranet::GetExtranetSiteID();
         } else {
             $CurrentSiteID = false;
         }
         if (!($this->IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_tasks', false, $CurrentSiteID))) {
             $this->error = new CSoapFault('Server error', 'iblock_tasks not set');
         } else {
             if (!$this->__checkIBlockRights()) {
                 $this->error = new CSoapFault('Access denied', '');
             } else {
                 $dbRes = CIBlock::GetProperties($this->IBLOCK_ID);
                 while ($arProperty = $dbRes->Fetch()) {
                     if ($arProperty['PROPERTY_TYPE'] == 'L') {
                         $arProperty['VARIANTS_ID'] = array();
                         $arProperty['VARIANTS'] = array();
                         $dbRes1 = CIBlockProperty::GetPropertyEnum($arProperty['ID']);
                         while ($arRes = $dbRes1->Fetch()) {
                             $arProperty['VARIANTS_ID'][$arRes['ID']] = trim($arRes['VALUE']);
                             $arProperty['VARIANTS'][$arRes['XML_ID']] = trim($arRes['VALUE']);
                         }
                     }
                     $this->arProperties[$arProperty['CODE']] = $arProperty;
                 }
                 $dbRes = CIBlockSection::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => $this->IBLOCK_ID, 'XML_ID' => 'users_tasks'));
                 if (!($this->arUsersSection = $dbRes->Fetch())) {
                     $this->error = new CSoapFault('Server error', 'users tasks section is not found');
                 }
             }
         }
     }
     return null === $this->error;
 }
Esempio n. 22
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
ini_set('display_errors', 1);
require_once $_SERVER["DOCUMENT_ROOT"] . "/service/contract/c_search_form.php";
global $APPLICATION;
$arShowFields = array("client_full_name", "client_short_name", "client_region", "client_town", "client_inn");
CModule::IncludeModule('iblock');
$res = CIBlock::GetProperties(22, array(), array("ID" => $_REQUEST["show"]));
if ($res_arr = $res->Fetch()) {
    $SrcPropID = $res_arr["CODE"];
} else {
    $SrcPropID = "client_inn";
}
try {
    echo ChoiceForm::HtmlForm(22, $arShowFields, $SrcPropID);
} catch (Exception $e) {
    echo $e->getMessage();
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
Esempio n. 23
0
                                    foreach ($iblockPropertiesName as $key => $prop) {
                                        $oldPropertySKU[$key] = $IBLOCK_PROPERTY_SKU[$iblock['ID']][$key];
                                    }
                                }

                                $oldPropertyUnitSKU = null;
                                if (isset($IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']])) {
                                    foreach ($iblockPropertiesName as $key => $prop) {
                                        $oldPropertyUnitSKU[$key] = $IBLOCK_PROPERTY_UNIT_SKU[$iblock['ID']][$key];
                                    }
                                }
                            }


                            $propertiesProduct = null;
                            $db_properties = CIBlock::GetProperties($iblock['ID'], Array());
                            while($prop = $db_properties->Fetch())
                                $propertiesProduct[] = $prop;

                            $oldPropertyProduct = null;
                            if (isset($IBLOCK_PROPERTY_PRODUCT[$iblock['ID']])) {
                                foreach ($iblockPropertiesName as $key => $prop) {
                                    $oldPropertyProduct[$key] = $IBLOCK_PROPERTY_PRODUCT[$iblock['ID']][$key];
                                }
                            }

                            $oldPropertyUnitProduct = null;
                            if (isset($IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']])) {
                                foreach ($iblockPropertiesName as $key => $prop) {
                                    $oldPropertyUnitProduct[$key] = $IBLOCK_PROPERTY_UNIT_PRODUCT[$iblock['ID']][$key];
                                }