<?php
/**
* @version	$Id: favorites_config.php 16388 2016-08-11 08:16:43Z 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' => 'fav',
	'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
	'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
	'EventHandlerClass' => Array ('class' => 'FavoritesEventHandler', 'file' => 'favorites_eh.php', 'build_event' => 'OnBuild'),
	'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),

	'AutoLoad' => true,

	'Hooks' => Array (
		Array (
			'Mode' => hAFTER,
			'Conditional' => false,
			'HookToPrefix' => '#PARENT#',
			'HookToSpecial' => '-item', // from OnMassDelete event
			'HookToEvent' => Array ('OnAfterItemDelete'),
			'DoPrefix' => '',
			'DoSpecial' => '',
			'DoEvent' => 'OnDeleteFavoriteItem',
		),
	),

	'QueryString' => Array (
		1 => 'id',
		2 => 'Page',
		3 => 'PerPage',
		4 => 'event',
	),

	'IDField' => 'FavoriteId',
	'TableName' => TABLE_PREFIX.'UserFavorites',

	'ParentTableKey' => 'PortalUserId',
	'ForeignKey' => 'PortalUserId',
	'ParentPrefix' => 'u',

	'AutoDelete' => true,
	'AutoClone' => false,

	'ListSQLs' => Array ('' => 'SELECT * FROM %s'),

	'ListSortings' => Array (
		'' => Array (
			'Sorting' => Array ('Modified' => 'desc'),
		)
	),

	'Fields' => Array (
		'FavoriteId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,),
		'PortalUserId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
		'ResourceId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
		'ItemTypeId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
		'Modified' => Array ('type' => 'int', 'not_null' => 1, 'default' => '#NOW#'),
	),
);