Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
t3o
my.typo3.org
Commits
a0d0aa20
Commit
a0d0aa20
authored
Nov 06, 2018
by
mabolek
Committed by
Thomas Löffler
Feb 11, 2019
Browse files
[FEATURE] Basic karma listing for user (without pagination)
parent
dfe1d4df
Changes
6
Hide whitespace changes
Inline
Side-by-side
extensions/karma/Classes/Controller/AbstractController.php
View file @
a0d0aa20
...
...
@@ -3,6 +3,7 @@
namespace
T3o\Karma\Controller
;
use
T3o\Karma\Domain\Repository\KarmaSourceRepository
;
use
T3o\Karma\Domain\Repository\LedgerEntryRepository
;
use
T3o\Karma\Service\KarmaService
;
use
TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
;
...
...
@@ -46,6 +47,11 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
*/
protected
$karmaSourceRepository
;
/**
* @var LedgerEntryRepository
*/
protected
$ledgerEntryRepository
;
/**
* @param KarmaService $karmaService
*/
...
...
@@ -70,4 +76,12 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
$this
->
karmaSourceRepository
=
$karmaSourceRepository
;
}
/**
* @param LedgerEntryRepository $ledgerEntryRepository
*/
public
function
injectLedgerEntryRepository
(
LedgerEntryRepository
$ledgerEntryRepository
)
{
$this
->
ledgerEntryRepository
=
$ledgerEntryRepository
;
}
}
extensions/karma/Classes/Controller/UserDisplayController.php
View file @
a0d0aa20
...
...
@@ -32,7 +32,9 @@ class UserDisplayController extends AbstractController
*/
public
function
listAction
()
{
$entries
=
$this
->
ledgerEntryRepository
->
findByUser
(
$GLOBALS
[
'TSFE'
]
->
fe_user
->
user
[
'uid'
]);
$this
->
view
->
assign
(
'entries'
,
$entries
);
}
/*
...
...
extensions/karma/Classes/Domain/Model/LedgerEntry.php
View file @
a0d0aa20
...
...
@@ -28,6 +28,16 @@ use T3o\Karma\Domain\Model\FrontendUser;
***************************************************************/
class
LedgerEntry
extends
\
TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var \DateTime
*/
protected
$crdate
;
/**
* @var \DateTime
*/
protected
$tstamp
;
/**
* The date when the entry expired, if set.
*
...
...
@@ -74,6 +84,46 @@ class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected
$user
;
/**
* Get the creation date
*
* @return \DateTime
*/
public
function
getCrdate
():
\
DateTime
{
return
$this
->
crdate
;
}
/**
* Set the creation date
*
* @param \DateTime $crdate
*/
public
function
setCrdate
(
\
DateTime
$crdate
)
{
$this
->
crdate
=
$crdate
;
}
/**
* Get the last modified timestamp
*
* @return \DateTime
*/
public
function
getTstamp
():
\
DateTime
{
return
$this
->
tstamp
;
}
/**
* Set the last modified timestamp
*
* @param \DateTime $tstamp
*/
public
function
setTstamp
(
\
DateTime
$tstamp
)
{
$this
->
tstamp
=
$tstamp
;
}
/**
* Return the expired timestamp or zero if not yet expired
*
...
...
html/typo3conf/ext/karma/Resources/Private/Layouts/UserDisplay/Default.html
0 → 100644
View file @
a0d0aa20
<f:render
section=
"main"
/>
html/typo3conf/ext/karma/Resources/Private/Partials/UserDisplay/.gitkeep
0 → 100644
View file @
a0d0aa20
html/typo3conf/ext/karma/Resources/Private/Templates/UserDisplay/List.html
0 → 100644
View file @
a0d0aa20
<section
class=
"container"
>
<table
class=
"table table-striped"
>
<thead>
<tr>
<th>
Date
</th>
<th>
Description
</th>
<th>
Karma Points
</th>
<th>
Karma Cash
</th>
</tr>
</thead>
<tbody>
<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.immutableValue}
</td>
<td>
{entry.mutableValue}
</td>
</tr>
</f:for>
</tbody>
</table>
</section>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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