Code:
$GLOBALS['TL_DCA']['tl_sale_sector'] = array
(
// Config
'config' => array
(
'dataContainer' => 'Table',
'ctable' => array('tl_sale_sector_elements'),
'switchToEdit' => true,
'enableVersioning' => true
),
// List
'list' => array
(
'sorting' => array
(
'mode' => 1,
'fields' => array('sector_type'),
'flag' => 1,
'panelLayout' => 'filter;search,limit'
),
'label' => array
(
'fields' => array('sector_type'),
'format' => '%s',
'label_callback' => array('tl_sale_sector', 'details_saler')
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();"'
)
),
'operations' => array
(
'edit' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['edit'],
'href' => 'act=edit',
'icon' => 'edit.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'
),
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
// Palettes
'palettes' => array
(
'default' => '{type_legend},sector_type',
'Continent' => '{type_legend},sector_type;{state_legend},sector_name',
'Pays' => '{type_legend},sector_type;{state_legend},sector_name',
'Departements' => '{type_legend},sector_type;{country_legend},sector_name,sector_number'
),
// Fields
'fields' => array
(
'sector_type' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['sector_type'],
'default' => 'Continent',
'exclude' => true,
'filter' => true,
'inputType' => 'select',
'options' => array('Veuillez choisir le type secteur', 'Departements', 'Pays', 'Continent'),
'eval' => array('mandatory'=>false, 'submitOnChange'=>true)
),
'sector_name' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['sector_name'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>10, 'feEditable'=>true, 'feViewable'=>true, 'tl_class'=>'w50')
),
'sector_number' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_sale_sector']['sector_number'],
'exclude' => true,
'search' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>10, 'feEditable'=>true, 'feViewable'=>true, 'tl_class'=>'w50')
)
)
);
class tl_sale_sector extends Backend
{
/*----- label_callback -----------------------------------------------------------------*/
/**
*
* List a Saler
*
*/
public function details_saler($arrRow, $strLabel)
{
$objElements = $this->Database->prepare("SELECT * FROM tl_list_feature_elements WHERE pid=? ORDER by sorting ASC")
->execute($arrRow['id']);
if ($objElements->numRows > 0)
{
while ($objElements->next())
{
if (strncmp($objElements->id, '.', 1) === 0)
{
continue;
}
}
}
else
{
$OutputImages = $GLOBALS['TL_LANG']['tl_list_feature']['misc_noimages'];
}
return '<div class="labelbox">
<div class="heading">' . $arrRow['sector_name'] . ' ' . $arrRow['sector_number'] . '</div>
<div style="margin-left:40px;" class="limit_height block">
Ce secteur compte ' . count($arrElements) . ' contact(s) :
</div>
</div>';
}
}
Bookmarks