18 $this->list_url = trim((
string)
$list_url);
19 if ($this->list_url ===
'')
23 public function Show(
$text, $sort_by, $alt_title =
false, $baseCssClass =
"")
28 if(mb_strtolower($this->field) == mb_strtolower($sort_by))
30 if(mb_strtolower($this->order) ==
"desc")
33 $title .=
" ".GetMessage(
"admin_lib_sort_down");
38 $title .=
" ".GetMessage(
"admin_lib_sort_up");
44 $sep = (
false === mb_strpos(
$path,
'?') ?
'?' :
'&');
45 $url =
$path.$sep.$this->by_name.
"=".$sort_by.
"&".$this->ord_name.
"=".($class <>
""? $ord:
"");
47 return 'class="'.$baseCssClass.
' adm-list-table-cell-sort'.$class.
'" onclick="'.$this->table_id.
'.Sort(\''.
htmlspecialcharsbx(CUtil::addslashes(
$url)).
'\',
'.($class <> ""? "false" : "true").', arguments);
" title="'.$title.'"';
51class CAdminSubList extends CAdminList
53 public const MODE_CONFIG = 'subsettings';
55 * list_url - string with params or array:
57 * PARAMS (array key => value)
60 public $strListUrl = ''; // add
61 public $strListUrlParams = ''; // add
62 public $arListUrlParams = array(); // add
63 public $boolNew = false; // add
64 public $arFieldNames = array(); // add
65 public $arHideHeaders = array(); // add
67 protected $bPublicMode = false;
69 protected $dialogParams = array();
70 protected $requiredDialogParams = array(
73 protected $dialogButtons = array(
74 'BX.CAdminDialog.btnSave', 'BX.CAdminDialog.btnCancel'
84 public function __construct($table_id, $sort = false, $list_url = '', $arHideHeaders = false)
88 $this->bPublicMode = defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1;
89 $this->dialogParams['from_module'] = 'iblock';
90 $this->requiredDialogParams['sessid'] = bitrix_sessid();
91 if (!$this->bPublicMode)
93 $this->dialogParams['bxsku'] = 'Y';
94 $this->requiredDialogParams['bxshowsettings'] = 'Y';
98 'js' => '/bitrix/js/iblock/subelement.js',
99 'rel' => array('admin_interface')
101 if ($this->bPublicMode)
102 $arJSDescr['css'] = '/bitrix/panel/iblock/sub-public.css';
104 $arJSDescr['css'] = '/bitrix/panel/iblock/sub-admin.css';
106 CJSCore::RegisterExt('subelement', $arJSDescr);
107 CJSCore::Init(array("subelement
"));
109 $this->strListUrlParams = '';
110 $this->arListUrlParams = array();
112 if (is_array($list_url) && isset($list_url['LINK']))
114 $this->strListUrl = $list_url['LINK'];
115 $this->__ParseListUrl(true);
116 if (isset($list_url['PARAMS']))
117 $this->__SetListUrlParams($list_url['PARAMS']);
121 $this->strListUrl = $list_url;
122 $this->__ParseListUrl(true);
124 if ('' == $this->strListUrl)
126 $this->strListUrl = $APPLICATION->GetCurPageParam();
127 $this->__ParseListUrl(true);
129 if ($this->bPublicMode)
130 $this->__AddListUrlParams('bxpublic', 'Y');
133 $sort = new CAdminSubSorting($table_id, 'ID', 'ASC', 'by', 'order', $this->GetListUrl(true));
135 $sort->list_url = $this->GetListUrl(true);
137 parent::__construct($table_id, $sort);
139 $this->SetBaseFieldNames();
140 if (!empty($arHideHeaders) && is_array($arHideHeaders))
141 $this->arHideHeaders = $arHideHeaders;
144 //TODO: remove after parent update wiil be stable
145 protected function initMode(): void
147 $this->mode = self::MODE_PAGE;
148 $mode = $this->request->get(self::MODE_FIELD_NAME);
153 $this->getModeList(),
162 protected function getModeList(): array
172 public function isConfigMode(): bool
174 return $this->getCurrentMode() === self::MODE_CONFIG;
177 function GetListUrl($boolFull = false)
179 $boolFull = ($boolFull === true);
180 return $this->strListUrl.($boolFull && '' != $this->strListUrlParams ? '?'.$this->strListUrlParams : '');
183 function __UpdateListUrlParams()
185 $this->strListUrlParams = '';
186 if (!empty($this->arListUrlParams))
188 foreach ($this->arListUrlParams as $key => $value)
189 $this->strListUrlParams .= $key.'='.$value.'&';
191 $this->strListUrlParams = mb_substr($this->strListUrlParams, 0, -1);
195 function __ClearListUrlParams()
197 $this->arListUrlParams = array();
198 $this->strListUrlParams = '';
201 function __AddListUrlParams($strKey, $strValue)
205 $this->arListUrlParams[$strKey] = $strValue;
206 $this->__UpdateListUrlParams();
210 function __DeleteListUrlParams($mxKey)
212 if (is_array($mxKey))
214 foreach ($mxKey as $value)
215 if ('' != $value && array_key_exists($value,$this->arListUrlParams))
216 unset($this->arListUrlParams[$value]);
218 elseif ('' != $mxKey && array_key_exists($mxKey,$this->arListUrlParams))
220 unset($this->arListUrlParams[$mxKey]);
222 $this->__UpdateListUrlParams();
225 function __SetListUrlParams($mxParams,$boolClear = false)
227 $boolClear = ($boolClear === true);
229 $this->arListUrlParams = array();
230 if (!is_array($mxParams))
233 parse_str($mxParams, $arParams);
234 $mxParams = (is_array($arParams) ? $arParams : array());
236 foreach ($mxParams as $key => $value)
238 $this->arListUrlParams[$key] = $value;
240 $this->__UpdateListUrlParams();
243 function __ParseListUrl($boolClear = false)
245 $mxPos = mb_strpos($this->strListUrl, '?');
246 if (false !== $mxPos)
248 $this->__SetListUrlParams(mb_substr($this->strListUrl, $mxPos + 1), $boolClear);
249 $this->strListUrl = mb_substr($this->strListUrl, 0, $mxPos);
253 function AddHideHeader($strID)
255 $strID = trim($strID);
258 if (!in_array($strID, $this->arHideHeaders))
259 $this->arHideHeaders[] = $strID;
263 //id, name, content, sort, default
264 public function AddHeaders($aParams)
266 $showAll = $this->request->get('showallcol');
267 if ($showAll !== null && $showAll !== '')
269 $this->session['SHALL'] = $showAll === 'Y';
271 $showAll = isset($this->session['SHALL']) && $this->session['SHALL'];
273 $hiddenColumns = (!empty($this->arHideHeaders) ? array_fill_keys($this->arHideHeaders, true) : array());
275 $aOptions = CUserOptions::GetOption("list
", $this->table_id, array());
276 if (!is_array($aOptions))
281 $aColsTmp = explode(",
", $aOptions["columns
"] ?? '');
283 $userColumns = array();
285 foreach($aColsTmp as $col)
288 if ($col != '' && !isset($hiddenColumns[$col]))
291 $userColumns[$col] = true;
295 $bEmptyCols = empty($aCols);
296 $userVisibleColumns = array();
297 foreach ($aParams as $param)
299 $param["__sort
"] = -1;
300 $param['default'] ??= false;
301 if (!isset($hiddenColumns[$param["id"]]))
303 $this->aHeaders[$param["id"]] = $param;
306 || ($bEmptyCols && ($param["default"] === true))
307 || isset($userColumns[$param["id"]])
310 $this->arVisibleColumns[] = $param["id"];
311 $userVisibleColumns[$param["id"]] = true;
317 $aAllCols = ($this->isConfigMode() ? $this->aHeaders : null);
321 foreach ($aCols as $i => $col)
322 if (isset($this->aHeaders[$col]))
323 $this->aHeaders[$col]["__sort
"] = $i;
324 Main\Type\Collection::sortByColumn($this->aHeaders, array('__sort' => SORT_ASC), '', null, true);
327 foreach($this->aHeaders as $id=>$arHeader)
329 if (isset($userVisibleColumns[$id]) && !isset($hiddenColumns[$id]))
330 $this->aVisibleHeaders[$id] = $arHeader;
332 unset($userVisibleColumns, $hiddenColumns);
334 if ($this->isConfigMode())
336 $this->ShowSettings($aAllCols, $aCols, $aOptions);
340 public function AddVisibleHeaderColumn($id)
342 if (!in_array($id, $this->arVisibleColumns) && !in_array($id,$this->arHideHeaders))
343 $this->arVisibleColumns[] = $id;
346 protected function GetSystemContextMenu(array $config = []): array
350 if (isset($config['settings']))
352 $this->__AddListUrlParams(parent::MODE_FIELD_NAME,self::MODE_CONFIG);
354 "TEXT
" => GetMessage("admin_lib_context_sett
"),
355 "TITLE
" => GetMessage("admin_lib_context_sett_title
"),
356 "ONCLICK
" => $this->table_id.".ShowSettings(
'".CUtil::JSEscape($this->GetListUrl(true))."')
",
357 "ICON
" => "btn_sub_settings
",
359 $this->__DeleteListUrlParams('mode');
361 if (isset($config['excel']))
363 $this->__AddListUrlParams(parent::MODE_FIELD_NAME,parent::MODE_EXPORT);
366 "TITLE
" => GetMessage("admin_lib_excel
"),
367 "ONCLICK
" => "location.href=
'".htmlspecialcharsbx($this->GetListUrl(true))."'",
368 "ICON
" => "btn_sub_excel
",
370 $this->__DeleteListUrlParams('mode');
375 protected function InitContextMenu(array $menu = [], array $additional = []): void
377 if (!empty($menu) || !empty($additional))
379 $this->context = new CAdminSubContextMenuList($menu, $additional);
388 public function IsGroupActionToAll()
390 return (isset($_REQUEST['action_sub_target']) && $_REQUEST['action_sub_target'] === 'selected');
396 protected function GetGroupIds()
399 if (isset($_REQUEST['SUB_ID']))
401 $result = (!is_array($_REQUEST['SUB_ID']) ? array($_REQUEST['SUB_ID']) : $_REQUEST['SUB_ID']);
406 public function ActionPost($url = false, $action_name = false, $action_value = 'Y')
408 return $this->table_id.".FormSubmit();
";
411 public function ActionDoGroup($id, $action_id, $add_params='')
413 $strParams = "SUB_ID=
".urlencode($id)
414 ."&action=
".urlencode($action_id)
415 ."&
lang=
".urlencode(LANGUAGE_ID)
416 ."&
".bitrix_sessid_get()
417 .($add_params<>""? "&
".$add_params: "")
419 $strUrl = $this->GetListUrl(true).('' != $this->strListUrlParams ? '&' : '?').$strParams;
420 return $this->table_id.".GetAdminList(
'".CUtil::JSEscape($strUrl)."');
";
423 public function &AddRow($id = false, $arRes = array(), $link = false, $title = false, $boolBX = false)
425 $row = new CAdminSubListRow($this->aHeaders, $this->table_id);
427 $row->arRes = $arRes;
429 $row->title = $title;
430 $row->pList = &$this;
431 $row->boolBX = $boolBX;
435 if($this->bEditMode && in_array($id, $this->arEditedRows))
436 $row->bEditMode = true;
437 elseif(!empty($this->arUpdateErrorIDs) && in_array($id, $this->arUpdateErrorIDs))
438 $row->bEditMode = true;
441 $this->aRows[] = &$row;
445 public function Display()
447 foreach(GetModuleEvents("main
", "OnAdminSubListDisplay
", true) as $arEvent)
448 ExecuteModuleEventEx($arEvent, array(&$this));
450 // Check after event handlers
451 if (!is_array($this->arActions))
453 $this->arActions = [];
455 if (!is_array($this->arActionsParams))
457 $this->arActionsParams = [];
460 echo '<div id="form_
'.$this->table_id.'" class="adm-sublist
">';
462 if($this->bEditMode && !$this->bCanBeEdited)
463 $this->bEditMode = false;
465 $boolCloseMessage = true;
467 foreach ($this->arFilterErrors as $err)
468 $errmsg .= ($errmsg<>''? '<br>': '').$err;
469 foreach ($this->arUpdateErrors as $err)
470 $errmsg .= ($errmsg<>''? '<br>': '').$err[0];
471 foreach ($this->arGroupErrors as $err)
472 $errmsg .= ($errmsg<>''? '<br>': '').$err[0];
475 CAdminSubMessage::ShowMessage(array("MESSAGE
"=>GetMessage("admin_lib_error
"), "DETAILS
"=>$errmsg, "TYPE
"=>"ERROR
"));
476 $boolCloseMessage = false;
479 $successMessage = '';
480 for ($i = 0, $cnt = count($this->arActionSuccess); $i < $cnt; $i++)
481 $successMessage .= ($successMessage != '' ? '<br>' : '').$this->arActionSuccess[$i];
482 if ($successMessage != '')
484 CAdminSubMessage::ShowMessage(array("MESSAGE
" => GetMessage("admin_lib_success
"), "DETAILS
" => $successMessage, "TYPE
" => "OK
"));
485 $boolCloseMessage = false;
488 if ($this->bPublicMode && $boolCloseMessage)
490 echo '<script>top.BX.WindowManager.Get().hideNotify();</script>';
493 echo $this->sPrologContent;
495 if($this->sContent===false)
497 echo '<div class="adm-list-table-wrap
'.($this->context ? '' : ' adm-list-table-without-header
').(empty($this->arActions) && !$this->bCanBeEdited ? ' adm-list-table-without-footer
' : '').'">';
501 $this->context->Show();
504 echo bitrix_sessid_post();
506 if($this->sContent!==false)
508 echo $this->sContent;
512 $bShowSelectAll = (!empty($this->arActions) || $this->bCanBeEdited);
514 $this->bShowActions = false;
515 foreach($this->aRows as $row)
517 if(!empty($row->aActions))
519 $this->bShowActions = true;
526echo '<table class="adm-list-table
" id="'.$this->table_id.'">
528 <tr class="adm-list-table-header
">';
532 echo '<td class="adm-list-table-cell adm-list-table-checkbox
" onclick="this.firstChild.firstChild.click();
return BX.PreventDefault(event);
"><div class="adm-list-table-cell-inner
"><input class="adm-checkbox adm-designed-checkbox
" type="checkbox
" id="'.$this->table_id.'_check_all
" '.($this->bEditMode ? 'disabled' : 'onclick="'.$this->table_id.'.SelectAllRows(
this);
return BX.eventCancelBubble(event);
"').' title="'.GetMessage("admin_lib_list_check_all").'" /><label for="'.$this->table_id.'_check_all
" class="adm-designed-checkbox-label
"></label></div></td>';
535 if($this->bShowActions)
537 echo '<td class="adm-list-table-cell adm-list-table-popup-block
" title="'.GetMessage("admin_lib_list_act").'"><div class="adm-list-table-cell-inner
"></div></td>';
540 foreach($this->aHeaders as $column_id=>$header)
542 if(!in_array($column_id, $this->arVisibleColumns))
545 $header['title'] = (string)($header['title'] ?? '');
546 $bSort = $this->sort && !empty($header["sort
"]);
550 $attrs = $this->sort->Show(
554 "adm-list-table-cell
"
559 $attrs = 'class="adm-list-table-cell
"';
563 echo '<td '.$attrs.'>
564 <div class="adm-list-table-cell-inner
">'.$header["content
"].'</div>'.($bSort ? '<span class="adm-sub-sort
"></span>' : '').'
569 echo '</tr></thead><tbody>';
571 if (!empty($this->aRows))
573 foreach ($this->aRows as &$row)
577 elseif (!empty($this->aHeaders))
579 echo '<tr><td colspan="'.$colSpan.'" class="adm-list-table-cell adm-list-table-empty
">'.GetMessage("admin_lib_no_data
").'</td></tr>';
582 echo '</tbody></table>';
584 $this->ShowActionTable();
586 echo $this->sEpilogContent;
588 echo $this->sNavText;
591 public function ShowActionTable()
593 if (empty($this->arActions) && !$this->bCanBeEdited)
596<div class="adm-list-table-footer
" id="<?=$this->table_id?>_footer<?=$this->bEditMode || !empty($this->arUpdateErrorIDs) ?
'_edit' :
''?>
">
597 <input type="hidden
" name="action_button
" id="<?=
$this->table_id; ?>_action_button
" value="" />
599 if($this->bEditMode || !empty($this->arUpdateErrorIDs))
601 $this->DisplayEditButtons();
606 if (isset($this->arActionsParams["disable_action_target
"]) && $this->arActionsParams["disable_action_target
"] === true)
608 elseif (isset($this->arActionsParams["disable_action_sub_target
"]) && $this->arActionsParams["disable_action_sub_target
"] === true)
613 <span class="adm-selectall-wrap
"><input type="checkbox
" class="adm-checkbox adm-designed-checkbox
" name="action_sub_target
" id="<?=
$this->table_id;?>_action_sub_target
" value="selected" onclick="if(this.checked && !confirm(
'<?=CUtil::JSEscape(GetMessage("admin_lib_list_edit_for_all_warn"));?>')) {this.checked=
false;} <?=
$this->table_id;?>.EnableActions();
" title="<?=
GetMessage(
"admin_lib_list_edit_for_all");?>
" /><label title="<?=
GetMessage(
"admin_lib_list_edit_for_all");?>
" for="action_sub_target
" class="adm-checkbox-label
"><?=GetMessage("admin_lib_list_for_all
");?></label></span>
616 $this->bCanBeDeleted = array_key_exists("delete", $this->arActions);
618 if ($this->bCanBeEdited || $this->bCanBeDeleted)
621 <span class="adm-table-item-edit-wrap
'.(!$this->bCanBeEdited || !$this->bCanBeDeleted ? ' adm-table-item-edit-single
' : '').'">';
622 if($this->bCanBeEdited):
623 echo '<a href="javascript:void(0)
" class="adm-table-btn-edit adm-edit-disable
" hidefocus="true" onclick="this.blur();
if(
'.$this->table_id.'.IsActionEnabled(\
'edit\')){BX(\''.$this->table_id.
'_action_button\').value=\'edit\'; '.
htmlspecialcharsbx($this->ActionPost()).
'}" title="'.
GetMessage(
"admin_lib_list_edit").
'" id="'.$this->table_id.
'_action_edit_button"></a>';
625 if($this->bCanBeDeleted):
626 echo
'<a href="javascript:void(0);" class="adm-table-btn-delete adm-edit-disable" hidefocus="true" onclick="this.blur();if('.$this->table_id.
'.IsActionEnabled() && confirm((BX(\'action_sub_target\') && BX(\'action_sub_target\').checked ? \''.
GetMessage(
"admin_lib_list_del").
'\':\
''.
GetMessage(
"admin_lib_list_del_sel").
'\'))) {BX(\
''.$this->table_id.
'_action_button\').value=\'delete\'; '.
htmlspecialcharsbx($this->ActionPost()).
'}" title="'.
GetMessage(
"admin_lib_list_del_title").
'" class="context-button icon action-delete-button-dis" id="'.$this->table_id.
'_action_delete_button"></a>';
632 if (isset($this->arActionsParams[
"select_onchange"]))
634 if (is_array($this->arActionsParams[
"select_onchange"]))
636 $onchange = implode(
' ', $this->arActionsParams[
"select_onchange"]);
638 elseif (is_string($this->arActionsParams[
"select_onchange"]))
640 $onchange = $this->arActionsParams[
"select_onchange"];
648 $actionList = array_filter($this->arActions);
649 if (isset($actionList[
'delete']))
651 unset($actionList[
'delete']);
657 'multicontrol' =>
true
660 foreach($actionList as
$k=>$v)
664 if (isset($v[
'type']) && isset($allowedTypes[$v[
'type']]))
669 $buttons .=
'<input type="button" name="" value="'.htmlspecialcharsbx($v[
'name']).
'" onclick="'.(!empty($v[
"action"])?
htmlspecialcharsbx($v[
'action']) :
'document.getElementById(\''.$this->table_id.
'_action_button\').value=\''.
htmlspecialcharsbx($v[
"value"]).
'\'; '.
htmlspecialcharsbx($this->ActionPost()).
'').
'" title="'.
htmlspecialcharsbx($v[
"title"]).
'" />';
672 $html .=
'<span class="adm-list-footer-ext">'.$v[
"value"].
'</span>';
675 $data = $this->prepareGroupMultiControl(
$k, $v);
678 $list .=
$data[
'ITEM'];
679 if (isset(
$data[
'BLOCK']))
681 $html .=
'<span class="adm-list-footer-ext">'.$data[
'BLOCK'].
'</span>';
683 if (isset(
$data[
'ACTION']))
685 $blockMap[] =
$data[
'ACTION'];
693 $list .=
'<option value="'.htmlspecialcharsbx($v[
'value']).
'"'.($v[
'action']?
' custom_action="'.htmlspecialcharsbx($v[
'action']).
'"':
'').
'>'.htmlspecialcharsex($v[
'name']).
'</option>';
698 $list .=
'<option value="'.htmlspecialcharsbx(
$k).
'">'.htmlspecialcharsex($v).
'</option>';
701 unset($actionList,
$k, $v);
702 unset($allowedTypes);
705 echo
'<span class="adm-list-footer-ext">'.$buttons.
'</span>';
709 <span
class=
"adm-select-wrap">
710 <
select name=
"action" id=
"<?=$this->table_id.'_action'; ?>" class=
"adm-select"<?=($onchange !=
'' ?
' onchange="'.htmlspecialcharsbx($onchange).
'"':
'')?> <?
711 if (!empty($blockMap))
714 data-actions=
"<?=htmlspecialcharsbx(Main\Web\Json::encode($blockMap)); ?>" data-use-actions=
"Y"
718 <option value=
""><?=
GetMessage(
"admin_lib_list_actions")?></option>
726 <input type=
"button" name=
"apply_sub" id=
"<?=$this->table_id;?>_apply_sub_button" value=
"<?=GetMessage("admin_lib_list_apply
");?>" onclick=
"<?=$this->table_id;?>.ExecuteFormAction('ACTION_BUTTON');" disabled=
"disabled" class=
"adm-table-action-button" />
730 <span
class=
"adm-table-counter" id=
"<?=$this->table_id?>_selected_count"><?=
GetMessage(
'admin_lib_checked')?>: <span>0</span></span>
740 $menu =
new CAdminPopup($this->table_id.
"_menu", $this->table_id.
"_menu",
false,
array(
'zIndex' => 4000));
743 $tbl = CUtil::JSEscape($this->table_id);
744 $aUserOpt = CUserOptions::GetOption(
"global",
"settings");
752var '.$this->table_id.
'= new BX.adminSubList("'.$tbl.
'", {context_ctrl: '.(
$aUserOpt[
"context_ctrl"] ===
"Y"?
"true":
"false").
'}, "'.$this->
GetListUrl(
true).
'");
753function ReloadSubList()
757function ReloadOffers()
763 echo
'<div id="'.$this->table_id.
'_result_div">';
781 $string = ob_get_contents();
786 echo
'<html><head></head><body>
787<div id="'.$this->table_id.
'_result_frame_div">'.$string.
'</div>
790 if($this->bEditMode ||
count($this->arUpdateErrorIDs)>0)
791 echo $this->table_id.
'._DeActivateMainForm();';
793 echo $this->table_id.
'._ActivateMainForm();';
795 if($this->onLoadScript)
796 echo
'w.eval(\''.CUtil::JSEscape($this->onLoadScript).
'\');
';
797 echo '</script></body></html>
';
801 if($this->onLoadScript)
802 echo '<script>
'.$this->onLoadScript.'</script>
';
805 define("ADMIN_AJAX_MODE", true);
806 require($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/epilog_admin_after.php");
809 elseif ($this->isExportMode())
811 $fname = basename($APPLICATION->GetCurPage(), ".php");
812 // http response splitting defence
813 $fname = str_replace(array("\r", "\n"), "", $fname);
815 header("Content-Type: application/vnd.ms-excel");
816 header("Content-Disposition: filename=".$fname.".xls");
817 $APPLICATION->EndBufferContentMan();
818 $this->DisplayExcel();
819 require($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/include/epilog_admin_after.php");
824 function SetBaseFieldNames()
826 $this->arFieldNames = array(
834 function AddListFieldNames()
836 $this->arFieldNames[] = array(
837 'NAME
' => 'ACTION_BUTTON
',
840 $this->arFieldNames[] = array(
841 'NAME
' => 'SUB_ID[]
',
842 'TYPE
' => 'CHECKBOX
',
846 function SetListFieldNames($boolClear = true)
848 $boolClear = ($boolClear === true);
850 $this->SetBaseFieldNames();
851 $this->AddListFieldNames();
854 function DeleteFieldNames($arList = array())
856 if (false == is_array($arList))
858 if (false == empty($arList))
861 foreach ($this->arFieldNames as $arName)
863 if (!in_array($arName['NAME
'],$arList))
864 $arTempo[] = $arName;
866 $this->arFieldNames = $arTempo;
871 function GetListFieldNames()
873 return $this->arFieldNames;
876 function AddFieldNames($strFieldName, $strFieldType)
881 public function setDialogParams($params)
883 if (!is_array($params))
885 $this->dialogParams = $params;
888 public function getDialogParams($withRequired = false)
890 $withRequired = ($withRequired === true);
891 $result = $this->dialogParams;
894 foreach ($this->requiredDialogParams as $key => $value)
895 $result[$key] = $value;
901 public function setDialogButtons($buttons)
903 if (!is_array($buttons))
905 $this->dialogButtons = $buttons;
908 public function setReadDialogButtons(): void
910 $this->setDialogButtons(['BX.CAdminDialog.btnCancel
']);
913 public function getDialogButtons($jsFormat = false)
915 $jsFormat = ($jsFormat === true);
918 return '[
'.implode(", \r\n", $this->dialogButtons).']
';
922 return $this->dialogButtons;
926 public function getRowAction($url)
928 return "(new BX.CAdminDialog({
929 'content_url
': '".$url."',
930 'content_post
': ".CUtil::PhpToJSObject($this->getDialogParams(true), false, true, true).",
935 'buttons
': ".$this->getDialogButtons(true)."
939 protected function DisplayEditButtons(): void
942 <input type="button" name="save_sub" id="<?=$this->table_id;?>_save_sub_button" value="<?=GetMessage("admin_lib_list_edit_save");?>." title="<?=GetMessage("admin_lib_list_edit_save_title");?>" onclick="<?=$this->table_id;?>.ExecuteFormAction('SAVE_BUTTON
');" />
943 <input type="button" name="cancel_sub" id="<?=$this->table_id;?>_cancel_sub_button" value="<?=GetMessage("admin_lib_list_edit_cancel");?>" title="<?=GetMessage("admin_lib_list_edit_cancel_title");?>" onclick="<?=$this->ActionAjaxReload($this->GetListUrl(true));?>"/>
947 private function prepareGroupMultiControl(string $id, array $action)
951 if (empty($action['action
']) || !is_array($action['action
']))
954 $subBlocks = $this->compileActions($action['action
']);
957 'ITEM
' => '<option value=
"'.htmlspecialcharsbx($id).'">
'.htmlspecialcharsex($action['name
']).'</option>
'
959 if (!empty($subBlocks))
961 $actionBlockId = $id.'_block
';
963 $result['BLOCK
'] = '<div
id=
"'.htmlspecialcharsbx($actionBlockId).'" style=
"display: none;">
'.
964 implode('', $subBlocks).
967 $result['ACTION
'] = [
969 'BLOCK
' => $actionBlockId
976 private function createGroupSubControl(array $data)
980 foreach ($data as $row)
982 if (empty($row) || !is_array($row) || !isset($row['TYPE
']))
985 switch ($row['TYPE
'])
987 case Main\Grid\Panel\Types::DROPDOWN:
988 $item = $this->createGroupSubControlDropdown($row);
990 case Main\Grid\Panel\Types::TEXT:
991 $item = $this->createGroupSubControlText($row);
999 return (!empty($result) ? $result: null);
1006 private function compileActions(array $actions)
1009 foreach ($actions as $row)
1011 if (empty($row) || !is_array($row))
1013 if (!isset($row['ACTION
']))
1015 switch ($row['ACTION
'])
1017 case Main\Grid\Panel\Actions::CREATE:
1018 if (!empty($row['DATA
']) && is_array($row['DATA
']))
1020 $subControl = $this->createGroupSubControl($row['DATA
']);
1021 if (!empty($subControl))
1023 $result = array_merge($result, $subControl);
1034 private function createGroupSubControlDropdown(array $data)
1037 if (!isset($data['ID
']) || !isset($data['NAME
']))
1039 if (empty($data['ITEMS
']) || !is_array($data['ITEMS
']))
1047 foreach ($data['ITEMS
'] as $row)
1049 if (!isset($row['VALUE
']) || !isset($row['NAME
']))
1052 if (!empty($row['ONCHANGE
']) && is_array($row['ONCHANGE
']))
1054 $itemBlocks = $this->compileActions($row['ONCHANGE
']);
1055 if (!empty($itemBlocks))
1057 $itemBlockId = $data['ID
'].'_
'.$row['VALUE
'].'_block
';
1058 $subBlocks[] = '<span
class=
"adm-list-footer-ext"><div
id=
"'.htmlspecialcharsbx($itemBlockId).'" style=
"display: '.($first ? 'inline-block' : 'none').';">
'.
1059 implode('', $itemBlocks).
1062 'VALUE
' => $row['VALUE
'],
1063 'BLOCK
' => $itemBlockId
1069 $items[] = '<option value=
"'.htmlspecialcharsbx($row['VALUE']).'">
'.
1070 htmlspecialcharsex($row['NAME
']).
1079 $result = '<
select id=
"'.htmlspecialcharsbx($data['ID']).'" '.
1080 'name=
"'.htmlspecialcharsbx($data['NAME']).'"'.
1081 (!empty($blockMap) ? ' data-actions=
"'.htmlspecialcharsbx(Main\Web\Json::encode($blockMap)).'" data-use-actions=
"Y"' : '').
1082 'data-action-item=
"Y" '.
1084 $result .= implode('', $items);
1086 if (!empty($subBlocks))
1088 $result .= implode('', $subBlocks);
1100 private function createGroupSubControlText(array $data)
1102 if (!isset($data['ID
']) || !isset($data['NAME
']))
1104 return '<span
class=
"adm-input-text-wrap"><input type=
"text" id=
"'.htmlspecialcharsbx($data['ID']).'" '.
1105 'name=
"'.htmlspecialcharsbx($data['NAME']).'" '.
1106 'data-action-item=
"Y" '.
1111class CAdminSubListRow extends CAdminListRow
1116 public $arFieldNames = array(); //add
1117 public $boolBX = false; // add
1119 public function __construct($aHeaders,$table_id)
1121 parent::__construct($aHeaders,$table_id);
1124 public function Display()
1126 $sDefAction = $sDefTitle = "";
1127 if (!$this->bEditMode)
1129 if (!empty($this->link))
1131 if (true == $this->boolBX)
1132 $sDefAction = $this->pList->getRowAction($this->link);
1134 $sDefAction = "BX.adminPanel.Redirect([], '
".CUtil::JSEscape($this->link)."', event);";
1135 $sDefTitle = $this->title;
1139 foreach ($this->aActions as $action)
1140 if ($action["DEFAULT"] == true)
1142 if (true == $this->boolBX)
1143 $sDefAction = $this->pList->getRowAction(CUtil::addslashes($action["ACTION"]));
1145 $sDefAction = $action["ACTION"]
1146 ? htmlspecialcharsbx($action["ACTION"])
1147 : "BX.adminPanel.Redirect([], '".CUtil::JSEscape($action["LINK
"])."', event)"
1149 $sDefTitle = (!empty($action["TITLE"])? $action["TITLE"]:$action["TEXT"]);
1154 $sDefAction = htmlspecialcharsbx($sDefAction);
1155 $sDefTitle = htmlspecialcharsbx($sDefTitle);
1159 if(!empty($this->aActions))
1160 $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions));
1163<tr class="adm-list-table-row<?=(isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true? ' footer
':'')?><?=$this->bEditMode?' adm-table-row-active
' : ''?>"<?=($sMenuItems <> "" ? ' oncontextmenu=
"return '.$sMenuItems.';"':'');?><?=($sDefAction <> ""? ' ondblclick=
"'.$sDefAction.'"'.(!empty($sDefTitle)? ' title=
"'.GetMessage("admin_lib_list_double_click
").' '.$sDefTitle.'"':''):'')?>>
1166 if (!empty($this->pList->arActions) || $this->pList->bCanBeEdited):
1167 $check_id = RandString(5);
1169 <td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?=$this->bReadOnly? ' adm-list-table-checkbox-
disabled':''?>"><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="SUB_ID[]" id="<?=$this->table_id."_".$this->id."_".$check_id;?>" value="<?=$this->id?>" autocomplete="off" title="<?=GetMessage("admin_lib_list_check")?>"<?=$this->bReadOnly? ' disabled=
"disabled"':''?><?=$this->bEditMode ? ' checked=
"checked" disabled=
"disabled"' : ''?> /><label class="adm-designed-checkbox-label adm-checkbox" for="<?=$this->table_id."_".$this->id."_".$check_id;?>"></label></td>
1173 if($this->pList->bShowActions):
1174 if(!empty($this->aActions)):
1176 <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="<?=GetMessage("admin_lib_list_actions_title")?>"></div></td>
1180 <td class="adm-list-table-cell"></td>
1185 end($this->pList->aVisibleHeaders);
1186 $last_id = key($this->pList->aVisibleHeaders);
1187 reset($this->pList->aVisibleHeaders);
1189 $bVarsFromForm = ($this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs));
1190 foreach($this->pList->aVisibleHeaders as $id=>$header_props)
1192 $field = $this->aFields[$id] ?? [];
1193 if ($this->bEditMode && isset($field["edit"]))
1195 if ($bVarsFromForm && isset($_REQUEST["FIELDS"]))
1197 $val = $_REQUEST["FIELDS"][$this->id][$id] ?? '';
1201 $val = $this->arRes[$id] ?? '';
1204 $val_old = $this->arRes[$id] ?? '';
1206 echo '<td
class=
"adm-list-table-cell',
1207 (isset($header_props['align']) && $header_props['align']? ' align-'.$header_props['align']: ''),
1208 (isset($header_props['valign']) && $header_props['valign']? ' valign-'.$header_props['valign']: ''),
1209 ($id === $last_id? ' adm-list-table-cell-last': ''),
1212 if(is_array($val_old))
1214 foreach($val_old as $k=>$v)
1215 echo '<input type=
"hidden" name=
"FIELDS_OLD['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']['.htmlspecialcharsbx($k).']" value=
"'.htmlspecialcharsbx($v).'">
';
1219 echo '<input type=
"hidden" name=
"FIELDS_OLD['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value=
"'.htmlspecialcharsbx($val_old).'">
';
1221 switch($field["edit"]["type"])
1224 echo '<input type=
"hidden" name=
"FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value=
"N">
';
1225 echo '<input type=
"checkbox" name=
"FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value=
"Y"'.($val=='Y
' || $val === true?' checked
':'').'>
';
1228 echo '<
select name=
"FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']"'.$this->__AttrGen($field["edit"]["attributes"]).'>
';
1229 foreach($field["edit"]["values"] as $k=>$v)
1230 echo '<option value=
"'.htmlspecialcharsbx($k).'" '.($k==$val?' selected':'').'>
'.htmlspecialcharsbx($v).'</option>
';
1234 if(!$field["edit"]["attributes"]["size"])
1235 $field["edit"]["attributes"]["size"] = "10";
1236 echo '<input type=
"text" '.$this->__AttrGen($field["edit"]["attributes"]).' name=
"FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value=
"'.htmlspecialcharsbx($val).'">
';
1239 if(!$field["edit"]["attributes"]["size"])
1240 $field["edit"]["attributes"]["size"] = "10";
1241 echo '<span
style=
"white-space:nowrap;"><input type=
"text" '.$this->__AttrGen($field["edit"]["attributes"]).' name=
"FIELDS['.htmlspecialcharsbx($this->id).']['.htmlspecialcharsbx($id).']" value=
"'.htmlspecialcharsbx($val).'">
';
1242 echo CAdminCalendar::Calendar(
1243 'FIELDS[
'.htmlspecialcharsbx($this->id).'][
'.htmlspecialcharsbx($id).']
',
1246 $field['edit
']['useTime
']
1250 echo CFileInput::Show(
1251 'FIELDS[
'.htmlspecialcharsbx($this->id).'][
'.htmlspecialcharsbx($id).']
',
1253 $field["edit"]["showInfo"],
1254 $field["edit"]["inputs"]
1258 echo $field["edit"]['value
'];
1264 $val = $this->arRes[$id] ?? '';
1265 if (is_string($val))
1270 if(isset($field["view"]))
1272 switch($field["view"]["type"])
1275 if($val == 'Y
' || $val === true)
1276 $val = htmlspecialcharsex(GetMessage("admin_lib_list_yes"));
1278 $val = htmlspecialcharsex(GetMessage("admin_lib_list_no"));
1281 if (isset($field["edit"]["values"][$val]))
1283 $val = htmlspecialcharsex($field["edit"]["values"][$val]);
1285 elseif (isset($field["view"]["values"][$val]))
1287 $val = htmlspecialcharsex($field["view"]["values"][$val]);
1291 $val = htmlspecialcharsex($val);
1296 $val = CFileInput::Show(
1297 'NO_FIELDS[
'.htmlspecialcharsbx($this->id).'][
'.htmlspecialcharsbx($id).']
',
1299 $field["view"]["showInfo"],
1300 $field["view"]["inputs"]
1306 $val = $field["view"]['value
'];
1309 $val = htmlspecialcharsex($val);
1315 $val = htmlspecialcharsex($val);
1318 echo '<td
class=
"adm-list-table-cell',
1319 (isset($header_props['align']) && $header_props['align']? ' align-'.$header_props['align']: ''),
1320 (isset($header_props['valign']) && $header_props['valign']? ' valign-'.$header_props['valign']: ''),
1321 ($id === $last_id? ' adm-list-table-cell-last': ''),
1323 echo ((string)$val <> ""? $val: '&
nbsp;
');
1324 if(isset($field["edit"]) && $field["edit"]["type"] == "calendar")
1325 CAdminCalendar::ShowScript();
1334 function AddFieldNames($strFieldName,$strFieldType = 'HIDDEN
')
1336 if ($strFieldName <> '')
1338 if (false == isset($this->arFieldNames[$strFieldName]))
1340 if ($strFieldType == '')
1341 $strFieldType = 'HIDDEN
';
1342 $this->arFieldNames[$strFieldName] = mb_strtoupper($strFieldType);
1347 function GetFieldNames()
1349 return $this->arFieldNames;
1353class CAdminSubContextMenu extends CAdminContextMenu
1355 public function __construct($items, $additional_items = array())
1357 parent::__construct($items, $additional_items);
1362 $hkInst = CHotKeys::GetInstance();
1364 foreach(GetModuleEvents("main", "OnAdminSubContextMenuShow", true) as $arEvent)
1366 ExecuteModuleEventEx($arEvent, array(&$this->items, &$this->additional_items));
1370 $bNeedSplitClosing = false;
1371 foreach($this->items as $item)
1373 if(!empty($item["NEWBAR"]))
1376 if($bFirst || !empty($item["NEWBAR"]))
1379 if(!empty($item["NEWBAR"]) || !empty($item['SEPARATOR
']))
1382 if ($item['ICON
'] != 'btn_sub_list
' && !$bNeedSplitClosing)
1384 $this->BeginRightBar();
1385 $bNeedSplitClosing = true;
1388 $this->Button($item, $hkInst);
1395 if (!empty($this->additional_items))
1402 $this->Additional();
1406 if ($bNeedSplitClosing)
1407 $this->EndRightBar();
1412 function GetClassByID($icon_id)
1417 return 'adm-btn-add
';
1418 case 'btn_sub_copy
':
1419 return 'adm-btn-copy
';
1420 case 'btn_sub_delete
':
1421 return 'adm-btn-
delete';
1422 case 'btn_sub_active
':
1423 return 'adm-btn-active
';
1429 function GetActiveClassByID($icon_id)
1431 return 'adm-btn-active
';
1435class CAdminSubContextMenuList extends CAdminSubContextMenu
1439 echo '<div
class=
"adm-list-table-top">
';
1441 function BeginRightBar() {}
1442 function EndRightBar() {}
1444 function GetClassByID($icon_id)
1446 if (mb_substr($icon_id, 0, 7) == 'btn_sub_new
')
1447 return 'adm-btn-save adm-btn-add
';
1449 return parent::GetClassByID($icon_id);
1452 function GetActiveClassByID($icon_id)
1454 if (mb_substr($icon_id, 0, 7) == 'btn_sub_new
')
1455 return 'adm-btn-save-active
';
1457 return parent::GetActiveClassByID($icon_id);
1461class CAdminSubForm extends CAdminForm
1464 * list_url - string with params or array:
1466 * PARAMS (array key => value)
1467 * POST_PARAMS (array key => value)
1469 var $strListUrl = ''; // add
1470 var $strListUrlParams = ''; // add
1471 var $arListUrlParams = array(); // add
1472 var $strListPostParams = '';
1473 var $arListPostParams = array();
1474 var $boolShowSettings = false;
1476 public function __construct($name, $tabs, $bCanExpand = true, $bDenyAutosave = false, $list_url = '', $boolShowSettings = false)
1478 global $APPLICATION;
1481 'js
' => '/bitrix/js/iblock/subelementdet.js
',
1482 'css
' => '/bitrix/panel/iblock/sub-detail-
public.css
',
1483 'rel
' => array('admin_interface
')
1486 CJSCore::RegisterExt('subelementdet
', $arJSDescr);
1488 CUtil::InitJSCore(array("subelementdet"));
1490 if (is_array($tabs))
1492 foreach (array_keys($tabs) as $index)
1494 $tabs[$index]['ONSELECT
'] = (string)($tabs[$index]['ONSELECT
'] ?? '');
1498 parent::__construct($name, $tabs, $bCanExpand, $bDenyAutosave);
1500 $this->boolShowSettings = ($boolShowSettings === true);
1501 $this->SetShowSettings($this->boolShowSettings);
1503 $this->strListUrlParams = '';
1504 $this->arListUrlParams = array();
1506 if (is_array($list_url) && isset($list_url['LINK
']))
1508 $this->strListUrl = $list_url['LINK
'];
1509 $this->__ParseListUrl(true);
1510 if (true == isset($list_url['PARAMS
']))
1511 $this->__SetListUrlParams($list_url['PARAMS
']);
1515 $this->strListUrl = $list_url;
1516 $this->__ParseListUrl(true);
1518 if ('' == $this->strListUrl)
1520 $this->strListUrl = $APPLICATION->GetCurPageParam();
1521 $this->__ParseListUrl(true);
1524 if (is_array($list_url) && !empty($list_url['POST_PARAMS
']))
1525 $this->__SetListPostParams($list_url['POST_PARAMS
'],true);
1528 function ShowSettings()
1532 global $APPLICATION, $USER;
1534 $APPLICATION->RestartBuffer();
1536 require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php");
1539 $adminFormParams = array(
1540 'tabPrefix
' => 'csubedit
'
1542 require($_SERVER['DOCUMENT_ROOT
']."/bitrix/modules/main/interface/settings_admin_form.php");
1543 require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
1547 public function GetListUrl($boolFull = false)
1549 return $this->strListUrl.(true == $boolFull && '' != $this->strListUrlParams ? '?
'.$this->strListUrlParams : '');
1552 public function GetListPostParams($boolType = false, $boolJS = false)
1554 $boolType = (true == $boolType ? true : false);
1557 $boolJS = (true == $boolJS ? true : false);
1558 return ($boolJS ? CUtil::PhpToJsObject($this->arListPostParams) : $this->arListPostParams);
1562 return $this->strListPostParams;
1566 private function __UpdateListUrlParams()
1568 $this->strListUrlParams = '';
1569 if (false == empty($this->arListUrlParams))
1571 foreach ($this->arListUrlParams as $key => $value)
1572 $this->strListUrlParams .= $key.'=
'.$value.'&
';
1573 $this->strListUrlParams = mb_substr($this->strListUrlParams, 0, -1);
1577 private function __ClearListUrlParams()
1579 $this->arListUrlParams = array();
1580 $this->strListUrlParams = '';
1583 private function __AddListUrlParams($strKey,$strValue)
1587 $this->arListUrlParams[$strKey] = $strValue;
1588 $this->__UpdateListUrlParams();
1592 private function __DeleteListUrlParams($mxKey)
1594 if (true == is_array($mxKey))
1596 foreach ($mxKey as $value)
1597 if (('' != $value) && (true == array_key_exists($value,$this->arListUrlParams)))
1598 unset($this->arListUrlParams[$value]);
1600 elseif (('' != $mxKey) && (true == array_key_exists($mxKey,$this->arListUrlParams)))
1602 unset($this->arListUrlParams[$mxKey]);
1604 $this->__UpdateListUrlParams();
1607 private function __SetListUrlParams($mxParams,$boolClear = false)
1609 if (true == $boolClear)
1610 $this->arListUrlParams = array();
1612 if (!is_array($mxParams))
1614 $arParams = array();
1615 parse_str($mxParams,$arParams);
1616 $mxParams = (true == is_array($arParams) ? $arParams : array());
1618 foreach ($mxParams as $key => $value)
1620 $this->arListUrlParams[$key] = $value;
1622 $this->__UpdateListUrlParams();
1625 private function __ParseListUrl($boolClear = false)
1627 $mxPos = mb_strpos($this->strListUrl, '?
');
1628 if (false !== $mxPos)
1630 $this->__SetListUrlParams(mb_substr($this->strListUrl, $mxPos + 1), $boolClear);
1631 $this->strListUrl = mb_substr($this->strListUrl, 0, $mxPos);
1635 private function __UpdateListPostParams()
1637 $this->strListPostParams = '';
1638 if (false == empty($this->arListPostParams))
1640 foreach ($this->arListPostParams as $key => $value)
1641 $this->strListPostParams .= $key.'=
'.$value.'&
';
1642 $this->strListPostParams = mb_substr($this->strListPostParams, 0, -1);
1646 private function __ClearListPostParams()
1648 $this->arListPostParams = array();
1649 $this->strListPostParams = '';
1652 private function __AddListPostParams($strKey,$strValue)
1656 $this->arListPostParams[$strKey] = $strValue;
1657 $this->__UpdateListPostParams();
1661 private function __DeleteListPostParams($mxKey)
1663 if (true == is_array($mxKey))
1665 foreach ($mxKey as $value)
1666 if (('' != $value) && (true == array_key_exists($value,$this->arListPostParams)))
1667 unset($this->arListPostParams[$value]);
1669 elseif (('' != $mxKey) && (true == array_key_exists($mxKey,$this->arListPostParams)))
1671 unset($this->arListPostParams[$mxKey]);
1673 $this->__UpdateListPostParams();
1676 private function __SetListPostParams($mxParams,$boolClear)
1678 if (true == $boolClear)
1679 $this->arListPostParams = array();
1680 if (!is_array($mxParams))
1682 $arParams = array();
1683 parse_str($mxParams,$arParams);
1684 $mxParams = $arParams;
1686 foreach ($mxParams as $key => $value)
1688 $this->arListPostParams[$key] = $value;
1690 $this->__UpdateListPostParams();
1693 function ShowTabButtons()
1696 if ($this->bShowSettings)
1698 $aAdditionalMenu = array();
1700 $this->__AddListUrlParams('mode
', 'settings
');
1701 $strLink = $this->GetListUrl(true);
1702 $this->__DeleteListUrlParams('mode
');
1704 $aAdditionalMenu[] = array(
1705 "TEXT"=>GetMessage("admin_lib_menu_settings"),
1706 "TITLE"=>GetMessage("admin_lib_context_sett_title"),
1707 "ONCLICK"=>$this->name.".ShowSettings('".htmlspecialcharsex(CUtil::JSEscape($strLink))."')",
1708 "ICON"=>"btn_settings",
1711 $nameExists = isset($this->session["ADMIN_CUSTOM_FIELDS"])
1712 && is_array($this->session["ADMIN_CUSTOM_FIELDS"])
1713 && array_key_exists($this->name, $this->session["ADMIN_CUSTOM_FIELDS"])
1715 if($this->bCustomFields)
1719 $aAdditionalMenu[] = array(
1720 "TEXT" => GetMessage("admin_lib_sett_sett_enable_text"),
1721 "TITLE" => GetMessage("admin_lib_sett_sett_enable"),
1722 "ONCLICK" => $this->name.'.EnableSettings();
',
1723 "ICON" => 'custom-fields-on
'
1728 $aAdditionalMenu[] = array(
1729 "TEXT" => GetMessage("admin_lib_sett_sett_disable_text"),
1730 "TITLE" => GetMessage("admin_lib_sett_sett_disable"),
1731 "ONCLICK" => $this->name.'.DisableSettings();
',
1732 "ICON" => 'custom-fields-off
'
1736 $s .= '<span
class=
"adm-detail-subsettings-cont">
';
1737 if (count($aAdditionalMenu) > 1)
1739 $sMenuUrl = "BX.adminShowMenu(this, ".htmlspecialcharsbx(CAdminPopupEx::PhpToJavaScript($aAdditionalMenu)).", {active_class: 'bx-settings-btn-active
'});";
1740 $s .= '<span
id=
"'.$this->name.'_settings_btn" class=
"adm-detail-subsettings adm-detail-subsettings-arrow'.($nameExists ? '' : ' adm-detail-subsettings-active').'" onclick=
"'.$sMenuUrl.'"></span>
';
1744 $s .= '<a
class=
"adm-detail-subsettings" href=
"javascript:void(0)" onclick=
"'.$aAdditionalMenu[0]['ONCLICK'].';"></a>
';
1749 return $s.CAdminTabControl::ShowTabButtons();
1754 $hkInst = CHotKeys::GetInstance();
1756 if(!$this->bButtons)
1758 while ($this->tabIndex < count($this->tabs))
1759 $this->BeginNextTab();
1763 echo '<div
class=
"adm-detail-content-btns-wrap"><div
class=
"adm-detail-content-btns adm-detail-content-btns-empty"></div></div>
';
1765 elseif (!$this->bPublicMode)
1767 echo '</div></div>
';
1770 if (!$this->bPublicMode)
1777 $Execs = $hkInst->GetCodeByClassName("CAdminSubForm");
1778 echo $hkInst->PrintJSExecs($Execs, $this->name);
1782<input type=
"hidden" id=
"'.$this->name.'_active_tab" name=
"'.$this->name.'_active_tab" value=
"'.htmlspecialcharsbx($this->selectedTab).'">
1786 foreach($this->tabs as $tab)
1788 $s .= ($s <> ""? ", ":"").
1790 "'DIV
': '".$tab["DIV
"]."' ".
1791 ($tab["ONSELECT"] <> ""? ", 'ONSELECT
': '".CUtil::JSEscape($tab["ONSELECT
"])."'":"").
1795 echo 'var
'.$this->name.' =
new BX.adminSubTabControl(
"'.$this->name.'",
"'.$this->unique_name.'", [
'.$s.'],
"'.CUtil::JSEscape($this->GetListUrl(true)).'",
'.$this->GetListPostParams(true,true).');
';
1797 if (!$this->bPublicMode)
1799 $aEditOpt = CUserOptions::GetOption("edit", $this->unique_name, array());
1800 $aTabOpt = CUserOptions::GetOption("edit", 'admin_tabs
', array());
1802 if($this->bCanExpand && count($this->tabs) > 1)
1804 if($aEditOpt["expand"] == "on")
1807'.$this->name.'.ToggleTabs();
';
1811 if ($aTabOpt["fix_top"] == "off" && $aEditOpt["expand"] != "on")
1814'.$this->name.'.ToggleFix(\
'top\');';
1817 if ($aTabOpt[
"fix_bottom"] ==
"off")
1820'.$this->name.
'.ToggleFix(\'bottom\');';
1825 echo
'window.'.$this->name.
'.setPublicMode(true); ';
1830 if ($this->bPublicModeBuffer)
1833 echo
'<script>BX.ready(function() {'.$this->publicObject.
'.SwapContent(\''.$this->publicModeBuffer_id.
'\');});</script>
';
1837 public static function closeSubForm($reload = true, $closeWait = true): void
1839 $reload = ($reload !== false);
1840 $closeWait = ($closeWait !== false);
1841 $result = '<script>
';
1843 var currentWindow =
top.window;
1844 if (
top.BX.SidePanel &&
top.BX.SidePanel.Instance &&
top.BX.SidePanel.Instance.getTopSlider())
1846 currentWindow =
top.BX.SidePanel.Instance.getTopSlider().getWindow();
1850 $result .= 'currentWindow.BX.closeWait();
';
1851 $result .= 'currentWindow.BX.WindowManager.Get().AllowClose(); currentWindow.BX.WindowManager.Get().Close();
';
1853 $result .= ' if (!!currentWindow.ReloadSubList) { currentWindow.ReloadSubList(); }
';
1854 $result .= '</script>
';
1856 CMain::FinalActions($result);
1860class CAdminSubResult extends CAdminResult
1863 var $list_url_params;
1865 public function __construct($res, $table_id, $list_url)
1867 $this->list_url = $list_url;
1868 $this->list_url_params = '';
1869 $intPos = mb_strpos($this->list_url, '?
');
1870 if (false !== $intPos)
1872 $this->list_url_params = mb_substr($this->list_url, $intPos + 1);
1873 $this->list_url = mb_substr($this->list_url, 0, $intPos);
1875 parent::__construct($res, $table_id);
1878 public function NavStart($nPageSize=20, $bShowAll=true, $iNumPage=false)
1880 $navResult = new CAdminSubResult(null, '', '');
1881 $nSize = $navResult->GetNavSize($this->table_id, $nPageSize, $this->list_url.('' != $this->list_url_params ? '?
'.$this->list_url_params : ''));
1884 if(!is_array($nPageSize))
1885 $nPageSize = array();
1887 $nPageSize["nPageSize"] = $nSize;
1888 if (isset($_REQUEST["mode"]) && $_REQUEST["mode"] === "excel")
1890 $nPageSize["NavShowAll"] = true;
1893 $this->nInitialSize = $nPageSize["nPageSize"];
1895 parent::NavStart($nPageSize, $bShowAll, $iNumPage);
1904 public static function GetNavSize($table_id=false, $nPageSize=20, $list_url = '
')
1906 $list_url = (string)$list_url;
1907 if ($list_url != '')
1909 if (!is_array($nPageSize))
1910 $nPageSize = array('nPageSize
' => $nPageSize);
1911 $nPageSize['sNavID
'] = $list_url;
1913 return parent::GetNavSize($table_id, $nPageSize);
1916 public function GetNavPrint($title, $show_allways=true, $StyleText="", $template_path=false, $arDeleteParam=false)
1918 if($template_path === false)
1919 $template_path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/iblock/admin/templates/navigation.php";
1922 $add_anchor = $this->add_anchor;
1925 $sBegin = GetMessage("nav_begin");
1927 $sEnd = GetMessage("nav_end");
1929 $sNext = GetMessage("nav_next");
1931 $sPrev = GetMessage("nav_prev");
1933 $sAll = GetMessage("nav_all");
1935 $sPaged = GetMessage("nav_paged");
1937 $nPageWindow = $this->nPageWindow;
1941 if ($this->NavRecordCount == 0 || ($this->NavPageCount == 1 && $this->NavShowAll == false))
1945 $sUrlPath = $this->list_url;
1946 $strNavQueryString = $this->list_url_params;
1947 if (strncmp($strNavQueryString, '&
', 1) !== 0)
1949 $strNavQueryString = '&
' . $strNavQueryString;
1951 $strNavQueryString = htmlspecialcharsbx($strNavQueryString);
1953 if($template_path!==false && !file_exists($template_path) && file_exists($_SERVER["DOCUMENT_ROOT"].$template_path))
1954 $template_path = $_SERVER["DOCUMENT_ROOT"].$template_path;
1956 if($this->bDescPageNumbering === true)
1958 if($this->NavPageNomer + floor($nPageWindow/2) >= $this->NavPageCount)
1959 $nStartPage = $this->NavPageCount;
1962 if($this->NavPageNomer + floor($nPageWindow/2) >= $nPageWindow)
1963 $nStartPage = $this->NavPageNomer + floor($nPageWindow/2);
1966 if($this->NavPageCount >= $nPageWindow)
1967 $nStartPage = $nPageWindow;
1969 $nStartPage = $this->NavPageCount;
1973 if($nStartPage - $nPageWindow >= 0)
1974 $nEndPage = $nStartPage - $nPageWindow + 1;
1980 if($this->NavPageNomer > floor($nPageWindow/2) + 1 && $this->NavPageCount > $nPageWindow)
1981 $nStartPage = $this->NavPageNomer - floor($nPageWindow/2);
1985 if($this->NavPageNomer <= $this->NavPageCount - floor($nPageWindow/2) && $nStartPage + $nPageWindow-1 <= $this->NavPageCount)
1986 $nEndPage = $nStartPage + $nPageWindow - 1;
1989 $nEndPage = $this->NavPageCount;
1990 if($nEndPage - $nPageWindow + 1 >= 1)
1991 $nStartPage = $nEndPage - $nPageWindow + 1;
1995 $this->nStartPage = $nStartPage;
1996 $this->nEndPage = $nEndPage;
1998 if($template_path!==false && file_exists($template_path))
2002 include($template_path);
2003 $res = ob_get_contents();
2005 $this->bFirstPrintNav = false;
2015class CAdminSubMessage extends CAdminMessage
2017 public function __construct($message, $exception = false)
2019 parent::__construct($message,$exception);
2022 public function Show()
2026 return '<script>
top.BX.WindowManager.Get().ShowError(\
''.CUtil::JSEscape(str_replace(
array(
'<br>',
'<br />',
'<BR>',
'<BR />'),
"\r\n",
htmlspecialcharsback($this->message[
'DETAILS']? $this->message[
'DETAILS'] : $this->message[
'MESSAGE']))).
'\');</script>
';
2030 if($this->message["MESSAGE"])
2031 $title = '<div
class=
"adm-info-message-title">
'.$this->_formatHTML($this->message["MESSAGE"]).'</div>
';
2035 if($this->message["DETAILS"])
2036 $details = $this->_formatHTML($this->message["DETAILS"]);
2040 if($this->message["TYPE"] == "OK")
2043<div
class=
"adm-info-message-wrap adm-info-message-green">
2044 <div
class=
"adm-info-message">
2047 <div
class=
"adm-info-message-icon"></div>
2052 elseif($this->message["TYPE"] == "PROGRESS")
2054 if ($this->message['PROGRESS_ICON
'])
2055 $title = '<div
class=
"adm-info-message-icon-progress"></div>
'.$title;
2057 $details = str_replace("#PROGRESS_BAR#", $this->_getProgressHtml(), $details);
2059<div
class=
"adm-info-message-wrap adm-info-message-gray">
2060 <div
class=
"adm-info-message">
2063 <div
class=
"adm-info-message-buttons">
'.$this->_getButtonsHtml().'</div>
2071<div
class=
"adm-info-message-wrap adm-info-message-red">
2072 <div
class=
"adm-info-message">
2075 <div
class=
"adm-info-message-icon"></div>
2085 public static function ShowOldStyleError($message)
2087 if(!empty($message))
2089 $m = new CAdminSubMessage(array("MESSAGE"=>GetMessage("admin_lib_error"), "DETAILS"=>$message, "TYPE"=>"ERROR"));
2094 public static function ShowMessage($message)
2096 if(!empty($message))
2098 $m = new CAdminSubMessage($message);
2103 public static function ShowNote($message)
2105 if(!empty($message))
2107 $m = new CAdminSubMessage(array("MESSAGE"=>$message, "TYPE"=>"OK"));
change_password_forgot_link login popup forget pas AUTH_GOTO_FORGOT_FORM login btn wrap change_password_button login popup link login popup return auth javascript
DisplayList($arParams=array())
GetListUrl($boolFull=false)
__construct($table_id, $by_initial=false, $order_initial=false, $by_name="by", $ord_name="order", $list_url='')
Show($text, $sort_by, $alt_title=false, $baseCssClass="")
hidden PROPERTY[<?=$propertyIndex?>][CODE]<?=htmlspecialcharsEx( $propertyCode)?> height
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
bx_acc_lim_group_list limitGroupList[] multiple<?=$group[ 'ID']?> ID selected margin top
Form FILTER_ACTION disabled
$_SERVER["DOCUMENT_ROOT"]
htmlspecialcharsback($str)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
<? endif;?> window document title
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"