<?php 
/**
 * Система управления сайтом HostCMS v. 5.xx
 * Copyright © 2005-2010 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 *
 * Обработчик добавления/редактирования страны.
 * 
 * Файл: /admin/shop/action/add_country.php
 * 
 * @author Hostmake LLC
 * @version 5.x
 */
$param = array();
$shop = & singleton('shop');
if (isset($_REQUEST['edit_country']))
{
	$param['id'] = to_int($_REQUEST['edit_country']);
}

$param['name'] = to_str($_REQUEST['country_name']);
$param['shop_country_order'] = to_int($_REQUEST['shop_country_order']);

if ($country = $shop->InsertCountry($param))
{
	$admin_forms = new admin_forms();
	$window_id = $admin_forms->GetWindowId();
	?><script type="text/javascript">
	$.appendInput('<?php echo $window_id?>', 'EditAddCountry', 'edit_country', '<?php echo $country?>');
	</script><?php

	if (isset($_REQUEST['edit_country'])) 
	{
		show_message($GLOBALS['MSG_shops']['success_edit_country']);
	}
	else 
	{
		show_message($GLOBALS['MSG_shops']['success_add_country']);
	}
}
else
{
	if (isset($_REQUEST['edit_country'])) 
	{
		show_error_message($GLOBALS['MSG_shops']['error_edit_country']);
	}
	else 
	{
		show_error_message($GLOBALS['MSG_shops']['error_add_country']);
	}
}
?>