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

// Title страницы
$form_params['title'] = $edit_characteristic_id == 0
? $GLOBALS['MSG_seo']['characteristic_add_form_title']
: $GLOBALS['MSG_seo']['characteristic_edit_form_title'];

//Метод отправки данных
$form_params['form_attribs']['method'] = 'post';

//Адрес всех обработчиков модуля – главный файл формы
$form_params['form_attribs']['action'] = '/admin/seo/seo.php';

//Метод отправки данных
$form_params['form_attribs']['name'] = 'EditAddCharacteristic';

$admin_forms_fields = new admin_forms_fields();

//Хлебные крошки
$new_path_array[] = array(
'link' => $admin_forms_fields->GetHtmlCallDoLoadAjax('/admin/seo/seo.php', '', 141, 'load_data'),
'onclick' => $admin_forms_fields->GetOnClickCallDoLoadAjax('/admin/seo/seo.php', '', 141, 'load_data'),
'name' => $GLOBALS['MSG_seo']['header_admin_characteristic_forms']);

// Передаем в массив для констурктора хлебные крошки
$form_params['path_array'] = $new_path_array;

$admin_forms_fields->admin_forms_fields($form_params);
$DataBase = & singleton('DataBase');
$row = false;

// Редактировние GetCharacteristic
if ($edit_characteristic_id)
{
	$DateClass = new DateClass();
	$seo = new seo();
	
	$row = $seo->GetCharacteristic($edit_characteristic_id);
	
	$site_id = $row['site_id'];
	$users_id = $row['users_id'];
	$seo_characteristic_id = $row['seo_characteristic_id'];
	$seo_characteristic_yc_rubric = $row['seo_characteristic_yc_rubric'];
	$seo_characteristic_date_time = $DateClass->datetime_format($row['seo_characteristic_date_time']);
	$seo_characteristic_yc = $row['seo_characteristic_yc'];
	$seo_characteristic_pr = $row['seo_characteristic_pr'];
	$seo_characteristic_links_google = $row['seo_characteristic_links_google'];
	$seo_characteristic_links_yandex = $row['seo_characteristic_links_yandex'];
	$seo_characteristic_links_yahoo = $row['seo_characteristic_links_yahoo'];
	$seo_characteristic_links_msn = $row['seo_characteristic_links_msn'];
	$seo_characteristic_indexed_aport = $row['seo_characteristic_indexed_aport'];
	$seo_characteristic_indexed_yandex = $row['seo_characteristic_indexed_yandex'];
	$seo_characteristic_indexed_yahoo = $row['seo_characteristic_indexed_yahoo'];
	$seo_characteristic_indexed_msn = $row['seo_characteristic_indexed_msn'];
	$seo_characteristic_indexed_rambler = $row['seo_characteristic_indexed_rambler'];
	$seo_characteristic_indexed_google = $row['seo_characteristic_indexed_google'];
	$seo_characteristic_catalog_yandex = $row['seo_characteristic_catalog_yandex'];
	$seo_characteristic_catalog_rambler = $row['seo_characteristic_catalog_rambler'];
	$seo_characteristic_catalog_mail = $row['seo_characteristic_catalog_mail'];
	$seo_characteristic_catalog_dmoz = $row['seo_characteristic_catalog_dmoz'];
	$seo_characteristic_catalog_aport = $row['seo_characteristic_catalog_aport'];
	$seo_characteristic_counter_rambler = $row['seo_characteristic_counter_rambler'];
	$seo_characteristic_counter_spylog = $row['seo_characteristic_counter_spylog'];
	$seo_characteristic_counter_hotlog = $row['seo_characteristic_counter_hotlog'];
	$seo_characteristic_counter_mail = $row['seo_characteristic_counter_mail'];
	$seo_characteristic_counter_liveinternet = $row['seo_characteristic_counter_liveinternet'];
}
// Добавление
else
{
	$site_id = CURRENT_SITE;
	$users_id = 0;
	$seo_characteristic_yc_rubric = '';
	$seo_characteristic_date_time = date("d.m.Y H:i:s");
	$seo_characteristic_yc = '';
	$seo_characteristic_pr = '';
	$seo_characteristic_links_google = 0;
	$seo_characteristic_links_yandex = 0;
	$seo_characteristic_links_yahoo = 0;
	$seo_characteristic_links_msn = 0;
	$seo_characteristic_indexed_aport = 0;
	$seo_characteristic_indexed_yandex = 0;
	$seo_characteristic_indexed_yahoo = 0;
	$seo_characteristic_indexed_msn = 0;
	$seo_characteristic_indexed_rambler = 0;
	$seo_characteristic_indexed_google = 0;
	$seo_characteristic_catalog_yandex = 0;
	$seo_characteristic_catalog_rambler = 0;
	$seo_characteristic_catalog_mail = 0;
	$seo_characteristic_catalog_dmoz = 0;
	$seo_characteristic_catalog_aport = 0;
	$seo_characteristic_counter_rambler = 0;
	$seo_characteristic_counter_spylog = 0;
	$seo_characteristic_counter_hotlog = 0;
	$seo_characteristic_counter_mail = 0;
	$seo_characteristic_counter_liveinternet = 0;
}

// Параметры.

//Вкладка Основные
$tab_id = $admin_forms_fields->AddTab($GLOBALS['MSG_seo']['seo_add_edit_characteristic_tab_basic']);

//Дата
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_date_time';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_date'];
$param['type'] = 11; // Дата.
$param['value'] = $seo_characteristic_date_time;

$admin_forms_fields->AddField($param);

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

//ТИЦ
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_yc';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_tyc'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_yc;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 110px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//PR
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_pr';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_pr'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_pr;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 2;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 110px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//Рубрика
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_yc_rubric';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_rubric'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_yc_rubric;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 255;
$param['attributes']['style'] = 'width: 220px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

if(to_int($row['seo_characteristic_id']))
{
	// Добавляем скрытое поле с идентификатором сущности, т.к. идет редактирование.
	$param = array();
	$param['tab_id'] = $tab_id;
	$param['name'] = 'seo_characteristic_id';
	$param['type'] = 4; // Скрытое поле.
	$param['value'] = to_int($row['seo_characteristic_id']);
	$admin_forms_fields->AddField($param);
}

//Вкладка Ссылки
$tab_id = $admin_forms_fields->AddTab($GLOBALS['MSG_seo']['seo_add_edit_characteristic_tab_links']);

//Ссылки yandex
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_links_yandex';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_links_yandex'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_links_yandex;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//Ссылки google
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_links_google';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_links_google'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_links_google;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

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

//Ссылки yahoo
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_links_yahoo';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_links_yahoo'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_links_yahoo;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//Ссылки Bing.com
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_links_msn';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_links_msn'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_links_msn;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$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_seo']['seo_add_edit_characteristic_tab_indexed']);

//Индексировано yandex
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_indexed_yandex';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_indexed_yandex'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_indexed_yandex;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//Индексировано google
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_indexed_google';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_indexed_google'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_indexed_google;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

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

//Индексировано rambler
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_indexed_rambler';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_indexed_rambler'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_indexed_rambler;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//Индексировано aport
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_indexed_aport';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_indexed_aport'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_indexed_aport;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

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

//Индексировано Bing.com
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_indexed_msn';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_indexed_msn'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_indexed_msn;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$param['div_attributes']['style'] = 'float: left;';
$admin_forms_fields->AddField($param);

//Индексировано yahoo
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_indexed_yahoo';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_indexed_yahoo'];
$param['type'] = 0; // Поле ввода.
$param['value'] = $seo_characteristic_indexed_yahoo;
$param['format']['minlen']['value'] = 0;
$param['format']['maxlen']['value'] = 10;
$param['format']['lib']['value'] = "integer";
$param['attributes']['style'] = 'width: 300px;';
$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_seo']['seo_add_edit_characteristic_tab_catalog']);

//Каталог yandex
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_catalog_yandex';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_catalog_yandex'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_catalog_yandex;
$admin_forms_fields->AddField($param);

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

//Каталог rambler
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_catalog_rambler';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_catalog_rambler'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_catalog_rambler;

$admin_forms_fields->AddField($param);

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

//Каталог dmoz
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_catalog_dmoz';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_catalog_dmoz'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_catalog_dmoz;

$admin_forms_fields->AddField($param);

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

//Каталог aport
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_catalog_aport';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_catalog_aport'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_catalog_aport;

$admin_forms_fields->AddField($param);

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

//Каталог mail
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_catalog_mail';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_catalog_mail'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_catalog_mail;

$admin_forms_fields->AddField($param);

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

//Вкладка Счетчики
$tab_id = $admin_forms_fields->AddTab($GLOBALS['MSG_seo']['seo_add_edit_characteristic_tab_counter']);

//Счетчик rambler
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_counter_rambler';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_counter_rambler'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_counter_rambler;

$admin_forms_fields->AddField($param);

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

//Счетчик spylog
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_counter_spylog';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_counter_spylog'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_counter_spylog;

$admin_forms_fields->AddField($param);

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

//Счетчик hotlog
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_counter_hotlog';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_counter_hotlog'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_counter_hotlog;

$admin_forms_fields->AddField($param);

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

//Счетчик liveinternet
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_counter_liveinternet';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_counter_liveinternet'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_counter_liveinternet;

$admin_forms_fields->AddField($param);

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

//Счетчик mail
$param = array();
$param['tab_id'] = $tab_id;
$param['name'] = 'seo_characteristic_counter_mail';
$param['caption'] = $GLOBALS['MSG_seo']['seo_add_edit_characteristic_caption_counter_mail'];
$param['type'] = 1; // Флажок.
$param['value'] = $seo_characteristic_counter_mail;

$admin_forms_fields->AddField($param);

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

// Кнопка "Сохранить".
$param = array();
$param['name'] = 'save_characteristic';
$param['caption'] = $GLOBALS['MSG_seo']['save_button_name'];
$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_characteristic';
$param['caption'] = $GLOBALS['MSG_seo']['apply_button_name'];
$param['image'] = '/admin/images/add.gif';
$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'] = 'submit';
$admin_forms_fields->AddButton($param);

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