diff --git a/lib/Alchemy/Phrasea/Controller/Client/Root.php b/lib/Alchemy/Phrasea/Controller/Client/Root.php index bce28a9a2d..7681f0ee6c 100644 --- a/lib/Alchemy/Phrasea/Controller/Client/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Client/Root.php @@ -97,8 +97,8 @@ class Root implements ControllerProviderInterface $app['EM']->persist($userQuery); $app['EM']->flush(); - if ($app['authentication']->getUser()->getPrefs('start_page') === 'LAST_QUERY') { - $app['authentication']->getUser()->setPrefs('start_page_query', $query); + if ($app['authentication']->getUser()->getSettingValue('start_page') === 'LAST_QUERY') { + $app['authentication']->getUser()->setSettingValue('start_page_query', $query); } foreach ($options->getDataboxes() as $databox) { @@ -261,13 +261,13 @@ class Root implements ControllerProviderInterface 'storage_access' => $this->getDocumentStorageAccess($app), 'tabs_setup' => $this->getTabSetup($app), 'module' => 'client', - 'menubar' => $app['twig']->render('common/menubar.html.twig', ['module' => 'client']), + 'menubar' => $app['twig']->render('common/menubar.html.twig', array('module' => 'client')), 'css_file' => $this->getCssFile($app), - 'basket_status' => null !== $app['authentication']->getUser()->getPrefs('client_basket_status') ? $app['authentication']->getUser()->getPrefs('client_basket_status') : "1", - 'mod_pres' => null !== $app['authentication']->getUser()->getPrefs('client_view') ? $app['authentication']->getUser()->getPrefs('client_view') : '', - 'start_page' => $app['authentication']->getUser()->getPrefs('start_page'), - 'start_page_query' => null !== $app['authentication']->getUser()->getPrefs('start_page_query') ? $app['authentication']->getUser()->getPrefs('start_page_query') : '' - ])); + 'basket_status' => $app['authentication']->getUser()->getSettingValue('client_basket_status', '1'), + 'mod_pres' => $app['authentication']->getUser()->getSettingValue('client_view', '' ), + 'start_page' => $app['authentication']->getUser()->getSettingValue('start_page'), + 'start_page_query' => $app['authentication']->getUser()->getSettingValue('start_page_query', '') + ))); } /** @@ -349,8 +349,8 @@ class Root implements ControllerProviderInterface { $cssPath = __DIR__ . '/../../../../../www/skins/client/'; - $css = []; - $cssFile = $app['authentication']->getUser()->getPrefs('client_css'); + $css = array(); + $cssFile = $app['authentication']->getUser()->getSettingValue('client_css'); $finder = new Finder(); @@ -418,7 +418,7 @@ class Root implements ControllerProviderInterface */ private function getDefaultClientStartPage(Application $app) { - $startPage = strtoupper($app['authentication']->getUser()->getPrefs('start_page')); + $startPage = strtoupper($app['authentication']->getUser()->getSettingValue('start_page')); if ($startPage === 'PUBLI') { return $this->getPublicationStartPage($app); @@ -441,7 +441,7 @@ class Root implements ControllerProviderInterface { $collections = $queryParameters = []; - $searchSet = json_decode($app['authentication']->getUser()->getPrefs('search')); + $searchSet = json_decode($app['authentication']->getUser()->getSettingValue('search')); if ($searchSet && isset($searchSet->bases)) { foreach ($searchSet->bases as $bases) { @@ -451,9 +451,9 @@ class Root implements ControllerProviderInterface $collections = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base()); } - $queryParameters["mod"] = $app['authentication']->getUser()->getPrefs('client_view') ?: '3X6'; + $queryParameters["mod"] = $app['authentication']->getUser()->getSettingValue('client_view', '3X6'); $queryParameters["bas"] = $collections; - $queryParameters["qry"] = $app['authentication']->getUser()->getPrefs('start_page_query') ?: 'all'; + $queryParameters["qry"] = $app['authentication']->getUser()->getSettingValue('start_page_query', 'all'); $queryParameters["pag"] = 0; $queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD; $queryParameters["qryAdv"] = ''; @@ -479,8 +479,8 @@ class Root implements ControllerProviderInterface { return $app['twig']->render('client/home_inter_pub_basket.html.twig', [ 'feeds' => Aggregate::createFromUser($app, $app['authentication']->getUser()), - 'image_size' => (int) $app['authentication']->getUser()->getPrefs('images_size') - ]); + 'image_size' => (int) $app['authentication']->getUser()->getSettingValue('images_size') + )); } /** diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index d3d7478413..5a083c4a83 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -52,7 +52,7 @@ class Query implements ControllerProviderInterface { $query = (string) $request->request->get('qry'); - $mod = $app['authentication']->getUser()->getPrefs('view'); + $mod = $app['authentication']->getUser()->getSettingValue('view'); $json = []; @@ -60,7 +60,7 @@ class Query implements ControllerProviderInterface $form = $options->serialize(); - $perPage = (int) $app['authentication']->getUser()->getPrefs('images_per_page'); + $perPage = (int) $app['authentication']->getUser()->getSettingValue('images_per_page'); $page = (int) $request->request->get('pag'); $firstPage = $page < 1; @@ -79,8 +79,8 @@ class Query implements ControllerProviderInterface $app['EM']->persist($userQuery); $app['EM']->flush(); - if ($app['authentication']->getUser()->getPrefs('start_page') === 'LAST_QUERY') { - $app['authentication']->getUser()->setPrefs('start_page_query', $result->getQuery()); + if ($app['authentication']->getUser()->getSettingValue('start_page') === 'LAST_QUERY') { + $app['authentication']->getUser()->setSettingValue('start_page_query', $result->getQuery()); } foreach ($options->getDataboxes() as $databox) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Root.php b/lib/Alchemy/Phrasea/Controller/Prod/Root.php index 19b780997e..c41b36e1c3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Root.php @@ -65,7 +65,7 @@ class Root implements ControllerProviderInterface $css[$baseName] = $baseName; } - $cssfile = $app['authentication']->getUser()->getPrefs('css'); + $cssfile = $app['authentication']->getUser()->getSettingValue('css'); if (!$cssfile && isset($css['000000'])) { $cssfile = '000000'; diff --git a/lib/Alchemy/Phrasea/Controller/User/Preferences.php b/lib/Alchemy/Phrasea/Controller/User/Preferences.php index 03311684b5..21342fbd54 100644 --- a/lib/Alchemy/Phrasea/Controller/User/Preferences.php +++ b/lib/Alchemy/Phrasea/Controller/User/Preferences.php @@ -85,7 +85,7 @@ class Preferences implements ControllerProviderInterface $success = false; if (null !== $prop && null !== $value) { - $app['authentication']->getUser()->setPrefs($prop, $value); + $app['authentication']->getUser()->setSettingValue($prop, $value); $success = true; $msg = $app->trans('Preference saved !'); } diff --git a/lib/classes/databox/cgu.php b/lib/classes/databox/cgu.php index a6f12cca78..4574dad3b4 100644 --- a/lib/classes/databox/cgu.php +++ b/lib/classes/databox/cgu.php @@ -62,7 +62,7 @@ class databox_cgu if ( ! $app['acl']->get($app['authentication']->getUser())->has_access_to_sbas($databox->get_sbas_id())) { continue; } - $userValidation = ($app['authentication']->getUser()->getPrefs('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== ''); + $userValidation = ($app['authentication']->getUser()->getSettingValue('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== ''); } if ($userValidation) diff --git a/lib/classes/eventsmanager/notifyAbstract.php b/lib/classes/eventsmanager/notifyAbstract.php index 3fae9a2511..8ec559d554 100644 --- a/lib/classes/eventsmanager/notifyAbstract.php +++ b/lib/classes/eventsmanager/notifyAbstract.php @@ -35,9 +35,8 @@ abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract protected function get_prefs($class, $usr_id) { $user = $this->app['manipulator.user']->getRepository()->find($usr_id); - $pref = $user->get_notifications_preference($this->app, $class); - return null !== $pref ? $pref : 1; + return $user->getNotificationSettingValue($class); } protected function shouldSendNotificationFor($usr_id) diff --git a/templates/web/account/account.html.twig b/templates/web/account/account.html.twig index 7711e00911..2c250a8f22 100644 --- a/templates/web/account/account.html.twig +++ b/templates/web/account/account.html.twig @@ -154,7 +154,7 @@ {% for notification in nots %}