Commit db079173 authored by Tino Goratsch's avatar Tino Goratsch

extend the data grid of the share module with some more info

parent 8f99bec7
......@@ -69,7 +69,7 @@ class Index extends Core\Controller\AbstractFrontendAction
'search' => [0, 1],
'replace' => [$this->translator->t('system', 'no'), $this->translator->t('system', 'yes')],
],
], 30)
], 50)
->addColumn([
'label' => $this->translator->t('share', 'uri'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\RouteColumnRenderer::class,
......@@ -78,6 +78,19 @@ class Index extends Core\Controller\AbstractFrontendAction
'custom' => [
'path' => '%s',
],
], 40)
->addColumn([
'label' => $this->translator->t('share', 'average_rating'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\RoundNumberColumnRenderer::class,
'fields' => ['average_rating'],
'custom' => [
'precision' => 2,
],
], 30)
->addColumn([
'label' => $this->translator->t('share', 'ratings_count'),
'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class,
'fields' => ['ratings_count'],
], 20)
->addColumn([
'label' => $this->translator->t('system', 'id'),
......
......@@ -7,7 +7,34 @@
namespace ACP3\Modules\ACP3\Share\Model\Repository;
use ACP3\Core\Helpers\DataGrid\ColumnPriorityQueue;
use Doctrine\DBAL\Query\QueryBuilder;
class DataGridRepository extends \ACP3\Core\Model\Repository\DataGridRepository
{
const TABLE_NAME = ShareRepository::TABLE_NAME;
protected function getColumns(ColumnPriorityQueue $gridColumns)
{
return [
'main.*',
'AVG(sr.stars) AS average_rating',
'COUNT(sr.id) AS ratings_count'
];
}
protected function addJoin(QueryBuilder $queryBuilder)
{
$queryBuilder->leftJoin(
'main',
$this->getTableName(ShareRatingsRepository::TABLE_NAME),
'sr',
'sr.share_id = main.id'
);
}
protected function addGroupBy(QueryBuilder $queryBuilder)
{
$queryBuilder->addGroupBy('sr.share_id');
}
}
......@@ -14,12 +14,14 @@
<item key="admin_index_edit">Datensatz bearbeiten</item>
<item key="admin_index_settings">Einstellungen</item>
<item key="already_rated">Sie haben diese Seite bereits bewertet.</item>
<item key="average_rating">Durchschnittliche Bewertung</item>
<item key="customize_services">Verfügbare Dienste anpassen</item>
<item key="fb_app_id">Facebook App-ID</item>
<item key="fb_secret">Facebook Secret</item>
<item key="mod_description">Ermöglicht die Einbindung diverser sozialer Netzwerke zum Teilen von Inhalten, etc.</item>
<item key="no_ratings_yet">Noch keine Bewertungen</item>
<item key="rate_with_x_stars">Mit %stars% Sternen bewerten</item>
<item key="ratings_count">Anzahl Bewertungen</item>
<item key="select_active">Bitte wählen aus, ob dieser Datensatz bei sozialen Netzwerken geteilt werden können soll oder nicht.</item>
<item key="select_customize_services">Bitte wählen aus ob Sie die verfügbaren sozialen Netzwerke für diesen Datensatz anpassen möchten oder nicht.</item>
<item key="select_ratings_active">Bitte wählen aus, ob dieser Datensatz von Benutzern bewertet werden können soll oder nicht.</item>
......
......@@ -14,12 +14,14 @@
<item key="admin_index_edit">Edit resultset</item>
<item key="admin_index_settings">Settings</item>
<item key="already_rated">You've already rated this page.</item>
<item key="average_rating">Average rating</item>
<item key="customize_services">Customize available services</item>
<item key="fb_app_id">Facebook App-ID</item>
<item key="fb_secret">Facebook Secret</item>
<item key="mod_description">Makes it possible to share site contents via various social networks.</item>
<item key="no_ratings_yet">No ratings yet</item>
<item key="rate_with_x_stars">Rate with %stars% stars</item>
<item key="ratings_count">Ratings count</item>
<item key="select_active">Please select whether users should be able to share this resultset on social networks or not.</item>
<item key="select_customize_services">Please select whether you want to customize the available social networks of this resultset or not.</item>
<item key="select_ratings_active">Please select whether users should be able to rate this resultset or not.</item>
......
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