Last active
November 8, 2017 20:19
-
-
Save gustvvo/15eb6179151ebb2edc099b9484c5d7ac to your computer and use it in GitHub Desktop.
LISTA.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> | |
<script src="//code.jquery.com/jquery-1.10.2.js"></script> | |
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> | |
<? | |
/** | |
* Bitrix Framework | |
* @package bitrix | |
* @subpackage main | |
* @copyright 2001-2013 Bitrix | |
*/ | |
/** | |
* Bitrix vars | |
* | |
* @var array $arParams | |
* @var array $arResult | |
* @var CBitrixComponentTemplate $this | |
* @global CMain $APPLICATION | |
* @global CUser $USER | |
*/ | |
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) | |
die(); | |
//color schemes | |
if($arParams["USE_THEMES"]) | |
$arThemes = CGridOptions::GetThemes($this->GetFolder()); | |
else | |
$arThemes = array(); | |
?> | |
<div class="bx-interface-form"> | |
<script type="text/javascript"> | |
var bxForm_<?=$arParams["FORM_ID"]?> = null; | |
</script> | |
<?//=$arParams["FORM_ID"]?> | |
<? | |
//LISTA UNIFICADA | |
if ($arParams["FORM_ID"]=="lists_element_add_180") { | |
$aListaUnificada = Array(); | |
/**/ | |
$arSelect = Array("ID", "NAME", "PROPERTY_DRFYMYO", "PROPERTY_DRFYMZO"); | |
$arFilter = Array("IBLOCK_ID"=>180, "ACTIVE"=>"Y", "PROPERTY_DRFYMYO"=>838); | |
$res = CIBlockElement::GetList(Array("ORDER"=>"DESC"), $arFilter, false, Array("nPageSize"=>50), $arSelect); | |
while ($ob = $res->GetNextElement()) | |
{ | |
$arFields = $ob->GetFields(); | |
//echo "<pre>"; print_r($arFields); echo "</pre>"; | |
array_push($aListaUnificada, $arFields["PROPERTY_DRFYMZO_VALUE"]); | |
} | |
/**/ | |
//echo "<pre>"; print_r($aListaUnificada); echo "</pre>"; | |
$m=$aListaUnificada[0]+1; | |
?> | |
<script> | |
function interno(){ | |
var t = document.getElementById("PROPERTY_652"); | |
var tt = t.options[t.selectedIndex].value; | |
//alert(tt); | |
if (tt==838) { | |
document.getElementById("importe").value = <?=$m;?>; | |
}else{ | |
document.getElementById("importe").value = ""; | |
} | |
} | |
</script> | |
<? | |
} | |
//CAJA TEST | |
/* | |
?> | |
<script type="text/javascript"> | |
var bxForm_<?=$arParams["FORM_ID1"]?> = null; | |
</script> | |
<? | |
*/ | |
/* | |
?> | |
<script type="text/javascript"> | |
var bxForm_<?=$arParams["FORM_ID1"]?> = null; | |
</script> | |
<? | |
if($arParams["FORM_ID1"]=="lists_element_add_301") { | |
$nnuevo1 = Array(); | |
$arSelect = Array("ID", "NAME", "PROPERTY_TIPO_DE_DOCUMENTO", "PROPERTY_NRO_DE_DOCUMENTO"); | |
$arFilter = Array("IBLOCK_ID"=>301, "ACTIVE"=>"Y", "PROPERTY_TIPO_DE_DOCUMENTO"=>1178); | |
$res = CIBlockElement::GetList(Array("ORDER"=>"DESC"), $arFilter, false, Array("nPageSize"=>50), $arSelect); | |
while ($ob0 = $res0->GetNextElement()) | |
{ | |
$arFields = $ob0->GetFields(); | |
//echo "<pre>"; print_r($arFields); echo "</pre>"; | |
array_push($nnuevo1, $arFields["PROPERTY_NRO_DE_DOCUMENTO_VALUE"]); | |
} | |
$m0=$nnuevo1[0]+1; | |
?> | |
<script> | |
function interno2(){ | |
var a0 = document.getElementById("PROPERTY_814"); | |
var aa0 = a0.options[a0.selectedIndex].value; | |
if (aa0==1178) { | |
document.getElementById("importe1").value = <?=$m0;?>; | |
}else{ | |
document.getElementById("importe1").value = ""; | |
} | |
} | |
</script> | |
<? | |
} | |
*/ | |
?> | |
<? | |
//------------------------------------------CAJA CHICA---------------------------------------------------------------------- | |
?> | |
<script> | |
//alert("Hola"); | |
$(function() { | |
var lista = [ | |
<? | |
CModule::IncludeModule("socialnetwork"); | |
$res = CSocNetGroup::GetList( | |
$arOrder = array("ID" => "DESC"), | |
$arFilter = array("CLOSED" => "N"), | |
$arGroupBy = false, | |
$arNavStartParams = false, | |
$arSelectFields = array() | |
); | |
echo $res->NavPrint(GetMessage("PAGES")); | |
while($res->NavNext(true, "f_")) : ?> | |
"<?=" ".$f_NAME." - (".$f_ID.")";?>", | |
<?endwhile; | |
?> | |
]; | |
$( "#autocm" ).autocomplete({ | |
source: lista | |
}); | |
}); | |
</script> | |
<? | |
//------------------------------------------------------------------------------------------------------------------- | |
?> | |
<script type="text/javascript"> | |
function alerta() { | |
//alert("Hola"); | |
var d = document.getElementById("PROPERTY_432"); | |
var dd = d.options[d.selectedIndex].value; | |
//alert(dd); | |
/**/ | |
if (dd=="574") { | |
document.getElementById("PROPERTY_433").disabled=false; | |
document.getElementById("PROPERTY_452").disabled=false; | |
document.getElementById("PROPERTY_454").disabled=true; | |
document.getElementById("PROPERTY_431").disabled=true; | |
}else if(dd=="573"){ | |
document.getElementById("PROPERTY_454").disabled=false; | |
document.getElementById("PROPERTY_431").disabled=false; | |
document.getElementById("PROPERTY_433").disabled=true; | |
document.getElementById("PROPERTY_452").disabled=true; | |
} | |
/**/ | |
} | |
</script> | |
<? | |
//--------------------------------------------CAJA CHICA DOLARES---------------------------------------------------------------- | |
?> | |
<script> | |
function alerta2() { | |
//alert("Hola"); | |
var r = document.getElementById("PROPERTY_771"); | |
var rr = r.options[r.selectedIndex].value; | |
//alert(dd); | |
/**/ | |
if (rr=="1108") { | |
document.getElementById("PROPERTY_773").disabled=false; | |
document.getElementById("PROPERTY_775").disabled=false; | |
document.getElementById("PROPERTY_772").disabled=true; | |
document.getElementById("PROPERTY_774").disabled=true; | |
}else if(rr=="1107"){ | |
document.getElementById("PROPERTY_772").disabled=false; | |
document.getElementById("PROPERTY_774").disabled=false; | |
document.getElementById("PROPERTY_773").disabled=true; | |
document.getElementById("PROPERTY_775").disabled=true; | |
} | |
/**/ | |
} | |
</script> | |
<? | |
//----------------------------------------------NUEVA CAJA EN SOLES-------------------------------------------------------------------- | |
?> | |
<script> | |
function alerta3(){ | |
var a = document.getElementById("PROPERTY_809"); | |
var aa = a.options[a.selectedIndex].value; | |
//alert(aa);#E6E6E6 | |
if (aa=="1152") { | |
document.getElementById("PROPERTY_810").disabled=false; | |
document.getElementById("PROPERTY_810").style.background = "#81F781"; | |
document.getElementById("PROPERTY_812").disabled=false; | |
document.getElementById("PROPERTY_812").style.background = "#81F781"; | |
document.getElementById("PROPERTY_811").disabled=true; | |
document.getElementById("PROPERTY_811").style.background = "#D8D8D8"; | |
document.getElementById("PROPERTY_813").disabled=true; | |
document.getElementById("PROPERTY_813").style.background = "#D8D8D8"; | |
}else if(aa=="1153"){ | |
document.getElementById("PROPERTY_811").disabled=false; | |
document.getElementById("PROPERTY_811").style.background = "#81F781"; | |
document.getElementById("PROPERTY_813").disabled=false; | |
document.getElementById("PROPERTY_813").style.background = "#81F781"; | |
document.getElementById("PROPERTY_810").disabled=true; | |
document.getElementById("PROPERTY_810").style.background = "#D8D8D8"; | |
document.getElementById("PROPERTY_812").disabled=true; | |
document.getElementById("PROPERTY_812").style.background = "#D8D8D8"; | |
} | |
} | |
</script> | |
<? | |
//----------------------------------------------NUEVA CAJA EN dolares-------------------------------------------------------------------- | |
?> | |
<script> | |
function alerta4(){ | |
var x = document.getElementById("PROPERTY_821"); | |
var xx = x.options[x.selectedIndex].value; | |
//alert(xx); | |
if (xx=="1182") { | |
document.getElementById("PROPERTY_822").disabled=false; | |
document.getElementById("PROPERTY_822").style.background = "#81F781"; | |
document.getElementById("PROPERTY_824").disabled=false; | |
document.getElementById("PROPERTY_824").style.background = "#81F781"; | |
document.getElementById("PROPERTY_823").disabled=true; | |
document.getElementById("PROPERTY_823").style.background = "#D8D8D8"; | |
document.getElementById("PROPERTY_825").disabled=true; | |
document.getElementById("PROPERTY_825").style.background = "#D8D8D8"; | |
}else if(xx=="1183"){ | |
document.getElementById("PROPERTY_823").disabled=false; | |
document.getElementById("PROPERTY_823").style.background = "#81F781"; | |
document.getElementById("PROPERTY_825").disabled=false; | |
document.getElementById("PROPERTY_825").style.background = "#81F781"; | |
document.getElementById("PROPERTY_822").disabled=true; | |
document.getElementById("PROPERTY_822").style.background = "#D8D8D8"; | |
document.getElementById("PROPERTY_824").disabled=true; | |
document.getElementById("PROPERTY_824").style.background = "#D8D8D8"; | |
} | |
} | |
</script> | |
<? | |
//------------------------------------------------------------------------------------------------------------------------------------- | |
?> | |
<?if($arParams["SHOW_FORM_TAG"]):?> | |
<? | |
//echo "<pre>"; print_r($_POST); echo "</pre>"; | |
?> | |
<form name="form_<?=$arParams["FORM_ID"]?>" id="form_<?=$arParams["FORM_ID"]?>" action="<?=POST_FORM_ACTION_URI?>" method="POST" enctype="multipart/form-data"> | |
<?=bitrix_sessid_post();?> | |
<input type="hidden" id="<?=$arParams["FORM_ID"]?>_active_tab" name="<?=$arParams["FORM_ID"]?>_active_tab" value="<?=htmlspecialcharsbx($arResult["SELECTED_TAB"])?>"> | |
<?endif?> | |
<table cellspacing="0" class="bx-edit-tabs" width="100%"> | |
<tr> | |
<td class="bx-tab-indent"><div class="empty"></div></td> | |
<? | |
$nTabs = count($arResult["TABS"]); | |
foreach($arResult["TABS"] as $tab): | |
$bSelected = ($tab["id"] == $arResult["SELECTED_TAB"]); | |
$callback = ''; | |
if(strlen($tab['onselect_callback'])) | |
{ | |
$callback = trim($tab['onselect_callback']); | |
if(!preg_match('#^[a-z0-9-_\.]+$#i', $callback)) | |
$callback = ''; | |
} | |
?> | |
<td title="<?=htmlspecialcharsbx($tab["title"])?>" id="tab_cont_<?=$tab["id"]?>" class="bx-tab-container<?=($bSelected? "-selected":"")?>" onclick="<?if(strlen($callback)):?><?=$callback?>('<?=$tab["id"]?>');<?endif?>bxForm_<?=$arParams["FORM_ID"]?>.SelectTab('<?=$tab["id"]?>');" onmouseover="if(window.bxForm_<?=$arParams["FORM_ID"]?>){bxForm_<?=$arParams["FORM_ID"]?>.HoverTab('<?=$tab["id"]?>', true);}" onmouseout="if(window.bxForm_<?=$arParams["FORM_ID"]?>){bxForm_<?=$arParams["FORM_ID"]?>.HoverTab('<?=$tab["id"]?>', false);}"> | |
<table cellspacing="0"> | |
<tr> | |
<td class="bx-tab-left<?=($bSelected? "-selected":"")?>" id="tab_left_<?=$tab["id"]?>"><div class="empty"></div></td> | |
<td class="bx-tab<?=($bSelected? "-selected":"")?>" id="tab_<?=$tab["id"]?>"><?=htmlspecialcharsbx($tab["name"])?></td> | |
<td class="bx-tab-right<?=($bSelected? "-selected":"")?>" id="tab_right_<?=$tab["id"]?>"><div class="empty"></div></td> | |
</tr> | |
</table> | |
</td> | |
<? | |
endforeach; | |
?> | |
<td width="100%"<?if($USER->IsAuthorized() && $arParams["SHOW_SETTINGS"] == true):?> ondblclick="bxForm_<?=$arParams["FORM_ID"]?>.ShowSettings()"<?endif?> style="white-space:nowrap; text-align:right"> | |
<?if(count($arResult["TABS"]) > 1 && $arParams["CAN_EXPAND_TABS"] == true):?> | |
<a href="javascript:void(0)" onclick="bxForm_<?=$arParams["FORM_ID"]?>.ToggleTabs();" title="<?echo GetMessage("interface_form_show_all")?>" id="bxForm_<?=$arParams["FORM_ID"]?>_expand_link" class="bx-context-button bx-down"><span></span></a> | |
<?endif?> | |
<?if($arParams["SHOW_SETTINGS"] || !empty($arThemes)):?> | |
<a href="javascript:void(0)" onclick="bxForm_<?=$arParams["FORM_ID"]?>.menu.ShowMenu(this, bxForm_<?=$arParams["FORM_ID"]?>.settingsMenu);" title="<?echo GetMessage("interface_form_settings")?>" class="bx-context-button bx-form-menu"><span></span></a> | |
<?endif;?> | |
</td> | |
</tr> | |
</table> | |
<table cellspacing="0" class="bx-edit-tab"> | |
<tr> | |
<td> | |
<? | |
$bWasRequired = false; | |
foreach($arResult["TABS"] as $tab): | |
?> | |
<div id="inner_tab_<?=$tab["id"]?>" class="bx-edit-tab-inner"<?if($tab["id"] <> $arResult["SELECTED_TAB"]) echo ' style="display:none;"'?>> | |
<div style="height: 100%;"> | |
<?if($tab["title"] <> ''):?> | |
<div class="bx-edit-tab-title"> | |
<table cellpadding="0" cellspacing="0" border="0" class="bx-edit-tab-title"> | |
<tr> | |
<? | |
if($tab["icon"] <> ""): | |
?> | |
<td class="bx-icon"><div class="<?=htmlspecialcharsbx($tab["icon"])?>"></div></td> | |
<? | |
endif | |
?> | |
<td class="bx-form-title"><?=htmlspecialcharsbx($tab["title"])?></td> | |
</tr> | |
</table> | |
</div> | |
<?endif;?> | |
<div class="bx-edit-table"> | |
<table cellpadding="0" cellspacing="0" border="0" class="bx-edit-table <?=(isset($tab["class"]) ? $tab['class'] : '')?>" id="<?=$tab["id"]?>_edit_table"> | |
<? | |
$i = 0; | |
$cnt = count($tab["fields"]); | |
$prevType = ''; | |
foreach($tab["fields"] as $field): | |
$style = ''; | |
if(isset($field["show"])) | |
{ | |
if($field["show"] == "N") | |
{ | |
$style = "display:none;"; | |
} | |
} | |
$i++; | |
if(!is_array($field)) | |
continue; | |
$className = array(); | |
if($i == 1) | |
$className[] = 'bx-top'; | |
if($i == $cnt) | |
$className[] = 'bx-bottom'; | |
if($prevType == 'section') | |
$className[] = 'bx-after-heading'; | |
if(strlen($field['class'])) | |
$className[] = $field['class']; | |
?> | |
<?//=$field["id"];?> | |
<tr<?if(!empty($className)):?> class="<?=implode(' ', $className)?>"<?endif?><?if(!empty($style)):?> style="<?= $style ?>"<?endif?>> | |
<? | |
if($field["type"] == 'section'): | |
?> | |
<td colspan="2" class="bx-heading"><?=htmlspecialcharsbx($field["name"])?></td> | |
<? | |
else: | |
$val = (isset($field["value"])? $field["value"] : $arParams["~DATA"][$field["id"]]); | |
$valEncoded = ''; | |
if(!is_array($val)) | |
$valEncoded = htmlspecialcharsbx(htmlspecialcharsback($val)); | |
//default attributes | |
if(!is_array($field["params"])) | |
$field["params"] = array(); | |
if($field["type"] == '' || $field["type"] == 'text') | |
{ | |
if($field["params"]["size"] == '') | |
$field["params"]["size"] = "30"; | |
//$field["params"]["id"] = $field["id"]; | |
} | |
elseif($field["type"] == 'textarea') | |
{ | |
if($field["params"]["cols"] == '') | |
$field["params"]["cols"] = "40"; | |
if($field["params"]["rows"] == '') | |
$field["params"]["rows"] = "3"; | |
} | |
elseif($field["type"] == 'date') | |
{ | |
if($field["params"]["size"] == '') | |
$field["params"]["size"] = "10"; | |
} | |
$params = ''; | |
if(is_array($field["params"]) && $field["type"] <> 'file') | |
{ | |
foreach($field["params"] as $p=>$v) | |
$params .= ' '.$p.'="'.$v.'"'; | |
} | |
if($field["colspan"] <> true): | |
if($field["required"]) | |
$bWasRequired = true; | |
?> | |
<!-- Acá es --> | |
<td class="bx-field-name<?if($field["type"] <> 'label') echo' bx-padding'?>"<?if($field["title"] <> '') echo ' title="'.htmlspecialcharsEx($field["title"]).'"'?>><?=($field["required"]? '<span class="required">*</span>':'')?><?if(strlen($field["name"])):?><?=htmlspecialcharsEx($field["name"])?>:<?endif?></td> | |
<? | |
endif | |
?> | |
<td class="bx-field-value"<?=($field["colspan"]? ' colspan="2"':'')?>> | |
<?//echo $field["id"]; ?> | |
<? | |
switch($field["type"]): | |
case 'label': | |
case 'custom': | |
if ($field["id"]=="PROPERTY_653") { | |
//echo "0".$val; | |
echo "<input id='importe' name='PROPERTY_653[n0][VALUE]' value='' size='30' type='text' />"; | |
}elseif($field["id"]=="PROPERTY_858"){ | |
echo "<input id='autocm' type='text' name='PROPERTY_858[n0][VALUE]' value='' style='width: 400px' >"; | |
//echo "<input id='#autocrm' name='PROPERTY_858[n0][VALUE]' value='' size='30' type='text' />"; | |
}else{ | |
echo $val; | |
} | |
break; | |
case 'checkbox': | |
?> | |
<input type="hidden" name="<?=$field["id"]?>" value="N"> | |
<input type="checkbox" name="<?=$field["id"]?>" value="Y"<?=($val == "Y"? ' checked':'')?><?=$params?>> | |
<? | |
break; | |
case 'textarea': | |
?> | |
<textarea name="<?=$field["id"]?>"<?=$params?>><?=$valEncoded?></textarea> | |
<? | |
break; | |
case 'list': | |
case 'select': | |
?> | |
<? | |
//echo $field["id"]; | |
//--------------------------------------------------SOLES------------------------------------------------------------------------------- | |
if($field["id"]=="PROPERTY_432"){ | |
?> | |
<select id="PROPERTY_432" name="<?=$field["id"]?>"<?=$params?> onchange="alerta();"> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
}elseif($field["id"]=="PROPERTY_454" or $field["id"]=="PROPERTY_433" or $field["id"]=="PROPERTY_431" or $field["id"]=="PROPERTY_452" or $field["id"]=="PROPERTY_772" or $field["id"]=="PROPERTY_773" or $field["id"]=="PROPERTY_774" or $field["id"]=="PROPERTY_775" or $field["id"]=="PROPERTY_810" or $field["id"]=="PROPERTY_811" or $field["id"]=="PROPERTY_812" or $field["id"]=="PROPERTY_813" or $field["id"]=="PROPERTY_822" or $field["id"]=="PROPERTY_823" or $field["id"]=="PROPERTY_824" or $field["id"]=="PROPERTY_825"){ | |
?> | |
<select id="<?=$field["id"]?>" name="<?=$field["id"]?>"<?=$params?> disabled> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
} | |
//----------------------------------------------CAJAUNIFICADA---------------------------------------------------------------- | |
elseif($field["id"]=="PROPERTY_652"){ | |
?> | |
<select id="<?=$field["id"]?>" name="<?=$field["id"]?>"<?=$params?> onchange="interno();"> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
} | |
//------------------------------DOLARES---------------------------------------------------------------------- | |
elseif($field["id"]=="PROPERTY_771"){ | |
?> | |
<select id="<?=$field["id"]?>" name="<?=$field["id"]?>"<?=$params?> onchange="alerta2();"> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
} | |
//----------------------------------NUEVOSOLES------------------------------------------------------------------------------- | |
elseif($field["id"]=="PROPERTY_809"){ | |
?> | |
<select id="<?=$field["id"]?>" name="<?=$field["id"]?>"<?=$params?> onchange="alerta3();"> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
} | |
//----------------------------------NUEVODOLARES---------------------------------------------------------------------------- | |
elseif($field["id"]=="PROPERTY_821"){ | |
?> | |
<select id="<?=$field["id"]?>" name="<?=$field["id"]?>"<?=$params?> onchange="alerta4();"> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
} | |
//--------------------------------------------------------------------------------------------------------------------------------------- | |
/*--------------------------------------------------------------------------------------------------------------------------*/ | |
else{ | |
?> | |
<select name="<?=$field["id"]?>"<?=$params?>> | |
<? | |
if(is_array($field["items"])): | |
if(!is_array($val)) | |
$val = array($val); | |
foreach($field["items"] as $k=>$v): | |
?> | |
<option value="<?=htmlspecialcharsbx($k)?>"<?=(in_array($k, $val)? ' selected':'')?>><?=htmlspecialcharsbx($v)?></option> | |
<? | |
endforeach; | |
?> | |
</select> | |
<? | |
endif; | |
break; | |
} | |
/*--------------------------------------------------------------------------------------------------------------------------*/ | |
?> | |
<? | |
case 'file': | |
$arDefParams = array("iMaxW"=>150, "iMaxH"=>150, "sParams"=>"border=0", "strImageUrl"=>"", "bPopup"=>true, "sPopupTitle"=>false, "size"=>20); | |
foreach($arDefParams as $k=>$v) | |
if(!array_key_exists($k, $field["params"])) | |
$field["params"][$k] = $v; | |
echo CFile::InputFile($field["id"], $field["params"]["size"], $val); | |
if($val <> '') | |
echo '<br>'.CFile::ShowImage($val, $field["params"]["iMaxW"], $field["params"]["iMaxH"], $field["params"]["sParams"], $field["params"]["strImageUrl"], $field["params"]["bPopup"], $field["params"]["sPopupTitle"]); | |
break; | |
case 'date': | |
case 'date_short': | |
/*--------------------------------------------------------------------------------------------------------------------------*/ | |
?> | |
<? | |
$APPLICATION->IncludeComponent( | |
"bitrix:main.calendar", | |
"", | |
array( | |
"SHOW_INPUT"=>"Y", | |
"INPUT_NAME"=>$field["id"], | |
"INPUT_VALUE"=>$val, | |
"INPUT_ADDITIONAL_ATTR"=>$params, | |
"SHOW_TIME" => $field["type"] === 'date'? 'Y' : 'N', | |
), | |
$component, | |
array("HIDE_ICONS"=>true) | |
); | |
?> | |
<? | |
break; | |
default: | |
?> | |
<input type="text" name="<?=$field["id"]?>" value="<?=$valEncoded?>"<?=$params?>> | |
<? | |
break; | |
endswitch; | |
?> | |
</td> | |
<?endif?> | |
</tr> | |
<? | |
$prevType = $field["type"]; | |
endforeach; | |
?> | |
</table> | |
</div> | |
</div> | |
</div> | |
<? | |
endforeach; | |
?> | |
</td> | |
</tr> | |
</table> | |
<? | |
if(isset($arParams["BUTTONS"])): | |
?> | |
<div class="bx-buttons"> | |
<?if($arParams["~BUTTONS"]["standard_buttons"] !== false):?> | |
<?if($arParams["BUTTONS"]["back_url"] <> ''):?> | |
<input type="submit" name="save" value="<?echo GetMessage("interface_form_save")?>" title="<?echo GetMessage("interface_form_save_title")?>" /> | |
<?endif?> | |
<input type="submit" name="apply" value="<?echo GetMessage("interface_form_apply")?>" title="<?echo GetMessage("interface_form_apply_title")?>" /> | |
<?if($arParams["BUTTONS"]["back_url"] <> ''):?> | |
<input type="button" value="<?echo GetMessage("interface_form_cancel")?>" name="cancel" onclick="window.location='<?=htmlspecialcharsbx(CUtil::addslashes($arParams["~BUTTONS"]["back_url"]))?>'" title="<?echo GetMessage("interface_form_cancel_title")?>" /> | |
<?endif?> | |
<?endif?> | |
<?=$arParams["~BUTTONS"]["custom_html"]?> | |
</div> | |
<?endif?> | |
<?if($arParams["SHOW_FORM_TAG"]):?> | |
</form> | |
<?endif?> | |
<?if($USER->IsAuthorized() && $arParams["SHOW_SETTINGS"] == true):?> | |
<div style="display:none"> | |
<div id="form_settings_<?=$arParams["FORM_ID"]?>"> | |
<table width="100%"> | |
<tr class="section"> | |
<td><?echo GetMessage("interface_form_tabs")?></td> | |
</tr> | |
<tr> | |
<td align="center"> | |
<table> | |
<tr> | |
<td style="background-image:none" nowrap> | |
<select style="min-width:150px;" name="tabs" size="10" ondblclick="this.form.tab_edit_btn.onclick()" onchange="bxForm_<?=$arParams["FORM_ID"]?>.OnSettingsChangeTab()"> | |
</select> | |
</td> | |
<td style="background-image:none"> | |
<div style="margin-bottom:5px"><input type="button" name="tab_up_btn" value="<?echo GetMessage("intarface_form_up")?>" title="<?echo GetMessage("intarface_form_up_title")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.TabMoveUp()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="tab_down_btn" value="<?echo GetMessage("intarface_form_up_down")?>" title="<?echo GetMessage("intarface_form_down_title")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.TabMoveDown()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="tab_add_btn" value="<?echo GetMessage("intarface_form_add")?>" title="<?echo GetMessage("intarface_form_add_title")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.TabAdd()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="tab_edit_btn" value="<?echo GetMessage("intarface_form_edit")?>" title="<?echo GetMessage("intarface_form_edit_title")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.TabEdit()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="tab_del_btn" value="<?echo GetMessage("intarface_form_del")?>" title="<?echo GetMessage("intarface_form_del_title")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.TabDelete()"></div> | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<tr class="section"> | |
<td><?echo GetMessage("intarface_form_fields")?></td> | |
</tr> | |
<tr> | |
<td align="center"> | |
<table> | |
<tr> | |
<td style="background-image:none" nowrap> | |
<div style="margin-bottom:5px"><?echo GetMessage("intarface_form_fields_available")?></div> | |
<select style="min-width:150px;" name="all_fields" multiple size="12" ondblclick="this.form.add_btn.onclick()" onchange="bxForm_<?=$arParams["FORM_ID"]?>.ProcessButtons()"> | |
</select> | |
</td> | |
<td style="background-image:none"> | |
<div style="margin-bottom:5px"><input type="button" name="add_btn" value=">" title="<?echo GetMessage("intarface_form_add_field")?>" style="width:30px;" disabled onclick="bxForm_<?=$arParams["FORM_ID"]?>.FieldsAdd()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="del_btn" value="<" title="<?echo GetMessage("intarface_form_del_field")?>" style="width:30px;" disabled onclick="bxForm_<?=$arParams["FORM_ID"]?>.FieldsDelete()"></div> | |
</td> | |
<td style="background-image:none" nowrap> | |
<div style="margin-bottom:5px"><?echo GetMessage("intarface_form_fields_on_tab")?></div> | |
<select style="min-width:150px;" name="fields" multiple size="12" ondblclick="this.form.del_btn.onclick()" onchange="bxForm_<?=$arParams["FORM_ID"]?>.ProcessButtons()"> | |
</select> | |
</td> | |
<td style="background-image:none"> | |
<div style="margin-bottom:5px"><input type="button" name="up_btn" value="<?echo GetMessage("intarface_form_up")?>" title="<?echo GetMessage("intarface_form_up_title")?>" style="width:80px;" disabled onclick="bxForm_<?=$arParams["FORM_ID"]?>.FieldsMoveUp()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="down_btn" value="<?echo GetMessage("intarface_form_up_down")?>" title="<?echo GetMessage("intarface_form_down_title")?>" style="width:80px;" disabled onclick="bxForm_<?=$arParams["FORM_ID"]?>.FieldsMoveDown()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="field_add_btn" value="<?echo GetMessage("intarface_form_add")?>" title="<?echo GetMessage("intarface_form_add_sect")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.FieldAdd()"></div> | |
<div style="margin-bottom:5px"><input type="button" name="field_edit_btn" value="<?echo GetMessage("intarface_form_edit")?>" title="<?echo GetMessage("intarface_form_edit_field")?>" style="width:80px;" onclick="bxForm_<?=$arParams["FORM_ID"]?>.FieldEdit()"></div> | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
<?if($arResult["IS_ADMIN"]):?> | |
<tr class="section"> | |
<td><?echo GetMessage("interface_form_common")?></td> | |
</tr> | |
<tr> | |
<td><input type="checkbox" name="set_default_settings" id="set_default_settings_<?=$arParams["FORM_ID"]?>" onclick="BX('delete_users_settings_<?=$arParams["FORM_ID"]?>').disabled = !this.checked;"><label for="set_default_settings_<?=$arParams["FORM_ID"]?>"><?echo GetMessage("interface_form_common_set")?></label></td> | |
</tr> | |
<tr> | |
<td><input type="checkbox" name="delete_users_settings" id="delete_users_settings_<?=$arParams["FORM_ID"]?>" disabled><label for="delete_users_settings_<?=$arParams["FORM_ID"]?>"><?echo GetMessage("interface_form_common_del")?></label></td> | |
</tr> | |
<?endif;?> | |
</table> | |
</div> | |
</div> | |
<? | |
endif //$GLOBALS['USER']->IsAuthorized() | |
?> | |
<? | |
$variables = array( | |
"mess"=>array( | |
"collapseTabs"=>GetMessage("interface_form_close_all"), | |
"expandTabs"=>GetMessage("interface_form_show_all"), | |
"settingsTitle"=>GetMessage("intarface_form_settings"), | |
"settingsSave"=>GetMessage("interface_form_save"), | |
"tabSettingsTitle"=>GetMessage("intarface_form_tab"), | |
"tabSettingsSave"=>"OK", | |
"tabSettingsName"=>GetMessage("intarface_form_tab_name"), | |
"tabSettingsCaption"=>GetMessage("intarface_form_tab_title"), | |
"fieldSettingsTitle"=>GetMessage("intarface_form_field"), | |
"fieldSettingsName"=>GetMessage("intarface_form_field_name"), | |
"sectSettingsTitle"=>GetMessage("intarface_form_sect"), | |
"sectSettingsName"=>GetMessage("intarface_form_sect_name"), | |
), | |
"ajax"=>array( | |
"AJAX_ID"=>$arParams["AJAX_ID"], | |
"AJAX_OPTION_SHADOW"=>($arParams["AJAX_OPTION_SHADOW"] == "Y"), | |
), | |
"settingWndSize"=>CUtil::GetPopupSize("InterfaceFormSettingWnd"), | |
"tabSettingWndSize"=>CUtil::GetPopupSize("InterfaceFormTabSettingWnd", array('width'=>400, 'height'=>200)), | |
"fieldSettingWndSize"=>CUtil::GetPopupSize("InterfaceFormFieldSettingWnd", array('width'=>400, 'height'=>150)), | |
"component_path"=>$component->GetRelativePath(), | |
"template_path"=>$this->GetFolder(), | |
"sessid"=>bitrix_sessid(), | |
"current_url"=>$APPLICATION->GetCurPageParam("", array("bxajaxid", "AJAX_CALL")), | |
"GRID_ID"=>$arParams["THEME_GRID_ID"], | |
); | |
?> | |
<script type="text/javascript"> | |
var formSettingsDialog<?=$arParams["FORM_ID"]?>; | |
bxForm_<?=$arParams["FORM_ID"]?> = new BxInterfaceForm('<?=$arParams["FORM_ID"]?>', <?=CUtil::PhpToJsObject(array_keys($arResult["TABS"]))?>); | |
bxForm_<?=$arParams["FORM_ID"]?>.vars = <?=CUtil::PhpToJsObject($variables)?>; | |
<?if($arParams["SHOW_SETTINGS"] == true):?> | |
bxForm_<?=$arParams["FORM_ID"]?>.oTabsMeta = <?=CUtil::PhpToJsObject($arResult["TABS_META"])?>; | |
bxForm_<?=$arParams["FORM_ID"]?>.oFields = <?=CUtil::PhpToJsObject($arResult["AVAILABLE_FIELDS"])?>; | |
<?endif?> | |
<? | |
$settingsMenu = array(); | |
if($arParams["SHOW_SETTINGS"]) | |
{ | |
$settingsMenu[] = array( | |
'TEXT' => GetMessage("intarface_form_mnu_settings"), | |
'TITLE' => GetMessage("intarface_form_mnu_settings_title"), | |
'ONCLICK' => 'bxForm_'.$arParams["FORM_ID"].'.ShowSettings()', | |
'DEFAULT' => true, | |
'DISABLED' => ($USER->IsAuthorized()? false:true), | |
'ICONCLASS' => 'form-settings' | |
); | |
if(!empty($arResult["OPTIONS"]["tabs"])) | |
{ | |
if($arResult["OPTIONS"]["settings_disabled"] == "Y") | |
{ | |
$settingsMenu[] = array( | |
'TEXT' => GetMessage("intarface_form_mnu_on"), | |
'TITLE' => GetMessage("intarface_form_mnu_on_title"), | |
'ONCLICK' => 'bxForm_'.$arParams["FORM_ID"].'.EnableSettings(true)', | |
'DISABLED' => ($USER->IsAuthorized()? false:true), | |
'ICONCLASS' => 'form-settings-on' | |
); | |
} | |
else | |
{ | |
$settingsMenu[] = array( | |
'TEXT' => GetMessage("intarface_form_mnu_off"), | |
'TITLE' => GetMessage("intarface_form_mnu_off_title"), | |
'ONCLICK' => 'bxForm_'.$arParams["FORM_ID"].'.EnableSettings(false)', | |
'DISABLED' => ($USER->IsAuthorized()? false:true), | |
'ICONCLASS' => 'form-settings-off' | |
); | |
} | |
} | |
} | |
if(!empty($arThemes)) | |
{ | |
$themeItems = array(); | |
foreach($arThemes as $theme) | |
{ | |
$themeItems[] = array( | |
'TEXT' => $theme["name"].($theme["theme"] == $arResult["GLOBAL_OPTIONS"]["theme"]? ' '.GetMessage("interface_form_default"):''), | |
'ONCLICK' => 'bxForm_'.$arParams["FORM_ID"].'.SetTheme(this, \''.$theme["theme"].'\')', | |
'ICONCLASS' => ($theme["theme"] == $arResult["OPTIONS"]["theme"] || $theme["theme"] == "grey" && $arResult["OPTIONS"]["theme"] == ''? 'checked' : '') | |
); | |
} | |
$settingsMenu[] = array( | |
'TEXT' => GetMessage("interface_form_colors"), | |
'TITLE' => GetMessage("interface_form_colors_title"), | |
'CLASS' => 'bx-grid-themes-menu-item', | |
'MENU' => $themeItems, | |
'DISABLED' => ($USER->IsAuthorized()? false:true), | |
'ICONCLASS' => 'form-themes' | |
); | |
} | |
?> | |
bxForm_<?=$arParams["FORM_ID"]?>.settingsMenu = <?=CUtil::PhpToJsObject($settingsMenu)?>; | |
<?if($arResult["OPTIONS"]["expand_tabs"] == "Y"):?> | |
BX.ready(function(){bxForm_<?=$arParams["FORM_ID"]?>.ToggleTabs(true);}); | |
<?endif?> | |
</script> | |
</div> | |
<?if($bWasRequired):?> | |
<div class="bx-form-notes"><span class="required">*</span><?echo GetMessage("interface_form_required")?></div> | |
<?endif?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment