$html = '<table id="tbl' . $propID . '">'; foreach ($defaultValue as $key => $value) { $html .= '<tr><td>'; $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $propID, $value['VALUE']); $obFileControl = new CCrmProductFileControl($obFile, $propID . '[' . $key . '][VALUE]'); $html .= $obFileControl->GetHTML(array('max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['~PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_FILE_ENLARGE'), 'download_text' => GetMessage('CRM_PRODUCT_FILE_DOWNLOAD'))); $html .= '</td></tr>'; } $html .= '</table>'; $html .= '<input type="button" onclick="addNewTableRow(\'tbl' . $propID . '\', 1, /' . $propID . '\\[(n)([0-9]*)\\]/g, 2)" value="' . GetMessage('CRM_PRODUCT_PROP_ADD_BUTTON') . '">'; $arResult['PRODUCT_CREATE_DLG_SETTINGS']['messages'][$propID] = $arProp['NAME']; $arResult['PRODUCT_CREATE_DLG_SETTINGS']['fields'][] = array('textCode' => $propID, 'type' => 'custom', 'value' => $html, 'skip' => $skip ? 'Y' : 'N', 'required' => $arProp['IS_REQUIRED'] == 'Y' ? 'Y' : 'N'); } else { foreach ($defaultValue as $key => $value) { $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $propID, $value['VALUE']); $obFileControl = new CCrmProductFileControl($obFile, $propID . '[' . $key . '][VALUE]'); $html = $obFileControl->GetHTML(array('max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['~PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_FILE_ENLARGE'), 'download_text' => GetMessage('CRM_PRODUCT_FILE_DOWNLOAD'))); $arResult['PRODUCT_CREATE_DLG_SETTINGS']['messages'][$propID] = $arProp['NAME']; $arResult['PRODUCT_CREATE_DLG_SETTINGS']['fields'][] = array('textCode' => $propID, 'type' => 'custom', 'value' => $html, 'skip' => $skip ? 'Y' : 'N', 'required' => $arProp['IS_REQUIRED'] == 'Y' ? 'Y' : 'N'); } } } else { if ($arProp['PROPERTY_TYPE'] == 'G') { } else { if ($arProp['PROPERTY_TYPE'] == 'E') { if ($arProp['IS_REQUIRED'] == 'Y') { $items = array(); } else { $items = array('' => GetMessage('CRM_PRODUCT_PROP_NO_VALUE')); } $rsElements = CIBlockElement::GetList(array('NAME' => 'ASC'), array('IBLOCK_ID' => $arProp['LINK_IBLOCK_ID']), false, false, array('ID', 'NAME'));
if ($productSectionID > 0) { $sectionListItems = array(); $rsSection = CIBlockSection::GetByID($productSectionID); if ($arSection = $rsSection->Fetch()) { $productSectionName = $arSection['NAME']; } } $arResult['FIELDS']['tab_1'][] = array('id' => 'SECTION', 'name' => GetMessage('CRM_FIELD_SECTION'), 'type' => 'label', 'value' => htmlspecialcharsbx(empty($productSectionName) ? GetMessage('CRM_SECTION_NOT_SELECTED') : $productSectionName), 'isTactile' => true); $arResult['FIELDS']['tab_1'][] = array('id' => 'SORT', 'name' => GetMessage('CRM_FIELD_SORT'), 'type' => 'label', 'params' => array(), 'value' => isset($product['SORT']) ? $product['SORT'] : '', 'isTactile' => true); $arFields = array('PREVIEW_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_PREVIEW_PICTURE'), 'DETAIL_PICTURE' => GetMessage('CRM_PRODUCT_FIELD_DETAIL_PICTURE')); $html = ''; $obFileControl = $obFile = null; foreach ($arFields as $fieldID => $fieldName) { if (isset($product['~' . $fieldID])) { $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $fieldID, $product['~' . $fieldID]); $obFileControl = new CCrmProductFileControl($obFile, $fieldID); $html = '<nobr>' . $obFileControl->GetHTML(array('show_input' => false, 'max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_PROP_ENLARGE'), 'download_text' => GetMessage("CRM_PRODUCT_PROP_DOWNLOAD"))) . '</nobr>'; $arResult['FIELDS']['tab_1'][] = array('id' => $fieldID, 'name' => $fieldName, 'type' => 'custom', 'value' => $html, 'isTactile' => true); } } unset($arFields, $fieldID, $fieldName, $obFile, $obFileControl, $html); /*if($FIELD_ID == "PREVIEW_PICTURE" || $FIELD_ID == "DETAIL_PICTURE") { $obFile = new CListFile( $arResult["IBLOCK_ID"], 0, //section_id $arRow["data"]["ID"], $FIELD_ID, $value ); $obFile->SetSocnetGroup($arParams["SOCNET_GROUP_ID"]);
IncludeModuleLangFile(__FILE__); $arArrays = array(); $arElements = array(); $arSections = array(); foreach ($arResult['PROPERTY_VALUES'] as $propID => $propValue) { $arProp = $arResult['PROPS'][$propID]; if ($arProp['PROPERTY_TYPE'] == 'F') { if (is_array($propValue)) { foreach ($propValue as $valueKey => $file) { $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $propID, $file); $obFileControl = new CCrmProductFileControl($obFile, $propID); $propValue[$valueKey] = '<nobr>' . $obFileControl->GetHTML(array('show_input' => false, 'max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_PROP_ENLARGE'), 'download_text' => GetMessage('CRM_PRODUCT_PROP_DOWNLOAD'))) . '</nobr>'; } } else { $obFile = new CCrmProductFile($arResult['PRODUCT_ID'], $propID, $propValue); $obFileControl = new CCrmProductFileControl($obFile, $propID); $propValue = '<nobr>' . $obFileControl->GetHTML(array('show_input' => false, 'max_size' => 102400, 'max_width' => 150, 'max_height' => 150, 'url_template' => $arParams['PATH_TO_PRODUCT_FILE'], 'a_title' => GetMessage('CRM_PRODUCT_PROP_ENLARGE'), 'download_text' => GetMessage('CRM_PRODUCT_PROP_DOWNLOAD'))) . '</nobr>'; } } else { if ($arProp['PROPERTY_TYPE'] == 'E') { if (is_array($propValue)) { foreach ($propValue as $valueKey => $id) { if ($id > 0) { $arElements[] =& $arResult['PROPERTY_VALUES'][$propID][$valueKey]; } } $arArrays[$propID] =& $arResult['PROPERTY_VALUES'][$propID]; } else { if ($propValue > 0) { $arElements[] =& $arResult['PROPERTY_VALUES'][$propID]; }