diff --git a/application/modules/admin/controllers/CatalogueController.php b/application/modules/admin/controllers/CatalogueController.php index d69f873ad9c415231a6ffff19fcbe2fc7ab68e5b..8b4d323dcbb4e48611815937d3572e9d9bf61d68 100644 --- a/application/modules/admin/controllers/CatalogueController.php +++ b/application/modules/admin/controllers/CatalogueController.php @@ -255,13 +255,6 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action { public function viewableDomainsJsonAction() { - $this->_helper->viewRenderer->setNoRender(); - - $data = []; - $data[] = Class_Catalogue::getViewableDomainJson(); - $JSON = json_encode($data); - - $this->getResponse()->setHeader('Content-Type', 'application/json; charset=utf-8'); - $this->getResponse()->setBody($JSON); + $this->_helper->json([Class_Catalogue::getViewableDomainJson()]); } } \ No newline at end of file diff --git a/application/modules/opac/views/scripts/abonne/settings.phtml b/application/modules/opac/views/scripts/abonne/settings.phtml index 307efa9fd969760913cde98984acc6197501a50d..fb242e29dad1e1f4f12bec7faf7da998bfac22d7 100644 --- a/application/modules/opac/views/scripts/abonne/settings.phtml +++ b/application/modules/opac/views/scripts/abonne/settings.phtml @@ -1,5 +1,3 @@ <?php -//$this->openBoite($this->_('Mes préférences')); echo $this->renderForm($this->form); -//$this->closeBoite(); ?> diff --git a/library/Class/MoteurRecherche/Facettes.php b/library/Class/MoteurRecherche/Facettes.php index cba27361b3c095811c6e607b1cc6857582a2c3fc..bebda653688e5ffb6bd3f187afb797a3d37390d8 100644 --- a/library/Class/MoteurRecherche/Facettes.php +++ b/library/Class/MoteurRecherche/Facettes.php @@ -182,16 +182,17 @@ class Class_MoteurRecherche_Facettes { $user_bookmarks_codes = array_map(function($domain) {return $domain->getFacetThesaurus();}, $user_bookmarks); foreach($user_bookmarks_codes as $bookmark_code) { - if(isset($codes_count[$bookmark_code])) { - if(!$facet = Class_Notice_Facette::find($bookmark_code)) - continue; + if(!isset($codes_count[$bookmark_code])) + continue; - if (!$facet_label = $facet->getLibelleFacette()) - continue; + if(!$facet = Class_Notice_Facette::find($bookmark_code)) + continue; - $matches[] = ['id' => $bookmark_code, - 'label' => $facet->getCodeRubriqueLibelle() . ' : ' . $facet_label . ' (' . $codes_count[$bookmark_code] . ')']; - } + if (!$facet_label = $facet->getLibelleFacette()) + continue; + + $matches[] = ['id' => $bookmark_code, + 'label' => $facet->getCodeRubriqueLibelle() . ' : ' . $facet_label . ' (' . $codes_count[$bookmark_code] . ')']; } return $matches; diff --git a/library/Class/User/Settings.php b/library/Class/User/Settings.php index c227e5355b0d40936b1cb4149c33aa6d5c7e91bf..b22fd5a6896d269578c8445e397f092a24afd853 100644 --- a/library/Class/User/Settings.php +++ b/library/Class/User/Settings.php @@ -22,17 +22,30 @@ class Class_User_Settings { const BOOKMARKED_DOMAINS = 'domain_ids'; - protected $_user; + protected $_user, $_user_settings; - public function visitUser($user) { + public function setUser($user) { $this->_user = $user; - $this->_user_settings = unserialize($this->_user->getSettings()); + return $this; + } + + public function setUserSettings($settings) { + $this->_user_settings = $settings; return $this; } + public static function newWith($user) { + $instance = new Self(); + $instance + ->setUser($user) + ->setUserSettings(unserialize($user->getSettings())); + return $instance; + } + + public function getBookmarkedDomains() { if(!isset($this->_user_settings[self::BOOKMARKED_DOMAINS])) return ''; @@ -54,6 +67,5 @@ class Class_User_Settings { return []; return unserialize($data); } - } ?> \ No newline at end of file diff --git a/library/Class/Users.php b/library/Class/Users.php index 59f714319688b43fa850641a291f7d62e8f13e38..0d0608beea59ecf59705c2b72a1939568a26c43d 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -1605,7 +1605,7 @@ class Class_Users extends Storm_Model_Abstract { protected function getSettingsModel() { if(!$this->_settings) - return $this->_settings = (new Class_User_Settings())->visitUser($this); + return $this->_settings = Class_User_Settings::newWith($this); return $this->_settings; } } diff --git a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php index c1f24d74a475df6b8c18853b73108561d6909c85..9052762c1cad6c1d40c21cb88c152eac4402f4ea 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php @@ -38,7 +38,7 @@ class AbonneControllerSettingsFormTest extends AbstractControllerTestCase { -class AbonneControllserSettingsFormPostTest extends AbstractControllerTestCase { +class AbonneControllerSettingsFormPostTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true, $_user; public function setUp() {