public function createNewDashboard()
{
$this->checkTokenInUrl();
if (Piwik::isUserIsAnonymous()) {
return '0';
}
$name = urldecode(Common::getRequestVar('name', '', 'string'));
$type = urldecode(Common::getRequestVar('type', 'default', 'string'));
$layout = '{}';
$login = Piwik::getCurrentUserLogin();
if ($type == 'default') {
$layout = $this->dashboard->getDefaultLayout();
}
$nextId = $this->getModel()->createNewDashboardForUser($login, $name, $layout);
Json::sendHeaderJSON();
return json_encode($nextId);
}