<?php

/**
 * References for Contao
 *
 * Copyright (c) 2014 Benjamin Roth [http://www.esales-media.de]
 *
 * @package eSM_clients
 * @link    http://www.esales-media.de
 * @license commercial
 */

/**
 * Table tl_esm_clients_projects
 */
$GLOBALS['TL_DCA']['tl_esm_clients_projects'] = array
(

	// Config
	'config' => array
	(
		'dataContainer'               => 'Table',
		'ptable'                      => 'tl_esm_clients',
		'enableVersioning'            => true,
		'onload_callback' => array
		(
		),
		'oncopy_callback' => array
		(
		),
		'onsubmit_callback' => array
		(
		),
		'sql' => array
		(
			'keys' => array
			(
				'id' => 'primary',
			)
		)
	),

	// List
	'list' => array
	(
		'sorting' => array
		(
			'mode'                    => 4,
			'fields'                  => array('sorting'),
			'panelLayout'             => 'filter;search,limit',
			'headerFields'            => array('title'),
			'child_record_callback'   => array('tl_esm_clients_projects', 'addProjects')
		),
		'global_operations' => array
		(
			'all' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['MSC']['all'],
				'href'                => 'act=select',
				'class'               => 'header_edit_all',
				'attributes'          => 'onclick="Backend.getScrollOffset()" accesskey="e"'
			)
		),
		'operations' => array
		(
			'edit' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['edit'],
				'href'                => 'act=edit',
				'icon'                => 'edit.gif',
			),
			'copy' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['copy'],
				'href'                => 'act=copy',
				'icon'                => 'copy.gif'
			),
			'delete' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['delete'],
				'href'                => 'act=delete',
				'icon'                => 'delete.gif',
				'attributes'          => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'
			),
			'toggle' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['toggle'],
				'icon'                => 'visible.gif',
				'attributes'          => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
				'button_callback'     => array('tl_esm_clients_projects', 'toggleIcon')
			),
			'show' => array
			(
				'label'               => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['show'],
				'href'                => 'act=show',
				'icon'                => 'show.gif'
			)
		)
	),

	// Select
	'select' => array
	(
		'buttons_callback' => array
		(
			array('tl_esm_clients_projects', 'addAliasButton')
		)
	),

	// Palettes
	'palettes' => array
	(
		'default'                     => '{title_legend},title,alias;{categorize_legend},type;{details_legend},text,projectUrl,services,features,tech;{images_legend},gallerySRC,desktopSRC,phoneSRC,tabletSRC;{invisible_legend:hide},invisible,start,stop'
	),

	// Fields
	'fields' => array
	(
		'id' => array
		(
			'sql'                     => "int(10) unsigned NOT NULL auto_increment"
		),
		'pid' => array
		(
			'foreignKey'              => 'tl_esm_clients.title',
			'sql'                     => "int(10) unsigned NOT NULL default '0'",
			'relation'                => array('type'=>'belongsTo', 'load'=>'lazy')
		),
		'sorting' => array
		(
			'sql'                     => "int(10) unsigned NOT NULL default '0'"
		),
		'tstamp' => array
		(
			'sql'                     => "int(10) unsigned NOT NULL default '0'"
		),
		'alias' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['alias'],
			'exclude'                 => true,
			'search'                  => true,
			'inputType'               => 'text',
			'eval'                    => array('rgxp'=>'alias', 'unique'=>true, 'maxlength'=>128, 'tl_class'=>'w50'),
			'save_callback' => array
			(
				array('tl_esm_clients_projects', 'generateAlias')
			),
			'sql'                     => "varchar(128) COLLATE utf8_bin NOT NULL default ''"
		),
		'title' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['title'],
			'inputType'               => 'text',
			'exclude'                 => true,
			'eval'                    => array('mandatory'=>true, 'maxlength'=>128,'tl_class'=>'w50'),
			'sql'                     => "varchar(128) NOT NULL default ''"
		),
		'text' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['text'],
			'inputType'               => 'textarea',
			'exclude'                 => true,
			'eval'                    => array('mandatory'=>true, 'maxlength'=>1024, 'rte'=>'tinyMCE'),
			'sql'                     => "varchar(1024) NOT NULL default ''"
		),
		'type' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['type'],
			'inputType'               => 'select',
			'exclude'                 => true,
			'options_callback'        => array('tl_esm_clients_projects','getTypes'),
			'eval'                    => array('mandatory'=>true, 'includeBlankOption'=>true,'csv'=>','),
			'sql'                     => "text NULL"
		),
		'projectUrl' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['projectUrl'],
			'inputType'               => 'text',
			'exclude'                 => true,
			'eval'                    => array('rgxp'=>'url', 'maxlength'=>128),
			'sql'                     => "varchar(128) NOT NULL default ''"
		),
		'services' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['services'],
			'inputType'               => 'checkboxWizard',
			'exclude'                 => true,
			'options_callback'        => array('tl_esm_clients_projects','getServices'),
			'eval'                    => array('mandatory'=>true, 'multiple'=>true, 'csv'=>','),
			'sql'                     => "text NULL"
		),
		'features' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['features'],
			'inputType'               => 'listWizard',
			'exclude'                 => true,
			'eval'                    => array('mandatory'=>false),
			'sql'                     => "text NULL"
		),
		'tech' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tech'],
			'inputType'               => 'checkboxWizard',
			'exclude'                 => true,
			'options_callback'        => array('tl_esm_clients_projects','getTech'),
			'eval'                    => array('mandatory'=>true, 'multiple'=>true, 'csv'=>','),
			'sql'                     => "text NULL"
		),
		'gallerySRC' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['gallerySRC'],
			'exclude'                 => true,
			'inputType'               => 'fileTree',
			'eval'                    => array('multiple'=>true, 'fieldType'=>'checkbox', 'orderField'=>'galleryOrder', 'files'=>true, 'mandatory'=>true, 'extensions'=>\Config::get('validImageTypes'), 'isGallery'=>true),
			'sql'                     => "blob NULL"
		),
		'galleryOrder' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['galleryOrder'],
			'sql'                     => "blob NULL"
		),
		'invisible' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['invisible'],
			'exclude'                 => true,
			'filter'                  => true,
			'inputType'               => 'checkbox',
			'sql'                     => "char(1) NOT NULL default ''"
		),
		'start' => array
		(
			'exclude'                 => true,
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['start'],
			'inputType'               => 'text',
			'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
			'sql'                     => "varchar(10) NOT NULL default ''"
		),
		'stop' => array
		(
			'exclude'                 => true,
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['stop'],
			'inputType'               => 'text',
			'eval'                    => array('rgxp'=>'datim', 'datepicker'=>true, 'tl_class'=>'w50 wizard'),
			'sql'                     => "varchar(10) NOT NULL default ''"
		),
		'desktopSRC' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['desktopSRC'],
			'exclude'                 => true,
			'inputType'               => 'fileTree',
			'eval'                    => array('fieldType'=>'radio', 'filesOnly'=>true, 'extensions'=>\Config::get('validImageTypes')),
			'sql'                     => "binary(16) NULL"
		),
		'phoneSRC' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['phoneSRC'],
			'exclude'                 => true,
			'inputType'               => 'fileTree',
			'eval'                    => array('fieldType'=>'radio', 'filesOnly'=>true, 'extensions'=>\Config::get('validImageTypes')),
			'sql'                     => "binary(16) NULL"
		),
		'tabletSRC' => array
		(
			'label'                   => &$GLOBALS['TL_LANG']['tl_esm_clients_projects']['tabletSRC'],
			'exclude'                 => true,
			'inputType'               => 'fileTree',
			'eval'                    => array('fieldType'=>'radio', 'filesOnly'=>true, 'extensions'=>\Config::get('validImageTypes')),
			'sql'                     => "binary(16) NULL"
		),
	)
);