Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
visitors
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
visitors
Merge requests
!152
Resolve
#3462384
"Remove user activity"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve
#3462384
"Remove user activity"
issue/visitors-3462384:3462384-remove-user-activity
into
8.x-2.x
Overview
0
Commits
2
Pipelines
2
Changes
8
Merged
Steven Ayers
requested to merge
issue/visitors-3462384:3462384-remove-user-activity
into
8.x-2.x
11 months ago
Overview
0
Commits
2
Pipelines
2
Changes
8
Expand
Closes
#3462384
0
0
Merge request reports
Compare
8.x-2.x
version 1
7c622aab
11 months ago
8.x-2.x (base)
and
latest version
latest version
7c622aab
2 commits,
11 months ago
version 1
7c622aab
2 commits,
11 months ago
8 files
+
0
−
466
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
src/Controller/Report/UserActivity.php deleted
100644 → 0
+
0
−
137
Options
<?php
namespace
Drupal\visitors\Controller\Report
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Form\FormBuilderInterface
;
use
Drupal\Core\StringTranslation\TranslationInterface
;
use
Drupal\visitors\VisitorsReportInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* User Activity Report controller.
*/
final
class
UserActivity
extends
ControllerBase
{
/**
* The form builder service.
*
* @var \Drupal\Core\Form\FormBuilderInterface
*/
protected
$formBuilder
;
/**
* The module handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected
$moduleHandler
;
/**
* The report service.
*
* @var \Drupal\visitors\VisitorsReportInterface
*/
protected
$report
;
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
):
UserActivity
{
return
new
self
(
$container
->
get
(
'form_builder'
),
$container
->
get
(
'module_handler'
),
$container
->
get
(
'visitors.report'
),
$container
->
get
(
'string_translation'
)
);
}
/**
* Constructs a UserActivity object.
*
* @param \Drupal\Core\Form\FormBuilderInterface $form_builder
* The form builder service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler service.
* @param \Drupal\visitors\VisitorsReportInterface $report_service
* The report service.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public
function
__construct
(
FormBuilderInterface
$form_builder
,
ModuleHandlerInterface
$module_handler
,
VisitorsReportInterface
$report_service
,
TranslationInterface
$string_translation
)
{
$this
->
formBuilder
=
$form_builder
;
$this
->
moduleHandler
=
$module_handler
;
$this
->
report
=
$report_service
;
$this
->
setStringTranslation
(
$string_translation
);
}
/**
* Returns a user activity page.
*
* @return array
* A render array representing the user activity page content.
*/
public
function
display
():
array
{
if
(
!
$this
->
moduleHandler
->
moduleExists
(
'node'
))
{
throw
new
NotFoundHttpException
();
}
$form
=
$this
->
formBuilder
->
getForm
(
'Drupal\visitors\Form\DateFilter'
);
$header
=
$this
->
getHeader
();
return
[
'visitors_date_filter_form'
=>
$form
,
'visitors_table'
=>
[
'#type'
=>
'table'
,
'#header'
=>
$header
,
'#rows'
=>
$this
->
report
->
activity
(
$header
),
],
'visitors_pager'
=>
[
'#type'
=>
'pager'
],
];
}
/**
* Returns a table header configuration.
*
* @return array
* A render array representing the table header info.
*/
protected
function
getHeader
():
array
{
$headers
=
[
'u.name'
=>
[
'data'
=>
$this
->
t
(
'User'
),
'field'
=>
'u.name'
,
'specifier'
=>
'u.name'
,
'class'
=>
[
RESPONSIVE_PRIORITY_LOW
],
],
'hits'
=>
[
'data'
=>
$this
->
t
(
'Hits'
),
'field'
=>
'hits'
,
'specifier'
=>
'hits'
,
'class'
=>
[
RESPONSIVE_PRIORITY_LOW
],
'sort'
=>
'desc'
,
],
'nodes'
=>
[
'data'
=>
$this
->
t
(
'Nodes'
),
'field'
=>
'nodes'
,
'specifier'
=>
'nodes'
,
'class'
=>
[
RESPONSIVE_PRIORITY_LOW
],
],
];
if
(
$this
->
moduleHandler
()
->
moduleExists
(
'comment'
))
{
$headers
[
'comments'
]
=
[
'data'
=>
$this
->
t
(
'Comments'
),
'field'
=>
'comments'
,
'specifier'
=>
'comments'
,
'class'
=>
[
RESPONSIVE_PRIORITY_LOW
],
];
}
return
$headers
;
}
}
Loading