You are here

public function UserController::getUserStatsBlock in Opigno statistics 3.x

Get user statistics block.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current request object.

Return value

\Drupal\Core\Ajax\AjaxResponse The response object.

1 string reference to 'UserController::getUserStatsBlock'
opigno_statistics.routing.yml in ./opigno_statistics.routing.yml
opigno_statistics.routing.yml

File

src/Controller/UserController.php, line 1534

Class

UserController
Statistics user controller.

Namespace

Drupal\opigno_statistics\Controller

Code

public function getUserStatsBlock(Request $request) : AjaxResponse {
  $days = (int) $request
    ->get('days', 0);
  $uid = (int) $request
    ->get('uid', 0);
  $stats = $this->statsManager
    ->renderUserStatistics($days, $uid);
  $response = new AjaxResponse();
  $response
    ->addCommand(new InvokeCommand('body', 'removeClass', [
    'charts-rendered',
  ]));
  $response
    ->addCommand(new ReplaceCommand('.opigno-user-statistics', $stats));
  return $response;
}