-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
/* | ||
* This file is part of Oveleon Isotope Product License. | ||
* | ||
* (c) https://www.oveleon.de/ | ||
*/ | ||
// Palette | ||
$GLOBALS['TL_DCA']['tl_module']['palettes']['orderLicenses'] = '{title_legend},name,headline,type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/* | ||
* This file is part of Oveleon Isotope Product License. | ||
* | ||
* (c) https://www.oveleon.de/ | ||
*/ | ||
|
||
namespace Oveleon\IsotopeProductLicenses; | ||
|
||
use Contao\Input; | ||
use Contao\Module; | ||
use Isotope\Model\ProductCollection\Order; | ||
|
||
class ModuleOrderLicenses extends Module | ||
{ | ||
/** | ||
* Template | ||
* @var string | ||
*/ | ||
protected $strTemplate = 'mod_orderLicenses'; | ||
|
||
/** | ||
* Generate the content element | ||
*/ | ||
protected function compile() | ||
{ | ||
if (!Input::get('uid') || ($order = Order::findOneBy('uniqid', Input::get('uid'))) === null) { | ||
return ''; | ||
} | ||
|
||
$objLicenses = LicenseItemModel::findByOrder($order->id, ['order' => 'pid']); | ||
|
||
if(null != $objLicenses) | ||
{ | ||
$arrProducts = []; | ||
$intCurrentProduct = 0; | ||
|
||
while($objLicenses->next()) | ||
{ | ||
if($objLicenses->pid != $intCurrentProduct) | ||
{ | ||
$intCurrentProduct = $objLicenses->pid; | ||
|
||
$arrProducts[$intCurrentProduct] = [ | ||
'label' => $objLicenses->getRelated('pid')->title, | ||
'licenses' => null | ||
]; | ||
} | ||
|
||
$arrProducts[$intCurrentProduct]['licenses'][] = $objLicenses->licence; | ||
} | ||
} | ||
|
||
$this->Template->products = $arrProducts; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php $this->extend('block_unsearchable'); ?> | ||
|
||
<?php $this->block('content'); ?> | ||
|
||
<?php if($this->products): ?> | ||
<?php foreach ($this->products as $pid => $product):?> | ||
<div class="product-item"> | ||
<div class="product-label"><?= $product['label'] ?></div> | ||
<ul> | ||
<?php foreach ($product['licenses'] as $license): ?> | ||
<li class="license-item"><?= $license ?></li> | ||
<?php endforeach; ?> | ||
</ul> | ||
</div> | ||
<?php endforeach; ?> | ||
<?php endif; ?> | ||
|
||
<?php $this->endblock(); ?> |