<?php
/**
* @version	$Id: related_searches_config.php 13289 2010-03-23 20:59:40Z alex $
* @package	In-Portal
* @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license      GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/

defined('FULL_PATH') or die('restricted access!');

	$config =	Array(
					'Prefix'			=>	'search',

					'Clones'			=>	Array(
												'c-search'	=>	Array('ParentPrefix'	=>	'c'),
											),

					'ItemClass'			=>	Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
					'ListClass'			=>	Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
					'EventHandlerClass'	=>	Array('class'=>'RelatedSearchEventHandler','file'=>'related_searches_event_handler.php','build_event'=>'OnBuild'),
					'TagProcessorClass' =>	Array('class'=>'RelatedSearchTagProcessor','file'=>'related_searches_tag_processor.php','build_event'=>'OnBuild'),
					'AutoLoad'			=>	true,

					'QueryString'		=>	Array(
												1	=>	'id',
												2	=>	'page',
												3	=>	'event',
											),
					'IDField'			=>	'RelatedSearchId',
					'StatusField'		=>	Array('Enabled'),
					'TableName'			=>	TABLE_PREFIX.'RelatedSearches',
					'ParentTableKey'	=>	'ResourceId',
					'ForeignKey'		=>	'ResourceId',
					'ParentPrefix'		=> 	'c',
					'AutoDelete'		=>	true,
					'AutoClone'			=> 	true,

					'FilterMenu'		=>	Array(
												'Groups' => Array(
													Array('mode' => 'AND', 'filters' => Array('show_active','show_disabled'), 'type' => WHERE_FILTER),
												),
												'Filters' => Array(
													'show_active'	=>	Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Enabled != 1' ),
													'show_disabled'	=>	Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Enabled != 0'  ),
												)
											),

					'CalculatedFields'	=>	Array(
												''	=>	Array(

														),
											),

					'ListSQLs'			=>	Array(	''=>	'SELECT %1$s.* %2$s FROM %1$s',
											), // key - special, value - list select sql

					'ListSortings'	=> 	Array(
																'' => Array(
																	'ForcedSorting' => Array('Priority' => 'desc'),
																	'Sorting' => Array('Keyword' => 'asc'),
																)
															),
					'ItemSQLs'			=>	Array(	'' => 'SELECT %1$s.* %2$s FROM %1$s',),

					'Fields'			=>	Array(
											    'RelatedSearchId'	=>	Array('type' => 'int', 'not_null' => 1, 'default' => 0),
												'ResourceId'		=>	Array('type'=>'int', 'not_null' => 1, 'required' => 1, 'default' => 0),
												'Keyword'			=>	Array('type'=>'string', 'required' => 1, 'not_null' => 1, 'default' => ''),
												'ItemType'			=>	Array('type'=>'int', 'not_null' => 1, 'required' => 1, 'default' => 0),
												'Enabled'			=>	Array(
													'type' => 'int',
													'formatter' => 'kOptionsFormatter',
													'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1,
													'not_null' => 1, 'default' => 1,
												),
												'Priority'			=>	Array('type'=>'int','not_null'=>1,'default'=>0),
											),
					'VirtualFields'	=> 	Array(

										),

					'Grids'	=> Array(
								'Default'		=>	Array(
									'Icons' => Array(
										'default' => 'icon16_item.png',
										0 => 'icon16_disabled.png',
										1 => 'icon16_item.png'
									),
									'Fields' => Array(
										'RelatedSearchId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter'),
										'Keyword' => Array( 'title'=>'la_col_Keyword', 'data_block' => 'grid_keyword_td', 'filter_block' => 'grid_like_filter'),
										'Enabled' => Array( 'title'=>'la_col_Status', 'filter_block' => 'grid_options_filter'),
									),
								),
					),
	);