<?php
/**
* @version	$Id: permissions_config.php 12734 2009-10-20 19:28:11Z 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'				=> 'perm',
					'ItemClass'			=>	Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
					'ListClass'			=>	Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
					'EventHandlerClass'	=>	Array('class'=>'PermissionsEventHandler','file'=>'permissions_event_handler.php','build_event'=>'OnBuild'),
					'TagProcessorClass' =>	Array('class'=>'PermissionsTagProcessor','file'=>'permissions_tag_processor.php','build_event'=>'OnBuild'),
					'AutoLoad'			=>	true,

					'Clones'		=>	Array(
												'c-perm'	=>	Array(
																		'Constrain'			=>	'Type = 0',	// non-system
																		'ParentPrefix'		=>	'c',
																		'ForeignKey' 		=> 	'CatId',
																		'ParentTableKey' 	=> 	'CategoryId',

																		'Hooks'	=>	Array(
																							Array(
																								'Mode' => hAFTER,
																								'Conditional' => true,
																								'HookToPrefix' => '#PARENT#',
																								'HookToSpecial' => '*',
																								'HookToEvent' => Array('OnPreSave'),
																								'DoPrefix' => '',
																								'DoSpecial' => '*',
																								'DoEvent' => 'OnCategorySavePermissions',
																							),
																					),
																),

												'g-perm'	=>	Array(
																		'Constrain'			=>	'Type = 1',	// system
																		'ParentPrefix'		=>	'g',
																		'ForeignKey' 		=> 	'GroupId',
																		'ParentTableKey' 	=> 	'GroupId',

																		'Hooks'	=>	Array(
																							Array(
																								'Mode' => hAFTER,
																								'Conditional' => true,
																								'HookToPrefix' => '#PARENT#',
																								'HookToSpecial' => '*',
																								'HookToEvent' => Array('OnPreSave'),
																								'DoPrefix' => '',
																								'DoSpecial' => '*',
																								'DoEvent' => 'OnGroupSavePermissions',
																							),
																					),
																),
										),

					'QueryString'		=>	Array(
												1	=>	'id',
												2	=>	'page',
												3	=>	'event',
											),

					'IDField'			=>	'PermissionId',

					'StatusField'		=>	Array('PermissionValue'),

					'TitleField'		=>	'Permission',

					'TableName'			=>	TABLE_PREFIX.'Permissions',

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

					'ListSQLs'			=>	Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
					'ItemSQLs'			=>	Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),

					'ListSortings'	=> 	Array(
																'' => Array(
																	'Sorting' => Array('Permission' => 'asc'),
																)
															),
					'Fields' => Array(
										'PermissionId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
										'Permission' => Array('type' => 'string','not_null' => '1','default' => ''),
										'GroupId' => Array('type' => 'int','default' => 0),
										'PermissionValue' => Array('type' => 'int','not_null' => 1,'default' => 0),
										'Type' => Array('type' => 'int','not_null' => 1,'default' => 0),
										'CatId' => Array('type' => 'int','not_null' => 1,'default' => 0),
								),
			);