| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,160 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
- |
|
| 3 |
-/** |
|
| 4 |
- * TeamList for Contao |
|
| 5 |
- * |
|
| 6 |
- * Copyright (c) 2016 Benjamin Roth |
|
| 7 |
- * |
|
| 8 |
- * @license LGPL-3.0+ |
|
| 9 |
- */ |
|
| 10 |
- |
|
| 11 |
-/** |
|
| 12 |
- * Table tl_eSM_team_group |
|
| 13 |
- */ |
|
| 14 |
- |
|
| 15 |
-use Contao\DC_Table; |
|
| 16 |
-use Contao\DataContainer; |
|
| 17 |
-use Contao\System; |
|
| 18 |
-use Contao\CoreBundle\Security\ContaoCorePermissions; |
|
| 19 |
- |
|
| 20 |
-$GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
|
| 21 |
-( |
|
| 22 |
- |
|
| 23 |
- // Config |
|
| 24 |
- 'config' => array |
|
| 25 |
- ( |
|
| 26 |
- 'dataContainer' => DC_Table::class, |
|
| 27 |
- 'ctable' => array('tl_eSM_team'),
|
|
| 28 |
- 'switchToEdit' => true, |
|
| 29 |
- 'enableVersioning' => true, |
|
| 30 |
- 'sql' => array |
|
| 31 |
- ( |
|
| 32 |
- 'keys' => array |
|
| 33 |
- ( |
|
| 34 |
- 'id' => 'primary' |
|
| 35 |
- ) |
|
| 36 |
- ) |
|
| 37 |
- ), |
|
| 38 |
- |
|
| 39 |
- // List |
|
| 40 |
- 'list' => array |
|
| 41 |
- ( |
|
| 42 |
- 'sorting' => array |
|
| 43 |
- ( |
|
| 44 |
- 'mode' => DataContainer::MODE_SORTED, |
|
| 45 |
- 'fields' => array('title'),
|
|
| 46 |
- 'flag' => 1, |
|
| 47 |
- 'panelLayout' => 'filter,search;sort,limit', |
|
| 48 |
- ), |
|
| 49 |
- 'label' => array |
|
| 50 |
- ( |
|
| 51 |
- 'fields' => array('title'),
|
|
| 52 |
- 'format' => '%s' |
|
| 53 |
- ), |
|
| 54 |
- 'global_operations' => array |
|
| 55 |
- ( |
|
| 56 |
- 'all' => array |
|
| 57 |
- ( |
|
| 58 |
- 'href' => 'act=select', |
|
| 59 |
- 'class' => 'header_edit_all', |
|
| 60 |
- 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
| 61 |
- ) |
|
| 62 |
- ), |
|
| 63 |
- 'operations' => array |
|
| 64 |
- ( |
|
| 65 |
- 'edit' => array |
|
| 66 |
- ( |
|
| 67 |
- 'href' => 'table=tl_eSM_team', |
|
| 68 |
- 'icon' => 'edit.svg' |
|
| 69 |
- ), |
|
| 70 |
- 'editheader' => array |
|
| 71 |
- ( |
|
| 72 |
- 'href' => 'act=edit', |
|
| 73 |
- 'icon' => 'header.svg', |
|
| 74 |
- 'button_callback' => array('tl_eSM_team_group', 'editHeader')
|
|
| 75 |
- ), |
|
| 76 |
- 'copy' => array |
|
| 77 |
- ( |
|
| 78 |
- 'href' => 'act=copy', |
|
| 79 |
- 'icon' => 'copy.svg' |
|
| 80 |
- ), |
|
| 81 |
- 'delete' => array |
|
| 82 |
- ( |
|
| 83 |
- 'href' => 'act=delete', |
|
| 84 |
- 'icon' => 'delete.svg', |
|
| 85 |
- 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"' |
|
| 86 |
- ), |
|
| 87 |
- 'show' => array |
|
| 88 |
- ( |
|
| 89 |
- 'href' => 'act=show', |
|
| 90 |
- 'icon' => 'show.svg' |
|
| 91 |
- ) |
|
| 92 |
- ) |
|
| 93 |
- ), |
|
| 94 |
- |
|
| 95 |
- // Palettes |
|
| 96 |
- 'palettes' => array |
|
| 97 |
- ( |
|
| 98 |
- 'default' => '{title_legend},title'
|
|
| 99 |
- ), |
|
| 100 |
- |
|
| 101 |
- // Subpalettes |
|
| 102 |
- 'subpalettes' => array |
|
| 103 |
- ( |
|
| 104 |
- ), |
|
| 105 |
- |
|
| 106 |
- // Fields |
|
| 107 |
- 'fields' => array |
|
| 108 |
- ( |
|
| 109 |
- 'id' => array |
|
| 110 |
- ( |
|
| 111 |
- 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
| 112 |
- ), |
|
| 113 |
- 'tstamp' => array |
|
| 114 |
- ( |
|
| 115 |
- 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
| 116 |
- ), |
|
| 117 |
- 'title' => array |
|
| 118 |
- ( |
|
| 119 |
- 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['title'], |
|
| 120 |
- 'exclude' => true, |
|
| 121 |
- 'search' => true, |
|
| 122 |
- 'inputType' => 'text', |
|
| 123 |
- 'eval' => array('mandatory'=>true, 'maxlength'=>128, 'tl_class'=>'w50'),
|
|
| 124 |
- 'sql' => "varchar(128) NOT NULL default ''" |
|
| 125 |
- ) |
|
| 126 |
- ) |
|
| 127 |
-); |
|
| 128 |
- |
|
| 129 |
-/** |
|
| 130 |
- * Provide miscellaneous methods that are used by the data configuration array. |
|
| 131 |
- */ |
|
| 132 |
-class tl_eSM_team_group extends Backend |
|
| 133 |
-{
|
|
| 134 |
- |
|
| 135 |
- /** |
|
| 136 |
- * Import the back end user object |
|
| 137 |
- */ |
|
| 138 |
- public function __construct() |
|
| 139 |
- {
|
|
| 140 |
- parent::__construct(); |
|
| 141 |
- $this->import('BackendUser', 'User');
|
|
| 142 |
- } |
|
| 143 |
- |
|
| 144 |
- /** |
|
| 145 |
- * Return the edit header button |
|
| 146 |
- * |
|
| 147 |
- * @param array $row |
|
| 148 |
- * @param string $href |
|
| 149 |
- * @param string $label |
|
| 150 |
- * @param string $title |
|
| 151 |
- * @param string $icon |
|
| 152 |
- * @param string $attributes |
|
| 153 |
- * |
|
| 154 |
- * @return string |
|
| 155 |
- */ |
|
| 156 |
- public function editHeader($row, $href, $label, $title, $icon, $attributes) |
|
| 157 |
- {
|
|
| 158 |
- return System::getContainer()->get('security.helper')->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELDS_OF_TABLE,'tl_eSM_team') ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
|
|
| 159 |
- } |
|
| 160 |
-} |
|
| 161 | 0 |
\ No newline at end of file |
| ... | ... |
@@ -82,7 +82,7 @@ $GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
| 82 | 82 |
( |
| 83 | 83 |
'href' => 'act=delete', |
| 84 | 84 |
'icon' => 'delete.svg', |
| 85 |
- 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"' |
|
| 85 |
+ 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"' |
|
| 86 | 86 |
), |
| 87 | 87 |
'show' => array |
| 88 | 88 |
( |
| ... | ... |
@@ -12,13 +12,18 @@ |
| 12 | 12 |
* Table tl_eSM_team_group |
| 13 | 13 |
*/ |
| 14 | 14 |
|
| 15 |
+use Contao\DC_Table; |
|
| 16 |
+use Contao\DataContainer; |
|
| 17 |
+use Contao\System; |
|
| 18 |
+use Contao\CoreBundle\Security\ContaoCorePermissions; |
|
| 19 |
+ |
|
| 15 | 20 |
$GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
| 16 | 21 |
( |
| 17 | 22 |
|
| 18 | 23 |
// Config |
| 19 | 24 |
'config' => array |
| 20 | 25 |
( |
| 21 |
- 'dataContainer' => 'Table', |
|
| 26 |
+ 'dataContainer' => DC_Table::class, |
|
| 22 | 27 |
'ctable' => array('tl_eSM_team'),
|
| 23 | 28 |
'switchToEdit' => true, |
| 24 | 29 |
'enableVersioning' => true, |
| ... | ... |
@@ -36,7 +41,7 @@ $GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
| 36 | 41 |
( |
| 37 | 42 |
'sorting' => array |
| 38 | 43 |
( |
| 39 |
- 'mode' => 1, |
|
| 44 |
+ 'mode' => DataContainer::MODE_SORTED, |
|
| 40 | 45 |
'fields' => array('title'),
|
| 41 | 46 |
'flag' => 1, |
| 42 | 47 |
'panelLayout' => 'filter,search;sort,limit', |
| ... | ... |
@@ -50,7 +55,6 @@ $GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
| 50 | 55 |
( |
| 51 | 56 |
'all' => array |
| 52 | 57 |
( |
| 53 |
- 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
| 54 | 58 |
'href' => 'act=select', |
| 55 | 59 |
'class' => 'header_edit_all', |
| 56 | 60 |
'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
| ... | ... |
@@ -60,36 +64,31 @@ $GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
| 60 | 64 |
( |
| 61 | 65 |
'edit' => array |
| 62 | 66 |
( |
| 63 |
- 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['edit'], |
|
| 64 | 67 |
'href' => 'table=tl_eSM_team', |
| 65 |
- 'icon' => 'edit.gif' |
|
| 68 |
+ 'icon' => 'edit.svg' |
|
| 66 | 69 |
), |
| 67 | 70 |
'editheader' => array |
| 68 | 71 |
( |
| 69 |
- 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['editheader'], |
|
| 70 | 72 |
'href' => 'act=edit', |
| 71 |
- 'icon' => 'header.gif', |
|
| 73 |
+ 'icon' => 'header.svg', |
|
| 72 | 74 |
'button_callback' => array('tl_eSM_team_group', 'editHeader')
|
| 73 | 75 |
), |
| 74 | 76 |
'copy' => array |
| 75 | 77 |
( |
| 76 |
- 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['copy'], |
|
| 77 | 78 |
'href' => 'act=copy', |
| 78 |
- 'icon' => 'copy.gif' |
|
| 79 |
- ), |
|
| 80 |
- 'delete' => array |
|
| 81 |
- ( |
|
| 82 |
- 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['delete'], |
|
| 83 |
- 'href' => 'act=delete', |
|
| 84 |
- 'icon' => 'delete.gif', |
|
| 85 |
- 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['tl_eSM_team_group']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"' |
|
| 79 |
+ 'icon' => 'copy.svg' |
|
| 86 | 80 |
), |
| 87 |
- 'show' => array |
|
| 88 |
- ( |
|
| 89 |
- 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['show'], |
|
| 90 |
- 'href' => 'act=show', |
|
| 91 |
- 'icon' => 'show.gif' |
|
| 92 |
- ) |
|
| 81 |
+ 'delete' => array |
|
| 82 |
+ ( |
|
| 83 |
+ 'href' => 'act=delete', |
|
| 84 |
+ 'icon' => 'delete.svg', |
|
| 85 |
+ 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"' |
|
| 86 |
+ ), |
|
| 87 |
+ 'show' => array |
|
| 88 |
+ ( |
|
| 89 |
+ 'href' => 'act=show', |
|
| 90 |
+ 'icon' => 'show.svg' |
|
| 91 |
+ ) |
|
| 93 | 92 |
) |
| 94 | 93 |
), |
| 95 | 94 |
|
| ... | ... |
@@ -156,6 +155,6 @@ class tl_eSM_team_group extends Backend |
| 156 | 155 |
*/ |
| 157 | 156 |
public function editHeader($row, $href, $label, $title, $icon, $attributes) |
| 158 | 157 |
{
|
| 159 |
- return $this->User->canEditFieldsOf('tl_eSM_team') ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
|
|
| 158 |
+ return System::getContainer()->get('security.helper')->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELDS_OF_TABLE,'tl_eSM_team') ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
|
|
| 160 | 159 |
} |
| 161 | 160 |
} |
| 162 | 161 |
\ No newline at end of file |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,161 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+/** |
|
| 4 |
+ * TeamList for Contao |
|
| 5 |
+ * |
|
| 6 |
+ * Copyright (c) 2016 Benjamin Roth |
|
| 7 |
+ * |
|
| 8 |
+ * @license LGPL-3.0+ |
|
| 9 |
+ */ |
|
| 10 |
+ |
|
| 11 |
+/** |
|
| 12 |
+ * Table tl_eSM_team_group |
|
| 13 |
+ */ |
|
| 14 |
+ |
|
| 15 |
+$GLOBALS['TL_DCA']['tl_eSM_team_group'] = array |
|
| 16 |
+( |
|
| 17 |
+ |
|
| 18 |
+ // Config |
|
| 19 |
+ 'config' => array |
|
| 20 |
+ ( |
|
| 21 |
+ 'dataContainer' => 'Table', |
|
| 22 |
+ 'ctable' => array('tl_eSM_team'),
|
|
| 23 |
+ 'switchToEdit' => true, |
|
| 24 |
+ 'enableVersioning' => true, |
|
| 25 |
+ 'sql' => array |
|
| 26 |
+ ( |
|
| 27 |
+ 'keys' => array |
|
| 28 |
+ ( |
|
| 29 |
+ 'id' => 'primary' |
|
| 30 |
+ ) |
|
| 31 |
+ ) |
|
| 32 |
+ ), |
|
| 33 |
+ |
|
| 34 |
+ // List |
|
| 35 |
+ 'list' => array |
|
| 36 |
+ ( |
|
| 37 |
+ 'sorting' => array |
|
| 38 |
+ ( |
|
| 39 |
+ 'mode' => 1, |
|
| 40 |
+ 'fields' => array('title'),
|
|
| 41 |
+ 'flag' => 1, |
|
| 42 |
+ 'panelLayout' => 'filter,search;sort,limit', |
|
| 43 |
+ ), |
|
| 44 |
+ 'label' => array |
|
| 45 |
+ ( |
|
| 46 |
+ 'fields' => array('title'),
|
|
| 47 |
+ 'format' => '%s' |
|
| 48 |
+ ), |
|
| 49 |
+ 'global_operations' => array |
|
| 50 |
+ ( |
|
| 51 |
+ 'all' => array |
|
| 52 |
+ ( |
|
| 53 |
+ 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], |
|
| 54 |
+ 'href' => 'act=select', |
|
| 55 |
+ 'class' => 'header_edit_all', |
|
| 56 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
| 57 |
+ ) |
|
| 58 |
+ ), |
|
| 59 |
+ 'operations' => array |
|
| 60 |
+ ( |
|
| 61 |
+ 'edit' => array |
|
| 62 |
+ ( |
|
| 63 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['edit'], |
|
| 64 |
+ 'href' => 'table=tl_eSM_team', |
|
| 65 |
+ 'icon' => 'edit.gif' |
|
| 66 |
+ ), |
|
| 67 |
+ 'editheader' => array |
|
| 68 |
+ ( |
|
| 69 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['editheader'], |
|
| 70 |
+ 'href' => 'act=edit', |
|
| 71 |
+ 'icon' => 'header.gif', |
|
| 72 |
+ 'button_callback' => array('tl_eSM_team_group', 'editHeader')
|
|
| 73 |
+ ), |
|
| 74 |
+ 'copy' => array |
|
| 75 |
+ ( |
|
| 76 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['copy'], |
|
| 77 |
+ 'href' => 'act=copy', |
|
| 78 |
+ 'icon' => 'copy.gif' |
|
| 79 |
+ ), |
|
| 80 |
+ 'delete' => array |
|
| 81 |
+ ( |
|
| 82 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['delete'], |
|
| 83 |
+ 'href' => 'act=delete', |
|
| 84 |
+ 'icon' => 'delete.gif', |
|
| 85 |
+ 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['tl_eSM_team_group']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"' |
|
| 86 |
+ ), |
|
| 87 |
+ 'show' => array |
|
| 88 |
+ ( |
|
| 89 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['show'], |
|
| 90 |
+ 'href' => 'act=show', |
|
| 91 |
+ 'icon' => 'show.gif' |
|
| 92 |
+ ) |
|
| 93 |
+ ) |
|
| 94 |
+ ), |
|
| 95 |
+ |
|
| 96 |
+ // Palettes |
|
| 97 |
+ 'palettes' => array |
|
| 98 |
+ ( |
|
| 99 |
+ 'default' => '{title_legend},title'
|
|
| 100 |
+ ), |
|
| 101 |
+ |
|
| 102 |
+ // Subpalettes |
|
| 103 |
+ 'subpalettes' => array |
|
| 104 |
+ ( |
|
| 105 |
+ ), |
|
| 106 |
+ |
|
| 107 |
+ // Fields |
|
| 108 |
+ 'fields' => array |
|
| 109 |
+ ( |
|
| 110 |
+ 'id' => array |
|
| 111 |
+ ( |
|
| 112 |
+ 'sql' => "int(10) unsigned NOT NULL auto_increment" |
|
| 113 |
+ ), |
|
| 114 |
+ 'tstamp' => array |
|
| 115 |
+ ( |
|
| 116 |
+ 'sql' => "int(10) unsigned NOT NULL default '0'" |
|
| 117 |
+ ), |
|
| 118 |
+ 'title' => array |
|
| 119 |
+ ( |
|
| 120 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_eSM_team_group']['title'], |
|
| 121 |
+ 'exclude' => true, |
|
| 122 |
+ 'search' => true, |
|
| 123 |
+ 'inputType' => 'text', |
|
| 124 |
+ 'eval' => array('mandatory'=>true, 'maxlength'=>128, 'tl_class'=>'w50'),
|
|
| 125 |
+ 'sql' => "varchar(128) NOT NULL default ''" |
|
| 126 |
+ ) |
|
| 127 |
+ ) |
|
| 128 |
+); |
|
| 129 |
+ |
|
| 130 |
+/** |
|
| 131 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
| 132 |
+ */ |
|
| 133 |
+class tl_eSM_team_group extends Backend |
|
| 134 |
+{
|
|
| 135 |
+ |
|
| 136 |
+ /** |
|
| 137 |
+ * Import the back end user object |
|
| 138 |
+ */ |
|
| 139 |
+ public function __construct() |
|
| 140 |
+ {
|
|
| 141 |
+ parent::__construct(); |
|
| 142 |
+ $this->import('BackendUser', 'User');
|
|
| 143 |
+ } |
|
| 144 |
+ |
|
| 145 |
+ /** |
|
| 146 |
+ * Return the edit header button |
|
| 147 |
+ * |
|
| 148 |
+ * @param array $row |
|
| 149 |
+ * @param string $href |
|
| 150 |
+ * @param string $label |
|
| 151 |
+ * @param string $title |
|
| 152 |
+ * @param string $icon |
|
| 153 |
+ * @param string $attributes |
|
| 154 |
+ * |
|
| 155 |
+ * @return string |
|
| 156 |
+ */ |
|
| 157 |
+ public function editHeader($row, $href, $label, $title, $icon, $attributes) |
|
| 158 |
+ {
|
|
| 159 |
+ return $this->User->canEditFieldsOf('tl_eSM_team') ? '<a href="'.$this->addToUrl($href.'&id='.$row['id']).'" title="'.specialchars($title).'"'.$attributes.'>'.Image::getHtml($icon, $label).'</a> ' : Image::getHtml(preg_replace('/\.gif$/i', '_.gif', $icon)).' ';
|
|
| 160 |
+ } |
|
| 161 |
+} |
|
| 0 | 162 |
\ No newline at end of file |