<?php 
/**
 * Система управления сайтом HostCMS v. 5.xx
 * Copyright © 2005-2010 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 *
 * Форма добаления/редактирования дополнительного свойства товара.
 * 
 * Файл: /admin/shop/action/form_edit_add_list_of_properties.php
 * 
 * @author Hostmake LLC
 * @version 5.x
 */
if (isset($id))
{
	$edit_list_of_properties = $id;
}
else
{
	$edit_list_of_properties = 0;
}

$form_params = array();
$form_params['title'] = $edit_list_of_properties == 0 ? $GLOBALS['MSG_shops']['list_of_properties_add_form_title'] : $GLOBALS['MSG_shops']['list_of_properties_edit_form_title'];
$form_params['form_attribs']['method'] = 'post';
$form_params['form_attribs']['action'] = '/admin/shop/shop.php';
$form_params['form_attribs']['name'] = 'EditAddProperty';

$admin_forms_fields = new admin_forms_fields();

$shop_shops_id = to_int($_REQUEST['shop_shops_id']);

$shop_groups_parent_id = to_int($_REQUEST['shop_groups_parent_id']);

$ext_shop_groups_parent_id = to_int($_REQUEST['ext_shop_groups_parent_id']);

$shop = & singleton('shop');

$data = new DateClass();

$DataBase = & singleton('DataBase');

$kernel = & singleton('kernel');

$row = $shop->GetShop($shop_shops_id);

$path_array = $shop->GetShopPathArray($shop_groups_parent_id, false);

// Преобразуем идентификаторы групп в ссылки на группы.
$new_path_array = array();
$new_path_array[0]['name'] = $GLOBALS['MSG_shops']['header_admin__list_forms'];
$new_path_array[0]['link'] = $admin_forms_fields->GetHtmlCallDoLoadAjax('/admin/shop/shop.php', '', 54, 'load_data');
$new_path_array[0]['onclick'] = $admin_forms_fields->GetOnClickCallDoLoadAjax('/admin/shop/shop.php', '', 54, 'load_data');

$new_path_array[1]['name'] = $row['shop_shops_name'];
$new_path_array[1]['link'] = $admin_forms_fields->GetHtmlCallDoLoadAjax('/admin/shop/shop.php', "&shop_groups_parent_id=0&shop_shops_id=$shop_shops_id", 65, 'load_data');
$new_path_array[1]['onclick'] = $admin_forms_fields->GetOnClickCallDoLoadAjax('/admin/shop/shop.php', "&shop_groups_parent_id=0&shop_shops_id=$shop_shops_id", 65, 'load_data');


if ($path_array)
{
	foreach ($path_array as $key => $value)
	{
		$new_path_array[] = array (
		'link' => $admin_forms_fields->GetHtmlCallDoLoadAjax('/admin/shop/shop.php', "&shop_groups_parent_id=$key&shop_shops_id=$shop_shops_id", 65, 'load_data'),
		'onclick' => $admin_forms_fields->GetOnClickCallDoLoadAjax('/admin/shop/shop.php', "&shop_groups_parent_id=$key&shop_shops_id=$shop_shops_id", 65, 'load_data'),
		'name' => $value);
	}
}

$new_path_array[] = array("name" => $GLOBALS['MSG_shops']['list_of_properties_add_form_link'],
"link" => $admin_forms_fields->GetHtmlCallDoLoadAjax('/admin/shop/shop.php', "&shop_shops_id=$shop_shops_id&shop_groups_parent_id=$shop_groups_parent_id&ext_shop_groups_parent_id=$ext_shop_groups_parent_id", 67, 'load_data'),
"onclick" => $admin_forms_fields->GetOnClickCallDoLoadAjax('/admin/shop/shop.php', "&shop_shops_id=$shop_shops_id&shop_groups_parent_id=$shop_groups_parent_id&ext_shop_groups_parent_id=$ext_shop_groups_parent_id", 67, 'load_data')
);

// Генерируем дополнительные хлебные крошки
$path_array = $shop->GetAdditionalPropertyPathArray($ext_shop_groups_parent_id);

if (count($path_array) > 0)
{
	foreach ($path_array as $key => $value)
	{
		$new_path_array[] = array (
		'link' => $admin_forms_fields->GetHtmlCallDoLoadAjax('/admin/shop/shop.php', "&shop_groups_parent_id=$shop_groups_parent_id&shop_shops_id=$shop_shops_id&ext_shop_groups_parent_id=$ext_shop_groups_parent_id", 67, 'load_data'),
		'onclick' => $admin_forms_fields->GetOnClickCallDoLoadAjax('/admin/shop/shop.php', "&shop_groups_parent_id=$shop_groups_parent_id&shop_shops_id=$shop_shops_id&ext_shop_groups_parent_id=$ext_shop_groups_parent_id", 67, 'load_data'),
		'name' => $value);
	}
}

$form_params['path_array'] = $new_path_array;

$admin_forms_fields->admin_forms_fields($form_params);

// Получаем данные о магазине
$show_row = $shop->GetShop($shop_shops_id);

// Редактировние налога
if ($edit_list_of_properties)
{
	$type = 1;

	$result = $shop->GetPropretyOfItems($edit_list_of_properties);

	$shop_shops_id = to_int($result['shop_shops_id']);
	$shop_mesures_id = to_int($result['shop_mesures_id']);
	$lists_id = to_int($result['lists_id']);
	$shop_list_of_properties_name = to_str($result['shop_list_of_properties_name']);
	$list_of_properties_lists_id = to_int($result['list_of_properties_lists_id']);
	$shop_list_of_properties_xml_name = to_str($result['shop_list_of_properties_xml_name']);
	$shop_list_of_properties_type = to_int($result['shop_list_of_properties_type']);
	$shop_list_of_properties_prefics = to_str($result['shop_list_of_properties_prefics']);
	$list_of_properties_mesures = to_int($result['list_of_properties_mesures']);
	$shop_list_of_properties_default_value = to_str($result['shop_list_of_properties_default_value']);
	$shop_properties_items_dir_id = to_int($result['shop_properties_items_dir_id']);

	// не равен типу дата или датавремя
	if ($shop_list_of_properties_type != 5 || $shop_list_of_properties_type != 6)
	{
		$list_of_properties_default_value = to_str($result['shop_list_of_properties_default_value']);
	}
	// тип - дата
	elseif($shop_list_of_properties_type == 5)
	{
		$list_of_properties_default_value = $data->date_format($result['shop_list_of_properties_default_value']);
	}
	// тип - датавремя
	elseif ($shop_list_of_properties_type == 6)
	{
		$list_of_properties_default_value = $data->datetime_format($result['shop_list_of_properties_default_value']);
	}

	$shop_list_of_properties_order = to_int($result['shop_list_of_properties_order']);
	$shop_list_of_properties_show_kind = to_int($result['shop_list_of_properties_show_kind']);
	$users_id = to_int($result['users_id']);
	$shop_list_of_properties_cml_id = to_str($result['shop_list_of_properties_cml_id']);
	$shop_list_of_properties_default_big_width = $result['shop_list_of_properties_default_big_width'];
	$shop_list_of_properties_default_big_height = $result['shop_list_of_properties_default_big_height'];
	$shop_list_of_properties_default_small_width = $result['shop_list_of_properties_default_small_width'];
	$shop_list_of_properties_default_small_height = $result['shop_list_of_properties_default_small_height'];
	
	$shop_list_of_properties_description = $result['shop_list_of_properties_description'];
}
// Добавление
else
{
	$shop_mesures_id = 0;
	$lists_id = 0;
	$list_of_properties_lists_id = 0;
	$list_of_properties_mesures = 0;
	$list_of_properties_default_value = '';
	$shop_list_of_properties_name = '';
	$shop_list_of_properties_xml_name = '';
	$shop_list_of_properties_type = 0;
	$shop_list_of_properties_prefics = '';
	$shop_list_of_properties_default_value = '';
	$shop_list_of_properties_order = 0;
	$shop_list_of_properties_show_kind = 0;
	$users_id = false;
	$shop_list_of_properties_cml_id = $kernel->Guid();
	$shop_properties_items_dir_id = $ext_shop_groups_parent_id;
	
	$shop_list_of_properties_description = '';

	if($show_row)
	{
		$shop_list_of_properties_default_big_width = $show_row['shop_image_big_max_width'];
		$shop_list_of_properties_default_big_height = $show_row['shop_image_big_max_height'];
		$shop_list_of_properties_default_small_width = $show_row['shop_image_small_max_width'];
		$shop_list_of_properties_default_small_height = $show_row['shop_image_small_max_height'];
	}
	else
	{
		$shop_list_of_properties_default_big_width = 0;
		$shop_list_of_properties_default_big_height = 0;
		$shop_list_of_properties_default_small_width = 0;
		$shop_list_of_properties_default_small_height = 0;
	}
}

// Параметры.
$tab_id = $admin_forms_fields->AddTab($GLOBALS['MSG_shops']['tab']);

// Название
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'list_of_properties_name';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_name'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $shop_list_of_properties_name;
$param['attributes']['class'] = 'large';
$param['format']['minlen']['value'] = 1;
$param['format']['maxlen']['value'] = 255;
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

$admin_forms = new admin_forms();
$window_id = $admin_forms->GetWindowId();

// Описание
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'shop_list_of_properties_description';
$param['caption'] = "Описание";
$param['type'] = 7; // TextArea
$param['value'] = $shop_list_of_properties_description;
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

$admin_forms = new admin_forms();
$window_id = $admin_forms->GetWindowId();

// Тип
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'list_of_properties_type';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_type'];
$param['type'] = 2; // Выпадающий список
$param['value'] = $shop_list_of_properties_type;
$param['attributes']['onchange'] = "ShowRowsShopItemPropertysType('{$window_id}', this.value)";
// Заполним массив возможных значений дополнительного свойства
$mas = array(
	0=>$GLOBALS['MSG_shops']['list_of_properties_string'],
	1=>$GLOBALS['MSG_shops']['list_of_properties_file'],
	3=>$GLOBALS['MSG_shops']['big_text'],
	4=>$GLOBALS['MSG_shops']['visual_edit'],
	5=>$GLOBALS['MSG_shops']['date'],
	6=>$GLOBALS['MSG_shops']['date_time'],
	7=>$GLOBALS['MSG_shops']['checkbox']
);
if (class_exists('lists'))
{
	$mas[2] = $GLOBALS['MSG_shops']['list_of_properties_list'];
}
$param['items'] = $mas;
$param['attributes']['style'] = 'width: 210px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

$array = array(0 => ' ... ');
$mas = $shop->GetDelimitedGroupsExtProperty(0, $shop_shops_id, '&nbsp;&nbsp;');
$mas_count = count($mas);
for ($i = 0; $i < $mas_count; $i++)
{
	$array[$mas[$i]['shop_properties_items_dir_id']] = $mas[$i]['separator'].$mas[$i]['shop_properties_items_dir_name'];
}

$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'shop_properties_items_dir_id';
$param['caption'] = $GLOBALS['MSG_shops']['form_edit_add_shop_properties_items_dir_parent_id_elements'];
$param['type'] = 2; // Выпадающий список.
$param['value'] = $shop_properties_items_dir_id;
$param['items'] = $array;
$param['attributes']['style'] = 'width: 210px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Порядок сортировки
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'list_of_properties_order';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_order'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $shop_list_of_properties_order;
$param['format']['lib']['value'] = 'integer';
$param['format']['lib']['message'] = $GLOBALS['MSG_shops']['show_invalid_characters_integer'];
$param['format']['minlen']['value'] = 1;
$param['format']['maxlen']['value'] = 6;
$param['attributes']['style'] = 'width: 210px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Префикс
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'list_of_properties_prefics';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_prefics'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $shop_list_of_properties_prefics;
$param['format']['maxlen']['value'] = 100;
$param['attributes']['style'] = 'width: 210px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

$arr = array(
	0 => $GLOBALS['MSG_shops']['properties_show_kind_none'],
	1 => $GLOBALS['MSG_shops']['properties_show_kind_text'],
	2 => $GLOBALS['MSG_shops']['properties_show_kind_list'],
	3 => $GLOBALS['MSG_shops']['properties_show_kind_radio'],
	4 => $GLOBALS['MSG_shops']['properties_show_kind_checkbox'],
	5 => $GLOBALS['MSG_shops']['properties_show_kind_checkbox_one'],
	6 => $GLOBALS['MSG_shops']['properties_show_kind_from_to'],
	7 => $GLOBALS['MSG_shops']['properties_show_kind_listbox']);

// Способ отображения
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'shop_list_of_properties_show_kind';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_show_kind'];
$param['type'] = 2; // Выпадающий список
$param['value'] = $shop_list_of_properties_show_kind;
$param['items'] = $arr;
$param['attributes']['style'] = 'width: 210px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Ширина большого изображения по умолчанию (Тип: строка)
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'shop_list_of_properties_default_big_width';
$param['name'] = 'shop_list_of_properties_default_big_width';
$param['caption'] = $GLOBALS['MSG_shops']['external_property_big_width'];
$param['type'] = 0; // Поле ввода
$param['value'] = $shop_list_of_properties_default_big_width;
$param['attributes']['style'] = 'width: 320px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// высота большого изображения по умолчанию (Тип: строка)
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'shop_list_of_properties_default_big_height';
$param['name'] = 'shop_list_of_properties_default_big_height';
$param['caption'] = $GLOBALS['MSG_shops']['external_property_big_height'];
$param['type'] = 0; // Поле ввода
$param['value'] = $shop_list_of_properties_default_big_height;
$param['attributes']['style'] = 'width: 320px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// ширина малого изображения по умолчанию
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'shop_list_of_properties_default_small_width';
$param['name'] = 'shop_list_of_properties_default_small_width';
$param['caption'] = $GLOBALS['MSG_shops']['external_property_small_width'];
$param['type'] = 0; // Поле ввода
$param['value'] = $shop_list_of_properties_default_small_width;
$param['attributes']['style'] = 'width: 320px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// высота малого изображения по умолчанию
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'shop_list_of_properties_default_small_height';
$param['name'] = 'shop_list_of_properties_default_small_height';
$param['caption'] = $GLOBALS['MSG_shops']['external_property_small_height'];
$param['type'] = 0; // Поле ввода
$param['value'] = $shop_list_of_properties_default_small_height;
$param['attributes']['style'] = 'width: 320px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Значение
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'list_of_properties_default_id';
$param['name'] = 'list_of_properties_default_value';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_default_value'];
$param['type'] = 0; // Поле ввода
$param['value'] = $list_of_properties_default_value;
$param['attributes']['style'] = 'width: 660px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Значение (Тип: флажок)
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'checkbox';
$param['name'] = 'checkbox';
//$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_default_value'];
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_checkbox_value'];
$param['type'] = 1; // Флажок
$param['value'] = $list_of_properties_default_value;
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Значение (Тип: дата)
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'date_without_time';
$param['name'] = 'date_without_time';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_default_value'];
$param['type'] = 10; // Дата
$param['value'] = $list_of_properties_default_value;
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Значение (Тип: дата-время)
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'date_with_time';
$param['name'] = 'date_with_time';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_default_value'];
$param['type'] = 11; // Дата-время
$param['value'] = $list_of_properties_default_value;
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Единица измерения (Тип: строка, файл, список)
$arr = array(0 => '...');
$result_mesures = $shop->GetAllMesures();
while(	$row = mysql_fetch_assoc($result_mesures))
{
	$arr[$row['shop_mesures_id']] = $row['shop_mesures_name'];
}
$param = array();
$param['tab_id'] = $tab_id;
$param['div_id'] = 'list_of_properties_mesures_id';
$param['name'] = 'list_of_properties_mesures';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_mesures'];
$param['type'] = 2; // Выпадающий список
$param['value'] = $shop_mesures_id;
$param['items'] = $arr;
$param['attributes']['style'] = 'width: 320px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

if (class_exists('lists'))
{
	// Заполняем поле "Списки"
	$arr = array();
	$lists = & singleton('lists');
	$result_lists = $lists->GetAllListsForSite(CURRENT_SITE);

	if (mysql_num_rows($result_lists) > 0)
	{
		/* В цикле выводим списки в массив */
		while($row = mysql_fetch_assoc($result_lists))
		{
			$arr[$row['lists_id']] = $row['lists_name'];
		}
	}
	else /* Нет ни одного списка */ 
	{
		$arr[0] = '...';
	}

	// Списки (Тип: список)
	$param = array();
	$param['tab_id'] = $tab_id;
	$param['div_id'] = 'list_of_properties_lists_id';
	$param['name'] = 'list_of_properties_lists_id';
	$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_lists'];
	$param['type'] = 2; // Выпадающий список
	$param['value'] = $lists_id;
	$param['items'] = $arr;
	$param['attributes']['style'] = 'width: 320px;';
	$param['div_attributes']['style'] = 'float: left;';
	$admin_forms_fields->AddField($param);

	$admin_forms_fields->AddSeparator($tab_id);
}

// Наименование XML-тега
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'list_of_properties_xml_name';
$param['caption'] = $GLOBALS['MSG_shops']['list_of_properties_add_form_xml_name'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $shop_list_of_properties_xml_name;
$param['format']['minlen']['value'] = 1;
$param['format']['lib']['value'] = 'latinBase';
$param['format']['lib']['message'] = $GLOBALS['MSG_shops']['show_invalid_characters_latin_base'];
$param['attributes']['style'] = 'width: 320px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// Добавляем вкладку импорт/экспорт
$tab_id = $admin_forms_fields->AddTab($GLOBALS['MSG_shops']['tab_yandex_market']);

// CML ID
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'shop_list_of_properties_cml_id';
$param['caption'] = $GLOBALS['MSG_shops']['1c_commerce_ml_prop'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $shop_list_of_properties_cml_id;
$param['format']['maxlen']['value'] = 100;
$admin_forms_fields->AddField($param);

// Разделитель.
$admin_forms_fields->AddSeparator($tab_id);

// передеам скрытое поле с идентификатором местоположения если он есть
if ($edit_list_of_properties)
{
	$param = array();
	$param['tab_id'] = $tab_id;
	$param['name'] = 'edit_list_of_properties';
	$param['caption'] = '';
	$param['type'] = 4; // hidden.
	$param['value'] = $edit_list_of_properties;
	$admin_forms_fields->AddField($param);
}

$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'action';
$param['caption'] = '';
$param['type'] = 4; // hidden.
$param['value'] = 'show_list_of_properties';
$admin_forms_fields->AddField($param);

$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'shop_shops_id';
$param['caption'] = '';
$param['type'] = 4; // hidden.
$param['value'] = $shop_shops_id;
$admin_forms_fields->AddField($param);

$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'shop_groups_parent_id';
$param['caption'] = '';
$param['type'] = 4; // hidden.
$param['value'] = $shop_groups_parent_id;
$admin_forms_fields->AddField($param);

$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'ext_shop_groups_parent_id';
$param['caption'] = '';
$param['type'] = 4; // hidden.
$param['value'] = $ext_shop_groups_parent_id;
$admin_forms_fields->AddField($param);

// Кнопка "Сохранить".
$param = array();
$param['name'] = 'save_list_of_properties';
$param['caption'] = $GLOBALS['MSG_shops']['save'];
$param['attributes']['onclick'] = "return SendForm('{$admin_forms_fields->GetWindowId()}', '{$admin_forms_fields->AAction}', '{$admin_forms_fields->AAdditionalParams}', this, ".to_int($_REQUEST['admin_forms_id']).", 'load_data', " . to_int($admin_forms_fields->form_params['current_page']) . ", " . to_int($admin_forms_fields->form_params['on_page']) . " )";
$param['attributes']['type'] = 'button';
$admin_forms_fields->AddButton($param);

// Кнопка "Применить".
$param = array();
$param['name'] = 'add_list_of_properties';
$param['caption'] = $GLOBALS['MSG_shops']['apply'];
$param['attributes']['onclick'] = "return SendForm('{$admin_forms_fields->GetWindowId()}', '{$admin_forms_fields->AAction}', '{$admin_forms_fields->AAdditionalParams}', this, ".to_int($_REQUEST['admin_forms_id']).", 'load_data', " . to_int($admin_forms_fields->form_params['current_page']) . ", " . to_int($admin_forms_fields->form_params['on_page']) . " )";
$param['image'] = '/admin/images/add.gif';
$param['attributes']['type'] = 'submit';
$admin_forms_fields->AddButton($param);

ob_start();
?><script language="JavaScript">
ShowRowsShopItemPropertysType('<?php echo $window_id?>', <?php echo $shop_list_of_properties_type?>)
</script><?php
$external_html = ob_get_clean();

$admin_forms_fields->SetExternalHtml($external_html);

// Отображение формы.
$admin_forms_fields->ShowForm();
?>