/** * Validate and save changes to user's notifications info. * @param $args array * @param $request PKPRequest */ function saveNotifications($args, $request) { $this->setupTemplate($request); import('classes.user.form.NotificationSettingsForm'); $notificationsForm = new NotificationSettingsForm($request->getUser()); $notificationsForm->readInputData(); if ($notificationsForm->validate()) { $notificationsForm->execute($request); return new JSONMessage(true); } return new JSONMessage(false, $notificationsForm->fetch($request)); }
/** * Save user notification settings */ function saveSettings() { $this->validate(); $this->setupTemplate(true); import('notification.form.NotificationSettingsForm'); $notificationSettingsForm = new NotificationSettingsForm(); $notificationSettingsForm->readInputData(); if ($notificationSettingsForm->validate()) { $notificationSettingsForm->execute(); PKPRequest::redirect(NotificationHandler::getContextDepthArray(), 'notification', 'settings'); } else { $notificationSettingsForm->display(); } }
/** * Save user notification settings * @param $args array * @param $request Request */ function saveSettings($args, &$request) { $this->validate(); $this->setupTemplate(true); import('classes.notification.form.NotificationSettingsForm'); $notificationSettingsForm = new NotificationSettingsForm(); $notificationSettingsForm->readInputData(); if ($notificationSettingsForm->validate()) { $notificationSettingsForm->execute($request); $router =& $request->getRouter(); $request->redirectUrl($router->url($request, null, 'notification', 'settings')); } else { $notificationSettingsForm->display($request); } }
/** * Save user notification settings. * @param $args array * @param $request PKPRequest * @return JSONMessage JSON-formatted response */ function saveNotificationSettings($args, $request) { $this->setupTemplate($request); import('classes.notification.form.NotificationSettingsForm'); $notificationSettingsForm = new NotificationSettingsForm(); $notificationSettingsForm->readInputData(); $json = new JSONMessage(); if ($notificationSettingsForm->validate()) { $notificationSettingsForm->execute($request); $user = $request->getUser(); $notificationMgr = new NotificationManager(); $notificationMgr->createTrivialNotification($user->getId()); } else { $json->setStatus(false); } return $json; }