Fix settings

This commit is contained in:
Nicolas Le Goff
2013-12-04 18:18:39 +01:00
parent ed4ae71819
commit 4cc82af980
33 changed files with 186 additions and 232 deletions

View File

@@ -97,8 +97,8 @@ class Root implements ControllerProviderInterface
$app['EM']->persist($userQuery);
$app['EM']->flush();
if ($app['authentication']->getUser()->getSettingValue('start_page') === 'LAST_QUERY') {
$app['authentication']->getUser()->setSettingValue('start_page_query', $query);
if ($app['settings']->getUserSetting($app['authentication']->getUser(), 'start_page') === 'LAST_QUERY') {
$app['manipulator.user']->setUserSetting($app['authentication']->getUser(), 'start_page_query', $query);
}
foreach ($options->getDataboxes() as $databox) {
@@ -263,10 +263,10 @@ class Root implements ControllerProviderInterface
'module' => 'client',
'menubar' => $app['twig']->render('common/menubar.html.twig', ['module' => 'client']),
'css_file' => $this->getCssFile($app),
'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', '')
'basket_status' => $app['settings']->getUserSetting($app['authentication']->getUser(), 'client_basket_status', '1'),
'mod_pres' => $app['settings']->getUserSetting($app['authentication']->getUser(), 'client_view', '' ),
'start_page' => $app['settings']->getUserSetting($app['authentication']->getUser(), 'start_page'),
'start_page_query' => $app['settings']->getUserSetting($app['authentication']->getUser(), 'start_page_query', '')
]));
}
@@ -350,7 +350,7 @@ class Root implements ControllerProviderInterface
$cssPath = __DIR__ . '/../../../../../www/skins/client/';
$css = [];
$cssFile = $app['authentication']->getUser()->getSettingValue('client_css');
$cssFile = $app['settings']->getUserSetting($app['authentication']->getUser(), 'client_css');
$finder = new Finder();
@@ -418,7 +418,7 @@ class Root implements ControllerProviderInterface
*/
private function getDefaultClientStartPage(Application $app)
{
$startPage = strtoupper($app['authentication']->getUser()->getSettingValue('start_page'));
$startPage = strtoupper($app['settings']->getUserSetting($app['authentication']->getUser(), '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()->getSettingValue('search'));
$searchSet = json_decode($app['settings']->getUserSetting($app['authentication']->getUser(), '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()->getSettingValue('client_view', '3X6');
$queryParameters["mod"] = $app['settings']->getUserSetting($app['authentication']->getUser(), 'client_view', '3X6');
$queryParameters["bas"] = $collections;
$queryParameters["qry"] = $app['authentication']->getUser()->getSettingValue('start_page_query', 'all');
$queryParameters["qry"] = $app['settings']->getUserSetting($app['authentication']->getUser(), 'start_page_query', 'all');
$queryParameters["pag"] = 0;
$queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD;
$queryParameters["qryAdv"] = '';
@@ -479,7 +479,7 @@ 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()->getSettingValue('images_size')
'image_size' => (int) $app['settings']->getUserSetting($app['authentication']->getUser(), 'images_size')
]);
}

View File

@@ -52,7 +52,7 @@ class Query implements ControllerProviderInterface
{
$query = (string) $request->request->get('qry');
$mod = $app['authentication']->getUser()->getSettingValue('view');
$mod = $app['settings']->getUserSetting($app['authentication']->getUser(), 'view');
$json = [];
@@ -60,7 +60,7 @@ class Query implements ControllerProviderInterface
$form = $options->serialize();
$perPage = (int) $app['authentication']->getUser()->getSettingValue('images_per_page');
$perPage = (int) $app['settings']->getUserSetting($app['authentication']->getUser(), 'images_per_page');
$page = (int) $request->request->get('pag');
$firstPage = $page < 1;
@@ -72,15 +72,10 @@ class Query implements ControllerProviderInterface
$result = $app['phraseanet.SE']->query($query, (($page - 1) * $perPage), $perPage, $options);
$userQuery = new UserQuery();
$userQuery->setUser($app['authentication']->getUser());
$userQuery->setQuery($result->getQuery());
$app['manipulator.user']->logQuery($app['authentication']->getUser(), $result->getQuery());
$app['EM']->persist($userQuery);
$app['EM']->flush();
if ($app['authentication']->getUser()->getSettingValue('start_page') === 'LAST_QUERY') {
$app['authentication']->getUser()->setSettingValue('start_page_query', $result->getQuery());
if ($app['settings']->getUserSetting($app['authentication']->getUser(), 'start_page') === 'LAST_QUERY') {
$app['manipulator.user']->setUserSetting($app['authentication']->getUser(), 'start_page_query', $result->getQuery());
}
foreach ($options->getDataboxes() as $databox) {

View File

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

View File

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

View File

@@ -91,6 +91,26 @@ class DisplaySettingService
return $user->getSettings()->get($name)->getValue();
}
/**
* Return a user notification setting given a user.
*
* @param User $user
* @param string $name
* @param mixed $default
*
* @return mixed
*/
public function getUserNotificationSetting(User $user, $name, $default = false)
{
if (false === $user->getNotificationSettings()->containsKey($name)) {
return $default;
}
return $user->getUserNotificationSetting()->get($name)->getValue();
}
/**
* Returns application setting value.
*

View File

@@ -992,34 +992,6 @@ class User
return $this;
}
/**
* Sets the value of a user setting.
*
* @param $name
* @param $value
*
* @return $this
*/
public function setSettingValue($name, $value)
{
foreach ($this->settings as $setting) {
if ($name === $setting->getName()) {
$setting->setValue($value);
$this->cachedSettings = null;
return $this;
}
}
$setting = new UserSetting();
$setting->setName($name);
$setting->setValue($value);
$this->cachedSettings = null;
return $this;
}
/**
* @return ArrayCollection
*/
@@ -1040,51 +1012,6 @@ class User
return $this;
}
/**
* Sets the value of a notification setting.
*
* @param $name
* @param $value
*
* @return $this
*/
public function setNotificationSettingValue($name, $value)
{
foreach ($this->notificationSettings as $setting) {
if ($name === $setting->getName()) {
$setting->setValue((Boolean) $value);
return $this;
}
}
$notificationSetting = new UserNotificationSetting();
$notificationSetting->setName($name);
$notificationSetting->setValue((Boolean) $value);
$this->notificationSettings->add($notificationSetting);
return $this;
}
/**
* Retrieves user notification setting value.
*
* @param $name
*
* @return boolean
*/
public function getNotificationSettingValue($name)
{
foreach ($this->notificationSettings as $setting) {
if ($name === $setting->getName()) {
return (Boolean) $setting->getValue();
}
}
return true;
}
/**
* @return boolean
*/

View File

@@ -184,13 +184,17 @@ class UserManipulator implements ManipulatorInterface
* @param string $name
* @param string $value
*/
public function addUserSetting(User $user, $name, $value)
public function setUserSetting(User $user, $name, $value)
{
if ($user->getSettings()->containsKey($name)) {
$user->getSettings()->get($name)->setValue($value);
} else {
$userSetting = new UserSetting();
$userSetting->setUser($user);
$userSetting->setName($name);
$userSetting->setValue($value);
$user->addSetting($userSetting);
}
$this->manager->update($user);
}
@@ -202,13 +206,17 @@ class UserManipulator implements ManipulatorInterface
* @param string $name
* @param string $value
*/
public function addNotificationSetting(User $user, $name, $value)
public function setNotificationSetting(User $user, $name, $value)
{
$notifSetting = new UserNotificationSetting();
$notifSetting->setName($name);
$notifSetting->setValue($value);
$notifSetting->setUser($user);
$user->addNotificationSettings($notifSetting);
if ($user->getNotificationSettings()->containsKey($name)) {
$user->getNotificationSettings()->get($name)->setValue((Boolean) $value);
} else {
$userSetting = new UserNotificationSetting();
$userSetting->setUser($user);
$userSetting->setName($name);
$userSetting->setValue($value);
$user->addNotificationSettings($userSetting);
}
$this->manager->update($user);
}

View File

@@ -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()->getSettingValue('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== '');
$userValidation = ($app['settings']->getUserSetting($app['authentication']->getUser(), 'terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== '');
}
if ($userValidation)

View File

@@ -32,15 +32,10 @@ abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract
abstract public function icon_url();
protected function get_prefs($class, $usr_id)
protected function shouldSendNotificationFor($usrId)
{
$user = $this->app['manipulator.user']->getRepository()->find($usr_id);
$user = $this->app['manipulator.user']->getRepository()->find($usrId);
return $user->getNotificationSettingValue($class);
}
protected function shouldSendNotificationFor($usr_id)
{
return 0 !== (int) $this->get_prefs(get_class($this), $usr_id);
return $this->app['settings']->getUserNotificationSetting($user, get_class($this));
}
}

View File

@@ -154,7 +154,7 @@
{% for notification in nots %}
<li>
<label class="checkbox" for="notif_{{ notification["id"] }}">
<input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if app["authentication"].getUser().getNotificationSettingValue(notification["id"]) %}checked{% endif %} value="1"/>
<input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if app['settings'].getUserNotificationSetting(app["authentication"].getUser(), notification["id"]) %}checked{% endif %} value="1"/>
{{ notification["description"] }}
</label>
<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) %}
<div class="desc{% if loop.index is odd %}im{% endif %}pair"><b>{{ value.label }}</b> : {{ value.value | thesaurus }}</div>
{% endfor %}
{% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}

View File

@@ -2,7 +2,7 @@
{% 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>
{% endfor %}
{% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}

View File

@@ -2,7 +2,7 @@
{% 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>
{% endfor %}
{% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}
<hr/>
{% include 'common/technical_datas.html.twig' %}
{% endif %}

View File

@@ -276,10 +276,10 @@
{% macro element(wz_scope, container, contained, record, ord) %}
{% set box_height = 110 %}
{% if app['authentication'].getUser().getSettingValue('basket_title_display') == '1' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'basket_title_display') == '1' %}
{% set box_height = (box_height + 20) %}
{% endif %}
{% if app['authentication'].getUser().getSettingValue('basket_status_display') == '1' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'basket_status_display') == '1' %}
{% set box_height = (box_height + 20) %}
{% endif %}
@@ -289,12 +289,12 @@
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 %}">
<input type="hidden" name="id" value="{{ record.get_serialize_key() }}"/>
{% if app['authentication'].getUser().getSettingValue('basket_title_display') == '1' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'basket_title_display') == '1' %}
<div class="title">
{{record.get_title()}}
</div>
{% endif %}
{% if app['authentication'].getUser().getSettingValue('basket_status_display') == '1' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'basket_status_display') == '1' %}
<div class="status" style="position:relative;height:20px;overflow-y:visible;z-index:15;">
{{record.get_status_icons|raw}}
</div>
@@ -317,7 +317,7 @@
class="WorkZoneElementRemover {{ wz_scope }}" title="{{ 'delete' | trans }}" >
X
</a>
{% if app['authentication'].getUser().getSettingValue('basket_caption_display') == '1' %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), '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>
{% endif %}
</div>

View File

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

View File

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

View File

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

View File

@@ -16,7 +16,7 @@
<div class="fixeddesc">
{% 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)}}
{% if app['authentication'].getUser().getSettingValue('technical_display') == 'group' %}<hr/>{{record.get_technical_infos|raw}}{% endif %}
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %}<hr/>{{record.get_technical_infos|raw}}{% endif %}
</div>
</div>
</td>

View File

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

View File

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

View File

@@ -321,6 +321,7 @@ class LightboxTest extends \PhraseanetAuthenticatedWebTestCase
$validationBasket = self::$DI['app']['EM']->find('Phraseanet:Basket', 4);
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoValidationDone');
$this->mockUserNotificationSettings('eventsmanager_notify_validationdone');
foreach ($validationBasket->getElements() as $element) {
$element->getUserValidationDatas(self::$DI['user'], self::$DI['app'])->setAgreement(true);

View File

@@ -45,6 +45,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
public function testRouteRightsApply()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailSuccessEmailUpdate', 2);
$user = self::$DI['app']['manipulator.user']->createUser(uniqid('user_'), 'test');
self::$DI['client']->request('POST', '/admin/users/rights/apply/', [

View File

@@ -62,9 +62,9 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testExecuteQuery()
{
$queryParameters = [];
$queryParameters["mod"] = self::$DI['user']->getSettingValue('client_view', '3X6');
$queryParameters["mod"] = self::$DI['app']['settings']->getUserSetting(self::$DI['user'], 'client_view', '3X6');
$queryParameters["bas"] = array_keys(self::$DI['app']['acl']->get(self::$DI['user'])->get_granted_base());
$queryParameters["qry"] = self::$DI['user']->getSettingValue('start_page_query', 'all');
$queryParameters["qry"] = self::$DI['app']['settings']->getUserSetting(self::$DI['user'], 'start_page_query', 'all');
$queryParameters["pag"] = 0;
$queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD;
$queryParameters["qryAdv"] = '';

View File

@@ -4,6 +4,7 @@ namespace Alchemy\Tests\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Model\Entities\Order;
use Alchemy\Phrasea\Model\Entities\OrderElement;
use Alchemy\Phrasea\Application as SilexApplication;
class OrderTest extends \PhraseanetAuthenticatedWebTestCase
{
@@ -102,6 +103,7 @@ class OrderTest extends \PhraseanetAuthenticatedWebTestCase
$order = $this->createOneOrder('I need this pictures');
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoOrderDelivered');
$this->mockUserNotificationSettings('eventsmanager_notify_orderdeliver');
$parameters = [];
foreach ($order->getElements() as $element) {
@@ -122,13 +124,13 @@ class OrderTest extends \PhraseanetAuthenticatedWebTestCase
$order = $this->createOneOrder('I need this pictures');
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoOrderDelivered');
$this->mockUserNotificationSettings('eventsmanager_notify_orderdeliver');
$parameters = [];
foreach ($order->getElements() as $element) {
$parameters[] = $element->getId();
}
$this->XMLHTTPRequest('POST', '/prod/order/' . $order->getId() . '/send/', ['elements' => $parameters]);
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals('application/json', $response->headers->get('Content-Type'));
@@ -148,6 +150,7 @@ class OrderTest extends \PhraseanetAuthenticatedWebTestCase
$order = $this->createOneOrder('I need this pictures');
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoOrderCancelled');
$this->mockUserNotificationSettings('eventsmanager_notify_ordernotdelivered');
$parameters = [];
foreach ($order->getElements() as $element) {
@@ -168,6 +171,7 @@ class OrderTest extends \PhraseanetAuthenticatedWebTestCase
$order = $this->createOneOrder('I need this pictures');
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoOrderCancelled');
$this->mockUserNotificationSettings('eventsmanager_notify_ordernotdelivered');
$parameters = [];
foreach ($order->getElements() as $element) {
@@ -190,6 +194,7 @@ class OrderTest extends \PhraseanetAuthenticatedWebTestCase
$order = $this->createOneOrder('I need this pictures');
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoOrderDelivered');
$this->mockUserNotificationSettings('eventsmanager_notify_orderdeliver');
$parameters = [];
foreach ($order->getElements() as $element) {

View File

@@ -36,6 +36,7 @@ class PushTest extends \PhraseanetAuthenticatedWebTestCase
public function testRoutePOSTsend()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoPushReceived', 2);
$this->mockUserNotificationSettings('eventsmanager_notify_push');
$route = '/prod/push/send/';
@@ -68,6 +69,7 @@ class PushTest extends \PhraseanetAuthenticatedWebTestCase
public function testRoutePOSTvalidate()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoValidationRequest', 3);
$this->mockUserNotificationSettings('eventsmanager_notify_validate');
$route = '/prod/push/validate/';

View File

@@ -143,6 +143,7 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
public function testUploadingTwiceTheSameRecordShouldSendToQuantantine()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailInfoRecordQuarantined');
$this->mockUserNotificationSettings('eventsmanager_notify_uploadquarantine');
$params = [
'base_id' => self::$DI['collection']->get_base_id()

View File

@@ -197,11 +197,12 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
}
/**
* @covers \Alchemy\Phrasea\Controller\Root\Login::registerConfirm
* @environment prod
*/
public function testRegisterConfirmMail()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailSuccessEmailConfirmationRegistered');
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$this->logout(self::$DI['app']);
$email = $this->generateEmail();
@@ -221,11 +222,12 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
}
/**
* @covers \Alchemy\Phrasea\Controller\Root\Login::registerConfirm
* @environment prod
*/
public function testRegisterConfirmMailNoCollAwait()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailSuccessEmailConfirmationUnregistered');
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$user = self::$DI['app']['manipulator.user']->createUser(uniqid('user_'), "test", 'email-random'.mt_rand().'@phraseanet.com');
@@ -280,11 +282,12 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
}
/**
* @covers \Alchemy\Phrasea\Controller\Root\Login::renewPassword
* @environment prod
*/
public function testRenewPasswordMail()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRequestPasswordUpdate');
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$this->logout(self::$DI['app']);
self::$DI['client']->request('POST', '/login/forgot-password/', [
@@ -457,9 +460,13 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertFlashMessage($crawler, 'error', 1);
}
/**
* @environment prod
*/
public function testForgotPasswordSubmission()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRequestPasswordUpdate');
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$this->logout(self::$DI['app']);
$crawler = self::$DI['client']->request('POST', '/login/forgot-password/', [
@@ -944,7 +951,6 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
}
/**
*
* @environment prod
*/
public function testPostRegisterWithProviderIdAndAccountNotCreatedYet()
@@ -959,6 +965,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
];
$this->mockNotificationsDeliverer($emails);
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$parameters = array_merge(['_token' => 'token'], [
"password" => [
@@ -1062,6 +1069,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
];
$this->mockNotificationsDeliverer($emails);
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$parameters = array_merge(['_token' => 'token'], $parameters);
foreach ($parameters as $key => $parameter) {
@@ -1117,11 +1125,12 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
}
/**
* @covers \Alchemy\Phrasea\Controller\Root\Login::sendConfirmMail
* @environment prod
*/
public function testSendConfirmMail()
{
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailRequestEmailConfirmation');
$this->mockUserNotificationSettings('eventsmanager_notify_register');
$this->logout(self::$DI['app']);
self::$DI['client']->request('GET', '/login/send-mail-confirm/', ['usr_id' => self::$DI['user']->getId()]);

View File

@@ -12,14 +12,19 @@ class PreferencesTest extends \PhraseanetAuthenticatedWebTestCase
public function testSaveUserPref()
{
self::$DI['app']['authentication']->setUser($this->getMockBuilder('Alchemy\Phrasea\Model\Entities\User')
->setMethods(['setSettingValue'])
->setMethods(['addSetting'])
->disableOriginalConstructor()
->getMock());
self::$DI['app']['authentication']->getUser()->expects($this->once())
->method('setSettingValue')
->with($this->equalTo('prop_test'), $this->equalTo('val_test'))
->will($this->returnValue(true));
self::$DI['app']['manipulator.user'] = $this->getMockBuilder('Alchemy\Phrasea\Model\Manipulator\User')
->setMethods(['setUserSetting'])
->disableOriginalConstructor()
->getMock();
self::$DI['app']['manipulator.user']->expects($this->once())
->method('setUserSetting')
->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\User'), $this->equalTo('prop_test'), $this->equalTo('val_test'))
->will($this->returnValue(null));
$this->XMLHTTPRequest('POST', '/user/preferences/', ['prop' => 'prop_test', 'value' => 'val_test']);
$response = self::$DI['client']->getResponse();

View File

@@ -14,8 +14,8 @@ class UserManagerTest extends \PhraseanetTestCase
{
$user = self::$DI['app']['manipulator.user']->createUser('login', 'password');
self::$DI['app']['manipulator.user']->logQuery($user, 'a query');
self::$DI['app']['manipulator.user']->addUserSetting($user, 'setting', false);
self::$DI['app']['manipulator.user']->addNotificationSetting($user, 'setting', false);
self::$DI['app']['manipulator.user']->setUserSetting($user, 'setting', false);
self::$DI['app']['manipulator.user']->setNotificationSetting($user, 'setting', false);
self::$DI['app']['model.user-manager']->delete($user);
$this->assertTrue($user->isDeleted());
$this->assertNull($user->getEmail());

View File

@@ -161,18 +161,18 @@ class UserManipulatorTest extends \PhraseanetTestCase
self::$DI['app']['manipulator.user']->createTemplate('login', $user);
}
public function testAddUserSetting()
public function testSetUserSetting()
{
$user = self::$DI['app']['manipulator.user']->createUser('login', 'password');
self::$DI['app']['manipulator.user']->addUserSetting($user, 'name' ,'value');
self::$DI['app']['manipulator.user']->setUserSetting($user, 'name' ,'value');
$user = self::$DI['app']['manipulator.user']->getRepository()->findOneByLogin('login');
$this->assertCount(1, $user->getSettings());
}
public function testAddNotificationSetting()
public function testSetNotificationSetting()
{
$user = self::$DI['app']['manipulator.user']->createUser('login', 'password');
self::$DI['app']['manipulator.user']->addNotificationSetting($user, 'name', 'value');
self::$DI['app']['manipulator.user']->setNotificationSetting($user, 'name', 'value');
$user = self::$DI['app']['manipulator.user']->getRepository()->findOneByLogin('login');
$this->assertCount(1, $user->getNotificationSettings());
}

View File

@@ -1290,6 +1290,26 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$this->assertFalse($data['success']);
}
protected function mockUserNotificationSettings($notificationName, $returnValue = true)
{
if (false === self::$DI['app']['settings'] instanceof \PHPUnit_Framework_MockObject_MockObject) {
self::$DI['app']['settings'] = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\DisplaySettingService')
->disableOriginalConstructor()
->getMock();
}
self::$DI['app']['settings']
->expects($this->any())
->method('getUserNotificationSetting')
->with(
$this->isInstanceOf('Alchemy\Phrasea\Model\Entities\User'),
$this->equalTo($notificationName)
)
->will($this->returnValue($returnValue));
self::$DI['app']['setting'] = 'toto';
}
protected function mockNotificationDeliverer($expectedMail, $qty = 1, $receipt = null)
{
self::$DI['app']['notification.deliverer'] = $this->getMockBuilder('Alchemy\Phrasea\Notification\Deliverer')

View File

@@ -63,9 +63,9 @@ class userTest extends \PhraseanetTestCase
{
$user = self::$DI['app']['manipulator.user']->createUser('notif_ref_test', 'pass');
$this->assertNull($user->getSettingValue('lalala'));
$this->assertSame('popo', $user->getSettingValue('lalala', 'popo'));
$this->assertSame(User::$defaultUserSettings['editing_top_box'], $user->getSettingValue('editing_top_box'));
$this->assertNull(self::$DI['app']['settings']->getUserSetting($user, 'lalala'));
$this->assertSame('popo', self::$DI['app']['settings']->getUserSetting($user, 'lalala', 'popo'));
$this->assertSame(self::$DI['app']['settings']->getUsersSettings()['editing_top_box'], self::$DI['app']['settings']->getUserSetting($user, 'editing_top_box'));
}
public function testGetPrefWithACustomizedConf()
@@ -83,10 +83,10 @@ class userTest extends \PhraseanetTestCase
$user = $this->get_user();
$user->setPrefs('images_per_page', 35);
$this->assertNull($user->getSettingValue('lalala'));
$this->assertSame(666, $user->getSettingValue('images_size'));
$this->assertSame(42, $user->getSettingValue('images_per_page'));
$this->assertSame(User::$defaultUserSettings['editing_top_box'], $user->getSettingValue('editing_top_box'));
$this->assertNull(self::$DI['app']['settings']->getUserSetting($user, 'lalala'));
$this->assertSame(666, self::$DI['app']['settings']->getUserSetting($user, 'images_size'));
$this->assertSame(42, self::$DI['app']['settings']->getUserSetting($user, 'images_per_page'));
$this->assertSame(self::$DI['app']['settings']->getUsersSettings()['editing_top_box'], self::$DI['app']['settings']->getUserSetting($user, 'editing_top_box'));
if (null === $data) {
self::$DI['app']['conf']->remove('user-settings');
@@ -99,25 +99,25 @@ class userTest extends \PhraseanetTestCase
{
$user = self::$DI['app']['manipulator.user']->createUser('notif_ref_test', 'pass');
$user->setSettingValue('prout', 'pooop');
$this->assertSame('pooop', $user->getSettingValue('prout'));
self::$DI['app']['manipulator.user']->setUserSetting($user, 'prout', 'pooop');
$this->assertSame('pooop', self::$DI['app']['settings']->getUserSetting($user, 'prout'));
}
public function testGetNotificationPref()
{
$user = self::$DI['app']['manipulator.user']->createUser('notif_ref_test', 'pass');
$this->assertTrue($user->getNotificationSettingValue('eventsmanager_notify_push'));
$this->assertTrue(self::$DI['app']['settings']->getUserNotificationSetting($user, 'eventsmanager_notify_push'));
}
public function testNotificationPref()
{
$user = self::$DI['app']['manipulator.user']->createUser('notif_ref_test', 'pass');
$this->assertTrue($user->getNotificationSettingValue('eventsmanager_notify_push'));
$user->setNotificationSettingValue('eventsmanager_notify_push', false);
$this->assertFalse($user->getNotificationSettingValue('eventsmanager_notify_push'));
$user->setNotificationSettingValue('eventsmanager_notify_push', true);
$this->assertTrue($user->getNotificationSettingValue('eventsmanager_notify_push'));
$this->assertTrue(self::$DI['app']['settings']->getUserNotificationSetting($user, 'eventsmanager_notify_push'));
self::$DI['app']['manipulator.user']->setNotificationSetting($user, 'eventsmanager_notify_push', false);
$this->assertFalse(self::$DI['app']['settings']->getUserNotificationSetting($user, 'eventsmanager_notify_push'));
self::$DI['app']['manipulator.user']->setNotificationSetting($user, 'eventsmanager_notify_push', true);
$this->assertTrue(self::$DI['app']['settings']->getUserNotificationSetting($user, 'eventsmanager_notify_push'));
}
}

View File

@@ -1024,17 +1024,6 @@ class User extends \Alchemy\Phrasea\Model\Entities\User implements \Doctrine\ORM
return parent::addSetting($setting);
}
/**
* {@inheritDoc}
*/
public function setSettingValue($name, $value)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'setSettingValue', array($name, $value));
return parent::setSettingValue($name, $value);
}
/**
* {@inheritDoc}
*/
@@ -1057,28 +1046,6 @@ class User extends \Alchemy\Phrasea\Model\Entities\User implements \Doctrine\ORM
return parent::addNotificationSettings($notificationSetting);
}
/**
* {@inheritDoc}
*/
public function setNotificationSettingValue($name, $value)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'setNotificationSettingValue', array($name, $value));
return parent::setNotificationSettingValue($name, $value);
}
/**
* {@inheritDoc}
*/
public function getNotificationSettingValue($name)
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getNotificationSettingValue', array($name));
return parent::getNotificationSettingValue($name);
}
/**
* {@inheritDoc}
*/