Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
Archive
t3o
my.typo3.org
Commits
57cd237a
Commit
57cd237a
authored
Feb 11, 2019
by
mabolek
Committed by
Sebastian Kotte
Feb 12, 2019
Browse files
[TASK] Completed karma source referencing
parent
bd57edf8
Changes
6
Hide whitespace changes
Inline
Side-by-side
extensions/karma/Classes/Domain/Model/LedgerEntry.php
View file @
57cd237a
...
...
@@ -62,12 +62,22 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected
$mutableValue
;
/**
* The entry karma source
* The entry karma source
code
*
* @var string
*/
protected
$karmaSource
;
/**
* @var string
*/
protected
$issuer
;
/**
* @var string
*/
protected
$issuerAction
;
/**
* Set to the related campaign if the entry is generated through a campaign
*
...
...
@@ -214,6 +224,47 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this
->
karmaSource
=
$karmaSource
;
}
/**
* Get the issuer code
*
* @return string
*/
public
function
getIssuer
()
{
return
$this
->
issuer
;
}
/**
* Set the issuer code
*
* @param string $issuer
*/
public
function
setIssuer
(
string
$issuer
)
{
$this
->
issuer
=
$issuer
;
}
/**
* Get the issuer action code
*
* @return string
*/
public
function
getIssuerAction
()
{
return
$this
->
issuerAction
;
}
/**
* Set the issuer action code
*
* @param string $issuerAction
*/
public
function
setIssuerAction
(
string
$issuerAction
)
{
$this
->
issuerAction
=
$issuerAction
;
}
/**
* Get the entry campaign that generated this entry, or null if no campaign
*
...
...
extensions/karma/Classes/Service/KarmaService.php
View file @
57cd237a
...
...
@@ -129,9 +129,10 @@ class KarmaService implements \TYPO3\CMS\Core\SingletonInterface
* @param int $karmaValue to add to the user
* @param ExtbaseFrontendUser $frontendUser to add the value to
* @param string $karmaSource for the karma value
* @param Campaign $campaign for the value (optional)
* @param string $karmaIssuer code
* @param string $karmaIssuerAction code
*/
public
function
addKarmaToUser
(
int
$karmaValue
,
ExtbaseFrontendUser
$frontendUser
,
string
$karmaSource
,
Campaign
$campaign
=
null
)
public
function
addKarmaToUser
(
int
$karmaValue
,
ExtbaseFrontendUser
$frontendUser
,
string
$karmaSource
,
string
$karmaIssuer
,
string
$karmaIssuerAction
)
{
$frontendUser
=
$this
->
ensureCorrectFrontendUserSubclass
(
$frontendUser
);
...
...
@@ -141,9 +142,8 @@ class KarmaService implements \TYPO3\CMS\Core\SingletonInterface
$ledgerEntry
->
setMutableValue
(
$karmaValue
);
$ledgerEntry
->
setUser
(
$frontendUser
);
$ledgerEntry
->
setKarmaSource
(
$karmaSource
);
if
(
$campaign
!==
null
)
{
$ledgerEntry
->
setCampaign
(
$campaign
);
}
$ledgerEntry
->
setIssuer
(
$karmaIssuer
);
$ledgerEntry
->
setIssuerAction
(
$karmaIssuerAction
);
$this
->
ledgerEntryRepository
->
add
(
$ledgerEntry
);
...
...
extensions/karma/Classes/Utility/UserProfileChangeKarmaIssuerUtility.php
View file @
57cd237a
...
...
@@ -35,6 +35,8 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
class
UserProfileChangeKarmaIssuerUtility
{
public
const
ISSUER_CODE
=
'userProfileChange'
;
/**
* @var \T3o\Karma\Service\KarmaService
*/
...
...
@@ -100,7 +102,7 @@ class UserProfileChangeKarmaIssuerUtility
*/
public
function
newUserWasCreated
(
ExtbaseFrontendUser
$frontendUser
)
{
$issuerActionSettings
=
$this
->
settings
[
'issuers'
][
'userProfileChange'
][
'newUserWasCreated'
];
$issuerActionSettings
=
$this
->
settings
[
'issuers'
][
self
::
ISSUER_CODE
][
__FUNCTION__
];
$karmaSourceCode
=
$issuerActionSettings
[
'sourceCode'
];
if
(
$karmaSourceCode
===
''
)
{
...
...
@@ -110,7 +112,9 @@ class UserProfileChangeKarmaIssuerUtility
$this
->
karmaService
->
addKarmaToUser
(
$issuerActionSettings
[
'valueEarned'
],
$frontendUser
,
$issuerActionSettings
[
'sourceCode'
]
$issuerActionSettings
[
'sourceCode'
],
self
::
ISSUER_CODE
,
__FUNCTION__
);
}
}
extensions/karma/Configuration/TCA/tx_karma_domain_model_ledgerentry.php
View file @
57cd237a
...
...
@@ -84,8 +84,27 @@ $tx_karma_domain_model_ledgerentry = [
'type'
=>
'input'
,
'size'
=>
16
,
'max'
=>
16
,
'eval'
=>
'trim'
,
'default'
=>
0
,
'eval'
=>
'trim'
]
],
'issuer'
=>
[
'exclude'
=>
true
,
'label'
=>
$ll
.
'tx_karma_domain_model_ledgerentry.issuer'
,
'config'
=>
[
'type'
=>
'input'
,
'size'
=>
32
,
'max'
=>
32
,
'eval'
=>
'trim'
]
],
'issuer_action'
=>
[
'exclude'
=>
true
,
'label'
=>
$ll
.
'tx_karma_domain_model_ledgerentry.issuer_action'
,
'config'
=>
[
'type'
=>
'input'
,
'size'
=>
32
,
'max'
=>
32
,
'eval'
=>
'trim'
]
],
'campaign'
=>
[
...
...
extensions/karma/Resources/Private/Templates/UserDisplay/List.html
View file @
57cd237a
...
...
@@ -12,7 +12,7 @@
<f:for
each=
"{entries}"
as=
"entry"
>
<tr
id=
"entry-{entry.uid}"
>
<td>
{entry.crdate -> f:format.date(format:'j F, Y')}
</td>
<td>
{entry.karmaSource
.title
}
</td>
<td>
{entry.karmaSource
} {entry.issuer} {entry.issuerAction
}
</td>
<td>
{entry.immutableValue}
</td>
<td>
{entry.mutableValue}
</td>
</tr>
...
...
extensions/karma/ext_tables.sql
View file @
57cd237a
...
...
@@ -14,6 +14,9 @@ CREATE TABLE tx_karma_domain_model_ledgerentry (
mutable_value
int
(
11
)
DEFAULT
'0'
,
karma_source
varchar
(
16
)
DEFAULT
''
,
issuer
varchar
(
32
)
DEFAULT
''
,
issuer_action
varchar
(
32
)
DEFAULT
''
,
campaign
int
(
11
)
unsigned
DEFAULT
'0'
,
user
int
(
11
)
unsigned
DEFAULT
'0'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment