public function copyDashboardToUser()
{
$this->checkTokenInUrl();
if (!Piwik::hasUserSuperUserAccess()) {
return '0';
}
$login = Piwik::getCurrentUserLogin();
$name = urldecode(Common::getRequestVar('name', '', 'string'));
$user = urldecode(Common::getRequestVar('user', '', 'string'));
$idDashboard = Common::getRequestVar('dashboardId', 0, 'int');
$layout = $this->dashboard->getLayoutForUser($login, $idDashboard);
if ($layout !== false) {
$nextId = $this->getModel()->createNewDashboardForUser($user, $name, $layout);
Json::sendHeaderJSON();
return json_encode($nextId);
}
}