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); } }
/** * @param FieldType $fieldType * @param array $field * @param mixed $value * @param bool $allowSelection * @param int $renderMode * @return string */ protected static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode) { $name = static::generateControlName($field); $renderResult = ''; if ($renderMode & FieldType::RENDER_MODE_ADMIN) { require_once $_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/modules/main/interface/init_admin.php'; $renderResult = \CAdminCalendar::calendarDate($name, $value, 19); } else { ob_start(); $GLOBALS['APPLICATION']->includeComponent('bitrix:main.calendar', '', array('SHOW_INPUT' => 'Y', 'FORM_NAME' => $field['Form'], 'INPUT_NAME' => $name, 'INPUT_VALUE' => $value, 'SHOW_TIME' => static::getType() == FieldType::DATETIME ? 'Y' : 'N'), false, array('HIDE_ICONS' => 'Y')); $renderResult = ob_get_contents(); ob_end_clean(); } return $renderResult; }
?> </span> <input type="button" value="..." onclick="BPAShowSelector('id_absence_from', 'datetime');"> </td> </tr> <tr> <td align="right" width="40%"><span style="color:#FF0000;">*</span> <?php echo GetMessage("BPSNAA2_PD_CTO"); ?> :</td> <td width="60%"> <span style="white-space:nowrap;"><input type="text" name="absence_to" id="id_absence_to" size="30" value="<?php echo htmlspecialcharsbx($arCurrentValues["absence_to"]); ?> "><?php echo CAdminCalendar::Calendar("absence_to", "", "", true); ?> </span> <input type="button" value="..." onclick="BPAShowSelector('id_absence_to', 'datetime');"> </td> </tr> <tr> <td align="right" width="40%"><span style="color:#FF0000;">*</span> <?php echo GetMessage("BPSNAA2_PD_CTYPES"); ?> :</td> <td width="60%"> <select name="absence_type" id="id_absence_type"> <?php foreach ($arAbsenceTypes as $key => $value) { ?>
?> </span> <input type="button" value="..." onclick="BPAShowSelector('id_task_active_from', 'datetime');"> </td> </tr> <tr> <td align="right" width="40%"><?php echo GetMessage("BPTA1A_TASKACTIVETO"); ?> :</td> <td width="60%"> <span style="white-space:nowrap;"><input type="text" name="task_active_to" id="id_task_active_to" size="30" value="<?php echo htmlspecialcharsbx($arCurrentValues["task_active_to"]); ?> "><?php echo CAdminCalendar::Calendar("task_active_to", "", "", true); ?> </span> <input type="button" value="..." onclick="BPAShowSelector('id_task_active_to', 'datetime');"> </td> </tr> <tr> <td align="right" width="40%"><span style="color:#FF0000;">*</span> <?php echo GetMessage("BPTA1A_TASKNAME"); ?> :</td> <td width="60%"> <input type="text" name="task_name" id="id_task_name" value="<?php echo htmlspecialcharsbx($arCurrentValues["task_name"]); ?> " size="50">
$lAdmin->AddGroupError(GetMessage("IBLIST_A_SAVE_ERROR", array("#ID#" => $ID, "#ERROR_MESSAGE#" => $obE->LAST_ERROR)), $TYPE.$ID); } else { $lAdmin->AddGroupError(GetMessage("IBLIST_A_UPDERR_ACCESS", array("#ID#" => $ID)), $TYPE.$ID); } } break; } } if(isset($return_url) && strlen($return_url)>0) LocalRedirect($return_url); } $CAdminCalendar_ShowScript = CAdminCalendar::ShowScript(); // List header $arHeader = array(); if ($bCatalog) { $arHeader[] = array( "id" => "CATALOG_TYPE", "content" => GetMessage("IBLIST_A_CATALOG_TYPE"), "title" => GetMessage('IBLIST_A_CATALOG_TYPE_TITLE'), "align" => "right", "default" => true, ); } //Common
echo $i; ?> " value="<?php echo htmlspecialcharsbx((string) $arCurrentValues["variable_condition_value_" . $i]); ?> "> </td> </tr> <?php } ?> <tr id="bwfvc_addrow_tr"> <td class="adm-detail-content-cell-l"></td> <td class="adm-detail-content-cell-r"> <?php echo CAdminCalendar::ShowScript(); ?> <script language="JavaScript"> var bwfvc_arFieldTypes = {<?php $fl = false; foreach ($arProperties as $key => $value) { if ($fl) { echo ","; } echo "'" . CUtil::JSEscape($key) . "':'" . CUtil::JSEscape($value["Type"]) . "'"; $fl = true; } foreach ($arVariables as $key => $value) { if ($fl) { echo ","; }
/** * Генерирует HTML для редактирования поля * @see AdminEditHelper::showField(); * @return mixed */ protected function genEditHTML() { return \CAdminCalendar::CalendarDate($this->getEditInputName(), ConvertTimeStamp(strtotime($this->getValue()), "FULL"), 10, true); }
function CalendarPeriod($sFromName, $sFromVal, $sToName, $sToVal, $sFormName="skform", $show_select="N", $field_select="class=\"typeselect\"", $field_input="class=\"typeinput\"", $size="10") { if(class_exists("CAdminCalendar")) return CAdminCalendar::CalendarPeriod($sFromName, $sToName, $sFromVal, $sToVal, ($show_select=="Y"), $size, ($size > 10)); $arr = array(); $str = ""; if ($show_select=="Y") { $sname = $sFromName."_DAYS_TO_BACK"; $str = " <script type=\"text/javascript\"> function ".$sFromName."_SetDate() { var number = document.".$sFormName.".".$sname.".selectedIndex-1; document.".$sFormName.".".$sFromName.".disabled = false; if (number>=0) { document.".$sFormName.".".$sFromName.".value = dates[number]; document.".$sFormName.".".$sFromName.".disabled = true; } } </script> "; global $$sname; $value = $$sname; if (strlen($value)>0 && $value!="NOT_REF") $ds="disabled"; ?><script type="text/javascript"> var dates = new Array(); <? for ($i=0; $i<=90; $i++) { $prev_date = GetTime(time()-86400*$i); ?>dates[<?php echo $i; ?> ]="<?php echo $prev_date; ?> ";<? if (!is_array($arr["reference"])) $arr["reference"] = array(); if (!is_array($arr["reference_id"])) $arr["reference_id"] = array(); $arr["reference"][] = $i." ".GetMessage("TOOLS_DN"); $arr["reference_id"][] = $i; } ?></script><? $str .= SelectBoxFromArray($sname, $arr, $value , " ", "onchange=\"".$sFromName."_SetDate()\" ".$field_select); $str .= " "; } $str .= '<input '.$ds.' '.$field_input.' type="text" name="'.$sFromName.'" id="'.$sFromName.'" size="'.$size.'" value="'.htmlspecialcharsbx($sFromVal).'" /> '."\n". Calendar($sFromName, $sFormName, $sFromName, $sToName).' ... '."\n". '<input '.$field_input.' type="text" name="'.$sToName.'" id="'.$sToName.'" size="'.$size.'" value="'.htmlspecialcharsbx($sToVal).'" /> '."\n". Calendar($sToName, $sFormName, $sFromName, $sToName)."\n"; return '<span style="white-space: nowrap;">'.$str.'</span>'; }
:</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>
<td><?php echo GetMessage("MAIN_EVENTLOG_ID"); ?> :</td> <td><input type="text" name="find_id" size="47" value="<?php echo htmlspecialcharsbx($find_id); ?> "></td> </tr> <tr> <td><?php echo GetMessage("MAIN_EVENTLOG_TIMESTAMP_X"); ?> :</td> <td><?php echo CAdminCalendar::CalendarPeriod("find_timestamp_x_1", "find_timestamp_x_2", $find_timestamp_x_1, $find_timestamp_x_2, false, 15, true); ?> </td> </tr> <tr> <td><?php echo GetMessage("MAIN_EVENTLOG_SEVERITY"); ?> :</td> <td><?php echo SelectBoxMFromArray("find_severity[]", array("REFERENCE" => array("SECURITY", "WARNING"), "REFERENCE_ID" => array("SECURITY", "WARNING")), $find_severity, GetMessage("MAIN_ALL")); ?> </td> </tr> <tr> <td><?php
<td align="right" width="40%"><span class="adm-required-field"><?php echo GetMessage("BPSNMA_PD_CFROM"); ?> :</span></td> <td width="60%"> <span style="white-space:nowrap;"><input type="text" name="calendar_from" id="id_calendar_from" size="30" value="<?php echo htmlspecialcharsbx($arCurrentValues["calendar_from"]); ?> "><?php echo CAdminCalendar::Calendar("calendar_from", "", "", true); ?> </span> <input type="button" value="..." onclick="BPAShowSelector('id_calendar_from', 'datetime');"> </td> </tr> <tr> <td align="right" width="40%"><span class="adm-required-field"><?php echo GetMessage("BPSNMA_PD_CTO"); ?> :</span></td> <td width="60%"> <span style="white-space:nowrap;"><input type="text" name="calendar_to" id="id_calendar_to" size="30" value="<?php echo htmlspecialcharsbx($arCurrentValues["calendar_to"]); ?> "><?php echo CAdminCalendar::Calendar("calendar_to", "", "", true); ?> </span> <input type="button" value="..." onclick="BPAShowSelector('id_calendar_to', 'datetime');"> </td> </tr>
function Display() { $sDefAction = $sDefTitle = ""; if (!$this->bEditMode) { if (!empty($this->link)) { if (true == $this->boolBX) { $sDefAction = "(new BX.CAdminDialog({\n\t\t\t\t\t\t'content_url': '" . $this->link . (!(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) ? '&bxsku=Y' : '') . "&bxpublic=Y&" . bitrix_sessid_get() . "',\n\t\t\t\t\t\t'content_post': 'from_module=iblock',\n\t\t\t\t\t\t'draggable': true,\n\t\t\t\t\t\t'resizable': true,\n\t\t\t\t\t\t'buttons': [BX.CAdminDialog.btnSave, BX.CAdminDialog.btnCancel]\n\t\t\t\t\t})).Show();"; } else { $sDefAction = "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($this->link) . "', event);"; } $sDefTitle = $this->title; } else { foreach ($this->aActions as $action) { if ($action["DEFAULT"] == true) { if (true == $this->boolBX) { $sDefAction = "(new BX.CAdminDialog({\n\t\t\t\t\t\t'content_url': '" . CUtil::addslashes($action["ACTION"]) . "',\n\t\t\t\t\t\t'content_post': '" . (!(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) ? '&bxsku=Y' : '') . "&bxpublic=Y&from_module=iblock&" . bitrix_sessid_get() . "',\n\t\t\t\t\t\t'draggable': true,\n\t\t\t\t\t\t'resizable': true,\n\t\t\t\t\t\t'buttons': [BX.CAdminDialog.btnSave, BX.CAdminDialog.btnCancel]\n\t\t\t\t\t})).Show();"; } else { $sDefAction = $action["ACTION"] ? htmlspecialcharsbx($action["ACTION"]) : "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($action["LINK"]) . "', event)"; } $sDefTitle = !empty($action["TITLE"]) ? $action["TITLE"] : $action["TEXT"]; break; } } } } $sMenuItems = ""; if (!empty($this->aActions)) { $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions)); } $aUserOpt = CUserOptions::GetOption("global", "settings"); ?> <tr class="adm-list-table-row<?php echo isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true ? ' footer' : ''; echo $this->bEditMode ? ' adm-table-row-active' : ''; ?> "<?php echo $sMenuItems != "" && $aUserOpt["context_menu"] != "N" ? ' oncontextmenu="return ' . $sMenuItems . ';"' : ''; echo $sDefAction != "" ? ' ondblclick="' . $sDefAction . '"' . (!empty($sDefTitle) ? ' title="' . GetMessage("admin_lib_list_double_click") . ' ' . $sDefTitle . '"' : '') : ''; ?> > <?php if (count($this->pList->arActions) > 0 || $this->pList->bCanBeEdited) { $check_id = RandString(5); ?> <td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?php echo $this->bReadOnly ? ' adm-list-table-checkbox-disabled' : ''; ?> "><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="SUB_ID[]" id="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> " value="<?php echo $this->id; ?> " autocomplete="off" title="<?php echo GetMessage("admin_lib_list_check"); ?> "<?php echo $this->bReadOnly ? ' disabled="disabled"' : ''; echo $this->bEditMode ? ' checked="checked" disabled="disabled"' : ''; ?> /><label class="adm-designed-checkbox-label adm-checkbox" for="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> "></label></td> <?php } if ($this->pList->bShowActions) { if (!empty($this->aActions)) { ?> <td class="adm-list-table-cell adm-list-table-popup-block" onclick="BX.adminSubList.ShowMenu(this.firstChild, this.parentNode.oncontextmenu(), this.parentNode);"><div class="adm-list-table-popup" title="<?php echo GetMessage("admin_lib_list_actions_title"); ?> "></div></td> <?php } else { ?> <td class="adm-list-table-cell"></td> <?php } } $bVarsFromForm = $this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs); foreach ($this->aHeaders as $id => $header_props) { if (!in_array($id, $this->pList->arVisibleColumns)) { continue; } $field = $this->aFields[$id]; if ($this->bEditMode && isset($field["edit"])) { if ($bVarsFromForm && $_REQUEST["FIELDS"]) { $val = $_REQUEST["FIELDS"][$this->id][$id]; } else { $val = $this->arRes[$id]; } $val_old = $this->arRes[$id]; echo '<td class="adm-list-table-cell' . ($header_props['align'] ? ' align-' . $header_props['align'] : '') . ' ' . ($header_props['valign'] ? ' valign-' . $header_props['valign'] : '') . '">'; if (is_array($val_old)) { foreach ($val_old as $k => $v) { echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . '][' . htmlspecialcharsbx($k) . ']" value="' . htmlspecialcharsbx($v) . '">'; } } else { echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val_old) . '">'; } switch ($field["edit"]["type"]) { case "checkbox": echo '<input type="hidden" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="N">'; echo '<input type="checkbox" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="Y"' . ($val == 'Y' ? ' checked' : '') . '>'; break; case "select": echo '<select name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']"' . $this->__AttrGen($field["edit"]["attributes"]) . '>'; foreach ($field["edit"]["values"] as $k => $v) { echo '<option value="' . htmlspecialcharsbx($k) . '" ' . ($k == $val ? ' selected' : '') . '>' . htmlspecialcharsex($v) . '</option>'; } echo '</select>'; break; case "input": if (!$field["edit"]["attributes"]["size"]) { $field["edit"]["attributes"]["size"] = "10"; } echo '<input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">'; break; case "calendar": if (!$field["edit"]["attributes"]["size"]) { $field["edit"]["attributes"]["size"] = "10"; } echo '<span style="white-space:nowrap;"><input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">'; echo CAdminCalendar::Calendar('FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']') . '</span>'; break; default: echo $field["edit"]['value']; } echo '</td>'; } else { if (!is_array($this->arRes[$id])) { $val = trim($this->arRes[$id]); } else { $val = $this->arRes[$id]; } switch ($field["view"]["type"]) { case "checkbox": if ($val == 'Y') { $val = GetMessage("admin_lib_list_yes"); } else { $val = GetMessage("admin_lib_list_no"); } break; case "select": if ($field["edit"]["values"][$val]) { $val = $field["edit"]["values"][$val]; } break; } if ($field["view"]['type'] == 'html') { $val = $field["view"]['value']; } else { $val = htmlspecialcharsex($val); } echo '<td class="adm-list-table-cell' . ($header_props['align'] ? ' align-' . $header_props['align'] : '') . ' ' . ($header_props['valign'] ? ' valign-' . $header_props['valign'] : '') . '">'; echo (string) $val != "" ? $val : ' '; if ($field["edit"]["type"] == "calendar") { echo CAdminCalendar::ShowScript(); } echo '</td>'; } } echo '</tr>'; }
$tabControl->AddCheckBoxField("ACTIVE", GetMessage("DSC_ACTIVE") . ":", false, "Y", $arDiscount['ACTIVE'] == "Y"); $tabControl->AddEditField("NAME", GetMessage("DSC_NAME") . ":", true, array("size" => 50, "maxlength" => 255), htmlspecialcharsbx($arDiscount['NAME'])); $tabControl->AddDropDownField("SITE_ID", GetMessage('DSC_SITE') . ':', true, $arSiteList, $arDiscount['SITE_ID']); $tabControl->BeginCustomField("PERIOD", GetMessage('DSC_PERIOD') . ":", false); ?> <tr id="tr_PERIOD"> <td width="40%"><?php echo $tabControl->GetCustomLabelHTML(); ?> </td> <td width="60%"><?php $periodValue = ''; if ('' != $arDiscount['ACTIVE_FROM'] || '' != $arDiscount['ACTIVE_TO']) { $periodValue = CAdminCalendar::PERIOD_INTERVAL; } echo CAdminCalendar::CalendarPeriodCustom('ACTIVE_FROM', 'ACTIVE_TO', $arDiscount['ACTIVE_FROM'], $arDiscount['ACTIVE_TO'], true, 19, true, array(CAdminCalendar::PERIOD_EMPTY => GetMessage('BT_CAT_DISCOUNT_EDIT_CALENDARE_PERIOD_EMPTY'), CAdminCalendar::PERIOD_INTERVAL => GetMessage('BT_CAT_DISCOUNT_EDIT_CALENDARE_PERIOD_INTERVAL')), $periodValue); ?> </td> </tr><?php $tabControl->EndCustomField("PERIOD", '<input type="hidden" name="ACTIVE_FROM" value="' . htmlspecialcharsbx($arDiscount['ACTIVE_FROM']) . '">' . '<input type="hidden" name="ACTIVE_TO" value="' . htmlspecialcharsbx($arDiscount['ACTIVE_FROM']) . '">'); $tabControl->BeginCustomField("VALUE_TYPE", GetMessage('DSC_TYPE') . ":", true); ?> <tr id="tr_VALUE_TYPE" class="adm-detail-required-field"> <td width="40%"><?php echo $tabControl->GetCustomLabelHTML(); ?> </td> <td width="60%"> <select name="VALUE_TYPE" id="ob_value_type"><?php foreach (CCatalogDiscount::GetDiscountTypes(true) as $key => $value) { ?>
/** * @param $arUserField * @param $value * @param CAdminListRow $row */ function AddUserField($arUserField, $value, &$row) { if($arUserField["USER_TYPE"]) { $js = $this->ShowScript(); if(is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"))) { if($arUserField["MULTIPLE"] == "N") { $html = call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]", "VALUE" => htmlspecialcharsbx($value), ), ) ); if($html == '') $html = ' '; $row->AddViewField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript()); } elseif(is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtmlmulty"))) { if(is_array($value)) $form_value = $value; else $form_value = unserialize($value); if(!is_array($form_value)) $form_value = array(); foreach($form_value as $key=>$val) $form_value[$key] = htmlspecialcharsbx($val); $html = call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtmlmulty"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[]", "VALUE" => $form_value, ), ) ); if($html == '') $html = ' '; $row->AddViewField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript()); } else { $html = ""; if(is_array($value)) $form_value = $value; else $form_value = strlen($value) > 0? unserialize($value): false; if(!is_array($form_value)) $form_value = array(); foreach($form_value as $i=>$val) { if($html!="") $html .= " / "; $html .= call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[".$i."]", "VALUE" => htmlspecialcharsbx($val), ), ) ); } if($html == '') $html = ' '; $row->AddViewField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript()); } } if($arUserField["EDIT_IN_LIST"]=="Y" && is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"))) { if($arUserField["MULTIPLE"] == "N") { $html = call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]", "VALUE" => htmlspecialcharsbx($value), ), ) ); if($html == '') $html = ' '; $row->AddEditField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript()); } elseif(is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtmlmulty"))) { if(is_array($value)) $form_value = $value; else $form_value = strlen($value) > 0? unserialize($value): false; if(!is_array($form_value)) $form_value = array(); foreach($form_value as $key=>$val) $form_value[$key] = htmlspecialcharsbx($val); $html = call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtmlmulty"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."][]", "VALUE" => $form_value, ), ) ); if($html == '') $html = ' '; $row->AddEditField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript()); } else { $html = "<table id=\"table_".$arUserField["FIELD_NAME"]."_".$row->id."\">"; if(is_array($value)) $form_value = $value; else $form_value = unserialize($value); if(!is_array($form_value)) $form_value = array(); $i = -1; foreach($form_value as $i=>$val) { $html .= '<tr><td>'.call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[".$i."]", "VALUE" => htmlspecialcharsbx($val), ), ) ).'</td></tr>'; } $html .= '<tr><td>'.call_user_func_array( array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"), array( $arUserField, array( "NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[".($i+1)."]", "VALUE" => "", ), ) ).'</td></tr>'; $html .= '<tr><td><input type="button" value="'.GetMessage("USER_TYPE_PROP_ADD").'" onClick="addNewRow(\'table_'.$arUserField["FIELD_NAME"].'_'.$row->id.'\', /'.'FIELDS\['.$row->id.'\]\['.$arUserField["FIELD_NAME"].'\]'.'\[([0-9]*)\]/g, 1)"></td></tr>'. '</table>'; $row->AddEditField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript()); } } } }
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 ' '; } }
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
} $control->BeginCustomField($prefix . 'PERIOD', Loc::getMessage('BX_SALE_DISCOUNT_COUPON_FIELD_PERIOD'), false); ?> <tr id="tr_COUPON_PERIOD"> <td width="40%"><?php echo $control->GetCustomLabelHTML(); ?> </td> <td width="60%"><?php $periodValue = ''; $activeFrom = $coupon['ACTIVE_FROM'] instanceof Main\Type\DateTime ? $coupon['ACTIVE_FROM']->toString() : ''; $activeTo = $coupon['ACTIVE_TO'] instanceof Main\Type\DateTime ? $coupon['ACTIVE_TO']->toString() : ''; if ($activeFrom != '' || $activeTo != '') { $periodValue = CAdminCalendar::PERIOD_INTERVAL; } $calendar = new CAdminCalendar(); echo $calendar->CalendarPeriodCustom($prefix . 'ACTIVE_FROM', $prefix . 'ACTIVE_TO', $activeFrom, $activeTo, true, 19, true, array(CAdminCalendar::PERIOD_EMPTY => Loc::getMessage('BX_SALE_DISCOUNT_COUPON_PERIOD_EMPTY'), CAdminCalendar::PERIOD_INTERVAL => Loc::getMessage('BX_SALE_DISCOUNT_COUPON_PERIOD_INTERVAL')), $periodValue); unset($activeTo, $activeFrom, $periodValue); ?> </td> </tr><?php $control->EndCustomField($prefix . 'PERIOD'); $control->BeginCustomField($prefix . 'USER_ID', Loc::getMessage('BX_SALE_DISCOUNT_COUPON_FIELD_USER_ID'), false); ?> <tr id="tr_USER_ID"> <td width="40%"><?php echo $control->GetCustomLabelHTML(); ?> </td> <td width="60%"><?php echo FindUserID($prefix . 'USER_ID', $coupon['USER_ID'] > 0 ? $coupon['USER_ID'] : '', '', $couponFormID);
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"]) . '">' : ''); }
public function GetJSFunctionsForFields($documentType, $objectName, $arDocumentFields = array(), $arDocumentFieldTypes = array()) { $iblockId = intval(substr($documentType, strlen("type_"))); if ($iblockId <= 0) { return ""; } ob_start(); echo CAdminCalendar::ShowScript(); ?> <script type="text/javascript"> <?php echo $objectName; ?> .GetGUIFieldEdit = function(field, value, showAddButton, inputName) { alert("Deprecated method GetGUIFieldEdit used"); if (!this.arDocumentFields[field]) return ""; if (typeof showAddButton == "undefined") showAddButton = false; if (typeof inputName == "undefined") inputName = field; var type = this.arDocumentFields[field]["Type"]; var bAddSelection = false; var bAddButton = true; s = ""; if (type == "N") { s += '<input type="text" size="10" id="id_' + field + '" name="' + inputName + '" value="' + this.HtmlSpecialChars(value) + '">'; } else if (type == "L") { s += '<select name="' + inputName + '_1">'; s += '<option value=""></option>'; for (k in this.arDocumentFields[field]["Options"]) { s += '<option value="' + this.arDocumentFields[field]["Options"][k][0] + '"' + (value == this.arDocumentFields[field]["Options"][k][0] ? " selected" : "") + '>' + this.arDocumentFields[field]["Options"][k][1] + '</option>'; if (value == this.arDocumentFields[field]["Options"][k][0]) value = ""; } s += '</select>'; bAddSelection = true; } else if (type == "F") { s += '<input type="file" id="id_' + field + '_1" name="' + inputName + '">'; bAddSelection = true; bAddButton = true; } else if (type == "B") { s += '<select name="' + inputName + '_1" id="id_' + name + '">'; s += '<option value=""></option>'; s += '<option value="Y"' + (value == "Y" ? " selected" : "") + '><?php echo GetMessage("BPVDX_YES"); ?> </option>'; s += '<option value="N"' + (value == "N" ? " selected" : "") + '><?php echo GetMessage("BPVDX_NO"); ?> </option>'; s += '</select>'; bAddSelection = true; if (value == "Y" || value == "N") value = ""; } else if (type == "S:DateTime") { s += '<span style="white-space:nowrap;">'; s += '<input type="text" name="' + inputName + '" id="id_' + field + '" size="10" value="' + this.HtmlSpecialChars(value) + '">'; s += '<a href="javascript:void(0);" title="<?php echo GetMessage("BPVDX_CALENDAR"); ?> ">'; s += '<img src="<?php echo ADMIN_THEMES_PATH; ?> /<?php echo ADMIN_THEME_ID; ?> /images/calendar/icon.gif" alt="<?php echo GetMessage("BPVDX_CALENDAR"); ?> " class="calendar-icon" onclick="jsAdminCalendar.Show(this, \'' + inputName + '\', \'\', \'\', ' + ((type == "datetime") ? 'true' : 'false') + ', <?php echo time() + date("Z") + CTimeZone::GetOffset(); ?> );" onmouseover="this.className+=\' calendar-icon-hover\';" onmouseout="this.className = this.className.replace(/\s*calendar-icon-hover/ig, \'\');">'; s += '</a></span>'; } //else if (type.substr(0, 2) == "S:" && this.arUserTypes[type.substr(2)]) //{ // s += eval(this.arUserTypes[type.substr(2)] + "(\"" + field + "\", \"" + value + "\")"); //} else // type == "S" { s += '<input type="text" size="40" id="id_' + field + '" name="' + inputName + '" value="' + this.HtmlSpecialChars(value) + '">'; } if (bAddSelection) s += '<br /><input type="text" id="id_' + field + '" name="' + inputName + '" value="' + this.HtmlSpecialChars(value) + '">'; if (bAddButton && showAddButton) s += '<input type="button" value="..." onclick="BPAShowSelector(\'id_' + field + '\', \'' + type + '\');">'; return s; } <?php echo $objectName; ?> .SetGUIFieldEdit = function(field) { alert("Deprecated method SetGUIFieldEdit used"); } <?php echo $objectName; ?> .GetGUIFieldEditSimple = function(type, value, name) { alert("Deprecated method GetGUIFieldEditSimple used"); if (typeof name == "undefined" || name.length <= 0) name = "BPVDDefaultValue"; if (typeof value == "undefined") { value = ""; var obj = document.getElementById('id_' + name); if (obj) { if (obj.type.substr(0, "select".length) == "select") value = obj.options[obj.selectedIndex].value; else value = obj.value; } } s = ""; if (type == "F") { s += ''; } else if (type == "B") { s += '<select name="' + name + '" id="id_' + name + '">'; s += '<option value=""></option>'; s += '<option value="Y"' + (value == "Y" ? " selected" : "") + '><?php echo GetMessage("BPVDX_YES"); ?> </option>'; s += '<option value="N"' + (value == "N" ? " selected" : "") + '><?php echo GetMessage("BPVDX_NO"); ?> </option>'; s += '</select>'; } else if (type == "S:UserID") { s += '<input type="text" size="10" id="id_' + name + '" name="' + name + '" value="' + this.HtmlSpecialChars(value) + '">'; s += '<input type="button" value="..." onclick="BPAShowSelector(\'id_' + name + '\', \'user\')">'; } else { s += '<input type="text" size="10" id="id_' + name + '" name="' + name + '" value="' + this.HtmlSpecialChars(value) + '">'; } return s; } <?php echo $objectName; ?> .SetGUIFieldEditSimple = function(type, name) { alert("Deprecated method SetGUIFieldEditSimple used"); if (typeof name == "undefined" || name.length <= 0) name = "BPVDDefaultValue"; s = ""; if (type != "F") { var obj = document.getElementById('id_' + name); if (obj) { if (obj.type.substr(0, "select".length) == "select") s = obj.options[obj.selectedIndex].value; else s = obj.value; } } return s; } </script> <?php $str = ob_get_contents(); ob_end_clean(); return $str; }
public static function BuildDialogContent($site) { global $APPLICATION; $actUri = $APPLICATION->GetCurPage() . "?search=Y&ssess=" . CFilemanSearch::GetSearchSess(); $s = DeleteParam(array('search', 'ssess')); if ($s != '') { $actUri .= '&' . $s; } $defMask = COption::GetOptionString("fileman", "search_mask", "*.php"); // Search dialog $aTabs[] = array("DIV" => "bx_fm_tab_search", "TAB" => GetMessage("FM_UTIL_FIND"), "ICON" => "", "TITLE" => GetMessage("FM_UTIL_FIND_TITLE"), "ONSELECT" => "window.oFMSearch.SetTab('search');"); $aTabs[] = array("DIV" => "bx_fm_tab_replace", "TAB" => GetMessage("FM_UTIL_REPLACE"), "ICON" => "", "TITLE" => GetMessage("FM_UTIL_REPLACE_TITLE"), "ONSELECT" => "window.oFMSearch.SetTab('replace');"); $searchTabControl = new CAdmintabControl("searchTabControl", $aTabs, false, true); $searchTabControl->SetPublicMode('oSearchDialog'); $searchTabControl->Begin(); ?> <?php $searchTabControl->BeginNextTab(); ?> <tr><td> <div id="bx_search_cont" class="bxfm-search-cont"><form name="bx_search_form" action="<?php echo $actUri; ?> " method="POST"> <table id="bx_fms_tbl" class="bxfm-d-params bxfm-d-params-add-hide"> <tr id="bx_search_in_res_tr"> <td class="bxfm-d-label"><input id="bx_search_in_res" type="checkbox" value="Y" checked="checked" /></td> <td class="bxfm-d-value"><label for="bx_search_in_res" style="font-weight: bold;"><?php echo GetMessage("FM_UTIL_IN_SEARCH_RESULT"); ?> </label></td> </tr> <tr title='<?php echo GetMessage("FM_UTIL_FILE_NAME_TITLE"); ?> '> <td class="bxfm-d-label"><label for="bx_search_file"><?php echo GetMessage("FM_UTIL_FILE_NAME"); ?> :</label></td> <td class="bxfm-d-value"><input id="bx_search_file" name="bx_search_file" value="<?php echo $defMask; ?> " style="width: 220px;" type="text"/></td> </tr> <tr title="<?php echo GetMessage("FM_UTIL_PHRASE_TITLE"); ?> "> <td class="bxfm-d-label"><label for="bx_search_phrase"><?php echo GetMessage("FM_UTIL_PHRASE"); ?> :</label></td> <td class="bxfm-d-value"><input id="bx_search_phrase" name="bx_search_phrase" value="" style="width: 220px;" type="text"/></td> </tr> <tr class="bxfm-d-only-replace" title="<?php echo GetMessage("FM_UTIL_REPLACE_INP_TITLE"); ?> "> <td class="bxfm-d-label"><label for="bx_replace_phrase"><?php echo GetMessage("FM_UTIL_REPLACE_INP"); ?> :</label></td> <td class="bxfm-d-value"><input id="bx_replace_phrase" name="bx_replace_phrase" value="" style="width: 220px;" type="text"/></td> </tr> <tr title="<?php echo GetMessage("FM_UTIL_DIR_TITLE"); ?> "> <td class="bxfm-d-label"><label for="bx_search_dir"><?php echo GetMessage("FM_UTIL_DIR"); ?> :</label></td> <td class="bxfm-d-value"><input id="bx_search_dir" name="bx_search_dir" value="" style="width: 220px;" type="text"/> <input id="bx_search_fd_but" type="button" value="..." title="<?php echo GetMessage('FD_OPEN_DIR'); ?> " onclick="FMFD_SearchDirOpen(true, {site: window.oFMSearch.oSiteSel.value, path: window.oFMSearch.pSearchDir.value});" /><span class="bxfm-site-sel" id="bx_search_site_sel"></span></td> </tr> <tr> <td class="bxfm-d-label"><label for="bx_search_subdir"><?php echo GetMessage("FM_UTIL_INCLUDE_SUBFOLDER"); ?> </label></td> <td class="bxfm-d-value"><input id="bx_search_subdir" name="bx_search_subdir" type="checkbox" value="Y" checked="checked" /></td> </tr> <tr class="bxfm-d-title"> <td colSpan="2"> <a class="bxfm-add-link" id="bx_fms_add_lnk" href="javascript: void(0);"><?php echo GetMessage("FM_UTIL_ADDITIONAL"); ?> <span class="bxfm-d-span-hide">(<?php echo GetMessage("FM_UTIL_HIDE"); ?> )</span></a> </td> </tr> <tr class="bxfm-add-hide" title="<?php echo GetMessage("FM_UTIL_DATE_TITLE"); ?> "> <td class="bxfm-d-label"><label for="bx_search_date_sel"><?php echo GetMessage("FM_UTIL_DATE"); ?> :</label></td> <td class="bxfm-d-value"> <select id="bx_search_date_sel" name="bx_search_date_sel"> <option value=""> - <?php echo GetMessage("FM_UTIL_NO_VAL"); ?> - </option> <option value="day"><?php echo GetMessage("FM_UTIL_DAY"); ?> </option> <option value="week"><?php echo GetMessage("FM_UTIL_WEEK"); ?> </option> <option value="month"><?php echo GetMessage("FM_UTIL_MONTH"); ?> </option> <option value="year"><?php echo GetMessage("FM_UTIL_YEAR"); ?> </option> <option value="set"><?php echo GetMessage("FM_UTIL_SET_EXACTLY"); ?> </option> </select> <div id="bx_search_date_div" class="bxfm-d-adjust-div"> <?php echo GetMessage("FM_UTIL_FROM"); ?> : <input name="bx_search_date_from" id="bx_search_date_from" value="" style="width: 90px;" type="text"/><?php echo CAdminCalendar::Calendar("bx_search_date_from", "bx_search_form"); ?> <?php echo GetMessage("FM_UTIL_TO"); ?> : <input name="bx_search_date_to" id="bx_search_date_to" value="" style="width: 90px;" type="text"/><?php echo CAdminCalendar::Calendar("bx_search_date_to", "bx_search_form"); ?> </div> </td> </tr> <tr class="bxfm-add-hide" title="<?php echo GetMessage("FM_UTIL_SIZE_TITLE"); ?> "> <td class="bxfm-d-label"><label for="bx_search_size_sel"><?php echo GetMessage("FM_UTIL_SIZE"); ?> :</label></td> <td class="bxfm-d-value"> <select id="bx_search_size_sel" name="bx_search_size_sel"> <option value=""> - <?php echo GetMessage("FM_UTIL_NO_VAL"); ?> - </option> <option value="100"><?php echo GetMessage("FM_UTIL_SIZE_100"); ?> </option> <option value="100_500"><?php echo GetMessage("FM_UTIL_SIZE_100_500"); ?> </option> <option value="500"><?php echo GetMessage("FM_UTIL_SIZE_500"); ?> </option> <option value="set"><?php echo GetMessage("FM_UTIL_SET_EXACTLY"); ?> </option> </select> <div id="bx_search_size_div" class="bxfm-d-adjust-div"> <?php echo GetMessage("FM_UTIL_SIZE_FROM"); ?> : <input id="bx_search_size_from" name="bx_search_size_from" value="" style="width: 70px;" type="text"/><?php echo GetMessage("FM_UTIL_KB"); ?> <?php echo GetMessage("FM_UTIL_SIZE_TO"); ?> : <input id="bx_search_size_to" name="bx_search_size_to" value="" style="width: 70px;" type="text"/><?php echo GetMessage("FM_UTIL_KB"); ?> </div> </td> </tr> <tr class="bxfm-add-hide bxfm-d-only-search"> <td class="bxfm-d-label"><label for="bx_search_dirs_too"><?php echo GetMessage("FM_UTIL_SEARCH_DIRS"); ?> </label></td> <td class="bxfm-d-value"><input id="bx_search_dirs_too" name="bx_search_dirs_too" type="checkbox" value="Y" checked="checked" /></td> </tr> <tr class="bxfm-add-hide-TEMP" style="display: none;"> <td class="bxfm-d-label"><label for="bx_search_entire"><?php echo GetMessage("FM_UTIL_ENTIRE"); ?> </label></td> <td class="bxfm-d-value"><input id="bx_search_entire" type="checkbox" value="Y" /></td> </tr> <tr class="bxfm-add-hide"> <td class="bxfm-d-label"><label for="bx_search_case"><?php echo GetMessage("FM_UTIL_CASE_SENS"); ?> </td> <td class="bxfm-d-value"><input id="bx_search_case" name="bx_search_case" type="checkbox" value="Y" /></label></td> </tr> </table> <input type="hidden" name="search" value="Y" /> <div id="bx_search_res_cont"></div> <?php CAdminFileDialog::ShowScript(array("event" => "FMFD_SearchDirOpen", "arResultDest" => array("ELEMENT_ID" => "bx_search_dir"), "arPath" => array("SITE" => $site, "PATH" => "/"), "select" => 'D', "operation" => 'O', "showUploadTab" => false, "showAddToMenuTab" => false, "allowAllFiles" => false, "SaveConfig" => true)); ?> </form></div> </td></tr> <?php $searchTabControl->BeginNextTab(); ?> <tr><td> <div id="bx_replace_cont" class="bxfm-replace-cont"></div> </td></tr> <?php $searchTabControl->End(); // *** Copy / move dialog *** ?> <div id="bx_copy_dialog" class="bx-copy-cont"> <table class="bx-copy-cont-tbl bx-copy-cont-tbl-add-hide" id="bx_copy_table" style="width: 470px;"> <tr> <td class="bxfm-d-label"><label for="bx_copy_file_list"><?php echo GetMessage("FM_UTIL_FILE"); ?> :</label></td> <td class="bxfm-d-value"><div id="bx_copy_file_list" style="margin-top: 2px;"><div></td> </tr> <tr> <td class="bxfm-d-label"><label for="bx_copy_to"><?php echo GetMessage("FM_COPY_TO"); ?> :</label></td> <td class="bxfm-d-value"> <div style="width: 340px;"> <input id="bx_copy_to" style="width: 255px;" value="/" type="text" /><input type="button" value="..." title="<?php echo GetMessage('FD_OPEN_DIR'); ?> " onclick="FMFD_CopyMoveOpen(true, {site: window.oBXFMCopy.oSiteSel.value, path: window.oBXFMCopy.oCopyTo.pInput.value});" /> <span class="bxfm-site-sel" id="bx_copy_site_sel"></span> </div> </td> </tr> <tr class="bx-copy-d-title"> <td colSpan="2"> <a class="bx-copy-add-link" id="bx_copy_add_lnk" href="javascript: void(0);"><?php echo GetMessage("FM_UTIL_ADDITIONAL"); ?> <span class="bx-copy-d-span-hide">(<?php echo GetMessage("FM_UTIL_HIDE"); ?> )</span></a> </td> </tr> <tr class="bxfm-add-hide"> <td colSpan="2" style="padding: 5px 0 5px 120px !important;"><?php echo GetMessage("FM_COPY_COINCID"); ?> :</td> </tr> <tr class="bxfm-add-hide"> <td class="bxfm-d-label"> <input id="bx_copy_ask_user" type="radio" name="bx_copy_coincidence" value="ask" checked="checked"/> </td> <td class="bxfm-d-value"> <label for="bx_copy_ask_user"><?php echo GetMessage("FM_COPY_ASK_USER"); ?> </label> </td> </tr> <tr class="bxfm-add-hide"> <td class="bxfm-d-label"> <input id="bx_copy_replace" type="radio" name="bx_copy_coincidence" value="replace" /> </td> <td class="bxfm-d-value"> <label for="bx_copy_replace"><?php echo GetMessage("FM_COPY_REPLACE"); ?> </label> </td> </tr> <tr class="bxfm-add-hide"> <td class="bxfm-d-label"> <input id="bx_copy_auto_rename" type="radio" name="bx_copy_coincidence" value="auto_rename" /> </td> <td class="bxfm-d-value"> <label for="bx_copy_auto_rename"><?php echo GetMessage("FM_COPY_AUTO_RENAME"); ?> </label> </td> </tr> <tr class="bxfm-add-hide"> <td class="bxfm-d-label"> <input id="bx_copy_skip" type="radio" name="bx_copy_coincidence" value="skip" /> </td> <td class="bxfm-d-value"> <label for="bx_copy_skip"><?php echo GetMessage("FM_COPY_SKIP"); ?> </label> </td> </tr> </table> <?php CAdminFileDialog::ShowScript(array("event" => "FMFD_CopyMoveOpen", "arResultDest" => array("ELEMENT_ID" => "bx_copy_to"), "arPath" => array("SITE" => $GLOBALS['site'], "PATH" => "/"), "select" => 'D', "operation" => 'O', "showUploadTab" => false, "showAddToMenuTab" => false, "allowAllFiles" => false, "SaveConfig" => true)); ?> </div> <div id="bx_copy_ask_dialog" class="bx-copy-cont"> <div style="margin: 0 70px 0 70px; width: 460px; padding: 10px 0 5px;"> <?php echo GetMessage("FM_UTIL_FILE_EXIST", array("#NAME#" => "<span id='bx_copy_ask_file_name'>#NAME#</span>", "#FOLDER#" => "<span id='bx_copy_ask_folder'>#FOLDER#</span>")); ?> : </div> <div style="margin: 0 50px;"> <table class="bx-copy-compare-tbl"> <tr class="bx-copy-title"> <td><?php echo GetMessage("FM_UTIL_NEW_FILE"); ?> :</td> <td rowSpan="4" class="bx-copy-sep-td"></td> <td><?php echo GetMessage("FM_UTIL_ORIGINAL_FILE"); ?> :</td> </tr> <tr> <td> <div class="bx-copy-name-cnt"> <a id="bx_copy_ask_file1" href="javascript:void();">file1</a> <div id="bxc_ask_nn_cont1" class="bx-copy-new-name bxcnn-0"></div> </div> </td> <td> <div class="bx-copy-name-cnt"><a id="bx_copy_ask_file2" href="javascript:void();">file2</a></div> </td> </tr> <tr id="bx_copy_ask_size_row"> <td><?php echo GetMessage("FM_UTIL_SIZE"); ?> : <span id="bx_copy_ask_size1"></span></td> <td><?php echo GetMessage("FM_UTIL_SIZE"); ?> : <span id="bx_copy_ask_size2"></span></td> </tr> <tr class="bx-copy-bottom"> <td><?php echo GetMessage("FM_UTIL_DATE"); ?> : <span id="bx_copy_ask_date1"></span></td> <td><?php echo GetMessage("FM_UTIL_DATE"); ?> : <span id="bx_copy_ask_date2"></span></td> </tr> </table> </div> </div> <?php $searchTabControl->BeginNextTab(); // *** Pack / unpack dialog *** ?> <div id="bx_pack_dialog" class="bx-pack-cont"> <table class="bx-pack-cont-tbl bx-pack-cont-tbl-add-hide" id="bx_pack_table" style="width: 470px;"> <tr> <td class="bxfm-d-label"><label for="bx_pack_file_list"><?php echo GetMessage("FM_PACK_FILE"); ?> :</label></td> <td class="bxfm-d-value"><div id="bx_pack_file_list" style="margin-top: 2px;"><div></td> </tr> <tr id="bxfm-arctype-line"> <td class="bxfm-d-label"><label for="bx_pack_arc_type"><?php echo GetMessage("FM_PACK_ARC_TYPE"); ?> :</label></td> <td class="bxfm-d-value"><div id="bx_pack_arc_type" class="bxfm-arctype-sel" style="margin-top: 4px;"><div></td> </tr> <tr> <!-- if pack "to archive", if not - "to folder" --> <td class="bxfm-d-label"><label for="bx_pack_to"><?php echo GetMessage("FM_PACK_TO"); ?> :</label></td> <td class="bxfm-d-value"> <div style="width: 340px;"> <input id="bx_pack_to" style="width: 260px;" value="/" type="text"/> <input type="button" value="..." title="<?php echo GetMessage('FD_OPEN_DIR'); ?> " onclick="FMFD_PackUnpackOpen(true, {site: window.oBXFMPack.oSiteSel.value, path: window.oBXFMPack.GetFolderPath(window.oBXFMPack.oPackTo.pInput.value)});" /> <span class="bxfm-site-sel" id="bx_pack_site_sel"></span> </div> </td> </tr> <tr class="bx-pack-d-title" id="bx-pack-d-title-label"> <td></td> <td><?php echo GetMessage("FM_PACK_ADDITIONAL"); ?> </td> </tr> <!--<tr class="bxfm-add-hide" id="bxfm-pack-option-ask"> <td class="bxfm-d-label"> <input id="bx_pack_ask_user" type="radio" name="bx_pack_coincidence" value="ask" checked="checked"/> </td> <td class="bxfm-d-value"> <label for="bx_pack_ask_user"><?php echo GetMessage("FM_PACK_ASK_USER"); ?> </label> </td> </tr>--> <tr class="bxfm-add-hide" id="bxfm-pack-option-replace"> <td class="bxfm-d-label"> <input id="bx_pack_replace" type="radio" name="bx_pack_coincidence" value="replace" /> </td> <td class="bxfm-d-value"> <label for="bx_pack_replace"><?php echo GetMessage("FM_PACK_REPLACE"); ?> </label> </td> </tr> <!--<tr class="bxfm-add-hide" id="bxfm-pack-option-rename"> <td class="bxfm-d-label"> <input id="bx_pack_auto_rename" type="radio" name="bx_pack_coincidence" value="auto_rename" /> </td> <td class="bxfm-d-value"> <label for="bx_pack_auto_rename"><?php echo GetMessage("FM_PACK_AUTO_RENAME"); ?> </label> </td> </tr>--> <tr class="bxfm-add-hide" id="bxfm-pack-option-skip"> <td class="bxfm-d-label"> <input id="bx_pack_skip" type="radio" name="bx_pack_coincidence" value="skip" /> </td> <td class="bxfm-d-value"> <label for="bx_pack_skip"><?php echo GetMessage("FM_PACK_SKIP"); ?> </label> </td> </tr> </table> <?php CAdminFileDialog::ShowScript(array("event" => "FMFD_PackUnpackOpen", "arResultDest" => array("FUNCTION_NAME" => "MakeArchivePathFromFolderPath"), "arPath" => array("SITE" => $GLOBALS['site'], "PATH" => "/"), "select" => 'D', "operation" => 'O', "showUploadTab" => false, "showAddToMenuTab" => false, "allowAllFiles" => false, "SaveConfig" => true)); ?> </div> <script type="text/javascript"> function MakeArchivePathFromFolderPath(filename, path, site) { var oldArchivePath = BX('bx_pack_to').value, newArchivePath, archiveName; archiveName = oldArchivePath.substr(oldArchivePath.lastIndexOf('/') + 1); newArchivePath = "/" + path + "/" + filename + "/" + archiveName; newArchivePath = newArchivePath.replace(/[\/]+$/g, ""); newArchivePath = newArchivePath.replace(/[\/]+/g, '/'); newArchivePath = newArchivePath.replace(/[\\]+/g, '/'); if (newArchivePath == '') newArchivePath = '/'; BX('bx_pack_to').value = newArchivePath; } </script> <div id="bx_pack_ask_dialog" class="bx-pack-cont"> <div style="margin: 0 20px 0 20px; width: 450px; padding: 10px 0 5px;"> <?php echo GetMessage("FM_UTIL_FILE_EXIST", array("#NAME#" => "<span id='bx_pack_ask_file_name'>#NAME#</span>", "#FOLDER#" => "<span id='bx_pack_ask_folder'>#FOLDER#</span>")); ?> : </div> <table style="margin: 0 20px 0 20px"> <tr> <td> <div class="bx-pack-name-cnt"> <a id="bx_pack_ask_file2" href="javascript:void('');">file1</a> <div id="bxc_ask_nn_cont2" class="bx-pack-new-name bxcnn-0"></div> </div> </td> </tr> <tr id="bx_pack_ask_size_row"> <td><?php echo GetMessage("FM_UTIL_SIZE"); ?> : <span id="bx_pack_ask_size2"></span></td> </tr> <tr class="bx-pack-bottom"> <td><?php echo GetMessage("FM_UTIL_DATE"); ?> : <span id="bx_pack_ask_date2"></span></td> </tr> </table> <br/> </div><?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; }
$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>
<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
<tr id="tr_COUPON_PERIOD" style="display: <?php echo $coupons['COUPON_ADD'] == 'Y' ? 'table-row' : 'none'; ?> ;"> <td width="40%"><?php echo GetMessage('BX_SALE_DISCOUNT_EDIT_FIELDS_COUPON_PERIOD'); ?> </td> <td width="60%"><?php $periodValue = ''; $activeFrom = $coupons['COUPON']['ACTIVE_FROM'] instanceof Main\Type\DateTime ? $coupons['COUPON']['ACTIVE_FROM']->toString() : ''; $activeTo = $coupons['COUPON']['ACTIVE_TO'] instanceof Main\Type\DateTime ? $coupons['COUPON']['ACTIVE_TO']->toString() : ''; if ($activeFrom != '' || $activeTo != '') { $periodValue = CAdminCalendar::PERIOD_INTERVAL; } $calendar = new CAdminCalendar(); echo $calendar->CalendarPeriodCustom('COUPON[ACTIVE_FROM]', 'COUPON[ACTIVE_TO]', $activeFrom, $activeTo, true, 19, true, array(CAdminCalendar::PERIOD_EMPTY => GetMessage('BX_SALE_DISCOUNT_COUPON_PERIOD_EMPTY'), CAdminCalendar::PERIOD_INTERVAL => GetMessage('BX_SALE_DISCOUNT_COUPON_PERIOD_INTERVAL')), $periodValue); unset($calendar); ?> </td> </tr> <tr id="tr_COUPON_TYPE" class="adm-detail-required-field" style="display: <?php echo $coupons['COUPON_ADD'] == 'Y' ? 'table-row' : 'none'; ?> ;"> <td width="40%"><?php echo GetMessage('BX_SALE_DISCOUNT_EDIT_FIELDS_COUPON_TYPE'); ?> </td> <td width="60%"> <select name="COUPON[TYPE]"><?php
function Display() { $sDefAction = $sDefTitle = ""; if(!$this->bEditMode) { if(!empty($this->link)) { $sDefAction = "BX.adminPanel.Redirect([], '".CUtil::JSEscape($this->link)."', event);"; $sDefTitle = $this->title; } else { $this->aActions = array_values($this->aActions); foreach($this->aActions as $action) { if($action["DEFAULT"] == true) { $sDefAction = $action["ACTION"] ? htmlspecialcharsbx($action["ACTION"]) : "BX.adminPanel.Redirect([], '".CUtil::JSEscape($action["LINK"])."', event)" ; $sDefTitle = (!empty($action["TITLE"])? $action["TITLE"]:$action["TEXT"]); break; } } } } $sMenuItems = ""; if(!empty($this->aActions)) $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions)); ?> <tr class="adm-list-table-row<?php echo isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true ? ' footer' : ''; echo $this->bEditMode ? ' adm-table-row-active' : ''; ?> "<?php echo $sMenuItems != "" ? ' oncontextmenu="return ' . $sMenuItems . ';"' : ''; echo $sDefAction != "" ? ' ondblclick="' . $sDefAction . '"' . (!empty($sDefTitle) ? ' title="' . GetMessage("admin_lib_list_double_click") . ' ' . $sDefTitle . '"' : '') : ''; ?> > <? if(count($this->pList->arActions)>0 || $this->pList->bCanBeEdited): $check_id = RandString(5); ?> <td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?php echo $this->bReadOnly ? ' adm-list-table-checkbox-disabled' : ''; ?> "><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="ID[]" id="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> " value="<?php echo $this->id; ?> " autocomplete="off" title="<?php echo GetMessage("admin_lib_list_check"); ?> "<?php echo $this->bReadOnly ? ' disabled="disabled"' : ''; echo $this->bEditMode ? ' checked="checked" disabled="disabled"' : ''; ?> /><label class="adm-designed-checkbox-label adm-checkbox" for="<?php echo $this->table_id . "_" . $this->id . "_" . $check_id; ?> "></label></td> <? endif; if($this->pList->bShowActions): if(!empty($this->aActions)): ?> <td class="adm-list-table-cell adm-list-table-popup-block" onclick="BX.adminList.ShowMenu(this.firstChild, this.parentNode.oncontextmenu(), this.parentNode);"><div class="adm-list-table-popup" title="<?php echo GetMessage("admin_lib_list_actions_title"); ?> "></div></td> <? else: ?> <td class="adm-list-table-cell"></td> <? endif; endif; end($this->pList->aVisibleHeaders); $last_id = key($this->pList->aVisibleHeaders); reset($this->pList->aVisibleHeaders); $bVarsFromForm = ($this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs)); foreach($this->pList->aVisibleHeaders as $id=>$header_props) { $field = $this->aFields[$id]; if($this->bEditMode && isset($field["edit"])) { if($bVarsFromForm && $_REQUEST["FIELDS"]) $val = $_REQUEST["FIELDS"][$this->id][$id]; else $val = $this->arRes[$id]; $val_old = $this->arRes[$id]; echo '<td class="adm-list-table-cell', (isset($header_props['align']) && $header_props['align']? ' align-'.$header_props['align']: ''), (isset($header_props['valign']) && $header_props['valign']? ' valign-'.$header_props['valign']: ''), ($id === $last_id? ' adm-list-table-cell-last': ''), '">'; if(is_array($val_old)) { foreach($val_old as $k=>$v) echo '<input type="hidden" name="FIELDS_OLD['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']['.htmlspecialcharsbx($k).']" value="'.htmlspecialcharsbx($v).'">'; } else { echo '<input type="hidden" name="FIELDS_OLD['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="'.htmlspecialcharsbx($val_old).'">'; } switch($field["edit"]["type"]) { case "checkbox": echo '<input type="hidden" name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="N">'; echo '<input type="checkbox" name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="Y"'.($val=='Y'?' checked':'').'>'; break; case "select": echo '<select name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']"'.$this->__AttrGen($field["edit"]["attributes"]).'>'; foreach($field["edit"]["values"] as $k=>$v) echo '<option value="'.htmlspecialcharsbx($k).'" '.($k==$val?' selected':'').'>'.htmlspecialcharsbx($v).'</option>'; echo '</select>'; break; case "input": if(!$field["edit"]["attributes"]["size"]) $field["edit"]["attributes"]["size"] = "10"; echo '<input type="text" '.$this->__AttrGen($field["edit"]["attributes"]).' name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="'.htmlspecialcharsbx($val).'">'; break; case "calendar": if(!$field["edit"]["attributes"]["size"]) $field["edit"]["attributes"]["size"] = "10"; echo '<span style="white-space:nowrap;"><input type="text" '.$this->__AttrGen($field["edit"]["attributes"]).' name="FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value="'.htmlspecialcharsbx($val).'">'; echo CAdminCalendar::Calendar('FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']').'</span>'; break; case "file": echo CFileInput::Show( 'FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']', $val, $field["edit"]["showInfo"], $field["edit"]["inputs"] ); break; default: echo $field["edit"]['value']; } echo '</td>'; } else { if(!is_array($this->arRes[$id])) $val = trim($this->arRes[$id]); else $val = $this->arRes[$id]; if(isset($field["view"])) { switch($field["view"]["type"]) { case "checkbox": if($val=='Y') $val = htmlspecialcharsex(GetMessage("admin_lib_list_yes")); else $val = htmlspecialcharsex(GetMessage("admin_lib_list_no")); break; case "select": if($field["edit"]["values"][$val]) $val = htmlspecialcharsex($field["edit"]["values"][$val]); break; case "file": if ($val > 0) $val = CFileInput::Show( 'NO_FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']', $val, $field["view"]["showInfo"], $field["view"]["inputs"] ); else $val = ''; break; case "html": $val = $field["view"]['value']; break; default: $val = htmlspecialcharsex($val); break; } } else { $val = htmlspecialcharsex($val); } echo '<td class="adm-list-table-cell', (isset($header_props['align']) && $header_props['align']? ' align-'.$header_props['align']: ''), (isset($header_props['valign']) && $header_props['valign']? ' valign-'.$header_props['valign']: ''), ($id === $last_id? ' adm-list-table-cell-last': ''), '">'; echo ((string)$val <> ""? $val: ' '); if(isset($field["edit"]) && $field["edit"]["type"] == "calendar") CAdminCalendar::ShowScript(); echo '</td>'; } } ?> </tr> <? }
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; }
public function GetFieldInputControl($documentType, $fieldType, $fieldName, $fieldValue, $allowSelection = false, $publicMode = false) { $iblockId = intval(substr($documentType, strlen("iblock_"))); if ($iblockId <= 0) { throw new CBPArgumentOutOfRangeException("documentType", $documentType); } static $documentFieldTypes = array(); if (!array_key_exists($documentType, $documentFieldTypes)) { $documentFieldTypes[$documentType] = self::getDocumentFieldTypes($documentType); } $fieldType["BaseType"] = "string"; $fieldType["Complex"] = false; if (array_key_exists($fieldType["Type"], $documentFieldTypes[$documentType])) { $fieldType["BaseType"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["BaseType"]; $fieldType["Complex"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["Complex"]; } if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::isAssociativeArray($fieldValue)) { $fieldValue = array($fieldValue); } $customMethodName = ""; $customMethodNameMulty = ""; if (strpos($fieldType["Type"], ":") !== false) { $ar = CIBlockProperty::getUserType(substr($fieldType["Type"], 2)); if (array_key_exists("GetPublicEditHTML", $ar)) { $customMethodName = $ar["GetPublicEditHTML"]; } if (array_key_exists("GetPublicEditHTMLMulty", $ar)) { $customMethodNameMulty = $ar["GetPublicEditHTMLMulty"]; } } ob_start(); if ($fieldType["Type"] == "select") { $fieldValueTmp = $fieldValue; ?> <select id="id_<?php echo htmlspecialcharsbx($fieldName["Field"]); ?> " name="<?php echo htmlspecialcharsbx($fieldName["Field"]) . ($fieldType["Multiple"] ? "[]" : ""); ?> "<?php echo $fieldType["Multiple"] ? ' size="5" multiple' : ''; ?> > <?php if (!$fieldType["Required"]) { echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>'; } foreach ($fieldType["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 ($allowSelection) { ?> <br /><input type="text" id="id_<?php echo htmlspecialcharsbx($fieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($fieldName["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($fieldName["Field"]); ?> _text', 'select');"> <?php } } elseif ($fieldType["Type"] == "user") { $fieldValue = CBPHelper::usersArrayToString($fieldValue, null, array("lists", get_called_class(), $documentType)); ?> <input type="text" size="40" id="id_<?php echo htmlspecialcharsbx($fieldName["Field"]); ?> " name="<?php echo htmlspecialcharsbx($fieldName["Field"]); ?> " value="<?php echo htmlspecialcharsbx($fieldValue); ?> "><input type="button" value="..." onclick="BPAShowSelector('id_<?php echo htmlspecialcharsbx($fieldName["Field"]); ?> ', 'user');"><?php } elseif (strpos($fieldType["Type"], ":") !== false && $fieldType["Multiple"] && (is_array($customMethodNameMulty) && count($customMethodNameMulty) > 0 || !is_array($customMethodNameMulty) && strlen($customMethodNameMulty) > 0)) { if (!is_array($fieldValue)) { $fieldValue = array(); } if ($allowSelection) { $fieldValueTmp1 = array(); $fieldValueTmp2 = array(); foreach ($fieldValue as $v) { $vTrim = trim($v); if (\CBPDocument::IsExpression($vTrim)) { $fieldValueTmp1[] = $vTrim; } else { $fieldValueTmp2[] = $v; } } } else { $fieldValueTmp1 = array(); $fieldValueTmp2 = $fieldValue; } if ($fieldType["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 ($fieldType["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" => $fieldType["Options"]), $fieldValueTmp2, array("FORM_NAME" => $fieldName["Form"], "VALUE" => htmlspecialcharsbx($fieldName["Field"])), true)); if ($allowSelection) { ?> <br /><input type="text" id="id_<?php echo htmlspecialcharsbx($fieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($fieldName["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($fieldName["Field"]); ?> _text', 'user', '<?php echo $fieldType["Type"] == 'S:employee' ? 'employee' : ''; ?> ');"> <?php } } else { if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted", $GLOBALS) && $fieldType["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':'', 'useFileDialogs':false, '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 ($fieldType["Multiple"]) { echo '<table width="100%" border="0" cellpadding="2" cellspacing="2" id="CBPVirtualDocument_' . htmlspecialcharsbx($fieldName["Field"]) . '_Table">'; } $fieldValueTmp = $fieldValue; if (sizeof($fieldValue) == 0) { $fieldValue[] = null; } $ind = -1; foreach ($fieldValue as $key => $value) { $ind++; $fieldNameId = 'id_' . htmlspecialcharsbx($fieldName["Field"]) . '__n' . $ind . '_'; $fieldNameName = htmlspecialcharsbx($fieldName["Field"]) . ($fieldType["Multiple"] ? "[n" . $ind . "]" : ""); if ($fieldType["Multiple"]) { echo '<tr><td>'; } if (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0) { if ($fieldType["Type"] == "S:HTML") { if (Loader::includeModule("fileman")) { $editor = new CHTMLEditor(); $res = array_merge(array('useFileDialogs' => false, 'height' => 200, 'useFileDialogs' => false, '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 ($allowSelection && \CBPDocument::IsExpression(trim($value1))) { $value1 = null; } else { unset($fieldValueTmp[$key]); } if ($fieldType["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" => $fieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $fieldName["Form"], "VALUE" => $fieldNameName), true)); } } else { switch ($fieldType["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 (!$fieldType["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 (!\CBPDocument::IsExpression(trim($value))) { $v = $value; unset($fieldValueTmp[$key]); } require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php"; echo CAdminCalendar::calendarDate($fieldNameName, $v, 19, $fieldType["Type"] != "date"); } else { $value1 = $value; if ($allowSelection && \CBPDocument::IsExpression(trim($value1))) { $value1 = null; } else { unset($fieldValueTmp[$key]); } if ($fieldType["Type"] == "date") { $type = "Date"; } else { $type = "DateTime"; } $ar = CIBlockProperty::getUserType($type); echo call_user_func_array($ar["GetPublicEditHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $fieldName["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 ($allowSelection) { if (!in_array($fieldType["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($fieldType["BaseType"]); ?> ');"><?php } } if ($fieldType["Multiple"]) { echo '</td></tr>'; } } if ($fieldType["Multiple"]) { echo "</table>"; } if ($fieldType["Multiple"] && $fieldType["Type"] != "S:HTML" && ($fieldType["Type"] != "file" || $publicMode)) { echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\')"/><br />'; } elseif ($fieldType["Multiple"] && $fieldType["Type"] == "S:HTML") { $functionOnclick = 'CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');createAdditionalHtmlEditor(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');'; echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="' . $functionOnclick . '"/><br />'; } if ($allowSelection) { if (in_array($fieldType["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($fieldName["Field"]); ?> _text" name="<?php echo htmlspecialcharsbx($fieldName["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($fieldName["Field"]); ?> _text', '<?php echo htmlspecialcharsbx($fieldType["BaseType"]); ?> ', '<?php echo $fieldType["Type"] == 'S:employee' ? 'employee' : ''; ?> ');"> <?php } } } $s = ob_get_contents(); ob_end_clean(); return $s; }
$tabControl->AddDropDownField("LID", GetMessage('SDEN_SITE') . ':', true, $arSiteList, $arDiscount['LID']); $tabControl->AddEditField("NAME", GetMessage("BT_SALE_DISCOUNT_EDIT_FIELDS_NAME") . ":", false, array("size" => 50, "maxlength" => 255), htmlspecialcharsbx($arDiscount['NAME'])); $tabControl->BeginCustomField("PERIOD", GetMessage('SDEN_PERIOD') . ":", false); ?> <tr id="tr_PERIOD"> <td width="40%"><?php echo $tabControl->GetCustomLabelHTML(); ?> </td> <td width="60%"><?php global $ACTIVE_FROM_FILTER_PERIOD; $ACTIVE_FROM_FILTER_PERIOD = ""; if ('' != $arDiscount['ACTIVE_FROM'] || '' != $arDiscount['ACTIVE_TO']) { $ACTIVE_FROM_FILTER_PERIOD = CAdminCalendar::PERIOD_INTERVAL; } echo CAdminCalendar::CalendarPeriodCustom("ACTIVE_FROM", "ACTIVE_TO", $arDiscount['ACTIVE_FROM'], $arDiscount['ACTIVE_TO'], true, 19, true, array(CAdminCalendar::PERIOD_EMPTY => GetMessage('BT_SALE_DISCOUNT_EDIT_CALENDARE_PERIOD_EMPTY'), CAdminCalendar::PERIOD_INTERVAL => GetMessage('BT_SALE_DISCOUNT_EDIT_CALENDARE_PERIOD_INTERVAL'))); ?> </td> </tr><?php $tabControl->EndCustomField("PERIOD", '<input type="hidden" name="ACTIVE_FROM" value="' . htmlspecialcharsbx($arDiscount['ACTIVE_FROM']) . '">' . '<input type="hidden" name="ACTIVE_TO" value="' . htmlspecialcharsbx($arDiscount['ACTIVE_FROM']) . '">'); $tabControl->AddEditField("PRIORITY", GetMessage("BT_SALE_DISCOUNT_EDIT_FIELDS_PRIORITY") . ":", false, array("size" => 20, "maxlength" => 20), intval($arDiscount['PRIORITY'])); $tabControl->AddEditField("SORT", GetMessage("BT_SALE_DISCOUNT_EDIT_FIELDS_SORT"), false, array('size' => 10, 'maxlength' => 20), intval($arDiscount['SORT'])); $tabControl->BeginCustomField("LAST_DISCOUNT", GetMessage('BT_SALE_DISCOUNT_EDIT_FIELDS_LAST_DISCOUNT') . ":", false); ?> <tr id="tr_LAST_DISCOUNT"> <td width="40%"><?php echo $tabControl->GetCustomLabelHTML(); ?> </td> <td width="60%"> <input type="hidden" value="N" name="LAST_DISCOUNT">