| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,113 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
- |
|
| 3 |
-declare(strict_types=1); |
|
| 4 |
- |
|
| 5 |
-/* |
|
| 6 |
- * This file is part of Oveleon ContaoMemberExtension Bundle. |
|
| 7 |
- * |
|
| 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/> |
|
| 14 |
- */ |
|
| 15 |
- |
|
| 16 |
-namespace Oveleon\ContaoMemberExtensionBundle; |
|
| 17 |
- |
|
| 18 |
-use Contao\BackendTemplate; |
|
| 19 |
-use Contao\Config; |
|
| 20 |
-use Contao\CoreBundle\Exception\PageNotFoundException; |
|
| 21 |
-use Contao\Environment; |
|
| 22 |
-use Contao\FrontendTemplate; |
|
| 23 |
-use Contao\Input; |
|
| 24 |
-use Contao\MemberModel; |
|
| 25 |
-use Contao\StringUtil; |
|
| 26 |
-use Contao\System; |
|
| 27 |
- |
|
| 28 |
-/** |
|
| 29 |
- * Class ModuleMemberList |
|
| 30 |
- * |
|
| 31 |
- * @property string $ext_groups considered member groups |
|
| 32 |
- * @property string $memberFields Fields to be displayed |
|
| 33 |
- * @property string $memberReaderTpl Frontend reader template |
|
| 34 |
- */ |
|
| 35 |
-class ModuleMemberReader extends ModuleMemberExtension |
|
| 36 |
-{
|
|
| 37 |
- |
|
| 38 |
- /** |
|
| 39 |
- * Template |
|
| 40 |
- * @var string |
|
| 41 |
- */ |
|
| 42 |
- protected $strTemplate = 'mod_memberReader'; |
|
| 43 |
- |
|
| 44 |
- /** |
|
| 45 |
- * Template |
|
| 46 |
- * @var string |
|
| 47 |
- */ |
|
| 48 |
- protected $strMemberTemplate = 'memberExtension_reader_full'; |
|
| 49 |
- |
|
| 50 |
- /** |
|
| 51 |
- * Return a wildcard in the back end |
|
| 52 |
- * |
|
| 53 |
- * @return string |
|
| 54 |
- */ |
|
| 55 |
- public function generate() |
|
| 56 |
- {
|
|
| 57 |
- $request = System::getContainer()->get('request_stack')->getCurrentRequest();
|
|
| 58 |
- |
|
| 59 |
- if ($request && System::getContainer()->get('contao.routing.scope_matcher')->isBackendRequest($request))
|
|
| 60 |
- {
|
|
| 61 |
- $objTemplate = new BackendTemplate('be_wildcard');
|
|
| 62 |
- $objTemplate->wildcard = '### ' . mb_strtoupper($GLOBALS['TL_LANG']['FMD']['memberList'][0], 'UTF-8') . ' ###'; |
|
| 63 |
- $objTemplate->title = $this->headline; |
|
| 64 |
- $objTemplate->id = $this->id; |
|
| 65 |
- $objTemplate->link = $this->name; |
|
| 66 |
- $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; |
|
| 67 |
- |
|
| 68 |
- return $objTemplate->parse(); |
|
| 69 |
- } |
|
| 70 |
- |
|
| 71 |
- // Set the item from the auto_item parameter |
|
| 72 |
- if (!isset($_GET['items']) && isset($_GET['auto_item']) && Config::get('useAutoItem'))
|
|
| 73 |
- {
|
|
| 74 |
- Input::setGet('items', Input::get('auto_item'));
|
|
| 75 |
- } |
|
| 76 |
- |
|
| 77 |
- return parent::generate(); |
|
| 78 |
- } |
|
| 79 |
- |
|
| 80 |
- /** |
|
| 81 |
- * Generate the module |
|
| 82 |
- */ |
|
| 83 |
- protected function compile() |
|
| 84 |
- {
|
|
| 85 |
- $this->Template->referer = 'javascript:history.go(-1)'; |
|
| 86 |
- $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack']; |
|
| 87 |
- |
|
| 88 |
- // Get the member |
|
| 89 |
- $objMember = MemberModel::findByIdOrAlias(Input::get('items'));
|
|
| 90 |
- |
|
| 91 |
- // The member does not exist and is not deactivated |
|
| 92 |
- if ($objMember === null || $objMember->disable) |
|
| 93 |
- {
|
|
| 94 |
- throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
|
|
| 95 |
- } |
|
| 96 |
- |
|
| 97 |
- // Check for group intersection |
|
| 98 |
- $arrGroups = StringUtil::deserialize($this->ext_groups); |
|
| 99 |
- $memberGroups = StringUtil::deserialize($objMember->groups); |
|
| 100 |
- |
|
| 101 |
- if (empty($arrGroups) || !\is_array($arrGroups) || !\count(array_intersect($arrGroups, $memberGroups))) |
|
| 102 |
- {
|
|
| 103 |
- throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
|
|
| 104 |
- } |
|
| 105 |
- |
|
| 106 |
- $arrMemberFields = StringUtil::deserialize($this->memberFields, true); |
|
| 107 |
- |
|
| 108 |
- $objTemplate = new FrontendTemplate($this->memberReaderTpl ?: $this->strMemberTemplate); |
|
| 109 |
- $objTemplate->setData($objMember->row()); |
|
| 110 |
- |
|
| 111 |
- $this->Template->member = $this->parseMemberTemplate($objMember, $objTemplate, $arrMemberFields, $this->imgSize); |
|
| 112 |
- } |
|
| 113 |
-} |
| ... | ... |
@@ -27,8 +27,10 @@ use Contao\System; |
| 27 | 27 |
|
| 28 | 28 |
/** |
| 29 | 29 |
* Class ModuleMemberList |
| 30 |
- * |
|
| 31 |
- * @author Daniele Sciannimanica <https://github.com/doishub> |
|
| 30 |
+ * |
|
| 31 |
+ * @property string $ext_groups considered member groups |
|
| 32 |
+ * @property string $memberFields Fields to be displayed |
|
| 33 |
+ * @property string $memberReaderTpl Frontend reader template |
|
| 32 | 34 |
*/ |
| 33 | 35 |
class ModuleMemberReader extends ModuleMemberExtension |
| 34 | 36 |
{
|
| ... | ... |
@@ -86,14 +88,14 @@ class ModuleMemberReader extends ModuleMemberExtension |
| 86 | 88 |
// Get the member |
| 87 | 89 |
$objMember = MemberModel::findByIdOrAlias(Input::get('items'));
|
| 88 | 90 |
|
| 89 |
- // The member does not exist |
|
| 91 |
+ // The member does not exist and is not deactivated |
|
| 90 | 92 |
if ($objMember === null || $objMember->disable) |
| 91 | 93 |
{
|
| 92 | 94 |
throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
|
| 93 | 95 |
} |
| 94 | 96 |
|
| 95 |
- // Check groups |
|
| 96 |
- $arrGroups = StringUtil::deserialize($this->groups); |
|
| 97 |
+ // Check for group intersection |
|
| 98 |
+ $arrGroups = StringUtil::deserialize($this->ext_groups); |
|
| 97 | 99 |
$memberGroups = StringUtil::deserialize($objMember->groups); |
| 98 | 100 |
|
| 99 | 101 |
if (empty($arrGroups) || !\is_array($arrGroups) || !\count(array_intersect($arrGroups, $memberGroups))) |
| ... | ... |
@@ -43,7 +43,7 @@ class ModuleMemberReader extends ModuleMemberExtension |
| 43 | 43 |
* Template |
| 44 | 44 |
* @var string |
| 45 | 45 |
*/ |
| 46 |
- protected $strMemberTemplate = 'member_reader_full'; |
|
| 46 |
+ protected $strMemberTemplate = 'memberExtension_reader_full'; |
|
| 47 | 47 |
|
| 48 | 48 |
/** |
| 49 | 49 |
* Return a wildcard in the back end |
| ... | ... |
@@ -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; |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,104 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+/* |
|
| 4 |
+ * This file is part of Oveleon ContaoMemberExtension Bundle. |
|
| 5 |
+ * |
|
| 6 |
+ * (c) https://www.oveleon.de/ |
|
| 7 |
+ */ |
|
| 8 |
+ |
|
| 9 |
+namespace Oveleon\ContaoMemberExtensionBundle; |
|
| 10 |
+ |
|
| 11 |
+use Contao\BackendTemplate; |
|
| 12 |
+use Contao\Config; |
|
| 13 |
+use Contao\CoreBundle\Exception\PageNotFoundException; |
|
| 14 |
+use Contao\Environment; |
|
| 15 |
+use Contao\FrontendTemplate; |
|
| 16 |
+use Contao\Input; |
|
| 17 |
+use Contao\MemberModel; |
|
| 18 |
+use Contao\StringUtil; |
|
| 19 |
+use Patchwork\Utf8; |
|
| 20 |
+ |
|
| 21 |
+/** |
|
| 22 |
+ * Class ModuleMemberList |
|
| 23 |
+ * |
|
| 24 |
+ * @author Daniele Sciannimanica <https://github.com/doishub> |
|
| 25 |
+ */ |
|
| 26 |
+class ModuleMemberReader extends ModuleMemberExtension |
|
| 27 |
+{
|
|
| 28 |
+ |
|
| 29 |
+ /** |
|
| 30 |
+ * Template |
|
| 31 |
+ * @var string |
|
| 32 |
+ */ |
|
| 33 |
+ protected $strTemplate = 'mod_memberReader'; |
|
| 34 |
+ |
|
| 35 |
+ /** |
|
| 36 |
+ * Template |
|
| 37 |
+ * @var string |
|
| 38 |
+ */ |
|
| 39 |
+ protected $strMemberTemplate = 'member_reader_full'; |
|
| 40 |
+ |
|
| 41 |
+ /** |
|
| 42 |
+ * Return a wildcard in the back end |
|
| 43 |
+ * |
|
| 44 |
+ * @return string |
|
| 45 |
+ */ |
|
| 46 |
+ public function generate() |
|
| 47 |
+ {
|
|
| 48 |
+ if (TL_MODE == 'BE') |
|
| 49 |
+ {
|
|
| 50 |
+ /** @var BackendTemplate|object $objTemplate */ |
|
| 51 |
+ $objTemplate = new BackendTemplate('be_wildcard');
|
|
| 52 |
+ |
|
| 53 |
+ $objTemplate->wildcard = '### ' . Utf8::strtoupper($GLOBALS['TL_LANG']['FMD']['memberList'][0]) . ' ###'; |
|
| 54 |
+ $objTemplate->title = $this->headline; |
|
| 55 |
+ $objTemplate->id = $this->id; |
|
| 56 |
+ $objTemplate->link = $this->name; |
|
| 57 |
+ $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; |
|
| 58 |
+ |
|
| 59 |
+ return $objTemplate->parse(); |
|
| 60 |
+ } |
|
| 61 |
+ |
|
| 62 |
+ // Set the item from the auto_item parameter |
|
| 63 |
+ if (!isset($_GET['items']) && isset($_GET['auto_item']) && Config::get('useAutoItem'))
|
|
| 64 |
+ {
|
|
| 65 |
+ Input::setGet('items', Input::get('auto_item'));
|
|
| 66 |
+ } |
|
| 67 |
+ |
|
| 68 |
+ return parent::generate(); |
|
| 69 |
+ } |
|
| 70 |
+ |
|
| 71 |
+ /** |
|
| 72 |
+ * Generate the module |
|
| 73 |
+ */ |
|
| 74 |
+ protected function compile() |
|
| 75 |
+ {
|
|
| 76 |
+ $this->Template->referer = 'javascript:history.go(-1)'; |
|
| 77 |
+ $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack']; |
|
| 78 |
+ |
|
| 79 |
+ // Get the member |
|
| 80 |
+ $objMember = MemberModel::findByIdOrAlias(Input::get('items'));
|
|
| 81 |
+ |
|
| 82 |
+ // The member does not exist |
|
| 83 |
+ if ($objMember === null || $objMember->disable) |
|
| 84 |
+ {
|
|
| 85 |
+ throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
|
|
| 86 |
+ } |
|
| 87 |
+ |
|
| 88 |
+ // Check groups |
|
| 89 |
+ $arrGroups = StringUtil::deserialize($this->groups); |
|
| 90 |
+ $memberGroups = StringUtil::deserialize($objMember->groups); |
|
| 91 |
+ |
|
| 92 |
+ if (empty($arrGroups) || !\is_array($arrGroups) || !\count(array_intersect($arrGroups, $memberGroups))) |
|
| 93 |
+ {
|
|
| 94 |
+ throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
|
|
| 95 |
+ } |
|
| 96 |
+ |
|
| 97 |
+ $arrMemberFields = StringUtil::deserialize($this->memberFields, true); |
|
| 98 |
+ |
|
| 99 |
+ $objTemplate = new FrontendTemplate($this->memberReaderTpl ?: $this->strMemberTemplate); |
|
| 100 |
+ $objTemplate->setData($objMember->row()); |
|
| 101 |
+ |
|
| 102 |
+ $this->Template->member = $this->parseMemberTemplate($objMember, $objTemplate, $arrMemberFields, $this->imgSize); |
|
| 103 |
+ } |
|
| 104 |
+} |