Commit 5e9cea9d authored by mabolek's avatar mabolek Committed by Thomas Löffler
Browse files

[FEATURE] Basic karma listing for user (without pagination)

parent 50b51687
......@@ -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;
}
}
......@@ -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);
}
/*
......
<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
Supports Markdown
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