| ... | ... |
@@ -35,6 +35,11 @@ $GLOBALS['TL_DCA']['tl_member']['fields']['memberno'] = [ |
| 35 | 35 |
$GLOBALS['TL_DCA']['tl_member']['config']['ctable'][] = 'tl_member_secureDownloads'; |
| 36 | 36 |
|
| 37 | 37 |
/** |
| 38 |
+ * Labels |
|
| 39 |
+ */ |
|
| 40 |
+\Contao\ArrayUtil::arrayInsert($GLOBALS['TL_DCA']['tl_member']['list']['label']['fields'],array_search('dateAdded',$GLOBALS['TL_DCA']['tl_member']['list']['label']['fields']),['memberno']);
|
|
| 41 |
+ |
|
| 42 |
+/** |
|
| 38 | 43 |
* Operations |
| 39 | 44 |
*/ |
| 40 | 45 |
$GLOBALS['TL_DCA']['tl_member']['list']['operations']['secureDownloads'] = array |
| ... | ... |
@@ -8,8 +8,27 @@ |
| 8 | 8 |
* @license commercial |
| 9 | 9 |
*/ |
| 10 | 10 |
|
| 11 |
+use Contao\CoreBundle\DataContainer\PaletteManipulator; |
|
| 11 | 12 |
use vonRotenberg\MemberfilesBundle\Model\SecureDownloadsModel; |
| 12 | 13 |
|
| 14 |
+PaletteManipulator::create() |
|
| 15 |
+ ->addField('memberno', 'personal_legend', PaletteManipulator::POSITION_APPEND)
|
|
| 16 |
+ ->applyToPalette('default', 'tl_member');
|
|
| 17 |
+ |
|
| 18 |
+/** |
|
| 19 |
+ * Fields |
|
| 20 |
+ */ |
|
| 21 |
+$GLOBALS['TL_DCA']['tl_member']['fields']['memberno'] = [ |
|
| 22 |
+ 'exclude' => true, |
|
| 23 |
+ 'inputType' => 'text', |
|
| 24 |
+ 'search' => true, |
|
| 25 |
+ 'eval' => [ |
|
| 26 |
+ 'maxlength' => 32, |
|
| 27 |
+ 'tl_class' => 'w50' |
|
| 28 |
+ ], |
|
| 29 |
+ 'sql' => ['type' => 'string', 'length' => 32, 'default' => ''] |
|
| 30 |
+]; |
|
| 31 |
+ |
|
| 13 | 32 |
/** |
| 14 | 33 |
* Config |
| 15 | 34 |
*/ |
| ... | ... |
@@ -20,8 +39,8 @@ $GLOBALS['TL_DCA']['tl_member']['config']['ctable'][] = 'tl_member_secureDownloa |
| 20 | 39 |
*/ |
| 21 | 40 |
$GLOBALS['TL_DCA']['tl_member']['list']['operations']['secureDownloads'] = array |
| 22 | 41 |
( |
| 23 |
- 'label' => &$GLOBALS['TL_LANG']['tl_member']['secureDownloads'], |
|
| 24 |
- 'href' => 'table='.SecureDownloadsModel::getTable(), |
|
| 25 |
- 'icon' => 'bundles/vonrotenbergmemberfiles/images/folder-secure.svg', |
|
| 42 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member']['secureDownloads'], |
|
| 43 |
+ 'href' => 'table=' . SecureDownloadsModel::getTable(), |
|
| 44 |
+ 'icon' => 'bundles/vonrotenbergmemberfiles/images/folder-secure.svg', |
|
| 26 | 45 |
|
| 27 | 46 |
); |
| ... | ... |
@@ -22,6 +22,6 @@ $GLOBALS['TL_DCA']['tl_member']['list']['operations']['secureDownloads'] = array |
| 22 | 22 |
( |
| 23 | 23 |
'label' => &$GLOBALS['TL_LANG']['tl_member']['secureDownloads'], |
| 24 | 24 |
'href' => 'table='.SecureDownloadsModel::getTable(), |
| 25 |
- 'icon' => 'bundles/vonrotenbergmemberfiles/images/sec_files.png', |
|
| 25 |
+ 'icon' => 'bundles/vonrotenbergmemberfiles/images/folder-secure.svg', |
|
| 26 | 26 |
|
| 27 | 27 |
); |
| ... | ... |
@@ -8,6 +8,7 @@ |
| 8 | 8 |
* @license commercial |
| 9 | 9 |
*/ |
| 10 | 10 |
|
| 11 |
+use vonRotenberg\MemberfilesBundle\Model\SecureDownloadsModel; |
|
| 11 | 12 |
|
| 12 | 13 |
/** |
| 13 | 14 |
* Config |
| ... | ... |
@@ -20,46 +21,7 @@ $GLOBALS['TL_DCA']['tl_member']['config']['ctable'][] = 'tl_member_secureDownloa |
| 20 | 21 |
$GLOBALS['TL_DCA']['tl_member']['list']['operations']['secureDownloads'] = array |
| 21 | 22 |
( |
| 22 | 23 |
'label' => &$GLOBALS['TL_LANG']['tl_member']['secureDownloads'], |
| 23 |
- 'href' => 'table='.\eSM_secureDownloads\SecureDownloadsModel::getTable(), |
|
| 24 |
- 'icon' => 'system/modules/eSM_secureDownloads/assets/images/sec_files.png', |
|
| 25 |
- 'button_callback' => array('tl_member_eSM_secureDownloads', 'showDownloads')
|
|
| 24 |
+ 'href' => 'table='.SecureDownloadsModel::getTable(), |
|
| 25 |
+ 'icon' => 'bundles/vonrotenbergmemberfiles/images/sec_files.png', |
|
| 26 | 26 |
|
| 27 | 27 |
); |
| 28 |
- |
|
| 29 |
- |
|
| 30 |
-class tl_member_eSM_secureDownloads extends \Backend |
|
| 31 |
-{
|
|
| 32 |
- /** |
|
| 33 |
- * Import the back end user object |
|
| 34 |
- */ |
|
| 35 |
- public function __construct() |
|
| 36 |
- {
|
|
| 37 |
- parent::__construct(); |
|
| 38 |
- $this->import('BackendUser', 'User');
|
|
| 39 |
- } |
|
| 40 |
- |
|
| 41 |
- |
|
| 42 |
- /** |
|
| 43 |
- * Generate a "showDownloads" button and return it as string |
|
| 44 |
- * |
|
| 45 |
- * @param array $row |
|
| 46 |
- * @param string $href |
|
| 47 |
- * @param string $label |
|
| 48 |
- * @param string $title |
|
| 49 |
- * @param string $icon |
|
| 50 |
- * |
|
| 51 |
- * @return string |
|
| 52 |
- */ |
|
| 53 |
- public function showDownloads($row, $href, $label, $title, $icon) |
|
| 54 |
- {
|
|
| 55 |
- if (!$this->User->isAdmin && !$this->User->hasAccess(1,'sec_dl_access')) |
|
| 56 |
- {
|
|
| 57 |
- return ''; |
|
| 58 |
- } |
|
| 59 |
- |
|
| 60 |
- $href .= '&id='.$row['id']; |
|
| 61 |
- |
|
| 62 |
- return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'">'.Image::getHtml($icon, $label).'</a> '; |
|
| 63 |
- } |
|
| 64 |
- |
|
| 65 |
-} |
|
| 66 | 28 |
\ No newline at end of file |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,65 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+/** |
|
| 4 |
+ * SecureDownloads for Contao |
|
| 5 |
+ * |
|
| 6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
| 7 |
+ * |
|
| 8 |
+ * @license commercial |
|
| 9 |
+ */ |
|
| 10 |
+ |
|
| 11 |
+ |
|
| 12 |
+/** |
|
| 13 |
+ * Config |
|
| 14 |
+ */ |
|
| 15 |
+$GLOBALS['TL_DCA']['tl_member']['config']['ctable'][] = 'tl_member_secureDownloads'; |
|
| 16 |
+ |
|
| 17 |
+/** |
|
| 18 |
+ * Operations |
|
| 19 |
+ */ |
|
| 20 |
+$GLOBALS['TL_DCA']['tl_member']['list']['operations']['secureDownloads'] = array |
|
| 21 |
+( |
|
| 22 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_member']['secureDownloads'], |
|
| 23 |
+ 'href' => 'table='.\eSM_secureDownloads\SecureDownloadsModel::getTable(), |
|
| 24 |
+ 'icon' => 'system/modules/eSM_secureDownloads/assets/images/sec_files.png', |
|
| 25 |
+ 'button_callback' => array('tl_member_eSM_secureDownloads', 'showDownloads')
|
|
| 26 |
+ |
|
| 27 |
+); |
|
| 28 |
+ |
|
| 29 |
+ |
|
| 30 |
+class tl_member_eSM_secureDownloads extends \Backend |
|
| 31 |
+{
|
|
| 32 |
+ /** |
|
| 33 |
+ * Import the back end user object |
|
| 34 |
+ */ |
|
| 35 |
+ public function __construct() |
|
| 36 |
+ {
|
|
| 37 |
+ parent::__construct(); |
|
| 38 |
+ $this->import('BackendUser', 'User');
|
|
| 39 |
+ } |
|
| 40 |
+ |
|
| 41 |
+ |
|
| 42 |
+ /** |
|
| 43 |
+ * Generate a "showDownloads" button and return it as string |
|
| 44 |
+ * |
|
| 45 |
+ * @param array $row |
|
| 46 |
+ * @param string $href |
|
| 47 |
+ * @param string $label |
|
| 48 |
+ * @param string $title |
|
| 49 |
+ * @param string $icon |
|
| 50 |
+ * |
|
| 51 |
+ * @return string |
|
| 52 |
+ */ |
|
| 53 |
+ public function showDownloads($row, $href, $label, $title, $icon) |
|
| 54 |
+ {
|
|
| 55 |
+ if (!$this->User->isAdmin && !$this->User->hasAccess(1,'sec_dl_access')) |
|
| 56 |
+ {
|
|
| 57 |
+ return ''; |
|
| 58 |
+ } |
|
| 59 |
+ |
|
| 60 |
+ $href .= '&id='.$row['id']; |
|
| 61 |
+ |
|
| 62 |
+ return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'">'.Image::getHtml($icon, $label).'</a> '; |
|
| 63 |
+ } |
|
| 64 |
+ |
|
| 65 |
+} |
|
| 0 | 66 |
\ No newline at end of file |