<?php
/**
* @version	$Id: downloads_config.php 13156 2010-02-23 20:11:38Z alex $
* @package	In-Commerce
* @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license	Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/

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

	$config =	Array(
					'Prefix'			=>	'down',
					'ItemClass'			=>	Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
					'ListClass'			=>	Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
					'EventHandlerClass'	=>	Array('class'=>'kDBEventHandler','file'=>'','build_event'=>'OnBuild'),
					'TagProcessorClass' =>	Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),

					'RegisterClasses'	=>	Array(
						Array('pseudo'=>'DownloadHelper','class'=>'DownloadHelper','file'=>'download_helper.php','build_event'=>'','require_classes'=>'kHelper'),
					),

					'AutoLoad'			=>	true,
					'Hooks'				=>	Array(
												/*Array(
													'Mode' => hBEFORE,
													'Conditional' => true,
													'HookToPrefix' => 'p',
													'HookToSpecial' => '',
													'HookToEvent' => Array( 'onPreSave' ),
													'DoPrefix' => 'pr',
													'DoSpecial' => 'tang',
													'DoEvent' => 'OnArrange',
												),*/
											),
					'QueryString'		=>	Array(
												1 => 'id',
												2 => 'Page',
												3 => 'PerPage',
												4 => 'event',
												5 => 'mode',
											),
					'TitlePresets'		=>	Array(
												'downloads_list'=>Array(	'prefixes'				=> Array('down_List'),
																			'format'				=>	"!la_title_FileDownloads!",
																),
											),

					'PermSection'		=>	Array('main' => 'in-commerce:downloadlog'),

					'Sections'			=>	Array(
						'in-commerce:downloadlog'	=>	Array(
							'parent'		=>	'in-portal:reports',
							'icon'			=>	'download_log',
							'label'			=>	'la_tab_DownloadLog',
							'url'			=>	Array('t' => 'in-commerce/downloads/downloads_list', 'pass' => 'm'),
							'permissions'	=>	Array('view', 'delete'),
							'priority'		=>	7,
							'type'			=>	stTREE,
						),
					),

					'IDField'			=>	'DownloadId',
					'TitleField'		=>	'Name',
					'TableName'			=>	TABLE_PREFIX.'UserDownloads',

					'ListSQLs'			=>	Array(	''=>'SELECT * FROM %s',
																		), // key - special, value - list select sql
					'ItemSQLs'			=>	Array(	''=>'SELECT * FROM %s',
																		),
					'ListSortings'	=> 	Array(
																'' => Array(
																	'Sorting' => Array('StartedOn' => 'desc'),
																)
															),
					'Fields'			=>	Array(
										'DownloadId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
							            'PortalUserId' => Array('type' => 'int','not_null' => 1, 'default' => 0),
							            'Username' => Array('type' => 'string','not_null' => 1, 'default' => ''),
							            'ProductId' => Array('type' => 'int','not_null' => 1, 'default' => 0),
							            'ProductName' => Array('type' => 'string','not_null' => 1, 'default' => ''),
							            'FileId' => Array('type' => 'int','not_null' => 1, 'default' => 0),
							            'Filename' => Array('type' => 'string','not_null' => 1, 'default' => ''),
							            'IPAddress' => Array('type' => 'string','not_null' => 1, 'default' => ''),
							            'StartedOn' => Array('type' => 'int','formatter' => 'kDateFormatter', 'default' => NULL),
							            'EndedOn' => Array('type' => 'int','formatter' => 'kDateFormatter', 'default' => NULL),
											),
					'VirtualFields'	=> 	Array(
													),

					'Grids'	=> Array(
						'Default' =>	Array(
							'Icons' => Array (
								'default' => 'icon16_item.png',
								0 => 'icon16_disabled.png',
								1 => 'icon16_item.png',
								'module' => 'core',
							),
							'Fields' => Array(
								'DownloadId' => Array( 'title'=>'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
								'Username' => Array( 'title'=>'la_col_Username', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
								'ProductName' => Array( 'title'=>'la_col_DownloadedProductName', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
								'Filename' => Array( 'title'=>'la_col_DownloadedFileName', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
								'IPAddress' => Array( 'title'=>'la_col_IPAddress', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
								'StartedOn' => Array( 'title'=>'la_col_StartedOn', 'filter_block' => 'grid_date_range_filter', 'width' => 150, ),
							),
						),
					),

	);