... | ... |
@@ -1,8 +1,16 @@ |
1 | 1 |
<?php |
2 |
+ |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
2 | 5 |
/* |
3 | 6 |
* This file is part of Oveleon ContaoMemberExtension Bundle. |
4 | 7 |
* |
5 |
- * (c) https://www.oveleon.de/ |
|
8 |
+ * @package contao-member-extension-bundle |
|
9 |
+ * @license MIT |
|
10 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
11 |
+ * @author Fabian Ekert <https://github.com/eki89> |
|
12 |
+ * @author Sebastian Zoglowek <https://github.com/zoglo> |
|
13 |
+ * @copyright Oveleon <https://www.oveleon.de/> |
|
6 | 14 |
*/ |
7 | 15 |
|
8 | 16 |
namespace Oveleon\ContaoMemberExtensionBundle; |
... | ... |
@@ -14,6 +22,7 @@ use Contao\MemberModel; |
14 | 22 |
use Contao\Module; |
15 | 23 |
use Contao\PageModel; |
16 | 24 |
use Contao\StringUtil; |
25 |
+use Contao\System; |
|
17 | 26 |
|
18 | 27 |
/** |
19 | 28 |
* Parent class for member modules. |
... | ... |
@@ -80,40 +89,31 @@ abstract class ModuleMemberExtension extends Module |
80 | 89 |
{ |
81 | 90 |
$objTemplate->addImage = false; |
82 | 91 |
|
83 |
- $arrData = array( |
|
84 |
- 'size' => $varImgSize |
|
85 |
- ); |
|
86 |
- |
|
87 |
- if ($objMember->avatar == '' && Config::get('defaultAvatar') == '') |
|
92 |
+ if (!$objMember->avatar && !Config::get('defaultAvatar')) |
|
88 | 93 |
{ |
89 | 94 |
return; |
90 | 95 |
} |
91 | 96 |
|
92 |
- if ($objMember->avatar == '') |
|
97 |
+ $arrData = ['size' => $varImgSize]; |
|
98 |
+ |
|
99 |
+ if(!!$objMember->avatar) |
|
93 | 100 |
{ |
94 |
- $objFile = FilesModel::findByUuid( Config::get('defaultAvatar') ); |
|
95 |
- |
|
96 |
- if ($objFile === null || !is_file(TL_ROOT . '/' . $objFile->path)) |
|
97 |
- { |
|
98 |
- return; |
|
99 |
- } |
|
100 |
- |
|
101 |
- $arrData['singleSRC'] = $objFile->path; |
|
102 |
- $objTemplate->addImage = true; |
|
103 |
- $this->addImageToTemplate($objTemplate, $arrData); |
|
101 |
+ $objFile = FilesModel::findByUuid($objMember->avatar); |
|
102 |
+ } |
|
103 |
+ else |
|
104 |
+ { |
|
105 |
+ $objFile = FilesModel::findByUuid(Config::get('defaultAvatar')); |
|
104 | 106 |
} |
105 | 107 |
|
106 |
- $objFile = FilesModel::findByUuid($objMember->avatar); |
|
107 |
- |
|
108 |
- if ($objFile === null || !is_file(TL_ROOT . '/' . $objFile->path)) |
|
108 |
+ if ($objFile === null || !is_file(System::getContainer()->getParameter('kernel.project_dir') . '/' . $objFile->path)) |
|
109 | 109 |
{ |
110 |
- $arrData['singleSRC'] = FilesModel::findByUuid(Config::get('defaultAvatar'))->path; |
|
111 |
- $objTemplate->addImage = true; |
|
112 |
- $this->addImageToTemplate($objTemplate, $arrData); |
|
110 |
+ return; |
|
113 | 111 |
} |
114 | 112 |
|
115 | 113 |
$arrData['singleSRC'] = $objFile->path; |
116 | 114 |
$objTemplate->addImage = true; |
115 |
+ |
|
116 |
+ //ToDo: Change to FigureBuilder in the future |
|
117 | 117 |
$this->addImageToTemplate($objTemplate, $arrData, null, null, $objFile); |
118 | 118 |
} |
119 | 119 |
|
... | ... |
@@ -1,9 +1,16 @@ |
1 | 1 |
<?php |
2 | 2 |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
3 | 5 |
/* |
4 | 6 |
* This file is part of Oveleon ContaoMemberExtension Bundle. |
5 | 7 |
* |
6 |
- * (c) https://www.oveleon.de/ |
|
8 |
+ * @package contao-member-extension-bundle |
|
9 |
+ * @license MIT |
|
10 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
11 |
+ * @author Fabian Ekert <https://github.com/eki89> |
|
12 |
+ * @author Sebastian Zoglowek <https://github.com/zoglo> |
|
13 |
+ * @copyright Oveleon <https://www.oveleon.de/> |
|
7 | 14 |
*/ |
8 | 15 |
|
9 | 16 |
namespace Oveleon\ContaoMemberExtensionBundle; |
... | ... |
@@ -12,7 +19,7 @@ use Contao\BackendTemplate; |
12 | 19 |
use Contao\FrontendTemplate; |
13 | 20 |
use Contao\MemberModel; |
14 | 21 |
use Contao\StringUtil; |
15 |
-use Patchwork\Utf8; |
|
22 |
+use Contao\System; |
|
16 | 23 |
|
17 | 24 |
/** |
18 | 25 |
* Class ModuleMemberList |
... | ... |
@@ -41,12 +48,12 @@ class ModuleMemberList extends ModuleMemberExtension |
41 | 48 |
*/ |
42 | 49 |
public function generate() |
43 | 50 |
{ |
44 |
- if (TL_MODE == 'BE') |
|
45 |
- { |
|
46 |
- /** @var BackendTemplate|object $objTemplate */ |
|
47 |
- $objTemplate = new BackendTemplate('be_wildcard'); |
|
51 |
+ $request = System::getContainer()->get('request_stack')->getCurrentRequest(); |
|
48 | 52 |
|
49 |
- $objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['memberList'][0]) . ' ###'; |
|
53 |
+ if ($request && System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest($request)) |
|
54 |
+ { |
|
55 |
+ $objTemplate = new BackendTemplate('be_wildcard'); |
|
56 |
+ $objTemplate->wildcard = '### ' . mb_strtoupper($GLOBALS['TL_LANG']['FMD']['memberList'][0], 'UTF-8') . ' ###'; |
|
50 | 57 |
$objTemplate->title = $this->headline; |
51 | 58 |
$objTemplate->id = $this->id; |
52 | 59 |
$objTemplate->link = $this->name; |
... | ... |
@@ -1,9 +1,16 @@ |
1 | 1 |
<?php |
2 | 2 |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
3 | 5 |
/* |
4 | 6 |
* This file is part of Oveleon ContaoMemberExtension Bundle. |
5 | 7 |
* |
6 |
- * (c) https://www.oveleon.de/ |
|
8 |
+ * @package contao-member-extension-bundle |
|
9 |
+ * @license MIT |
|
10 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
11 |
+ * @author Fabian Ekert <https://github.com/eki89> |
|
12 |
+ * @author Sebastian Zoglowek <https://github.com/zoglo> |
|
13 |
+ * @copyright Oveleon <https://www.oveleon.de/> |
|
7 | 14 |
*/ |
8 | 15 |
|
9 | 16 |
namespace Oveleon\ContaoMemberExtensionBundle; |
... | ... |
@@ -16,7 +23,7 @@ use Contao\FrontendTemplate; |
16 | 23 |
use Contao\Input; |
17 | 24 |
use Contao\MemberModel; |
18 | 25 |
use Contao\StringUtil; |
19 |
-use Patchwork\Utf8; |
|
26 |
+use Contao\System; |
|
20 | 27 |
|
21 | 28 |
/** |
22 | 29 |
* Class ModuleMemberList |
... | ... |
@@ -45,12 +52,12 @@ class ModuleMemberReader extends ModuleMemberExtension |
45 | 52 |
*/ |
46 | 53 |
public function generate() |
47 | 54 |
{ |
48 |
- if (TL_MODE == 'BE') |
|
49 |
- { |
|
50 |
- /** @var BackendTemplate|object $objTemplate */ |
|
51 |
- $objTemplate = new BackendTemplate('be_wildcard'); |
|
55 |
+ $request = System::getContainer()->get('request_stack')->getCurrentRequest(); |
|
52 | 56 |
|
53 |
- $objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['memberList'][0]) . ' ###'; |
|
57 |
+ if ($request && System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest($request)) |
|
58 |
+ { |
|
59 |
+ $objTemplate = new BackendTemplate('be_wildcard'); |
|
60 |
+ $objTemplate->wildcard = '### ' . mb_strtoupper($GLOBALS['TL_LANG']['FMD']['memberList'][0], 'UTF-8') . ' ###'; |
|
54 | 61 |
$objTemplate->title = $this->headline; |
55 | 62 |
$objTemplate->id = $this->id; |
56 | 63 |
$objTemplate->link = $this->name; |