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

$shop = new shop();

// Получаем переданные параметры
if (isset($_REQUEST['shop_properties_groups_dir_id']))
{
	$param['shop_properties_groups_dir_id'] = intval($_REQUEST['shop_properties_groups_dir_id']);
}

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

$param['shop_properties_groups_dir_parent_id'] = to_int($_REQUEST['shop_properties_groups_dir_parent_id']);

$param['shop_properties_groups_dir_name'] = to_str($_REQUEST['shop_properties_groups_dir_name']);

$param['shop_properties_groups_dir_description'] = to_str($_REQUEST['shop_properties_groups_dir_description']);

$param['shop_properties_groups_dir_order'] = to_int($_REQUEST['shop_properties_groups_dir_order']);

if ($insered_id = $shop->InsertPropertiesGroupsDir($param))
{
	$admin_forms = new admin_forms();
	$window_id = $admin_forms->GetWindowId();
	?><script type="text/javascript">
	$.appendInput('<?php echo $window_id?>', 'EditAddGroupDir', 'shop_properties_groups_dir_id', '<?php echo $insered_id?>');
	</script><?php

	if (isset($_REQUEST['shop_properties_groups_dir_id']))
	{
		show_message($GLOBALS['MSG_shops']['success_edit_group_for_dir']);
	}
	else
	{
		show_message($GLOBALS['MSG_shops']['success_add_group_for_dir']);
	}
}
else
{
	if (isset($_REQUEST['shop_properties_groups_dir_id']))
	{
		show_error_message($GLOBALS['MSG_shops']['error_edit_group_for_dir']);
	}
	else
	{
		show_error_message($GLOBALS['MSG_shops']['error_add_group_for_dir']);
	}
}
?>