public function DashboardController::restoreToDefaultAll in Opigno dashboard 8
Same name and namespace in other branches
- 3.x src/Controller/DashboardController.php \Drupal\opigno_dashboard\Controller\DashboardController::restoreToDefaultAll()
1 string reference to 'DashboardController::restoreToDefaultAll'
File
- src/
Controller/ DashboardController.php, line 256
Class
- DashboardController
- Controller for all the actions of the Learning Path manager app.
Namespace
Drupal\opigno_dashboard\ControllerCode
public function restoreToDefaultAll() {
$positioning = $this
->getPositioning(NULL, TRUE, TRUE);
unset($positioning['positions'][0]);
$connection = \Drupal::database();
$uids = \Drupal::entityQuery('user')
->execute();
unset($uids[0]);
if ($uids) {
foreach ($uids as $uid) {
$connection
->merge('opigno_dashboard_positioning')
->key([
'uid' => $uid,
])
->fields([
'columns' => (int) $positioning['columns'],
'positions' => json_encode($positioning['positions']),
])
->execute();
}
}
return new JsonResponse(NULL, Response::HTTP_OK);
}