/** * Save profile settings. */ function execute($request) { $user = $request->getUser(); $notificationStatusDao = DAORegistry::getDAO('NotificationStatusDAO'); $pressNotifications = $notificationStatusDao->getPressNotifications($user->getId()); $readerNotify = $request->getUserVar('pressNotify'); $pressDao = DAORegistry::getDAO('PressDAO'); $presses = $pressDao->getAll(); while ($thisPress = $presses->next()) { $thisPressId = $thisPress->getId(); $currentlyReceives = !empty($pressNotifications[$thisPressId]); $shouldReceive = !empty($readerNotify) && in_array($thisPress->getId(), $readerNotify); if ($currentlyReceives != $shouldReceive) { $notificationStatusDao->setPressNotifications($thisPressId, $user->getId(), $shouldReceive); } } parent::execute($request); }
/** * Save profile settings. */ function execute($request) { $user = $request->getUser(); $journalDao = DAORegistry::getDAO('JournalDAO'); $openAccessNotify = $request->getUserVar('openAccessNotify'); $userSettingsDao = DAORegistry::getDAO('UserSettingsDAO'); $journals = $journalDao->getAll(true); while ($thisJournal = $journals->next()) { if ($thisJournal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $thisJournal->getSetting('enableOpenAccessNotification')) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisJournal->getId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisJournal->getId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisJournal->getId()); } } } parent::execute($request); }
/** * Constructor. */ function ProfileForm($user) { parent::PKPProfileForm('user/profile.tpl', $user); }
/** * Save profile settings. */ function execute($request) { $user = $this->getUser(); $user->setTimeZone($this->getData('timeZone')); $roleDao = DAORegistry::getDAO('RoleDAO'); $schedConfDao = DAORegistry::getDAO('SchedConfDAO'); // Roles $schedConf = Request::getSchedConf(); if ($schedConf) { import('classes.schedConf.SchedConfAction'); $role = new Role(); $role->setUserId($user->getId()); $role->setConferenceId($schedConf->getConferenceId()); $role->setSchedConfId($schedConf->getId()); if (SchedConfAction::allowRegReviewer($schedConf)) { $role->setRoleId(ROLE_ID_REVIEWER); $hasRole = Validation::isReviewer(); $wantsRole = Request::getUserVar('reviewerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if (SchedConfAction::allowRegAuthor($schedConf)) { $role->setRoleId(ROLE_ID_AUTHOR); $hasRole = Validation::isAuthor(); $wantsRole = Request::getUserVar('authorRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } if (SchedConfAction::allowRegReader($schedConf)) { $role->setRoleId(ROLE_ID_READER); $hasRole = Validation::isReader(); $wantsRole = Request::getUserVar('readerRole'); if ($hasRole && !$wantsRole) { $roleDao->deleteRole($role); } if (!$hasRole && $wantsRole) { $roleDao->insertRole($role); } } } $openAccessNotify = Request::getUserVar('openAccessNotify'); $userSettingsDao = DAORegistry::getDAO('UserSettingsDAO'); $schedConfs = $schedConfDao->getAll(); $schedConfs = $schedConfs->toArray(); foreach ($schedConfs as $thisSchedConf) { if ($thisSchedConf->getSetting('enableOpenAccessNotification') == true) { $currentlyReceives = $user->getSetting('openAccessNotification', $thisSchedConf->getId()); $shouldReceive = !empty($openAccessNotify) && in_array($thisSchedConf->getId(), $openAccessNotify); if ($currentlyReceives != $shouldReceive) { $userSettingsDao->updateSetting($user->getId(), 'openAccessNotification', $shouldReceive, 'bool', $thisSchedConf->getId()); } } } parent::execute($request); }