public function UloginController::uloginReport in uLogin (advanced version) 8
Returns report.
Return value
array Report table.
1 string reference to 'UloginController::uloginReport'
File
- src/
Controller/ UloginController.php, line 25
Class
- UloginController
- Controller routines for user routes.
Namespace
Drupal\ulogin\ControllerCode
public function uloginReport() {
$providers = UloginHelper::providersList();
$header = [
$this
->t('Authentication provider'),
$this
->t('Users count'),
];
$rows = [];
$query = \Drupal::database()
->select('ulogin_identity', 'ul_id');
$query
->addField('ul_id', 'network', 'network');
$query
->addExpression('COUNT(ulogin_uid)', 'count');
$query
->groupBy('network');
$results = $query
->execute()
->fetchAllAssoc('network', \PDO::FETCH_ASSOC);
foreach ($results as $result) {
$rows[] = [
$providers[$result['network']],
$result['count'],
];
}
$build = [];
$build['report'] = [
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
];
return $build;
}