function ___WDBPStartWorkflowParametersShow($templateId, $arWorkflowParameters, $bVarsFromForm, &$arFields) { $templateId = intval($templateId); if ($templateId <= 0) { return; } if (!isset($arWorkflowParameters) || !is_array($arWorkflowParameters)) { $arWorkflowParameters = array(); } $arParametersValues = array(); $keys = array_keys($arWorkflowParameters); foreach ($keys as $key) { $v = $bVarsFromForm ? $_REQUEST["bizproc" . $templateId . "_" . $key] : $arWorkflowParameters[$key]["Default"]; if (!is_array($v)) { $arParametersValues[$key] = htmlspecialcharsbx($v); } else { $keys1 = array_keys($v); foreach ($keys1 as $key1) { $arParametersValues[$key][$key1] = htmlspecialcharsbx($v[$key1]); } } } foreach ($arWorkflowParameters as $parameterKey => $arParameter) { $parameterKeyExt = "bizproc" . $templateId . "_" . $parameterKey; $sData = GetMessage("BPCGDOC_INVALID_TYPE"); switch ($arParameter["Type"]) { case "int": case "double": $sData = '<input type="text" name="' . $parameterKeyExt . '" size="10" value="' . $arParametersValues[$parameterKey] . '" />'; break; case "string": $sData = '<input type="text" name="' . $parameterKeyExt . '" size="50" value="' . $arParametersValues[$parameterKey] . '" />'; break; case "text": $sData = '<textarea name="' . $parameterKeyExt . '" rows="5" cols="40">' . $arParametersValues[$parameterKey] . '</textarea>'; break; case "select": $sData = '<select name="' . $parameterKeyExt . ($arParameter["Multiple"] ? '[]" size="5" multiple="multiple"' : '"') . '>'; if (is_array($arParameter["Options"]) && count($arParameter["Options"]) > 0) { foreach ($arParameter["Options"] as $key => $value) { $sData .= '<option value="' . $key . '"' . (!$arParameter["Multiple"] && $key == $arParametersValues[$parameterKey] || $arParameter["Multiple"] && is_array($arParametersValues[$parameterKey]) && in_array($key, $arParametersValues[$parameterKey]) ? ' selected="selected"' : '') . '>' . $value . '</option>'; } } $sData .= '</select>'; break; case "bool": $sData = '<select name="' . $parameterKeyExt . '">' . '<option value="Y"' . ($arParametersValues[$parameterKey] == "Y" ? ' selected="selected"' : '') . '>' . GetMessage("WD_Y") . '</option>' . '<option value="N"' . ($arParametersValues[$parameterKey] == "N" ? ' selected="selected"' : '') . '>' . GetMessage("WD_N") . '</option>' . '</select>'; break; case "date": case "datetime": $sData = CAdminCalendar::CalendarDate($parameterKeyExt, $arParametersValues[$parameterKey], 19, $arParameter["Type"] == "date"); break; case "user": $sData = '<textarea name="' . $parameterKeyExt . '" id="id_' . $parameterKeyExt . '" rows="3" cols="40">' . $arParametersValues[$parameterKey] . '</textarea><input type="button" value="..." onclick="BPAShowSelector(\'id_' . $parameterKeyExt . '\', \'user\');" />'; break; } $arFields[] = array("id" => $parameterKeyExt, "required" => $arParameter["Required"], "name" => $arParameter["Name"], "tooltip" => trim($arParameter["Description"]), "type" => "custom", "value" => $sData); } }
<form method="POST" Action="<?echo $APPLICATION->GetCurPage()?>"> <?// проверка идентификатора сессии ?> <?echo bitrix_sessid_post();?> <? // отобразим заголовки закладок $tabControl->Begin(); ?> <? //******************** // первая закладка - форма редактирования //******************** $tabControl->BeginNextTab(); ?> <tr> <td><span class="required">*</span><?echo GetMessage("STALL_ORDER_EDIT_DATE_CREATE")?></td> <td><?echo CAdminCalendar::CalendarDate("DATE_CREATE", $row['DATE_CREATE'], 19, true)?></td> <td rowspan="3" valign="top" style="text-align: right; width: 60%;"> <table class="internal" style="width: 100%;"> <tr class="heading"> <td>Name</td> <td width="100">Price</td> <td width="100">Count</td> <td width="120">Summ</td> <td width="50">Del</td> </tr> <? //TODO add css ?> <?foreach($arElement as $arItem):?> <tr id="order_item_<?php
function GetFieldInputControl($documentType, $arFieldType, $arFieldName, $fieldValue, $bAllowSelection = false, $publicMode = false) { $iblockId = intval(substr($documentType, strlen("iblock_"))); if ($iblockId <= 0) { throw new CBPArgumentOutOfRangeException("documentType", $documentType); } static $arDocumentFieldTypes = array(); if (!array_key_exists($documentType, $arDocumentFieldTypes)) { $arDocumentFieldTypes[$documentType] = self::GetDocumentFieldTypes($documentType); } $arFieldType["BaseType"] = "string"; $arFieldType["Complex"] = false; if (array_key_exists($arFieldType["Type"], $arDocumentFieldTypes[$documentType])) { $arFieldType["BaseType"] = $arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["BaseType"]; $arFieldType["Complex"] = $arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["Complex"]; } if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::IsAssociativeArray($fieldValue)) { $fieldValue = array($fieldValue); } $customMethodName = ""; $customMethodNameMulty = ""; if (strpos($arFieldType["Type"], ":") !== false) { $ar = CIBlockProperty::GetUserType(substr($arFieldType["Type"], 2)); if (array_key_exists("GetPublicEditHTML", $ar)) { $customMethodName = $ar["GetPublicEditHTML"]; } if (array_key_exists("GetPublicEditHTMLMulty", $ar)) { $customMethodNameMulty = $ar["GetPublicEditHTMLMulty"]; } } ob_start(); if ($arFieldType["Type"] == "select") { $fieldValueTmp = $fieldValue; ?> <select id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> " name="<?php echo htmlspecialcharsbx($arFieldName["Field"]) . ($arFieldType["Multiple"] ? "[]" : ""); ?> "<?php echo $arFieldType["Multiple"] ? ' size="5" multiple' : ''; ?> > <?php if (!$arFieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } foreach ($arFieldType["Options"] as $k => $v) { if (is_array($v) && count($v) == 2) { $v1 = array_values($v); $k = $v1[0]; $v = $v1[1]; } $ind = array_search($k, $fieldValueTmp); echo '<option value="' . htmlspecialcharsbx($k) . '"' . ($ind !== false ? ' selected' : '') . '>' . htmlspecialcharsbx($v) . '</option>'; if ($ind !== false) { unset($fieldValueTmp[$ind]); } } ?> </select> <?php if ($bAllowSelection) { ?> <br /><input type="text" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" value="<?php if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text', 'select');"> <?php } } elseif ($arFieldType["Type"] == "user") { $fieldValue = CBPHelper::UsersArrayToString($fieldValue, null, array("iblock", "CIBlockDocument", $documentType)); ?> <input type="text" size="40" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> " name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> " value="<?php echo htmlspecialcharsbx($fieldValue); ?> "><input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> ', 'user');"><?php } elseif (strpos($arFieldType["Type"], ":") !== false && $arFieldType["Multiple"] && (is_array($customMethodNameMulty) && count($customMethodNameMulty) > 0 || !is_array($customMethodNameMulty) && strlen($customMethodNameMulty) > 0)) { if (!is_array($fieldValue)) { $fieldValue = array(); } if ($bAllowSelection) { $fieldValueTmp1 = array(); $fieldValueTmp2 = array(); foreach ($fieldValue as $v) { $vTrim = trim($v); if (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", $vTrim) || substr($vTrim, 0, 1) == "=") { $fieldValueTmp1[] = $vTrim; } else { $fieldValueTmp2[] = $v; } } } else { $fieldValueTmp1 = array(); $fieldValueTmp2 = $fieldValue; } if ($arFieldType["Type"] == "S:employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") { $fieldValueTmp2 = CBPHelper::StripUserPrefix($fieldValueTmp2); } foreach ($fieldValueTmp2 as &$fld) { $fld = array("VALUE" => $fld); } echo call_user_func_array($customMethodNameMulty, array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), $fieldValueTmp2, array("FORM_NAME" => $arFieldName["Form"], "VALUE" => htmlspecialcharsbx($arFieldName["Field"])), true)); if ($bAllowSelection) { ?> <br /><input type="text" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" value="<?php if (count($fieldValueTmp1) > 0) { $a = array_values($fieldValueTmp1); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text', 'user');"> <?php } } else { if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted", $GLOBALS) && $arFieldType["Multiple"]) { $GLOBALS["CBPVirtualDocumentCloneRowPrinted"] = 1; ?> <script language="JavaScript"> <!-- function CBPVirtualDocumentCloneRow(tableID) { var tbl = document.getElementById(tableID); var cnt = tbl.rows.length; var oRow = tbl.insertRow(cnt); var oCell = oRow.insertCell(0); var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML; var p = 0; while (true) { var s = sHTML.indexOf('[n', p); if (s < 0) break; var e = sHTML.indexOf(']', s); if (e < 0) break; var n = parseInt(sHTML.substr(s + 2, e - s)); sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1); p = s + 1; } var p = 0; while (true) { var s = sHTML.indexOf('__n', p); if (s < 0) break; var e = sHTML.indexOf('_', s + 2); if (e < 0) break; var n = parseInt(sHTML.substr(s + 3, e - s)); sHTML = sHTML.substr(0, s) + '__n' + (++n) + '_' + sHTML.substr(e + 1); p = e + 1; } oCell.innerHTML = sHTML; var patt = new RegExp('<' + 'script' + '>[^\000]*?<' + '\/' + 'script' + '>', 'ig'); var code = sHTML.match(patt); if (code) { for (var i = 0; i < code.length; i++) { if (code[i] != '') { var s = code[i].substring(8, code[i].length - 9); jsUtils.EvalGlobal(s); } } } } //--> </script> <?php } if ($arFieldType["Multiple"]) { echo '<table width="100%" border="0" cellpadding="2" cellspacing="2" id="CBPVirtualDocument_' . htmlspecialcharsbx($arFieldName["Field"]) . '_Table">'; } $fieldValueTmp = $fieldValue; $ind = -1; foreach ($fieldValue as $key => $value) { $ind++; $fieldNameId = 'id_' . htmlspecialcharsbx($arFieldName["Field"]) . '__n' . $ind . '_'; $fieldNameName = htmlspecialcharsbx($arFieldName["Field"]) . ($arFieldType["Multiple"] ? "[n" . $ind . "]" : ""); if ($arFieldType["Multiple"]) { echo '<tr><td>'; } if (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0) { $value1 = $value; if ($bAllowSelection && (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value1)) || substr(trim($value1), 0, 1) == "=")) { $value1 = null; } else { unset($fieldValueTmp[$key]); } if ($arFieldType["Type"] == "S:employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") { $value1 = CBPHelper::StripUserPrefix($value1); } echo call_user_func_array($customMethodName, array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName), true)); } else { switch ($arFieldType["Type"]) { case "int": case "double": unset($fieldValueTmp[$key]); ?> <input type="text" size="10" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> " value="<?php echo htmlspecialcharsbx($value); ?> "><?php break; case "file": if ($publicMode) { //unset($fieldValueTmp[$key]); ?> <input type="file" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php } break; case "bool": if (in_array($value, array("Y", "N"))) { unset($fieldValueTmp[$key]); } ?> <select id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "> <?php if (!$arFieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } ?> <option value="Y"<?php echo in_array("Y", $fieldValue) ? ' selected' : ''; ?> ><?php echo GetMessage("BPCGHLP_YES"); ?> </option> <option value="N"<?php echo in_array("N", $fieldValue) ? ' selected' : ''; ?> ><?php echo GetMessage("BPCGHLP_NO"); ?> </option> </select> <?php break; case "text": unset($fieldValueTmp[$key]); ?> <textarea rows="5" cols="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php echo htmlspecialcharsbx($value); ?> </textarea><?php break; case "date": case "datetime": if (defined("ADMIN_SECTION") && ADMIN_SECTION) { $v = ""; if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value)) && substr(trim($value), 0, 1) != "=") { $v = $value; unset($fieldValueTmp[$key]); } require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php"; echo CAdminCalendar::CalendarDate($fieldNameName, $v, 19, $arFieldType["Type"] != "date"); } else { $value1 = $value; if ($bAllowSelection && (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value1)) || substr(trim($value1), 0, 1) == "=")) { $value1 = null; } else { unset($fieldValueTmp[$key]); } $ar = CIBlockProperty::GetUserType("DateTime"); echo call_user_func_array($ar["GetPublicEditHTML"], array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName), true)); } break; default: unset($fieldValueTmp[$key]); ?> <input type="text" size="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> " value="<?php echo htmlspecialcharsbx($value); ?> "><?php } } if ($bAllowSelection) { if (!in_array($arFieldType["Type"], array("file", "bool", "date", "datetime")) && (is_array($customMethodName) && count($customMethodName) <= 0 || !is_array($customMethodName) && strlen($customMethodName) <= 0)) { ?> <input type="button" value="..." onclick="BPAShowSelector('<?php echo $fieldNameId; ?> ', '<?php echo htmlspecialcharsbx($arFieldType["BaseType"]); ?> ');"><?php } } if ($arFieldType["Multiple"]) { echo '</td></tr>'; } } if ($arFieldType["Multiple"]) { echo "</table>"; } if ($arFieldType["Multiple"] && ($arFieldType["Type"] != "file" || $publicMode)) { echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $arFieldName["Field"] . '_Table\')"/><br />'; } if ($bAllowSelection) { if (in_array($arFieldType["Type"], array("file", "bool", "date", "datetime")) || (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0)) { ?> <input type="text" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" value="<?php if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text', '<?php echo htmlspecialcharsbx($arFieldType["BaseType"]); ?> ');"> <?php } } } $s = ob_get_contents(); ob_end_clean(); return $s; }
/** * Генерирует HTML для редактирования поля * @see AdminEditHelper::showField(); * @return mixed */ protected function genEditHTML() { return \CAdminCalendar::CalendarDate($this->getEditInputName(), ConvertTimeStamp(strtotime($this->getValue()), "FULL"), 10, true); }
function CalendarDate($sFromName, $sFromVal, $sFormName="skform", $size="10", $param="class=\"typeinput\"") { if(class_exists("CAdminCalendar")) return CAdminCalendar::CalendarDate($sFromName, $sFromVal, $size, ($size > 10)); return '<input type="text" name="'.$sFromName.'" id="'.$sFromName.'" size="'.$size.'" value="'.htmlspecialcharsbx($sFromVal).'" '.$param.' /> '."\n".Calendar($sFromName, $sFormName)."\n"; }
function GetAdminListEditHTML($arUserField, $arHtmlControl) { if ($arUserField["EDIT_IN_LIST"] == "Y") { return CAdminCalendar::CalendarDate($arHtmlControl["NAME"], $arHtmlControl["VALUE"]); } elseif (strlen($arHtmlControl["VALUE"]) > 0) { return $arHtmlControl["VALUE"]; } else { return ' '; } }
public static function GetFieldInputControl($documentType, $arFieldType, $arFieldName, $fieldValue, $bAllowSelection = false) { if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::IsAssociativeArray($fieldValue)) { $fieldValue = array($fieldValue); } ob_start(); if ($arFieldType["Type"] == "select") { $fieldValueTmp = $fieldValue; ?> <select id="id_<?php echo $arFieldName["Field"]; ?> " name="<?php echo $arFieldName["Field"] . ($arFieldType["Multiple"] ? "[]" : ""); ?> "<?php echo $arFieldType["Multiple"] ? ' size="5" multiple' : ''; ?> > <?php if (!$arFieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } foreach ($arFieldType["Options"] as $k => $v) { $ind = array_search($k, $fieldValueTmp); echo '<option value="' . htmlspecialcharsbx($k) . '"' . ($ind !== false ? ' selected' : '') . '>' . htmlspecialcharsbx($v) . '</option>'; if ($ind !== false) { unset($fieldValueTmp[$ind]); } } ?> </select> <?php if ($bAllowSelection) { ?> <br /><input type="text" id="id_<?php echo $arFieldName["Field"]; ?> _text" name="<?php echo $arFieldName["Field"]; ?> _text" value="<?php if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo $arFieldName["Field"]; ?> _text', 'select');"> <?php } } elseif ($arFieldType["Type"] == "user") { $fieldValue = CBPHelper::UsersArrayToString($fieldValue, null, $documentType); ?> <input type="text" size="40" id="id_<?php echo $arFieldName["Field"]; ?> " name="<?php echo $arFieldName["Field"]; ?> " value="<?php echo htmlspecialcharsbx($fieldValue); ?> "><input type="button" value="..." onclick="BPAShowSelector('id_<?php echo $arFieldName["Field"]; ?> ', 'user');"><?php } else { if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted", $GLOBALS) && $arFieldType["Multiple"]) { $GLOBALS["CBPVirtualDocumentCloneRowPrinted"] = 1; ?> <script language="JavaScript"> <!-- function CBPVirtualDocumentCloneRow(tableID) { var tbl = document.getElementById(tableID); var cnt = tbl.rows.length; var oRow = tbl.insertRow(cnt); var oCell = oRow.insertCell(0); var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML; var p = 0; while (true) { var s = sHTML.indexOf('[n', p); if (s < 0) break; var e = sHTML.indexOf(']', s); if (e < 0) break; var n = parseInt(sHTML.substr(s + 2, e - s)); sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1); p = s + 1; } var p = 0; while (true) { var s = sHTML.indexOf('__n', p); if (s < 0) break; var e = sHTML.indexOf('_', s + 2); if (e < 0) break; var n = parseInt(sHTML.substr(s + 3, e - s)); sHTML = sHTML.substr(0, s) + '__n' + (++n) + '_' + sHTML.substr(e + 1); p = e + 1; } oCell.innerHTML = sHTML; var patt = new RegExp('<' + 'script' + '>[^\000]*?<' + '\/' + 'script' + '>', 'ig'); var code = sHTML.match(patt); if (code) { for (var i = 0; i < code.length; i++) { if (code[i] != '') { var s = code[i].substring(8, code[i].length - 9); jsUtils.EvalGlobal(s); } } } } //--> </script> <?php } if ($arFieldType["Multiple"]) { echo '<table width="100%" border="0" cellpadding="2" cellspacing="2" id="CBPVirtualDocument_' . $arFieldName["Field"] . '_Table">'; } if ($bAllowSelection) { $arFieldType["BaseType"] = "string"; static $arDocumentTypes = null; if (is_null($arDocumentTypes)) { $arDocumentTypes = self::GetDocumentFieldTypes($documentType); } if (array_key_exists($arFieldType["Type"], $arDocumentTypes)) { $arFieldType["BaseType"] = $arDocumentTypes[$arFieldType["Type"]]["BaseType"]; } } $fieldValueTmp = $fieldValue; $ind = -1; foreach ($fieldValue as $key => $value) { $ind++; $fieldNameId = 'id_' . $arFieldName["Field"] . '__n' . $ind . '_'; $fieldNameName = $arFieldName["Field"] . ($arFieldType["Multiple"] ? "[n" . $ind . "]" : ""); if ($arFieldType["Multiple"]) { echo '<tr><td>'; } switch ($arFieldType["Type"]) { case "int": case "double": unset($fieldValueTmp[$key]); ?> <input type="text" size="10" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> " value="<?php echo htmlspecialcharsbx($value); ?> "><?php break; case "file": unset($fieldValueTmp[$key]); ?> <input type="file" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php break; case "bool": if (in_array($value, array("Y", "N"))) { unset($fieldValueTmp[$key]); } ?> <select id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "> <?php if (!$arFieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } ?> <option value="Y"<?php echo in_array("Y", $fieldValue) ? ' selected' : ''; ?> ><?php echo GetMessage("BPCGHLP_YES"); ?> </option> <option value="N"<?php echo in_array("N", $fieldValue) ? ' selected' : ''; ?> ><?php echo GetMessage("BPCGHLP_NO"); ?> </option> </select> <?php break; case "text": unset($fieldValueTmp[$key]); ?> <textarea rows="5" cols="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php echo htmlspecialcharsbx($value); ?> </textarea><?php break; case "date": case "datetime": $v = ""; if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value)) && substr(trim($value), 0, 1) != "=") { $v = $value; unset($fieldValueTmp[$key]); } require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php"; echo CAdminCalendar::CalendarDate($fieldNameName, $v, 19, $arFieldType["Type"] == "date"); break; default: unset($fieldValueTmp[$key]); ?> <input type="text" size="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> " value="<?php echo htmlspecialcharsbx($value); ?> "><?php } if ($bAllowSelection) { if (!in_array($arFieldType["Type"], array("file", "bool", "date", "datetime"))) { ?> <input type="button" value="..." onclick="BPAShowSelector('<?php echo $fieldNameId; ?> ', '<?php echo $arFieldType["BaseType"]; ?> ');"><?php } } if ($arFieldType["Multiple"]) { echo '</td></tr>'; } } if ($arFieldType["Multiple"]) { echo "</table>"; } if ($arFieldType["Multiple"]) { echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $arFieldName["Field"] . '_Table\')"/><br />'; } if ($bAllowSelection) { if (in_array($arFieldType["Type"], array("file", "bool", "date", "datetime"))) { ?> <input type="text" id="id_<?php echo $arFieldName["Field"]; ?> _text" name="<?php echo $arFieldName["Field"]; ?> _text" value="<?php if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo $arFieldName["Field"]; ?> _text', '<?php echo $arFieldType["BaseType"]; ?> ');"> <?php } } } $s = ob_get_contents(); ob_end_clean(); return $s; }
$pr = array(); } $tabControl->AddCheckBoxField("ACTIVE", GetMessage("IBLOCK_FIELD_ACTIVE").":", false, array("Y","N"), $str_ACTIVE=="Y"); $tabControl->BeginCustomField("ACTIVE_FROM", GetMessage("IBLOCK_FIELD_ACTIVE_PERIOD_FROM"), $arIBlock["FIELDS"]["ACTIVE_FROM"]["IS_REQUIRED"] === "Y"); ?> <tr id="tr_ACTIVE_FROM"> <td><?echo $tabControl->GetCustomLabelHTML()?>:</td> <td><?echo CAdminCalendar::CalendarDate("ACTIVE_FROM", $str_ACTIVE_FROM, 19, true)?></td> </tr> <? $tabControl->EndCustomField("ACTIVE_FROM", '<input type="hidden" id="ACTIVE_FROM" name="ACTIVE_FROM" value="'.$str_ACTIVE_FROM.'">'); $tabControl->BeginCustomField("ACTIVE_TO", GetMessage("IBLOCK_FIELD_ACTIVE_PERIOD_TO"), $arIBlock["FIELDS"]["ACTIVE_TO"]["IS_REQUIRED"] === "Y"); ?> <tr id="tr_ACTIVE_TO"> <td><?echo $tabControl->GetCustomLabelHTML()?>:</td> <td><?echo CAdminCalendar::CalendarDate("ACTIVE_TO", $str_ACTIVE_TO, 19, true)?></td> </tr> <? $tabControl->EndCustomField("ACTIVE_TO", '<input type="hidden" id="ACTIVE_TO" name="ACTIVE_TO" value="'.$str_ACTIVE_TO.'">'); if($arTranslit["TRANSLITERATION"] == "Y") { $tabControl->BeginCustomField("NAME", GetMessage("IBLOCK_FIELD_NAME").":", true); ?> <tr id="tr_NAME"> <td><?echo $tabControl->GetCustomLabelHTML()?></td> <td style="white-space: nowrap;"> <input type="text" size="50" name="NAME" id="NAME" maxlength="255" value="<?echo $str_NAME?>"><image id="name_link" title="<?echo GetMessage("IBEL_E_LINK_TIP")?>" class="linked" src="/bitrix/themes/.default/icons/iblock/<?if($bLinked) echo 'link.gif'; else echo 'unlink.gif';?>" onclick="set_linked()" /> </td> </tr>
public static function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName) { return CAdminCalendar::CalendarDate($strHTMLControlName["VALUE"], $value["VALUE"], 20, false) . ($arProperty["WITH_DESCRIPTION"] == "Y" && '' != trim($strHTMLControlName["DESCRIPTION"]) ? ' <input type="text" size="20" name="' . $strHTMLControlName["DESCRIPTION"] . '" value="' . htmlspecialcharsbx($value["DESCRIPTION"]) . '">' : ''); }
echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo CAdminCalendar::CalendarDate($Field, $arRecord["FULL_" . $Field], 20, true); ?> <?php } elseif ($arField["type"] === "date") { ?> <tr> <td width="40%"><?php echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo CAdminCalendar::CalendarDate($Field, $arRecord["SHORT_" . $Field], 10, false); ?> <?php } elseif (isset($arField["SELECT"])) { ?> <tr> <td width="40%"><?php echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo SelectBoxFromArray($Field, $arField["SELECT"], $arRecord[$Field], $arField["nullable"] ? "(null)" : ""); ?> </td> </tr> <?php
:</td> <td width="60%"><?php echo htmlspecialcharsex($arRecord[$Field]); ?> </td> </tr> <?php } elseif ($arField["type"] === "datetime") { ?> <tr> <td width="40%"><?php echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo CAdminCalendar::CalendarDate($Field, $arRecord["FULL_" . $Field], 20, true); ?> <?php } elseif (isset($arField["SELECT"])) { ?> <tr> <td width="40%"><?php echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo SelectBoxFromArray($Field, $arField["SELECT"], $arRecord[$Field], $arField["nullable"] ? "(null)" : ""); ?> </td> </tr> <?php
<td><?php echo CAdminCalendar::CalendarDate("SUB_ACTIVE_FROM", $str_ACTIVE_FROM, 19, true); ?> </td> </tr> <?php $tabControl->EndCustomField("SUB_ACTIVE_FROM", '<input type="hidden" id="SUB_ACTIVE_FROM" name="SUB_ACTIVE_FROM" value="' . $str_ACTIVE_FROM . '">'); $tabControl->BeginCustomField("SUB_ACTIVE_TO", GetMessage("IBLOCK_FIELD_ACTIVE_PERIOD_TO"), $arIBlock["FIELDS"]["ACTIVE_TO"]["IS_REQUIRED"] === "Y"); ?> <tr id="tr_SUB_ACTIVE_TO"> <td><?php echo $tabControl->GetCustomLabelHTML(); ?> :</td> <td><?php echo CAdminCalendar::CalendarDate("SUB_ACTIVE_TO", $str_ACTIVE_TO, 19, true); ?> </td> </tr> <?php $tabControl->EndCustomField("SUB_ACTIVE_TO", '<input type="hidden" id="SUB_ACTIVE_TO" name="SUB_ACTIVE_TO" value="' . $str_ACTIVE_TO . '">'); if ($arTranslit["TRANSLITERATION"] == "Y") { $tabControl->BeginCustomField("SUB_NAME", GetMessage("IBLOCK_FIELD_NAME") . ":", true); ?> <tr id="tr_SUB_NAME"> <td><?php echo $tabControl->GetCustomLabelHTML(); ?> </td> <td style="white-space: nowrap;">
</td> </tr> <tr id="tr_time_type_selector_time"> <td align="right" width="40%"><?php echo GetMessage("CPAD_DP_TIME1"); ?> :</td> <td width="60%"> <?php $v = ""; $v_x = trim($arCurrentValues["delay_date"]); if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", $v_x) && substr($v_x, 0, 1) != "=") { $v = $v_x; $v_x = ""; } require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php"; echo CAdminCalendar::CalendarDate("delay_date", $v, 19, true); ?> <input type="text" name="delay_date_x" id="id_delay_date_x" value="<?php echo htmlspecialcharsbx($v_x); ?> " size="20" /> <input type="button" value="..." onclick="BPAShowSelector('id_delay_date_x', 'datetime');" /> </td> </tr> <script type="text/javascript"> SetDelayMode(<?php echo !array_key_exists("delay_date", $arCurrentValues) ? "true" : "false"; ?> ); </script>
public function GetFieldInputControl($documentType, $arFieldType, $arFieldName, $fieldValue, $bAllowSelection = false, $publicMode = false) { $iblockId = intval(substr($documentType, strlen("iblock_"))); if ($iblockId <= 0) { throw new CBPArgumentOutOfRangeException("documentType", $documentType); } global $APPLICATION; if (!$publicMode) { $APPLICATION->showAjaxHead(); } static $arDocumentFieldTypes = array(); if (!array_key_exists($documentType, $arDocumentFieldTypes)) { $arDocumentFieldTypes[$documentType] = self::GetDocumentFieldTypes($documentType); } $arFieldType["BaseType"] = "string"; $arFieldType["Complex"] = false; if (array_key_exists($arFieldType["Type"], $arDocumentFieldTypes[$documentType])) { $arFieldType["BaseType"] = $arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["BaseType"]; $arFieldType["Complex"] = $arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["Complex"]; } if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::IsAssociativeArray($fieldValue)) { $fieldValue = array($fieldValue); } $customMethodName = ""; $customMethodNameMulty = ""; if (strpos($arFieldType["Type"], ":") !== false) { $ar = CIBlockProperty::GetUserType(substr($arFieldType["Type"], 2)); if (array_key_exists("GetPublicEditHTML", $ar)) { $customMethodName = $ar["GetPublicEditHTML"]; } if (array_key_exists("GetPublicEditHTMLMulty", $ar)) { $customMethodNameMulty = $ar["GetPublicEditHTMLMulty"]; } } ob_start(); if ($arFieldType["Type"] == "select") { $fieldValueTmp = $fieldValue; ?> <select id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> " name="<?php echo htmlspecialcharsbx($arFieldName["Field"]) . ($arFieldType["Multiple"] ? "[]" : ""); ?> "<?php echo $arFieldType["Multiple"] ? ' size="5" multiple' : ''; ?> > <?php if (!$arFieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } foreach ($arFieldType["Options"] as $k => $v) { if (is_array($v) && count($v) == 2) { $v1 = array_values($v); $k = $v1[0]; $v = $v1[1]; } $ind = array_search($k, $fieldValueTmp); echo '<option value="' . htmlspecialcharsbx($k) . '"' . ($ind !== false ? ' selected' : '') . '>' . htmlspecialcharsbx($v) . '</option>'; if ($ind !== false) { unset($fieldValueTmp[$ind]); } } ?> </select> <?php if ($bAllowSelection) { ?> <br /><input type="text" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" value="<?php if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text', 'select');"> <?php } } elseif ($arFieldType["Type"] == "user") { $fieldValue = CBPHelper::UsersArrayToString($fieldValue, null, array("lists", "BizprocDocument", $documentType)); ?> <input type="text" size="40" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> " name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> " value="<?php echo htmlspecialcharsbx($fieldValue); ?> "><input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> ', 'user');"><?php } elseif (strpos($arFieldType["Type"], ":") !== false && $arFieldType["Multiple"] && (is_array($customMethodNameMulty) && count($customMethodNameMulty) > 0 || !is_array($customMethodNameMulty) && strlen($customMethodNameMulty) > 0)) { if (!is_array($fieldValue)) { $fieldValue = array(); } if ($bAllowSelection) { $fieldValueTmp1 = array(); $fieldValueTmp2 = array(); foreach ($fieldValue as $v) { $vTrim = trim($v); if (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", $vTrim) || substr($vTrim, 0, 1) == "=") { $fieldValueTmp1[] = $vTrim; } else { $fieldValueTmp2[] = $v; } } } else { $fieldValueTmp1 = array(); $fieldValueTmp2 = $fieldValue; } if ($arFieldType["Type"] == "S:employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") { $fieldValueTmp2 = CBPHelper::StripUserPrefix($fieldValueTmp2); } foreach ($fieldValueTmp2 as &$fld) { if (!isset($fld['VALUE'])) { $fld = array("VALUE" => $fld); } } if ($arFieldType["Type"] == "E:EList") { static $fl = true; if ($fl) { if (!empty($_SERVER['HTTP_BX_AJAX'])) { $GLOBALS["APPLICATION"]->ShowAjaxHead(); } $GLOBALS["APPLICATION"]->AddHeadScript('/bitrix/js/iblock/iblock_edit.js'); } $fl = false; } echo call_user_func_array($customMethodNameMulty, array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), $fieldValueTmp2, array("FORM_NAME" => $arFieldName["Form"], "VALUE" => htmlspecialcharsbx($arFieldName["Field"])), true)); if ($bAllowSelection) { ?> <br /><input type="text" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" value="<?php if (count($fieldValueTmp1) > 0) { $a = array_values($fieldValueTmp1); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text', 'user');"> <?php } } else { if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted", $GLOBALS) && $arFieldType["Multiple"]) { $GLOBALS["CBPVirtualDocumentCloneRowPrinted"] = 1; ?> <script language="JavaScript"> function CBPVirtualDocumentCloneRow(tableID) { var tbl = document.getElementById(tableID); var cnt = tbl.rows.length; var oRow = tbl.insertRow(cnt); var oCell = oRow.insertCell(0); var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML; var p = 0; while (true) { var s = sHTML.indexOf('[n', p); if (s < 0) break; var e = sHTML.indexOf(']', s); if (e < 0) break; var n = parseInt(sHTML.substr(s + 2, e - s)); sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1); p = s + 1; } var p = 0; while (true) { var s = sHTML.indexOf('__n', p); if (s < 0) break; var e = sHTML.indexOf('_', s + 2); if (e < 0) break; var n = parseInt(sHTML.substr(s + 3, e - s)); sHTML = sHTML.substr(0, s) + '__n' + (++n) + '_' + sHTML.substr(e + 1); p = e + 1; } oCell.innerHTML = sHTML; var patt = new RegExp('<' + 'script' + '>[^\000]*?<' + '\/' + 'script' + '>', 'ig'); var code = sHTML.match(patt); if (code) { for (var i = 0; i < code.length; i++) { if (code[i] != '') { var s = code[i].substring(8, code[i].length - 9); jsUtils.EvalGlobal(s); } } } } function createAdditionalHtmlEditor(tableId) { var tbl = document.getElementById(tableId); var cnt = tbl.rows.length-1; var name = tableId.replace(/(?:CBPVirtualDocument_)(.*)(?:_Table)/, '$1') var idEditor = 'id_'+name+'__n'+cnt+'_'; var inputNameEditor = name+'[n'+cnt+']'; window.BXHtmlEditor.Show( { 'id':idEditor, 'inputName':inputNameEditor, 'content':'', 'width':'100%', 'height':'200', 'allowPhp':false, 'limitPhpAccess':false, 'templates':[], 'templateId':'', 'templateParams':[], 'componentFilter':'', 'snippets':[], 'placeholder':'Text here...', 'actionUrl':'/bitrix/tools/html_editor_action.php', 'cssIframePath':'/bitrix/js/fileman/html_editor/iframe-style.css?1412693817', 'bodyClass':'', 'bodyId':'', 'spellcheck_path':'/bitrix/js/fileman/html_editor/html-spell.js?v=1412693817', 'usePspell':'N', 'useCustomSpell':'Y', 'bbCode':false, 'askBeforeUnloadPage':true, 'settingsKey':'user_settings_1', 'showComponents':true, 'showSnippets':true, 'view':'wysiwyg', 'splitVertical':false, 'splitRatio':'1', 'taskbarShown':false, 'taskbarWidth':'250', 'lastSpecialchars':false, 'cleanEmptySpans':true, 'lazyLoad':false, 'showTaskbars':false, 'showNodeNavi':false, 'controlsMap':[ {'id':'Bold','compact':true,'sort':'80'}, {'id':'Italic','compact':true,'sort':'90'}, {'id':'Underline','compact':true,'sort':'100'}, {'id':'Strikeout','compact':true,'sort':'110'}, {'id':'RemoveFormat','compact':true,'sort':'120'}, {'id':'Color','compact':true,'sort':'130'}, {'id':'FontSelector','compact':false,'sort':'135'}, {'id':'FontSize','compact':false,'sort':'140'}, {'separator':true,'compact':false,'sort':'145'}, {'id':'OrderedList','compact':true,'sort':'150'}, {'id':'UnorderedList','compact':true,'sort':'160'}, {'id':'AlignList','compact':false,'sort':'190'}, {'separator':true,'compact':false,'sort':'200'}, {'id':'InsertLink','compact':true,'sort':'210','wrap':'bx-b-link-'+idEditor}, {'id':'InsertImage','compact':false,'sort':'220'}, {'id':'InsertVideo','compact':true,'sort':'230','wrap':'bx-b-video-'+idEditor}, {'id':'InsertTable','compact':false,'sort':'250'}, {'id':'Code','compact':true,'sort':'260'}, {'id':'Quote','compact':true,'sort':'270','wrap':'bx-b-quote-'+idEditor}, {'id':'Smile','compact':false,'sort':'280'}, {'separator':true,'compact':false,'sort':'290'}, {'id':'Fullscreen','compact':false,'sort':'310'}, {'id':'BbCode','compact':true,'sort':'340'}, {'id':'More','compact':true,'sort':'400'}], 'autoResize':true, 'autoResizeOffset':'40', 'minBodyWidth':'350', 'normalBodyWidth':'555' }); var htmlEditor = BX.findChildrenByClassName(BX(tableId), 'bx-html-editor'); for(var k in htmlEditor) { var editorId = htmlEditor[k].getAttribute('id'); var frameArray = BX.findChildrenByClassName(BX(editorId), 'bx-editor-iframe'); if(frameArray.length > 1) { for(var i = 0; i < frameArray.length - 1; i++) { frameArray[i].parentNode.removeChild(frameArray[i]); } } } } </script> <?php } if ($arFieldType["Multiple"]) { echo '<table width="100%" border="0" cellpadding="2" cellspacing="2" id="CBPVirtualDocument_' . htmlspecialcharsbx($arFieldName["Field"]) . '_Table">'; } $fieldValueTmp = $fieldValue; if (sizeof($fieldValue) == 0) { $fieldValue[] = null; } $ind = -1; foreach ($fieldValue as $key => $value) { $ind++; $fieldNameId = 'id_' . htmlspecialcharsbx($arFieldName["Field"]) . '__n' . $ind . '_'; $fieldNameName = htmlspecialcharsbx($arFieldName["Field"]) . ($arFieldType["Multiple"] ? "[n" . $ind . "]" : ""); if ($arFieldType["Multiple"]) { echo '<tr><td>'; } if (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0) { if ($arFieldType["Type"] == "S:HTML") { if (Loader::includeModule("fileman")) { $editor = new \CHTMLEditor(); $res = array_merge(array('height' => 200, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => false, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-' . $fieldNameId), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-' . $fieldNameId), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-' . $fieldNameId), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400))), array('name' => $fieldNameName, 'inputName' => $fieldNameName, 'id' => $fieldNameId, 'width' => '100%', 'content' => htmlspecialcharsBack($value))); $editor->show($res); } else { ?> <textarea rows="5" cols="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php echo htmlspecialcharsbx($value); ?> </textarea><?php } } else { $value1 = $value; if ($bAllowSelection && (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value1)) || substr(trim($value1), 0, 1) == "=")) { $value1 = null; } else { unset($fieldValueTmp[$key]); } if ($arFieldType["Type"] == "S:employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") { $value1 = CBPHelper::StripUserPrefix($value1); } echo call_user_func_array($customMethodName, array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName), true)); } } else { switch ($arFieldType["Type"]) { case "int": case "double": unset($fieldValueTmp[$key]); ?> <input type="text" size="10" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> " value="<?php echo htmlspecialcharsbx($value); ?> "><?php break; case "file": if ($publicMode) { //unset($fieldValueTmp[$key]); ?> <input type="file" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php } break; case "bool": if (in_array($value, array("Y", "N"))) { unset($fieldValueTmp[$key]); } ?> <select id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "> <?php if (!$arFieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } ?> <option value="Y"<?php echo in_array("Y", $fieldValue) ? ' selected' : ''; ?> ><?php echo GetMessage("BPCGHLP_YES"); ?> </option> <option value="N"<?php echo in_array("N", $fieldValue) ? ' selected' : ''; ?> ><?php echo GetMessage("BPCGHLP_NO"); ?> </option> </select> <?php break; case "text": unset($fieldValueTmp[$key]); ?> <textarea rows="5" cols="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> "><?php echo htmlspecialcharsbx($value); ?> </textarea><?php break; case "date": case "datetime": if (defined("ADMIN_SECTION") && ADMIN_SECTION) { $v = ""; if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value)) && substr(trim($value), 0, 1) != "=") { $v = $value; unset($fieldValueTmp[$key]); } require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php"; echo CAdminCalendar::CalendarDate($fieldNameName, $v, 19, $arFieldType["Type"] != "date"); } else { $value1 = $value; if ($bAllowSelection && (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value1)) || substr(trim($value1), 0, 1) == "=")) { $value1 = null; } else { unset($fieldValueTmp[$key]); } if ($arFieldType["Type"] == "date") { $type = "Date"; } else { $type = "DateTime"; } $ar = CIBlockProperty::GetUserType($type); echo call_user_func_array($ar["GetPublicEditHTML"], array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName), true)); } break; default: unset($fieldValueTmp[$key]); ?> <input type="text" size="40" id="<?php echo $fieldNameId; ?> " name="<?php echo $fieldNameName; ?> " value="<?php echo htmlspecialcharsbx($value); ?> "><?php } } if ($bAllowSelection) { if (!in_array($arFieldType["Type"], array("file", "bool", "date", "datetime")) && (is_array($customMethodName) && count($customMethodName) <= 0 || !is_array($customMethodName) && strlen($customMethodName) <= 0)) { ?> <input type="button" value="..." onclick="BPAShowSelector('<?php echo $fieldNameId; ?> ', '<?php echo htmlspecialcharsbx($arFieldType["BaseType"]); ?> ');"><?php } } if ($arFieldType["Multiple"]) { echo '</td></tr>'; } } if ($arFieldType["Multiple"]) { echo "</table>"; } if ($arFieldType["Multiple"] && $arFieldType["Type"] != "S:HTML" && ($arFieldType["Type"] != "file" || $publicMode)) { echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $arFieldName["Field"] . '_Table\')"/><br />'; } elseif ($arFieldType["Multiple"] && $arFieldType["Type"] == "S:HTML") { $functionOnclick = 'CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $arFieldName["Field"] . '_Table\');createAdditionalHtmlEditor(\'CBPVirtualDocument_' . $arFieldName["Field"] . '_Table\');'; echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="' . $functionOnclick . '"/><br />'; } if ($bAllowSelection) { if (in_array($arFieldType["Type"], array("file", "bool", "date", "datetime")) || (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0)) { ?> <input type="text" id="id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text" value="<?php if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?> "> <input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($arFieldName["Field"]); ?> _text', '<?php echo htmlspecialcharsbx($arFieldType["BaseType"]); ?> ');"> <?php } } } $s = ob_get_contents(); ob_end_clean(); return $s; }
echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo CAdminCalendar::CalendarDate($Field, $value, 20, true); ?> <?php } elseif ($arField["type"] === "date") { $value = $bVarsFromForm ? $_REQUEST[$Field] : $arRecord["SHORT_" . $Field]; ?> <td width="40%"><?php echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo CAdminCalendar::CalendarDate($Field, $value, 10, false); ?> <?php } elseif (isset($arField["SELECT"])) { $value = $bVarsFromForm ? $_REQUEST[$Field] : $arRecord[$Field]; ?> <td width="40%"><?php echo htmlspecialcharsbx($Field); ?> :</td> <td width="60%"><?php echo SelectBoxFromArray($Field, $arField["SELECT"], $value, $arField["nullable"] ? "(null)" : ""); ?> </td> <?php } elseif ($arField["type"] === "string" && $arField["length"] == 1 && ($arField["default"] === "Y" || $arField["default"] === "N") && ($arRecord[$Field] === "Y" || $arRecord[$Field] === "N") && !$arField["nullable"]) {
public static function GetAdminListEditHTML($arUserField, $arHtmlControl) { if($arUserField["EDIT_IN_LIST"]=="Y") return CAdminCalendar::CalendarDate($arHtmlControl["NAME"], $arHtmlControl["VALUE"], 20, true); elseif(strlen($arHtmlControl["VALUE"])>0) return $arHtmlControl["VALUE"]; else return ' '; }