Replace getter and setter for user & user notif setting value

This commit is contained in:
Nicolas Le Goff
2013-11-16 19:43:00 +01:00
parent 3b3e92575f
commit 54a5d6578c
20 changed files with 88 additions and 87 deletions

View File

@@ -97,8 +97,8 @@ class Root implements ControllerProviderInterface
$app['EM']->persist($userQuery); $app['EM']->persist($userQuery);
$app['EM']->flush(); $app['EM']->flush();
if ($app['authentication']->getUser()->getPrefs('start_page') === 'LAST_QUERY') { if ($app['authentication']->getUser()->getSettingValue('start_page') === 'LAST_QUERY') {
$app['authentication']->getUser()->setPrefs('start_page_query', $query); $app['authentication']->getUser()->setSettingValue('start_page_query', $query);
} }
foreach ($options->getDataboxes() as $databox) { foreach ($options->getDataboxes() as $databox) {
@@ -261,13 +261,13 @@ class Root implements ControllerProviderInterface
'storage_access' => $this->getDocumentStorageAccess($app), 'storage_access' => $this->getDocumentStorageAccess($app),
'tabs_setup' => $this->getTabSetup($app), 'tabs_setup' => $this->getTabSetup($app),
'module' => 'client', '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), 'css_file' => $this->getCssFile($app),
'basket_status' => null !== $app['authentication']->getUser()->getPrefs('client_basket_status') ? $app['authentication']->getUser()->getPrefs('client_basket_status') : "1", 'basket_status' => $app['authentication']->getUser()->getSettingValue('client_basket_status', '1'),
'mod_pres' => null !== $app['authentication']->getUser()->getPrefs('client_view') ? $app['authentication']->getUser()->getPrefs('client_view') : '', 'mod_pres' => $app['authentication']->getUser()->getSettingValue('client_view', '' ),
'start_page' => $app['authentication']->getUser()->getPrefs('start_page'), 'start_page' => $app['authentication']->getUser()->getSettingValue('start_page'),
'start_page_query' => null !== $app['authentication']->getUser()->getPrefs('start_page_query') ? $app['authentication']->getUser()->getPrefs('start_page_query') : '' 'start_page_query' => $app['authentication']->getUser()->getSettingValue('start_page_query', '')
])); )));
} }
/** /**
@@ -349,8 +349,8 @@ class Root implements ControllerProviderInterface
{ {
$cssPath = __DIR__ . '/../../../../../www/skins/client/'; $cssPath = __DIR__ . '/../../../../../www/skins/client/';
$css = []; $css = array();
$cssFile = $app['authentication']->getUser()->getPrefs('client_css'); $cssFile = $app['authentication']->getUser()->getSettingValue('client_css');
$finder = new Finder(); $finder = new Finder();
@@ -418,7 +418,7 @@ class Root implements ControllerProviderInterface
*/ */
private function getDefaultClientStartPage(Application $app) private function getDefaultClientStartPage(Application $app)
{ {
$startPage = strtoupper($app['authentication']->getUser()->getPrefs('start_page')); $startPage = strtoupper($app['authentication']->getUser()->getSettingValue('start_page'));
if ($startPage === 'PUBLI') { if ($startPage === 'PUBLI') {
return $this->getPublicationStartPage($app); return $this->getPublicationStartPage($app);
@@ -441,7 +441,7 @@ class Root implements ControllerProviderInterface
{ {
$collections = $queryParameters = []; $collections = $queryParameters = [];
$searchSet = json_decode($app['authentication']->getUser()->getPrefs('search')); $searchSet = json_decode($app['authentication']->getUser()->getSettingValue('search'));
if ($searchSet && isset($searchSet->bases)) { if ($searchSet && isset($searchSet->bases)) {
foreach ($searchSet->bases as $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()); $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["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["pag"] = 0;
$queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD; $queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD;
$queryParameters["qryAdv"] = ''; $queryParameters["qryAdv"] = '';
@@ -479,8 +479,8 @@ class Root implements ControllerProviderInterface
{ {
return $app['twig']->render('client/home_inter_pub_basket.html.twig', [ return $app['twig']->render('client/home_inter_pub_basket.html.twig', [
'feeds' => Aggregate::createFromUser($app, $app['authentication']->getUser()), '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')
]); ));
} }
/** /**

View File

@@ -52,7 +52,7 @@ class Query implements ControllerProviderInterface
{ {
$query = (string) $request->request->get('qry'); $query = (string) $request->request->get('qry');
$mod = $app['authentication']->getUser()->getPrefs('view'); $mod = $app['authentication']->getUser()->getSettingValue('view');
$json = []; $json = [];
@@ -60,7 +60,7 @@ class Query implements ControllerProviderInterface
$form = $options->serialize(); $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'); $page = (int) $request->request->get('pag');
$firstPage = $page < 1; $firstPage = $page < 1;
@@ -79,8 +79,8 @@ class Query implements ControllerProviderInterface
$app['EM']->persist($userQuery); $app['EM']->persist($userQuery);
$app['EM']->flush(); $app['EM']->flush();
if ($app['authentication']->getUser()->getPrefs('start_page') === 'LAST_QUERY') { if ($app['authentication']->getUser()->getSettingValue('start_page') === 'LAST_QUERY') {
$app['authentication']->getUser()->setPrefs('start_page_query', $result->getQuery()); $app['authentication']->getUser()->setSettingValue('start_page_query', $result->getQuery());
} }
foreach ($options->getDataboxes() as $databox) { foreach ($options->getDataboxes() as $databox) {

View File

@@ -65,7 +65,7 @@ class Root implements ControllerProviderInterface
$css[$baseName] = $baseName; $css[$baseName] = $baseName;
} }
$cssfile = $app['authentication']->getUser()->getPrefs('css'); $cssfile = $app['authentication']->getUser()->getSettingValue('css');
if (!$cssfile && isset($css['000000'])) { if (!$cssfile && isset($css['000000'])) {
$cssfile = '000000'; $cssfile = '000000';

View File

@@ -85,7 +85,7 @@ class Preferences implements ControllerProviderInterface
$success = false; $success = false;
if (null !== $prop && null !== $value) { if (null !== $prop && null !== $value) {
$app['authentication']->getUser()->setPrefs($prop, $value); $app['authentication']->getUser()->setSettingValue($prop, $value);
$success = true; $success = true;
$msg = $app->trans('Preference saved !'); $msg = $app->trans('Preference saved !');
} }

View File

@@ -62,7 +62,7 @@ class databox_cgu
if ( ! $app['acl']->get($app['authentication']->getUser())->has_access_to_sbas($databox->get_sbas_id())) { if ( ! $app['acl']->get($app['authentication']->getUser())->has_access_to_sbas($databox->get_sbas_id())) {
continue; 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) if ($userValidation)

View File

@@ -35,9 +35,8 @@ abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract
protected function get_prefs($class, $usr_id) protected function get_prefs($class, $usr_id)
{ {
$user = $this->app['manipulator.user']->getRepository()->find($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) protected function shouldSendNotificationFor($usr_id)

View File

@@ -154,7 +154,7 @@
{% for notification in nots %} {% for notification in nots %}
<li> <li>
<label class="checkbox" for="notif_{{ notification["id"] }}"> <label class="checkbox" for="notif_{{ notification["id"] }}">
<input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if not app["authentication"].getUser().get_notifications_preference(app, notification["id"]) == "0" %}checked{% endif %} value="1"/> <input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if app["authentication"].getUser().getNotificationSettingValue(notification["id"]) %}checked{% endif %} value="1"/>
{{ notification["description"] }} {{ notification["description"] }}
</label> </label>
<p class="form_alert help-block"></p> <p class="form_alert help-block"></p>

View File

@@ -2,7 +2,7 @@
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %} {% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div> <div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %} {% endfor %}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %} {% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}
<hr/> <hr/>
{% include 'common/technical_datas.html.twig' %} {% include 'common/technical_datas.html.twig' %}
{% endif %} {% endif %}

View File

@@ -2,7 +2,7 @@
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %} {% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div> <div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %} {% endfor %}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %} {% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}
<hr/> <hr/>
{% include 'common/technical_datas.html.twig' %} {% include 'common/technical_datas.html.twig' %}
{% endif %} {% endif %}

View File

@@ -2,7 +2,7 @@
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %} {% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness, options) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div> <div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %} {% endfor %}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %} {% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}
<hr/> <hr/>
{% include 'common/technical_datas.html.twig' %} {% include 'common/technical_datas.html.twig' %}
{% endif %} {% endif %}

View File

@@ -276,10 +276,10 @@
{% macro element(wz_scope, container, contained, record, ord) %} {% macro element(wz_scope, container, contained, record, ord) %}
{% set box_height = 110 %} {% set box_height = 110 %}
{% if app['authentication'].getUser().getPrefs('basket_title_display') == '1' %} {% if app['authentication'].getUser().getSettingValue('basket_title_display') == '1' %}
{% set box_height = (box_height + 20) %} {% set box_height = (box_height + 20) %}
{% endif %} {% endif %}
{% if app['authentication'].getUser().getPrefs('basket_status_display') == '1' %} {% if app['authentication'].getUser().getSettingValue('basket_status_display') == '1' %}
{% set box_height = (box_height + 20) %} {% set box_height = (box_height + 20) %}
{% endif %} {% endif %}
@@ -289,12 +289,12 @@
class="CHIM diapo CHIM_{{record.get_serialize_key()}}" style="height:{{box_height}}px;" class="CHIM diapo CHIM_{{record.get_serialize_key()}}" style="height:{{box_height}}px;"
id="CHIM_{% if wz_scope == 'groupings' %}{{record.get_serialize_key()}}{% else %}{{ contained.getId() }}{% endif %}"> id="CHIM_{% if wz_scope == 'groupings' %}{{record.get_serialize_key()}}{% else %}{{ contained.getId() }}{% endif %}">
<input type="hidden" name="id" value="{{ record.get_serialize_key() }}"/> <input type="hidden" name="id" value="{{ record.get_serialize_key() }}"/>
{% if app['authentication'].getUser().getPrefs('basket_title_display') == '1' %} {% if app['authentication'].getUser().getSettingValue('basket_title_display') == '1' %}
<div class="title"> <div class="title">
{{record.get_title()}} {{record.get_title()}}
</div> </div>
{% endif %} {% endif %}
{% if app['authentication'].getUser().getPrefs('basket_status_display') == '1' %} {% if app['authentication'].getUser().getSettingValue('basket_status_display') == '1' %}
<div class="status" style="position:relative;height:20px;overflow-y:visible;z-index:15;"> <div class="status" style="position:relative;height:20px;overflow-y:visible;z-index:15;">
{{record.get_status_icons|raw}} {{record.get_status_icons|raw}}
</div> </div>
@@ -317,7 +317,7 @@
class="WorkZoneElementRemover {{ wz_scope }}" title="{{ 'delete' | trans }}" > class="WorkZoneElementRemover {{ wz_scope }}" title="{{ 'delete' | trans }}" >
X X
</a> </a>
{% if app['authentication'].getUser().getPrefs('basket_caption_display') == '1' %} {% if app['authentication'].getUser().getSettingValue('basket_caption_display') == '1' %}
<div class="captionRolloverTips" tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'basket', 'number' : record.get_number() }) }}"></div> <div class="captionRolloverTips" tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'basket', 'number' : record.get_number() }) }}"></div>
{% endif %} {% endif %}
</div> </div>

View File

@@ -4,8 +4,8 @@
{% set cont_width = 130 %} {% set cont_width = 130 %}
{% set cont_height = 140 %} {% set cont_height = 140 %}
{% else %} {% else %}
{% set cont_width = app['authentication'].getUser().getPrefs('editing_images_size') %} {% set cont_width = app['authentication'].getUser().getSettingValue('editing_images_size') %}
{% set cont_height = app['authentication'].getUser().getPrefs('editing_images_size') %} {% set cont_height = app['authentication'].getUser().getSettingValue('editing_images_size') %}
{% endif %} {% endif %}
{% set i = record.get_number() %} {% set i = record.get_number() %}
@@ -71,8 +71,8 @@
{% trans %}prod::editing::fields: status{% endtrans %} {% trans %}prod::editing::fields: status{% endtrans %}
</div> </div>
{% set cssfile = '000000' %} {% set cssfile = '000000' %}
{% if app['authentication'].getUser().getPrefs('css') %} {% if app['authentication'].getUser().getSettingValue('css') %}
{% set cssfile = app['authentication'].getUser().getPrefs('css') %} {% set cssfile = app['authentication'].getUser().getSettingValue('css') %}
{% endif %} {% endif %}
{% for field in fields %} {% for field in fields %}
{% set i = field.get_id() %} {% set i = field.get_id() %}
@@ -127,7 +127,7 @@
<input style="font-size:2px; width:5px;" type="text" id="editFakefocus" /> <input style="font-size:2px; width:5px;" type="text" id="editFakefocus" />
</form> </form>
</div> </div>
<div id="EDIT_TOP" style="height:{{app['authentication'].getUser().getPrefs('editing_top_box')}}%;"> <div id="EDIT_TOP" style="height:{{app['authentication'].getUser().getSettingValue('editing_top_box')}};">
<div id="EDIT_MENU"> <div id="EDIT_MENU">
<div id="EDIT_ZOOMSLIDER" > <div id="EDIT_ZOOMSLIDER" >
</div> </div>
@@ -150,7 +150,7 @@
<div id='EDIT_MID'> <div id='EDIT_MID'>
<div id='EDIT_MID_L' class='ui-corner-all'> <div id='EDIT_MID_L' class='ui-corner-all'>
<div id="divS_wrapper" style="width:{{app['authentication'].getUser().getPrefs('editing_right_box')}}%"> <div id="divS_wrapper" style="width:{{app['authentication'].getUser().getSettingValue('editing_right_box')}}">
<div id="divS"> <div id="divS">
{{_self.HTML_fieldlist(recordsRequest, fields)}} {{_self.HTML_fieldlist(recordsRequest, fields)}}
</div> </div>
@@ -230,7 +230,7 @@
<div id="idExplain" class="PNB"></div> <div id="idExplain" class="PNB"></div>
</div> </div>
</div> </div>
<div id="EDIT_MID_R" style="width:{{app['authentication'].getUser().getPrefs('editing_left_box')}}%;"> <div id="EDIT_MID_R" style="width:{{app['authentication'].getUser().getSettingValue('editing_left_box')}}">
<div style='position:absolute; top:0; left:0; right:0; bottom:0;' class='tabs'> <div style='position:absolute; top:0; left:0; right:0; bottom:0;' class='tabs'>
<ul> <ul>
{% if thesaurus %} {% if thesaurus %}

View File

@@ -96,12 +96,12 @@
<style title="color_selection" type="text/css"> <style title="color_selection" type="text/css">
/* .diapo.ui-selecting,#reorder_box .diapo.selecting, #EDIT_ALL .diapo.selecting, .list.selecting, .list.selecting .diapo { /* .diapo.ui-selecting,#reorder_box .diapo.selecting, #EDIT_ALL .diapo.selecting, .list.selecting, .list.selecting .diapo {
color: #{% if app['authentication'].getUser().getPrefs('fontcolor-selection') != '' %}{{app['authentication'].getUser().getPrefs('fontcolor-selection')}}{% else %}FFFFFF{% endif %}; color: #{{ app['authentication'].getUser().getSettingValue('fontcolor-selection', 'FFFFFF') }};
background-color: #{% if app['authentication'].getUser().getPrefs('background-selection-disabled') != '' %}{{app['authentication'].getUser().getPrefs('background-selection-disabled')}}{% else %}333333{% endif %}; background-color: #{{ app['authentication'].getUser().getSettingValue('background-selection-disabled', '333333')}}};
}*/ }*/
.diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo { .diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo {
color: #{% if app['authentication'].getUser().getPrefs('fontcolor-selection') != '' %}{{app['authentication'].getUser().getPrefs('fontcolor-selection')}}{% else %}FFFFFF{% endif %}; color: #{{app['authentication'].getUser().getSettingValue('fontcolor-selection', 'FFFFFF')}};
background-color: #{% if app['authentication'].getUser().getPrefs('background-selection') != '' %}{{app['authentication'].getUser().getPrefs('background-selection')}}{% else %}404040{% endif %}; background-color: #{{app['authentication'].getUser().getSettingValue('background-selection', '404040')}};
} }
</style> </style>
{% endblock %} {% endblock %}
@@ -123,7 +123,7 @@
</div> </div>
<div id="desktop" class="PNB" style="overflow:hidden;"> <div id="desktop" class="PNB" style="overflow:hidden;">
{% set ratio = app['authentication'].getUser().getPrefs('search_window') %} {% set ratio = app['authentication'].getUser().getSettingValue('search_window') %}
{% if ratio == 0 %} {% if ratio == 0 %}
{% set ratio = '0.333' %} {% set ratio = '0.333' %}
{% endif %} {% endif %}
@@ -283,7 +283,7 @@
<div style="margin: 15px auto; line-height: 30px; width: 580px;"> <div style="margin: 15px auto; line-height: 30px; width: 580px;">
<form id="searchForm" method="POST" action="{{ path('prod_query') }}" name="phrasea_query" class="phrasea_query"> <form id="searchForm" method="POST" action="{{ path('prod_query') }}" name="phrasea_query" class="phrasea_query">
<div class="input-append"> <div class="input-append">
<input autocomplete="off" class="search query" id="EDIT_query" name="qry" type="text" name="qry" value="{{app['authentication'].getUser().getPrefs('start_page_query')}}"> <input autocomplete="off" class="search query" id="EDIT_query" name="qry" type="text" name="qry" value="{{app['authentication'].getUser().getSettingValue('start_page_query')}}">
<a href="#" class="btn btn-inverse adv_trigger adv_search_button"> <a href="#" class="btn btn-inverse adv_trigger adv_search_button">
<img src="/skins/icons/settings.png" title="{{ 'Advanced Search' | trans }}"/> <img src="/skins/icons/settings.png" title="{{ 'Advanced Search' | trans }}"/>
</a> </a>
@@ -680,11 +680,11 @@
<div id="answers" class=" PNB10" style="top:48px; bottom:30px;"> <div id="answers" class=" PNB10" style="top:48px; bottom:30px;">
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
{% if app['authentication'].getUser().getPrefs('start_page') == 'QUERY' %} {% if app['authentication'].getUser().getSettingValue('start_page') == 'QUERY' %}
$('form[name="phrasea_query"]').addClass('triggerAfterInit'); $('form[name="phrasea_query"]').addClass('triggerAfterInit');
{% elseif app['authentication'].getUser().getPrefs('start_page') == 'LAST_QUERY' %} {% elseif app['authentication'].getUser().getSettingValue('start_page') == 'LAST_QUERY' %}
$('form[name="phrasea_query"]').addClass('triggerAfterInit'); $('form[name="phrasea_query"]').addClass('triggerAfterInit');
{% elseif app['authentication'].getUser().getPrefs('start_page') == 'PUBLI' %} {% elseif app['authentication'].getUser().getSettingValue('start_page') == 'PUBLI' %}
getHome('PUBLI'); getHome('PUBLI');
{% endif %} {% endif %}
}); });
@@ -741,7 +741,7 @@
<div id="MESSAGE-push"></div> <div id="MESSAGE-push"></div>
<div id="MESSAGE-publi"></div> <div id="MESSAGE-publi"></div>
<div id="DIALOG"></div> <div id="DIALOG"></div>
<div id="keyboard-dialog" class="{% if app['authentication'].getUser().getPrefs('keyboard_infos') != '0' %}auto{% endif %}" style="display:none;" title="{{ 'raccourci :: a propos des raccourcis claviers' | trans }}"> <div id="keyboard-dialog" class="{% if app['authentication'].getUser().getSettingValue('keyboard_infos') != '0' %}auto{% endif %}" style="display:none;" title="{{ 'raccourci :: a propos des raccourcis claviers' | trans }}">
<div> <div>
<h1>{{ 'Raccourcis claviers en cours de recherche :' | trans }}</h1> <h1>{{ 'Raccourcis claviers en cours de recherche :' | trans }}</h1>
<ul> <ul>
@@ -813,6 +813,8 @@
</div> </div>
<div class="box"> <div class="box">
<div class="" style="float:left; width:49%;"> <div class="" style="float:left; width:49%;">
<h1>{{ 'Mode de presentation' | trans }}</h1>
{% set mod = app['authentication'].getUser().getSettingValue('view') %}
<h1>{{ 'Mode de presentation' | trans }}</h1> <h1>{{ 'Mode de presentation' | trans }}</h1>
{% set mod = app['authentication'].getUser().getPrefs('view') %} {% set mod = app['authentication'].getUser().getPrefs('view') %}
<label class="radio inline" for="thumbs_view"> <label class="radio inline" for="thumbs_view">
@@ -833,7 +835,7 @@
</div> </div>
</div> </div>
<div class="box"> <div class="box">
{% set rollover_thumbnail = app['authentication'].getUser().getPrefs('rollover_thumbnail') %} {% set rollover_thumbnail = app['authentication'].getUser().getSettingValue('rollover_thumbnail') %}
<h1>{{ 'Presentation de vignettes' | trans }}</h1> <h1>{{ 'Presentation de vignettes' | trans }}</h1>
<label class="radio" for="rollover_caption"> <label class="radio" for="rollover_caption">
<input onchange="setPref('rollover_thumbnail',$(this).val());" name="rollover_thumbnail" type="radio" class="radio" value="caption" id="rollover_caption" {% if rollover_thumbnail == 'caption' %}checked="checked" {% endif %}/> <input onchange="setPref('rollover_thumbnail',$(this).val());" name="rollover_thumbnail" type="radio" class="radio" value="caption" id="rollover_caption" {% if rollover_thumbnail == 'caption' %}checked="checked" {% endif %}/>
@@ -845,7 +847,7 @@
</label> </label>
</div> </div>
<div class="box"> <div class="box">
{% set technical_display = app['authentication'].getUser().getPrefs('technical_display') %} {% set technical_display = app['authentication'].getUser().getSettingValue('technical_display') %}
<h1>{{ 'Informations techniques' | trans }}</h1> <h1>{{ 'Informations techniques' | trans }}</h1>
<label class="radio" for="technical_show"> <label class="radio" for="technical_show">
<input onchange="setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="1" id="technical_show" {% if technical_display == '1' %}checked="checked"{% endif %}/> <input onchange="setPref('technical_display',$(this).val());" name="technical_display" type="radio" class="radio" value="1" id="technical_show" {% if technical_display == '1' %}checked="checked"{% endif %}/>
@@ -861,7 +863,7 @@
</label> </label>
</div> </div>
<div class="box"> <div class="box">
{% set doctype_display = app['authentication'].getUser().getPrefs('doctype_display') %} {% set doctype_display = app['authentication'].getUser().getSettingValue('doctype_display') %}
<h1>{{ 'Type de documents' | trans }}</h1> <h1>{{ 'Type de documents' | trans }}</h1>
<label class="checkbox" for="doctype_display_show"> <label class="checkbox" for="doctype_display_show">
<input onchange="setPref('doctype_display',($(this).attr('checked') ? '1' :'0'));" name="doctype_display" type="checkbox" class="checkbox" value="1" id="doctype_display_show" {% if doctype_display != '0' %}checked="checked"{% endif %}/> <input onchange="setPref('doctype_display',($(this).attr('checked') ? '1' :'0'));" name="doctype_display" type="checkbox" class="checkbox" value="1" id="doctype_display_show" {% if doctype_display != '0' %}checked="checked"{% endif %}/>
@@ -874,14 +876,14 @@
<h1>{{ 'reponses:: images par pages :' | trans }}</h1> <h1>{{ 'reponses:: images par pages :' | trans }}</h1>
<div class="box"> <div class="box">
<div id="nperpage_slider" class="ui-corner-all" style="width:100px; display:inline-block;"></div> <div id="nperpage_slider" class="ui-corner-all" style="width:100px; display:inline-block;"></div>
<input type="text" readonly style="width:35px;" value="{{app['authentication'].getUser().getPrefs('images_per_page')}}" id="nperpage_value"/> <input type="text" readonly style="width:35px;" value="{{app['authentication'].getUser().getSettingValue('images_per_page')}}" id="nperpage_value"/>
</div> </div>
</div> </div>
<div style="float:right; width:49%;"> <div style="float:right; width:49%;">
<h1>{{ 'reponses:: taille des images :' | trans }}</h1> <h1>{{ 'reponses:: taille des images :' | trans }}</h1>
<div class="box"> <div class="box">
<div id="sizeAns_slider" class="ui-corner-all" style="width:100px;display:inline-block;"></div> <div id="sizeAns_slider" class="ui-corner-all" style="width:100px;display:inline-block;"></div>
<input type="hidden" value="{{app['authentication'].getUser().getPrefs('images_size')}}" id="sizeAns_value"/> <input type="hidden" value="{{app['authentication'].getUser().getSettingValue('images_size')}}" id="sizeAns_value"/>
</div> </div>
</div> </div>
</div> </div>
@@ -897,7 +899,7 @@
<div class="box"> <div class="box">
<h1>{{ 'Affichage au demarrage' | trans }}</h1> <h1>{{ 'Affichage au demarrage' | trans }}</h1>
<form class="form-inline"> <form class="form-inline">
{% set start_page_pref = app['authentication'].getUser().getPrefs('start_page') %} {% set start_page_pref = app['authentication'].getUser().getSettingValue('start_page') %}
<select class="span4" name="start_page" onchange="start_page_selector();"> <select class="span4" name="start_page" onchange="start_page_selector();">
<option value="LAST_QUERY" {% if start_page_pref == 'LAST_QUERY' %}selected="selected"{% endif %} > <option value="LAST_QUERY" {% if start_page_pref == 'LAST_QUERY' %}selected="selected"{% endif %} >
{{ 'Ma derniere question' | trans }} {{ 'Ma derniere question' | trans }}
@@ -912,7 +914,7 @@
{{ 'Aide' | trans }} {{ 'Aide' | trans }}
</option> </option>
</select> </select>
<input type="text" class="span4" name="start_page_value" value="{{app['authentication'].getUser().getPrefs('start_page_query')}}" style="display:{% if start_page_pref == 'QUERY' %}inline{% else %}none{% endif %}" /> <input type="text" class="span4" name="start_page_value" value="{{app['authentication'].getUser().getSettingValue('start_page_query')}}" style="display:{% if start_page_pref == 'QUERY' %}inline{% else %}none{% endif %}" />
<input type="button" class="btn btn-inverse" value="{{ 'boutton::valider' | trans }}" onclick="set_start_page();" /> <input type="button" class="btn btn-inverse" value="{{ 'boutton::valider' | trans }}" onclick="set_start_page();" />
</form> </form>
</div> </div>
@@ -982,7 +984,7 @@
<div class="box"> <div class="box">
<h1>{{ 'Presentation de vignettes de panier' | trans }}</h1> <h1>{{ 'Presentation de vignettes de panier' | trans }}</h1>
<div> <div>
{% set basket_status_display = app['authentication'].getUser().getPrefs('basket_status_display') %} {% set basket_status_display = app['authentication'].getUser().getSettingValue('basket_status_display') %}
<label for="basket_status_display" class="checkbox"> <label for="basket_status_display" class="checkbox">
<input onchange="setPref('basket_status_display',($(this).attr('checked') ? '1' :'0'));" <input onchange="setPref('basket_status_display',($(this).attr('checked') ? '1' :'0'));"
name="basket_status_display" type="checkbox" class="checkbox" value="1" name="basket_status_display" type="checkbox" class="checkbox" value="1"
@@ -991,7 +993,7 @@
</label> </label>
</div> </div>
<div> <div>
{% set basket_caption_display = app['authentication'].getUser().getPrefs('basket_caption_display') %} {% set basket_caption_display = app['authentication'].getUser().getSettingValue('basket_caption_display') %}
<label for="basket_caption_display" class="checkbox"> <label for="basket_caption_display" class="checkbox">
<input onchange="setPref('basket_caption_display',($(this).attr('checked') ? '1' :'0'));" <input onchange="setPref('basket_caption_display',($(this).attr('checked') ? '1' :'0'));"
name="basket_caption_display" type="checkbox" class="checkbox" value="1" name="basket_caption_display" type="checkbox" class="checkbox" value="1"
@@ -1000,7 +1002,7 @@
</label> </label>
</div> </div>
<div> <div>
{% set basket_title_display = app['authentication'].getUser().getPrefs('basket_title_display') %} {% set basket_title_display = app['authentication'].getUser().getSettingValue('basket_title_display') %}
<label for="basket_title_display" class="checkbox"> <label for="basket_title_display" class="checkbox">
<input onchange="setPref('basket_title_display',($(this).attr('checked') ? '1' :'0'));" <input onchange="setPref('basket_title_display',($(this).attr('checked') ? '1' :'0'));"
name="basket_title_display" type="checkbox" class="checkbox" value="1" name="basket_title_display" type="checkbox" class="checkbox" value="1"
@@ -1022,7 +1024,7 @@
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'prod' }) }}"></script> <script type="text/javascript" src="{{ path('minifier', { 'g' : 'prod' }) }}"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
p4.reg_delete="{% if app['authentication'].getUser().getPrefs("warning_on_delete_story") %}true{% else %}false{% endif %}"; p4.reg_delete="{% if app['authentication'].getUser().getSettingValue("warning_on_delete_story") %}true{% else %}false{% endif %}";
}); });
function sessionactive(){ function sessionactive(){

View File

@@ -13,7 +13,7 @@
{% trans with {'%link%' : link} %}Voulez-vous dire %link% ?{% endtrans %} {% trans with {'%link%' : link} %}Voulez-vous dire %link% ?{% endtrans %}
<br/> <br/>
{% endif %} {% endif %}
{% set th_size = app['authentication'].getUser().getPrefs('images_size')%} {% set th_size = app['authentication'].getUser().getSettingValue('images_size')%}
<div class="selectable" style="margin:10px 0; float:left;"> <div class="selectable" style="margin:10px 0; float:left;">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>

View File

@@ -16,7 +16,7 @@
<div class="fixeddesc"> <div class="fixeddesc">
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord') %} {% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord') %}
{{caption.format_caption(record, highlight, searchEngine, searchOptions, business)}} {{caption.format_caption(record, highlight, searchEngine, searchOptions, business)}}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %}<hr/>{{record.get_technical_infos|raw}}{% endif %} {% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}<hr/>{{record.get_technical_infos|raw}}{% endif %}
</div> </div>
</div> </div>
</td> </td>

View File

@@ -18,7 +18,7 @@
<br/> <br/>
{% endif %} {% endif %}
{% set th_size = app['authentication'].getUser().getPrefs('images_size')%} {% set th_size = app['authentication'].getUser().getSettingValue('images_size')%}
{% if app['locale'] == 'fr' %} {% if app['locale'] == 'fr' %}
<div class="client_help"> <div class="client_help">

View File

@@ -2,7 +2,7 @@
{% import 'common/thumbnail.html.twig' as thumbnail %} {% import 'common/thumbnail.html.twig' as thumbnail %}
{% import 'common/doctype_icons.html.twig' as doctype_icons %} {% import 'common/doctype_icons.html.twig' as doctype_icons %}
{% import 'common/drop_down_options.html.twig' as drop_down %} {% import 'common/drop_down_options.html.twig' as drop_down %}
{% set th_size = app['authentication'].getUser().getPrefs('images_size')%} {% set th_size = app['authentication'].getUser().getSettingValue('images_size')%}
{% set sbas_id = record.get_sbas_id %} {% set sbas_id = record.get_sbas_id %}
{% if entry_id %} {% if entry_id %}
<div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}" <div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
@@ -31,8 +31,8 @@
</div> </div>
{% set rollover_gif = record.get_rollover_thumbnail() %} {% set rollover_gif = record.get_rollover_thumbnail() %}
{% set user_technical_display = app['authentication'].getUser().getPrefs('technical_display') %} {% set user_technical_display = app['authentication'].getUser().getSettingValue('technical_display') %}
{% set user_rollover_thumbnail = app['authentication'].getUser().getPrefs('rollover_thumbnail') %} {% set user_rollover_thumbnail = app['authentication'].getUser().getSettingValue('rollover_thumbnail') %}
{% set extraclass = '' %} {% set extraclass = '' %}
{% if user_rollover_thumbnail == 'caption' and searchEngine is not null %} {% if user_rollover_thumbnail == 'caption' and searchEngine is not null %}
@@ -47,7 +47,7 @@
{% endif %} {% endif %}
<div class="thumb {{extraclass}} " tooltipsrc="{{tooltipsrc}}" style="height:{{th_size}}px; z-index:90;"> <div class="thumb {{extraclass}} " tooltipsrc="{{tooltipsrc}}" style="height:{{th_size}}px; z-index:90;">
<div class="doc_infos"> <div class="doc_infos">
{% if app['authentication'].getUser().getPrefs('doctype_display') == '1' %} {% if app['authentication'].getUser().getSettingValue('doctype_display') == '1' %}
{{doctype_icons.format(record)}} {{doctype_icons.format(record)}}
{% endif %} {% endif %}
<span class="duration"> <span class="duration">

View File

@@ -61,15 +61,15 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testExecuteQuery() public function testExecuteQuery()
{ {
$queryParameters = []; $queryParameters = array();
$queryParameters["mod"] = self::$DI['user']->getPrefs('client_view') ? : '3X6'; $queryParameters["mod"] = self::$DI['user']->getSettingValue('client_view', '3X6');
$queryParameters["bas"] = array_keys(self::$DI['app']['acl']->get(self::$DI['user'])->get_granted_base()); $queryParameters["bas"] = array_keys(self::$DI['app']['acl']->get(self::$DI['user'])->get_granted_base());
$queryParameters["qry"] = self::$DI['user']->getPrefs('start_page_query') ? : 'all'; $queryParameters["qry"] = self::$DI['user']->getSettingValue('start_page_query', 'all');
$queryParameters["pag"] = 0; $queryParameters["pag"] = 0;
$queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD; $queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD;
$queryParameters["qryAdv"] = ''; $queryParameters["qryAdv"] = '';
$queryParameters["opAdv"] = []; $queryParameters["opAdv"] = array();
$queryParameters["status"] = []; $queryParameters["status"] = array();
$queryParameters["recordtype"] = SearchEngineOptions::TYPE_ALL; $queryParameters["recordtype"] = SearchEngineOptions::TYPE_ALL;
$queryParameters["sort"] = ''; $queryParameters["sort"] = '';
$queryParameters["infield"] = []; $queryParameters["infield"] = [];

View File

@@ -12,12 +12,12 @@ class PreferencesTest extends \PhraseanetAuthenticatedWebTestCase
public function testSaveUserPref() public function testSaveUserPref()
{ {
self::$DI['app']['authentication']->setUser($this->getMockBuilder('Alchemy\Phrasea\Model\Entities\User') self::$DI['app']['authentication']->setUser($this->getMockBuilder('Alchemy\Phrasea\Model\Entities\User')
->setMethods(array('setPrefs')) ->setMethods(array('setSettingValue'))
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock()); ->getMock());
self::$DI['app']['authentication']->getUser()->expects($this->once()) self::$DI['app']['authentication']->getUser()->expects($this->once())
->method('setPrefs') ->method('setSettingValue')
->with($this->equalTo('prop_test'), $this->equalTo('val_test')) ->with($this->equalTo('prop_test'), $this->equalTo('val_test'))
->will($this->returnValue(true)); ->will($this->returnValue(true));

View File

@@ -73,9 +73,9 @@ class userTest extends \PhraseanetTestCase
{ {
$user = $this->get_user(); $user = $this->get_user();
$this->assertNull($user->getPrefs('lalala')); $this->assertNull($user->getSettingValue('lalala'));
$this->assertSame('popo', $user->getPrefs('lalala', 'popo')); $this->assertSame('popo', $user->getSettingValue('lalala', 'popo'));
$this->assertSame(User::$defaultUserSettings['editing_top_box'], $user->getPrefs('editing_top_box')); $this->assertSame(User::$defaultUserSettings['editing_top_box'], $user->getSettingValue('editing_top_box'));
} }
public function testGetPrefWithACustomizedConf() public function testGetPrefWithACustomizedConf()
@@ -109,26 +109,26 @@ class userTest extends \PhraseanetTestCase
{ {
$user = $this->get_user(); $user = $this->get_user();
$user->setPrefs('prout', 'pooop'); $user->setSettingValue('prout', 'pooop');
$this->assertSame('pooop', $user->getPrefs('prout')); $this->assertSame('pooop', $user->getSettingValue('prout'));
} }
public function testGetNotificationPref() public function testGetNotificationPref()
{ {
$user = $this->get_user(); $user = $this->get_user();
$this->assertSame('1', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push')); $this->assertSame('1', $user->getNotificationSettingValue('eventsmanager_notify_push'));
} }
public function testNotificationPref() public function testNotificationPref()
{ {
$user = $this->get_user(); $user = $this->get_user();
$this->assertSame('1', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push')); $this->assertSame('1', $user->getNotificationSettingValue('eventsmanager_notify_push'));
$user->set_notification_preference(self::$DI['app'], 'eventsmanager_notify_push', false); $user->setNotificationSettingValue('eventsmanager_notify_push', false);
$this->assertSame('0', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push')); $this->assertSame('0', $user->getNotificationSettingValue('eventsmanager_notify_push'));
$user->set_notification_preference(self::$DI['app'], 'eventsmanager_notify_push', true); $user->setNotificationSettingValue('eventsmanager_notify_push', true);
$this->assertSame('1', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push')); $this->assertSame('1', $user->getNotificationSettingValue('eventsmanager_notify_push'));
} }
private function get_user() private function get_user()