Commit 407a9f34 authored by Valentin Süß's avatar Valentin Süß

Merge branch '2-use-membership-logos-to-render-platinum-banners' into 'master'

Resolve "Use membership logos to render platinum banners"

Closes #2

See merge request !5
parents 2507ddaf 1a9f1d67
......@@ -14,6 +14,9 @@ namespace T3o\Randombanners\Domain\Model;
* The TYPO3 project - inspiring people to share!
*/
use T3o\T3oMembership\Domain\Model\Member;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
class Banner extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
......@@ -59,18 +62,27 @@ class Banner extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $clickedLastMonth;
/**
* $member
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\T3oMembership\Domain\Model\Member>
*/
protected $member = 0;
/**
* @param string $name
* @return void
*/
public function setName($name) {
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName() {
public function getName()
{
return $this->name;
}
......@@ -78,29 +90,32 @@ class Banner extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $link
* @return void
*/
public function setLink($link) {
public function setLink($link)
{
$this->link = $link;
}
/**
* @return string
*/
public function getLink() {
public function getLink()
{
return $this->link;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $logo
* @param ObjectStorage $logo
* @return void
*/
public function setLogo(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $logo) {
public function setLogo(ObjectStorage $logo)
{
$this->logo = $logo;
}
/**
* Get logo
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
* @return ObjectStorage
*/
public function getLogo() {
return $this->logo;
......@@ -110,14 +125,16 @@ class Banner extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $email
* @return void
*/
public function setEmail($email) {
public function setEmail($email)
{
$this->email = $email;
}
/**
* @return string
*/
public function getEmail() {
public function getEmail()
{
return $this->email;
}
......@@ -125,14 +142,16 @@ class Banner extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param integer $clickedThisMonth
* @return void
*/
public function setClickedThisMonth($clickedThisMonth) {
public function setClickedThisMonth($clickedThisMonth)
{
$this->clickedThisMonth = $clickedThisMonth;
}
/**
* @return integer
*/
public function getClickedThisMonth() {
public function getClickedThisMonth()
{
return $this->clickedThisMonth;
}
......@@ -140,15 +159,60 @@ class Banner extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $clickedLastMonth
* @return void
*/
public function setClickedLastMonth($clickedLastMonth) {
public function setClickedLastMonth($clickedLastMonth)
{
$this->clickedLastMonth = $clickedLastMonth;
}
/**
* @return string
*/
public function getClickedLastMonth() {
public function getClickedLastMonth()
{
return $this->clickedLastMonth;
}
}
\ No newline at end of file
/**
* Adds a Member
*
* @param Member $member
* @return void
*/
public function addMember(Member $member)
{
$this->member->attach($member);
}
/**
* Removes a Member
*
* @param Member $memberToRemove The Member to be removed
* @return void
*/
public function removeMember(Member $memberToRemove)
{
$this->member->detach($memberToRemove);
}
/**
* Returns the member
*
* @return ObjectStorage<\T3o\T3oMembership\Domain\Model\Member> $member
*/
public function getMember()
{
return $this->member;
}
/**
* Sets the members
*
* @param ObjectStorage<\T3o\T3oMembership\Domain\Model\Member> $member
* @return void
*/
public function setMember(ObjectStorage $member)
{
$this->member = $member;
}
}
......@@ -24,10 +24,11 @@ return [
'iconfile' => 'EXT:randombanners/Resources/Public/Icons/tx_randombanners_domain_model_banner.gif'
],
'interface' => [
'showRecordFieldList' => 'cruser_id, pid, sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, link, email, logo, clicked_this_month, clicked_last_month',
'showRecordFieldList' => 'cruser_id, pid, sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, link, email, logo, clicked_this_month, clicked_last_month, member',
],
'types' => [
'1' => ['showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, name, link, email, logo, clicked_this_month, clicked_last_month,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,starttime, endtime'],
'1' => [
'showitem' => 'sys_language_uid;;;;1-1-1, l10n_parent, l10n_diffsource, hidden;;1, name, link, email, logo, clicked_this_month, clicked_last_month, member,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access,starttime, endtime'],
],
'palettes' => [
'1' => ['showitem' => ''],
......@@ -177,5 +178,17 @@ return [
'readOnly' => 1,
],
],
'member' => array(
'exclude' => 0,
'label' => 'LLL:EXT:t3o_membership/Resources/Private/Language/locallang_db.xlf:tx_t3omembership_domain_model_member',
'config' => array(
'type' => 'select',
'items' => [['none', 0]],
'foreign_table' => 'tx_t3omembership_domain_model_member',
'foreign_table_where' => 'tx_t3omembership_domain_model_member.membership=1',
'minitems' => 0,
'maxitems' => 1,
),
),
],
];
\ No newline at end of file
......@@ -9,7 +9,14 @@
<f:for each="{banners}" as="banner">
<li>
<f:link.external class="t3js-banner" uri="{f:uri.external(uri: banner.link)}" target="_blank" additionalAttributes="{data-uid: banner.uid, rel: settings.linkAttributeRel}">
<f:image image="{banner.logo.0}" alt="{banner.name}" maxWidth="150" />
<f:if condition="{banner.member.0.logo}">
<f:then>
<f:image class="membership-logo" image="{banner.member.0.logo}" alt="{banner.name}" maxWidth="150" />
</f:then>
<f:else>
<f:image image="{banner.logo.0}" alt="{banner.name}" maxWidth="150" />
</f:else>
</f:if>
</f:link.external>
</li>
</f:for>
......
......@@ -12,6 +12,8 @@ CREATE TABLE tx_randombanners_domain_model_banner (
clicked_this_month int(11) DEFAULT '0' NOT NULL,
clicked_last_month int(11) DEFAULT '0' NOT NULL,
member int(11) DEFAULT '0' NOT NULL,
tstamp int(11) DEFAULT '0' NOT NULL,
crdate int(11) DEFAULT '0' NOT NULL,
cruser_id int(11) DEFAULT '0' NOT NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment