Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
SocialstatsController
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 homeAction
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Admin Social Statistics Controller
5 *
6 * PHP version 8
7 *
8 * Copyright (C) Villanova University 2010.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 *
23 * @category VuFind
24 * @package  Controller
25 * @author   Demian Katz <demian.katz@villanova.edu>
26 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org Main Site
28 */
29
30namespace VuFindAdmin\Controller;
31
32use VuFind\Db\Service\CommentsServiceInterface;
33use VuFind\Db\Service\RatingsServiceInterface;
34use VuFind\Db\Service\UserResourceServiceInterface;
35use VuFind\Tags\TagsService;
36
37/**
38 * Class controls VuFind social statistical data.
39 *
40 * @category VuFind
41 * @package  Controller
42 * @author   Demian Katz <demian.katz@villanova.edu>
43 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
44 * @link     https://vufind.org Main Site
45 */
46class SocialstatsController extends AbstractAdmin
47{
48    /**
49     * Social statistics reporting
50     *
51     * @return \Laminas\View\Model\ViewModel
52     */
53    public function homeAction()
54    {
55        $view = $this->createViewModel();
56        $view->setTemplate('admin/socialstats/home');
57        $view->comments = $this->getDbService(CommentsServiceInterface::class)->getStatistics();
58        $view->ratings = $this->getDbService(RatingsServiceInterface::class)->getStatistics();
59        $view->favorites = $this->getDbService(UserResourceServiceInterface::class)->getStatistics();
60        $view->tags = $this->serviceLocator->get(TagsService::class)->getStatistics();
61        return $view;
62    }
63}