diff --git a/VERSIONS_WIP/111 b/VERSIONS_WIP/111 new file mode 100644 index 0000000000000000000000000000000000000000..57d6a87c8a3c057897917331db578f6280918928 --- /dev/null +++ b/VERSIONS_WIP/111 @@ -0,0 +1 @@ + - fonctionnalité : Amélioration de l'adaptabilité des carousels dans les thèmes. \ No newline at end of file diff --git a/library/Class/Template.php b/library/Class/Template.php index 235f7ae2b99e9058556c80716a31f607ca078f61..4bbf019e83a73f027acac46876f69ed1890423a7 100644 --- a/library/Class/Template.php +++ b/library/Class/Template.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. * @@ -18,49 +19,47 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class Class_Template +{ + use Trait_Translator; + use Trait_StormFileSystem; -class Class_Template { - - use - Trait_Translator, - Trait_StormFileSystem; - - const TEMPLATES_CSS_PATCHS_FOLDER = 'templates_patchs'; - const TEMPLATES_CSS_PATCHS = ROOT_PATH . 'public/opac/css/' . self::TEMPLATES_CSS_PATCHS_FOLDER . '/'; + public const TEMPLATES_CSS_PATCHS_FOLDER = 'templates_patchs'; + public const TEMPLATES_CSS_PATCHS = ROOT_PATH . 'public/opac/css/' . self::TEMPLATES_CSS_PATCHS_FOLDER . '/'; protected static $_instance; - protected - $_id = '', - $_title = '', - $_settings, - $_control_key, - $_patcher, - $_icons_cache, - $_namespace; + protected $_id = ''; + protected $_title = ''; + protected $_settings; + protected $_control_key; + protected $_patcher; + protected $_icons_cache; + protected $_namespace; protected ?Class_Profil $_profile = null; - public function __call($name, $params) { + public function __call($name, $params) + { return ($settings = $this->getSettings()) ? call_user_func_array([$settings, $name], $params) : null; } - - public static function current() : Class_Template { + public static function current(): Class_Template + { return static::$_instance ?? (($profile = Class_Profil::getCurrentProfil()) ? static::setCurrentFrom($profile->getId()) : static::setCurrent((new Class_Template_Loader)->getNullTemplate())); } - - public static function redirectActionFor($action) { + public static function redirectActionFor($action) + { return static::current()->getRedirectActionFor($action); } - - public static function setCurrentFrom($profile_id) : Class_Template { + public static function setCurrentFrom($profile_id): Class_Template + { $loader = new Class_Template_Loader; $template = ((new Class_UserAgent)->isMyBibApp() && (new Class_AdminVar_MyBibAppTemplate)->isEnabled()) @@ -70,116 +69,115 @@ class Class_Template { return static::setCurrent($template); } - - public static function setCurrent(Class_Template $instance) : Class_Template { + public static function setCurrent(Class_Template $instance): Class_Template + { return static::$_instance = $instance; } - - public static function reset() { + public static function reset() + { static::$_instance = null; } - - public static function isDisabled() { + public static function isDisabled() + { return !static::isEnabled(); } - - public static function isEnabled() { + public static function isEnabled() + { return Class_AdminVar::isTemplatingEnabled(); } - - public function getTryUrl() { + public function getTryUrl() + { return Class_Url::relative(sprintf('/admin/template/try/template/%s/on/1', $this->getId())); } - - public function getCheckBeforeTryUrl() { + public function getCheckBeforeTryUrl() + { return Class_Url::relative(sprintf('/admin/template/check-before-try/template/%s/on/1', $this->getId())); } - - public function getTryOnNewProfileUrl() { + public function getTryOnNewProfileUrl() + { return Class_Url::relative(sprintf('/admin/template/try-on-new-profile/template/%s/on/1', $this->getId())); } - - public function getStylesPackUrl() { + public function getStylesPackUrl() + { return Class_Url::relative('/admin/styles-pack/index/template/' . $this->getId()); } - - public function getResponsivePackUrl() { + public function getResponsivePackUrl() + { return Class_Url::relative('/admin/responsive-pack/index/template/' . $this->getId()); } - - public function getStylesPack() { + public function getStylesPack() + { return Class_StylesPack::findAllByTemplate($this); } - - public function getResponsivePack() { + public function getResponsivePack() + { return Class_ResponsivePack::findAllByTemplate($this); } - - public function initDefaultsPacks() : Class_Template_NullPatcher { + public function initDefaultsPacks(): Class_Template_NullPatcher + { return $this->getPatcher()->initDefaultsPacks(); } - - public function getDefaultWidgetMenuConfiguration(array $params) : array { + public function getDefaultWidgetMenuConfiguration(array $params): array + { return $this->initDefaultsPacks()->getDefaultWidgetMenuConfiguration($params); } - - public function getDefaultWidgetConfiguration(array $params) : array { + public function getDefaultWidgetConfiguration(array $params): array + { return $this->initDefaultsPacks()->getDefaultWidgetConfiguration($params); } - - public function getApplyUrl() { + public function getApplyUrl() + { return Class_Url::relative(sprintf('/admin/template/apply/template/%s', $this->getId())); } - - public function getEditUrl() { + public function getEditUrl() + { return Class_Url::relative(sprintf('/admin/template/edit/template/%s', $this->getId())); } - - public function getResetUrl() { + public function getResetUrl() + { return Class_Url::relative(sprintf('/admin/template/reset/template/%s', $this->getId())); } - - public function getControlKey($profile) { + public function getControlKey($profile) + { if ($this->_control_key) return $this->_control_key; - return $this->_control_key = md5($this->getId().$profile->getId()); + return $this->_control_key = md5($this->getId() . $profile->getId()); } - - public function removeControlKeys($profile){ + public function removeControlKeys($profile) + { $this->getControlKey($profile); - foreach (Class_Profil::findAllBy(['commentaire' => $this->_control_key ]) - as $test_profile) + foreach (Class_Profil::findAllBy(['commentaire' => $this->_control_key ]) as $test_profile) $test_profile->resetTemplateTestKey() ->save(); + return $this; } - - public function tryOn($profile) { - if ( ! $profile) + public function tryOn($profile) + { + if (!$profile) return null; - static::reset(); $try_profile = $this->_findOrCreateTryProfileFrom($profile); @@ -193,11 +191,10 @@ class Class_Template { return $try_profile->getId(); } - - public function applyOn($profile) { - if(!$profile) + public function applyOn($profile) + { + if (!$profile) return null; - $profile ->setTemplate($this->getId()) ->save(); @@ -205,14 +202,14 @@ class Class_Template { Class_Profil::setCurrentProfil($profile); $profile = $this->_patchProfile($profile); $profile->save(); + return $profile->getId(); } - - public function createFrom($profile) { - if(!$profile) + public function createFrom($profile) + { + if (!$profile) return null; - $template_profile = $this->_findOrCreateProfileFrom($profile); $template_profile->save(); @@ -224,255 +221,199 @@ class Class_Template { return $template_profile->getId(); } - - protected function _findOrCreateTryProfileFrom($profile) { - if (!$try_profile = Class_Profil::findFirstBy(['commentaire' => $this->getControlKey($profile)])) - return $profile - ->copy() - ->setCommentaire($this->getControlKey($profile)) - ->setAccessLevel(ZendAfi_Acl_AdminControllerRoles::MODO_BIB) - ->setLibelle($this->_('Test du thème %s', - $this->getTitle())) - ->setTemplate($this->getId()); - - if ($try_profile->hasParentProfil()) { - $try_profile - ->resetTemplateTestKey() - ->assertSave(); - return $this->_findOrCreateTryProfileFrom($profile); - } - - return $try_profile; - } - - - protected function _findOrCreateProfileFrom($profile) { - if ($template_profile = Class_Profil::findFirstBy(['template' => $this->getId()])) - return $template_profile; - - return $profile - ->copy() - ->setTemplate($this->getId()); - } - - - protected function _patchProfile($profile) { - if (!$patcher = $this->getPatcher()) - return $profile; - - return $patcher->upgrade($profile); - } - - - public function hydrate($attribs, $name) { + public function hydrate($attribs, $name) + { return $attribs; } - - protected function _localUpgrade($profile) { - return $profile; - } - - - protected function _upgradeMenus($profile) { - return $profile; - } - - - public function withNameSpace($text) { + public function withNameSpace($text) + { return $this->_getNameSpace() . Storm_Inflector::camelize(Storm_Inflector::underscorize($text)); } - - public function isNamespaced(string $name) : bool { + public function isNamespaced(string $name): bool + { return 0 === strpos($name, $this->_getNameSpace()); } - - protected function _getNameSpace() : string { - return $this->_namespace ?: ($this->_namespace = Storm_Inflector::camelize($this->getId())); - } - - - public function filterNotNamespaced(array $items) : array { + public function filterNotNamespaced(array $items): array + { return array_filter($items, fn($item) => !$this->isNamespaced((string) $item), ARRAY_FILTER_USE_KEY); } - - public function customWidgetForm($form) { + public function customWidgetForm($form) + { return $form; } - - public function customActionForm($form) { + public function customActionForm($form) + { return $form; } - - public function customMenuForm($form) { + public function customMenuForm($form) + { return $form; } - - public function customMenuEntryForm($form) { + public function customMenuEntryForm($form) + { return $form; } - - public function customTemplateForm($form) { + public function customTemplateForm($form) + { return $form; } - - public function customSectionForm($form) { + public function customSectionForm($form) + { return $form; } - - public function customProfileForm($form) { + public function customProfileForm($form) + { return $form; } - - public function customProfilePageForm($form) { + public function customProfilePageForm($form) + { return $form; } - - public function customLoginForm($form) { + public function customLoginForm($form) + { return $form; } - - public function customUserSettingsForm($form) { + public function customUserSettingsForm($form) + { return $form; } - - public function customUserRichContents($sections) { + public function customUserRichContents($sections) + { return $sections; } - - public function customRecordItemsForm($form) { + public function customRecordItemsForm($form) + { return $form; } - - public function customStylesPackForm($form) { + public function customStylesPackForm($form) + { return $form; } - - public function customResponsivePackForm($form) { + public function customResponsivePackForm($form) + { return $form; } - - public function handleRecordView() { + public function handleRecordView() + { return false; } - - public function getWidgets() { + public function getWidgets() + { return []; } - - public function getWidgetSettingsWrapper($settings) { + public function getWidgetSettingsWrapper($settings) + { return new Class_Systeme_Widget_Settings($settings); } - - public function renderOpac($view) { + public function renderOpac($view) + { return ''; } - - public function renderSubModal($view) { + public function renderSubModal($view) + { return ''; } - - public function renderKO($view) { + public function renderKO($view) + { $head = $view->partial('head.phtml', - array_merge($view->profil->getCfgSiteAsArray(), - ['titre' => $view->getTitre()])); + array_merge($view->profil->getCfgSiteAsArray(), + ['titre' => $view->getTitre()])); $body = $view->tag('body', - $view->tagImg('/library/templates/Intonation/Assets/images/bokeh_focale.png', - ['alt' => $this->_('Image d\'erreur'), - 'class' => 'icon_error_danger']). - $view->tag('p', - $this->_('L\'accès au site est momentanément bloqué.<br> Veuillez réessayer plus tard.'), - ['class' => 'erreur']) - ); + $view->tagImg('/library/templates/Intonation/Assets/images/bokeh_focale.png', + ['alt' => $this->_('Image d\'erreur'), + 'class' => 'icon_error_danger']) . + $view->tag('p', + $this->_('L\'accès au site est momentanément bloqué.<br> Veuillez réessayer plus tard.'), + ['class' => 'erreur']) + ); return $head . $body; } - - public function getImagePlaceHolder() { + public function getImagePlaceHolder() + { return ''; } - - public function setId($id) { + public function setId($id) + { $this->_id = $id; + return $this; } - - public function getId() { + public function getId() + { return $this->_id; } - - public function setTitle($title) { + public function setTitle($title) + { $this->_title = $title; + return $this; } - - public function getTitle() { + public function getTitle() + { return $this->_title; } - - public function setProfile($profile) { + public function setProfile($profile) + { $this->_profile = $profile; + return $this; } - - public function getProfile() { + public function getProfile() + { return $this->_profile; } - - public function getSection($id) { - if(Class_Profil::DIV_FIRST_SIDE == $id) + public function getSection($id) + { + if (Class_Profil::DIV_FIRST_SIDE == $id) return new Class_Systeme_Widget_Section_FirstSide; - - if(Class_Profil::DIV_MAIN == $id) + if (Class_Profil::DIV_MAIN == $id) return new Class_Systeme_Widget_Section_Main; - - if(Class_Profil::DIV_FLOTANTTE == $id) + if (Class_Profil::DIV_FLOTANTTE == $id) return new Class_Systeme_Widget_Section_FloatSide; - - if(Class_Profil::DIV_FOOTER == $id) + if (Class_Profil::DIV_FOOTER == $id) return new Class_Systeme_Widget_Section_Footer; - - if(Class_Profil::DIV_BANNIERE == $id) + if (Class_Profil::DIV_BANNIERE == $id) return new Class_Systeme_Widget_Section_Header; - - if(Class_Profil::DIV_SECOND_SIDE == $id) + if (Class_Profil::DIV_SECOND_SIDE == $id) return new Class_Systeme_Widget_Section_SecondSide; return new Class_Systeme_Widget_Section; } - - public function getLivingWidgets() { + public function getLivingWidgets() + { $sections = [Class_Systeme_Widget_Section_Header::class, Class_Systeme_Widget_Section_FirstSide::class, Class_Systeme_Widget_Section_Main::class, @@ -483,270 +424,327 @@ class Class_Template { $widgets = []; foreach ($sections as $section) - if ($section = (new $section()) + if ($section = (new $section) ->setProfileId($this->getProfile()->getId()) ->load()) - $widgets[$section->getTitle()] = $section->getWidgets(); + $widgets[$section->getTitle()] = $section->getWidgets(); return $widgets; } - - public function getSettings() { + public function getSettings() + { return $this->_settings ?: ($this->_settings = $this->_buildSettings()); } - - protected function _buildSettings() { - $class_name = explode('_', get_class($this))[0] . '_Library_Settings'; - return new $class_name($this); - } - - - public function setSettings($settings) { + public function setSettings($settings) + { $this->_settings = $settings; + return $this; } - - public function setPatcher($patcher) { + public function setPatcher($patcher) + { $this->_patcher = $patcher; + return $this; } - - public function getPatcher() { + public function getPatcher() + { return $this->_patcher; } - - public function resetSettings() { - foreach(Class_Template_Settings::findAllBy(['template' => $this->getId()]) as $settings) + public function resetSettings() + { + foreach (Class_Template_Settings::findAllBy(['template' => $this->getId()]) as $settings) $settings->delete(); $this->_settings = Class_Template_Settings::newInstance(); + return $this; } + public function resetPacks(): self + { + foreach (Class_StylesPack::findAllByTemplate($this) as $pack) + $pack->delete(); - public function resetPacks() : self { - foreach ( Class_StylesPack::findAllByTemplate($this) as $pack) - $pack ->delete(); - - foreach ( Class_ResponsivePack::findAllByTemplate($this) as $pack) - $pack ->delete(); + foreach (Class_ResponsivePack::findAllByTemplate($this) as $pack) + $pack->delete(); return $this; } - - public function updateSettings() { + public function updateSettings() + { $this->getSettings()->updateSettings(); + return $this; } - - public function addHelperPath($view) { + public function addHelperPath($view) + { return $this; } - - public function addAdminHelperPath($view) { + public function addAdminHelperPath($view) + { return $this; } - - public function handleMappings(array $post) : array { + public function handleMappings(array $post): array + { return $post; } - - public function getIco($view, $key, $category = '', $params = []) { + public function getIco($view, $key, $category = '', $params = []) + { $cache_key = $category . $key . json_encode($params); if (isset($this->_icons_cache[$cache_key])) return $this->_icons_cache[$cache_key]; - if (!$category) return $this->_icoFromClassOrUrl($view, $key, $cache_key, $params); - $function = 'get' . Storm_Inflector::camelize('icons_map_' . $category); if (!$mapping = call_user_func([$this->getSettings(), $function])) return $this->_icons_cache[$cache_key] = ''; - if (!isset($mapping[$key])) return $this->_icons_cache[$cache_key] = ''; - if (!$rules = $mapping[$key]) return $this->_icons_cache[$cache_key] = ''; return $this->_icoFromClassOrUrl($view, $rules, $cache_key, $params, $category, $mapping); } - - protected function _icoFromClassOrUrl($view, $key, $cache_key, $params, $category = '', $mapping = []) { - $params = $this->_updateParamsWithCategory($params, $category); - $rules = explode(' ', $key); - array_shift($rules); - $span_title = ''; - if (isset($params['title'])) { - $span_title = $view->screenReaderOnly($params['title']); - } - - if ($icon = $view->renderIcon($key, $params)) - return $this->_icons_cache[$cache_key] = $icon; - - - $parts = explode(' ', $key); - return $this->_icons_cache[$cache_key] = end($parts); - } - - - - protected function _updateParamsWithCategory($params, $category) { - if ( ! $category ) - return $params; - - $class = [$category]; - - if (isset($params['class'])) - $class = array_merge([$params['class']], - $class); - - $params ['class'] = implode(' ', $class); - return $params; - } - - - public function upgradeUser($user) { + public function upgradeUser($user) + { return $this; } - - public function isLegacy() { + public function isLegacy() + { return false; } - - public function isNull() : bool { + public function isNull(): bool + { return false; } - - public function isNotNull() : bool { - return ! $this->isNull(); + public function isNotNull(): bool + { + return !$this->isNull(); } - - public function getWidgetTemplates(string $widget_id = '') : array { + public function getWidgetTemplates(string $widget_id = ''): array + { return []; } - - public function withUserAndSIGBDo($callback) { + public function withUserAndSIGBDo($callback) + { return $callback(); } - - public function getCarouselRenderer( string $layout) : string { + public function getCarouselRenderer(string $layout): string + { return ''; } - - public function getCarouselLayouts() { + public function getCarouselLayouts(): array + { return []; } - - public function getContentsCss() { + public function getContentsCss() + { return []; } - - public function addTemplateJsTo($script_loader) { + public function addTemplateJsTo($script_loader) + { return $this; } - - public function addTemplateCss() : array { + public function addTemplateCss(): array + { return []; } - - public function providesSearchByWork() { + public function providesSearchByWork() + { return false; } - - public function getSearchCriteria() : Class_CriteresRecherche { + public function getSearchCriteria(): Class_CriteresRecherche + { return new Class_CriteresRecherche; } - - public function newWrapper($model, $view) { + public function newWrapper($model, $view) + { $map = $this->_getMapWrapper(); $class_name = $map[get_class($model)]; + return new $class_name($model, $view); } - - public function newWrappers($models, $view) { + public function newWrappers($models, $view) + { $elements = array_map(fn($model) => Class_Template::current()->newWrapper($model, $view), - $models); + $models); return new Storm_Collection($elements); } - - protected function _getMapWrapper() : array { - return []; - } - - /** * Each template can register other classes for menus - * Default values : Class_Systeme_ModulesMenu::MODULES_CLASS_DEFINITION + * Default values : Class_Systeme_ModulesMenu::MODULES_CLASS_DEFINITION. + * * @see Class_Systeme_ModulesMenu::initModules + * + * @param mixed $modules_definition */ - public function updateModulesMenuClassDefinition($modules_definition) { + public function updateModulesMenuClassDefinition($modules_definition) + { return $modules_definition; } - - public function getRedirectActionFor($action) { + public function getRedirectActionFor($action) + { return $action; } - - public function allConfigurableScreensDo($callback_with_title_url) { + public function allConfigurableScreensDo($callback_with_title_url) + { return $this; } - public function validate() {} - - public function shouldHighlightRecords() : bool { + public function shouldHighlightRecords(): bool + { return (bool) Class_AdminVar::isSearchTermHighlightedEnabled(); } - - public function getCssPatchsFiles() : array { + public function getCssPatchsFiles(): array + { return $this->getFileSystem()->fileNamesAt(static::TEMPLATES_CSS_PATCHS); } - - public function getFolder() : string { + public function getFolder(): string + { return basename(dirname((new ReflectionClass($this))->getFileName())); } - - public function getTemplateCssFileName() : string { + public function getTemplateCssFileName(): string + { return ''; } - - public function isAuthorized(): bool { + public function isAuthorized(): bool + { return true; } + + protected function _findOrCreateTryProfileFrom($profile) + { + if (!$try_profile = Class_Profil::findFirstBy(['commentaire' => $this->getControlKey($profile)])) + return $profile + ->copy() + ->setCommentaire($this->getControlKey($profile)) + ->setAccessLevel(ZendAfi_Acl_AdminControllerRoles::MODO_BIB) + ->setLibelle($this->_('Test du thème %s', + $this->getTitle())) + ->setTemplate($this->getId()); + + if ($try_profile->hasParentProfil()) { + $try_profile + ->resetTemplateTestKey() + ->assertSave(); + + return $this->_findOrCreateTryProfileFrom($profile); + } + + return $try_profile; + } + + protected function _findOrCreateProfileFrom($profile) + { + if ($template_profile = Class_Profil::findFirstBy(['template' => $this->getId()])) + return $template_profile; + + return $profile + ->copy() + ->setTemplate($this->getId()); + } + + protected function _patchProfile($profile) + { + if (!$patcher = $this->getPatcher()) + return $profile; + + return $patcher->upgrade($profile); + } + + protected function _localUpgrade($profile) + { + return $profile; + } + + protected function _upgradeMenus($profile) + { + return $profile; + } + + protected function _getNameSpace(): string + { + return $this->_namespace ?: ($this->_namespace = Storm_Inflector::camelize($this->getId())); + } + + protected function _buildSettings() + { + $class_name = explode('_', get_class($this))[0] . '_Library_Settings'; + + return new $class_name($this); + } + + protected function _icoFromClassOrUrl($view, $key, $cache_key, $params, $category = '', $mapping = []) + { + $params = $this->_updateParamsWithCategory($params, $category); + $rules = explode(' ', $key); + array_shift($rules); + $span_title = ''; + if (isset($params['title'])) { + $span_title = $view->screenReaderOnly($params['title']); + } + + if ($icon = $view->renderIcon($key, $params)) + return $this->_icons_cache[$cache_key] = $icon; + $parts = explode(' ', $key); + + return $this->_icons_cache[$cache_key] = end($parts); + } + + protected function _updateParamsWithCategory($params, $category) + { + if (!$category) + return $params; + $class = [$category]; + + if (isset($params['class'])) + $class = array_merge([$params['class']], + $class); + + $params['class'] = implode(' ', $class); + + return $params; + } + + protected function _getMapWrapper(): array + { + return []; + } } diff --git a/library/Class/Template/ProfilePatcher.php b/library/Class/Template/ProfilePatcher.php index 90a1cf435dcb3d8dbda1c174ffdf196a11e4ba74..dc69e595a8e2dee9263d91fefa9991d1bd60b677 100644 --- a/library/Class/Template/ProfilePatcher.php +++ b/library/Class/Template/ProfilePatcher.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,9 +19,8 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Class_Template_ProfilePatcher extends Class_Template_NullPatcher { +class Class_Template_ProfilePatcher extends Class_Template_NullPatcher +{ use Trait_Translator; protected bool $_generate_defaults_pack_cache = false; @@ -28,41 +28,31 @@ class Class_Template_ProfilePatcher extends Class_Template_NullPatcher { protected ?Class_Template $_template; protected int $_profile_id; - public function __construct(?Class_Template $template) { + public function __construct(?Class_Template $template) + { $this->_template = $template; } - - public function setProfile($profile) { + public function setProfile($profile) + { $this->_profile = $profile; $this->_profile_id = $profile->getId(); $this->_template = (new Class_Template_Loader)->findFromProfile($profile); Class_Profil::setCurrentProfil($profile); - return $this; - } - - - protected function _generateDefaultsPacks() : self { - if ( $this->_generate_defaults_pack_cache ) - return $this; - - $this->_generate_defaults_pack_cache = true; - return $this - ->_generateCorePacks() - ->_generatePacks(); + return $this; } - - public function initDefaultsPacks() : self { + public function initDefaultsPacks(): self + { return $this->_generateDefaultsPacks(); } - - public function removeWidgets() { + public function removeWidgets() + { $cfg_accueil = $this->_profile->getCfgAccueilAsArray(); - foreach($cfg_accueil['modules'] as $id => $config) + foreach ($cfg_accueil['modules'] as $id => $config) unset($cfg_accueil['modules'][$id]); $this->_profile @@ -72,41 +62,61 @@ class Class_Template_ProfilePatcher extends Class_Template_NullPatcher { return $this; } + public function addWidget($type, $division, $settings = []) + { + return $this->_addWidget($type, $division, $settings); + } - protected function _addWidget($type, $division, $settings = []) { - (new Class_Template_ProfilePatcher_Profile($this->_profile)) - ->addWidget($type, $division, $settings); + public function getDefaultWidgetMenuConfiguration(array $params): array + { + return []; + } - return $this->_clearCache(); + public function getDefaultWidgetConfiguration(array $params): array + { + return []; } + protected function _generateDefaultsPacks(): self + { + if ($this->_generate_defaults_pack_cache) + return $this; + $this->_generate_defaults_pack_cache = true; - public function addWidget($type, $division, $settings = []) { - return $this->_addWidget($type, $division, $settings); + return $this + ->_generateCorePacks() + ->_generatePacks(); } + protected function _addWidget($type, $division, $settings = []) + { + (new Class_Template_ProfilePatcher_Profile($this->_profile)) + ->addWidget($type, $division, $settings); - protected function _moveWidgetsFromTo($types, $from_divisions, $to_division) { - foreach($types as $type) - $this->_moveWidgetFromTo($type, $from_divisions, $to_division); + return $this->_clearCache(); } + protected function _moveWidgetsFromTo($types, $from_divisions, $to_division) + { + foreach ($types as $type) + $this->_moveWidgetFromTo($type, $from_divisions, $to_division); + } - protected function _moveWidgetFromTo($type, $from_divisions, $to_division) { + protected function _moveWidgetFromTo($type, $from_divisions, $to_division) + { $cfg_accueil = $this->_profile->getCfgAccueilAsArray(); $ids = []; - foreach($cfg_accueil['modules'] as $id => $config) + foreach ($cfg_accueil['modules'] as $id => $config) if (in_array($config['division'], $from_divisions) && $config['type_module'] == $type) - $ids [$type] = $id; + $ids[$type] = $id; - foreach($ids as $id) { - if(!$widget = (new Class_Systeme_Widget_Widget()) + foreach ($ids as $id) { + if (!$widget = (new Class_Systeme_Widget_Widget) ->setId($id) ->setProfileId($this->_profile->getId()) ->load()) - continue; - + continue; $widget->moveToSection($to_division); Class_Profil::clearCache(); $this->_profile = $widget->getProfile(); @@ -115,26 +125,16 @@ class Class_Template_ProfilePatcher extends Class_Template_NullPatcher { return $this; } - - protected function _nameSpaced(string $label) : string { + protected function _nameSpaced(string $label): string + { return $this->_template->withNameSpace($label); } - - public function getDefaultWidgetMenuConfiguration(array $params) : array { - return []; - } - - - public function getDefaultWidgetConfiguration(array $params) : array { - return []; - } - - - protected function _disableItemsMap() { + protected function _disableItemsMap() + { $preferences = new Class_Profil_ItemsSettings($this->_profile); $params = $preferences->toArray(); - $params ['all_items_map'] = 0; + $params['all_items_map'] = 0; $preferences ->setSettings($params) ->save(); @@ -142,155 +142,170 @@ class Class_Template_ProfilePatcher extends Class_Template_NullPatcher { return $this->_clearCache(); } - - protected function _setActionSettings($controller, $action, $settings) { - (new Class_Profil_Preferences()) + protected function _setActionSettings($controller, $action, $settings, $sub_action = '') + { + (new Class_Profil_Preferences) ->setModulePref($this->_profile, - (new Class_Profil_ModuleDefinition($controller, - $action)), - $settings); + new Class_Profil_ModuleDefinition($controller, + $action, + $sub_action), + $settings); return $this->_clearCache(); } - - protected function _setSimpleSearchSettings($settings) { - (new Class_Profil_Preferences()) + protected function _setSimpleSearchSettings($settings) + { + (new Class_Profil_Preferences) ->setModulePref($this->_profile, - (new Class_Profil_ModuleDefinition('recherche', - 'resultat', - 'simple')), - $settings); + new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple'), + $settings); return $this->_clearCache(); } - - - protected function _setNoMapsInBibSettings($settings) { - (new Class_Profil_Preferences()) + protected function _setNoMapsInBibSettings($settings) + { + (new Class_Profil_Preferences) ->setModulePref($this->_profile, - (new Class_Profil_ModuleDefinition('bib', - 'en-lire-plus')), - $settings); + new Class_Profil_ModuleDefinition('bib', + 'en-lire-plus'), + $settings); return $this->_clearCache(); } - - protected function _setNoTeamsInBibSettings($settings) { - (new Class_Profil_Preferences()) + protected function _setNoTeamsInBibSettings($settings) + { + (new Class_Profil_Preferences) ->setModulePref($this->_profile, - (new Class_Profil_ModuleDefinition('bib', - 'en-lire-plus')), - $settings); + new Class_Profil_ModuleDefinition('bib', + 'en-lire-plus'), + $settings); return $this->_clearCache(); } - - protected function _enableLibraryNoveltiesTab() : self { + protected function _enableLibraryNoveltiesTab(): self + { return $this->_setActionSettings('bib', 'en-lire-plus', - [Intonation_Library_View_Wrapper_Library_RichContent_Novelties::class => '1']); + [Intonation_Library_View_Wrapper_Library_RichContent_Novelties::class => '1']); } - - protected function _setNoMediaInNoticeSettings(array $settings) : self { - foreach ( [Class_TypeDoc::LIVRE, - Class_TypeDoc::PERIODIQUE] as $doc_type_id) - (new Class_Profil_Preferences()) - ->setModulePref($this->_profile, - (new Class_Profil_ModuleDefinition('recherche', - 'viewnotice', - $doc_type_id)), - $settings); + protected function _setNoMediaInNoticeSettings(array $settings): self + { + foreach ([Class_TypeDoc::LIVRE, + Class_TypeDoc::PERIODIQUE] as $doc_type_id)(new Class_Profil_Preferences) + ->setModulePref($this->_profile, + new Class_Profil_ModuleDefinition('recherche', + 'viewnotice', + $doc_type_id), + $settings); return $this->_clearCache(); } - - protected function _createPage(string $title) : Class_Template_ProfilePatcher_Profile { + protected function _createPage(string $title): Class_Template_ProfilePatcher_Profile + { if ($page = Class_Profil::findFirstBy(['parent_id' => $this->_profile->getId(), - 'libelle' => $title])) { + 'libelle' => $title])) { return (new Class_Template_ProfilePatcher_Profile($page))->removeWidgets(); } $page = Class_Profil::newInstance(['parent_profil' => $this->_profile, - 'libelle' => $title]); + 'libelle' => $title]); $page->save(); return new Class_Template_ProfilePatcher_Profile($page); } - protected function _getOrCreateCategory($label): Class_ArticleCategorie { return Class_ArticleCategorie::getOrCreate($label, - Class_ArticleCategorie::getOrCreate($this->_('Magasin de thèmes'))); + Class_ArticleCategorie::getOrCreate($this->_('Magasin de thèmes'))); } - protected function _getOrCreateArticle(string $label, - string $content, - Class_ArticleCategorie $category, - array $attribs = []): Class_Article + string $content, + Class_ArticleCategorie $category, + array $attribs = []): Class_Article { return Class_Article_Loader::getOrCreate($label, $content, $category, $attribs); } - - - protected function _addWidgetInMenu($code, $settings) { + protected function _addWidgetInMenu($code, $settings) + { return - ['type_menu' => 'MODULE_ACCUEIL_' . $code, + ['type_menu' => 'MODULE_ACCUEIL_' . $code, 'type_module' => $code, 'preferences' => $settings]; } - - protected function _setHeaderSettings($settings) { + protected function _setHeaderSettings($settings) + { (new Class_Template_ProfilePatcher_Profile($this->_profile)) ->setHeaderSettings($settings); return $this->_clearCache(); } - - protected function _setMainSettings($settings) { + protected function _setMainSettings($settings) + { (new Class_Template_ProfilePatcher_Profile($this->_profile)) ->setMainSettings($settings); return $this->_clearCache(); } - - protected function _setFooterSettings($settings) { + protected function _setFooterSettings($settings) + { (new Class_Template_ProfilePatcher_Profile($this->_profile)) ->setFooterSettings($settings); return $this->_clearCache(); } - - protected function _setFirstSideSettings(array $settings) : self { + protected function _setFirstSideSettings(array $settings): self + { (new Class_Template_ProfilePatcher_Profile($this->_profile)) ->setFirstSideSettings($settings); return $this->_clearCache(); } - - protected function _setSecondSideSettings(array $settings) : self { + protected function _setSecondSideSettings(array $settings): self + { (new Class_Template_ProfilePatcher_Profile($this->_profile)) ->setSecondSideSettings($settings); return $this->_clearCache(); } - - protected function _clearCache() : self { + protected function _clearCache(): self + { Class_Profil::clearCache(); $this->_profile = Class_Profil::find($this->_profile_id); + return $this; } + + protected function _findOrCreateArticle(string $title, + string $content, + Class_ArticleCategorie $categorie): Class_Article + { + if ($article = Class_Article::findFirstBy(['titre' => $title, + 'id_cat' => $categorie->getId()])) + return $article; + $article = (new Class_Article) + ->updateAttributes(['titre' => $title, + 'contenu' => $content, + 'categorie' => $categorie, + 'status' => Class_Article::STATUS_VALIDATED]); + + $article->save(); + + return $article; + } } diff --git a/library/ZendAfi/View/Helper/Template/Abonne/NewSuggestionPage.php b/library/ZendAfi/View/Helper/Template/Abonne/NewSuggestionPage.php index 9d4d889ba9c2d1358274cff2700ebf7fd13d5a02..6bf306b58c0ffedb4bd4ee6c796b95d700a75c73 100644 --- a/library/ZendAfi/View/Helper/Template/Abonne/NewSuggestionPage.php +++ b/library/ZendAfi/View/Helper/Template/Abonne/NewSuggestionPage.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2024, Agence Française Informatique (AFI). All rights reserved. * @@ -18,56 +19,50 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - class ZendAfi_View_Helper_Template_Abonne_NewSuggestionPage extends ZendAfi_View_Helper_BaseHelper { - public function Abonne_NewSuggestionPage(array $records, ZendAfi_Form $form, array $preferences): string { - $help_message = ($help = (trim($preferences['help-text'] ?? ''))) + $help_message = ($help = trim($preferences['help-text'] ?? '')) ? $this->_div(['class' => 'col-12'], - $this->view->tag('p', - $help, - ['class' => 'help-text'])) - : '' ; + $this->view->tag('p', + $help, + ['class' => 'help-text'])) + : ''; $form_string = $this->_div(['class' => 'col-11 col-lg-8 page_with_form'], - $this->view->renderForm($form)); + $this->view->renderForm($form)); - if ( ! $records) + if (!$records) return $this->view->grid($help_message . $form, [], ['class' => 'justify-content-center']); - $records_html = $this->_renderRecords($records); $intro = $this->_div(['class' => 'col-11 col-lg-8'], - $this->view->tag('p', $this->_('Les documents suivants sont dans le catalogue.')) - . $this->view->tag('p', $this->_('Veuillez vérifier que votre suggestion n\'est pas présente', - $form->titleValue()))); + $this->view->tag('p', $this->_('Les documents suivants sont dans le catalogue.')) + . $this->view->tag('p', $this->_('Veuillez vérifier que votre suggestion n\'est pas présente', + $form->titleValue()))); $send_form = $this->_div(['class' => 'col-11'], - $this->view->button((new Class_Button) - ->setText($this->_('Confirmer l\'envoi de la suggestion')) - ->setAttrib('aria-label',$this->_('Confirmer l\'envoi de la suggestion d\'achat')) - ->setAttrib('onclick', - "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();" - ))); + $this->view->button((new Class_Button) + ->setText($this->_('Confirmer l\'envoi de la suggestion')) + ->setAttrib('aria-label', $this->_('Confirmer l\'envoi de la suggestion d\'achat')) + ->setAttrib('onclick', + "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();" + ))); - return $this->view->grid( $help_message . $form_string . $intro . $records_html . $send_form, [], ['class' => 'justify-content-center']); + return $this->view->grid($help_message . $form_string . $intro . $records_html . $send_form, [], ['class' => 'justify-content-center']); } - protected function _renderRecords(array $records): string { $callback = function ($record) { $wrapped = Class_Template::current()->newWrapper($record, $this->view); + return $this->view->renderingOnlyImage($wrapped); }; return $this->_div(['class' => 'col-12 mt-3 p-0'], - $this->view->multipleCarousel(new Storm_Collection($records), - $callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(3))); + $this->view->responsiveCarouselPlus(new Storm_Collection($records), + $callback)); } - } diff --git a/library/templates/Chili/View/AbstractHighlightCarousel.php b/library/ZendAfi/View/Helper/Template/AbstractHighlightCarousel.php similarity index 97% rename from library/templates/Chili/View/AbstractHighlightCarousel.php rename to library/ZendAfi/View/Helper/Template/AbstractHighlightCarousel.php index c16391bc68a1847375b494b078d0e7161dc4aeef..6581c1bedb13eab21229e4bb458f1628068fd4fd 100644 --- a/library/templates/Chili/View/AbstractHighlightCarousel.php +++ b/library/ZendAfi/View/Helper/Template/AbstractHighlightCarousel.php @@ -20,7 +20,7 @@ */ -class Chili_View_AbstractHighlightCarousel +class ZendAfi_View_Helper_Template_AbstractHighlightCarousel extends ZendAfi_View_Helper_Template_MultipleCarousel { protected $_highlight_class, @@ -30,7 +30,8 @@ class Chili_View_AbstractHighlightCarousel protected function _renderCarousel(Storm_Collection $collection, ?Callable $callback, - Intonation_Library_Widget_Carousel_Settings $settings) { + Intonation_Library_Widget_Carousel_Settings $settings): string + { if ($collection->isEmpty()) return ''; diff --git a/library/templates/Chili/View/HighlightCardify.php b/library/ZendAfi/View/Helper/Template/HighlightCardify.php similarity index 81% rename from library/templates/Chili/View/HighlightCardify.php rename to library/ZendAfi/View/Helper/Template/HighlightCardify.php index 64695056465b186fc9ce5a48563c53c2cbe8aa7d..b2c8d6576dea05cfd4c5fe66477ce56014113e2b 100644 --- a/library/templates/Chili/View/HighlightCardify.php +++ b/library/ZendAfi/View/Helper/Template/HighlightCardify.php @@ -20,14 +20,17 @@ */ -class Chili_View_HighlightCardify extends ZendAfi_View_Helper_Template_RenderingOnlyImage { +class ZendAfi_View_Helper_Template_HighlightCardify extends ZendAfi_View_Helper_Template_RenderingOnlyImage +{ - public function highlightCardify($element) { + public function highlightCardify($element): string + { return parent::renderingOnlyImage($element); } - protected function _overlay($element) { + protected function _overlay($element):string + { return $this->view->renderingDescription($element); } -} \ No newline at end of file +} diff --git a/library/ZendAfi/View/Helper/Template/MultipleCarousel.php b/library/ZendAfi/View/Helper/Template/MultipleCarousel.php index c7129ce5469de2b5f423401aa71652f8fb05e470..d1cc666674c675e10a7fd4ecf6383c766993d100 100644 --- a/library/ZendAfi/View/Helper/Template/MultipleCarousel.php +++ b/library/ZendAfi/View/Helper/Template/MultipleCarousel.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved. * @@ -18,51 +19,49 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class ZendAfi_View_Helper_Template_MultipleCarousel - extends Intonation_View_Abstract_Carousel { - +class ZendAfi_View_Helper_Template_MultipleCarousel extends Intonation_View_Abstract_Carousel +{ public function multipleCarousel(Storm_Collection $collection, - Closure $callback, - Intonation_Library_Widget_Carousel_Settings $settings) : string { + Closure $callback, + Intonation_Library_Widget_Carousel_Settings $settings): string + { return $this->_renderCarousel($collection, $callback, $settings); } - - protected function _numberOfPages($collection) { + protected function _numberOfPages($collection) + { return ceil($collection->count() / $this->_settings->getColumns()); } - - protected function _shouldShowControls($collection) { + protected function _shouldShowControls($collection) + { return 1 < $this->_numberOfPages($collection); } - - protected function _carouselClasses() { + protected function _carouselClasses() + { return 'carousel slide multiple_carousel'; } - protected function _carouselInner(Storm_Collection $collection, - string $id, - Callable $callback) : string { + string $id, + callable $callback): string + { $cards = array_filter($collection->injectInto([], - function($html, $element) use ($callback) - { - $html [] = $callback($element); - return $html; - })); + function ($html, $element) use ($callback) { + $html[] = $callback($element); + + return $html; + })); return parent::_carouselInner($this->_cardLayout($cards), - $id, - fn($element) => $element); + $id, + fn($element) => $element); } - - protected function _cardLayout($cards) { + protected function _cardLayout($cards) + { return $this->view->renderCardLayout($cards, $this->_settings->getColumns()); } } diff --git a/library/templates/Chili/View/RenderLeftHighlightCarousel.php b/library/ZendAfi/View/Helper/Template/RenderLeftHighlightCarousel.php similarity index 81% rename from library/templates/Chili/View/RenderLeftHighlightCarousel.php rename to library/ZendAfi/View/Helper/Template/RenderLeftHighlightCarousel.php index bfeeff07eec9482b9b626b33fd229b87089d05a7..e5356d2e13c6e41a26b91d086ecb7e377f415de6 100644 --- a/library/templates/Chili/View/RenderLeftHighlightCarousel.php +++ b/library/ZendAfi/View/Helper/Template/RenderLeftHighlightCarousel.php @@ -20,15 +20,18 @@ */ -class Chili_View_RenderLeftHighlightCarousel - extends Chili_View_AbstractHighlightCarousel { +class ZendAfi_View_Helper_Template_RenderLeftHighlightCarousel + extends ZendAfi_View_Helper_Template_AbstractHighlightCarousel +{ protected $_highlight_class = 'left_highlight_carousel', $_highlight_column_class = 'left_highlight_column', $_columns_class = 'left_carousel_columns'; - public function renderLeftHighlightCarousel($elements, $content_callback) { + public function renderLeftHighlightCarousel(Storm_Collection $elements, + ?Callable $content_callback): string + { return $this->_renderCarousel($elements, $content_callback, ((new Intonation_Library_Widget_Carousel_Settings) diff --git a/library/templates/Chili/View/RenderTopHighlightCarousel.php b/library/ZendAfi/View/Helper/Template/RenderTopHighlightCarousel.php similarity index 81% rename from library/templates/Chili/View/RenderTopHighlightCarousel.php rename to library/ZendAfi/View/Helper/Template/RenderTopHighlightCarousel.php index 729291c8276f5f208d095b8cd294fa91188016b7..dd2651eb24b2710cce7b598c37062fdd67f75ff7 100644 --- a/library/templates/Chili/View/RenderTopHighlightCarousel.php +++ b/library/ZendAfi/View/Helper/Template/RenderTopHighlightCarousel.php @@ -20,15 +20,18 @@ */ -class Chili_View_RenderTopHighlightCarousel - extends Chili_View_AbstractHighlightCarousel { +class ZendAfi_View_Helper_Template_RenderTopHighlightCarousel + extends ZendAfi_View_Helper_Template_AbstractHighlightCarousel +{ protected $_highlight_class = 'top_highlight_carousel', $_highlight_column_class = 'top_highlight_column', $_columns_class = 'top_carousel_columns'; - public function renderTopHighlightCarousel($elements, $content_callback) { + public function renderTopHighlightCarousel(Storm_Collection $elements, + ?Callable $content_callback): string + { return $this->_renderCarousel($elements, $content_callback, (new Intonation_Library_Widget_Carousel_Settings)->setColumns(6)); diff --git a/library/templates/Chili/View/MultipleCarousel.php b/library/ZendAfi/View/Helper/Template/ResponsiveCarousel.php similarity index 68% rename from library/templates/Chili/View/MultipleCarousel.php rename to library/ZendAfi/View/Helper/Template/ResponsiveCarousel.php index 3741af5db8ae2df30bda103a57efe2a09a1c5315..d364e5f8fa167011976a14ee0af0e322886547fd 100644 --- a/library/templates/Chili/View/MultipleCarousel.php +++ b/library/ZendAfi/View/Helper/Template/ResponsiveCarousel.php @@ -20,12 +20,21 @@ */ -class Chili_View_MultipleCarousel +class ZendAfi_View_Helper_Template_ResponsiveCarousel extends ZendAfi_View_Helper_Template_MultipleCarousel { - protected function _renderCarousel($collection, - $callback, - Intonation_Library_Widget_Carousel_Settings $settings) { + public function responsiveCarousel(Storm_Collection $collection, + ?Closure $callback, + ?Intonation_Library_Widget_Carousel_Settings $settings = null): string + { + return $this->_renderCarousel($collection, $callback, $settings ?? new Intonation_Library_Widget_Carousel_Settings); + } + + + protected function _renderCarousel(Storm_Collection $collection, + ?Callable $callback, + Intonation_Library_Widget_Carousel_Settings $settings): string + { if ($collection->isEmpty()) return ''; @@ -36,22 +45,16 @@ class Chili_View_MultipleCarousel ->setView($this->view); $html = [ - $this->_div(['class' => 'col-12 d-none d-lg-block'], + $this->_div(['class' => 'responsive_carousel_md'], parent::_renderCarousel($collection, $callback, - $settings->setColumns(5))), - - $this->_div(['class' => 'col-12 d-none d-md-block d-lg-none'], - $md_helper->multipleCarousel($collection, - $callback, - ($settings - ->setColumns(3)))), + $settings->setColumns(3))), - $this->_div(['class' => 'col-12 d-block d-md-none'], + $this->_div(['class' => 'responsive_carousel_xs'], $this->view->layoutCarousel($collection, $callback, $settings->setColumns(1)))]; - return $this->view->grid($html, ['class' => 'responsive_multiple_carousel']); + return $this->view->grid($html, ['class' => 'responsive_multiple_carousel responsive_carousel']); } } diff --git a/library/ZendAfi/View/Helper/Template/ResponsiveCarouselPlus.php b/library/ZendAfi/View/Helper/Template/ResponsiveCarouselPlus.php new file mode 100644 index 0000000000000000000000000000000000000000..1ccbab38f121c156711342c5920aafb7e1eb1e1a --- /dev/null +++ b/library/ZendAfi/View/Helper/Template/ResponsiveCarouselPlus.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_View_Helper_Template_ResponsiveCarouselPlus + extends ZendAfi_View_Helper_Template_MultipleCarousel +{ + + public function responsiveCarouselPlus(Storm_Collection $collection, + Closure $callback, + ?Intonation_Library_Widget_Carousel_Settings $settings = null): string + { + return $this->_renderCarousel($collection, $callback, $settings ?? new Intonation_Library_Widget_Carousel_Settings); + } + + + protected function _renderCarousel(Storm_Collection $collection, + ?Callable $callback, + Intonation_Library_Widget_Carousel_Settings $settings): string + { + + if ($collection->isEmpty()) + return ''; + + $this->_settings = $settings; + + $md_helper = (new ZendAfi_View_Helper_Template_MultipleCarousel) + ->setView($this->view); + + $html = [ + $this->_div(['class' => 'responsive_multiple_carousel_xl'], + parent::_renderCarousel($collection, + $callback, + $settings->setColumns(5))), + + $this->_div(['class' => 'responsive_multiple_carousel_md'], + $md_helper->multipleCarousel($collection, + $callback, + ($settings + ->setColumns(3)))), + + $this->_div(['class' => 'responsive_multiple_carousel_xs'], + $this->view->layoutCarousel($collection, + $callback, + $settings->setColumns(1)))]; + + return $this->view->grid($html, ['class' => 'responsive_multiple_carousel responsive_carousel_plus']); + } +} diff --git a/library/templates/Chili/Assets/css/chili.css b/library/templates/Chili/Assets/css/chili.css index 8a272d10113a8b026d78eaed1d9c4ce9ecccfdf5..2434663fe21eb102544449743b09209ea356fab2 100644 --- a/library/templates/Chili/Assets/css/chili.css +++ b/library/templates/Chili/Assets/css/chili.css @@ -209,47 +209,6 @@ header .widget.login .dropdown-menu.dropdown-menu-right.show { background-color: var(--chili-white-bg); } -.boite [class*="highlight_carousel"] .card-img-overlay { - display: table; - height: 100%; - width: 100%; -} - -.boite [class*="highlight_carousel"] .card-img-overlay > .card { - display: table-cell; - vertical-align: bottom; -} - -.boite [class*="highlight_carousel"] [class*="highlight_column"] { - overflow: hidden; -} - -.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card, -.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card > a, -.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card > a *{ - height: 100%; - width: auto; - max-width: none; -} - -.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card > a { - min-height: 250px; -} - -.boite [class*="highlight_carousel"] .card { - padding: 5px; -} - -.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card { - padding: 0; -} - -.boite [class*="highlight_carousel"] .card-img-overlay .card { - background-color: var(--front-transparent-background); - border: none !important; - box-shadow: none !important; -} - .boite [class*="highlight_carousel"] .card-img-overlay .card a, .boite [class*="highlight_carousel"] .card-img-overlay .card p, .boite [class*="highlight_carousel"] .card-img-overlay .card span { diff --git a/library/templates/Chili/Library/ProfilePatcher.php b/library/templates/Chili/Library/ProfilePatcher.php index a05db93cd45161d33e1d5df847e8297a1ecd4809..5bdc03b4e655e83afcce64eefd48bd4639843ca1 100644 --- a/library/templates/Chili/Library/ProfilePatcher.php +++ b/library/templates/Chili/Library/ProfilePatcher.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,137 +19,155 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { - +class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher +{ protected $_grey_styles_pack; - protected - $_main_menu, - $_search_menu, - $_network_menu, - $_legal_mentions_menu, - $_login_menu, - $_not_logged_menu, - - $_logo_widget_styles_pack, - $_widget_fixed_top_styles_pack, - $_search_button_widget_styles_pack, - $_banner_widget_styles_pack, - $_red_background_styles_pack, - $_breadcrumb_styles_pack, - $_white_styles_pack, - $_footer_styles_pack, - - $_full_width_responsive_pack, - $_quarter_width_responsive_pack; + protected $_main_menu; + protected $_search_menu; + protected $_network_menu; + protected $_legal_mentions_menu; + protected $_login_menu; + protected $_not_logged_menu; + protected $_logo_widget_styles_pack; + protected $_widget_fixed_top_styles_pack; + protected $_search_button_widget_styles_pack; + protected $_banner_widget_styles_pack; + protected $_red_background_styles_pack; + protected $_breadcrumb_styles_pack; + protected $_white_styles_pack; + protected $_footer_styles_pack; + protected $_full_width_responsive_pack; + protected $_quarter_width_responsive_pack; + + public function getDefaultWidgetMenuConfiguration(array $params): array + { + return + ['boite' => ['text-center'], + $this->_template->withNameSpace('styles_pack') => $this->_widget_fixed_top_styles_pack->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_LARGE, + $this->_template->withNameSpace('width_xsmall') => 8, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]; + } + public function getDefaultWidgetConfiguration(array $params): array + { + return + ['link_to_all' => 0, + $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), + $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]; + } - protected function _generatePacks() { + protected function _generatePacks() + { $this->_logo_widget_styles_pack = $this->_getOrCreateStylePack($this->_('Boite logo'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_fixed_top', - 'w-100', - 'chili_widget', - 'chili_logo']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_fixed_top', + 'w-100', + 'chili_widget', + 'chili_logo']); $this->_widget_fixed_top_styles_pack = $this->_getOrCreateStylePack($this->_('Fixé en haut'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_fixed_top', - 'w-100', - 'chili_widget']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_fixed_top', + 'w-100', + 'chili_widget']); $this->_search_button_widget_styles_pack = $this->_getOrCreateStylePack($this->_('Bouton de recherche'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_fixed_top', - 'w-100', - 'position_fixed_top']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_fixed_top', + 'w-100', + 'position_fixed_top']); $this->_banner_widget_styles_pack = $this->_getOrCreateStylePack($this->_('Boite bannière'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_widget', - 'chili_banner', - 'fond_blanc']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_widget', + 'chili_banner', + 'fond_blanc']); $this->_red_background_styles_pack = $this->_getOrCreateStylePack($this->_('Boite rouge'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_widget', - 'fond_rouge', - 'align-item-center']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_widget', + 'fond_rouge', + 'align-item-center']); $this->_breadcrumb_styles_pack = $this->_getOrCreateStylePack($this->_('Boite fil d\'Ariane'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_widget', - 'm-auto', - 'justify-content-start']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_widget', + 'm-auto', + 'justify-content-start']); $this->_grey_styles_pack = $this->_getOrCreateStylePack($this->_('Boite grise'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_widget', - 'm-auto', - 'fond_gris', - 'my-3', - 'py-3', - 'limit_badges_5']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_widget', + 'm-auto', + 'fond_gris', + 'my-3', + 'py-3', + 'limit_badges_5']); $this->_white_styles_pack = $this->_getOrCreateStylePack($this->_('Boite blanche'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'chili_widget', - 'm-auto', - 'fond_blanc', - 'my-3', - 'py-3', - 'limit_badges_5']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'chili_widget', + 'm-auto', + 'fond_blanc', + 'my-3', + 'py-3', + 'limit_badges_5']); $this->_footer_styles_pack = $this->_getOrCreateStylePack($this->_('Boite pied de page'), - ['no_border', - 'no_border_radius', - 'no_shadow', - 'admin_tools_invert_colors', - 'chili_footer_widget', - 'px-3']); + ['no_border', + 'no_border_radius', + 'no_shadow', + 'admin_tools_invert_colors', + 'chili_footer_widget', + 'px-3']); $this->_full_width_responsive_pack = $this->_getOrCreateResponsivePack($this->_('1 colonne, centrée, adaptable'), - [$this->_nameSpaced('width_xsmall') => 12, - $this->_nameSpaced('width_large') => 10]); + [$this->_nameSpaced('width_xsmall') => 12, + $this->_nameSpaced('width_large') => 10]); $this->_quarter_width_responsive_pack = $this->_getOrCreateResponsivePack($this->_('4 colonnes puis 1'), - [$this->_nameSpaced('width_xsmall') => 12, - $this->_nameSpaced('width_large') => 3]); + [$this->_nameSpaced('width_xsmall') => 12, + $this->_nameSpaced('width_large') => 3]); return $this; } - - protected function _upgradeProfile() { + protected function _upgradeProfile() + { parent::_upgradeProfile(); $this->_profile @@ -157,18 +176,18 @@ class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { $codes = (new Class_Codification)->getCodesForFacets(); - (new Class_Profil_Preferences()) + (new Class_Profil_Preferences) ->setModulePref($this->_profile, - (new Class_Profil_ModuleDefinition('recherche', - 'resultat', - 'simple')), - ['boite' => ['no_border'], - 'facettes_codes' => implode('', $codes), - 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_LIST, - 'facets_order' => 1, - 'search_suggests' => 0, - 'multi_facettes' => 0, - 'facets_closed_codes' => implode('', array_diff($codes,[Class_TypeDoc::CODE_FACETTE]))]); + new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple'), + ['boite' => ['no_border'], + 'facettes_codes' => implode('', $codes), + 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_LIST, + 'facets_order' => 1, + 'search_suggests' => 0, + 'multi_facettes' => 0, + 'facets_closed_codes' => implode('', array_diff($codes, [Class_TypeDoc::CODE_FACETTE]))]); Class_AdminVar::set('MENU_BOITE', 1); Class_AdminVar::set('ENABLE_IDENTITY_PROVIDERS', 1); @@ -176,60 +195,60 @@ class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { return $this; } - - protected function _upgradeSections() { - $section_main = ((new Class_Systeme_Widget_Section_Main) + protected function _upgradeSections() + { + $section_main = (new Class_Systeme_Widget_Section_Main) ->setProfileId($this->_profile_id) - ->load()); + ->load(); $section_main - ->setNewDatas(['boite' => [''], + ->setNewDatas(['boite' => [''], $this->_template->withNameSpace('width_xsmall') => 12]) ->updateProfile(); Class_Profil::clearCache(); - $first_section = ((new Class_Systeme_Widget_Section_FirstSide) + $first_section = (new Class_Systeme_Widget_Section_FirstSide) ->setProfileId($this->_profile_id) - ->load()); + ->load(); $first_section - ->setNewDatas(['boite' => [''], - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('visibility_index') => 1, + ->setNewDatas(['boite' => [''], + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('visibility_index') => 1, $this->_template->withNameSpace('visibility_recherche') => 0, - $this->_template->withNameSpace('visibility_abonne') => 0, - $this->_template->withNameSpace('visibility_cms') => 0, - $this->_template->withNameSpace('visibility_blog') => 0, - $this->_template->withNameSpace('visibility_auth') => 0]) + $this->_template->withNameSpace('visibility_abonne') => 0, + $this->_template->withNameSpace('visibility_cms') => 0, + $this->_template->withNameSpace('visibility_blog') => 0, + $this->_template->withNameSpace('visibility_auth') => 0]) ->updateProfile(); Class_Profil::clearCache(); - $second_section = ((new Class_Systeme_Widget_Section_SecondSide) + $second_section = (new Class_Systeme_Widget_Section_SecondSide) ->setProfileId($this->_profile_id) - ->load()); + ->load(); $second_section - ->setNewDatas(['boite' => [''], - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('visibility_index') => 1, + ->setNewDatas(['boite' => [''], + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('visibility_index') => 1, $this->_template->withNameSpace('visibility_recherche') => 0, - $this->_template->withNameSpace('visibility_abonne') => 0, - $this->_template->withNameSpace('visibility_cms') => 0, - $this->_template->withNameSpace('visibility_blog') => 0, - $this->_template->withNameSpace('visibility_auth') => 0]) + $this->_template->withNameSpace('visibility_abonne') => 0, + $this->_template->withNameSpace('visibility_cms') => 0, + $this->_template->withNameSpace('visibility_blog') => 0, + $this->_template->withNameSpace('visibility_auth') => 0]) ->updateProfile(); Class_Profil::clearCache(); - $section_footer = ((new Class_Systeme_Widget_Section_Footer) + $section_footer = (new Class_Systeme_Widget_Section_Footer) ->setProfileId($this->_profile_id) - ->load()); + ->load(); $section_footer - ->setNewDatas(['boite' => ['fond_bleu'], + ->setNewDatas(['boite' => ['fond_bleu'], $this->_template->withNameSpace('width_xsmall') => 12]) ->updateProfile(); @@ -240,182 +259,180 @@ class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { return $this; } - - protected function _upgradeMenus() { + protected function _upgradeMenus() + { $this->_main_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu principal'), - 'picto' => '', - 'menus' => [ - ['type_menu' => 'ACCUEIL', - 'libelle' => $this->_('Accueil'), + 'picto' => '', + 'menus' => [ + ['type_menu' => 'ACCUEIL', + 'libelle' => $this->_('Accueil'), 'use_profil' => $this->_profile_id], ['type_menu' => 'URL', - 'libelle' => $this->_('Médiathèques'), - 'url' => ''], + 'libelle' => $this->_('Médiathèques'), + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Catalogue'), - 'url' => ''], + 'libelle' => $this->_('Catalogue'), + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Agenda'), - 'url' => ''], + 'libelle' => $this->_('Agenda'), + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Offre en ligne'), - 'url' => ''], + 'libelle' => $this->_('Offre en ligne'), + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Nouveautés'), - 'url' => ''], + 'libelle' => $this->_('Nouveautés'), + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Coups de coeur'), - 'url' => ''], + 'libelle' => $this->_('Coups de coeur'), + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Services'), - 'url' => ''] - ] + 'libelle' => $this->_('Services'), + 'url' => ''], + ], ]); - $this->_search_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu de recherche en scroll'), - 'picto' => '', - 'menus' => [ - ['type_menu' => 'MODULE_ACCUEIL_RECH_SIMPLE', + 'picto' => '', + 'menus' => [ + ['type_menu' => 'MODULE_ACCUEIL_RECH_SIMPLE', 'type_module' => 'RECH_SIMPLE', - 'libelle' => $this->_('Boites de recherche'), - - 'preferences' => ['titre' => $this->_('Recherche'), - 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'chili_widget', 'fond_rouge', 'align-item-center'], - 'search_button' => 'Rechercher', - 'placeholder' => $this->_('Recherchez un livre, un CD, un DVD, une musique...'), - 'doc_type_selection_label' => $this->_('Catégories'), - 'select_doc' => 1, - 'facets_in_session' => 1, - 'always_new_search' => 0, - 'type_doc' => '', - $this->_template->withNameSpace('form_style') => 'inline', + 'libelle' => $this->_('Boites de recherche'), + + 'preferences' => ['titre' => $this->_('Recherche'), + 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'chili_widget', 'fond_rouge', 'align-item-center'], + 'search_button' => 'Rechercher', + 'placeholder' => $this->_('Recherchez un livre, un CD, un DVD, une musique...'), + 'doc_type_selection_label' => $this->_('Catégories'), + 'select_doc' => 1, + 'facets_in_session' => 1, + 'always_new_search' => 0, + 'type_doc' => '', + $this->_template->withNameSpace('form_style') => 'inline', $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]], - + $this->_template->withNameSpace('show_footer') => 0]], ]]); $this->_login_menu = $this->_profile ->addMenu(['libelle' => $this->_('Boite de connexion : menu connecté'), - 'picto' => '', - 'menus' => [ + 'picto' => '', + 'menus' => [ ['type_menu' => 'ABON_FICHE', - 'libelle' => $this->_('Mon compte'), - 'picto' => 'class fas fa-user-circle'], + 'libelle' => $this->_('Mon compte'), + 'picto' => 'class fas fa-user-circle'], - ['type_menu' => 'ABON_PRETS', - 'libelle' => $this->_('Mes prêts en cours'), - 'picto' => 'class fas fa-book', + ['type_menu' => 'ABON_PRETS', + 'libelle' => $this->_('Mes prêts en cours'), + 'picto' => 'class fas fa-book', 'display_counter' => '1'], - ['type_menu' => 'ABON_RESAS', - 'libelle' => $this->_('Mes réservations en cours'), - 'picto' => 'class fas fa-thumbtack', + ['type_menu' => 'ABON_RESAS', + 'libelle' => $this->_('Mes réservations en cours'), + 'picto' => 'class fas fa-thumbtack', 'display_counter' => '1'], - ['type_menu' => 'ABON_CARDS', - 'libelle' => $this->_('Mon abonnement'), - 'picto' => 'class fas fa-receipt', + ['type_menu' => 'ABON_CARDS', + 'libelle' => $this->_('Mon abonnement'), + 'picto' => 'class fas fa-receipt', 'display_end_validity' => '1'], ['type_menu' => 'URL', - 'libelle' => $this->_('Découvrir notre site insitutionnel'), - 'url' => ''], + 'libelle' => $this->_('Découvrir notre site insitutionnel'), + 'url' => ''], ['type_menu' => 'DISCONNECT', - 'libelle' => $this->_('Se déconnecter')], + 'libelle' => $this->_('Se déconnecter')], ['type_menu' => 'FORM_CONTACT', - 'libelle' => $this->_('Un problème ? Contactez-nous !'), - 'url' => ''], + 'libelle' => $this->_('Un problème ? Contactez-nous !'), + 'url' => ''], ]]); $this->_not_logged_menu = $this->_profile ->addMenu(['libelle' => $this->_('Boite de connexion : menu déconnecté'), - 'picto' => '', - 'menus' => [ + 'picto' => '', + 'menus' => [ ['type_menu' => 'LOST_PASSWORD', - 'libelle' => $this->_('Mot de passe oublié ?')], + 'libelle' => $this->_('Mot de passe oublié ?')], ['type_menu' => 'PREREGISTRATION', - 'libelle' => $this->_('Je n\'ai pas encore de compte !')], + 'libelle' => $this->_('Je n\'ai pas encore de compte !')], ['type_menu' => 'FORM_CONTACT', - 'libelle' => $this->_('Un problème ? Contactez-nous !')], + 'libelle' => $this->_('Un problème ? Contactez-nous !')], - ['type_menu' => 'MODULE_ACCUEIL_IDENTITY_PROVIDER', + ['type_menu' => 'MODULE_ACCUEIL_IDENTITY_PROVIDER', 'type_module' => 'MODULE_ACCUEIL_IDENTITY_PROVIDER', - 'libelle' => $this->_('Connecteurs tiers'), - 'preferences' => ['titre' => $this->_('Connecteurs tierces'), - 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'm-auto', 'no_overflow', 'p-0'], + 'libelle' => $this->_('Connecteurs tiers'), + 'preferences' => ['titre' => $this->_('Connecteurs tierces'), + 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'm-auto', 'no_overflow', 'p-0'], $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]], + $this->_template->withNameSpace('show_footer') => 0]], ]]); $this->_network_menu = $this->_profile ->addMenu(['libelle' => $this->_('Le réseau'), - 'picto' => '', - 'menus' => [ - ['type_menu' => 'MODULE_ACCUEIL_IMAGE', + 'picto' => '', + 'menus' => [ + ['type_menu' => 'MODULE_ACCUEIL_IMAGE', 'type_module' => 'MODULE_ACCUEIL_IMAGE', - 'libelle' => $this->_('Loge réseau'), - 'preferences' => ['titre' => $this->_('Logo'), - 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'chili_logo_footer', 'm-auto', 'no_overflow'], - 'image' => '/library/templates/Chili/Assets/images/logo.jpg', - 'link' => '', + 'libelle' => $this->_('Loge réseau'), + 'preferences' => ['titre' => $this->_('Logo'), + 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'chili_logo_footer', 'm-auto', 'no_overflow'], + 'image' => '/library/templates/Chili/Assets/images/logo.jpg', + 'link' => '', $this->_template->withNameSpace('width_xsmall') => 6, - $this->_template->withNameSpace('width_large') => 12, - $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('width_large') => 12, + $this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]], + $this->_template->withNameSpace('show_footer') => 0]], - ['type_menu' => 'MODULE_ACCUEIL_LIBRARY', + ['type_menu' => 'MODULE_ACCUEIL_LIBRARY', 'type_module' => 'MODULE_ACCUEIL_LIBRARY', - 'libelle' => $this->_('Liste des bibliothèques'), - 'preferences' => ['titre' => $this->_('Bibliothèques'), - 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'chili_network_list_widget', 'mt-5'], - 'rendering' => 'card-description', - 'layout' => 'list', - 'osm_map' => 0, - 'size' => 100, + 'libelle' => $this->_('Liste des bibliothèques'), + 'preferences' => ['titre' => $this->_('Bibliothèques'), + 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'chili_network_list_widget', 'mt-5'], + 'rendering' => 'card-description', + 'layout' => 'list', + 'osm_map' => 0, + 'size' => 100, $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]] + $this->_template->withNameSpace('show_footer') => 0]], ]]); $this->_legal_mentions_menu = $this->_profile ->addMenu(['libelle' => $this->_('Mentions légales'), - 'picto' => '', - 'menus' => [ + 'picto' => '', + 'menus' => [ ['type_menu' => 'URL', - 'libelle' => $this->_('Mentions légales'), - 'url' => '', - 'picto' => ''], + 'libelle' => $this->_('Mentions légales'), + 'url' => '', + 'picto' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Politique de confidentialité'), - 'url' => '', - 'picto' => ''], + 'libelle' => $this->_('Politique de confidentialité'), + 'url' => '', + 'picto' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('2002 - Propulsé par Bokeh'), - 'url' => '', - 'picto' => ''], - ] + 'libelle' => $this->_('2002 - Propulsé par Bokeh'), + 'url' => '', + 'picto' => ''], + ], ]); $this->_profile->save(); @@ -423,231 +440,231 @@ class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { return $this; } - - protected function _upgradeWidgets() { + protected function _upgradeWidgets() + { $this ->removeWidgets() ->_addWidget(Intonation_Library_Widget_Image_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Logo du réseau'), - 'boite' => ['position_fixed_top_left', 'chili_fixed_top', 'order-2 order-lg-1'], - 'image' => '/library/templates/Chili/Assets/images/logo.jpg', - 'link' => '', - $this->_template->withNameSpace('styles_pack') => $this->_logo_widget_styles_pack->getId(), - $this->_template->withNameSpace('width_xsmall') => 1, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Logo du réseau'), + 'boite' => ['position_fixed_top_left', 'chili_fixed_top', 'order-2 order-lg-1'], + 'image' => '/library/templates/Chili/Assets/images/logo.jpg', + 'link' => '', + $this->_template->withNameSpace('styles_pack') => $this->_logo_widget_styles_pack->getId(), + $this->_template->withNameSpace('width_xsmall') => 1, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Nav_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Navigation principal'), - 'boite' => ['position_fixed_top', 'text-center', 'order-1', 'order-lg-2'], - 'menu' => $this->_profile_id . '-' . $this->_main_menu, - $this->_template->withNameSpace('styles_pack') => $this->_widget_fixed_top_styles_pack->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_LARGE, - $this->_template->withNameSpace('width_xsmall') => 8, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Navigation principal'), + 'boite' => ['position_fixed_top', 'text-center', 'order-1', 'order-lg-2'], + 'menu' => $this->_profile_id . '-' . $this->_main_menu, + $this->_template->withNameSpace('styles_pack') => $this->_widget_fixed_top_styles_pack->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_LARGE, + $this->_template->withNameSpace('width_xsmall') => 8, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Menu recherche'), - 'menu' => $this->_profile_id . '-' . $this->_search_menu, - 'layout' => 'horizontal', - $this->_template->withNameSpace('styles_pack') => $this->_search_button_widget_styles_pack->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_ALWAYS, - $this->_template->withNameSpace('visible_when_hidden') => 6, - $this->_template->withNameSpace('width_xsmall') => 1, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Menu recherche'), + 'menu' => $this->_profile_id . '-' . $this->_search_menu, + 'layout' => 'horizontal', + $this->_template->withNameSpace('styles_pack') => $this->_search_button_widget_styles_pack->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_ALWAYS, + $this->_template->withNameSpace('visible_when_hidden') => 6, + $this->_template->withNameSpace('width_xsmall') => 1, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Login_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Connexion'), - 'boite' => ['position_fixed_top_right', 'order-3'], - 'titre_connecte' => $this->_('Mon compte'), - 'message_connecte' => '', - 'identifiant' => $this->_('Identifiant'), - 'identifiant_exemple' => $this->_('Identifiant *'), - 'mot_de_passe' => $this->_('Mot de passe'), - 'mot_de_passe_exemple' => $this->_('Mot de passe *'), - 'lien_connexion' => $this->_('Se connecter'), - 'lien_deconnection' => $this->_('Se déconnecter'), - 'lien_mot_de_passe_oublie' => '', - 'lien_compte' => $this->_('SE CONNECTER'), - 'lien_creer_compte' => '', - 'pre_registration' => '', - 'authenticated_menu' => $this->_profile_id . '-' . $this->_login_menu, - 'not_authenticated_menu' => $this->_profile_id . '-' . $this->_not_logged_menu, - $this->_template->withNameSpace('styles_pack') => $this->_widget_fixed_top_styles_pack->getId(), - $this->_template->withNameSpace('form_style') => 'toggle', - $this->_template->withNameSpace('width_xsmall') => 2, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Connexion'), + 'boite' => ['position_fixed_top_right', 'order-3'], + 'titre_connecte' => $this->_('Mon compte'), + 'message_connecte' => '', + 'identifiant' => $this->_('Identifiant'), + 'identifiant_exemple' => $this->_('Identifiant *'), + 'mot_de_passe' => $this->_('Mot de passe'), + 'mot_de_passe_exemple' => $this->_('Mot de passe *'), + 'lien_connexion' => $this->_('Se connecter'), + 'lien_deconnection' => $this->_('Se déconnecter'), + 'lien_mot_de_passe_oublie' => '', + 'lien_compte' => $this->_('SE CONNECTER'), + 'lien_creer_compte' => '', + 'pre_registration' => '', + 'authenticated_menu' => $this->_profile_id . '-' . $this->_login_menu, + 'not_authenticated_menu' => $this->_profile_id . '-' . $this->_not_logged_menu, + $this->_template->withNameSpace('styles_pack') => $this->_widget_fixed_top_styles_pack->getId(), + $this->_template->withNameSpace('form_style') => 'toggle', + $this->_template->withNameSpace('width_xsmall') => 2, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Image_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Bannière'), - 'boite' => ['order-4'], - 'image' => '/library/templates/Chili/Assets/images/header.jpg', - 'link' => '', - $this->_template->withNameSpace('styles_pack') => $this->_banner_widget_styles_pack->getId(), - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Bannière'), + 'boite' => ['order-4'], + 'image' => '/library/templates/Chili/Assets/images/header.jpg', + 'link' => '', + $this->_template->withNameSpace('styles_pack') => $this->_banner_widget_styles_pack->getId(), + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Search_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Recherche'), - 'boite' => ['order-5'], - 'search_button' => 'Rechercher', - 'placeholder' => $this->_('Recherchez un livre, un CD, un DVD, une musique...'), - 'doc_type_selection_label' => $this->_('Catégories'), - 'select_doc' => 1, - 'facets_in_session' => 1, - 'always_new_search' => 0, - 'type_doc' => '', - $this->_template->withNameSpace('styles_pack') => $this->_red_background_styles_pack->getId(), - $this->_template->withNameSpace('form_style') => 'inline', - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Recherche'), + 'boite' => ['order-5'], + 'search_button' => 'Rechercher', + 'placeholder' => $this->_('Recherchez un livre, un CD, un DVD, une musique...'), + 'doc_type_selection_label' => $this->_('Catégories'), + 'select_doc' => 1, + 'facets_in_session' => 1, + 'always_new_search' => 0, + 'type_doc' => '', + $this->_template->withNameSpace('styles_pack') => $this->_red_background_styles_pack->getId(), + $this->_template->withNameSpace('form_style') => 'inline', + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Breadcrumb_Definition::CODE, - Class_Profil::DIV_BANNIERE, - ['titre' => $this->_('Fil d\'ariane'), - 'boite' => ['order-6'], - 'root' => '', - 'show_profile' => 1, - $this->_template->withNameSpace('styles_pack') => $this->_breadcrumb_styles_pack->getId(), - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_BANNIERE, + ['titre' => $this->_('Fil d\'ariane'), + 'boite' => ['order-6'], + 'root' => '', + 'show_profile' => 1, + $this->_template->withNameSpace('styles_pack') => $this->_breadcrumb_styles_pack->getId(), + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10, + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Agenda_Definition::CODE, - Class_Profil::DIV_MAIN, - ['titre' => $this->_('Evènements à la une !'), - 'rendering' => 'card', - 'layout' => Chili_Library_Widget_Carousel_Definition::TOP_HIGHLIGHT_CAROUSEL, - 'size' => 15, - 'order' => 'DebutPublicationDesc', - 'enabled_filters' => '', - $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10, - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_MAIN, + ['titre' => $this->_('Evènements à la une !'), + 'rendering' => 'card', + 'layout' => Intonation_Library_Widget_Carousel_Definition::TOP_HIGHLIGHT_CAROUSEL, + 'size' => 15, + 'order' => 'DebutPublicationDesc', + 'enabled_filters' => '', + $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10, + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_MAIN, - ['titre' => $this->_('Médiathèques'), - 'rendering' => 'card-description', - 'layout' => 'carousel', - 'osm_map' => 1, - 'size' => 0, - 'link_to_all' => 0, - $this->_template->withNameSpace('styles_pack') => $this->_white_styles_pack->getId(), - $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 1, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_MAIN, + ['titre' => $this->_('Médiathèques'), + 'rendering' => 'card-description', + 'layout' => 'carousel', + 'osm_map' => 1, + 'size' => 0, + 'link_to_all' => 0, + $this->_template->withNameSpace('styles_pack') => $this->_white_styles_pack->getId(), + $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 1, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Review_Definition::CODE, - Class_Profil::DIV_MAIN, - ['titre' => $this->_('Coups de coeur'), - 'abon_ou_bib' => 'all', - 'rendering' => 'card', - 'layout' => Chili_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL, - 'size' => 15, - 'order' => 'random', - 'link_to_all' => 0, - $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), - $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_MAIN, + ['titre' => $this->_('Coups de coeur'), + 'abon_ou_bib' => 'all', + 'rendering' => 'card', + 'layout' => Intonation_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL, + 'size' => 15, + 'order' => 'random', + 'link_to_all' => 0, + $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), + $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - ['titre' => $this->_('Nouveautés de l\'année'), - 'rendering' => 'card', - 'layout' => Chili_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL, - 'size' => 15, - 'order' => 'RAND()', - 'link_to_all' => 0, - $this->_template->withNameSpace('styles_pack') => $this->_white_styles_pack->getId(), - $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 1, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_MAIN, + ['titre' => $this->_('Nouveautés de l\'année'), + 'rendering' => 'card', + 'layout' => Intonation_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL, + 'size' => 15, + 'order' => 'RAND()', + 'link_to_all' => 0, + $this->_template->withNameSpace('styles_pack') => $this->_white_styles_pack->getId(), + $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 1, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Domain_Definition::CODE, - Class_Profil::DIV_MAIN, - ['titre' => $this->_('Une envie de …'), - 'rendering' => 'card', - 'layout' => 'grid', - 'size' => 25, - 'order' => 'libelle', - $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), - $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_MAIN, + ['titre' => $this->_('Une envie de …'), + 'rendering' => 'card', + 'layout' => 'grid', + 'size' => 25, + 'order' => 'libelle', + $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), + $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - Class_Profil::DIV_FOOTER, - ['titre' => $this->_('Menu réseau'), - 'menu' => $this->_profile_id . '-' . $this->_network_menu, - 'layout' => 'vertical', - $this->_template->withNameSpace('styles_pack') => $this->_admin_invert_colors_style_pack->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_FOOTER, + ['titre' => $this->_('Menu réseau'), + 'menu' => $this->_profile_id . '-' . $this->_network_menu, + 'layout' => 'vertical', + $this->_template->withNameSpace('styles_pack') => $this->_admin_invert_colors_style_pack->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - Class_Profil::DIV_FOOTER, - ['titre' => $this->_('Plan du site'), - 'menu' => $this->_profile_id . '-' . $this->_main_menu, - 'layout' => 'vertical', - $this->_template->withNameSpace('styles_pack') => $this->_footer_styles_pack->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_FOOTER, + ['titre' => $this->_('Plan du site'), + 'menu' => $this->_profile_id . '-' . $this->_main_menu, + 'layout' => 'vertical', + $this->_template->withNameSpace('styles_pack') => $this->_footer_styles_pack->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Free_Definition::CODE, - Class_Profil::DIV_FOOTER, - ['titre' => $this->_('Nous contacter'), - $this->_template->withNameSpace('styles_pack') => $this->_footer_styles_pack->getId(), - $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_FOOTER, + ['titre' => $this->_('Nous contacter'), + $this->_template->withNameSpace('styles_pack') => $this->_footer_styles_pack->getId(), + $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addWidget(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - Class_Profil::DIV_FOOTER, - ['titre' => $this->_('Mentions légales'), - 'menu' => $this->_profile_id . '-' . $this->_legal_mentions_menu, - 'layout' => 'vertical', - $this->_template->withNameSpace('styles_pack') => $this->_footer_styles_pack->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]) + Class_Profil::DIV_FOOTER, + ['titre' => $this->_('Mentions légales'), + 'menu' => $this->_profile_id . '-' . $this->_legal_mentions_menu, + 'layout' => 'vertical', + $this->_template->withNameSpace('styles_pack') => $this->_footer_styles_pack->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + $this->_template->withNameSpace('responsive_pack') => $this->_quarter_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]) ->_addScrollDownWidget() ->_addScrollTopWidget() @@ -657,27 +674,4 @@ class Chili_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { return $this; } - - - public function getDefaultWidgetMenuConfiguration(array $params) : array { - return - ['boite' => ['text-center'], - $this->_template->withNameSpace('styles_pack') => $this->_widget_fixed_top_styles_pack->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_LARGE, - $this->_template->withNameSpace('width_xsmall') => 8, - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]; - } - - - public function getDefaultWidgetConfiguration(array $params) : array { - return - ['link_to_all' => 0, - $this->_template->withNameSpace('styles_pack') => $this->_grey_styles_pack->getId(), - $this->_template->withNameSpace('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]; - } } diff --git a/library/templates/Chili/Library/Settings.php b/library/templates/Chili/Library/Settings.php index 305c80b655ce9fa82d60174fac72aaf2d5316985..27303ac18625d4141f3faf09fdac71e4ac967cc8 100644 --- a/library/templates/Chili/Library/Settings.php +++ b/library/templates/Chili/Library/Settings.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,39 +19,39 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Chili_Library_Settings extends Intonation_Library_Settings { - protected function _getDefaultSettings() { +class Chili_Library_Settings extends Intonation_Library_Settings +{ + protected function _getDefaultSettings() + { $settings = parent::_getDefaultSettings(); $settings[$this->_template->withNameSpace('chili_css')] = 1; $custom_css_classes = $settings[$this->_template->withNameSpace('custom_css_class')]; $custom_css_classes = array_merge($custom_css_classes, - ['chili_widget', - 'chili_footer_widget', - 'chili_banner', - 'chili_logo', - 'chili_logo_footer', - 'chili_fixed_top', - 'chili_network_list_widget', - 'fond_gris', - 'fond_bleu', - 'fond_rouge', - 'fond_blanc', - 'mx_4rem', - 'ml-3', - 'mr-3', - 'mt-5', - 'order-lg-2', - 'order-lg-1', - 'order-1', - 'order-2', - 'my-3', - 'py-3', - 'px-3', - 'w-100']); + ['chili_widget', + 'chili_footer_widget', + 'chili_banner', + 'chili_logo', + 'chili_logo_footer', + 'chili_fixed_top', + 'chili_network_list_widget', + 'fond_gris', + 'fond_bleu', + 'fond_rouge', + 'fond_blanc', + 'mx_4rem', + 'ml-3', + 'mr-3', + 'mt-5', + 'order-lg-2', + 'order-lg-1', + 'order-1', + 'order-2', + 'my-3', + 'py-3', + 'px-3', + 'w-100']); $settings[$this->_template->withNameSpace('custom_css_class')] = $custom_css_classes; @@ -89,10 +90,6 @@ class Chili_Library_Settings extends Intonation_Library_Settings { $hydrating_mapping['a class record_serie'] = 'badge-white no_truncate order-7'; $hydrating_mapping['span class badge_record_editor'] = 'no_truncate order-5'; $hydrating_mapping['a class badge_record_language'] = 'order-5'; - $hydrating_mapping['div class left_highlight_column'] = 'col-12 col-md-4 col-lg-5 rounded'; - $hydrating_mapping['div class left_carousel_columns'] = 'col-12 col-md-8 col-lg-7'; - $hydrating_mapping['div class top_highlight_column'] = 'col-12 rounded'; - $hydrating_mapping['div class top_carousel_columns'] = 'col-12'; $hydrating_mapping['div class card_with_overlay'] = 'card'; $hydrating_mapping['div class card_overlay'] = 'card-block card-img-overlay rounded text-white'; $hydrating_mapping['div class big_buttons'] = 'chili_widget col-10 col-xl-9'; @@ -108,11 +105,9 @@ class Chili_Library_Settings extends Intonation_Library_Settings { $hydrating_mapping['div class description_library_opened'] = 'col-12'; $hydrating_mapping['div class wall_grid_lg'] = 'd-none d-lg-block'; $hydrating_mapping['div class wall_grid_md'] = 'd-lg-none'; - $hydrating_mapping['div class highlight_carousel_xl'] = 'd-none d-xl-block'; - $hydrating_mapping['div class highlight_carousel_md'] = 'd-none d-md-block d-xl-none'; - $hydrating_mapping['div class highlight_carousel_sm'] = 'd-md-none'; $settings[$this->_template->withNameSpace('hydrating_mapping')] = $hydrating_mapping; + return $settings; } } diff --git a/library/templates/Chili/Library/Widget/Carousel/Definition.php b/library/templates/Chili/Library/Widget/Carousel/Definition.php deleted file mode 100644 index c9e1dd4298d506e706f86cbf027ed95757a39de9..0000000000000000000000000000000000000000 --- a/library/templates/Chili/Library/Widget/Carousel/Definition.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. - * - * BOKEH is free software; you can redistribute it and/or modify - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by - * the Free Software Foundation. - * - * There are special exceptions to the terms and conditions of the AGPL as it - * is applied to this software (see README file). - * - * BOKEH is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE - * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -class Chili_Library_Widget_Carousel_Definition { - const - TOP_HIGHLIGHT_CAROUSEL = 'top_highlight_carousel', - LEFT_HIGHLIGHT_CAROUSEL = 'left_highlight_carousel'; -} diff --git a/library/templates/Chili/Template.php b/library/templates/Chili/Template.php index 9e2b35a734a8f8e7259125ff762c84aafa6a0554..eb90f779a30eb5f5de83f77bc19a7bd3ffba49e7 100644 --- a/library/templates/Chili/Template.php +++ b/library/templates/Chili/Template.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -18,108 +19,91 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class Chili_Template extends Intonation_Template +{ + public const ID = 'CHILI'; - -class Chili_Template extends Intonation_Template { - - const ID = 'CHILI'; - - public function __construct() { + public function __construct() + { $this->setId(static::ID) ->setTitle($this->_('Chili')) ->setPatcher(new Chili_Library_ProfilePatcher($this)); } - - public function getProfile() { + public function getProfile() + { if ($this->_profile) return $this->_profile; - if ($this->_profile = Class_Profil::findFirstBy(['template' => $this->getId()])) return $this->_profile; - $this->createFrom(Class_Profil::getPortail()); return $this->_profile = Class_Profil::getCurrentProfil(); } - - public function renderSubModal($view) { + public function renderSubModal($view) + { return (new Chili_View_SubModal($this, $view))->render(); } - - public function customTemplateForm($form) { + public function customTemplateForm($form) + { $helper = new Chili_Library_FormCustomizer($this); + return $helper->getTemplateForm($form); } - - public function addHelperPath($view) { + public function addHelperPath($view) + { parent::addHelperPath($view); $view->addHelperPath('templates/Chili/View', 'Chili_View'); + return $this; } - - public function addAdminHelperPath($view) { + public function addAdminHelperPath($view) + { parent::addAdminHelperPath($view); $view->addHelperPath('templates/Chili/View/Admin', 'Chili_View_Admin'); + return $this; } - - public function getCarouselRenderer(string $layout) : string { - if (Chili_Library_Widget_Carousel_Definition::TOP_HIGHLIGHT_CAROUSEL === $layout) - return Chili_View_RenderTopHighlightCarousel::class; - - if (Chili_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL === $layout) - return Chili_View_RenderLeftHighlightCarousel::class; - + public function getCarouselRenderer(string $layout): string + { if (Intonation_Library_Widget_Carousel_Definition::GRID === $layout) return Chili_View_WallGrid::class; - if (Intonation_Library_Widget_Carousel_Definition::WALL === $layout) return Chili_View_Wall::class; - if (Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS === $layout) - return Chili_View_MultipleCarousel::class; - - return ''; - } - - - public function getCarouselLayouts() { - return [Chili_Library_Widget_Carousel_Definition::TOP_HIGHLIGHT_CAROUSEL => $this->_('Carousel avec mise en avant au dessus'), - Chili_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL => $this->_('Carousel avec mise en avant à gauche')]; - + return parent::getCarouselRenderer($layout); } - - public function customUserRichContents($sections) { + public function customUserRichContents($sections) + { unset($sections[Intonation_Library_View_Wrapper_User_RichContent::HOME]); array_unshift($sections, 'Chili_Library_Wrapper_User_RichContent_Home'); return $sections; } - - protected function _getMapWrapper() : array { - return - array_merge(parent::_getMapWrapper(), - ['Class_Notice' => 'Chili_Library_Wrapper_Record', - 'Class_Bib' => 'Chili_Library_Wrapper_Library']); - } - - - public function renderOpac($view) { + public function renderOpac($view) + { return (new Chili_View_Opac($this, $view))->render(); } - - public function getTemplateCssFileName() : string { + public function getTemplateCssFileName(): string + { return $this->getChiliCss() ? 'chili' : ''; } + + protected function _getMapWrapper(): array + { + return + array_merge(parent::_getMapWrapper(), + ['Class_Notice' => 'Chili_Library_Wrapper_Record', + 'Class_Bib' => 'Chili_Library_Wrapper_Library']); + } } diff --git a/library/templates/Chili/View/Abonne.php b/library/templates/Chili/View/Abonne.php index ade38432a3bab1b6d0ecd09520e8f1a54b8c1a8c..47d67b16deac3a0ffda8630a8c1b18c14d9afb67 100644 --- a/library/templates/Chili/View/Abonne.php +++ b/library/templates/Chili/View/Abonne.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,10 +19,10 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Chili_View_Abonne extends ZendAfi_View_Helper_BaseHelper { - public function abonne($user) { +class Chili_View_Abonne extends ZendAfi_View_Helper_BaseHelper +{ + public function abonne($user) + { $this->view->titre = $this->_('Mon compte'); $sections = $this->_getUserSections($user); @@ -31,64 +32,62 @@ class Chili_View_Abonne extends ZendAfi_View_Helper_BaseHelper { $this->_renderWallGridForBigScreen($sections)]; return $this->view->grid( - $this->_div(['class' => 'big_buttons'], - implode('', $html)), - [], - ['class' => 'justify-content-center']); + $this->_div(['class' => 'big_buttons'], + implode('', $html)), + [], + ['class' => 'justify-content-center']); } + protected function _renderTitle($user) + { + $wrapper = (new Intonation_Library_View_Wrapper_User) + ->setModel($user) + ->setView($this->view); - protected function _renderTitle($user) { - $wrapper = (new Intonation_Library_View_Wrapper_User) - ->setModel($user) - ->setView($this->view); - - return $this->_tag('h1', - $this->_('Bonjour %s !', - $wrapper->getMainTitle()), - ['class' => 'card-header widget-header']); + return $this->_tag('h1', + $this->_('Bonjour %s !', + $wrapper->getMainTitle()), + ['class' => 'card-header widget-header']); } - - protected function _renderCarouselForSmallScreen($sections) { + protected function _renderCarouselForSmallScreen($sections) + { $content = - $this->view->multipleCarousel($sections, - fn($item) => $this->view->renderingVertical($item), - ((new Intonation_Library_Widget_Carousel_Settings) - ->setColumns(3))); + $this->view->responsiveCarousel($sections, + fn($item) => $this->view->renderingVertical($item)); return $this->_div(['class' => 'big_buttons_sm'], - $content); + $content); } - - protected function _renderWallGridForBigScreen($sections) { + protected function _renderWallGridForBigScreen($sections) + { $helper = (new ZendAfi_View_Helper_Template_WallGrid) ->setView($this->view); $content = $helper->wallGrid($sections, - [$this->view, 'renderingVertical']); + [$this->view, 'renderingVertical']); return $this->_div(['class' => 'big_buttons_lg'], - $content); + $content); } - - protected function _getUserSections($user) { + protected function _getUserSections($user) + { $sections = $this->_wrapUserSectionsWithChili($user); $sections = $this->_injectThumbnailSectionIn($sections, $user); return new Storm_Collection($sections); } - - protected function _wrapUserSectionsWithChili($user) { - return array_map( fn($section) => new Chili_Library_Wrapper_RichContentSection($section, $this->view), - (new Intonation_Library_View_Wrapper_User_RichContent($user, $this->view)) - ->getSections()); + protected function _wrapUserSectionsWithChili($user) + { + return array_map(fn($section) => new Chili_Library_Wrapper_RichContentSection($section, $this->view), + (new Intonation_Library_View_Wrapper_User_RichContent($user, $this->view)) + ->getSections()); } - - protected function _injectThumbnailSectionIn($sections, $user) { + protected function _injectThumbnailSectionIn($sections, $user) + { unset($sections[Intonation_Library_View_Wrapper_User_RichContent::HOME]); array_unshift($sections, new Chili_Library_Wrapper_RichContentThumbnail($user, $this->view)); diff --git a/library/templates/Chili/View/Wall.php b/library/templates/Chili/View/Wall.php index f7f87afb463726546486622236cdb32e700c921d..a625617a431c9e9fb9acc292fc977889611bd941 100644 --- a/library/templates/Chili/View/Wall.php +++ b/library/templates/Chili/View/Wall.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -18,32 +19,28 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class Chili_View_Wall extends ZendAfi_View_Helper_Template_Wall +{ + protected $_collection; + protected $_callback; - -class Chili_View_Wall extends ZendAfi_View_Helper_Template_Wall { - - protected - $_collection, - $_callback; - - - public function wall($collection, $callback) { + public function wall($collection, $callback) + { $this->_collection = $collection; $this->_callback = $callback; return parent::wall($collection, $callback); } - - protected function _renderHtml($html) { + protected function _renderHtml($html) + { $html = [$this->_div(['class' => 'wall_grid_lg'], - parent::_renderHtml($html)), + parent::_renderHtml($html)), $this->_div(['class' => 'wall_grid_md'], - $this->view->multipleCarousel($this->_collection, - $this->_callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(3)))]; + $this->view->responsiveCarousel($this->_collection, + $this->_callback))]; return $this->view->grid($html); } diff --git a/library/templates/EtatFrancais/Library/ProfilePatcher.php b/library/templates/EtatFrancais/Library/ProfilePatcher.php index 19d6802ad1e7f4807045a2b526cb1fd6c351ec0d..85980a88234a4211a703edc3c4a0399cf6598259 100644 --- a/library/templates/EtatFrancais/Library/ProfilePatcher.php +++ b/library/templates/EtatFrancais/Library/ProfilePatcher.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2024, Agence Française Informatique (AFI). All rights reserved. * @@ -18,11 +19,8 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class EtatFrancais_Library_ProfilePatcher - extends Intonation_Library_ProfilePatcher { - +class EtatFrancais_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher +{ protected Class_StylesPack $_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto; protected Class_StylesPack $_style_pack_no_border_no_radius_no_shadow_mx_auto_my_5; protected Class_StylesPack $_style_pack_background_white; @@ -34,65 +32,58 @@ class EtatFrancais_Library_ProfilePatcher protected Class_StylesPack $_style_pack_biblio_footer; protected Class_StylesPack $_style_pack_recherche_scroll; - protected - $_main_menu_simple_bib, - $_main_menu_reseau_bib, - $_credits_menu, - $_recherche_scroll_menu, - - $_actualites_page, - $_documents_page, - $_faq_page, - $_histoire_page, - $_politique_page, - $_revues_page, - $_cartes_page, - $_fonds_page, - $_numerique_page, - $_portail_page, - $_produits_page, - $_bdn_page, - $_images_page, - $_traites_page, - $_inventaire_page, - $_catalogues_page, - $_sito_page, - $_presentation_page, - $_etrangers_page, - - $_mentionslegales_page, - $_accessibilite_page, - - $_disable_widget_template, - - $_only_content_widget_template, - $_disable_only_content_widget_template, - - $_widget_nav_classes = ['etatfrancais_menu'], - $_tag_main_settings, - - $_widget_in_main_settings, - $_widget_general_settings = ['no_background', + protected $_main_menu_simple_bib; + protected $_main_menu_reseau_bib; + protected $_credits_menu; + protected $_recherche_scroll_menu; + protected $_actualites_page; + protected $_documents_page; + protected $_faq_page; + protected $_histoire_page; + protected $_politique_page; + protected $_revues_page; + protected $_cartes_page; + protected $_fonds_page; + protected $_numerique_page; + protected $_portail_page; + protected $_produits_page; + protected $_bdn_page; + protected $_images_page; + protected $_traites_page; + protected $_inventaire_page; + protected $_catalogues_page; + protected $_sito_page; + protected $_presentation_page; + protected $_etrangers_page; + protected $_mentionslegales_page; + protected $_accessibilite_page; + protected $_disable_widget_template; + protected $_only_content_widget_template; + protected $_disable_only_content_widget_template; + protected $_widget_nav_classes = ['etatfrancais_menu']; + protected $_tag_main_settings; + protected $_widget_in_main_settings; + protected $_widget_general_settings = ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', - 'mx-auto'], - $_header_section_settings, - $_footer_section_settings; + 'mx-auto']; + protected $_header_section_settings; + protected $_footer_section_settings; public function __construct($template) { parent::__construct($template); - $this->_disable_widget_template = [$this->_template->withNameSpace('show_header') => 0, + $this->_disable_widget_template = [$this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]; - $this->_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_footer') => 0]; + $this->_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 1, - $this->_template->withNameSpace('show_footer') => 0]; - $this->_disable_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_footer') => 0]; + $this->_disable_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 1, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 1]; + $this->_template->withNameSpace('show_footer') => 1]; $this->_tag_main_settings = ['boite' => ['no_border_radius', 'm-auto', 'py-3', @@ -102,131 +93,152 @@ class EtatFrancais_Library_ProfilePatcher $this->_widget_in_main_settings = array_merge(['boite' => ['no_border_widget', 'no_shadow', 'mx-auto'], - 'rendering' => 'card', - 'layout' => 'grid', - 'size' => 99, + 'rendering' => 'card', + 'layout' => 'grid', + 'size' => 99, $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_only_content_widget_template); - $this->_header_section_settings = ['boite' => [''], - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('visibility_index') => 1, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_only_content_widget_template); + $this->_header_section_settings = ['boite' => [''], + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('visibility_index') => 1, $this->_template->withNameSpace('visibility_recherche') => 1, - $this->_template->withNameSpace('visibility_abonne') => 1, - $this->_template->withNameSpace('visibility_cms') => 1, - $this->_template->withNameSpace('visibility_blog') => 1, - $this->_template->withNameSpace('visibility_auth') => 1]; - $this->_footer_section_settings = ['boite' => ['no_background'], - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('visibility_index') => 1, + $this->_template->withNameSpace('visibility_abonne') => 1, + $this->_template->withNameSpace('visibility_cms') => 1, + $this->_template->withNameSpace('visibility_blog') => 1, + $this->_template->withNameSpace('visibility_auth') => 1]; + $this->_footer_section_settings = ['boite' => ['no_background'], + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('visibility_index') => 1, $this->_template->withNameSpace('visibility_recherche') => 1, - $this->_template->withNameSpace('visibility_abonne') => 1, - $this->_template->withNameSpace('visibility_cms') => 1, - $this->_template->withNameSpace('visibility_blog') => 1, - $this->_template->withNameSpace('visibility_auth') => 1]; + $this->_template->withNameSpace('visibility_abonne') => 1, + $this->_template->withNameSpace('visibility_cms') => 1, + $this->_template->withNameSpace('visibility_blog') => 1, + $this->_template->withNameSpace('visibility_auth') => 1]; } + public function getDefaultWidgetMenuConfiguration(array $params): array + { + return + ['boite' => [], + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, + $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]; + } + + public function getDefaultWidgetConfiguration(array $params): array + { + return + ['boite' => [], + 'link_to_all' => 1, + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 1]; + } protected function _generatePacks(): self { $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto = $this->_getOrCreateStylePack($this->_('Marges horizontales automatiques, sans bordure de boites, sans arrondi, sans ombre, sans fond'), - ['no_background', - 'no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto']); - + ['no_background', + 'no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto']); $this->_style_pack_no_border_no_radius_no_shadow_mx_auto_my_5 = $this->_getOrCreateStylePack($this->_('Marges horizontales automatiques, marges vertical à 5, sans bordure de boites, sans arrondi, sans ombre'), - ['no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'my-5']); + ['no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'my-5']); $this->_style_pack_background_white = $this->_getOrCreateStylePack($this->_('Fond blanc'), - ['no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'background-white', - 'py-3', - 'my-3']); + ['no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'background-white', + 'py-3', + 'my-3']); $this->_style_pack_background_light = $this->_getOrCreateStylePack($this->_('Fond clair'), - ['no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'background-light', - 'py-3', - 'my-3']); + ['no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'background-light', + 'py-3', + 'my-3']); $this->_style_pack_background_dark = $this->_getOrCreateStylePack($this->_('Fond foncé'), - ['no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'background-dark', - 'py-3', - 'my-3']); + ['no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'background-dark', + 'py-3', + 'my-3']); $this->_style_pack_background_very_dark = $this->_getOrCreateStylePack($this->_('Fond très foncé'), - ['no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'background-very_dark', - 'py-3', - 'my-3']); + ['no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'background-very_dark', + 'py-3', + 'my-3']); $this->_style_pack_image_banniere = $this->_getOrCreateStylePack($this->_('Image banniere'), - ['no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'image_banniere', - 'mt-8']); + ['no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'image_banniere', + 'mt-8']); $this->_style_pack_biblio_header = $this->_getOrCreateStylePack($this->_('Boite bibliothèque bouton horaires'), - ['no_background', - 'no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'biblio_header']); + ['no_background', + 'no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'biblio_header']); $this->_style_pack_biblio_footer = $this->_getOrCreateStylePack($this->_('Boite bibliothèque horaires'), - ['no_background', - 'no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'biblio_footer', - 'no_footer_card']); + ['no_background', + 'no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'biblio_footer', + 'no_footer_card']); $this->_style_pack_recherche_scroll = $this->_getOrCreateStylePack($this->_('Boite recherche scroll'), - ['no_background', - 'no_border_widget', - 'no_border_radius', - 'no_shadow', - 'mx-auto', - 'recherche_scroll']); + ['no_background', + 'no_border_widget', + 'no_border_radius', + 'no_shadow', + 'mx-auto', + 'recherche_scroll']); return $this; } - protected function _upgradeProfile(): self { parent::_upgradeProfile(); @@ -236,7 +248,7 @@ class EtatFrancais_Library_ProfilePatcher ->setAccessLevel(-1) ->setLibelle($this->_('Thème de l\'État Français - Accueil')); - if ( ! $this->_profile->hasFavicon()) + if (!$this->_profile->hasFavicon()) $this->_profile->setFavicon('/library/templates/EtatFrancais/Assets/images/apple_touch_icon_8ffa1fa80c.png'); $this->_profile->save(); @@ -267,7 +279,6 @@ class EtatFrancais_Library_ProfilePatcher ->_addProduitsPage(); } - protected function _addActualitesPage(): self { $this->_actualites_page = $this @@ -275,248 +286,233 @@ class EtatFrancais_Library_ProfilePatcher ->setRewriteUrl($this->_('actualites')) ->addWidget(Intonation_Library_Widget_Carousel_Agenda_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Actualités')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Actualités')], + $this->_widget_in_main_settings)); + return $this; } - protected function _addFaqPage(): self { $this->_faq_page = $this ->_createPage($this->_('Faq')) ->setRewriteUrl($this->_('faq')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['boite' => ['no_border_widget', - 'no_shadow', - 'mx-auto'], - 'titre' => $this->_('faq'), - 'rendering' => 'card-description', - 'layout' => 'accordion', - 'size' => 99, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_only_content_widget_template)); + Class_Profil::DIV_MAIN, + array_merge(['boite' => ['no_border_widget', + 'no_shadow', + 'mx-auto'], + 'titre' => $this->_('faq'), + 'rendering' => 'card-description', + 'layout' => 'accordion', + 'size' => 99, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_only_content_widget_template)); return $this->_clearCache(); } - protected function _addDocumentsPage(): self { $this->_documents_page = $this ->_createPage($this->_('Documents diplomatiques Français')) ->setRewriteUrl($this->_('documents-diplomatiques-francais')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Documents diplomatiques français')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Documents diplomatiques français')], + $this->_widget_in_main_settings)); return $this; } - protected function _addEtrangersPage(): self { $this->_etrangers_page = $this ->_createPage($this->_('Documents diplomatiques Etrangers')) ->setRewriteUrl($this->_('documents-diplomatiques-etrangers')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Documents diplomatiques étrangers')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Documents diplomatiques étrangers')], + $this->_widget_in_main_settings)); return $this; } - protected function _addFondsPage(): self { $this->_fonds_page = $this ->_createPage($this->_('Fonds spécifiques')) ->setRewriteUrl($this->_('fonds-specifiques')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Fonds spécifiques')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Fonds spécifiques')], + $this->_widget_in_main_settings)); return $this; } - protected function _addTraitesPage(): self { $this->_traites_page = $this ->_createPage($this->_('Base traités')) ->setRewriteUrl($this->_('base-traites')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Base traités')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Base traités')], + $this->_widget_in_main_settings)); return $this; } - protected function _addRevuesPage(): self { $this->_revues_page = $this ->_createPage($this->_('Revues')) ->setRewriteUrl($this->_('revues')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Revues')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Revues')], + $this->_widget_in_main_settings)); return $this; } - protected function _addPresentationPage(): self { $this->_presentation_page = $this ->_createPage($this->_('Présentation des collections')) ->setRewriteUrl($this->_('presentation-collections')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Présentation des collections')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Présentation des collections')], + $this->_widget_in_main_settings)); return $this; } - protected function _addNumeriquePage(): self { $this->_numerique_page = $this ->_createPage($this->_('Ressources électroniques')) ->setRewriteUrl($this->_('ressources-electroniques')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Les ressources électroniques')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Les ressources électroniques')], + $this->_widget_in_main_settings)); return $this; } - protected function _addHistoirePage(): self { $this->_histoire_page = $this ->_createPage($this->_('Histoire')) ->setRewriteUrl($this->_('histoire')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['boite' => ['no_border_widget', - 'no_shadow', - 'mx-auto'], - 'titre' => $this->_('Histoire'), - 'rendering' => 'card-horizontal', - 'layout' => 'list', - 'size' => 99, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_only_content_widget_template)); + Class_Profil::DIV_MAIN, + array_merge(['boite' => ['no_border_widget', + 'no_shadow', + 'mx-auto'], + 'titre' => $this->_('Histoire'), + 'rendering' => 'card-horizontal', + 'layout' => 'list', + 'size' => 99, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_only_content_widget_template)); return $this; } - protected function _addPolitiquePage(): self { $this->_politique_page = $this ->_createPage($this->_('Politique Documentaire')) ->setRewriteUrl($this->_('politique-documentaire')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Politique Documentaire')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Politique Documentaire')], + $this->_widget_in_main_settings)); return $this; } - protected function _addPortailPage(): self { $this->_portail_page = $this ->_createPage($this->_('Le portail de la bibliothèque')) ->setRewriteUrl($this->_('portail-bibliotheque')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Le portail de la bibliothèque')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Le portail de la bibliothèque')], + $this->_widget_in_main_settings)); return $this; } - protected function _addImagesPage(): self { $this->_images_page = $this ->_createPage($this->_('Base image')) ->setRewriteUrl($this->_('base-image')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Base image')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Base image')], + $this->_widget_in_main_settings)); return $this; } - protected function _addBdnPage(): self { $this->_bdn_page = $this ->_createPage($this->_('BDN')) ->setRewriteUrl($this->_('bdn')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('La BDN')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('La BDN')], + $this->_widget_in_main_settings)); return $this; } - protected function _addInventairePage(): self { $this->_inventaire_page = $this ->_createPage($this->_('Inventaire et archives en ligne')) ->setRewriteUrl($this->_('inventaire-archives')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Inventaire et archives en ligne')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Inventaire et archives en ligne')], + $this->_widget_in_main_settings)); return $this; } - protected function _addSitoPage(): self { $this->_sito_page = $this ->_createPage($this->_('Sitothèque')) ->setRewriteUrl($this->_('sitotheque')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Sithothèque')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Sithothèque')], + $this->_widget_in_main_settings)); return $this; } - protected function _addCataloguesPage(): self { $this->_catalogues_page = $this ->_createPage($this->_('Catalogues en ligne des bibliothèques')) ->setRewriteUrl($this->_('catalogues-enligne')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Catalogues en ligne des bibliothèques')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Catalogues en ligne des bibliothèques')], + $this->_widget_in_main_settings)); return $this; } @@ -527,78 +523,70 @@ class EtatFrancais_Library_ProfilePatcher ->_createPage($this->_('Produits documentaires')) ->setRewriteUrl($this->_('produits-documentaires')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Produit documentaires')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Produit documentaires')], + $this->_widget_in_main_settings)); return $this; } - protected function _addCartesPage(): self { $this->_cartes_page = $this ->_createPage($this->_('Cartes et plans')) ->setRewriteUrl($this->_('cartes-plans')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Les cartes et plans')], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Les cartes et plans')], + $this->_widget_in_main_settings)); return $this; } - protected function _addMentionslegalesPage(): self { $categorie = $this->_getOrCreateCategory($this->_('EtatFrancais')); $article_content = file_get_contents(ROOT_PATH . 'library/templates/EtatFrancais/Assets/contents/mentions_legales.html'); - $article = (new Class_Article()) - ->updateAttributes(['titre' => $this->_('Mentions légales'), - 'categorie' => $categorie, - 'status' => Class_Article::STATUS_VALIDATED, - 'contenu' => $article_content]); - $article->save(); + $article = $this->_findOrCreateArticle($this->_('Mentions légales'), + $article_content, + $categorie); $this->_mentionslegales_page = $this ->_createPage($this->_('Mentions légales')) ->setRewriteUrl($this->_('mentions_legales')) ->addWidget(Intonation_Library_Widget_Free_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Mentions légales'), - 'id_items' => $article->getId()], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Mentions légales'), + 'id_items' => $article->getId()], + $this->_widget_in_main_settings)); + return $this; } - protected function _addAccessibilitePage(): self { $categorie = $this->_getOrCreateCategory($this->_('EtatFrancais')); $article_content = file_get_contents(ROOT_PATH . 'library/templates/EtatFrancais/Assets/contents/accessibilite.html'); - $article = (new Class_Article()) - ->updateAttributes(['titre' => $this->_('Accessibilité'), - 'categorie' => $categorie, - 'status' => Class_Article::STATUS_VALIDATED, - 'contenu' => $article_content]); - $article->save(); + $article = $this->_findOrCreateArticle($this->_('Accessibilité'), + $article_content, + $categorie); $this->_accessibilite_page = $this ->_createPage($this->_('Accessibilité')) ->setRewriteUrl($this->_('accessibilite')) ->addWidget(Intonation_Library_Widget_Free_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Accessibilité'), - 'id_items' => $article->getId()], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Accessibilité'), + 'id_items' => $article->getId()], + $this->_widget_in_main_settings)); + return $this; } - protected function _upgradeSections(): self { return $this @@ -609,517 +597,490 @@ class EtatFrancais_Library_ProfilePatcher 'etatfrancais_widget'], $this->_template->withNameSpace('width_xsmall') => 12]) ->_setSecondSideSettings($this->_footer_section_settings) - ->_setFooterSettings($this->_footer_section_settings) - ; + ->_setFooterSettings($this->_footer_section_settings); } - protected function _upgradeMenus(): self { $recherche_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Search_Definition::CODE, - array_merge(['titre' => $this->_('Recherche scroll'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_recherche_scroll->getId(), - 'search_button' => 'class fas fa-search', - 'placeholder' => $this->_('Tapez ici votre recherche (Titre, Auteur, Mot clé...)'), - 'type_doc' => 'Tous types de documents :', - 'facets_in_session' => 0, - 'always_new_search' => 1, - 'select_doc' => 1, - 'recherche_avancee' => 0, - 'doc_type_selection_label' => '', - 'EtatFrancaisVisibleWhenHidden' => '6', - $this->_template->withNameSpace('form_style') => 'toggle', - 'menu' => $this->_profile_id . '-' . $this->_recherche_scroll_menu, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)); + array_merge(['titre' => $this->_('Recherche scroll'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_recherche_scroll->getId(), + 'search_button' => 'class fas fa-search', + 'placeholder' => $this->_('Tapez ici votre recherche (Titre, Auteur, Mot clé...)'), + 'type_doc' => 'Tous types de documents :', + 'facets_in_session' => 0, + 'always_new_search' => 1, + 'select_doc' => 1, + 'recherche_avancee' => 0, + 'doc_type_selection_label' => '', + 'EtatFrancaisVisibleWhenHidden' => '6', + $this->_template->withNameSpace('form_style') => 'toggle', + 'menu' => $this->_profile_id . '-' . $this->_recherche_scroll_menu, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)); $this->_recherche_scroll_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu recherche en scroll'), - 'picto' => '', - 'menus' => [$recherche_widget_menu]]); + 'picto' => '', + 'menus' => [$recherche_widget_menu]]); $this->_main_menu_simple_bib = $this->_profile ->addMenu(['libelle' => $this->_('Menu bibliothèque'), - 'picto' => '', - 'menus' => [['type_menu' => 'ACCUEIL', - 'libelle' => $this->_('Accueil'), - 'use_profil' => $this->_profile_id], + 'picto' => '', + 'menus' => [['type_menu' => 'ACCUEIL', + 'libelle' => $this->_('Accueil'), + 'use_profil' => $this->_profile_id], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Actualités'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Actualités'), 'clef_profil' => $this->_actualites_page->getId()], - ['type_menu' => 'MENU', - 'libelle' => $this->_('La bibliothèque'), - 'sous_menus' => [['type_menu' => 'PROFIL', - 'libelle' => $this->_('Le portail de la bibliothèque'), + ['type_menu' => 'MENU', + 'libelle' => $this->_('La bibliothèque'), + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => $this->_('Le portail de la bibliothèque'), 'clef_profil' => $this->_portail_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Un peu d\'histoire'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Un peu d\'histoire'), 'clef_profil' => $this->_histoire_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('La politique documentaire'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('La politique documentaire'), 'clef_profil' => $this->_politique_page->getId()], - ['type_menu' => 'URL', - 'libelle' => $this->_('La Courneuve'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('La Courneuve'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Nantes'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Nantes'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Paris - Quai d\'Orsay'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Paris - Quai d\'Orsay'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Nous contacter'), - 'url' => '/index/formulairecontact']]], - + 'libelle' => $this->_('Nous contacter'), + 'url' => '/index/formulairecontact']]], - ['type_menu' => 'MENU', - 'libelle' => $this->_('Les collections'), - 'sous_menus' => [['type_menu' => 'PROFIL', - 'libelle' => $this->_('Présentation des collections'), + ['type_menu' => 'MENU', + 'libelle' => $this->_('Les collections'), + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => $this->_('Présentation des collections'), 'clef_profil' => $this->_presentation_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Revues'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Revues'), 'clef_profil' => $this->_revues_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Cartes et plans'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Cartes et plans'), 'clef_profil' => $this->_cartes_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Documents diplomatiques français'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Documents diplomatiques français'), 'clef_profil' => $this->_documents_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Documents diplomatiques étrangers'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Documents diplomatiques étrangers'), 'clef_profil' => $this->_etrangers_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Les fonds spécifiques'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Les fonds spécifiques'), 'clef_profil' => $this->_fonds_page->getId()]]], - ['type_menu' => 'MENU', - 'libelle' => $this->_('Ressources documentaires'), - 'sous_menus' => [['type_menu' => 'PROFIL', - 'libelle' => $this->_('Produits documentaires'), + ['type_menu' => 'MENU', + 'libelle' => $this->_('Ressources documentaires'), + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => $this->_('Produits documentaires'), 'clef_profil' => $this->_produits_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Ressources électroniques'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Ressources électroniques'), 'clef_profil' => $this->_numerique_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('La BDN'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('La BDN'), 'clef_profil' => $this->_bdn_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Base image'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Base image'), 'clef_profil' => $this->_images_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Base traités'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Base traités'), 'clef_profil' => $this->_traites_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Inventaire et archives en ligne'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Inventaire et archives en ligne'), 'clef_profil' => $this->_inventaire_page->getId()]]], - - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('FAQ'), - 'clef_profil' => $this->_faq_page->getId()] - + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('FAQ'), + 'clef_profil' => $this->_faq_page->getId()], ]]); - $this->_main_menu_reseau_bib = $this->_profile ->addMenu(['libelle' => $this->_('Menu réseau bibliothèques'), - 'picto' => '', - 'menus' => [['type_menu' => 'ACCUEIL', - 'libelle' => $this->_('Accueil'), - 'use_profil' => $this->_profile_id], - - ['type_menu' => 'MENU', - 'libelle' => $this->_('Infos pratiques'), - 'sous_menus' => [['type_menu' => 'PROFIL', - 'libelle' => $this->_('Tout le réseau'), + 'picto' => '', + 'menus' => [['type_menu' => 'ACCUEIL', + 'libelle' => $this->_('Accueil'), + 'use_profil' => $this->_profile_id], + + ['type_menu' => 'MENU', + 'libelle' => $this->_('Infos pratiques'), + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => $this->_('Tout le réseau'), 'clef_profil' => $this->_documents_page->getId()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°1'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Bibliothèque n°1'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°2'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Bibliothèque n°2'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°3'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Bibliothèque n°3'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°4'), - 'url' => $this->_getLibraryUrl()]]], + 'libelle' => $this->_('Bibliothèque n°4'), + 'url' => $this->_getLibraryUrl()]]], ['type_menu' => 'URL', - 'libelle' => $this->_('Actualités'), - 'url' => $this->_actualites_page->getUrl()], + 'libelle' => $this->_('Actualités'), + 'url' => $this->_actualites_page->getUrl()], - ['type_menu' => 'MENU', - 'libelle' => $this->_('Les collections'), + ['type_menu' => 'MENU', + 'libelle' => $this->_('Les collections'), 'sous_menus' => [['type_menu' => 'PROFIL', - 'libelle' => $this->_('Histoire'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_histoire_page->getId()])], + 'libelle' => $this->_('Histoire'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_histoire_page->getId()])], ['type_menu' => 'URL', - 'libelle' => $this->_('Politique documentaire'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_politique_page->getId()])], + 'libelle' => $this->_('Politique documentaire'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_politique_page->getId()])], ['type_menu' => 'URL', - 'libelle' => $this->_('Les revues'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_revues_page->getId()])], + 'libelle' => $this->_('Les revues'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_revues_page->getId()])], ['type_menu' => 'URL', - 'libelle' => $this->_('Les cartes et plans'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_cartes_page->getId()])]]], + 'libelle' => $this->_('Les cartes et plans'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_cartes_page->getId()])]]], $recherche_widget_menu]]); $this->_addWidgetInMenu(Intonation_Library_Widget_Credits_Definition::CODE, - array_merge(['titre' => $this->_('Crédits'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['p-3'], - 'link_to_all' => 0, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)); + array_merge(['titre' => $this->_('Crédits'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['p-3'], + 'link_to_all' => 0, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)); $this->_credits_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu crédits'), - 'picto' => '', - 'menus' => [['type_menu' => 'URL', - 'libelle' => $this->_('Contact'), - 'url' => '/index/formulairecontact'], + 'picto' => '', + 'menus' => [['type_menu' => 'URL', + 'libelle' => $this->_('Contact'), + 'url' => '/index/formulairecontact'], ['type_menu' => 'URL', - 'libelle' => $this->_('Mentions Légales'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_mentionslegales_page->getId()])], + 'libelle' => $this->_('Mentions Légales'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_mentionslegales_page->getId()])], ['type_menu' => 'URL', - 'libelle' => $this->_('Politique de confidentialité'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_mentionslegales_page->getId()])], + 'libelle' => $this->_('Politique de confidentialité'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_mentionslegales_page->getId()])], ['type_menu' => 'URL', - 'libelle' => $this->_('Accessibilité'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_accessibilite_page->getId()])]]]); + 'libelle' => $this->_('Accessibilité'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_accessibilite_page->getId()])]]]); $this->_profile->save(); + return $this; } - protected function _upgradeWidgets(): self { $this ->removeWidgets() - ->_addWidget(Intonation_Library_Widget_Image_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => '', - 'boite' => ['no_shadow', - 'no_border'], - 'image' => Class_URL::relative('/library/templates/EtatFrancais/Assets/images/mae_logo_marianne.svg'), - 'link' => $this->_('/accueil'), - $this->_template->withNameSpace('width_xsmall') => 4, - $this->_template->withNameSpace('width_medium') => 2, - $this->_template->withNameSpace('width_large') => 2], - $this->_only_content_widget_template)) - + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => '', + 'boite' => ['no_shadow', + 'no_border'], + 'image' => Class_URL::relative('/library/templates/EtatFrancais/Assets/images/mae_logo_marianne.svg'), + 'link' => $this->_('/accueil'), + $this->_template->withNameSpace('width_xsmall') => 4, + $this->_template->withNameSpace('width_medium') => 2, + $this->_template->withNameSpace('width_large') => 2], + $this->_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Login_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Mon Compte'), - 'boite' => ['no_background', - 'no_shadow', - 'align-items-end', - 'text-align-center', - 'no_border_widget', - 'no_border_radius'], - 'titre_connecte' => $this->_('Mon compte'), - 'message_connecte' => '', - 'identifiant' => $this->_('Identifiant'), - 'identifiant_exemple' => $this->_('Adresse email'), - 'mot_de_passe' => $this->_('Mot de passe'), - 'mot_de_passe_exemple' => $this->_(''), - 'lien_connexion' => $this->_('Se connecter'), - 'lien_deconnection' => $this->_('Se déconnecter'), - 'lien_mot_de_passe_oublie' => $this->_('Mot de passe oublié'), - 'lien_compte' => $this->_('Mon compte'), - 'lien_creer_compte' => $this->_('S\'enregistrer'), - $this->_template->withNameSpace('form_style') => 'toggle', - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_medium') => 12, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_widget_template)) + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Mon Compte'), + 'boite' => ['no_background', + 'no_shadow', + 'align-items-end', + 'text-align-center', + 'no_border_widget', + 'no_border_radius'], + 'titre_connecte' => $this->_('Mon compte'), + 'message_connecte' => '', + 'identifiant' => $this->_('Identifiant'), + 'identifiant_exemple' => $this->_('Adresse email'), + 'mot_de_passe' => $this->_('Mot de passe'), + 'mot_de_passe_exemple' => $this->_(''), + 'lien_connexion' => $this->_('Se connecter'), + 'lien_deconnection' => $this->_('Se déconnecter'), + 'lien_mot_de_passe_oublie' => $this->_('Mot de passe oublié'), + 'lien_compte' => $this->_('Mon compte'), + 'lien_creer_compte' => $this->_('S\'enregistrer'), + $this->_template->withNameSpace('form_style') => 'toggle', + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_medium') => 12, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Search_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Recherche'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['justify-content-center', - 'align-items-center', - 'col-md-12'], - 'search_button' => 'class fas fa-search', - 'placeholder' => $this->_('Rechercher'), - 'type_doc' => '', - 'facets_in_session' => 0, - 'always_new_search' => 1, - 'select_doc' => 0, - 'recherche_avancee' => 1, - 'doc_type_selection_label' => 'Tous types de documents :', - $this->_template->withNameSpace('form_style') => 'default', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_medium') => 10, - $this->_template->withNameSpace('width_large') => 9], - $this->_disable_widget_template)) - - - /*ASIDE*/ + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Recherche'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['justify-content-center', + 'align-items-center', + 'col-md-12'], + 'search_button' => 'class fas fa-search', + 'placeholder' => $this->_('Rechercher'), + 'type_doc' => '', + 'facets_in_session' => 0, + 'always_new_search' => 1, + 'select_doc' => 0, + 'recherche_avancee' => 1, + 'doc_type_selection_label' => 'Tous types de documents :', + $this->_template->withNameSpace('form_style') => 'default', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_medium') => 10, + $this->_template->withNameSpace('width_large') => 9], + $this->_disable_widget_template)) + + // ASIDE ->_addWidget(Intonation_Library_Widget_Nav_Definition::CODE, - Class_Profil::DIV_FIRST_SIDE, - array_merge(['titre' => $this->_('Navigation principal'), - 'boite' => $this->_widget_nav_classes, - 'menu' => $this->_profile_id . '-' . $this->_main_menu_simple_bib, - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)) - - - - - /*MAIN*/ + Class_Profil::DIV_FIRST_SIDE, + array_merge(['titre' => $this->_('Navigation principal'), + 'boite' => $this->_widget_nav_classes, + 'menu' => $this->_profile_id . '-' . $this->_main_menu_simple_bib, + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)) + // MAIN ->_addWidget(Intonation_Library_Widget_Breadcrumb_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Fil d\'ariane'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_widget_template)) - + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Fil d\'ariane'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Nouveautés'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_overlay', - 'fr-py-9w'], - 'rendering' => 'card-overlay', - 'layout' => 'multiple_carousel_plus', - 'size' => 50, - 'order' => 'date_creation desc, alpha_titre asc', - 'link_to_all' => 1, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_medium') => 12], - $this->_disable_only_content_widget_template)) + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Nouveautés'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_overlay', + 'fr-py-9w'], + 'rendering' => 'card-overlay', + 'layout' => 'multiple_carousel_plus', + 'size' => 50, + 'order' => 'date_creation desc, alpha_titre asc', + 'link_to_all' => 1, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_medium') => 12], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Nouvelles acquisitions'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_overlay', - 'fr-py-9w'], - 'rendering' => 'card-overlay', - 'layout' => 'multiple_carousel_plus', - 'size' => 50, - 'order' => 'date_creation desc, alpha_titre asc', - 'link_to_all' => 1, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_medium') => 12], - $this->_disable_only_content_widget_template)) - + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Nouvelles acquisitions'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_overlay', + 'fr-py-9w'], + 'rendering' => 'card-overlay', + 'layout' => 'multiple_carousel_plus', + 'size' => 50, + 'order' => 'date_creation desc, alpha_titre asc', + 'link_to_all' => 1, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_medium') => 12], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Sélectionné dans nos revues'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_overlay', - 'fr-py-9w'], - 'rendering' => 'card-overlay', - 'layout' => 'multiple_carousel_plus', - 'size' => 50, - 'order' => 'date_creation desc, alpha_titre asc', - 'link_to_all' => 1, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_medium') => 12], - $this->_disable_only_content_widget_template)) + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Sélectionné dans nos revues'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_overlay', + 'fr-py-9w'], + 'rendering' => 'card-overlay', + 'layout' => 'multiple_carousel_plus', + 'size' => 50, + 'order' => 'date_creation desc, alpha_titre asc', + 'link_to_all' => 1, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_medium') => 12], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Actualités'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_border', - 'no_badges', - 'mx-auto', - 'fr-py-9w'], - 'rendering' => 'card', - 'layout' => 'horizontal_list', - 'size' => 3, - 'order' => 'DateCreationDesc', - 'link_to_all' => 1, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_only_content_widget_template)) - - + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Actualités'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_border', + 'no_badges', + 'mx-auto', + 'fr-py-9w'], + 'rendering' => 'card', + 'layout' => 'horizontal_list', + 'size' => 3, + 'order' => 'DateCreationDesc', + 'link_to_all' => 1, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Domain_Definition::CODE, - class_Profil::DIV_MAIN, - array_merge(['titre' => $this ->_('Accès géographique'), - 'boite' => ['no_border', - 'no_background', - 'fr-py-9w'], - 'layout' => 'horizontal_list', - 'rendering' => 'card', - 'size' => 5, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_only_content_widget_template)) - + class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Accès géographique'), + 'boite' => ['no_border', + 'no_background', + 'fr-py-9w'], + 'layout' => 'horizontal_list', + 'rendering' => 'card', + 'size' => 5, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Domain_Definition::CODE, - class_Profil::DIV_MAIN, - array_merge(['titre' => $this ->_('Accès thématique'), - 'boite' => ['no_border', - 'no_background', - 'fr-py-9w'], - 'layout' => 'horizontal_list', - 'rendering' => 'card', - 'size' => 5, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 12], - $this->_disable_only_content_widget_template)) - - - - /*FOOTER*/ + class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Accès thématique'), + 'boite' => ['no_border', + 'no_background', + 'fr-py-9w'], + 'layout' => 'horizontal_list', + 'rendering' => 'card', + 'size' => 5, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 12], + $this->_disable_only_content_widget_template)) + + // FOOTER ->_addWidget(Intonation_Library_Widget_Image_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Logo du réseau'), - 'boite' => ['no_border', - 'no_shadow', - 'py-3', - 'align-items-center'], - 'image' => Class_Url::relative('/library/templates/EtatFrancais/Assets/images/mae_logo_marianne.svg'), - 'link' => $this->_('/accueil'), - $this->_template->withNameSpace('width_xsmall') => 8, - $this->_template->withNameSpace('width_medium') => 5, - $this->_template->withNameSpace('width_large') => 2], - $this->_disable_widget_template)) + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Logo du réseau'), + 'boite' => ['no_border', + 'no_shadow', + 'py-3', + 'align-items-center'], + 'image' => Class_Url::relative('/library/templates/EtatFrancais/Assets/images/mae_logo_marianne.svg'), + 'link' => $this->_('/accueil'), + $this->_template->withNameSpace('width_xsmall') => 8, + $this->_template->withNameSpace('width_medium') => 5, + $this->_template->withNameSpace('width_large') => 2], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Menu footer'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['justify-content-center', - 'fr-footer__bottom'], - 'layout' => 'horizontal', - 'menu' => $this->_profile_id . '-' . $this->_credits_menu, - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_medium') => 12, - $this->_template->withNameSpace('width_large') => 12, - $this->_template->withNameSpace('order_xsmall') => 12, - $this->_template->withNameSpace('order_large') => 12], - $this->_disable_widget_template)) - + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Menu footer'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['justify-content-center', + 'fr-footer__bottom'], + 'layout' => 'horizontal', + 'menu' => $this->_profile_id . '-' . $this->_credits_menu, + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_medium') => 12, + $this->_template->withNameSpace('width_large') => 12, + $this->_template->withNameSpace('order_xsmall') => 12, + $this->_template->withNameSpace('order_large') => 12], + $this->_disable_widget_template)) ->_addAdminWidget() ->_addNotificationWidget(); - - foreach(Class_Profil::findAllBy(['parent_id' => $this->_profile_id]) as $profile) - { + foreach (Class_Profil::findAllBy(['parent_id' => $this->_profile_id]) as $profile) { $page = (new Class_Template_ProfilePatcher_Profile($profile)); $page ->setFirstSideSettings($this->_header_section_settings) ->addWidget(Intonation_Library_Widget_Nav_Definition::CODE, - Class_Profil::DIV_FIRST_SIDE, - array_merge(['titre' => $this->_('Navigation principal'), - 'boite' => $this->_widget_nav_classes, - 'menu' => $this->_profile_id . '-' . $this->_main_menu_simple_bib, - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)); + Class_Profil::DIV_FIRST_SIDE, + array_merge(['titre' => $this->_('Navigation principal'), + 'boite' => $this->_widget_nav_classes, + 'menu' => $this->_profile_id . '-' . $this->_main_menu_simple_bib, + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)); $this->_clearCache(); } return $this; } - - protected function _addAdminWidget(): self { return $this->_addWidget(Intonation_Library_Widget_AdminTools_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Administration'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['no_border', - 'position_fixed_bottom_left', - 'white_widget']], - $this->_disable_widget_template)); + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Administration'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['no_border', + 'position_fixed_bottom_left', + 'white_widget']], + $this->_disable_widget_template)); } - protected function _upgradeActions(): self { - $form_action_settings = ['boite' => ['mx-auto'], + $form_action_settings = ['boite' => ['mx-auto'], $this->_template->withNameSpace('width_xsmall') => 12, $this->_template->withNameSpace('width_medium') => 11, - $this->_template->withNameSpace('width_large') => 6]; + $this->_template->withNameSpace('width_large') => 6]; $default_action_settings = ['boite' => ['no_border_widget', 'no_border', 'mx-auto'], $this->_template->withNameSpace('width_xsmall') => 12, $this->_template->withNameSpace('width_medium') => 12, - $this->_template->withNameSpace('width_large') => 0]; + $this->_template->withNameSpace('width_large') => 0]; $simple_search_action_settings = array_merge(['facettes_codes' => (Class_TypeDoc::CODE_FACETTE . Class_CodifAuteur::CODE_FACETTE . Class_CodifCentreInteret::CODE_FACETTE . Class_CodifMatiere::CODE_FACETTE . Class_Codification::CODE_EDITEUR), - 'facets_order' => 0, + 'facets_order' => 0, 'facets_closed_codes' => '', - 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_VIGNETTES], - $default_action_settings); + 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_VIGNETTES], + $default_action_settings); $no_maps_bib_settings = [Intonation_Library_View_Wrapper_Library_RichContent_Map::class => 0]; @@ -1148,42 +1109,18 @@ class EtatFrancais_Library_ProfilePatcher return $this; } - - protected function _createPage(string $title) : Class_Template_ProfilePatcher_Profile { + protected function _createPage(string $title): Class_Template_ProfilePatcher_Profile + { return parent::_createPage($title) ->setHeaderSettings($this->_header_section_settings) ->setMainSettings($this->_tag_main_settings) ->setFooterSettings($this->_footer_section_settings); } - - protected function _getLibraryUrl() : string { + protected function _getLibraryUrl(): string + { return ($libraries = Class_Bib::findAllVisible()) ? array_shift($libraries)->getUrl() : ''; } - - - public function getDefaultWidgetMenuConfiguration(array $params) : array { - return - ['boite' => [], - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, - $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]; - } - - - public function getDefaultWidgetConfiguration(array $params) : array { - return - ['boite' => [], - 'link_to_all' => 1, - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 1]; - } } diff --git a/library/templates/EtatFrancais/Template.php b/library/templates/EtatFrancais/Template.php index 647e6f8d3b76e131ed92146fe523f81499d23fdc..ab5dca2e8c1fb6e37e3a84ad8e632bde920a5f71 100644 --- a/library/templates/EtatFrancais/Template.php +++ b/library/templates/EtatFrancais/Template.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -18,81 +19,72 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class EtatFrancais_Template extends Intonation_Template +{ + public const ID = 'ETATFRANCAIS'; - -class EtatFrancais_Template extends Intonation_Template { - - const ID = 'ETATFRANCAIS'; - - public function __construct() { + public function __construct() + { $this->setId(static::ID) ->setTitle($this->_('État Français')) ->setSettings(new EtatFrancais_Library_Settings($this)) ->setPatcher(new EtatFrancais_Library_ProfilePatcher($this)); } - - public function getProfile() { + public function getProfile() + { if ($this->_profile) return $this->_profile; - if ($this->_profile = Class_Profil::findFirstBy(['template' => $this->getId()])) return $this->_profile; - $this->createFrom(Class_Profil::getPortail()); return $this->_profile = Class_Profil::getCurrentProfil(); } - - public function renderOpac($view) { + public function renderOpac($view) + { return (new EtatFrancais_View_Opac($this, $view))->render(); } - - public function renderSubModal($view) { + public function renderSubModal($view) + { return (new EtatFrancais_View_SubModal($this, $view))->render(); } - - public function customTemplateForm($form) { + public function customTemplateForm($form) + { $helper = new EtatFrancais_Library_FormCustomizer($this); + return $helper->getTemplateForm($form); } - - public function addHelperPath($view) { + public function addHelperPath($view) + { parent::addHelperPath($view); $view->addHelperPath('templates/EtatFrancais/View', 'EtatFrancais_View'); } - - public function addAdminHelperPath($view) { + public function addAdminHelperPath($view) + { parent::addAdminHelperPath($view); $view->addHelperPath('templates/EtatFrancais/View/Admin', 'EtatFrancais_View_Admin'); } - - public function getCarouselRenderer(string $layout) : string { - return (Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS === $layout) - ? Chili_View_MultipleCarousel::class - : ''; - } - - - public function getTemplateCssFileName() : string { + public function getTemplateCssFileName(): string + { return $this->getEtatfrancaisCss() ? 'etatfrancais' : ''; } - - public function addTemplateJsTo($script_loader) { + public function addTemplateJsTo($script_loader) + { return $this; } - - public function addTemplateCss() : array { + public function addTemplateCss(): array + { return [Class_Url::relative('/library/templates/' . $this->getFolder() . '/Assets/css/dsfr.min.css'), @@ -101,8 +93,8 @@ class EtatFrancais_Template extends Intonation_Template { . '/Assets/css/utility.min.css')]; } - - public function isAuthorized(): bool { + public function isAuthorized(): bool + { return Class_AdminVar::isTemplateEtatFrancaisEnabled(); } } diff --git a/library/templates/Herisson/Assets/css/herisson.css b/library/templates/Herisson/Assets/css/herisson.css index 9142fd82c1b8138dc3e21c444e74824176366bbf..3341b76775bd7c2a45bf83325934b50a7aa3a365 100644 --- a/library/templates/Herisson/Assets/css/herisson.css +++ b/library/templates/Herisson/Assets/css/herisson.css @@ -1729,10 +1729,6 @@ footer .leaflet-pane.leaflet-popup-pane { .search_records_col .masonry .masonry-brick { width: 260px; } - - .card-deck-medium>.card_template { - width: 365px; - } } @media (max-width: 1700px) and (min-width: 1500px) { @@ -1842,10 +1838,7 @@ footer .leaflet-pane.leaflet-popup-pane { .search_records_col .masonry .masonry-brick { width: 255px; } - - .card-deck-medium>.card_template { - width: 240px; - } + .biblio_header .card-deck-medium>.card_template { margin: 0; width: 100%; @@ -1867,10 +1860,6 @@ footer .leaflet-pane.leaflet-popup-pane { .masonry { grid-template-columns: repeat(2, auto); } - - .card-deck-medium { - grid-template-columns: repeat(2, auto) !important; - } } @media (max-width: 991px) { diff --git a/library/templates/Herisson/Library/ProfilePatcher.php b/library/templates/Herisson/Library/ProfilePatcher.php index 24aa9926e50cd040fea78b43986724c2f4d5c51b..a277f7259e69071a23d600b588d00d730c9e9410 100644 --- a/library/templates/Herisson/Library/ProfilePatcher.php +++ b/library/templates/Herisson/Library/ProfilePatcher.php @@ -1,14 +1,13 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * * BOKEH is free software; you can redistribute it and/or modify * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by */ - - -class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher { - +class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher +{ protected Class_StylesPack $_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto; protected Class_StylesPack $_style_pack_no_border_no_radius_no_shadow_mx_auto_my_5; protected Class_StylesPack $_style_pack_background_white; @@ -20,95 +19,115 @@ class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher protected Class_StylesPack $_style_pack_biblio_footer; protected Class_StylesPack $_style_pack_recherche_scroll; - protected - $_main_menu_simple_bib, - $_main_menu_reseaux_bib, - $_credits_menu, - $_recherche_scroll_menu, - - $_agenda_page, - $_reseau_page, - $_selections_page, - $_enligne_page, - $_mentionslegales_page, - $_accessibilite_page, - - $_disable_widget_template, - $_only_content_widget_template, - $_disable_only_content_widget_template, - - $_widget_nav_classes = ['background-white', 'no_border_widget', 'no_border_radius'], - $_tag_main_settings, - - $_widget_in_main_settings, - $_widget_general_settings = ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto'], - $_header_section_settings, - $_footer_section_settings; - - - public function __construct($template) { + protected $_main_menu_simple_bib; + protected $_main_menu_reseaux_bib; + protected $_credits_menu; + protected $_recherche_scroll_menu; + protected $_agenda_page; + protected $_reseau_page; + protected $_selections_page; + protected $_enligne_page; + protected $_mentionslegales_page; + protected $_accessibilite_page; + protected $_disable_widget_template; + protected $_only_content_widget_template; + protected $_disable_only_content_widget_template; + protected $_widget_nav_classes = ['background-white', 'no_border_widget', 'no_border_radius']; + protected $_tag_main_settings; + protected $_widget_in_main_settings; + protected $_widget_general_settings = ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto']; + protected $_header_section_settings; + protected $_footer_section_settings; + + public function __construct($template) + { parent::__construct($template); - $this->_disable_widget_template = [$this->_template->withNameSpace('show_header') => 0, + $this->_disable_widget_template = [$this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]; - $this->_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_footer') => 0]; + $this->_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 0, $this->_template->withNameSpace('show_content') => 1, - $this->_template->withNameSpace('show_footer') => 0]; - $this->_disable_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_footer') => 0]; + $this->_disable_only_content_widget_template = [$this->_template->withNameSpace('show_header') => 1, $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 1]; - $this->_tag_main_settings = ['boite' => ['no_border_radius', 'mx-auto'], + $this->_template->withNameSpace('show_footer') => 1]; + $this->_tag_main_settings = ['boite' => ['no_border_radius', 'mx-auto'], $this->_template->withNameSpace('width_xsmall') => 12]; - $this->_widget_in_main_settings = array_merge(['boite' => ['no_border_widget', 'no_shadow', 'mx-auto'], - 'rendering' => 'card', - 'layout' => 'grid', - 'size' => 99, + $this->_widget_in_main_settings = array_merge(['boite' => ['no_border_widget', 'no_shadow', 'mx-auto'], + 'rendering' => 'card', + 'layout' => 'grid', + 'size' => 99, $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template); + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template); $this->_header_section_settings = [$this->_template->withNameSpace('width_xsmall') => 12]; - $this->_footer_section_settings = ['boite' => ['background-dark'], + $this->_footer_section_settings = ['boite' => ['background-dark'], $this->_template->withNameSpace('width_xsmall') => 12]; } + public function getDefaultWidgetMenuConfiguration(array $params): array + { + return + ['boite' => [], + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, + $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 0, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 0]; + } + + public function getDefaultWidgetConfiguration(array $params): array + { + return + ['boite' => [], + 'link_to_all' => 1, + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), + $this->_template->withNameSpace('show_header') => 1, + $this->_template->withNameSpace('show_content') => 0, + $this->_template->withNameSpace('show_footer') => 1]; + } - protected function _generatePacks() { + protected function _generatePacks() + { $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto = $this->_getOrCreateStylePack($this->_('Marges horizontales automatiques, sans bordure de boites, sans arrondi, sans ombre, sans fond'), - ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto']); + ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto']); $this->_style_pack_no_border_no_radius_no_shadow_mx_auto_my_5 = $this->_getOrCreateStylePack($this->_('Marges horizontales automatiques, marges vertical à 5, sans bordure de boites, sans arrondi, sans ombre'), - ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'my-5']); + ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'my-5']); $this->_style_pack_background_white = $this->_getOrCreateStylePack($this->_('Fond blanc'), - ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-white', 'py-3', 'my-3']); + ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-white', 'py-3', 'my-3']); $this->_style_pack_background_light = $this->_getOrCreateStylePack($this->_('Fond clair'), - ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-light', 'py-3', 'my-3']); + ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-light', 'py-3', 'my-3']); $this->_style_pack_background_dark = $this->_getOrCreateStylePack($this->_('Fond foncé'), - ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-dark', 'py-3', 'my-3']); + ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-dark', 'py-3', 'my-3']); $this->_style_pack_background_very_dark = $this->_getOrCreateStylePack($this->_('Fond très foncé'), - ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-very_dark', 'py-3', 'my-3']); + ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'background-very_dark', 'py-3', 'my-3']); $this->_style_pack_image_banniere = $this->_getOrCreateStylePack($this->_('Image banniere'), - ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'image_banniere', 'mt_80']); + ['no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'image_banniere', 'mt_80']); $this->_style_pack_biblio_header = $this->_getOrCreateStylePack($this->_('Boite bibliothèque bouton horaires'), - ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'biblio_header']); + ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'biblio_header']); $this->_style_pack_biblio_footer = $this->_getOrCreateStylePack($this->_('Boite bibliothèque horaires'), - ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'biblio_footer', 'no_footer_card']); + ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'biblio_footer', 'no_footer_card']); $this->_style_pack_recherche_scroll = $this->_getOrCreateStylePack($this->_('Boite recherche scroll'), - ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'recherche_scroll']); + ['no_background', 'no_border_widget', 'no_border_radius', 'no_shadow', 'mx-auto', 'recherche_scroll']); + return $this; } - - protected function _upgradeProfile() { + protected function _upgradeProfile() + { parent::_upgradeProfile(); $this->_profile @@ -116,7 +135,7 @@ class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher ->setAccessLevel(-1) ->setLibelle($this->_('Thème Hérisson - Accueil')); - if ( ! $this->_profile->hasFavicon()) + if (!$this->_profile->hasFavicon()) $this->_profile->setFavicon('../Assets/images/favicon.ico'); $this->_profile->save(); @@ -132,563 +151,556 @@ class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher ->_addAccessibilitePage(); } - - /* Page agenda */ - protected function _addAgendaPage() { + // Page agenda + protected function _addAgendaPage() + { $this->_agenda_page = $this ->_createPage($this->_('Agenda')) ->setRewriteUrl($this->_('agenda')) ->addWidget(Intonation_Library_Widget_Carousel_Agenda_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Agenda'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'rendering' => 'card', - 'layout' => 'grid', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Agenda'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'rendering' => 'card', + 'layout' => 'grid', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)); + return $this; } - - /* Page réseau des bibliothèques */ - protected function _addReseauPage() { + // Page réseau des bibliothèques + protected function _addReseauPage() + { $this->_reseau_page = $this ->_createPage($this->_('Réseau des bibliothèques')) ->setRewriteUrl($this->_('reseau_des_bibliotheques')) ->addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Réseau des bibliothèques'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_footer_card'], - 'rendering' => 'card', - 'layout' => 'grid', - 'osm_map' => 1, - 'osm_layer' => 1, - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Réseau des bibliothèques'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_footer_card'], + 'rendering' => 'card', + 'layout' => 'grid', + 'osm_map' => 1, + 'osm_layer' => 1, + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)); + return $this; } - - /* Page sélections */ - protected function _addSelectionsPage() { + // Page sélections + protected function _addSelectionsPage() + { $this->_selections_page = $this ->_createPage($this->_('Sélections')) ->setRewriteUrl($this->_('selections')) ->addWidget(Intonation_Library_Widget_Carousel_Domain_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Sélections'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_footer_card'], - 'rendering' => 'card-description', - 'layout' => 'grid', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Sélections'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_footer_card'], + 'rendering' => 'card-description', + 'layout' => 'grid', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)); return $this; } - - /* Page en ligne */ - protected function _addEnLignePage() { + // Page en ligne + protected function _addEnLignePage() + { $this->_enligne_page = $this ->_createPage($this->_('En ligne')) ->setRewriteUrl($this->_('en_ligne')) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('En ligne'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'rendering' => 'card', - 'layout' => 'grid', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('En ligne'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'rendering' => 'card', + 'layout' => 'grid', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)); return $this; } - - /* Page mentions légales */ - protected function _addMentionslegalesPage() { + // Page mentions légales + protected function _addMentionslegalesPage() + { $categorie = $this->_getOrCreateCategory($this->_('Herisson')); $article_content = file_get_contents(ROOT_PATH . 'library/templates/Herisson/Assets/contents/mentions_legales.html'); - $article = (new Class_Article()) - ->updateAttributes(['titre' => $this->_('Mentions légales'), - 'categorie' => $categorie, - 'status' => Class_Article::STATUS_VALIDATED, - 'contenu' => $article_content]); - $article->save(); + $article = $this->_findOrCreateArticle($this->_('Mentions légales'), + $article_content, + $categorie); $this->_mentionslegales_page = $this ->_createPage($this->_('Mentions légales')) ->setRewriteUrl($this->_('mentions_legales')) ->addWidget(Intonation_Library_Widget_Free_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Mentions légales'), - 'id_items' => $article->getId()], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Mentions légales'), + 'id_items' => $article->getId()], + $this->_widget_in_main_settings)); + return $this; } - - /* Page accessibilite */ - protected function _addAccessibilitePage() { + // Page accessibilite + protected function _addAccessibilitePage() + { $categorie = $this->_getOrCreateCategory($this->_('Herisson')); $article_content = file_get_contents(ROOT_PATH . 'library/templates/Herisson/Assets/contents/accessibilite.html'); - $article = (new Class_Article()) - ->updateAttributes(['titre' => $this->_('Accessibilité'), - 'categorie' => $categorie, - 'status' => Class_Article::STATUS_VALIDATED, - 'contenu' => $article_content]); - $article->save(); + $article = $this->_findOrCreateArticle($this->_('Accessibilité'), + $article_content, + $categorie); $this->_accessibilite_page = $this ->_createPage($this->_('Accessibilité')) ->setRewriteUrl($this->_('accessibilite')) ->addWidget(Intonation_Library_Widget_Free_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Accessibilité'), - 'id_items' => $article->getId()], - $this->_widget_in_main_settings)); + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Accessibilité'), + 'id_items' => $article->getId()], + $this->_widget_in_main_settings)); + return $this; } - - protected function _upgradeSections() { + protected function _upgradeSections() + { return $this ->_setHeaderSettings($this->_header_section_settings) - ->_setMainSettings(['boite' => ['no_border_radius', 'mx-auto', 'herisson_widget'], + ->_setMainSettings(['boite' => ['no_border_radius', 'mx-auto', 'herisson_widget'], $this->_template->withNameSpace('width_xsmall') => 12]) ->_setFooterSettings($this->_footer_section_settings); } - - protected function _upgradeMenus() { + protected function _upgradeMenus() + { $recherche_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Search_Definition::CODE, - array_merge(['titre' => $this->_('Recherche scroll'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_recherche_scroll->getId(), - 'search_button' => 'class fas fa-search', - 'placeholder' => $this->_('Tapez ici votre recherche (Titre, Auteur, Mot clé...)'), - 'type_doc' => 'Tous types de documents :', - 'facets_in_session' => 0, - 'always_new_search' => 1, - 'select_doc' => 1, - 'recherche_avancee' => 0, - 'doc_type_selection_label' => '', - 'HerissonVisibleWhenHidden' => '6', - $this->_template->withNameSpace('form_style') => 'toggle', - 'menu' => $this->_profile_id . '-' . $this->_recherche_scroll_menu, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)); - - $this->_recherche_scroll_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu recherche en scroll'), - 'picto' => '', - 'menus' => [$recherche_widget_menu]]); + array_merge(['titre' => $this->_('Recherche scroll'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_recherche_scroll->getId(), + 'search_button' => 'class fas fa-search', + 'placeholder' => $this->_('Tapez ici votre recherche (Titre, Auteur, Mot clé...)'), + 'type_doc' => 'Tous types de documents :', + 'facets_in_session' => 0, + 'always_new_search' => 1, + 'select_doc' => 1, + 'recherche_avancee' => 0, + 'doc_type_selection_label' => '', + 'HerissonVisibleWhenHidden' => '6', + $this->_template->withNameSpace('form_style') => 'toggle', + 'menu' => $this->_profile_id . '-' . $this->_recherche_scroll_menu, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)); + + $this->_recherche_scroll_menu = $this->_profile->addMenu(['libelle' => $this->_('Menu recherche en scroll'), + 'picto' => '', + 'menus' => [$recherche_widget_menu]]); $image_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Image_Definition::CODE, - array_merge(['titre' => $this->_('Logo du réseau'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), 'image' => Class_Url::relative('/library/templates/Intonation/Assets/images/bokeh_focale.png'), - 'image_alt' => 'Logo du réseau', - 'link' => $this->_('/accueil')], - $this->_disable_widget_template)); + array_merge(['titre' => $this->_('Logo du réseau'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), 'image' => Class_Url::relative('/library/templates/Intonation/Assets/images/bokeh_focale.png'), + 'image_alt' => 'Logo du réseau', + 'link' => $this->_('/accueil')], + $this->_disable_widget_template)); $access_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Accessibility_Definition::CODE, - array_merge(['titre' => $this->_('Accessibilité'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'popup_mode' => 'popup'], - $this->_disable_widget_template)); - - $simple_bibs_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu des bibliothèques'), - 'picto' => '', - 'menus' => [['type_menu' => 'ACCUEIL', - 'libelle' => $this->_('Accueil'), + array_merge(['titre' => $this->_('Accessibilité'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'popup_mode' => 'popup'], + $this->_disable_widget_template)); + + $simple_bibs_menu = $this->_profile->addMenu(['libelle' => $this->_('Menu des bibliothèques'), + 'picto' => '', + 'menus' => [['type_menu' => 'ACCUEIL', + 'libelle' => $this->_('Accueil'), 'use_profil' => $this->_profile_id], ['type_menu' => 'URL', - 'libelle' => $this->_('Infos pratiques'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Infos pratiques'), + 'url' => $this->_getLibraryUrl()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Agenda'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Agenda'), 'clef_profil' => $this->_agenda_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Sélections'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Sélections'), 'clef_profil' => $this->_selections_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('En ligne'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('En ligne'), 'clef_profil' => $this->_enligne_page->getId()], - $recherche_widget_menu]]); $simple_bibs_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - array_merge(['titre' => $this->_('Menu simple bibliothèques'), - 'menu' => $this->_profile_id . '-' . $simple_bibs_menu, - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'link_to_all' => 0], - $this->_disable_widget_template)); - - $reseaux_bibs_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu réseau bibliothèques'), - 'picto' => '', - 'menus' => [['type_menu' => 'ACCUEIL', - 'libelle' => $this->_('Accueil'), - 'use_profil' => $this->_profile_id], - - ['type_menu' => 'MENU', - 'libelle' => $this->_('Infos pratiques'), - 'sous_menus' => [['type_menu' => 'PROFIL', - 'libelle' => $this->_('Tout le réseau'), + array_merge(['titre' => $this->_('Menu simple bibliothèques'), + 'menu' => $this->_profile_id . '-' . $simple_bibs_menu, + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'link_to_all' => 0], + $this->_disable_widget_template)); + + $reseaux_bibs_menu = $this->_profile->addMenu(['libelle' => $this->_('Menu réseau bibliothèques'), + 'picto' => '', + 'menus' => [['type_menu' => 'ACCUEIL', + 'libelle' => $this->_('Accueil'), + 'use_profil' => $this->_profile_id], + + ['type_menu' => 'MENU', + 'libelle' => $this->_('Infos pratiques'), + 'sous_menus' => [['type_menu' => 'PROFIL', + 'libelle' => $this->_('Tout le réseau'), 'clef_profil' => $this->_reseau_page->getId()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°1'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Bibliothèque n°1'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°2'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Bibliothèque n°2'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°3'), - 'url' => $this->_getLibraryUrl()], + 'libelle' => $this->_('Bibliothèque n°3'), + 'url' => $this->_getLibraryUrl()], ['type_menu' => 'URL', - 'libelle' => $this->_('Bibliothèque n°4'), - 'url' => $this->_getLibraryUrl()]]], + 'libelle' => $this->_('Bibliothèque n°4'), + 'url' => $this->_getLibraryUrl()]]], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Agenda'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Agenda'), 'clef_profil' => $this->_agenda_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('Selections'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('Selections'), 'clef_profil' => $this->_selections_page->getId()], - ['type_menu' => 'PROFIL', - 'libelle' => $this->_('En ligne'), + ['type_menu' => 'PROFIL', + 'libelle' => $this->_('En ligne'), 'clef_profil' => $this->_enligne_page->getId()], - $recherche_widget_menu]]); $reseaux_bibs_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - array_merge(['titre' => $this->_('Menu réseaux bibliothèques'), - 'menu' => $this->_profile_id . '-' . $reseaux_bibs_menu, - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'link_to_all' => 0], - $this->_disable_widget_template)); - - $social_networks_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu réseaux sociaux'), - 'picto' => '', - 'menus' => [['type_menu' => 'URL', - 'libelle' => $this->_('Facebook'), - 'picto' => 'class fab fa-facebook-square', - 'picto_alt' => 'Logo Facebook', - 'url' => ''], + array_merge(['titre' => $this->_('Menu réseaux bibliothèques'), + 'menu' => $this->_profile_id . '-' . $reseaux_bibs_menu, + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'link_to_all' => 0], + $this->_disable_widget_template)); + + $social_networks_menu = $this->_profile->addMenu(['libelle' => $this->_('Menu réseaux sociaux'), + 'picto' => '', + 'menus' => [['type_menu' => 'URL', + 'libelle' => $this->_('Facebook'), + 'picto' => 'class fab fa-facebook-square', + 'picto_alt' => 'Logo Facebook', + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Youtube'), - 'picto' => 'class fab fa-youtube', - 'picto_alt' => 'Logo Youtube', - 'url' => ''], + 'libelle' => $this->_('Youtube'), + 'picto' => 'class fab fa-youtube', + 'picto_alt' => 'Logo Youtube', + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('X'), - 'picto' => '/library/templates/Intonation/Assets/Font-Awesome/x-twitter-brands-solid.svg', - 'picto_alt' => 'Logo X', - 'url' => ''], + 'libelle' => $this->_('X'), + 'picto' => '/library/templates/Intonation/Assets/Font-Awesome/x-twitter-brands-solid.svg', + 'picto_alt' => 'Logo X', + 'url' => ''], ['type_menu' => 'URL', - 'libelle' => $this->_('Instagram'), - 'picto' => 'class fab fa-instagram', - 'picto_alt' => 'Logo Instagram', - 'url' => ''], - + 'libelle' => $this->_('Instagram'), + 'picto' => 'class fab fa-instagram', + 'picto_alt' => 'Logo Instagram', + 'url' => ''], $access_widget_menu]]); $social_networks_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - array_merge(['titre' => $this->_('Menu réseaux sociaux'), - 'menu' => $this->_profile_id . '-' . $social_networks_menu, - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['menu_buttons'], - 'link_to_all' => 0, - 'HerissonExpandBreakpoint' => '', - 'HerissonHiddenMode' => ['md', 'lg', 'xl']], - $this->_disable_widget_template)); + array_merge(['titre' => $this->_('Menu réseaux sociaux'), + 'menu' => $this->_profile_id . '-' . $social_networks_menu, + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['menu_buttons'], + 'link_to_all' => 0, + 'HerissonExpandBreakpoint' => '', + 'HerissonHiddenMode' => ['md', 'lg', 'xl']], + $this->_disable_widget_template)); $connexion_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Login_Definition::CODE, - array_merge(['titre' => $this->_('Connexion'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), 'titre_connecte' => $this->_('Mon compte'), - 'message_connecte' => '', - 'identifiant' => $this->_('Identifiant'), - 'identifiant_exemple' => $this->_('N° de carte'), - 'mot_de_passe' => $this->_('Mot de passe'), - 'mot_de_passe_exemple' => $this->_('Année de naissance'), - 'lien_connexion' => $this->_('Se connecter'), - 'lien_deconnection' => $this->_('Se déconnecter'), - 'lien_mot_de_passe_oublie' => $this->_('Mot de passe oublié'), - 'lien_compte' => $this->_('Mon compte'), - 'lien_creer_compte' => $this->_('S\'enregistrer'), - $this->_template->withNameSpace('form_style') => 'toggle'], - $this->_only_content_widget_template)); - - $this->_main_menu_simple_bib = $this->_profile ->addMenu(['libelle' => $this->_('Menu principal simple bib'), - 'picto' => '', - 'menus' => [$image_widget_menu, + array_merge(['titre' => $this->_('Connexion'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), 'titre_connecte' => $this->_('Mon compte'), + 'message_connecte' => '', + 'identifiant' => $this->_('Identifiant'), + 'identifiant_exemple' => $this->_('N° de carte'), + 'mot_de_passe' => $this->_('Mot de passe'), + 'mot_de_passe_exemple' => $this->_('Année de naissance'), + 'lien_connexion' => $this->_('Se connecter'), + 'lien_deconnection' => $this->_('Se déconnecter'), + 'lien_mot_de_passe_oublie' => $this->_('Mot de passe oublié'), + 'lien_compte' => $this->_('Mon compte'), + 'lien_creer_compte' => $this->_('S\'enregistrer'), + $this->_template->withNameSpace('form_style') => 'toggle'], + $this->_only_content_widget_template)); + + $this->_main_menu_simple_bib = $this->_profile->addMenu(['libelle' => $this->_('Menu principal simple bib'), + 'picto' => '', + 'menus' => [$image_widget_menu, $simple_bibs_widget_menu, $social_networks_widget_menu, $connexion_widget_menu]]); - $this->_main_menu_reseaux_bib = $this->_profile ->addMenu(['libelle' => $this->_('Menu principal réseaux bibs'), - 'picto' => '', - 'menus' => [$image_widget_menu, + $this->_main_menu_reseaux_bib = $this->_profile->addMenu(['libelle' => $this->_('Menu principal réseaux bibs'), + 'picto' => '', + 'menus' => [$image_widget_menu, $reseaux_bibs_widget_menu, $social_networks_widget_menu, $connexion_widget_menu]]); $credit_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_Credits_Definition::CODE, - array_merge(['titre' => $this->_('Crédits'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'link_to_all' => 0, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)); + array_merge(['titre' => $this->_('Crédits'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'link_to_all' => 0, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)); $cookies_widget_menu = $this->_addWidgetInMenu(Intonation_Library_Widget_CookiesManager_Definition::CODE, - array_merge(['titre' => $this->_('Gestion des cookies'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'link_to_all' => 0, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)); + array_merge(['titre' => $this->_('Gestion des cookies'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'link_to_all' => 0, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)); $this->_credits_menu = $this->_profile ->addMenu(['libelle' => $this->_('Menu crédits'), - 'picto' => '', - 'menus' => [['type_menu' => 'URL', - 'libelle' => $this->_('Contact'), - 'url' => '/index/formulairecontact'], + 'picto' => '', + 'menus' => [['type_menu' => 'URL', + 'libelle' => $this->_('Contact'), + 'url' => '/index/formulairecontact'], ['type_menu' => 'URL', - 'libelle' => $this->_('Mentions légales'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_mentionslegales_page->getId()])], + 'libelle' => $this->_('Mentions légales'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_mentionslegales_page->getId()])], ['type_menu' => 'URL', - 'libelle' => $this->_('Accessibilité : Partiellement conforme'), - 'url' => Class_Url::relative(['controller' => 'index', - 'action' => 'index', - 'id_profil' => $this->_accessibilite_page->getId()])], + 'libelle' => $this->_('Accessibilité : Partiellement conforme'), + 'url' => Class_Url::relative(['controller' => 'index', + 'action' => 'index', + 'id_profil' => $this->_accessibilite_page->getId()])], $credit_widget_menu, - $cookies_widget_menu]]); $this->_profile->save(); return $this; } - protected function _upgradeWidgets() { + protected function _upgradeWidgets() + { $categorie = $this->_getOrCreateCategory($this->_('Herisson')); $article_content = file_get_contents(ROOT_PATH . 'library/templates/Herisson/Assets/contents/flash_infos.html'); - $article = (new Class_Article()) - ->updateAttributes(['titre' => $this->_('Flash infos'), + $article = (new Class_Article) + ->updateAttributes(['titre' => $this->_('Flash infos'), 'categorie' => $categorie, - 'status' => Class_Article::STATUS_VALIDATED, - 'contenu' => $article_content]); + 'status' => Class_Article::STATUS_VALIDATED, + 'contenu' => $article_content]); $article->save(); - $this ->removeWidgets() ->_addWidget(Intonation_Library_Widget_Nav_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Navigation principal'), - 'boite' => array_merge(['my-3', 'justify-content-center', 'position_fixed_top'], - $this->_widget_nav_classes), - 'menu' => $this->_profile_id . '-' . $this->_main_menu_simple_bib, - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)) + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Navigation principal'), + 'boite' => array_merge(['my-3', 'justify-content-center', 'position_fixed_top'], + $this->_widget_nav_classes), + 'menu' => $this->_profile_id . '-' . $this->_main_menu_simple_bib, + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Image_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Image banniere'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_image_banniere->getId(), - 'image' => Class_Url::relative('/library/templates/Herisson/Assets/images/banniere_herisson.jpg'), - 'image_alt' => 'Banniere', - 'link' => $this->_('/accueil'), - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)) + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Image banniere'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_image_banniere->getId(), + 'image' => Class_Url::relative('/library/templates/Herisson/Assets/images/banniere_herisson.jpg'), + 'image_alt' => 'Banniere', + 'link' => $this->_('/accueil'), + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Ouverture bibliothèque'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_biblio_header->getId(), - 'rendering' => 'card-description', - 'layout' => 'horizontal_list', - 'filters' => '', - 'size'=> 1, - 'osm_map' => 0, - 'osm_layer' => 0, - $this->_template->withNameSpace('width_xsmall') => 12], - $this->_disable_widget_template)) + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Ouverture bibliothèque'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_biblio_header->getId(), + 'rendering' => 'card-description', + 'layout' => 'horizontal_list', + 'filters' => '', + 'size' => 1, + 'osm_map' => 0, + 'osm_layer' => 0, + $this->_template->withNameSpace('width_xsmall') => 12], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Search_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Recherche'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['justify-content-center', 'align-items-center', 'my-5'], - 'search_button' => 'class fas fa-search', - 'placeholder' => $this->_('Tapez ici votre recherche (Titre, Auteur, Mot clé...)'), - 'type_doc' => '', - 'facets_in_session' => 0, - 'always_new_search' => 1, - 'select_doc' => 0, - 'recherche_avancee' => 1, - 'doc_type_selection_label' => 'Tous types de documents :', - $this->_template->withNameSpace('form_style') => 'default', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_medium') => 10, - $this->_template->withNameSpace('width_large') => 7], - $this->_disable_widget_template)) - + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Recherche'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['justify-content-center', 'align-items-center', 'my-5'], + 'search_button' => 'class fas fa-search', + 'placeholder' => $this->_('Tapez ici votre recherche (Titre, Auteur, Mot clé...)'), + 'type_doc' => '', + 'facets_in_session' => 0, + 'always_new_search' => 1, + 'select_doc' => 0, + 'recherche_avancee' => 1, + 'doc_type_selection_label' => 'Tous types de documents :', + $this->_template->withNameSpace('form_style') => 'default', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_medium') => 10, + $this->_template->withNameSpace('width_large') => 7], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Breadcrumb_Definition::CODE, - Class_Profil::DIV_BANNIERE, - array_merge(['titre' => $this->_('Fil d\'ariane'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_widget_template)) - - /*MAIN*/ + Class_Profil::DIV_BANNIERE, + array_merge(['titre' => $this->_('Fil d\'ariane'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_widget_template)) + + // MAIN ->_addWidget(Intonation_Library_Widget_Free_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Flash infos'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_light->getId(), - 'boite' => ['flash', 'messagedefilant'], - 'id_items' => $article->getId(), - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)) + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Flash infos'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_light->getId(), + 'boite' => ['flash', 'messagedefilant'], + 'id_items' => $article->getId(), + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Actualités'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['text-align-center', 'no_badges', 'card_shadow', 'no_description', 'no_footer_card', 'title-uppercase'], - 'rendering' => 'card', - 'layout' => 'horizontal_list', - 'size' => 3, - 'order' => 'DateCreationDesc', - 'link_to_all' => 1, - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)) + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Actualités'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['text-align-center', 'no_badges', 'card_shadow', 'no_description', 'no_footer_card', 'title-uppercase'], + 'rendering' => 'card', + 'layout' => 'horizontal_list', + 'size' => 3, + 'order' => 'DateCreationDesc', + 'link_to_all' => 1, + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Nouveautés'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_light->getId(), - 'boite' => ['px-9', 'no_overlay'], - 'rendering' => 'card-overlay', - 'layout' => 'multiple_carousel_plus', - 'size' => 15, - 'order' => 'date_creation desc, alpha_titre asc', - 'link_to_all' => 1, - 'all_layout' => 'search', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_medium') => 12], - $this->_disable_only_content_widget_template)) + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Nouveautés'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_light->getId(), + 'boite' => ['px-9', 'no_overlay'], + 'rendering' => 'card-overlay', + 'layout' => 'multiple_carousel_plus', + 'size' => 15, + 'order' => 'date_creation desc, alpha_titre asc', + 'link_to_all' => 1, + 'all_layout' => 'search', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_medium') => 12], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Domain_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Nouveautés par genres'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['no_footer_card'], - 'rendering' => 'card-description', - 'layout' => 'horizontal_list', - 'size' => 6, - 'all_layout' => 'search', - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)) + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Nouveautés par genres'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['no_footer_card'], + 'rendering' => 'card-description', + 'layout' => 'horizontal_list', + 'size' => 6, + 'all_layout' => 'search', + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Review_Definition::CODE, - Class_Profil::DIV_MAIN, - array_merge(['titre' => $this->_('Avis'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - 'boite' => ['limit_badges_2', 'background-white_and_light_card'], - 'rendering' => 'card', - 'layout' => 'horizontal_list', - 'size' => 5, - 'link_to_all' => 1, - $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10], - $this->_disable_only_content_widget_template)) - - /*FOOTER*/ + Class_Profil::DIV_MAIN, + array_merge(['titre' => $this->_('Avis'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), + 'boite' => ['limit_badges_2', 'background-white_and_light_card'], + 'rendering' => 'card', + 'layout' => 'horizontal_list', + 'size' => 5, + 'link_to_all' => 1, + $this->_template->withNameSpace('width_xsmall') => 11, + $this->_template->withNameSpace('width_large') => 10], + $this->_disable_only_content_widget_template)) + + // FOOTER ->_addWidget(Intonation_Library_Widget_Image_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Logo du réseau'), - 'boite' => ['no_border', 'no_shadow', 'm-auto', 'py-3', 'align-items-center'], - 'image' => Class_Url::relative('/library/templates/Intonation/Assets/images/bokeh_focale.png'), - 'image_alt' => 'Logo du réseau', - 'link' => $this->_('/accueil'), - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 2], - $this->_disable_widget_template)) + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Logo du réseau'), + 'boite' => ['no_border', 'no_shadow', 'm-auto', 'py-3', 'align-items-center'], + 'image' => Class_Url::relative('/library/templates/Intonation/Assets/images/bokeh_focale.png'), + 'image_alt' => 'Logo du réseau', + 'link' => $this->_('/accueil'), + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 2], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Boite bibliothèque horaires'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_biblio_footer->getId(), - 'boite' => ['justify-content-center'], - 'rendering' => 'card-description', - 'layout' => 'horizontal_list', - 'filters' => '', - 'size'=> 1, - 'osm_map' => 0, - 'osm_layer' => 0, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_small') => 6, - $this->_template->withNameSpace('width_large') => 3], - $this->_disable_widget_template)) + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Boite bibliothèque horaires'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_biblio_footer->getId(), + 'boite' => ['justify-content-center'], + 'rendering' => 'card-description', + 'layout' => 'horizontal_list', + 'filters' => '', + 'size' => 1, + 'osm_map' => 0, + 'osm_layer' => 0, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_small') => 6, + $this->_template->withNameSpace('width_large') => 3], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Menu_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Menu footer'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['justify-content-center', 'credits_bib'], - 'layout' => 'vertical', - 'menu' => $this->_profile_id . '-' . $this->_credits_menu, - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_small') => 6, - $this->_template->withNameSpace('width_large') => 3], - $this->_disable_widget_template)) + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Menu footer'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['justify-content-center', 'credits_bib'], + 'layout' => 'vertical', + 'menu' => $this->_profile_id . '-' . $this->_credits_menu, + $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_small') => 6, + $this->_template->withNameSpace('width_large') => 3], + $this->_disable_widget_template)) ->_addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Carte bibliothèque'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'rendering' => 'card-description', - 'layout' => 'horizontal_list', - 'filters' => '', - 'size'=> 0, - 'osm_map' => 1, - 'osm_layer' => 1, - $this->_template->withNameSpace('width_xsmall') => 12, - $this->_template->withNameSpace('width_large') => 3], - $this->_only_content_widget_template)) + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Carte bibliothèque'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'rendering' => 'card-description', + 'layout' => 'horizontal_list', + 'filters' => '', + 'size' => 0, + 'osm_map' => 1, + 'osm_layer' => 1, + $this->_template->withNameSpace('width_xsmall') => 12, + $this->_template->withNameSpace('width_large') => 3], + $this->_only_content_widget_template)) ->_addScrollTopWidget() ->_addAdminWidget() @@ -697,49 +709,50 @@ class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher return $this; } - - protected function _addScrollTopWidget() { + protected function _addScrollTopWidget() + { $this->_addWidget(Intonation_Library_Widget_Scroll_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Défilement vers le haut'), - 'boite' => ['no_border', 'no_border_radius', 'position_fixed_bottom_right'], - 'direction' => 'up'], - $this->_disable_widget_template)); + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Défilement vers le haut'), + 'boite' => ['no_border', 'no_border_radius', 'position_fixed_bottom_right'], + 'direction' => 'up'], + $this->_disable_widget_template)); + return $this; } - - protected function _addAdminWidget() { + protected function _addAdminWidget() + { return $this->_addWidget(Intonation_Library_Widget_AdminTools_Definition::CODE, - Class_Profil::DIV_FOOTER, - array_merge(['titre' => $this->_('Administration'), - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), - 'boite' => ['no_border', 'position_fixed_bottom_left', 'white_widget']], - $this->_disable_widget_template)); + Class_Profil::DIV_FOOTER, + array_merge(['titre' => $this->_('Administration'), + $this->_template->withNameSpace('styles_pack') => $this->_style_pack_no_background_no_border_no_radius_no_shadow_mx_auto->getId(), + 'boite' => ['no_border', 'position_fixed_bottom_left', 'white_widget']], + $this->_disable_widget_template)); } - - /*cle a molette*/ - protected function _upgradeActions() { - $form_action_settings = ['boite' => ['mx-auto'], + // cle a molette + protected function _upgradeActions() + { + $form_action_settings = ['boite' => ['mx-auto'], $this->_template->withNameSpace('width_xsmall') => 12, $this->_template->withNameSpace('width_medium') => 11, - $this->_template->withNameSpace('width_large') => 0]; + $this->_template->withNameSpace('width_large') => 0]; - $default_action_settings = ['boite' => ['no_border_widget', 'no_border', 'mx-auto'], + $default_action_settings = ['boite' => ['no_border_widget', 'no_border', 'mx-auto'], $this->_template->withNameSpace('width_xsmall') => 11, - $this->_template->withNameSpace('width_large') => 10]; + $this->_template->withNameSpace('width_large') => 10]; $simple_search_action_settings = array_merge(['facettes_codes' => (Class_TypeDoc::CODE_FACETTE . Class_CodifAuteur::CODE_FACETTE . Class_CodifCentreInteret::CODE_FACETTE . Class_CodifMatiere::CODE_FACETTE . Class_Codification::CODE_EDITEUR), - 'facets_order' => 0, + 'facets_order' => 0, 'facets_closed_codes' => '', - 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_VIGNETTES], - $default_action_settings); + 'liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_VIGNETTES], + $default_action_settings); $no_maps_bib_settings = [Intonation_Library_View_Wrapper_Library_RichContent_Map::class => 0]; @@ -765,42 +778,18 @@ class Herisson_Library_ProfilePatcher extends Intonation_Library_ProfilePatcher return $this; } - - protected function _createPage(string $title) : Class_Template_ProfilePatcher_Profile { + protected function _createPage(string $title): Class_Template_ProfilePatcher_Profile + { return parent::_createPage($title) ->setHeaderSettings($this->_header_section_settings) ->setMainSettings($this->_tag_main_settings) ->setFooterSettings($this->_footer_section_settings); } - - protected function _getLibraryUrl() : string { + protected function _getLibraryUrl(): string + { return ($libraries = Class_Bib::findAllVisible()) ? array_shift($libraries)->getUrl() : ''; } - - - public function getDefaultWidgetMenuConfiguration(array $params) : array { - return - ['boite' => [], - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - $this->_template->withNameSpace('expand_breakpoint') => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, - $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 0, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 0]; - } - - - public function getDefaultWidgetConfiguration(array $params) : array { - return - ['boite' => [], - 'link_to_all' => 1, - $this->_template->withNameSpace('styles_pack') => $this->_style_pack_background_white->getId(), - $this->_nameSpaced('responsive_pack') => $this->_full_width_responsive_pack->getId(), - $this->_template->withNameSpace('show_header') => 1, - $this->_template->withNameSpace('show_content') => 0, - $this->_template->withNameSpace('show_footer') => 1]; - } } diff --git a/library/templates/Herisson/Template.php b/library/templates/Herisson/Template.php index 8add87c64b9d25a2981d84159781908b3f72b452..c7fdda807da20eb0a22269f72ceb336b6babb54e 100644 --- a/library/templates/Herisson/Template.php +++ b/library/templates/Herisson/Template.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -18,69 +19,60 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class Herisson_Template extends Intonation_Template +{ + public const ID = 'HERISSON'; - -class Herisson_Template extends Intonation_Template { - - const ID = 'HERISSON'; - - public function __construct() { + public function __construct() + { $this->setId(static::ID) ->setTitle($this->_('Herisson')) ->setSettings(new Herisson_Library_Settings($this)) ->setPatcher(new Herisson_Library_ProfilePatcher($this)); } - - public function getProfile() { + public function getProfile() + { if ($this->_profile) return $this->_profile; - if ($this->_profile = Class_Profil::findFirstBy(['template' => $this->getId()])) return $this->_profile; - $this->createFrom(Class_Profil::getPortail()); return $this->_profile = Class_Profil::getCurrentProfil(); } - - public function renderOpac($view) { + public function renderOpac($view) + { return (new Herisson_View_Opac($this, $view))->render(); } - - public function renderSubModal($view) { + public function renderSubModal($view) + { return (new Herisson_View_SubModal($this, $view))->render(); } - - public function customTemplateForm($form) { + public function customTemplateForm($form) + { $helper = new Herisson_Library_FormCustomizer($this); + return $helper->getTemplateForm($form); } - - public function addHelperPath($view) { + public function addHelperPath($view) + { parent::addHelperPath($view); $view->addHelperPath('templates/Herisson/View', 'Herisson_View'); } - - public function addAdminHelperPath($view) { + public function addAdminHelperPath($view) + { parent::addAdminHelperPath($view); $view->addHelperPath('templates/Herisson/View/Admin', 'Herisson_View_Admin'); } - - public function getCarouselRenderer(string $layout) : string { - return (Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS === $layout) - ? Chili_View_MultipleCarousel::class - : ''; - } - - - public function getTemplateCssFileName() : string { + public function getTemplateCssFileName(): string + { return $this->getHerissonCss() ? 'herisson' : ''; diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index 5b7e826f25ab1507b2dfa6ccfefc8ad2eddc7ba4..eab18117eb47419f047e94e86c3d64516e2c081c 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -1242,4 +1242,45 @@ div.form_row_as_table:hover { .navbar-expand-sm .navbar-collapse.show { display: initial !important; } -} \ No newline at end of file +} + +.boite [class*="highlight_carousel"] .card-img-overlay { + display: table; + height: 100%; + width: 100%; +} + +.boite [class*="highlight_carousel"] .card-img-overlay > .card { + display: table-cell; + vertical-align: bottom; +} + +.boite [class*="highlight_carousel"] [class*="highlight_column"] { + overflow: hidden; +} + +.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card, +.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card > a, +.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card > a *{ + height: 100%; + width: auto; + max-width: none; +} + +.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card > a { + min-height: 250px; +} + +.boite [class*="highlight_carousel"] .card { + padding: 5px; +} + +.boite [class*="highlight_carousel"] [class*="highlight_column"] > .card { + padding: 0; +} + +.boite [class*="highlight_carousel"] .card-img-overlay .card { + background-color: var(--front-transparent-background); + border: none !important; + box-shadow: none !important; +} diff --git a/library/templates/Intonation/Assets/js/onChangeDoSideEffects/side_effects.js b/library/templates/Intonation/Assets/js/onChangeDoSideEffects/side_effects.js index 602574b1560eef1ee8a6879183327d3111029c9d..0822e3d5aae41503a31f17d316819d7f680b0528 100644 --- a/library/templates/Intonation/Assets/js/onChangeDoSideEffects/side_effects.js +++ b/library/templates/Intonation/Assets/js/onChangeDoSideEffects/side_effects.js @@ -31,6 +31,18 @@ {'input' : '#size', 'value' : '15'}]}, + {'value' : 'top_highlight_carousel', + 'effects' : [{'input' : '#rendering', + 'value' : 'card'}, + {'input' : '#size', + 'value' : '18'}]}, + + {'value' : 'left_highlight_carousel', + 'effects' : [{'input' : '#rendering', + 'value' : 'card'}, + {'input' : '#size', + 'value' : '20'}]}, + {'value' : 'map', 'effects' : [{'input' : '#rendering', 'value' : 'card-description'}, diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index d18f160fab492fbb175d350c5c0d876e3826bce4..3863fe61f7b2f3087b09d0e3e5c63de5ba8fc350 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. * @@ -18,25 +19,22 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_Library_Settings extends Intonation_System_Abstract { - +class Intonation_Library_Settings extends Intonation_System_Abstract +{ protected ?Class_Template $_template; - protected array - $_default_settings = ['core_css' => 1, - 'css_patchs' => [], - 'core_js' => 1, - 'font_awesome_css' => 1, - 'jquery' => 1, - 'jquery_ui' => 1, - 'bootstrap_css' => 1, - 'bootstrap_js' => 1, + protected array $_default_settings = ['core_css' => 1, + 'css_patchs' => [], + 'core_js' => 1, + 'font_awesome_css' => 1, + 'jquery' => 1, + 'jquery_ui' => 1, + 'bootstrap_css' => 1, + 'bootstrap_js' => 1, 'bootstrap_dependency_popper' => 1, - 'intonation_css' => 1, - 'custom_css_url' => [], - 'custom_js_url' => [], - 'library_badges' => 1, + 'intonation_css' => 1, + 'custom_css_url' => [], + 'custom_js_url' => [], + 'library_badges' => 1, 'custom_css_class' => ['position_absolute', 'position_fixed_bottom', @@ -93,442 +91,451 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'justify-content-end', 'justify-content-center', 'menu_buttons', - 'no_badges' + 'no_badges', ], - 'hydrating_mapping' => ['div id site_web_wrapper' => 'container align-self-center no_overflow', - 'div id site_web_content_wrapper' => 'row justify-content-center no-gutters', - 'div class widget' => 'card', - 'div class widget-header' => 'card-header', - 'div class widget-body' => 'card-body', - 'div class widget-footer' => 'card-footer', - 'div class boutons' => 'row justify-content-around my-3', - 'label' => 'col-12 col-sm-5 col-form-label col-form-label-sm pr-1', - 'label class multi-element-label' => 'col-form-label col-form-label-sm', - 'label class debts-email-label' => 'col-4 col-form-label col-form-label-sm', - 'input' => 'form-control form-control-sm', - 'input data-spambots true' => '', - 'input type checkbox' => 'form-check-input form-check-input-sm mr-1', - 'input type submit' => 'btn btn-sm btn-primary', - 'textarea' => 'form-control form-control-sm', - 'select' => 'form-control form-control-sm custom-select custom-select-sm', - 'button' => 'btn btn-secondary', - 'button class btn' => '', - 'button class accessibility' => 'btn btn-light', - 'button class scroll' => 'btn btn-light', - 'button type submit' => 'btn btn-sm btn-primary', - 'fieldset' => 'form-group container-fluid', - 'table' => 'table table-stripped table-hover table-responsive-md table-sm', - 'thead' => 'thead-dark', - 'img' => 'img-fluid rounded', - 'img class image_widget' => 'img-fluid', - 'img class d-block' => '', - 'img class card-img-top' => '', - 'img class img-thumbnail' => '', - 'dl' => 'row', - 'dt' => 'col-12 col-sm-3', - 'dd' => 'col-12 col-sm-9', - 'dt class user_info' => 'col-12 col-sm-6', - 'dd class user_info' => 'col-12 col-sm-6', - 'a' => 'text-secondary', - 'a class flux-rss' => 'btn btn-secondary', - 'a class carousel_control' => 'text-dark', - 'a class btn' => 'text-light', - 'a class list_format' => 'btn btn-light', - 'a class nav-link' => 'text-light', - 'a class jumbotron_nav_link' => 'text-dark', - 'a class account_all_loans' => 'btn btn-sm list-group-item-info', - 'a class account_current_loans' => 'btn btn-sm list-group-item-info', - 'a class account_late_loans' => 'btn btn-sm list-group-item-info', - 'a class account_others_holds' => 'btn btn-sm list-group-item-info', - 'a class more_action' => 'text-primary', - 'a class badge' => '', - 'a class active' => '', - 'a class card-link' => '', - 'div class card_action' => 'col col-lg-12 p-0 mx-1 my-1', - 'div class collection_action' => 'col mr-3', - 'div class alone_in_the_list' => 'col-3', - 'a class list-group-item' => '', - 'div class list-group-item' => 'bg-transparent px-0 mb-3', - 'div class list-group' => ' bg-transparent no_border', - 'a class badge_tag' => 'text-left badge', - 'address class badge_tag' => 'text-left badge-secondary badge no_truncate', - 'a class badge_mail' => 'no_truncate badge-primary text-light', - 'a class badge_phone' => 'no_truncate badge-primary text-light', - 'span class badge_tag' => 'text-left badge', - 'span class badge_event_start' => 'badge-success no_truncate', - 'span class badge_event_end' => 'badge-warning no_truncate', - 'span class badge_event_period' => 'badge-success no_truncate', - 'span class custom_field' => 'badge-light', - 'span class search_result_count' => 'btn btn-sm btn-info', - 'a class calendar_day_event_start' => 'border-bottom border-info', + 'hydrating_mapping' => ['div id site_web_wrapper' => 'container align-self-center no_overflow', + 'div id site_web_content_wrapper' => 'row justify-content-center no-gutters', + 'div class widget' => 'card', + 'div class widget-header' => 'card-header', + 'div class widget-body' => 'card-body', + 'div class widget-footer' => 'card-footer', + 'div class boutons' => 'row justify-content-around my-3', + 'label' => 'col-12 col-sm-5 col-form-label col-form-label-sm pr-1', + 'label class multi-element-label' => 'col-form-label col-form-label-sm', + 'label class debts-email-label' => 'col-4 col-form-label col-form-label-sm', + 'input' => 'form-control form-control-sm', + 'input data-spambots true' => '', + 'input type checkbox' => 'form-check-input form-check-input-sm mr-1', + 'input type submit' => 'btn btn-sm btn-primary', + 'textarea' => 'form-control form-control-sm', + 'select' => 'form-control form-control-sm custom-select custom-select-sm', + 'button' => 'btn btn-secondary', + 'button class btn' => '', + 'button class accessibility' => 'btn btn-light', + 'button class scroll' => 'btn btn-light', + 'button type submit' => 'btn btn-sm btn-primary', + 'fieldset' => 'form-group container-fluid', + 'table' => 'table table-stripped table-hover table-responsive-md table-sm', + 'thead' => 'thead-dark', + 'img' => 'img-fluid rounded', + 'img class image_widget' => 'img-fluid', + 'img class d-block' => '', + 'img class card-img-top' => '', + 'img class img-thumbnail' => '', + 'dl' => 'row', + 'dt' => 'col-12 col-sm-3', + 'dd' => 'col-12 col-sm-9', + 'dt class user_info' => 'col-12 col-sm-6', + 'dd class user_info' => 'col-12 col-sm-6', + 'a' => 'text-secondary', + 'a class flux-rss' => 'btn btn-secondary', + 'a class carousel_control' => 'text-dark', + 'a class btn' => 'text-light', + 'a class list_format' => 'btn btn-light', + 'a class nav-link' => 'text-light', + 'a class jumbotron_nav_link' => 'text-dark', + 'a class account_all_loans' => 'btn btn-sm list-group-item-info', + 'a class account_current_loans' => 'btn btn-sm list-group-item-info', + 'a class account_late_loans' => 'btn btn-sm list-group-item-info', + 'a class account_others_holds' => 'btn btn-sm list-group-item-info', + 'a class more_action' => 'text-primary', + 'a class badge' => '', + 'a class active' => '', + 'a class card-link' => '', + 'div class card_action' => 'col col-lg-12 p-0 mx-1 my-1', + 'div class collection_action' => 'col mr-3', + 'div class alone_in_the_list' => 'col-3', + 'a class list-group-item' => '', + 'div class list-group-item' => 'bg-transparent px-0 mb-3', + 'div class list-group' => ' bg-transparent no_border', + 'a class badge_tag' => 'text-left badge', + 'address class badge_tag' => 'text-left badge-secondary badge no_truncate', + 'a class badge_mail' => 'no_truncate badge-primary text-light', + 'a class badge_phone' => 'no_truncate badge-primary text-light', + 'span class badge_tag' => 'text-left badge', + 'span class badge_event_start' => 'badge-success no_truncate', + 'span class badge_event_end' => 'badge-warning no_truncate', + 'span class badge_event_period' => 'badge-success no_truncate', + 'span class custom_field' => 'badge-light', + 'span class search_result_count' => 'btn btn-sm btn-info', + 'a class calendar_day_event_start' => 'border-bottom border-info', 'span class calendar_day_event_start' => 'border-bottom border-info', - 'a class day_clickable' => 'text-success font-weight-bold', - 'a class filter_reset_button' => 'btn btn-warning', - 'ul' => 'list-unstyled', - 'div class navbar-header' => 'justify-content-between', - 'div class navbar-collapse' => 'justify-content-center', - 'div class _notify' => 'alert-warning', - 'div class success_notify' => 'alert-success', - 'div class delete_notify' => 'alert-danger', + 'a class day_clickable' => 'text-success font-weight-bold', + 'a class filter_reset_button' => 'btn btn-warning', + 'ul' => 'list-unstyled', + 'div class navbar-header' => 'justify-content-between', + 'div class navbar-collapse' => 'justify-content-center', + 'div class _notify' => 'alert-warning', + 'div class success_notify' => 'alert-success', + 'div class delete_notify' => 'alert-danger', 'div class ils_unread_message_notify' => 'alert alert-info', - 'div class ils_read_message_notify' => 'alert alert-dark', - 'a class ils_unread_message_button' => 'btn btn-sm btn-danger font-weight-bold', - 'a class ils_read_message_button' => 'btn btn-sm btn-info', - - 'div class card_article' => 'col-12 mb-3', - 'div class card_activity_session' => 'col-12 mb-3', - 'div class search_result' => 'px-3 px-sm-0', - 'h1 class content_title' => 'col-12 py-2 px-0 my-2 mx-0 border-bottom', - 'h2 class jumbotron_section_title' => 'text-dark', - 'span class search_axe_operator_prefix' => 'col-5', - 'label class search_axe_label' => 'ml-3 col-6', - 'span class search_axe_input' => '', + 'div class ils_read_message_notify' => 'alert alert-dark', + 'a class ils_unread_message_button' => 'btn btn-sm btn-danger font-weight-bold', + 'a class ils_read_message_button' => 'btn btn-sm btn-info', + + 'div class card_article' => 'col-12 mb-3', + 'div class card_activity_session' => 'col-12 mb-3', + 'div class search_result' => 'px-3 px-sm-0', + 'h1 class content_title' => 'col-12 py-2 px-0 my-2 mx-0 border-bottom', + 'h2 class jumbotron_section_title' => 'text-dark', + 'span class search_axe_operator_prefix' => 'col-5', + 'label class search_axe_label' => 'ml-3 col-6', + 'span class search_axe_input' => '', 'div class search_axe_label_and_operator' => 'col-12 col-sm-5 row no-gutters', - 'p class opened' => 'text-white bg-success p-1 rounded d-inline-block', - 'p class closed' => 'text-white bg-danger p-1 rounded d-inline-block', - 'p class empty_list_message' => 'text-warning px-4', - 'div class search_dropdown_menu' => 'dropdown-menu-right', - - 'ul class result_tools_nav' => 'list-unstyled row no-gutters', - 'li class result_count_results' => 'order-1', - 'li class result_list_mod' => 'order-2', - 'li class result_wall_mod' => 'order-3', - 'li class result_page_size' => 'order-4', - 'li class result_search_order' => 'order-5', - 'li class result_pager' => 'order-6', + 'p class opened' => 'text-white bg-success p-1 rounded d-inline-block', + 'p class closed' => 'text-white bg-danger p-1 rounded d-inline-block', + 'p class empty_list_message' => 'text-warning px-4', + 'div class search_dropdown_menu' => 'dropdown-menu-right', + + 'ul class result_tools_nav' => 'list-unstyled row no-gutters', + 'li class result_count_results' => 'order-1', + 'li class result_list_mod' => 'order-2', + 'li class result_wall_mod' => 'order-3', + 'li class result_page_size' => 'order-4', + 'li class result_search_order' => 'order-5', + 'li class result_pager' => 'order-6', 'li class result_select_records' => 'order-7', - 'li class result_follow_search' => 'order-8', - 'li class result_more_actions' => 'order-9', + 'li class result_follow_search' => 'order-8', + 'li class result_more_actions' => 'order-9', - 'div class search_title_col' => 'col-12 order-1', + 'div class search_title_col' => 'col-12 order-1', 'div class search_criteria_col' => 'col-12 order-2', - 'div class search_tools_col' => 'col-12 border-top border-bottom pt-2 mb-2 order-3', + 'div class search_tools_col' => 'col-12 border-top border-bottom pt-2 mb-2 order-3', 'div class search_domain_browser_col' => 'col-12 pt-2 mb-2 order-4', - 'div class search_facets_col' => 'col-12 col-md-3 order-5', - 'div class search_records_col' => 'col-12 col-md-9 order-6', - 'div class search_no_records_col' => 'col-12 order-6', - 'div class search_tools_col_2' => 'col-12 border-top border-bottom pt-2 mb-2 order-7', + 'div class search_facets_col' => 'col-12 col-md-3 order-5', + 'div class search_records_col' => 'col-12 col-md-9 order-6', + 'div class search_no_records_col' => 'col-12 order-6', + 'div class search_tools_col_2' => 'col-12 border-top border-bottom pt-2 mb-2 order-7', - 'form class login' => 'row no-gutters m-auto', + 'form class login' => 'row no-gutters m-auto', 'h1 class login_header' => 'col-12', 'div class wrapper_zendafi_form_custommultifacetsdoctype' => 'order-1', 'div class wrapper_zendafi_form_custommultifacetsdomains' => 'order-2', - 'div class wrapper_zendafi_form_custommultifacetsannexe' => 'order-3', - 'div class wrapper_zendafi_form_custommultifacetsbib' => 'order-3', - 'div class wrapper_zendafi_form_expressionrecherche' => 'order-4', - 'div class custom_reset_search' => 'order-5', - 'div class custom_advanced_search' => 'order-6', - 'button class search_submit_button' => 'order-7', - 'a class active_criteria' => 'btn btn-warning btn-sm mt-2 mr-2 text-dark text-left', - 'a class reset_criteria' => 'btn btn-info btn-sm mt-2 mr-2 text-dark text-left', - 'a class back_to_search' => 'btn btn-info btn-sm mt-2 mr-2 text-dark text-left', - 'button class reset_search' => 'btn btn-sm btn-warning border-dark', - - 'div class multi_facets_submit' => 'btn btn-sm btn-primary mb-2', - 'li class facette_titre' => 'list-unstyled list-group-item py-1 px-1 my-1', + 'div class wrapper_zendafi_form_custommultifacetsannexe' => 'order-3', + 'div class wrapper_zendafi_form_custommultifacetsbib' => 'order-3', + 'div class wrapper_zendafi_form_expressionrecherche' => 'order-4', + 'div class custom_reset_search' => 'order-5', + 'div class custom_advanced_search' => 'order-6', + 'button class search_submit_button' => 'order-7', + 'a class active_criteria' => 'btn btn-warning btn-sm mt-2 mr-2 text-dark text-left', + 'a class reset_criteria' => 'btn btn-info btn-sm mt-2 mr-2 text-dark text-left', + 'a class back_to_search' => 'btn btn-info btn-sm mt-2 mr-2 text-dark text-left', + 'button class reset_search' => 'btn btn-sm btn-warning border-dark', + + 'div class multi_facets_submit' => 'btn btn-sm btn-primary mb-2', + 'li class facette_titre' => 'list-unstyled list-group-item py-1 px-1 my-1', 'ul class facettes_unordered_list' => 'list-group no_border mb-2', - 'form class form_facets' => 'mb-2', - 'ul class facets_group' => 'list-unstyled list-group facets', - 'li class facet_item' => 'list-group-item py-1 pr-1 d-flex justify-content-between align-items-center', + 'form class form_facets' => 'mb-2', + 'ul class facets_group' => 'list-unstyled list-group facets', + 'li class facet_item' => 'list-group-item py-1 pr-1 d-flex justify-content-between align-items-center', - 'li class jumbotron_nav_link' => 'p-1 p-xl-0', + 'li class jumbotron_nav_link' => 'p-1 p-xl-0', 'div class jumbotron_nav_tab_text' => 'd-none d-xl-block', - 'div class jumbotron_previous' => 'order-1 col-3 col-md-1', - 'div class jumbotron_next' => 'order-3 order-md-4 order-lg-5 col-3 col-md-1', - 'div class jumbotron_thumbnail' => 'order-2 col-6 col-sm-5 col-md-4 col-lg-2 col-xl-2', - 'div class jumbotron_title' => 'order-4 order-md-3 col-10 col-md-5 col-lg-5 col-xl-5 ml-md-1 px-md-3', - 'div class jumbotron_actions' => 'order-5 order-lg-4 mh-100 no-gutters col-10 col-md-9 col-lg-2', - 'div class jumbotron_nav' => 'order-6 col-10 col-xl-9 mt-2', - 'div class bokeh_jumbotron' => 'jumbotron jumbotron-fluid w-100 py-3 mb-3', - 'div class jumbotron_content' => 'col-10 col-xl-9', + 'div class jumbotron_previous' => 'order-1 col-3 col-md-1', + 'div class jumbotron_next' => 'order-3 order-md-4 order-lg-5 col-3 col-md-1', + 'div class jumbotron_thumbnail' => 'order-2 col-6 col-sm-5 col-md-4 col-lg-2 col-xl-2', + 'div class jumbotron_title' => 'order-4 order-md-3 col-10 col-md-5 col-lg-5 col-xl-5 ml-md-1 px-md-3', + 'div class jumbotron_actions' => 'order-5 order-lg-4 mh-100 no-gutters col-10 col-md-9 col-lg-2', + 'div class jumbotron_nav' => 'order-6 col-10 col-xl-9 mt-2', + 'div class bokeh_jumbotron' => 'jumbotron jumbotron-fluid w-100 py-3 mb-3', + 'div class jumbotron_content' => 'col-10 col-xl-9', 'div class jumbotron_rich_content' => 'col-12 border-bottom border-primary mb-3 pb-3', - 'a class active_item' => 'active', - 'a class record_serie' => 'badge-white no_truncate', + 'a class active_item' => 'active', + 'a class record_serie' => 'badge-white no_truncate', - 'div class rich_content_actions' => 'col-12 px-0 mt-3 record_summary', - 'div class rich_content_row_actions' => 'col col-lg-12 pt-1 mt-1 mr-1 pr-1 w-s_nowrap text-center', - 'div class cardify_horizontal_img' => 'col-12 col-md-4 col-lg-3 px-0 pl-md-0 pr-md-3', + 'div class rich_content_actions' => 'col-12 px-0 mt-3 record_summary', + 'div class rich_content_row_actions' => 'col col-lg-12 pt-1 mt-1 mr-1 pr-1 w-s_nowrap text-center', + 'div class cardify_horizontal_img' => 'col-12 col-md-4 col-lg-3 px-0 pl-md-0 pr-md-3', 'div class cardify_horizontal_content' => 'col-12 col-md-8 col-lg-6 px-0 py-3 py-md-0', 'div class cardify_horizontal_actions' => 'col-12 col-md-12 col-lg-3 px-0 pl-lg-3 pr-lg-0', - 'div class loading_icon' => 'spinner-border', - 'div class review_author' => 'col-12 col-lg-6 text-md-left', - 'div class review_date' => 'col-12 col-lg-6 text-md-right', - 'div class card_with_overlay' => 'card text-center', - 'div class card_overlay' => 'card-block card-img-overlay rounded text-center text-white', - 'div class article_location_header' => 'col-12 order-1', - 'div class article_location_static_map' => 'col-12 col-md-6 col-xl-4 order-3 order-md-2 pt-md-5 px-5 px-md-0', - 'div class article_location_data' => 'col-12 col-md-6 col-xl-4 order-2 order-md-3', - 'span class badge_article_draft' => 'badge-danger', - 'a class badge_article_library' => 'badge-primary no_truncate', - 'span class badge_article_category' => 'badge-info', - 'span class badge_article_location' => 'badge-secondary no_truncate', - 'a class record_doctype' => 'badge-warning fs_1em', - 'a class badge_bookmarked_library' => 'badge-info', - 'a class record_edition_year' => 'badge-dark', - 'span class badge_record_date_approximate' => 'badge-dark', - 'a class record_novelty' => 'badge-secondary', - 'span class record_pro_reviews_count' => 'badge-success', - 'span class record_pro_reviews_average_score' => 'badge-success', - 'span class record_borrower_review_count' => 'badge-info', + 'div class loading_icon' => 'spinner-border', + 'div class review_author' => 'col-12 col-lg-6 text-md-left', + 'div class review_date' => 'col-12 col-lg-6 text-md-right', + 'div class card_with_overlay' => 'card text-center', + 'div class card_overlay' => 'card-block card-img-overlay rounded text-center text-white', + 'div class article_location_header' => 'col-12 order-1', + 'div class article_location_static_map' => 'col-12 col-md-6 col-xl-4 order-3 order-md-2 pt-md-5 px-5 px-md-0', + 'div class article_location_data' => 'col-12 col-md-6 col-xl-4 order-2 order-md-3', + 'span class badge_article_draft' => 'badge-danger', + 'a class badge_article_library' => 'badge-primary no_truncate', + 'span class badge_article_category' => 'badge-info', + 'span class badge_article_location' => 'badge-secondary no_truncate', + 'a class record_doctype' => 'badge-warning fs_1em', + 'a class badge_bookmarked_library' => 'badge-info', + 'a class record_edition_year' => 'badge-dark', + 'span class badge_record_date_approximate' => 'badge-dark', + 'a class record_novelty' => 'badge-secondary', + 'span class record_pro_reviews_count' => 'badge-success', + 'span class record_pro_reviews_average_score' => 'badge-success', + 'span class record_borrower_review_count' => 'badge-info', 'span class record_borrower_review_average_score' => 'badge-info', - 'a class record_facets' => 'badge-primary', - 'a class record_by_work' => 'badge-light', - 'span class item_hold_rank' => 'badge-warning', - 'span class badge_text' => 'align-middle d-inline-block text-left', - 'span class hold_ready' => 'badge-success', - 'span class hold_not_ready' => 'badge-secondary', - 'span class hold_state' => 'badge-secondary', - 'span class hold_rank' => 'badge-secondary', - 'span class hold_expiration' => 'badge-warning', - 'span class pnb_hold_date' => 'badge-info', - 'span class pnb_hold_status' => 'badge-secondary', - 'span class pnb_hold_rank' => 'badge-secondary', - 'span class by_idabon' => 'd-none', - 'span class loan_late' => 'badge-danger', - 'span class loan_issue_date' => 'badge-info', - 'span class loan_return_date' => 'badge-success', - 'span class loan_return_date_late' => 'badge-danger', - 'span class unread_public_comment' => 'badge-warning', - 'span class loan_library' => 'badge-secondary', - 'span class loan_holded' => 'badge-warning', - 'span class loan_renewed' => 'badge-info', - 'div class review_rating' => 'col-12', - 'div class review_title' => 'col-12', - 'div class score_rating' => 'col-12 col-lg-6 text-md-left', - 'div class score_date' => 'col-12 col-lg-5 text-md-right', - 'div class loans_list' => 'col-12', - 'div class numerical_loans_list' => 'col-12 mt-5', - 'div class historical_loans_list' => 'col-12 mt-5', - 'a class clear_history_button' => 'btn btn-sm btn-warning', - 'a class disable_all_newsletters' => 'btn btn-sm', - 'form class user_configuration_form' => 'form row no-gutters', - 'a class manage_activities_button' => 'btn btn-sm btn-success menu_admin_front_anchor', - 'input class zendafi_form_review_review_submit' => 'ml-auto mr-auto mt-3', - 'button class accordion_button' => 'btn btn-link', - 'div class collection_actions' => 'col-12', - 'div class collection_truncate_list' => 'col-12', - 'div class websites_list_title' => 'col-12', - 'div class websites_list_content' => 'col-12', - 'div class library_horaire' => 'col-12', - 'div class library_opening' => 'col-12', - 'div class library_opening_hours' => 'col-12 d-none', - 'div class menu_with_carousel_layout' => 'overflow-visible', - 'div class record_no_thumbnail' => 'card card-img-overlay', - 'a class account_link' => 'btn btn-sm btn-primary', - 'a class account_disconnect' => 'btn btn-sm btn-secondary', - 'span class user_notifications' => 'btn btn-sm list-group-item-danger', - 'div class babeltheque_reviews' => 'mt-3 mb-3', - 'span class truncate_list_size' => 'btn btn-sm btn-info', - 'div class truncate_list_size_wrapper' => 'col-12 col-sm-3', - 'div class truncate_list_form_wrapper' => 'col-12 col-sm-9', - 'div class truncate_list_container' => 'my-2', - 'div class truncate_list_row' => 'justify-content-start', - 'div class truncate_list_wrapper' => 'col-12 list-group bg-transparent no_border', - 'div class truncate_list_top_tools' => 'col-12', - 'div class truncate_list_bottom_tools' => 'col-12 d-none', - 'span class highlight' => 'font-weight-bold text_decoration_underline', - 'span class more_description_data_title' => 'font-italic', - 'span class facet_title' => 'font-weight-bold', - 'span class selection_date_maj' => 'badge-warning', - 'span class selection_count_records' => 'badge-info', - 'div class items_map' => 'col-12 mb-3', - 'div class items_wall' => 'col-12', - 'div class same_work_items' => 'col-12 mt-3', - 'div class same_work_items_collection' => 'col-12', - 'div class paginated_collection' => 'col-12 mt-3 list-group bg-transparent no_border', - 'a class loans_renew_all' => 'btn btn-sm btn-success', - 'a class loans_export_barcodes' => 'btn btn-sm btn-success', - 'a class loans_export_unimarc' => 'btn btn-sm btn-success', - 'a class loans_export_csv' => 'btn btn-sm btn-success', - 'div class paginated_secondary_collection' => 'col-12 mt-3 list-group bg-transparent no_border', - 'div class ajax_paginated_collection' => 'col-12', - 'div class paginated_collection_pager' => 'col', - 'div class library_details_attribut' => 'col-12', - 'div class library_details_custom_field' => 'col-12', - 'div class record_serials_articles' => 'articles', - 'div class record_serials_articles_title' => 'col-12 d-none', - 'div class record_serials_articles_list' => 'col-12 ', - 'span class danger' => 'badge-danger text-light', - 'span class success' => 'badge-success text-light', - 'span class warning' => 'badge-warning text-dark', - 'a class browse_shelf' => 'badge-secondary', - 'div class items_shelf' => 'col-12', - 'div class title_sibling_picto' => 'd-inline-block', - 'h3 class tracks_source' => 'd-none', - 'div class ina_interviews' => 'card bg-dark text-white shadow', - 'span class record_not_available' => 'badge-danger', - 'span class record_available' => 'badge-success', - 'span class availability_no_answers' => 'badge-info', - 'div class card_footer' => 'card-footer row mx-1 px-3 justify-content-between', - 'div class extra_actions' => 'col-12 row justify-content-around mx-0 px-0 mb-2', - 'div class card_body' => 'card-body pb-1', - 'div class payfip_borrower_widget' => 'col-12 mt-3', - 'div class form_row_as_table' => 'row col-12 no-gutters m-0 p-0 py-2 border-top', - 'h3 class card_title' => 'card-title', - 'span class badge_section' => 'badge-info', - 'span class badge_retour' => 'badge-warning', - 'span class badge_emplacement' => 'badge-secondary', - 'span class badge_cote' => 'badge-secondary', - 'a class badge_data_item' => 'badge-secondary', - 'span class badge_data_item' => 'badge-secondary', - 'span class session_date_debut' => 'badge-info', - 'span class session_date_fin' => 'badge-dark', - 'span class session_horaires' => 'badge-warning', - 'span class session_duree' => 'badge-warning', - 'span class session_attendees' => 'badge-secondary', - 'span class session_lieu' => 'badge-primary', - 'a class session_lieu' => 'badge-primary', - 'span class session_intervenant' => 'badge-secondary', - 'span class session_expired' => 'badge-danger', - 'span class session_canceled' => 'badge-danger', - 'span class session_full' => 'badge-danger', - 'span class session_has_queue' => 'badge-danger', - 'span class custom_field_actitivy_session' => 'badge-light', - 'span class session_registration_warning' => 'badge-warning', - 'span class session_registration_success' => 'badge-success', - 'a class social_network_link' => ' py-1 my-1 d-block', + 'a class record_facets' => 'badge-primary', + 'a class record_by_work' => 'badge-light', + 'span class item_hold_rank' => 'badge-warning', + 'span class badge_text' => 'align-middle d-inline-block text-left', + 'span class hold_ready' => 'badge-success', + 'span class hold_not_ready' => 'badge-secondary', + 'span class hold_state' => 'badge-secondary', + 'span class hold_rank' => 'badge-secondary', + 'span class hold_expiration' => 'badge-warning', + 'span class pnb_hold_date' => 'badge-info', + 'span class pnb_hold_status' => 'badge-secondary', + 'span class pnb_hold_rank' => 'badge-secondary', + 'span class by_idabon' => 'd-none', + 'span class loan_late' => 'badge-danger', + 'span class loan_issue_date' => 'badge-info', + 'span class loan_return_date' => 'badge-success', + 'span class loan_return_date_late' => 'badge-danger', + 'span class unread_public_comment' => 'badge-warning', + 'span class loan_library' => 'badge-secondary', + 'span class loan_holded' => 'badge-warning', + 'span class loan_renewed' => 'badge-info', + 'div class review_rating' => 'col-12', + 'div class review_title' => 'col-12', + 'div class score_rating' => 'col-12 col-lg-6 text-md-left', + 'div class score_date' => 'col-12 col-lg-5 text-md-right', + 'div class loans_list' => 'col-12', + 'div class numerical_loans_list' => 'col-12 mt-5', + 'div class historical_loans_list' => 'col-12 mt-5', + 'a class clear_history_button' => 'btn btn-sm btn-warning', + 'a class disable_all_newsletters' => 'btn btn-sm', + 'form class user_configuration_form' => 'form row no-gutters', + 'a class manage_activities_button' => 'btn btn-sm btn-success menu_admin_front_anchor', + 'input class zendafi_form_review_review_submit' => 'ml-auto mr-auto mt-3', + 'button class accordion_button' => 'btn btn-link', + 'div class collection_actions' => 'col-12', + 'div class collection_truncate_list' => 'col-12', + 'div class websites_list_title' => 'col-12', + 'div class websites_list_content' => 'col-12', + 'div class library_horaire' => 'col-12', + 'div class library_opening' => 'col-12', + 'div class library_opening_hours' => 'col-12 d-none', + 'div class menu_with_carousel_layout' => 'overflow-visible', + 'div class record_no_thumbnail' => 'card card-img-overlay', + 'a class account_link' => 'btn btn-sm btn-primary', + 'a class account_disconnect' => 'btn btn-sm btn-secondary', + 'span class user_notifications' => 'btn btn-sm list-group-item-danger', + 'div class babeltheque_reviews' => 'mt-3 mb-3', + 'span class truncate_list_size' => 'btn btn-sm btn-info', + 'div class truncate_list_size_wrapper' => 'col-12 col-sm-3', + 'div class truncate_list_form_wrapper' => 'col-12 col-sm-9', + 'div class truncate_list_container' => 'my-2', + 'div class truncate_list_row' => 'justify-content-start', + 'div class truncate_list_wrapper' => 'col-12 list-group bg-transparent no_border', + 'div class truncate_list_top_tools' => 'col-12', + 'div class truncate_list_bottom_tools' => 'col-12 d-none', + 'span class highlight' => 'font-weight-bold text_decoration_underline', + 'span class more_description_data_title' => 'font-italic', + 'span class facet_title' => 'font-weight-bold', + 'span class selection_date_maj' => 'badge-warning', + 'span class selection_count_records' => 'badge-info', + 'div class items_map' => 'col-12 mb-3', + 'div class items_wall' => 'col-12', + 'div class same_work_items' => 'col-12 mt-3', + 'div class same_work_items_collection' => 'col-12', + 'div class paginated_collection' => 'col-12 mt-3 list-group bg-transparent no_border', + 'a class loans_renew_all' => 'btn btn-sm btn-success', + 'a class loans_export_barcodes' => 'btn btn-sm btn-success', + 'a class loans_export_unimarc' => 'btn btn-sm btn-success', + 'a class loans_export_csv' => 'btn btn-sm btn-success', + 'div class paginated_secondary_collection' => 'col-12 mt-3 list-group bg-transparent no_border', + 'div class ajax_paginated_collection' => 'col-12', + 'div class paginated_collection_pager' => 'col', + 'div class library_details_attribut' => 'col-12', + 'div class library_details_custom_field' => 'col-12', + 'div class record_serials_articles' => 'articles', + 'div class record_serials_articles_title' => 'col-12 d-none', + 'div class record_serials_articles_list' => 'col-12 ', + 'span class danger' => 'badge-danger text-light', + 'span class success' => 'badge-success text-light', + 'span class warning' => 'badge-warning text-dark', + 'a class browse_shelf' => 'badge-secondary', + 'div class items_shelf' => 'col-12', + 'div class title_sibling_picto' => 'd-inline-block', + 'h3 class tracks_source' => 'd-none', + 'div class ina_interviews' => 'card bg-dark text-white shadow', + 'span class record_not_available' => 'badge-danger', + 'span class record_available' => 'badge-success', + 'span class availability_no_answers' => 'badge-info', + 'div class card_footer' => 'card-footer row mx-1 px-3 justify-content-between', + 'div class extra_actions' => 'col-12 row justify-content-around mx-0 px-0 mb-2', + 'div class card_body' => 'card-body pb-1', + 'div class payfip_borrower_widget' => 'col-12 mt-3', + 'div class form_row_as_table' => 'row col-12 no-gutters m-0 p-0 py-2 border-top', + 'h3 class card_title' => 'card-title', + 'span class badge_section' => 'badge-info', + 'span class badge_retour' => 'badge-warning', + 'span class badge_emplacement' => 'badge-secondary', + 'span class badge_cote' => 'badge-secondary', + 'a class badge_data_item' => 'badge-secondary', + 'span class badge_data_item' => 'badge-secondary', + 'span class session_date_debut' => 'badge-info', + 'span class session_date_fin' => 'badge-dark', + 'span class session_horaires' => 'badge-warning', + 'span class session_duree' => 'badge-warning', + 'span class session_attendees' => 'badge-secondary', + 'span class session_lieu' => 'badge-primary', + 'a class session_lieu' => 'badge-primary', + 'span class session_intervenant' => 'badge-secondary', + 'span class session_expired' => 'badge-danger', + 'span class session_canceled' => 'badge-danger', + 'span class session_full' => 'badge-danger', + 'span class session_has_queue' => 'badge-danger', + 'span class custom_field_actitivy_session' => 'badge-light', + 'span class session_registration_warning' => 'badge-warning', + 'span class session_registration_success' => 'badge-success', + 'a class social_network_link' => ' py-1 my-1 d-block', 'input class submit_preregistration' => 'mx-auto', - 'div class renderform_login_username' => 'col-12', + 'div class renderform_login_username' => 'col-12', 'div class renderinlineform_login_username' => 'col', - - 'div class renderform_login_password' => 'col-12', + 'div class renderform_login_password' => 'col-12', 'div class renderinlineform_login_password' => 'col', - 'div class renderform_login_lostpass' => 'col-12', + 'div class renderform_login_lostpass' => 'col-12', 'div class renderinlineform_login_lostpass' => 'col', - 'div class renderform_login_preregistrationlink' => 'col-12', + 'div class renderform_login_preregistrationlink' => 'col-12', 'div class renderinlineform_login_preregistrationlink' => 'col', - 'div class renderform_login_register' => 'col-12', + 'div class renderform_login_register' => 'col-12', 'div class renderinlineform_login_register' => 'col', - 'div class form_element_wrapper' => 'col-12 col-sm align-self-center', - 'div class default_form_group' => 'form-group container-fluid no-gutters py-1', - 'div class label_html_tag' => 'row justify-content-between no-gutters', - 'form class default_form' => 'row', - 'div class row_input_group' => 'row input-group mb-2', - 'div class col_inline_form' => 'col row form-group no-gutters', - 'div class stacked_label_html_tag' => 'justify-content-between no-gutters', - 'div class inline_form_fieldset' => 'col form-row align-items-center justify-content-center', + 'div class form_element_wrapper' => 'col-12 col-sm align-self-center', + 'div class default_form_group' => 'form-group container-fluid no-gutters py-1', + 'div class label_html_tag' => 'row justify-content-between no-gutters', + 'form class default_form' => 'row', + 'div class row_input_group' => 'row input-group mb-2', + 'div class col_inline_form' => 'col row form-group no-gutters', + 'div class stacked_label_html_tag' => 'justify-content-between no-gutters', + 'div class inline_form_fieldset' => 'col form-row align-items-center justify-content-center', 'input class renderform_review_reviewsubmit' => 'mx-auto mt-3', - 'div class page_with_form' => 'col-11 col-lg-10', - 'div class html_criteria' => 'd-inline-block align-items-start', - + 'div class page_with_form' => 'col-11 col-lg-10', + 'div class html_criteria' => 'd-inline-block align-items-start', + 'div class left_highlight_column' => 'col-12 col-md-4 col-lg-5 rounded', + 'div class top_highlight_column' => 'col-12 rounded', + 'div class left_carousel_columns' => 'col-12 col-md-8 col-lg-7', + 'div class top_carousel_columns' => 'col-12', + 'div class highlight_carousel_xl' => 'd-none d-xl-block', + 'div class highlight_carousel_md' => 'd-none d-md-block d-xl-none', + 'div class highlight_carousel_sm' => 'd-md-none', + 'div class responsive_multiple_carousel_xl' => 'col-12 d-none d-xl-block', + 'div class responsive_multiple_carousel_md' => 'col-12 d-none d-md-block d-xl-none', + 'div class responsive_multiple_carousel_xs' => 'col-12 d-block d-md-none', + 'div class responsive_carousel_md' => 'col-12 d-none d-md-block', + 'div class responsive_carousel_xs' => 'col-12 d-block d-md-none', ], 'icons_map_doc_types' => [], - 'icons_map_library' => ['author' => 'class fas fa-user', - 'search_more' => 'class fas fa-list', - 'library' => 'class fas fa-landmark', - 'history' => 'class fas fa-history', - 'available' => 'class far fa-check-circle', + 'icons_map_library' => ['author' => 'class fas fa-user', + 'search_more' => 'class fas fa-list', + 'library' => 'class fas fa-landmark', + 'history' => 'class fas fa-history', + 'available' => 'class far fa-check-circle', 'not-available' => 'class far fa-times-circle', - 'readed' => 'class fas fa-check-circle text-success', - 'unread' => 'class far fa-check-circle', - 'to_read' => 'class fas fa-bookmark text-warning', - 'to_not_read' => 'class far fa-bookmark', - 'return-date' => 'class fas fa-dolly', - 'place' => 'class fas fa-map-signs', - 'map' => 'class fas fa-map-marked-alt', - 'cote' => 'class fas fa-crosshairs', - 'hold' => 'class fas fa-thumbtack', - 'loan' => 'class fas fa-book', - 'late-loan' => 'class fas fa-book', - 'extend-loan' => 'class fas fa-calendar-plus', - 'home' => 'class fas fa-home', - 'related' => 'class fas fa-clone', - 'description' => 'class fas fa-info', - 'summary' => 'class fab fa-readme', - 'reviews' => 'class fas fa-comments', - 'ils_messages' => 'class fas fa-comments', - 'media' => 'class fas fa-images', - 'date-edition' => 'class fas fa-file-signature', - 'openings' => 'class fas fa-clock', - 'settings' => 'class fas fa-user-cog', - 'selection' => 'class fas fa-heart', - 'no-selection' => 'class far fa-heart', - 'like' => 'class fas fa-heart text-danger', - 'dislike' => 'class far fa-heart', - 'suggest' => 'class fas fa-hand-holding-heart', - 'subscription' => 'class fas fa-receipt', - 'card-number' => 'class fas fa-barcode', + 'readed' => 'class fas fa-check-circle text-success', + 'unread' => 'class far fa-check-circle', + 'to_read' => 'class fas fa-bookmark text-warning', + 'to_not_read' => 'class far fa-bookmark', + 'return-date' => 'class fas fa-dolly', + 'place' => 'class fas fa-map-signs', + 'map' => 'class fas fa-map-marked-alt', + 'cote' => 'class fas fa-crosshairs', + 'hold' => 'class fas fa-thumbtack', + 'loan' => 'class fas fa-book', + 'late-loan' => 'class fas fa-book', + 'extend-loan' => 'class fas fa-calendar-plus', + 'home' => 'class fas fa-home', + 'related' => 'class fas fa-clone', + 'description' => 'class fas fa-info', + 'summary' => 'class fab fa-readme', + 'reviews' => 'class fas fa-comments', + 'ils_messages' => 'class fas fa-comments', + 'media' => 'class fas fa-images', + 'date-edition' => 'class fas fa-file-signature', + 'openings' => 'class fas fa-clock', + 'settings' => 'class fas fa-user-cog', + 'selection' => 'class fas fa-heart', + 'no-selection' => 'class far fa-heart', + 'like' => 'class fas fa-heart text-danger', + 'dislike' => 'class far fa-heart', + 'suggest' => 'class fas fa-hand-holding-heart', + 'subscription' => 'class fas fa-receipt', + 'card-number' => 'class fas fa-barcode', 'read-document' => 'class far fa-arrow-alt-circle-right', - 'read-review' => 'class far fa-comment-dots', - 'team' => 'class fas fa-users', - 'agenda' => 'class fas fa-calendar-alt', - 'ical' => 'class far fa-calendar-plus', - 'novelty' => 'class far fa-sun', - 'editor' => 'class fas fa-home', - 'language' => 'class fas fa-globe-africa', + 'read-review' => 'class far fa-comment-dots', + 'team' => 'class fas fa-users', + 'agenda' => 'class fas fa-calendar-alt', + 'ical' => 'class far fa-calendar-plus', + 'novelty' => 'class far fa-sun', + 'editor' => 'class fas fa-home', + 'language' => 'class fas fa-globe-africa', ], 'icons_map_utils' => ['image_place_holder' => '/library/templates/Intonation/Assets/images/image_place_holder.png', - - 'osm_opened_marker' => '', - 'osm_closed_marker' => '', - 'osm_marker' => '', + 'osm_opened_marker' => '', + 'osm_closed_marker' => '', + 'osm_marker' => '', 'accessibility' => 'class fas fa-low-vision', - 'login' => 'class fas fa-sign-in-alt', - 'ban' => 'class fas fa-ban', + 'login' => 'class fas fa-sign-in-alt', + 'ban' => 'class fas fa-ban', 'previous' => 'class fas fa-chevron-left', - 'next' => 'class fas fa-chevron-right', - 'below' => 'class fas fa-chevron-down', - 'above' => 'class fas fa-chevron-up', + 'next' => 'class fas fa-chevron-right', + 'below' => 'class fas fa-chevron-down', + 'above' => 'class fas fa-chevron-up', 'list' => 'class fas fa-list', 'wall' => 'class fas fa-th', - 'clean' => 'class fas fa-eraser', - 'open' => 'class far fa-caret-square-down', - 'add' => 'class fas fa-plus-square', - 'add_user' => 'class fas fa-user-plus', + 'clean' => 'class fas fa-eraser', + 'open' => 'class far fa-caret-square-down', + 'add' => 'class fas fa-plus-square', + 'add_user' => 'class fas fa-user-plus', 'unlink_user' => 'class fas fa-user-minus', - 'delete' => 'class fas fa-minus', - 'edit' => 'class fas fa-edit', - 'check-list' => 'class fas fa-tasks', - 'rename' => 'class fas fa-edit', - 'more' => 'class fas fa-ellipsis-h', - 'refresh' => 'class fas fa-sync-alt', - 'lock' => 'class fas fa-unlock-alt', - 'eye' => 'class far fa-eye', - 'attention' => 'class fas fa-exclamation-triangle', - 'empty' => 'class fa fa-sad-tear', - 'check' => 'class fa fa-check', - - 'email' => 'class fas fa-at', - 'phone' => 'class fas fa-phone', - 'rss' => 'class fas fa-rss', - 'embed' => 'class fas fa-code', - 'export' => 'class fas fa-file-export', - 'print' => 'class fas fa-print', - 'facebook' => 'class fab fa-facebook-f', - 'x' => 'url /library/templates/Intonation/Assets/Font-Awesome/x-twitter-brands-solid.svg', - 'permalink' => 'class fas fa-link', + 'delete' => 'class fas fa-minus', + 'edit' => 'class fas fa-edit', + 'check-list' => 'class fas fa-tasks', + 'rename' => 'class fas fa-edit', + 'more' => 'class fas fa-ellipsis-h', + 'refresh' => 'class fas fa-sync-alt', + 'lock' => 'class fas fa-unlock-alt', + 'eye' => 'class far fa-eye', + 'attention' => 'class fas fa-exclamation-triangle', + 'empty' => 'class fa fa-sad-tear', + 'check' => 'class fa fa-check', + + 'email' => 'class fas fa-at', + 'phone' => 'class fas fa-phone', + 'rss' => 'class fas fa-rss', + 'embed' => 'class fas fa-code', + 'export' => 'class fas fa-file-export', + 'print' => 'class fas fa-print', + 'facebook' => 'class fab fa-facebook-f', + 'x' => 'url /library/templates/Intonation/Assets/Font-Awesome/x-twitter-brands-solid.svg', + 'permalink' => 'class fas fa-link', 'external-link' => 'class fas fa-external-link-alt', - 'tag' => 'class fas fa-tag', - 'star' => 'class fas fa-star', + 'tag' => 'class fas fa-tag', + 'star' => 'class fas fa-star', 'star-empty' => 'class far fa-star', - 'track' => 'class fas fa-music', - 'video' => 'class fas fa-video', - 'image' => 'class far fa-image', - 'play' => 'class fas fa-play', - ] + 'track' => 'class fas fa-music', + 'video' => 'class fas fa-video', + 'image' => 'class far fa-image', + 'play' => 'class fas fa-play', + ], ]; - - public function __construct(?Class_Template $template) { + public function __construct(?Class_Template $template) + { $this->_template = $template; $settings = ($settings = Class_Template_Settings::findFirstBy(['template' => $this->_template->getId()])) @@ -538,80 +545,80 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { $this->setSettings($settings); } - - public function getHtmlAttribs() { - return ['id' => 'site_web_wrapper', + public function getHtmlAttribs() + { + return ['id' => 'site_web_wrapper', 'class' => $this->_getResponsiveWidths()]; } - - protected function _injectDefaultSettings() { - $this->_settings->setTemplate($this->_template->getId()); - + public function updateSettings() + { $local_settings = $this->_settings->getSettingsInstance()->toArray(); $defaults_settings = $this->_getDefaultSettings(); - if(!array_diff_key($defaults_settings, $local_settings)) - return $this; + foreach ($defaults_settings as $key => $default) { + $data = $local_settings[$key] ?? $default; - $local_settings = array_merge($defaults_settings, - $local_settings); + $local_settings[$key] = is_array($default) + ? $this->_mergeData($default, (array) $data) + : $data; + } $this->_settings->setSettings(serialize($local_settings)); $this->_settings->save(); - $this->_settings->clearCache(); return $this; } + protected function _injectDefaultSettings() + { + $this->_settings->setTemplate($this->_template->getId()); - protected function _getDefaultSettings() { - $this->_default_settings['icons_map_doc_types'] = - [Class_TypeDoc::getLabelFor(Class_TypeDoc::UNKNOWN) => 'class far fa-question-circle', - Class_TypeDoc::getLabelFor(Class_TypeDoc::LIVRE) => 'class fas fa-book', - Class_TypeDoc::getLabelFor(Class_TypeDoc::PERIODIQUE) => 'class fas fa-newspaper', - Class_TypeDoc::getLabelFor(Class_TypeDoc::DISQUE) => 'class fas fa-compact-disc', - Class_TypeDoc::getLabelFor(Class_TypeDoc::DVD) => 'class fas fa-video', - Class_TypeDoc::getLabelFor(Class_TypeDoc::LOGICIEL) => 'class fas fa-keyboard', - Class_TypeDoc::getLabelFor(Class_TypeDoc::ARTICLE) => 'class fas fa-bullhorn', - Class_TypeDoc::getLabelFor(Class_TypeDoc::RSS) => 'class fas fa-rss-square', - Class_TypeDoc::getLabelFor(Class_TypeDoc::SITE) => 'class fas fa-link', - Class_TypeDoc::getLabelFor(Class_TypeDoc::PAGE) => 'class fas fa-pager']; - - return array_combine( - array_map(fn($name) => $this->_template->withNameSpace($name), array_keys($this->_default_settings)), - $this->_default_settings); - } - - - public function updateSettings() { $local_settings = $this->_settings->getSettingsInstance()->toArray(); $defaults_settings = $this->_getDefaultSettings(); - foreach ($defaults_settings as $key => $default) { - $data = $local_settings[$key] ?? $default; - - $local_settings[$key] = is_array($default) - ? $this->_mergeData($default, (array) $data) - : $data; - } + if (!array_diff_key($defaults_settings, $local_settings)) + return $this; + $local_settings = array_merge($defaults_settings, + $local_settings); $this->_settings->setSettings(serialize($local_settings)); $this->_settings->save(); + $this->_settings->clearCache(); + return $this; } + protected function _getDefaultSettings() + { + $this->_default_settings['icons_map_doc_types'] = + [Class_TypeDoc::getLabelFor(Class_TypeDoc::UNKNOWN) => 'class far fa-question-circle', + Class_TypeDoc::getLabelFor(Class_TypeDoc::LIVRE) => 'class fas fa-book', + Class_TypeDoc::getLabelFor(Class_TypeDoc::PERIODIQUE) => 'class fas fa-newspaper', + Class_TypeDoc::getLabelFor(Class_TypeDoc::DISQUE) => 'class fas fa-compact-disc', + Class_TypeDoc::getLabelFor(Class_TypeDoc::DVD) => 'class fas fa-video', + Class_TypeDoc::getLabelFor(Class_TypeDoc::LOGICIEL) => 'class fas fa-keyboard', + Class_TypeDoc::getLabelFor(Class_TypeDoc::ARTICLE) => 'class fas fa-bullhorn', + Class_TypeDoc::getLabelFor(Class_TypeDoc::RSS) => 'class fas fa-rss-square', + Class_TypeDoc::getLabelFor(Class_TypeDoc::SITE) => 'class fas fa-link', + Class_TypeDoc::getLabelFor(Class_TypeDoc::PAGE) => 'class fas fa-pager']; - protected function _mergeData(array $default, array $data) : array { + return array_combine( + array_map(fn($name) => $this->_template->withNameSpace($name), array_keys($this->_default_settings)), + $this->_default_settings); + } + + protected function _mergeData(array $default, array $data): array + { $merged = array_merge($default, $data); - if (array_filter(array_keys($default), 'is_string') !== []) + if ([] !== array_filter(array_keys($default), 'is_string')) return $merged; return array_values(array_unique($merged)); } - - protected function _newSettingsInstance() { + protected function _newSettingsInstance() + { return new Class_Systeme_Widget_Settings; } } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Team.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Team.php index 4fb4e05984246e713a4396e045f3d3a95a1a500b..1c556c09572e93f580f3a7080115a8e093bfb1f9 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Team.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Team.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,82 +19,78 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_Library_View_Wrapper_Library_RichContent_Team extends Intonation_Library_View_Wrapper_Library_RichContent_Section { - - public function getTitle() { +class Intonation_Library_View_Wrapper_Library_RichContent_Team extends Intonation_Library_View_Wrapper_Library_RichContent_Section +{ + public function getTitle() + { return $this->_('L\'équipe'); } - - public function getContent() { - return (new Storm_Cache()) + public function getContent() + { + return (new Storm_Cache) ->memoize(json_encode([$this->_model->getId(), Class_Profil::getCurrentProfil()->getId(), self::class, __FUNCTION__]), - fn() => $this->_renderContent()); + fn() => $this->_renderContent()); + } + + public function getClass() + { + return 'library_team'; + } + + public function getNavUrl() + { + return ['controller' => 'bib', + 'action' => 'equipe']; + } + + public function getNavIco() + { + return 'class fas fa-users'; + } + + public function getNavTitle() + { + return $this->_('L\'équipe de la bibliothèque'); } + public function handleSection() + { + return true; + } - protected function _renderContent() { + protected function _renderContent() + { $roles_level = [ZendAfi_Acl_AdminControllerRoles::MODO_BIB, ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB, ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL, ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]; - $pros = ($pros = Class_Users::findAllBy(['id_site' => $this->_model->getId(), + $pros = ($pros = Class_Users::findAllBy(['id_site' => $this->_model->getId(), 'role_level' => $roles_level])) ? $pros : Class_Users::findAllBy(['role_level' => $roles_level]); usort($pros, - fn($pro_1, $pro_2) : int - => strcasecmp($pro_1->getNomAff(), $pro_2->getNomAff())); + fn($pro_1, $pro_2): int => strcasecmp($pro_1->getNomAff(), $pro_2->getNomAff())); - $pros = array_map(function($pro) - { - $context = - ((new Intonation_Library_Widget_Carousel_NullContext) - ->setLibraryId($this->_model->getId())); + $pros = array_map(function ($pro) { + $context = + (new Intonation_Library_Widget_Carousel_NullContext) + ->setLibraryId($this->_model->getId()); - return (new Intonation_Library_View_Wrapper_Pro) - ->setModel($pro) - ->setWidgetContext($context) - ->setView($this->_view); - }, $pros); + return (new Intonation_Library_View_Wrapper_Pro) + ->setModel($pro) + ->setWidgetContext($context) + ->setView($this->_view); + }, $pros); $callback = fn($wrapped) => $this->_view->renderingVertical($wrapped); - return $this->_view->multipleCarousel(new Storm_Collection($pros), - $callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5)); - } - - - public function getClass() { - return 'library_team'; - } - - - public function getNavUrl() { - return ['controller' => 'bib', - 'action' => 'equipe']; - } - - - public function getNavIco() { - return 'class fas fa-users'; - } - - - public function getNavTitle() { - return $this->_('L\'équipe de la bibliothèque'); - } - - - public function handleSection() { - return true; + return $this->_view->responsiveCarouselPlus(new Storm_Collection($pros), + $callback); } } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Related.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Related.php index f05e77aec6155b768c4097d23d2b2dfc897546a4..7d6482bcd115cad2b3b558b4232f88b6df53faaf 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Related.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Related.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,140 +19,125 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_Library_View_Wrapper_Record_RichContent_Related - extends Intonation_Library_View_Wrapper_Record_RichContent_Section { - +class Intonation_Library_View_Wrapper_Record_RichContent_Related extends Intonation_Library_View_Wrapper_Record_RichContent_Section +{ protected $_strategy; - - public function getTitle() { + public function getTitle() + { return $this->_strategy()->getTitle(); } - - public function getContent() { + public function getContent() + { return $this->_content ?: ($this->_content = $this->_view->grid($this->_strategy() - ->getContentOf($this->_model, $this->_view))); + ->getContentOf($this->_model, $this->_view))); } - - protected function _strategy() { - if ($this->_strategy) - return $this->_strategy; - - $callback = $this->_renderElementCallback(); - - return $this->_strategy = $this->_model instanceof Class_Notice_Work - ? new Intonation_Library_View_Wrapper_Record_RichContent_RelatedForWork($callback) - : new Intonation_Library_View_Wrapper_Record_RichContent_RelatedForRecord($callback); - } - - - protected function _renderElementCallback() { - return fn($record) => - $this->_view->renderingOnlyImage((new Intonation_Library_View_Wrapper_Record) - ->setView($this->_view) - ->setModel($record)); - } - - - public function getClass() { + public function getClass() + { return 'related'; } - - public function getNavUrl() { + public function getNavUrl() + { return ['controller' => 'record', - 'action' => 'related']; + 'action' => 'related']; } - - public function getNavIco() { + public function getNavIco() + { return 'class fas fa-clone'; } - - public function getNavTitle() { + public function getNavTitle() + { return $this->_strategy()->getNavTitle(); } -} + protected function _strategy() + { + if ($this->_strategy) + return $this->_strategy; + $callback = $this->_renderElementCallback(); + return $this->_strategy = $this->_model instanceof Class_Notice_Work + ? new Intonation_Library_View_Wrapper_Record_RichContent_RelatedForWork($callback) + : new Intonation_Library_View_Wrapper_Record_RichContent_RelatedForRecord($callback); + } + protected function _renderElementCallback() + { + return fn($record) => $this->_view->renderingOnlyImage((new Intonation_Library_View_Wrapper_Record) + ->setView($this->_view) + ->setModel($record)); + } +} -class Intonation_Library_View_Wrapper_Record_RichContent_RelatedStrategy { +class Intonation_Library_View_Wrapper_Record_RichContent_RelatedStrategy +{ use Trait_Translator; protected $_callback; - public function __construct($callback) { + public function __construct($callback) + { $this->_callback = $callback; } } - - - -class Intonation_Library_View_Wrapper_Record_RichContent_RelatedForRecord - extends Intonation_Library_View_Wrapper_Record_RichContent_RelatedStrategy{ - - public function getTitle() { +class Intonation_Library_View_Wrapper_Record_RichContent_RelatedForRecord extends Intonation_Library_View_Wrapper_Record_RichContent_RelatedStrategy +{ + public function getTitle() + { return $this->_('Voir aussi'); } - - public function getNavTitle() { + public function getNavTitle() + { return $this->_('Les documents reliés'); } - - public function getContentOf($model, $view) { + public function getContentOf($model, $view) + { $html = []; if ($same_series = $model->getNoticesMemeSeries()) - $html [] = $view->div(['class' => 'col-12 mt-3 meme_serie'], - $view->tag('h3', $this->_('Les documents de la même série'), ['class' => 'card_title']) - . $view->multipleCarousel(new Storm_Collection($same_series), - $this->_callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5))); + $html[] = $view->div(['class' => 'col-12 mt-3 meme_serie'], + $view->tag('h3', $this->_('Les documents de la même série'), ['class' => 'card_title']) + . $view->responsiveCarouselPlus(new Storm_Collection($same_series), + $this->_callback)); if ($like = $model->getNoticesSimilaires()) - $html [] = $view->div(['class' => 'col-12 mt-3 similaires'], - $view->tag('h3', $this->_('Les similaires'), ['class' => 'card_title']) - . $view->multipleCarousel(new Storm_Collection($like), - $this->_callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5))); + $html[] = $view->div(['class' => 'col-12 mt-3 similaires'], + $view->tag('h3', $this->_('Les similaires'), ['class' => 'card_title']) + . $view->responsiveCarouselPlus(new Storm_Collection($like), + $this->_callback)); return implode('', $html); } } - - - -class Intonation_Library_View_Wrapper_Record_RichContent_RelatedForWork - extends Intonation_Library_View_Wrapper_Record_RichContent_RelatedStrategy { - - public function getTitle() { +class Intonation_Library_View_Wrapper_Record_RichContent_RelatedForWork extends Intonation_Library_View_Wrapper_Record_RichContent_RelatedStrategy +{ + public function getTitle() + { return $this->_('Toutes les éditions'); } - - public function getNavTitle() { + public function getNavTitle() + { return $this->getTitle(); } - - public function getContentOf($model, $view) { + public function getContentOf($model, $view) + { $html = []; if ($editions = $model->getNoticesSameWork()) - $html [] = $view->div(['class' => 'col-12 mt-3'], - $view->multipleCarousel(new Storm_Collection($editions), - $this->_callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5))); + $html[] = $view->div(['class' => 'col-12 mt-3'], + $view->responsiveCarouselPlus(new Storm_Collection($editions), + $this->_callback)); return implode('', $html); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php index f7d8458dd93e5c4b21487ec4aba0638eba76527b..05a406ee029a633159a8c528c03788da21fec082 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,61 +19,81 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonation_Library_View_Wrapper_User_RichContent_Section { - - public function getTitle() { +class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonation_Library_View_Wrapper_User_RichContent_Section +{ + public function getTitle() + { return $this->_('Mes configurations'); } - - public function getContent() { + public function getContent() + { $html = []; - $html [] = $this->_renderIdentityProviders(); + $html[] = $this->_renderIdentityProviders(); $cards = new Class_User_Cards($this->_model); $count_cards = count($cards); $parent_cards = new Storm_Collection($this->_model->getParentCards()); $count_parent_cards = $parent_cards->count(); - $html [] = $this->_div(['class' => 'col-12'], - $this->_tag('h3', $this->_plural($count_cards, - 'Aucune carte d\'abonné', - 'Ma carte d\'abonné', - 'Mes cartes d\'abonnés'))); + $html[] = $this->_div(['class' => 'col-12'], + $this->_tag('h3', $this->_plural($count_cards, + 'Aucune carte d\'abonné', + 'Ma carte d\'abonné', + 'Mes cartes d\'abonnés'))); - $html [] = $this->_div(['class' => 'col-12'], - $this->_renderCards($cards)); + $html[] = $this->_div(['class' => 'col-12'], + $this->_renderCards($cards)); if ($count_parent_cards) { - $html [] = $this->_div(['class' => 'col-12'], - $this->_tag('h3', $this->_plural($count_parent_cards, - '', - 'Il gère mes prêts et mes réservations', - 'Ils gèrent mes prêts et mes réservations'))); - $html [] = $this->_div(['class' => 'col-12'], - $this->_renderParentCards($parent_cards)); + $html[] = $this->_div(['class' => 'col-12'], + $this->_tag('h3', $this->_plural($count_parent_cards, + '', + 'Il gère mes prêts et mes réservations', + 'Ils gèrent mes prêts et mes réservations'))); + $html[] = $this->_div(['class' => 'col-12'], + $this->_renderParentCards($parent_cards)); } - $html [] = $this->_div(['class' => 'col-12 mt-5'], - $this->_tag('h3', $this->_('Mes paramètres'))); + $html[] = $this->_div(['class' => 'col-12 mt-5'], + $this->_tag('h3', $this->_('Mes paramètres'))); - $html [] = $this->_div(['class' => 'col-12'], - $this->_renderEditionLink()); + $html[] = $this->_div(['class' => 'col-12'], + $this->_renderEditionLink()); - $html [] = $this->_div(['class' => 'col-12'], - $this->_renderSettingsForm()); + $html[] = $this->_div(['class' => 'col-12'], + $this->_renderSettingsForm()); return $this->_grid(implode('', $html)); } + public function getClass() + { + return 'user_settings'; + } + + public function getNavUrl() + { + return ['controller' => 'abonne', + 'action' => 'configurations']; + } + + public function getNavIco() + { + return 'class fas fa-user-cog'; + } + + public function getNavTitle() + { + return $this->_('Mes configurations'); + } - protected function _renderCards($cards) { + protected function _renderCards($cards) + { $link = (new Intonation_Library_Link) ->setUrl($this->_view->url(['controller' => 'abonne', - 'action' => 'add-card'])) + 'action' => 'add-card'])) ->setText($this->_('Ajouter une carte')) ->setImage($this->_view->templateIco('add_user', 'utils')) ->setClass('btn btn-sm btn-success') @@ -80,24 +101,23 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati ->setPopup(true); $html = [$this->_div(['class' => 'col-12'], - $this->_view->tagAction($link))]; + $this->_view->tagAction($link))]; if (!$cards->isEmpty()) - $html [] = $this->_div(['class' => 'mt-3 col-12'], - $this->_renderCardsCarousel($cards, - 'Intonation_Library_View_Wrapper_Card')); + $html[] = $this->_div(['class' => 'mt-3 col-12'], + $this->_renderCardsCarousel($cards, + 'Intonation_Library_View_Wrapper_Card')); return $this->_grid(implode('', $html)); } - - protected function _renderEditionLink() : string { + protected function _renderEditionLink(): string + { if (Class_AdminVar::get('INTERDIRE_MODIF_FICHE_ABONNE')) return ''; - $link = (new Intonation_Library_Link) ->setUrl($this->_view->url(['controller' => 'abonne', - 'action' => 'modifier'])) + 'action' => 'modifier'])) ->setImage($this->_view->templateIco('edit', 'utils')) ->setText($this->_('Modifier mes informations')) ->setTitle($this->_('Modifier les informations me concernant')) @@ -105,34 +125,34 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati ->alwaysDisplayText(); $html = [$this->_div(['class' => 'col-12'], - $this->_view->tagAction($link))]; + $this->_view->tagAction($link))]; return $this->_grid(implode('', $html)); } - - protected function _renderParentCards($cards) { + protected function _renderParentCards($cards) + { $html = $this->_div(['class' => 'col-12'], - $this->_renderCardsCarousel($cards, - 'Intonation_Library_View_Wrapper_ParentCard')); + $this->_renderCardsCarousel($cards, + 'Intonation_Library_View_Wrapper_ParentCard')); return $this->_grid($html); } - - protected function _renderCardsCarousel($cards, $wrapper_class) { + protected function _renderCardsCarousel($cards, $wrapper_class) + { $cards = array_map(fn($card) => (new $wrapper_class) - ->setModel($card) - ->setView($this->_view), $cards->getArrayCopy()); + ->setModel($card) + ->setView($this->_view), $cards->getArrayCopy()); $callback = fn($wrapped) => $this->_view->renderingVertical($wrapped); - return $this->_view->multipleCarousel(new Storm_Collection($cards), $callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5)); + return $this->_view->responsiveCarouselPlus(new Storm_Collection($cards), + $callback); } - - protected function _renderSettingsForm() { + protected function _renderSettingsForm() + { $form = ZendAfi_Form_User_Settings::forUser($this->_model); if ($domain_ids = $form->getElement(Class_User_Setting::BOOKMARKED_DOMAINS)) @@ -145,7 +165,7 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati $popup_features->setLabel($this->_('Masquer la fenêtre des nouvelles fonctionnalités')); $form->setAction($this->_view->url(['controller' => 'abonne', - 'action' => 'manage-preferences'])); + 'action' => 'manage-preferences'])); $form->setAttrib('class', 'user_configuration_form'); @@ -155,38 +175,16 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati return $this->_view->renderForm($form); } - - protected function _renderIdentityProviders() { + protected function _renderIdentityProviders() + { if (!Class_AdminVar::isIdentityProvidersEnabled()) return ''; - $identities = Class_User_Identity::findIdentitiesForActiveProviders($this->_model); $description = new Class_TableDescription_IdentityProviders('active_identities'); $table = $this->_view->renderTable($description, $identities); return $this->_div(['class' => 'col-12'], - $this->_tag('h3', $this->_('Fournisseur(s) d\'identité associé(s)')) - . $table); - } - - - public function getClass() { - return 'user_settings'; - } - - - public function getNavUrl() { - return ['controller' => 'abonne', - 'action' => 'configurations']; - } - - - public function getNavIco() { - return 'class fas fa-user-cog'; - } - - - public function getNavTitle() { - return $this->_('Mes configurations'); + $this->_tag('h3', $this->_('Fournisseur(s) d\'identité associé(s)')) + . $table); } } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Definition.php index 6aecd08b8afb99b0e639725ff2bf064b4e966c8c..7d2a123cce8a4b98ef36b86c41fec05d6fa1a7b9 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Definition.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved. * @@ -18,94 +19,93 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_Library_Widget_Carousel_Definition extends Class_Systeme_ModulesAccueil_Null { - - const - ACCORDION_CAROUSEL = 'accordion', - WALL = 'wall', - CAROUSEL = 'carousel', - GRID = 'grid', - MAP = 'map', - HORIZONTAL_LISTING = 'horizontal_list', - LISTING = 'list', - LISTING_WITH_OPTIONS = 'list_with_options', - MULTIPLE_CAROUSEL = 'multiple_carousel', - MULTIPLE_CAROUSEL_PLUS = 'multiple_carousel_plus', - CALENDAR = 'calendar', - TIMELINE = 'timeline', - TABLE = 'table', - - CARD_OVERLAY = 'card-overlay', - CARD_DESCRIPTION = 'card-description', - HORIZONTAL_CARD = 'card-horizontal', - CARD = 'card', - PAGE = 'page', - - LIMIT_SIZE = 1000; - - - protected - $_isPhone = false, - $_layouts_list_cache; - - - public function __construct() { - $this->_defaultValues = ['layout' => static::WALL, - 'rendering' => static::CARD_OVERLAY, - 'size' => 9, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'all_layout' => static::LISTING, - 'all_rendering' => static::HORIZONTAL_CARD, +class Intonation_Library_Widget_Carousel_Definition extends Class_Systeme_ModulesAccueil_Null +{ + public const ACCORDION_CAROUSEL = 'accordion'; + public const WALL = 'wall'; + public const CAROUSEL = 'carousel'; + public const GRID = 'grid'; + public const MAP = 'map'; + public const HORIZONTAL_LISTING = 'horizontal_list'; + public const LISTING = 'list'; + public const LISTING_WITH_OPTIONS = 'list_with_options'; + public const MULTIPLE_CAROUSEL = 'multiple_carousel'; + public const MULTIPLE_CAROUSEL_PLUS = 'multiple_carousel_plus'; + public const CALENDAR = 'calendar'; + public const TIMELINE = 'timeline'; + public const TABLE = 'table'; + public const TOP_HIGHLIGHT_CAROUSEL = 'top_highlight_carousel'; + public const LEFT_HIGHLIGHT_CAROUSEL = 'left_highlight_carousel'; + public const CARD_OVERLAY = 'card-overlay'; + public const CARD_DESCRIPTION = 'card-description'; + public const HORIZONTAL_CARD = 'card-horizontal'; + public const CARD = 'card'; + public const PAGE = 'page'; + public const LIMIT_SIZE = 1000; + + protected $_isPhone = false; + protected $_layouts_list_cache; + + public function __construct() + { + $this->_defaultValues = ['layout' => static::WALL, + 'rendering' => static::CARD_OVERLAY, + 'size' => 9, + 'rss' => false, + 'embeded_code' => false, + 'link_to_all' => false, + 'all_layout' => static::LISTING, + 'all_rendering' => static::HORIZONTAL_CARD, 'description_length' => 20, - 'geo_fields' => '123-f-d;941-d-f' + 'geo_fields' => '123-f-d;941-d-f', ]; } - - public function getOrderedLayouts($layouts) { + public function getOrderedLayouts($layouts) + { asort($layouts, SORT_NATURAL | SORT_FLAG_CASE); + return $layouts; } - - public function getLayoutsList() { - if ( $this->_layouts_list_cache) + public function getLayoutsList(): array + { + if ($this->_layouts_list_cache) return $this->_layouts_list_cache; return $this->_layouts_list_cache = - array_merge([static::ACCORDION_CAROUSEL => $this->_('Accordéon'), - static::CAROUSEL => $this->_('Carrousel à 1 colonne'), - static::MULTIPLE_CAROUSEL => $this->_('Carrousel à 3 colonnes'), - static::MULTIPLE_CAROUSEL_PLUS => $this->_('Carrousel à 5 colonnes'), - static::TIMELINE => $this->_('Frise chronologique'), - static::GRID => $this->_('Grille'), - static::HORIZONTAL_LISTING => $this->_('Liste horizontale'), - static::LISTING => $this->_('Liste verticale'), - static::LISTING_WITH_OPTIONS => $this->_('Liste verticale à interactions'), - static::WALL => $this->_('Mur'), - static::MAP => $this->_('Carte géographique'), - static::TABLE => $this->_('Tableau'),], - Class_Template::current()->getCarouselLayouts()); + array_merge([static::ACCORDION_CAROUSEL => $this->_('Accordéon'), + static::MAP => $this->_('Carte géographique'), + static::CAROUSEL => $this->_('Carrousel à 1 colonne'), + static::MULTIPLE_CAROUSEL => $this->_('Carrousel à 3 colonnes'), + static::MULTIPLE_CAROUSEL_PLUS => $this->_('Carrousel à 5 colonnes'), + static::TIMELINE => $this->_('Frise chronologique'), + static::GRID => $this->_('Grille'), + static::HORIZONTAL_LISTING => $this->_('Liste horizontale'), + static::LISTING => $this->_('Liste verticale'), + static::LISTING_WITH_OPTIONS => $this->_('Liste verticale à interactions'), + static::WALL => $this->_('Mur'), + static::TABLE => $this->_('Tableau'), + static::TOP_HIGHLIGHT_CAROUSEL => $this->_('Carousel avec mise en avant au dessus'), + static::LEFT_HIGHLIGHT_CAROUSEL => $this->_('Carousel avec mise en avant à gauche'), + ], + Class_Template::current()->getCarouselLayouts()); } - - public function getLayoutTitle(string $layout_key) : string { + public function getLayoutTitle(string $layout_key): string + { return $this->getLayoutsList()[$layout_key] ?? ''; } - - public function getLayouts() { + public function getLayouts(): array + { return $this->getOrderedLayouts($this->getLayoutsList()); } - - public function getCarouselLayouts() { + public function getCarouselLayouts(): array + { return array_filter($this->getLayouts(), - fn($key) => false !== strpos($key, 'carousel'), - ARRAY_FILTER_USE_KEY); + fn($key) => false !== strpos($key, 'carousel'), + ARRAY_FILTER_USE_KEY); } } diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index 001cd45d735fdd4335a01713dd6732b843571c0f..46a17c2823856b57e08b4ea04ff43946edde8502 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved. * @@ -18,31 +19,31 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Helper_Accueil_Base { - +abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Helper_Accueil_Base +{ protected $_template_context; protected static $_helper_by_layout = - [Intonation_Library_Widget_Carousel_Definition::WALL => ZendAfi_View_Helper_Template_Wall::class, - Intonation_Library_Widget_Carousel_Definition::CAROUSEL => ZendAfi_View_Helper_Template_LayoutCarousel::class, - Intonation_Library_Widget_Carousel_Definition::LISTING => ZendAfi_View_Helper_Template_ListGroup::class, - Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS => ZendAfi_View_Helper_Template_TruncateList::class, - Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_LISTING => ZendAfi_View_Helper_Template_CardDeck::class, - Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL => ZendAfi_View_Helper_Template_MultipleCarousel::class, - Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS => ZendAfi_View_Helper_Template_MultipleCarousel::class, - Intonation_Library_Widget_Carousel_Definition::GRID => ZendAfi_View_Helper_Template_WallGrid::class, - Intonation_Library_Widget_Carousel_Definition::MAP => ZendAfi_View_Helper_Template_LayoutOsmMap::class, - Intonation_Library_Widget_Carousel_Definition::ACCORDION_CAROUSEL => ZendAfi_View_Helper_Template_LayoutAccordion::class, - Intonation_Library_Widget_Carousel_Definition::TIMELINE => ZendAfi_View_Helper_Template_Timeline::class, - Intonation_Library_Widget_Carousel_Definition::TABLE => ZendAfi_View_Helper_Template_LayoutTable::class]; - + [Intonation_Library_Widget_Carousel_Definition::WALL => ZendAfi_View_Helper_Template_Wall::class, + Intonation_Library_Widget_Carousel_Definition::CAROUSEL => ZendAfi_View_Helper_Template_LayoutCarousel::class, + Intonation_Library_Widget_Carousel_Definition::LISTING => ZendAfi_View_Helper_Template_ListGroup::class, + Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS => ZendAfi_View_Helper_Template_TruncateList::class, + Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_LISTING => ZendAfi_View_Helper_Template_CardDeck::class, + Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL => ZendAfi_View_Helper_Template_ResponsiveCarousel::class, + Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS => ZendAfi_View_Helper_Template_ResponsiveCarouselPlus::class, + Intonation_Library_Widget_Carousel_Definition::GRID => ZendAfi_View_Helper_Template_WallGrid::class, + Intonation_Library_Widget_Carousel_Definition::MAP => ZendAfi_View_Helper_Template_LayoutOsmMap::class, + Intonation_Library_Widget_Carousel_Definition::ACCORDION_CAROUSEL => ZendAfi_View_Helper_Template_LayoutAccordion::class, + Intonation_Library_Widget_Carousel_Definition::TIMELINE => ZendAfi_View_Helper_Template_Timeline::class, + Intonation_Library_Widget_Carousel_Definition::TABLE => ZendAfi_View_Helper_Template_LayoutTable::class, + Intonation_Library_Widget_Carousel_Definition::TOP_HIGHLIGHT_CAROUSEL => ZendAfi_View_Helper_Template_RenderTopHighlightCarousel::class, + Intonation_Library_Widget_Carousel_Definition::LEFT_HIGHLIGHT_CAROUSEL => ZendAfi_View_Helper_Template_RenderLeftHighlightCarousel::class, +]; protected $_layout_helper; - - public function __sleep() { + public function __sleep() + { return ['titre', 'contenu', 'id_module', @@ -51,38 +52,31 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help '_template_context']; } - - public function getCacheKey() { + public function getCacheKey() + { return json_encode([$this->id_module, Class_Profil::getCurrentProfil()->getId(), $this->getLocale(), $this->preferences['preferences']], JSON_PARTIAL_OUTPUT_ON_ERROR); } - - public function getHtml() { + public function getHtml() + { $this->titre = $this->_getMainTitle(); $this->contenu = $this->_getHTML(); return $this->getHtmlArray(); } - - public function shouldCacheContent() : bool { + public function shouldCacheContent(): bool + { return $this->_isDelayed() ? false : parent::shouldCacheContent(); } - - protected function _renderHeadScriptsOn( Class_ScriptLoader $script_loader) : self { - $this->_getLayoutHelper((string) $this->_settings->getLayout()) - ->renderHeadScriptsOn($script_loader); - return $this; - } - - - public function getFooter() : string { + public function getFooter(): string + { $rss = $this->_settings->getRss() ? $this->_getTagRss() : ''; @@ -91,7 +85,6 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help ? $this->_getTagEmbededCode() : ''; - $link_to_all = $this->_settings->getLinkToAll() ? $this->_getTagLinkToAll() : ''; @@ -100,61 +93,139 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help $embeded, $link_to_all]); - if ($html === []) + if ([] === $html) return ''; return $this->_tag('div', - implode('', $html), - ['class' => 'btn-group', - 'role' => 'group']); + implode('', $html), + ['class' => 'btn-group', + 'role' => 'group']); + } + + public function getBodyHTML(): string + { + if ($elements = $this->_findElements()) + return $this->_renderElements($elements); + + return $this->_settings->isHideWhenEmpty() + ? '' + : $this->_emptyListMessage(); } + public static function hashArray(array $data): string + { + return md5(serialize($data)); + } - protected function _getTagRss() : string { - return $this->view->tagAnchor( - $this->_getRSSUrl(), - $this->view - ->templateIco('rss', - 'utils'), - ['class' => 'flux-rss', - 'type' => 'application/rss+xml', - 'title' => $this->_('Flux RSS de la boite "%s"', - $this->_settings->getTitre()) ]); + public function getLinkToAllContent() + { + $this->view->titre = $this->_settings->getTitre(); + + $this->_settings->setSize(Intonation_Library_Widget_Carousel_Definition::LIMIT_SIZE); + if (isset($this->preferences['size'])) + $this->preferences['size'] = Intonation_Library_Widget_Carousel_Definition::LIMIT_SIZE; + + if (!$elements = $this->_findElements()) + return $this->_emptyListMessage(); + + return $this->_renderLayout($this->_settings->getAllLayout(), + $this->_wrapElements($elements), + $this->_getContentCallback($this->_settings->getAllRendering())); + } + + public function getLinkToAllParams() + { + return []; } + public function getHandleLinkToAll() + { + return true; + } + + public function findElements() + { + return $this->_findElements(); + } + + public function getAvailableOrders() + { + return ($template_context = $this->getTemplateContext()) + ? $template_context->getAvailableOrders() + : []; + } + + public function newCollectionWith($order) + { + $this->_settings->setOrder($order); + + return new Storm_Collection($this->_sliceElements($this->_findElements())); + } + + public function isLayoutCarousel(string $layout = ''): bool + { + $layout = $layout ?: $this->_settings->getLayout(); + + return + array_key_exists($layout, + (new Intonation_Library_Widget_Carousel_Definition)->getCarouselLayouts()); + } - protected function _getTagEmbededCode() { + protected function _renderHeadScriptsOn(Class_ScriptLoader $script_loader): self + { + $this->_getLayoutHelper((string) $this->_settings->getLayout()) + ->renderHeadScriptsOn($script_loader); + + return $this; + } + + protected function _getTagRss(): string + { + return $this->view->tagAnchor( + $this->_getRSSUrl(), + $this->view + ->templateIco('rss', + 'utils'), + ['class' => 'flux-rss', + 'type' => 'application/rss+xml', + 'title' => $this->_('Flux RSS de la boite "%s"', + $this->_settings->getTitre()) ]); + } + + protected function _getTagEmbededCode() + { $id = 'dropdown_embed_' . $this->getId(); + return $this->_tag('div', - $this->_tag('button', - $this->view->templateIco('embed', 'utils'), - ['class' => 'dropdown-toggle', - 'title' => $this->_('Code IFRAME à copier coller'), - 'id' => $id, - 'data-toggle' => 'dropdown', - 'aria-haspopup' => 'true', - 'aria-expanded' => 'false']) - . $this->_tag('div', - $this->view->tagPre($this->_tag('iframe', - '', - ['src' => $this->view->absoluteUrl([ - 'module' => 'opac', - 'controller' => 'widget', - 'action' => 'render', - 'widget_id' => $this->getId(), - 'profile_id' => Class_Profil::getCurrentProfil()->getId(), - 'anchor_target' => '_blank',], - null, - true)]), - ['class' => 'text-monospace embeded_code']), - ['class' => 'dropdown-menu', - 'aria-labelledby' => $id]), - ['class' => 'btn-group', - 'role' => 'group']); - } - - - protected function _getTagLinkToAll() { + $this->_tag('button', + $this->view->templateIco('embed', 'utils'), + ['class' => 'dropdown-toggle', + 'title' => $this->_('Code IFRAME à copier coller'), + 'id' => $id, + 'data-toggle' => 'dropdown', + 'aria-haspopup' => 'true', + 'aria-expanded' => 'false']) + . $this->_tag('div', + $this->view->tagPre($this->_tag('iframe', + '', + ['src' => $this->view->absoluteUrl([ + 'module' => 'opac', + 'controller' => 'widget', + 'action' => 'render', + 'widget_id' => $this->getId(), + 'profile_id' => Class_Profil::getCurrentProfil()->getId(), + 'anchor_target' => '_blank', ], + null, + true)]), + ['class' => 'text-monospace embeded_code']), + ['class' => 'dropdown-menu', + 'aria-labelledby' => $id]), + ['class' => 'btn-group', + 'role' => 'group']); + } + + protected function _getTagLinkToAll() + { return $this->view ->tagAction((new Intonation_Library_Link) ->setUrl($this->_getLinkToAllUrl()) @@ -165,66 +236,58 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help ->setOnlyClasses('btn btn-secondary render_all_link')); } - - protected function _getLinkToAllText() { + protected function _getLinkToAllText() + { $text = $this->_settings->getLinkToAllText(); + return $text ?: $this->_('En lire plus'); } - - protected function _getLinkToAllTitleDb() { + protected function _getLinkToAllTitleDb() + { $title = $this->_settings->getLinkToAllTitle(); + return $title ? sprintf($title, $this->titre) : $this->_getLinkToAllTitle(); } - - protected function _getMainTitle() { - if ( ! $use_url = $this->_settings->getLinkToAllToMainTitle()) + protected function _getMainTitle() + { + if (!$use_url = $this->_settings->getLinkToAllToMainTitle()) return $this->_settings->getTitre(); return $this->view->tagAnchor($this->_getLinkToAllUrl(), - $this->_settings->getTitre()); + $this->_settings->getTitre()); } - - protected function _getHTML() { + protected function _getHTML() + { return $this->_isDelayed() ? $this->_renderDelayed() : $this->getBodyHTML(); } - - public function getBodyHTML() : string { - if ($elements = $this->_findElements()) - return $this->_renderElements($elements); - - return $this->_settings->isHideWhenEmpty() - ? '' - : $this->_emptyListMessage(); - } - - - protected function _isDelayed() : bool { + protected function _isDelayed(): bool + { return $this->_settings->isDelayed(); } - - protected function _renderDelayed () : string { + protected function _renderDelayed(): string + { return $this->view->loadingIcon() . $this->view->delayedLoad('widget', - 'render', - ['render' => 'ajax', - 'only' => 'body', - 'widget_id' => $this->getId(), - 'profile_id' => Class_Profil::getCurrentProfil()->getId()], - sprintf('$("#boite_%s").find(".loading_icon_wrapper").remove();', - $this->getIdModule())); + 'render', + ['render' => 'ajax', + 'only' => 'body', + 'widget_id' => $this->getId(), + 'profile_id' => Class_Profil::getCurrentProfil()->getId()], + sprintf('$("#boite_%s").find(".loading_icon_wrapper").remove();', + $this->getIdModule())); } - - protected function _renderElements($elements) { + protected function _renderElements($elements) + { $content_callback = $this->_getContentCallback($this->_settings->getRendering()); $elements = $this->_sliceElements($elements); @@ -232,31 +295,30 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help return $this->_renderLayout($this->_settings->getLayout(), $elements, $content_callback); } - - protected function _wrapElements(array $elements) : array { - if ( null === ($wrapper = $this->_getWrapper())) + protected function _wrapElements(array $elements): array + { + if (null === ($wrapper = $this->_getWrapper())) return $elements; - return array_map(fn($element) => ((new $wrapper) + return array_map(fn($element) => (new $wrapper) ->setView($this->view) ->setModel($element) - ->setWidgetContext($this)), - $elements); + ->setWidgetContext($this), + $elements); } - - protected function _getLayoutHelperClass($layout) { + protected function _getLayoutHelperClass($layout) + { if ($renderer = Class_Template::current()->getCarouselRenderer($layout)) return $renderer; return static::$_helper_by_layout[$layout] ?? ZendAfi_View_Helper_Template_TruncateList::class; } - - protected function _getLayoutHelper($layout) { + protected function _getLayoutHelper($layout) + { if ($this->_layout_helper) return $this->_layout_helper; - $helper_class = $this->_getLayoutHelperClass($layout); $this->_layout_helper = new $helper_class; @@ -265,180 +327,121 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help ->setRenderingOptions($this); if (in_array($layout, - [Intonation_Library_Widget_Carousel_Definition::MAP, - Intonation_Library_Widget_Carousel_Definition::WALL, - Intonation_Library_Widget_Carousel_Definition::GRID, - Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS])) - $this->_layout_helper->setIdModule($this->_settings->getIdForHtml()); + [Intonation_Library_Widget_Carousel_Definition::MAP, + Intonation_Library_Widget_Carousel_Definition::WALL, + Intonation_Library_Widget_Carousel_Definition::GRID, + Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS])) + $this->_layout_helper->setIdModule($this->_settings->getIdForHtml()); return $this->_layout_helper; } - - protected function _renderLayout($layout, $elements, $content_callback) { + protected function _renderLayout($layout, $elements, $content_callback) + { $args = [new Storm_Collection($elements), $content_callback]; - if ( $this->isLayoutCarousel((string) $layout)) - $args [] = (new Intonation_Library_Widget_Carousel_Settings)->initDefaultsFor($layout); + if ($this->isLayoutCarousel((string) $layout)) + $args[] = (new Intonation_Library_Widget_Carousel_Settings)->initDefaultsFor($layout); $helper_class = $this->_getLayoutHelper((string) $layout); $helper_function = array_reverse(explode('_', get_class($helper_class)))[0]; return call_user_func_array([$helper_class, $helper_function], - $args); + $args); } - - protected function _getContentCallback($rendering) { - if ($rendering == Intonation_Library_Widget_Carousel_Definition::CARD_OVERLAY) + protected function _getContentCallback($rendering) + { + if (Intonation_Library_Widget_Carousel_Definition::CARD_OVERLAY == $rendering) return fn($element) => $this->view->renderingOnlyImage($element); - - if ($rendering == Intonation_Library_Widget_Carousel_Definition::CARD) + if (Intonation_Library_Widget_Carousel_Definition::CARD == $rendering) return fn($element) => $this->view->renderingVertical($element); - - if ($rendering == Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION) + if (Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION == $rendering) return fn($element) => $this->view->renderingDescription($element); - - if ($rendering == Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_CARD) + if (Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_CARD == $rendering) return fn($element) => $this->view->renderingHorizontal($element); - - if ($rendering == Intonation_Library_Widget_Carousel_Definition::PAGE) + if (Intonation_Library_Widget_Carousel_Definition::PAGE == $rendering) return fn($element) => $element->asPage(); return fn() => ''; } - - protected function _getLinkToAllUrl() { + protected function _getLinkToAllUrl() + { if ($url = $this->_settings->getLinkToAllUrl()) return $url; - - if ($this->_settings->getAllLayout() == Intonation_Library_Widget_Carousel_Record_Definition::SEARCH) + if (Intonation_Library_Widget_Carousel_Record_Definition::SEARCH == $this->_settings->getAllLayout()) return $this->_getLinkToAllAsSearch(); return $this->view->url($this->_getLinkToAllUrlParams(), null, true); } - - protected function _getLinkToAllAsSearch() : string { - return - $this->view->url(array_filter($this->_getLinkToAllAsSearchParams()), null, true); + protected function _getLinkToAllAsSearch(): string + { + return $this->view->url(array_filter($this->_getLinkToAllAsSearchParams()), null, true); } - - protected function _getLinkToAllAsSearchParams() : array { + protected function _getLinkToAllAsSearchParams(): array + { return - ['module' => 'opac', - 'controller' => 'recherche', - 'action' => 'simple', + ['module' => 'opac', + 'controller' => 'recherche', + 'action' => 'simple', 'id_catalogue' => $this->_settings->getIdCatalogue(), - 'id_panier' => $this->_settings->getIdPanier(), - 'tri' => $this->_settings->getOrder(), - 'titre' => str_replace(['/', '%2F'], ' ', $this->_settings->getTitre())]; + 'id_panier' => $this->_settings->getIdPanier(), + 'tri' => $this->_settings->getOrder(), + 'titre' => str_replace(['/', '%2F'], ' ', $this->_settings->getTitre())]; } - - protected function _getLinkToAllUrlParams() : array { + protected function _getLinkToAllUrlParams(): array + { $url_params = - ['module' => 'opac', + ['module' => 'opac', 'controller' => 'widget', - 'action' => 'render-all', + 'action' => 'render-all', 'profile_id' => Class_Profil::getCurrentProfil()->getId()]; - if ( $this->view->article && ($this->view->article instanceof Class_Article)) { - $url_params ['article_id'] = $this->view->article->getId(); - $url_params ['widget_key'] = $this->_getWidgetKey(); + if ($this->view->article && ($this->view->article instanceof Class_Article)) { + $url_params['article_id'] = $this->view->article->getId(); + $url_params['widget_key'] = $this->_getWidgetKey(); + return $url_params; } - $url_params ['widget_id'] = $this->getId(); + $url_params['widget_id'] = $this->getId(); + return $url_params; } - - protected function _getWidgetKey() : string { + protected function _getWidgetKey(): string + { return static::hashArray($this->_settings->getPreferences()); } - - public static function hashArray(array $data) : string { - return md5(serialize($data)); - } - - protected function _emptyListMessage(): string { return $this->_emptyList($this->_('Aucun document')); } - - public function getLinkToAllContent() { - $this->view->titre = $this->_settings->getTitre(); - - $this->_settings->setSize(Intonation_Library_Widget_Carousel_Definition::LIMIT_SIZE); - if (isset($this->preferences['size'])) - $this->preferences['size'] = Intonation_Library_Widget_Carousel_Definition::LIMIT_SIZE; - - if (!$elements = $this->_findElements()) - return $this->_emptyListMessage(); - - return $this->_renderLayout($this->_settings->getAllLayout(), - $this->_wrapElements($elements), - $this->_getContentCallback($this->_settings->getAllRendering())); - } - - - public function getLinkToAllParams() { - return []; - } - - - public function getHandleLinkToAll() { - return true; - } - - - protected function _isVolatile() { + protected function _isVolatile() + { return Class_Systeme_Widget_Abstract::VOLATILE_ID_PREFIX === substr($this->id_module, 0, 3); } - - public function findElements() { - return $this->_findElements(); - } - - - public function getAvailableOrders() { - return ($template_context = $this->getTemplateContext()) - ? $template_context->getAvailableOrders() - : []; - } - - - public function newCollectionWith($order) { - $this->_settings->setOrder($order); - return new Storm_Collection($this->_sliceElements($this->_findElements())); - } - - - protected function _sliceElements($elements) { + protected function _sliceElements($elements) + { $elements = array_slice($elements, 0, $this->_settings->getSize()); - return $this->_wrapElements($elements); - } - - public function isLayoutCarousel(string $layout = '') : bool { - $layout = $layout ?: $this->_settings->getLayout(); - return - array_key_exists($layout, - (new Intonation_Library_Widget_Carousel_Definition)->getCarouselLayouts()); + return $this->_wrapElements($elements); } - abstract protected function _findElements(); + abstract protected function _getWrapper(); + abstract protected function _getLinkToAllTitle(); + abstract protected function _getRSSUrl(); } diff --git a/library/templates/Intonation/View/Abonne/HistoryLoansList.php b/library/templates/Intonation/View/Abonne/HistoryLoansList.php index 53ebba58161b4226b1cfce820e1fc077451e85cd..5c1d81897d0128ef0897b089b19baba47c291dd0 100644 --- a/library/templates/Intonation/View/Abonne/HistoryLoansList.php +++ b/library/templates/Intonation/View/Abonne/HistoryLoansList.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,21 +19,16 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_View_Abonne_HistoryLoansList extends Intonation_View_Abonne_LoansList { - - +class Intonation_View_Abonne_HistoryLoansList extends Intonation_View_Abonne_LoansList +{ public function abonne_HistoryLoansList($config) { return parent::abonne_LoansList($config); } - protected function _renderList(Storm_Collection $collection): string { - if ($this->_config->useIlsForPagination()) - { + if ($this->_config->useIlsForPagination()) { $helper = (new Intonation_Library_PaginatedCollectionHelper_HistoryLoans($collection)) ->warmUp($this->view, $this->_config->getParams()); @@ -41,8 +37,7 @@ class Intonation_View_Abonne_HistoryLoansList extends Intonation_View_Abonne_Loa return ZendAfi_View_Helper_Template_TruncateList::AJAX_SIZE < $collection->count() ? $this->view->truncateList($collection, null) - : $this->view->multipleCarousel($collection, - fn($wrapper) => $this->view->renderingVertical($wrapper), - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(3)); + : $this->view->responsiveCarouselPlus($collection, + fn($wrapper) => $this->view->renderingVertical($wrapper)); } } diff --git a/library/templates/Intonation/View/Abstract/Carousel.php b/library/templates/Intonation/View/Abstract/Carousel.php index 6bc8266427fcadf21ef71f256eecc7fcf1031422..bb3739f517402101bc5d4fcd8d107644c1fc975d 100644 --- a/library/templates/Intonation/View/Abstract/Carousel.php +++ b/library/templates/Intonation/View/Abstract/Carousel.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved. * @@ -18,25 +19,28 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -abstract class Intonation_View_Abstract_Carousel - extends Intonation_View_Abstract_Layout { +abstract class Intonation_View_Abstract_Carousel extends Intonation_View_Abstract_Layout +{ + use Trait_TimeSource; protected Intonation_Library_Widget_Carousel_Settings $_settings; + public function renderHeadScriptsOn($script_loader) + { + return $this; + } protected function _renderCarousel(Storm_Collection $collection, - ?Callable $callback, - Intonation_Library_Widget_Carousel_Settings $settings) { + ?callable $callback, + Intonation_Library_Widget_Carousel_Settings $settings): string + { if ($collection->isEmpty()) return ''; - $this->_settings = $settings; $callback = $callback ?: fn($item) => $this->view->renderingVertical($item); - $id = 'carousel_' . uniqid(); + $id = 'carousel_' . $this->getTimeSource()->uniqid(); $content = $this->_carouselInner($collection, $id, $callback) . $this->_indicators($this->_numberOfPages($collection), $id) @@ -53,100 +57,90 @@ $("#%1$s").on("slid.bs.carousel", function() { $("#%1$s").closest(".menu_with_carousel_layout").addClass("overflow-visible"); });', - $id)); + $id)); if ($data_interval = $this->_getCarouselDataInterval()) - Class_ScriptLoader::getInstance() - ->addJqueryReady(sprintf('$("#%s").carousel("cycle")', - $id)); + Class_ScriptLoader::getInstance() + ->addJqueryReady(sprintf('$("#%s").carousel("cycle")', + $id)); return $this->_tag('div', - $content, - ['id' => $id, - 'class' => $this->_carouselClasses(), - 'data-interval' => $data_interval, - 'data-ride' => 'carousel']); - + $content, + ['id' => $id, + 'class' => $this->_carouselClasses(), + 'data-interval' => $data_interval, + 'data-ride' => 'carousel']); } - - protected function _getCarouselDataInterval() { + protected function _getCarouselDataInterval() + { return ($cycle = $this->getRenderingOptions()->getCycle()) ? 1000 * $cycle : 0; } - - protected function _indicators(int $count, string $id) : string { + protected function _indicators(int $count, string $id): string + { if (1 >= $count) return ''; - $pages = []; - for ($i = 0; $i < $count; $i++) - $pages [] = + for ($i = 0; $i < $count; ++$i) + $pages[] = $this->_tag('div', - $this->view->screenReaderOnly($this->_('Page numéro %s', $i)), - ['class' => $this->_settings->getCssClassesForPosition('bg-dark', $i), - 'data-target' => '#' . $id, - 'data-slide-to' => $i]); + $this->view->screenReaderOnly($this->_('Page numéro %s', $i)), + ['class' => $this->_settings->getCssClassesForPosition('bg-dark', $i), + 'data-target' => '#' . $id, + 'data-slide-to' => $i]); return $this->_tag('div', - implode('', $pages), - ['class' => 'carousel-indicators my-2 position-relative']); + implode('', $pages), + ['class' => 'carousel-indicators my-2 position-relative']); } - protected function _carouselInner(Storm_Collection $collection, - string $id, - Callable $callback) : string { + string $id, + callable $callback): string + { $html = $collection ->injectInto([], - function($html, $element) use ($callback) - { - $html [] = - $this->_tag('div', - $callback($element), - ['class' => ($this->_settings - ->getCssClassesForPosition('carousel-item', count($html)))]); - return $html; - }); + function ($html, $element) use ($callback) { + $html[] = + $this->_tag('div', + $callback($element), + ['class' => $this->_settings + ->getCssClassesForPosition('carousel-item', count($html))]); + + return $html; + }); return $this->_tag('div', - implode('', $html), - ['class' => 'carousel-inner']); + implode('', $html), + ['class' => 'carousel-inner']); } - - protected function _carouselControl($should_render, $id) { - if (! $should_render) + protected function _carouselControl(bool $should_render, string $id): string + { + if (!$should_render) return ''; return $this->_tag('a', - Class_Template::current()->getIco($this->view, 'previous', 'utils', ['class' => 'ico_xl']) - . $this->view->screenReaderOnly($this->_('Aller au contenu précédent')), - ['href' => '#' . $id, - 'data-slide' => 'prev', - 'role' => 'button', - 'title' => $this->_('Voir le contenu précédent'), - 'class' => 'carousel_control carousel-control-prev px-3']) + Class_Template::current()->getIco($this->view, 'previous', 'utils', ['class' => 'ico_xl']) + . $this->view->screenReaderOnly($this->_('Aller au contenu précédent')), + ['href' => '#' . $id, + 'data-slide' => 'prev', + 'role' => 'button', + 'class' => 'carousel_control carousel-control-prev px-3']) . $this->_tag('a', - Class_Template::current()->getIco($this->view, 'next', 'utils', ['class' => 'ico_xl']) - . $this->view->screenReaderOnly($this->_('Aller au contenu suivant')), - ['href' => '#' . $id, - 'data-slide' => 'next', - 'role' => 'button', - 'title' => $this->_('Voir le contenu suivant'), - 'class' => 'carousel_control carousel-control-next px-3']); + Class_Template::current()->getIco($this->view, 'next', 'utils', ['class' => 'ico_xl']) + . $this->view->screenReaderOnly($this->_('Aller au contenu suivant')), + ['href' => '#' . $id, + 'data-slide' => 'next', + 'role' => 'button', + 'class' => 'carousel_control carousel-control-next px-3']); } - - public function renderHeadScriptsOn($script_loader) { - return $this; - } - - abstract protected function _carouselClasses(); abstract protected function _numberOfPages($collection); diff --git a/library/templates/Intonation/View/Author/RenderCollaborations.php b/library/templates/Intonation/View/Author/RenderCollaborations.php index 7813d8102b54b2d29978c0b1b082927ea0565b13..e7359faaf2ee1981584b84cf13668bb7d69500c9 100644 --- a/library/templates/Intonation/View/Author/RenderCollaborations.php +++ b/library/templates/Intonation/View/Author/RenderCollaborations.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,44 +19,44 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_View_Author_RenderCollaborations extends ZendAfi_View_Helper_BaseHelper { - public function Author_RenderCollaborations($author) { +class Intonation_View_Author_RenderCollaborations extends ZendAfi_View_Helper_BaseHelper +{ + public function Author_RenderCollaborations($author) + { $callback = fn($collaboration) => $this->_renderCollaboration($author, $collaboration); - return ($content = $this->view->multipleCarousel(new Storm_Collection($author->getAssociatedAuthors()), - $callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5))) + return ($content = $this->view->responsiveCarouselPlus(new Storm_Collection($author->getAssociatedAuthors()), + $callback)) ? $this->_tag('h3', $this->_('Auteurs associés'), ['class' => 'card_title']) . $content : ''; } - - protected function _renderCollaboration($author_description, $collaboration) { + protected function _renderCollaboration($author_description, $collaboration) + { $author = $collaboration['author']; $occurences = $collaboration['occurences']; - $collaboration_link = $this->view->tagAnchor(Class_Url::assemble(['controller' => 'recherche', - 'action' => 'simple', + $collaboration_link = $this->view->tagAnchor(Class_Url::assemble(['controller' => 'recherche', + 'action' => 'simple', 'code_rebond' => $author_description->getFacetCode(), - 'facette' => $author->getFacetCode()]), - $this->_plural($occurences, - 'aucune collaboration', - '1 collaboration', - '%s collaborations', - $occurences), - ['class' => 'text-dark', - 'title' => sprintf('Voir les documents du fonds issus d\'une collaboration entre %s et %s', - $author_description->getLabel(), - $author->getLibelle())]); + 'facette' => $author->getFacetCode()]), + $this->_plural($occurences, + 'aucune collaboration', + '1 collaboration', + '%s collaborations', + $occurences), + ['class' => 'text-dark', + 'title' => sprintf('Voir les documents du fonds issus d\'une collaboration entre %s et %s', + $author_description->getLabel(), + $author->getLibelle())]); + return $this->_div(['class' => 'card'], - $this->_div(['class' => 'p-1 bg-light rounded pl-3'], - $this->_tag('span', - (new Class_Notice_FieldAuthor($author))->renderOn($this->view), - ['class' => 'mr-3']) - . $this->_tag('span', - $collaboration_link, - ['class' => 'badge badge-light']))); + $this->_div(['class' => 'p-1 bg-light rounded pl-3'], + $this->_tag('span', + (new Class_Notice_FieldAuthor($author))->renderOn($this->view), + ['class' => 'mr-3']) + . $this->_tag('span', + $collaboration_link, + ['class' => 'badge badge-light']))); } } diff --git a/library/templates/Intonation/View/Author/RenderRecords.php b/library/templates/Intonation/View/Author/RenderRecords.php index 269c06c6234b3ce6663670054433e682698e83f7..e13e0b0b69494953be428fba98208a0ee6275f52 100644 --- a/library/templates/Intonation/View/Author/RenderRecords.php +++ b/library/templates/Intonation/View/Author/RenderRecords.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,44 +19,43 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_View_Author_RenderRecords extends ZendAfi_View_Helper_BaseHelper { - public function Author_RenderRecords($author) { +class Intonation_View_Author_RenderRecords extends ZendAfi_View_Helper_BaseHelper +{ + public function Author_RenderRecords($author) + { $records_by_doctype = []; - foreach($author->getRecordsByDocType() as $doc_type_id => $records) - $records_by_doctype [] = $this->_renderRecord($author, - $doc_type_id, - $records); + foreach ($author->getRecordsByDocType() as $doc_type_id => $records) + $records_by_doctype[] = $this->_renderRecord($author, + $doc_type_id, + $records); return $this->view->grid(implode('', $records_by_doctype), ['class' => 'records'], ['class' => ' justify-content-between']); } - - protected function _renderRecord($author_description, $doc_type_id, $records) { + protected function _renderRecord($author_description, $doc_type_id, $records) + { $type_doc = Class_TypeDoc::find($doc_type_id); $header = $this->_tag('h3', - $this->view->tagAnchor(Class_Url::assemble(['controller' => 'recherche', - 'action' => 'simple', - 'code_rebond' => $author_description->getFacetCode(), - 'facette' => $type_doc->getFacetCode()]), - ucfirst($type_doc->getLibelle()), - ['title' => $this->_('Afficher tous les documents de type %s pour %s', - $type_doc->getLibelle(), - $author_description->getLabel())] )); + $this->view->tagAnchor(Class_Url::assemble(['controller' => 'recherche', + 'action' => 'simple', + 'code_rebond' => $author_description->getFacetCode(), + 'facette' => $type_doc->getFacetCode()]), + ucfirst($type_doc->getLibelle()), + ['title' => $this->_('Afficher tous les documents de type %s pour %s', + $type_doc->getLibelle(), + $author_description->getLabel())])); $elements = Class_Template::current()->newWrappers($records, $this->view); $records = - $this->view->multipleCarousel($elements, - fn($record) => $this->view->renderingOnlyImage($record), - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5)); + $this->view->responsiveCarouselPlus($elements, + fn($record) => $this->view->renderingOnlyImage($record)); $libelle = strtolower($type_doc->getLibelle()); $class_name = 'doctype_' . preg_replace('/\s+/', '-', $libelle); - return $this->_div(['class' => "col-12 $class_name"], $header . $records); + return $this->_div(['class' => "col-12 {$class_name}"], $header . $records); } } diff --git a/library/templates/Intonation/View/Search/History.php b/library/templates/Intonation/View/Search/History.php index 0f61d6226eeed1c048efaea70e3099f1ac135093..92ef44b054ebec1e8a3e3319b1060757763ef7d3 100644 --- a/library/templates/Intonation/View/Search/History.php +++ b/library/templates/Intonation/View/Search/History.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,42 +19,41 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class Intonation_View_Search_History extends ZendAfi_View_Helper_BaseHelper { - public function search_History() { +class Intonation_View_Search_History extends ZendAfi_View_Helper_BaseHelper +{ + public function search_History() + { $title = $this->_tag('h3', $this->_('Historique de recherches')); - if (!$history = (new Class_SearchHistory())->getHistory()) + if (!$history = (new Class_SearchHistory)->getHistory()) return $title . $this->_('Vous n\'avez pas encore effectué de recherche. %s !', - $this->view->tagAnchor(['controller' => 'recherche', - 'action' => 'simple'], - $this->_('Commencer maintenant'))); + $this->view->tagAnchor(['controller' => 'recherche', + 'action' => 'simple'], + $this->_('Commencer maintenant'))); $history = array_reverse($history); - $history = array_map(function($criteria) - { - $unserialized_criteria = unserialize($criteria); + $history = array_map(function ($criteria) { + $unserialized_criteria = unserialize($criteria); - $bookmarked_search = (new Class_User_BookmarkedSearch) - ->setLabel($unserialized_criteria - ? $unserialized_criteria->getExpressionRecherche() - :'') - ->setCriterias($criteria); + $bookmarked_search = (new Class_User_BookmarkedSearch) + ->setLabel($unserialized_criteria + ? $unserialized_criteria->getExpressionRecherche() + : '') + ->setCriterias($criteria); - return (new Intonation_Library_View_Wrapper_SearchHistory) - ->setModel($bookmarked_search) - ->setView($this->view); - }, $history); + return (new Intonation_Library_View_Wrapper_SearchHistory) + ->setModel($bookmarked_search) + ->setView($this->view); + }, $history); $callback = fn($wrapped) => $this->view->renderingVertical($wrapped); $actions = [(new Intonation_Library_Link) ->setUrl($this->view->url(['controller' => 'abonne', - 'action' => 'clear-history'])) + 'action' => 'clear-history'])) ->setImage($this->view->templateIco('delete', 'utils')) ->setText($this->_('Vider')) ->setAriaLabel($this->_('Vider l\'historique de recherches')) @@ -63,9 +63,8 @@ class Intonation_View_Search_History extends ZendAfi_View_Helper_BaseHelper { $html = [$this->view->div(['class' => 'col-12'], $this->view->collectionActions($actions)), $this->view->div(['class' => 'col-12 mt-3'], - $this->view->multipleCarousel(new Storm_Collection($history), - $callback, - (new Intonation_Library_Widget_Carousel_Settings)->setColumns(5)))]; + $this->view->responsiveCarouselPlus(new Storm_Collection($history), + $callback))]; $html = $this->view->grid(implode('', $html)); diff --git a/library/templates/MyBibApp/Template.php b/library/templates/MyBibApp/Template.php index cc8d7c30aee3f8c1a0c00946346b2fad2cbc72ea..f33514122c11eb9001cac529a00af18097d7ad63 100644 --- a/library/templates/MyBibApp/Template.php +++ b/library/templates/MyBibApp/Template.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. * @@ -18,67 +19,59 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +class MyBibApp_Template extends Intonation_Template +{ + public const ID = 'MYBIBAPP'; - -class MyBibApp_Template extends Intonation_Template { - - const ID = 'MYBIBAPP'; - - public function __construct() { + public function __construct() + { $this->setId(static::ID) ->setTitle($this->_('MyBibApp')) ->setPatcher(new MyBibApp_Library_ProfilePatcher($this)); } - - public function getProfile() { + public function getProfile() + { if ($this->_profile) return $this->_profile; - if ($this->_profile = Class_Profil::findFirstBy(['template' => $this->getId()])) return $this->_profile; - $this->createFrom(Class_Profil::getPortail()); return $this->_profile = Class_Profil::getCurrentProfil(); } - - public function renderSubModal($view) { + public function renderSubModal($view) + { return (new MyBibApp_View_SubModal($this, $view))->render(); } - - public function customTemplateForm($form) { + public function customTemplateForm($form) + { $helper = new MyBibApp_Library_FormCustomizer($this); + return $helper->getTemplateForm($form); } - - public function getTemplateCssFileName() : string { + public function getTemplateCssFileName(): string + { return $this->getMybibappCss() ? 'mybibapp' : ''; } - - protected function _getMapWrapper() : array { - return - array_merge(parent::_getMapWrapper(), - [Class_Notice::class => MyBibApp_Library_Wrapper_Record::class]); - } - - - public function addHelperPath($view) { + public function addHelperPath($view) + { parent::addHelperPath($view); $view->addHelperPath('templates/MyBibApp/View', 'MyBibApp_View'); + return $this; } - - public function getCarouselRenderer(string $layout) : string { - return (Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS === $layout) - ? Chili_View_MultipleCarousel::class - : ''; + protected function _getMapWrapper(): array + { + return + array_merge(parent::_getMapWrapper(), + [Class_Notice::class => MyBibApp_Library_Wrapper_Record::class]); } } diff --git a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php index 1f7d72a777adcc8fc42c104a1f0124d66ad6e1a4..38056cfc9f2a2a2f950da1e7b7b5f3c54cc20c17 100644 --- a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php +++ b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. * @@ -19,81 +20,79 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'AdminAbstractControllerTestCase.php'; -require_once 'fixtures/RessourcesNumeriquesFixtures.php'; -abstract class AdminIndexControllerTestCase extends Admin_AbstractControllerTestCase { +require_once 'fixtures/RessourcesNumeriquesFixtures.php'; +abstract class AdminIndexControllerTestCase extends Admin_AbstractControllerTestCase +{ protected $_storm_default_to_volatile = true; } - - - -class AdminIndexControllerIndexActionTest extends AdminIndexControllerTestCase { - - public function setUp(): void { +class AdminIndexControllerIndexActionTest extends AdminIndexControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture(Class_AdminVar::class, ['id' => 'LANGUES', 'valeur' => '']); $this->dispatch('/admin/index'); } - /** @test */ - public function pageShouldBeHTML5Valid() { + public function adminIndexPageShouldBeHTML5Valid() + { $this->assertHTML5(); } - /** @test */ - function menuGaucheTraductionsShouldBeHidden() { + public function menuGaucheTraductionsShouldBeHidden() + { $this->assertNotXPathContentContains('//a', 'Traductions'); } - /** @test */ - public function titreShouldBeAccueil() { + public function titreShouldBeAccueil() + { $this->assertXPathContentContains('//div[@class="modules"]/h1', 'Accueil'); } - /** @test */ - public function helpLinkShouldBePresent() { + public function helpLinkShouldBePresent() + { $this->assertXPath("//a[@href='http://wiki.bokeh-library-portal.org/index.php/Bokeh']//img"); } - /** @test */ - public function PATH_JAVAShouldExists() { + public function pATHJAVAShouldExists() + { $this->assertTrue(file_exists(PATH_JAVA)); } - /** @test */ - public function menuGaucheShouldContainsCustomFields() { + public function menuGaucheShouldContainsCustomFields() + { $this->assertXPathContentContains('//li//a', 'Champs personnalisés'); } - /** @test */ - public function menuGaucheShouldContainsTestMyOpac() { + public function menuGaucheShouldContainsTestMyOpac() + { $this->assertXPathContentContains('//li//a', 'Test de mon OPAC'); } - /** @test */ - public function menuGaucheShouldContainsInformationsMemcached() { + public function menuGaucheShouldContainsInformationsMemcached() + { $this->assertXPathContentContains('//li//a[contains(@href, "/admin/systeme/memcached-status")]', 'Informations Memcached'); } } - - - -class AdminIndexControllerAdminVarActionTest extends Admin_AbstractControllerTestCase { +class AdminIndexControllerAdminVarActionTest extends Admin_AbstractControllerTestCase +{ protected $_storm_default_to_volatile = true; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->fixture('Class_AdminVar', ['id' => 'BIBNUM', 'valeur' => '0']); $this->fixture('Class_AdminVar', ['id' => 'CACHE_ACTIF', 'valeur' => '1']); @@ -102,107 +101,105 @@ class AdminIndexControllerAdminVarActionTest extends Admin_AbstractControllerTes $this->dispatch('/admin/index/adminvar', true); } - /** @test */ - public function titleShouldBeGestionDesVariables() { + public function titleShouldBeGestionDesVariables() + { $this->assertXpathContentContains('//h1', 'Gestion des variables'); } - /** @test */ - public function avisMaxSaisieShouldBePresent() { + public function avisMaxSaisieShouldBePresent() + { $this->assertXpathContentContains('//td', 'AVIS_MAX_SAISIE'); } - /** @test */ - public function avisMaxSaisieEditLinkShouldBePresent() { + public function avisMaxSaisieEditLinkShouldBePresent() + { $this->assertXpath('//a[contains(@href, "adminvaredit/cle/AVIS_MAX_SAISIE")]'); } - /** @test */ - public function webkioskReservatioURLShouldBePresent() { + public function webkioskReservatioURLShouldBePresent() + { $this->assertXpathContentContains('//td', 'WEBKIOSK_RESERVATION_URL'); } - /** @test */ - public function webkioskKeyShouldBePresent() { + public function webkioskKeyShouldBePresent() + { $this->assertXpathContentContains('//td', 'WEBKIOSK_KEY'); } - /** @test */ - public function boitePanierAutoKeyShouldBePresent() { + public function boitePanierAutoKeyShouldBePresent() + { $this->assertXpathContentContains('//td', 'BOITE_PANIER_AUTO'); } - /** @test */ - public function textReplacementsShouldBePresent() { + public function textReplacementsShouldBePresent() + { $this->assertXpathContentContains('//td', 'TEXT_REPLACEMENTS'); } - /** @test */ - public function pageShouldDisplayVariableNEWSLETTER_INLINE_CSS() { + public function pageShouldDisplayVariableNEWSLETTERINLINECSS() + { $this->assertXPathContentContains('//td', 'NEWSLETTER_INLINE_CSS'); } - /** @test */ - public function bibnumShouldDisplayDelImageAndDisabledLabel() { + public function bibnumShouldDisplayDelImageAndDisabledLabel() + { $base_xpath = '//table[@id="adminvars"]//sub[contains(text(), "BIBNUM")]/ancestor::tr[1]/td[2]'; $this->assertXPath($base_xpath . '/img[contains(@src, "unpublish_16.png")]'); $this->assertXPathContentContains($base_xpath, 'Désactivé'); } - /** @test */ - public function cacheActifShouldDisplayCocheVerteImageAndEnabledLabel() { + public function cacheActifShouldDisplayCocheVerteImageAndEnabledLabel() + { $base_xpath = '//table[@id="adminvars"]//sub[contains(text(), "CACHE ACTIF")]/ancestor::tr[1]/td[2]'; $this->assertXPathContentContains($base_xpath, 'Activé'); $this->assertXPath($base_xpath . '/img[contains(@src, "publish_16.png")]'); } - /** @test */ - public function dilicomPNBShouldBePresent() { + public function dilicomPNBShouldBePresent() + { $this->assertXpathContentContains('//td', 'DILICOM_PNB'); } - /** @test */ - public function dilicomPNBLoanCountLimitShouldBePresent() { + public function dilicomPNBLoanCountLimitShouldBePresent() + { $this->assertXpathContentContains('//td', 'DILICOM_PNB_LOAN_COUNT_LIMIT'); } - /** @test */ - public function newsletterProfilShouldDisplayPortalPath() { + public function newsletterProfilShouldDisplayPortalPath() + { $this->assertXpathContentContains('//td', 'Portail > portail'); } - /** @test */ - public function redmineServerUrlShouldBePresent() { + public function redmineServerUrlShouldBePresent() + { $this->assertXpathContentContains('//td', 'REDMINE_SERVER_URL'); } - /** @test */ - public function pageShouldBeHTML5Valid() { + public function pageShouldBeHTML5Valid() + { $this->assertHTML5(); } } - - - -class AdminIndexControllerAdminVarActionAsAdminPortailTest extends Admin_AbstractControllerTestCase { - - public function setUp(): void { +class AdminIndexControllerAdminVarActionAsAdminPortailTest extends Admin_AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture('Class_AdminVar', ['id' => 'ALBUMS_LIST_MODE', 'valeur' => '1']); @@ -210,9 +207,9 @@ class AdminIndexControllerAdminVarActionAsAdminPortailTest extends Admin_Abstrac $this->fixture('Class_AdminVar', ['id' => 'JAMENDO_CLIENT_ID', 'valeur' => '1']); $this->fixture('Class_AdminVar', ['id' => 'CACHE_ACTIF', 'valeur' => '1']); - $user = $this->fixture('Class_Users', ['id' => 8, - 'login' => 'joe', - 'password' => 'foo', + $user = $this->fixture('Class_Users', ['id' => 8, + 'login' => 'joe', + 'password' => 'foo', 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); ZendAfi_Auth::getInstance()->logUser($user); @@ -220,358 +217,352 @@ class AdminIndexControllerAdminVarActionAsAdminPortailTest extends Admin_Abstrac $this->dispatch('/admin/index/adminvar', true); } - /** @test */ - public function VariableAlbumsListModeShouldBePresent() { + public function variableAlbumsListModeShouldBePresent() + { $this->assertXpathContentContains('//td', 'ALBUMS_LIST_MODE'); } - /** @test */ - public function variableArticlesListModeShouldBePresent() { + public function variableArticlesListModeShouldBePresent() + { $this->assertXpathContentContains('//td', 'ARTICLES_LIST_MODE'); } - /** @test */ - public function VariableJamendoClientIdShouldBePresent() { + public function variableJamendoClientIdShouldBePresent() + { $this->assertXpathContentContains('//td', 'JAMENDO_CLIENT_ID'); } - /** @test */ - public function variableCacheActifShouldNotBePresent() { + public function variableCacheActifShouldNotBePresent() + { $this->assertNotXpathContentContains('//td', 'CACHE_ACTIF'); } - /** @test */ - public function unexistingVarInDbShouldBeDisplayed() { + public function unexistingVarInDbShouldBeDisplayed() + { $this->assertXpathContentContains('//td', 'AFFICHER_DISPONIBILITE_SUR_RECHERCHE'); } - /** @test */ - public function cnilVarShouldBeDisplay() { + public function cnilVarShouldBeDisplay() + { $this->assertXPathContentContains('//td', 'CNIL_CONSENT_ENABLE'); } } - - - -class AdminIndexControllerAdminVarEditActionTest extends Admin_AbstractControllerTestCase { - +class AdminIndexControllerAdminVarEditActionTest extends Admin_AbstractControllerTestCase +{ public $genre_facet; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->genre_facet = $this->fixture(Class_AdminVar::class, - ['id' => 'FACETTE_GENRE_LIBELLE', - 'valeur' => '1']); + ['id' => 'FACETTE_GENRE_LIBELLE', + 'valeur' => '1']); } - /** @test */ - public function editPageShouldContainsTitleFacetteGenreLibelle() { + public function editPageShouldContainsTitleFacetteGenreLibelle() + { $this->dispatch('/admin/index/adminvaredit/cle/FACETTE_GENRE_LIBELLE'); $this->assertQueryContentContains('h1', - 'FACETTE_GENRE_LIBELLE', - $this->_response->getBody()); + 'FACETTE_GENRE_LIBELLE', + $this->_response->getBody()); } - /** @test */ - public function postTwoToFacetteGenreLibelleShouldRemoveTags() { + public function postTwoToFacetteGenreLibelleShouldRemoveTags() + { $this->postDispatch('/admin/index/adminvaredit/cle/FACETTE_GENRE_LIBELLE', - ['cle' => 'FACETTE_GENRE_LIBELLE', - 'valeur' => "<b>test \n</b>"]); + ['cle' => 'FACETTE_GENRE_LIBELLE', + 'valeur' => "<b>test \n</b>"]); $this->assertEquals('test', $this->genre_facet->getValeur()); $this->assertRedirectTo('/admin/index/adminvaredit/cle/FACETTE_GENRE_LIBELLE'); $this->assertFlashMessengerContentContains('Variable FACETTE_GENRE_LIBELLE sauvegardée'); } - /** @test */ - public function postWithoutStylesReloadPopupShouldClosePopup() { + public function postWithoutStylesReloadPopupShouldClosePopup() + { $this->postDispatch('/admin/index/adminvaredit/cle/FACETTE_GENRE_LIBELLE/render/popup', - ['cle' => 'FACETTE_GENRE_LIBELLE', - 'valeur' => "<b>test \n</b>"]); + ['cle' => 'FACETTE_GENRE_LIBELLE', + 'valeur' => "<b>test \n</b>"]); $this->assertXPathContentContains('//script', 'location.reload()'); } - /** @test */ - public function postWithStylesReloadPopupShouldReopenEditSameKey() { + public function postWithStylesReloadPopupShouldReopenEditSameKey() + { $this->postDispatch('/admin/index/adminvaredit/cle/FACETTE_GENRE_LIBELLE/styles_reload/1/render/popup', - ['cle' => 'FACETTE_GENRE_LIBELLE', - 'valeur' => "<b>test \n</b>"]); + ['cle' => 'FACETTE_GENRE_LIBELLE', + 'valeur' => "<b>test \n</b>"]); $this->assertFlashMessengerContainsPopup(Class_Url::absolute('/admin/index/adminvaredit/cle/FACETTE_GENRE_LIBELLE/render/popup')); } } - - - -class AdminIndexControllerAdminVarEditCKEditorActionTest extends Admin_AbstractControllerTestCase { +class AdminIndexControllerAdminVarEditCKEditorActionTest extends Admin_AbstractControllerTestCase +{ protected $_response; - protected $_storm_default_to_volatile=true; - public function setUp(): void { + protected $_storm_default_to_volatile = true; + + public function setUp(): void + { parent::setUp(); } - /** @test */ - public function defaultValueShouldBeSet() { - $this->assertEquals('Votre compte sera mis à jour dans un délai de 15 minutes après le retour anticipé du document.',Class_AdminVar::getValueOrDefault('DILICOM_PNB_LOAN_WARNING_MESSAGE')); + public function defaultValueShouldBeSet() + { + $this->assertEquals('Votre compte sera mis à jour dans un délai de 15 minutes après le retour anticipé du document.', Class_AdminVar::getValueOrDefault('DILICOM_PNB_LOAN_WARNING_MESSAGE')); } - /** @test */ - public function editPageShouldContainsTitlePNBLoanMessage() { + public function editPageShouldContainsTitlePNBLoanMessage() + { $this->fixture('Class_AdminVar', - ['id' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', - 'valeur' => '']); + ['id' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', + 'valeur' => '']); $this->dispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_LOAN_WARNING_MESSAGE'); $this->assertQueryContentContains('h1', - 'DILICOM_PNB_LOAN_WARNING_MESSAGE', - $this->_response->getBody()); + 'DILICOM_PNB_LOAN_WARNING_MESSAGE', + $this->_response->getBody()); } - /** @test */ - public function postEnrichTextShouldNotRemoveTags() { + public function postEnrichTextShouldNotRemoveTags() + { $this->fixture('Class_AdminVar', - ['id' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', - 'valeur' => '']); + ['id' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', + 'valeur' => '']); $this ->getRequest() ->setMethod('POST') - ->setPost(['cle' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', + ->setPost(['cle' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', 'valeur' => "<b>don't use this, drm are dangerous!</b>"]); $this->dispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_LOAN_WARNING_MESSAGE'); $this->assertEquals('<b>don\'t use this, drm are dangerous!</b>', Class_AdminVar::get('DILICOM_PNB_LOAN_WARNING_MESSAGE')); } } - -abstract class AdminIndexControllerAdminVarEditWithWorkflowTestCase extends Admin_AbstractControllerTestCase { - public function setUp(): void { +abstract class AdminIndexControllerAdminVarEditWithWorkflowTestCase extends Admin_AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Permission::beVolatile(); } } - - - -class AdminIndexControllerAdminVarEditWorkflowPostTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase { - public function setUp(): void { +class AdminIndexControllerAdminVarEditWorkflowPostTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '']); $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '[{"id":"1", "label":"Testing test"}]']); + ['cle' => 'WORKFLOW', + 'valeur' => '[{"id":"1", "label":"Testing test"}]']); } - /** @test */ - public function errorShouldBeNotified() { + public function errorShouldBeNotified() + { $this->assertFlashMessengerContentContains('Erreur(s) : Le statut 1 est réservé par Bokeh, variable WORKFLOW NON sauvegardée'); } } - - - -class AdminIndexControllerAdminVarEditWorkflowPostPermissionTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase { - public function setUp(): void { +class AdminIndexControllerAdminVarEditWorkflowPostPermissionTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '']); } - /** @test */ - public function rightForStatus12ShouldBeCreated() { + public function rightForStatus12ShouldBeCreated() + { $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '[{"id":"12", "label":"Testing test"}]']); + ['cle' => 'WORKFLOW', + 'valeur' => '[{"id":"12", "label":"Testing test"}]']); $this->assertNotNull(Class_Permission::findDynamicWorkflow(12)); } - /** @test */ - public function rightForStatus13ShouldBeCreated() { + public function rightForStatus13ShouldBeCreated() + { $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '[{"id":"13", "label":"Testing test 2"}]']); + ['cle' => 'WORKFLOW', + 'valeur' => '[{"id":"13", "label":"Testing test 2"}]']); $this->assertNotNull(Class_Permission::findDynamicWorkflow(13)); } - /** @test */ - public function rightForStatus12ShouldNotBeCreated() { - $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', + public function rightForStatus12ShouldNotBeCreated() + { + $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '[{"id":"12", "label":"Testing test"}]']); $this->_fixDynamicWorkflowPermission(1, 12, 'Testing test'); $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '[{"id":"12", "label":"Testing test"},{"id":"13", "label":"Testing test 2"}]']); + ['cle' => 'WORKFLOW', + 'valeur' => '[{"id":"12", "label":"Testing test"},{"id":"13", "label":"Testing test 2"}]']); $this->assertEquals(1, Class_Permission::countBy(['code' => 'DYNAMIC_12'])); } - /** @test */ - public function rightForStatus12ShouldBeDeleted() { - $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', + public function rightForStatus12ShouldBeDeleted() + { + $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '[{"id":"12", "label":"Testing test"}]']); $this->_fixDynamicWorkflowPermission(1, 12, 'Testing test'); $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '1']); + ['cle' => 'WORKFLOW', + 'valeur' => '1']); $this->assertNull(Class_Permission::findDynamicWorkflow(12)); } - /** @test */ - public function rightForStatus12ShouldNotBeDeleted() { - $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', + public function rightForStatus12ShouldNotBeDeleted() + { + $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '[{"id":"12", "label":"Testing test"},{"id":"13", "label":"Testing test 2"}]']); $this->_fixDynamicWorkflowPermission(1, 12, 'Testing test'); $this->_fixDynamicWorkflowPermission(2, 13, 'Testing test 2'); $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '[{"id":"13", "label":"Testing test 2"}]']); + ['cle' => 'WORKFLOW', + 'valeur' => '[{"id":"13", "label":"Testing test 2"}]']); $this->assertNull(Class_Permission::findFirstBy(['code' => 'DYNAMIC_12'])); $this->assertNotNull(Class_Permission::findFirstBy(['code' => 'DYNAMIC_13'])); } - - protected function _fixDynamicWorkflowPermission($id, $status_id, $label) { - $this->fixture('Class_Permission', ['id' => $id, - 'code' => 'DYNAMIC_' . $status_id, + protected function _fixDynamicWorkflowPermission($id, $status_id, $label) + { + $this->fixture('Class_Permission', ['id' => $id, + 'code' => 'DYNAMIC_' . $status_id, 'module' => 'ARTICLE', - 'type' => 'Workflow', - 'label' => $label]); + 'type' => 'Workflow', + 'label' => $label]); } } - - - -class AdminIndexControllerAdminVarEditWorkflowWithUsedPostTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase { - public function setUp(): void { +class AdminIndexControllerAdminVarEditWorkflowWithUsedPostTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase +{ + public function setUp(): void + { parent::setUp(); - $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', + $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '[{"id":"10", "label":"Testing test"}]']); $this->fixture('Class_Article', - ['id' => 99, - 'status' => "10", - 'titre' => 'Arnaud Afi power', - 'contenu' => 'It\'s alive!']); + ['id' => 99, + 'status' => '10', + 'titre' => 'Arnaud Afi power', + 'contenu' => 'It\'s alive!']); $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '[{"id":"78", "label":"Other test"}]']); + ['cle' => 'WORKFLOW', + 'valeur' => '[{"id":"78", "label":"Other test"}]']); } - /** @test */ - public function errorShouldBeNotified() { + public function errorShouldBeNotified() + { $this->assertFlashMessengerContentContains('Le statut 10 est utilisé par un article et ne peut être supprimé'); } } - - - -class AdminIndexControllerAdminVarEditWorkflowGoSimpleWithUsedPostTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase { - public function setUp(): void { +class AdminIndexControllerAdminVarEditWorkflowGoSimpleWithUsedPostTest extends AdminIndexControllerAdminVarEditWithWorkflowTestCase +{ + public function setUp(): void + { parent::setUp(); - $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', + $this->fixture('Class_AdminVar', ['id' => 'WORKFLOW', 'valeur' => '[{"id":"10", "label":"Testing test"}]']); $this->fixture('Class_Article', - ['id' => 99, - 'status' => "10", - 'titre' => 'Arnaud Afi power', - 'contenu' => 'It\'s alive!']); + ['id' => 99, + 'status' => '10', + 'titre' => 'Arnaud Afi power', + 'contenu' => 'It\'s alive!']); $this->postDispatch('/admin/index/adminvaredit/cle/WORKFLOW', - ['cle' => 'WORKFLOW', - 'valeur' => '1']); + ['cle' => 'WORKFLOW', + 'valeur' => '1']); } - /** @test */ - public function errorShouldBeNotified() { + public function errorShouldBeNotified() + { $this->assertFlashMessengerContentContains('Le statut 10 est utilisé par un article et ne peut être supprimé'); } } - - - -class AdminIndexControllerAdminVarEditResaConditionActionTest extends Admin_AbstractControllerTestCase { +class AdminIndexControllerAdminVarEditResaConditionActionTest extends Admin_AbstractControllerTestCase +{ protected $_response; protected $_resa_condition; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->_resa_condition = $this->fixture('Class_AdminVar', - ['id' => 'RESA_CONDITION', - 'valeur' => 'Mes+conditions+de+reservation']); + ['id' => 'RESA_CONDITION', + 'valeur' => 'Mes+conditions+de+reservation']); } - /** @test */ - public function editResaConditionShouldDecodeItsValeur() { + public function editResaConditionShouldDecodeItsValeur() + { $this->dispatch('/admin/index/adminvaredit/cle/RESA_CONDITION', true); $this->assertXPathContentContains('//textarea', 'Mes conditions de reservation', - $this->_response->getBody()); + $this->_response->getBody()); } - /** @test */ - public function postResaConditionShouldEncodeItsValeur() { + public function postResaConditionShouldEncodeItsValeur() + { $this->postDispatch('/admin/index/adminvaredit/cle/RESA_CONDITION', - ['valeur' => 'Il faut demander']); + ['valeur' => 'Il faut demander']); $this->assertEquals('Il+faut+demander', $this->_resa_condition->getValeur()); } - /** @test */ - public function emptyPostResaConditionShouldBePossible() { + public function emptyPostResaConditionShouldBePossible() + { $this->postDispatch('/admin/index/adminvaredit/cle/RESA_CONDITION', - ['valeur' => '']); + ['valeur' => '']); $this->assertEquals('', $this->_resa_condition->getValeur()); } } +abstract class AdminIndexControllerDilicomPnbIpAdressesTestCase extends Admin_AbstractControllerTestCase +{ + protected $_http; + protected $_storm_default_to_volatile = true; - -abstract class AdminIndexControllerDilicomPnbIpAdressesTestCase extends Admin_AbstractControllerTestCase { - protected $_http, - $_storm_default_to_volatile = true; - - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->_http = Storm_Test_ObjectWrapper::mock(); $this->_http ->whenCalled('setAuth')->answers(null) - ->whenCalled('open_url')->answers(json_encode(['returnStatus' => 'OK', + ->whenCalled('open_url')->answers(json_encode(['returnStatus' => 'OK', 'returnMessage' => []])); Class_AdminVar::set('DILICOM_PNB_IP_ADRESSES', ''); @@ -581,238 +572,225 @@ abstract class AdminIndexControllerDilicomPnbIpAdressesTestCase extends Admin_Ab Class_WebService_BibNumerique_Dilicom_Hub::setDefaultHttpClient($this->_http); } - - public function tearDown(): void { + public function tearDown(): void + { Class_WebService_BibNumerique_Dilicom_Hub::setDefaultHttpClient(null); RessourcesNumeriquesFixtures::deactivateDilicom(); parent::tearDown(); } } - - - -class AdminIndexControllerAdminVarEditDilicomPnbIpAdressesTest extends AdminIndexControllerDilicomPnbIpAdressesTestCase { - public function setUp(): void { +class AdminIndexControllerAdminVarEditDilicomPnbIpAdressesTest extends AdminIndexControllerDilicomPnbIpAdressesTestCase +{ + public function setUp(): void + { parent::setUp(); - $this->fixture('Class_AdminVar', ['id' => 'DILICOM_PNB_IP_ADRESSES', + $this->fixture('Class_AdminVar', ['id' => 'DILICOM_PNB_IP_ADRESSES', 'valeur' => '178.12.34.56;178.12.34.57']); $this->dispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_IP_ADRESSES', - true); + true); } - /** @test */ - public function varNameDilicomPnbIpAdressesShouldBeDisplayed() { + public function varNameDilicomPnbIpAdressesShouldBeDisplayed() + { $this->assertQueryContentContains('//h1', 'DILICOM_PNB_IP_ADRESSES'); } - /** @test */ - public function pageShouldContainsMultiInputsValeur() { + public function pageShouldContainsMultiInputsValeur() + { $this->assertXPath('//div[@id="multi_inputs_valeur"]'); } - /** @test */ - public function multiInputAdressesShouldContains178_12_34_56() { + public function multiInputAdressesShouldContains178123456() + { $this->assertXPathContentContains('//script', - '178.12.34.56'); + '178.12.34.56'); } - /** @test */ - public function descriptionShouldContainsListeDesAdressesIp() { + public function descriptionShouldContainsListeDesAdressesIp() + { $this->assertXPathContentContains('//p', 'Liste des adresses IP'); } - /** @test */ - public function backUrlShouldBeAdminVar() { + public function backUrlShouldBeAdminVar() + { $this->assertXPath('//div//button[@class="back admin-button"][contains(@onclick, "/admin/index/adminvar")]'); } } - - - -class AdminIndexControllerSetTestCase extends Admin_AbstractControllerTestCase{ +class AdminIndexControllerSetTestCase extends Admin_AbstractControllerTestCase +{ /** * @test */ - public function setVarShouldSetAdminVar(){ - Class_AdminVar::set('ACTIVATE_AUTH_LOG',1); - $this->assertEquals( 1 , Class_AdminVar::get( 'ACTIVATE_AUTH_LOG')); + public function setVarShouldSetAdminVar() + { + Class_AdminVar::set('ACTIVATE_AUTH_LOG', 1); + $this->assertEquals(1, Class_AdminVar::get('ACTIVATE_AUTH_LOG')); $this->dispatch('/admin/index/adminvar_set/cle/ACTIVATE_AUTH_LOG/valeur/0'); - $this->assertEquals( 0, Class_AdminVar::get( 'ACTIVATE_AUTH_LOG')); + $this->assertEquals(0, Class_AdminVar::get('ACTIVATE_AUTH_LOG')); } - /** * @test */ - public function unsetVarShouldActivateAdminVar(){ - Class_AdminVar::set('ACTIVATE_AUTH_LOG',0); - $this->assertEquals( 0 , Class_AdminVar::get( 'ACTIVATE_AUTH_LOG')); + public function unsetVarShouldActivateAdminVar() + { + Class_AdminVar::set('ACTIVATE_AUTH_LOG', 0); + $this->assertEquals(0, Class_AdminVar::get('ACTIVATE_AUTH_LOG')); $this->dispatch('/admin/index/adminvar_set/cle/ACTIVATE_AUTH_LOG/valeur/1/'); - $this->assertEquals( 1, Class_AdminVar::get( 'ACTIVATE_AUTH_LOG')); + $this->assertEquals(1, Class_AdminVar::get('ACTIVATE_AUTH_LOG')); } } - - - -class AdminIndexControllerAdminVarDilicomDeclareIpPostTest extends AdminIndexControllerDilicomPnbIpAdressesTestCase { +class AdminIndexControllerAdminVarDilicomDeclareIpPostTest extends AdminIndexControllerDilicomPnbIpAdressesTestCase +{ /** @test */ - public function hubErrorMessageShouldAppearInNotification() { + public function hubErrorMessageShouldAppearInNotification() + { $this->_http->whenCalled('open_url') - ->answers(json_encode(['requestId' => 'xxx', - 'returnStatus' => 'KO', + ->answers(json_encode(['requestId' => 'xxx', + 'returnStatus' => 'KO', 'returnMessage' => ['xxx is not a valid address']])); $this->postDispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_IP_ADRESSES', - ['cle' => 'DILICOM_PNB_IP_ADRESSES', - 'values' => ['xxx', - '123.156.15.3']]); + ['cle' => 'DILICOM_PNB_IP_ADRESSES', + 'values' => ['xxx', + '123.156.15.3']]); $this->assertXPathContentContains('//div//ul[@class="errors"]/li', 'xxx is not a valid address'); } - /** @test */ - public function whenDilicomDisabledErrorMessageShouldAppearInNotification() { + public function whenDilicomDisabledErrorMessageShouldAppearInNotification() + { RessourcesNumeriquesFixtures::deactivateDilicom(); $this->postDispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_IP_ADRESSES', - ['cle' => 'DILICOM_PNB_IP_ADRESSES', - 'values' => ['xxx', - '123.156.15.3']]); + ['cle' => 'DILICOM_PNB_IP_ADRESSES', + 'values' => ['xxx', + '123.156.15.3']]); $this->assertXPathContentContains('//div//ul[@class="errors"]/li', 'configuration du PNB Dilicom incomplète'); } - /** @test */ - public function emptyAnswerErrorMessageShouldBePresnt() { + public function emptyAnswerErrorMessageShouldBePresnt() + { $this->_http->whenCalled('open_url') ->answers(''); $this->postDispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_IP_ADRESSES', - ['cle' => 'DILICOM_PNB_IP_ADRESSES', - 'values' => ['xxx', - '123.156.15.3']]); + ['cle' => 'DILICOM_PNB_IP_ADRESSES', + 'values' => ['xxx', + '123.156.15.3']]); $this->assertXPathContentContains('//div//ul[@class="errors"]/li', 'échec de communication avec le serveur PNB Dilicom'); } - /** @test */ - public function hubWarningMessageShouldNotPreventSave() { + public function hubWarningMessageShouldNotPreventSave() + { $this->_http->whenCalled('open_url') - ->answers(json_encode(['requestId' => 'xxx', - 'returnStatus' => 'WARNING', + ->answers(json_encode(['requestId' => 'xxx', + 'returnStatus' => 'WARNING', 'returnMessage' => ['xxx is already declared']])); $this->postDispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_IP_ADRESSES', - ['cle' => 'DILICOM_PNB_IP_ADRESSES', - 'values' => ['123.156.15.3']]); + ['cle' => 'DILICOM_PNB_IP_ADRESSES', + 'values' => ['123.156.15.3']]); $this->assertEquals('123.156.15.3', Class_AdminVar::get('DILICOM_PNB_IP_ADRESSES')); } } - /** @see http://forge.afi-sa.fr/issues/24383 */ -class AdminIndexControllerAdminVarEditTextReplacementsActionTest extends Admin_AbstractControllerTestCase { - +class AdminIndexControllerAdminVarEditTextReplacementsActionTest extends Admin_AbstractControllerTestCase +{ /** @test */ - public function postShouldNotStripTags() { + public function postShouldNotStripTags() + { $this->fixture('Class_AdminVar', - ['id' => 'TEXT_REPLACEMENTS', 'valeur' => '']); + ['id' => 'TEXT_REPLACEMENTS', 'valeur' => '']); $value = 'Votre réservation est enregistrée.<br>Nous vous informerons quand le document%s sera disponible pour être retiré à : %s'; $this->postDispatch('/admin/index/adminvaredit/cle/TEXT_REPLACEMENTS', - ['valeur' => $value]); + ['valeur' => $value]); $this->assertEquals($value, Class_AdminVar::get('TEXT_REPLACEMENTS')); } } - - - -abstract class AdminIndexControllerAdminVarEditComboActionTestCase extends Admin_AbstractControllerTestCase { +abstract class AdminIndexControllerAdminVarEditComboActionTestCase extends Admin_AbstractControllerTestCase +{ protected $_storm_default_to_volatile = true; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); Class_AdminVar::resetAllVars(); $this->fixture('Class_Profil', - ['id' => 4, 'libelle' => 'Accueil']); + ['id' => 4, 'libelle' => 'Accueil']); $this->fixture('Class_AdminVar', - ['id' => 'NEWSLETTER_ID_PROFIL', 'valeur' => '']); + ['id' => 'NEWSLETTER_ID_PROFIL', 'valeur' => '']); } } - - - -class AdminIndexControllerAdminVarEditComboActionTest - extends AdminIndexControllerAdminVarEditComboActionTestCase { +class AdminIndexControllerAdminVarEditComboActionTest extends AdminIndexControllerAdminVarEditComboActionTestCase +{ /** @test */ - public function shouldDisplayProfilsSelect() { + public function shouldDisplayProfilsSelect() + { $this->dispatch('/admin/index/adminvaredit/cle/NEWSLETTER_ID_PROFIL', true); $this->assertXPathContentContains('//select[@name="valeur"]//option[@value="4"]', - 'Accueil'); + 'Accueil'); } } - - - -class AdminIndexControllerAdminVarEditComboValidPostActionTest - extends AdminIndexControllerAdminVarEditComboActionTestCase { - +class AdminIndexControllerAdminVarEditComboValidPostActionTest extends AdminIndexControllerAdminVarEditComboActionTestCase +{ protected $_response; + /** @test */ - public function shouldSave() { + public function shouldSave() + { $this->postDispatch('/admin/index/adminvaredit/cle/NEWSLETTER_ID_PROFIL', - ['valeur' => 4]); + ['valeur' => 4]); $this->assertEquals(4, Class_AdminVar::get('NEWSLETTER_ID_PROFIL'), - $this->_response->getBody()); + $this->_response->getBody()); } } - - - -class AdminIndexControllerAdminVarEditComboInvalidPostActionTest - extends AdminIndexControllerAdminVarEditComboActionTestCase { - +class AdminIndexControllerAdminVarEditComboInvalidPostActionTest extends AdminIndexControllerAdminVarEditComboActionTestCase +{ /** @test */ - public function shouldNotSave() { + public function shouldNotSave() + { $this->postDispatch('/admin/index/adminvaredit/cle/NEWSLETTER_ID_PROFIL', - ['valeur' => 19]); + ['valeur' => 19]); $this->assertNotEquals(19, Class_AdminVar::get('NEWSLETTER_ID_PROFIL')); } } - - - -class AdminIndexControllerDisplayModifierNomDomaineTest extends AbstractControllerTestCase { - +class AdminIndexControllerDisplayModifierNomDomaineTest extends AbstractControllerTestCase +{ /** @test */ - public function ModifierNomDomaineShouldBePresent() { + public function modifierNomDomaineShouldBePresent() + { $user = $this->fixture(Class_Users::class, - ['id' => 8, - 'login' => 'joe', - 'password' => 'foo', - 'date_maj' => '', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); + ['id' => 8, + 'login' => 'joe', + 'password' => 'foo', + 'date_maj' => '', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); ZendAfi_Auth::getInstance()->logUser($user); @@ -821,15 +799,15 @@ class AdminIndexControllerDisplayModifierNomDomaineTest extends AbstractControll $this->assertXpathContentContains('//div[@class="modules"]//a', 'Modifier'); } - /** @test */ - public function ModifierNomDomaineShouldNotBePresent() { + public function modifierNomDomaineShouldNotBePresent() + { $user = $this->fixture(Class_Users::class, - ['id' => 8, - 'login' => 'joe', - 'password' => 'foo', - 'date_maj' => '', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL]); + ['id' => 8, + 'login' => 'joe', + 'password' => 'foo', + 'date_maj' => '', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL]); ZendAfi_Auth::getInstance()->logUser($user); @@ -839,26 +817,21 @@ class AdminIndexControllerDisplayModifierNomDomaineTest extends AbstractControll } } - - -abstract class AdminIndexControllerAdminVarEditSearchAlsoInTestCase extends AbstractControllerTestCase { - - public function setUp(): void { +abstract class AdminIndexControllerAdminVarEditSearchAlsoInTestCase extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture('Class_AdminVar', - ['id' => 'SEARCH_ALSO_IN', - 'valeur' => json_encode(['site_label' => ['Jumel'], - 'site_url' => ['http://testing.fr?q=%s']])]); + ['id' => 'SEARCH_ALSO_IN', + 'valeur' => json_encode(['site_label' => ['Jumel'], + 'site_url' => ['http://testing.fr?q=%s']])]); } } - - - -class AdminIndexControllerAdminVarEditSearchAlsoInTest - extends AdminIndexControllerAdminVarEditSearchAlsoInTestCase { - +class AdminIndexControllerAdminVarEditSearchAlsoInTest extends AdminIndexControllerAdminVarEditSearchAlsoInTestCase +{ public function setUp(): void { parent::setUp(); @@ -866,130 +839,123 @@ class AdminIndexControllerAdminVarEditSearchAlsoInTest $this->dispatch('/admin/index/adminvaredit/cle/SEARCH_ALSO_IN'); } - /** @test */ - public function shouldDisplayLabel() { + public function shouldDisplayLabel() + { $this->assertXpathContentContains('//p', 'Liste des sites de recherche élargie'); } - /** @test */ - public function shouldDisplayId() { + public function shouldDisplayId() + { $this->assertXpathContentContains('//h1', 'SEARCH_ALSO_IN'); } - /** @test */ - public function scriptShouldContainsSiteLabel() { + public function scriptShouldContainsSiteLabel() + { $this->assertXpathContentContains('//script', 'Nom du site'); } - /** @test */ - public function scriptShouldContainsSiteUrlLabel() { + public function scriptShouldContainsSiteUrlLabel() + { $this->assertXpathContentContains('//script', 'Url de recherche'); } - /** @test */ - public function scriptShouldcontainsSiteLabelValue() { + public function scriptShouldcontainsSiteLabelValue() + { $this->assertXpathContentContains('//script', 'Jumel'); } - /** @test */ - public function scriptShouldcontainsSiteUrlValue() { - $this->assertXpathContentContains('//script', 'http:\\/\\/testing.fr?q=%s'); + public function scriptShouldcontainsSiteUrlValue() + { + $this->assertXpathContentContains('//script', 'http:\/\/testing.fr?q=%s'); } } - - - -class AdminIndexControllerAdminVarEditSearchAlsoInPostTest - extends AdminIndexControllerAdminVarEditSearchAlsoInTestCase { - - public function setUp(): void { +class AdminIndexControllerAdminVarEditSearchAlsoInPostTest extends AdminIndexControllerAdminVarEditSearchAlsoInTestCase +{ + public function setUp(): void + { parent::setUp(); $this->postDispatch('/admin/index/adminvaredit/cle/SEARCH_ALSO_IN', - ['site_label' => ['Jumelles'], - 'site_url' => ['http://jumelles.fr/?q=%s']]); + ['site_label' => ['Jumelles'], + 'site_url' => ['http://jumelles.fr/?q=%s']]); } - /** @test */ - public function varShouldContainsJumelles() { + public function varShouldContainsJumelles() + { $this->assertContains('Jumelles', Class_AdminVar::find('SEARCH_ALSO_IN')->getValeur()); } - /** @test */ - public function varShouldContainsUrl() { + public function varShouldContainsUrl() + { $this->assertEquals('http://jumelles.fr/?q=%s', - json_decode(Class_AdminVar::find('SEARCH_ALSO_IN')->getValeur())->site_url[0]); + json_decode(Class_AdminVar::find('SEARCH_ALSO_IN')->getValeur())->site_url[0]); } } - - - -class AdminIndexControllerAdminVarEditHTTPSTest - extends Admin_AbstractControllerTestCase { +class AdminIndexControllerAdminVarEditHTTPSTest extends Admin_AbstractControllerTestCase +{ protected $_response; protected $_storm_default_to_volatile = true; protected $oldServerName; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->oldServerName = $_SERVER['SERVER_NAME']; - $_SERVER['SERVER_NAME'] = "MyWebsite"; + $_SERVER['SERVER_NAME'] = 'MyWebsite'; } - - public function tearDown(): void { + public function tearDown(): void + { parent::tearDown(); Class_AdminVar_ForceHTTPS::$FORCE_HTTPS = false; $_SERVER['SERVER_NAME'] = $this->oldServerName; } - /** @test */ - public function editAdminVarShouldPostHTTPS() { + public function editAdminVarShouldPostHTTPS() + { Class_AdminVar::set('FORCE_HTTPS', 0); $this->dispatch('/admin/index/adminvaredit/cle/FORCE_HTTPS', true); - $this->assertXPath('//form[@action="https://MyWebsite/admin/index/adminvaredit/cle/FORCE_HTTPS"]',$this->_response->getBody()); + $this->assertXPath('//form[@action="https://MyWebsite/admin/index/adminvaredit/cle/FORCE_HTTPS"]', $this->_response->getBody()); } - /** @test */ - public function editAdminVarShouldPostHTTPIfAlreadySetToHttps() { + public function editAdminVarShouldPostHTTPIfAlreadySetToHttps() + { Class_AdminVar_ForceHTTPS::$FORCE_HTTPS = true; $this->dispatch('/admin/index/adminvaredit/cle/FORCE_HTTPS', true); - $this->assertXPath('//form[@action="https://MyWebsite/admin/index/adminvaredit/cle/FORCE_HTTPS"]',$this->_response->getBody()); + $this->assertXPath('//form[@action="https://MyWebsite/admin/index/adminvaredit/cle/FORCE_HTTPS"]', $this->_response->getBody()); } } - - - -class AdminIndexControllerWithFormLinkTest extends Admin_AbstractControllerTestCase { - +class AdminIndexControllerWithFormLinkTest extends Admin_AbstractControllerTestCase +{ protected $_storm_default_to_volatile = true; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $super_admin = $this->fixture('Class_Users', - ['id' => 34, - 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN, - 'login' => 'bokeh', - 'password' => 'vvvvvv']); + ['id' => 34, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN, + 'login' => 'bokeh', + 'password' => 'vvvvvv']); ZendAfi_Auth::getInstance()->logUser($super_admin); } - /** @test */ - public function withSuperAdminLoggedDbNameShouldBePresent() { + public function withSuperAdminLoggedDbNameShouldBePresent() + { $this->dispatch('admin/index'); $this->assertXPathContentContains('//div[@class = "ligne_info "]', 'Base de donnée'); } diff --git a/tests/scenarios/Templates/ChiliMultipleCarouselTest.php b/tests/scenarios/Templates/ChiliMultipleCarouselTest.php index 24d4a63b7d85498209696d7fd9ae34f07515970c..cca63654ee707e52a5634c8ef9148e39246c0e8a 100644 --- a/tests/scenarios/Templates/ChiliMultipleCarouselTest.php +++ b/tests/scenarios/Templates/ChiliMultipleCarouselTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. * @@ -18,14 +19,13 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class ChiliMultipleCarouselResponsiveTest extends AbstractControllerTestCase { - - public function setUp(): void { +class ChiliMultipleCarouselResponsiveTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $profile = - $this->_buildTemplateProfil(['id' => 23, + $this->_buildTemplateProfil(['id' => 23, 'template' => 'CHILI']); $profile_patcher = (new Class_Template_ProfilePatcher(null)) @@ -33,63 +33,63 @@ class ChiliMultipleCarouselResponsiveTest extends AbstractControllerTestCase { $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'libraries' => '1;2;3;4;5;6', - 'layout' => 'multiple_carousel_plus', - 'size' => 10]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'libraries' => '1;2;3;4;5;6', + 'layout' => 'multiple_carousel_plus', + 'size' => 10]); $this->fixture('Class_Bib', - ['id' => 1, - 'libelle' => 'Esertine']); + ['id' => 1, + 'libelle' => 'Esertine']); $this->fixture('Class_Bib', - ['id' => 2, - 'libelle' => 'Polliet']); + ['id' => 2, + 'libelle' => 'Polliet']); $this->fixture('Class_Bib', - ['id' => 3, - 'libelle' => 'Yverdon']); + ['id' => 3, + 'libelle' => 'Yverdon']); $this->fixture('Class_Bib', - ['id' => 4, - 'libelle' => 'Echallens']); + ['id' => 4, + 'libelle' => 'Echallens']); $this->fixture('Class_Bib', - ['id' => 5, - 'libelle' => 'Sainte Croix']); + ['id' => 5, + 'libelle' => 'Sainte Croix']); $this->fixture('Class_Bib', - ['id' => 6, - 'libelle' => 'Botten']); + ['id' => 6, + 'libelle' => 'Botten']); $this->dispatch('/opac/widget/render/widget_id/1/profile_id/23'); } - /** @test */ - public function widgetShouldBeHtml5Valid() { + public function widgetShouldBeHtml5Valid() + { $this->assertHTML5(); } - /** @test */ - public function sainteCroixShouldBeInMainPageForLg() { - $this->assertXPathContentContains('//div[contains(@class, "col-12 d-none d-lg-block")]//div[contains(@class, "multiple_carousel")]//div[@class="carousel-item active"]', - 'Sainte Croix'); + public function sainteCroixShouldBeInMainPageForLg() + { + $this->assertXPathContentContains('//div[@class="responsive_multiple_carousel responsive_carousel_plus container-fluid"]//div[@class= "responsive_multiple_carousel_xl col-12 d-none d-xl-block"]//div[contains(@class, "multiple_carousel")]//div[@class="carousel-item active"]', + 'Sainte Croix'); } - /** @test */ - public function echallensShouldBeInMdActive() { - $this->assertXPathContentContains('//div[contains(@class, "col-12 d-none d-md-block d-lg-none")]//div[contains(@class, "multiple_carousel")]//div[@class="carousel-item active"]', - 'Echallens'); + public function echallensShouldBeInMdActive() + { + $this->assertXPathContentContains('//div[@class= "responsive_multiple_carousel_md col-12 d-none d-md-block d-xl-none"]//div[contains(@class, "multiple_carousel")]//div[@class="carousel-item active"]', + 'Echallens'); } - /** @test */ - public function bottenShouldBeInSmActive() { - $this->assertXPathContentContains('//div[@class="col-12 d-block d-md-none"]//div[@class="carousel slide"]//div[@class="carousel-item active"]', - 'Botten'); + public function bottenShouldBeInSmActive() + { + $this->assertXPathContentContains('//div[@class="responsive_multiple_carousel_xs col-12 d-block d-md-none"]//div[@class="carousel slide"]//div[@class="carousel-item active"]', + 'Botten'); } } diff --git a/tests/scenarios/Templates/HerissonTemplateTest.php b/tests/scenarios/Templates/HerissonTemplateTest.php index 0fd78bd715a0fb5c414e07f18eed45f74c627224..86403b1565ebc502236f069f726aac65790433f3 100644 --- a/tests/scenarios/Templates/HerissonTemplateTest.php +++ b/tests/scenarios/Templates/HerissonTemplateTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -18,13 +19,12 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -abstract class HerissonTemplateTestCase extends AbstractControllerTestCase { - +abstract class HerissonTemplateTestCase extends AbstractControllerTestCase +{ protected $_current_profile; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $profile = $this->_buildTemplateProfil(['id' => 22]); @@ -35,225 +35,215 @@ abstract class HerissonTemplateTestCase extends AbstractControllerTestCase { $this->_current_profile = Class_Profil::find(Class_Profil::getCurrentProfil()->getId()); } - /** @test */ - public function templateHerissonShouldCurrentProfile() { + public function templateHerissonShouldCurrentProfile() + { $this->assertEquals('HERISSON', $this->_current_profile->getTemplate()); } - protected function _addFixtures() {} } - - - -class HerissonTemplateSubPagesTest extends HerissonTemplateTestCase { - +class HerissonTemplateSubPagesTest extends HerissonTemplateTestCase +{ /** @test */ - public function pageAgendaShouldBeCreated() { - $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), - 'libelle' => 'Agenda', + public function pageAgendaShouldBeCreated() + { + $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), + 'libelle' => 'Agenda', 'rewrite_url' => 'agenda'])); } - /** @test */ - public function pageSelectionsShouldBeCreated() { - $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), - 'libelle' => 'Sélections', + public function pageSelectionsShouldBeCreated() + { + $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), + 'libelle' => 'Sélections', 'rewrite_url' => 'selections'])); } - /** @test */ - public function pageEnLigneShouldBeCreated() { - $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), - 'libelle' => 'En ligne', + public function pageEnLigneShouldBeCreated() + { + $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), + 'libelle' => 'En ligne', 'rewrite_url' => 'en_ligne'])); } - /** @test */ - public function pageMentionsLegalesShouldBeCreated() { - $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), - 'libelle' => 'Mentions légales', + public function pageMentionsLegalesShouldBeCreated() + { + $this->assertNotNull(Class_Profil::findFirstBy(['parent_id' => $this->_current_profile->getId(), + 'libelle' => 'Mentions légales', 'rewrite_url' => 'mentions_legales'])); } - /** @test */ - public function footerShouldHaveBackgroundDarkChecked() { - $this->assertEquals(['boite' => [0 => 'background-dark'], - 'visibility' => '1', + public function footerShouldHaveBackgroundDarkChecked() + { + $this->assertEquals(['boite' => [0 => 'background-dark'], + 'visibility' => '1', 'HerissonWidthXsmall' => '12', - 'titre' => 'Division pied de page'], - (new Class_Template_ProfilePatcher_Profile($this->_current_profile)) - ->getFooterSettings()); + 'titre' => 'Division pied de page'], + (new Class_Template_ProfilePatcher_Profile($this->_current_profile)) + ->getFooterSettings()); } /** @test */ - public function profileShouldHaveDefaultFavico() { + public function profileShouldHaveDefaultFavico() + { $this->assertEquals('../Assets/images/favicon.ico', - $this->_current_profile->getFavicon()); + $this->_current_profile->getFavicon()); } } - - - -class HerissonTemplateRechercheViewNoticeHarryPotterTest extends HerissonTemplateTestCase { - - public function setUp(): void { +class HerissonTemplateRechercheViewNoticeHarryPotterTest extends HerissonTemplateTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture(Class_Bib::class, - ['id' => 3, - 'libelle' => 'Annecy', - 'lieu' => $this->fixture(Class_Lieu::class, - ['id' => 2, - 'libelle' => 'Bonlieu', - 'latitude' => 1, - 'longitude' => 1])]); + ['id' => 3, + 'libelle' => 'Annecy', + 'lieu' => $this->fixture(Class_Lieu::class, + ['id' => 2, + 'libelle' => 'Bonlieu', + 'latitude' => 1, + 'longitude' => 1])]); $this->fixture(Class_Notice::class, - ['id' => 23, - 'unimarc' => file_get_contents(__DIR__ . '/../../fixtures/dvd_potter.uni'), - 'exemplaires' => [ - $this->fixture(Class_Exemplaire::class, - ['id' => 2, - 'id_bib' => 3]) - ]]); + ['id' => 23, + 'unimarc' => file_get_contents(__DIR__ . '/../../fixtures/dvd_potter.uni'), + 'exemplaires' => [ + $this->fixture(Class_Exemplaire::class, + ['id' => 2, + 'id_bib' => 3]), + ]]); $this->dispatch('/noticeajax/resources/id/23'); } - /** @test */ - public function responseShouldContainsLinkToEnLirePlusAnnecy() { + public function responseShouldContainsLinkToEnLirePlusAnnecy() + { $this->assertXPathContentContains('//div[contains(@class, "items_wall")]//a[contains(@href, "/bib/en-lire-plus/id/3")]', - 'Annecy'); + 'Annecy'); } - /** @test */ - public function documentItemsShouldNotContainsMap() { + public function documentItemsShouldNotContainsMap() + { $this->assertNotXpath('//div[contains(@class, "items_map")]'); } } - - - -class HerissonTemplateIndexTest extends HerissonTemplateTestCase { - - public function setUp(): void { +class HerissonTemplateIndexTest extends HerissonTemplateTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/index'); } - /** @test */ - public function navigationAgendaEntryShouldHaveUrlAgenda() { + public function navigationAgendaEntryShouldHaveUrlAgenda() + { $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/agenda")]', 'Agenda'); } - /** @test */ - public function logoFooterUrlShouldBeRelative() { + public function logoFooterUrlShouldBeRelative() + { $this->assertXPath('//footer//img[@src="' . Class_Url::relative('/library/templates/Intonation/Assets/images/bokeh_focale.png') . '"]'); } - /** @test */ - public function herissonCssFileShouldBeLoaded() { + public function herissonCssFileShouldBeLoaded() + { $this->assertXPath('//link[contains(@href, "/library/templates/Herisson/Assets/css/herisson.css")]'); } } - - - -class HerissonTemplateMenuEntriesDispatchTest extends HerissonTemplateTestCase { - +class HerissonTemplateMenuEntriesDispatchTest extends HerissonTemplateTestCase +{ /** @test */ - public function menuEnLigneShouldBeActiveWhenDispatchingAccueilEnLigne() { + public function menuEnLigneShouldBeActiveWhenDispatchingAccueilEnLigne() + { $this->dispatch('/accueil/en_ligne'); $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/en_ligne")][@class="nav-link active_item active"]', 'En ligne'); } - /** @test */ - public function menuEnLigneShouldBeActiveWhenDispatchingEnLigne() { + public function menuEnLigneShouldBeActiveWhenDispatchingEnLigne() + { $this->dispatch('/en_ligne'); $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/en_ligne")][@class="nav-link active_item active"]', 'En ligne'); } - /** @test */ - public function menuEnLigneShouldBeActiveWhenDispatchingIdProfil25() { + public function menuEnLigneShouldBeActiveWhenDispatchingIdProfil25() + { $this->dispatch('/index/index/id_profil/' . Class_Profil::findFirstBy(['rewrite_url' => 'en_ligne'])->getId()); $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/en_ligne")][@class="nav-link active_item active"]', 'En ligne'); } - /** @test */ - public function menuRoseShouldBeActiveWhenDispatchingRose() { + public function menuRoseShouldBeActiveWhenDispatchingRose() + { $this->dispatch('/rose'); $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/rose")][@class="nav-link active_item active"]', 'Infos pratiques'); } - /** @test */ - public function menuRoseShouldBeActiveWhenDispatchingBibOuvertures() { + public function menuRoseShouldBeActiveWhenDispatchingBibOuvertures() + { $this->dispatch('/bib/ouvertures/id/789'); $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/rose")][@class="nav-link active_item active"]', 'Infos pratiques'); } - /** @test */ - public function menuAccueilShouldNotBeActiveWhenDispatchingRose() { + public function menuAccueilShouldNotBeActiveWhenDispatchingRose() + { $this->dispatch('/rose'); $this->assertNotXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/accueil")][@class="nav-link active_item active"]', 'Accueil'); } - /** @test */ - public function menuAccueilShouldNotBeActiveWhenDispatchingBibOuvertures() { + public function menuAccueilShouldNotBeActiveWhenDispatchingBibOuvertures() + { $this->dispatch('/bib/ouvertures/id/789'); $this->assertNotXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/accueil")][@class="nav-link active_item active"]', 'Accueil'); } - /** @test */ - public function menuAgendaShouldNotBeActiveWhenDispatchingRose() { + public function menuAgendaShouldNotBeActiveWhenDispatchingRose() + { $this->dispatch('/rose'); $this->assertNotXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/agenda")][@class="nav-link active_item active"]', 'Agenda'); } - - protected function _addFixtures() { + protected function _addFixtures() + { $this->fixture(Class_Bib::class, - ['id' => 789, - 'libelle' => 'Rose', - 'visibilite' => Class_Bib::V_NODATA, - 'rewrite_url' => 'rose']); + ['id' => 789, + 'libelle' => 'Rose', + 'visibilite' => Class_Bib::V_NODATA, + 'rewrite_url' => 'rose']); } } - - - -class HerissonTemplateSubProfilesRewriteUrlTest extends AbstractControllerTestCase { - - public function setUp(): void { +class HerissonTemplateSubProfilesRewriteUrlTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); - $profile = $this->_buildTemplateProfil(['id' => 21, - 'libelle' => 'accueil', + $profile = $this->_buildTemplateProfil(['id' => 21, + 'libelle' => 'accueil', 'rewrite_url' => 'agenda']); $profile = $this->_buildTemplateProfil(['id' => 22]); @@ -262,31 +252,30 @@ class HerissonTemplateSubProfilesRewriteUrlTest extends AbstractControllerTestCa $this->dispatch('/index'); } - /** @test */ - public function pageAgendaShouldNotHaveRewriteUrl() { + public function pageAgendaShouldNotHaveRewriteUrl() + { $this->assertEquals('', Class_Profil::findFirstBy(['libelle' => 'Agenda'])->getRewriteUrl()); } - /** @test */ - public function navigationAgendaEntryShouldNotHaveUrlAgenda() { + public function navigationAgendaEntryShouldNotHaveUrlAgenda() + { $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/id_profil/24")]', 'Agenda'); } - /** @test */ - public function loginWidgetUsernameShouldNotHaveSize() { + public function loginWidgetUsernameShouldNotHaveSize() + { $this->assertNotXPath('//header//div[contains(@class, "boite login")]//input[@name="username"][@size]'); } - /** @test */ - public function loginWidgetPasswordShouldNotHaveSize() { + public function loginWidgetPasswordShouldNotHaveSize() + { $this->assertNotXPath('//header//div[contains(@class, "boite login")]//input[@name="password"][@size]'); } - /** @test */ public function selectionEntryShouldBeInLibrariesMenu() { @@ -294,43 +283,39 @@ class HerissonTemplateSubProfilesRewriteUrlTest extends AbstractControllerTestCa } } - - - -class HerissonTemplateLibraryRewriteUrlTest extends AbstractControllerTestCase { - - public function setUp(): void { +class HerissonTemplateLibraryRewriteUrlTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); - $profile = $this->_buildTemplateProfil(['id' => 21, - 'libelle' => 'accueil', + $profile = $this->_buildTemplateProfil(['id' => 21, + 'libelle' => 'accueil', 'rewrite_url' => 'agenda']); $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Saint Jorioz', - 'visibilite' => Class_Bib::V_NODATA, - 'rewrite_url' => 'saint_jorioz' - ]); + ['id' => 1, + 'libelle' => 'Saint Jorioz', + 'visibilite' => Class_Bib::V_NODATA, + 'rewrite_url' => 'saint_jorioz', + ]); $profile = $this->_buildTemplateProfil(['id' => 22]); (new Herisson_Template)->tryOn($profile); $this->dispatch('/index'); } - /** @test */ - public function navigationLibraryEntryShouldContainsSaintJorioz() { + public function navigationLibraryEntryShouldContainsSaintJorioz() + { $this->assertXPathContentContains('//body//header//div[contains(@class, "boite nav")]//li//a[contains(@href,"/saint_jorioz")]', 'Infos pratiques'); } } - - - -class HerissonTemplateMentionsLegalesTest extends HerissonTemplateTestCase { - - public function setUp(): void { +class HerissonTemplateMentionsLegalesTest extends HerissonTemplateTestCase +{ + public function setUp(): void + { parent::setUp(); $profile = Class_Profil::findFirstBy(['libelle' => 'Mentions légales']); @@ -338,115 +323,111 @@ class HerissonTemplateMentionsLegalesTest extends HerissonTemplateTestCase { $this->dispatch('/index/index/id_profil/' . $profile->getId()); } - /** @test */ - public function articleMentionLegaleShouldHaveBeenCreated() { + public function articleMentionLegaleShouldHaveBeenCreated() + { $this->assertNotNull(Class_Article::findFirstBy(['titre' => 'Mentions légales'])); } - /** @test */ - public function articleMentionLegaleShouldBeInCategoryMagasinDeThemesHerisson() { + public function articleMentionLegaleShouldBeInCategoryMagasinDeThemesHerisson() + { $this->assertEquals('Herisson', - Class_Article::findFirstBy(['titre' => 'Mentions légales']) - ->getCategorieLibelle()); + Class_Article::findFirstBy(['titre' => 'Mentions légales']) + ->getCategorieLibelle()); } - /** @test */ - public function mentionsLegalesArticleContentShouldContainsGestionDesCookies() { + public function mentionsLegalesArticleContentShouldContainsGestionDesCookies() + { $this->assertContains('Gestion des cookies', - Class_Article::findFirstBy(['titre' => 'Mentions légales'])->getContenu()); + Class_Article::findFirstBy(['titre' => 'Mentions légales'])->getContenu()); } - /** @test */ - public function articleMentionsLegalesShouldBeInWidgetFree() { + public function articleMentionsLegalesShouldBeInWidgetFree() + { $this->assertXPathContentContains('//main//div[contains(@class, "boite free")]//h3', - 'Propriétaire du site'); + 'Propriétaire du site'); } } - - - -class HerissonTemplateDispatchRechercheViewnotice extends HerissonTemplateTestCase { - - public function setUp(): void { +class HerissonTemplateDispatchRechercheViewnotice extends HerissonTemplateTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture(Class_Notice::class, - ['id' => 987, - 'type_doc' => 1]); + ['id' => 987, + 'type_doc' => 1]); $this->dispatch('/recherche/viewnotice/id/987'); } - /** @test */ - public function tabMediaShouldNotBeInDOM() { + public function tabMediaShouldNotBeInDOM() + { $this->assertNotXPath('//div//li[contains(@class, "wrapper_document_media")]'); } - /** @test */ - public function divClassInspectorGadgetShouldNotBePresent() { + public function divClassInspectorGadgetShouldNotBePresent() + { $this->assertNotXPath('//div[@class="inspector_gadget"]'); } } - - - -class HerissonTemplateWithResponseMultipleCarouselTest extends HerissonTemplateTestCase { - - public function setUp(): void { +class HerissonTemplateWithResponseMultipleCarouselTest extends HerissonTemplateTestCase +{ + public function setUp(): void + { parent::setUp(); $profile_patcher = (new Class_Template_ProfilePatcher(null)) ->setProfile($this->_current_profile); $this->fixture(Class_Notice::class, - ['id' => 1, - ]); + ['id' => 1, + ]); $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'layout' => 'multiple_carousel_plus', - 'size' => 1]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'layout' => 'multiple_carousel_plus', + 'size' => 1]); $this->dispatch('/index'); } - /** @test */ - public function widgetResponsiveMultipleCarouselPlusShouldBePresent() { + public function widgetResponsiveMultipleCarouselPlusShouldBePresent() + { $this->assertXPath('//main//div[@class="boite kiosque no_border_widget no_border_radius no_shadow mx-auto background-light py-3 my-3 px-9 no_overlay widget col-11 col-md-12 card"]//div[contains(@class, "responsive_multiple_carousel")]'); } - /** @test */ - public function widgetResponsiveMultipleCarouselPlusShouldContainsMultipleCarouselForLg() { - $this->assertXPath('//main//div[@class="boite kiosque no_border_widget no_border_radius no_shadow mx-auto background-light py-3 my-3 px-9 no_overlay widget col-11 col-md-12 card"]//div[contains(@class, "responsive_multiple_carousel")]//div[contains(@class, "col-12 d-none d-lg-block")]//div[contains(@class, "carousel slide multiple_carousel")]//div[@class="card_grid"]'); + public function widgetResponsiveMultipleCarouselPlusShouldContainsMultipleCarouselForLg() + { + $this->assertXPath('//main//div[@class="boite kiosque no_border_widget no_border_radius no_shadow mx-auto background-light py-3 my-3 px-9 no_overlay widget col-11 col-md-12 card"]//div[contains(@class, "responsive_multiple_carousel")]//div[contains(@class, "col-12 d-none d-xl-block")]//div[contains(@class, "carousel slide multiple_carousel")]//div[@class="card_grid"]'); } - /** @test */ - public function widgetResponsiveMultipleCarouselPlusShouldContainsMultipleCarouselForMd() { - $this->assertXPath('//main//div[@class="boite kiosque no_border_widget no_border_radius no_shadow mx-auto background-light py-3 my-3 px-9 no_overlay widget col-11 col-md-12 card"]//div[contains(@class, "responsive_multiple_carousel")]//div[contains(@class, "col-12 d-none d-md-block d-lg-none")]//div[contains(@class, "carousel slide multiple_carousel")]'); + public function widgetResponsiveMultipleCarouselPlusShouldContainsMultipleCarouselForMd() + { + $this->assertXPath('//main//div[@class="boite kiosque no_border_widget no_border_radius no_shadow mx-auto background-light py-3 my-3 px-9 no_overlay widget col-11 col-md-12 card"]//div[contains(@class, "responsive_multiple_carousel")]//div[contains(@class, "col-12 d-none d-md-block d-xl-none")]//div[contains(@class, "carousel slide multiple_carousel")]'); } - /** @test */ - public function widgetResponsiveMultipleCarouselPlusShouldContainsCarouselForSmall() { + public function widgetResponsiveMultipleCarouselPlusShouldContainsCarouselForSmall() + { $this->assertXPath('//main//div[@class="boite kiosque no_border_widget no_border_radius no_shadow mx-auto background-light py-3 my-3 px-9 no_overlay widget col-11 col-md-12 card"]//div[contains(@class, "responsive_multiple_carousel")]//div[contains(@class, "col-12 d-block d-md-none")]//div[contains(@class, "carousel slide")]'); } - /** @test */ - public function indexAsAdminShouldContainsHeartbeatScript() { + public function indexAsAdminShouldContainsHeartbeatScript() + { $this->assertXPathContentContains('//script', '/admin/index/heartbeat", function() {setTimeout(heartbeat, 60000);}); })();'); } } diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index 118139c8c26b8edc38b15dc4e70801eb9686729a..cbd2e4834849b7cf53e18284170e71156d203e95 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -20,29 +21,32 @@ */ require_once 'TemplatesTest.php'; -include_once 'tests/fixtures/NanookFixtures.php'; -abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTestCase { +include_once 'tests/fixtures/NanookFixtures.php'; - protected $_mock_emprunts, $_emprunteur; +abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTestCase +{ + protected $_mock_emprunts; + protected $_emprunteur; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $item = $this->fixture(Class_Exemplaire::class, - ['id' => 967, - 'code_barres' => 123, - 'id_int_bib' => 1, - 'id_origine' => 1234, - 'zone995' => serialize([['code' => 'a', 'valeur' => 'PotterItem'], - ['code' => 'v', 'valeur' => '7'], - ['code' => 'h', 'valeur' => 'Numero 23']]), - 'notice' => $this->fixture(Class_Notice::class, - ['id' => 889, - 'titre_principal' => 'Potter', - 'type_doc' => Class_TypeDoc::LIVRE, - 'url_image' => 'https://monimage.org', - 'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103 aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm'])]); + ['id' => 967, + 'code_barres' => 123, + 'id_int_bib' => 1, + 'id_origine' => 1234, + 'zone995' => serialize([['code' => 'a', 'valeur' => 'PotterItem'], + ['code' => 'v', 'valeur' => '7'], + ['code' => 'h', 'valeur' => 'Numero 23']]), + 'notice' => $this->fixture(Class_Notice::class, + ['id' => 889, + 'titre_principal' => 'Potter', + 'type_doc' => Class_TypeDoc::LIVRE, + 'url_image' => 'https://monimage.org', + 'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103 aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm'])]); $potter = new Class_WebService_SIGB_Emprunt('12', new Class_WebService_SIGB_Exemplaire(123)); $potter @@ -55,11 +59,11 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes $potter ->parseExtraAttributes(['Dateretourprevue' => '29/10/1990', - 'Section' => 'Espace jeunesse', - 'Auteur' => 'JK Rowling', - 'Bibliotheque' => 'Astrolabe', - 'N° de notice' => '1234', - 'Type' => 'P1']); + 'Section' => 'Espace jeunesse', + 'Auteur' => 'JK Rowling', + 'Bibliotheque' => 'Astrolabe', + 'N° de notice' => '1234', + 'Type' => 'P1']); $alice = new Class_WebService_SIGB_Emprunt('13', new Class_WebService_SIGB_Exemplaire(456)); $alice @@ -68,82 +72,82 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes ->setIssueDate('01/08/2001') ->setTitre('Alice') ->setExemplaireOPAC($this->fixture(Class_Exemplaire::class, - ['id' => 918, - 'id_origine' => 5678, - 'code_barres' => 124, - 'id_int_bib' => 1, - 'zone995' => serialize([['clef' => 'a', 'valeur' => 'AliceItem']]), - 'notice' => $this->fixture(Class_Notice::class, - ['id' => 827, - 'titre_principal' => 'Alice', - 'unimarc' => '01175cam0 22002771 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrèfleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la forêt aux portes, Alice tombe nez ànez avec Ace. Devenue malgré elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assisté àla scène, intervient, la rencontre tourne àl\'affrontement. b9782355926358 1tAlice au royaume de Trèfle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR'])])); + ['id' => 918, + 'id_origine' => 5678, + 'code_barres' => 124, + 'id_int_bib' => 1, + 'zone995' => serialize([['clef' => 'a', 'valeur' => 'AliceItem']]), + 'notice' => $this->fixture(Class_Notice::class, + ['id' => 827, + 'titre_principal' => 'Alice', + 'unimarc' => '01175cam0 22002771 450 001001500000010003700015100004100052101000800093102000700101105001800108106000600126200009300132210002400225211001300249215006400262300002400326307002900350330027300379345001800652461005600670700001800726701003000744801003300774856008300807940000700890frOr0354235228 a978-2-35592-635-8bbr.d7,65 EUR a20140225d2014 | |0fre|0103||||ba afre aFR a 0||y| ar1 aAlice au royaume de TrèfleeCheshire cat Waltzh5fQuinRosegdessin Mamenosuke Fujimaru aPariscKi-oond2014 1a20140227 a1 vol. (164 p.)cillustrations en noir et blancd18 x 13 cm aTraduit du japonais aSens de lecture japonais aPerdue dans la forêt aux portes, Alice tombe nez ànez avec Ace. Devenue malgré elle la confidente du chevalier, elle ne sait comment repousser ses avances. Lorsque le chat du Cheshire, qui a assisté àla scène, intervient, la rencontre tourne àl\'affrontement. b9782355926358 1tAlice au royaume de Trèfle : Cheshire cat Waltzv5 1aQuinRose4070 1aFujimarubMamenosuke4440 aFRbElectrec20140225gAFNOR uhttp://www.electre.com//GetBlob.ashx?Ean=9782355926358,0-1913692&Size=Original aLR'])])); $alice->parseExtraAttributes(['Dateretourprevue' => '21/10/2010', - 'Section' => 'Espace jeunesse', - 'Auteur' => 'Lewis Caroll', - 'Bibliotheque' => 'Almont', - 'N° de notice' => '5678']); + 'Section' => 'Espace jeunesse', + 'Auteur' => 'Lewis Caroll', + 'Bibliotheque' => 'Almont', + 'N° de notice' => '5678']); $this->fixture(Class_Exemplaire::class, - ['id' => 918, - 'id_origine' => 5678, - 'code_barres' => 124, - 'id_int_bib' => 1, - 'zone995' => serialize([['clef' => 'a', 'valeur' => 'AliceItem']]), - 'notice' => $this->fixture(Class_Notice::class, - ['id' => 827, - 'titre_principal' => 'Alice', - 'type_doc' => 1])]); + ['id' => 918, + 'id_origine' => 5678, + 'code_barres' => 124, + 'id_int_bib' => 1, + 'zone995' => serialize([['clef' => 'a', 'valeur' => 'AliceItem']]), + 'notice' => $this->fixture(Class_Notice::class, + ['id' => 827, + 'titre_principal' => 'Alice', + 'type_doc' => 1])]); (new Class_Profil_ItemsSettings(Class_Profil::find(72))) - ->setSettings(['datas_items_code' => ['h'], + ->setSettings(['datas_items_code' => ['h'], 'datas_items_label' => ['Périodique :']]); $this->fixture(Class_IntProfilDonnees::class, - ['id' => 22, - 'attributs' => serialize([0 => ['item_numero_periodique' => 'h', - 'item_label_numero_periodique' => ' : ']]) - ]); + ['id' => 22, + 'attributs' => serialize([0 => ['item_numero_periodique' => 'h', + 'item_label_numero_periodique' => ' : ']]), + ]); $exemplaire_dobby = $this->fixture(Class_Exemplaire::class, - ['id' => 12089, - 'code_barres' => 123, - 'id_int_bib' => 1, - 'zone_995' => serialize([['code' => 'a', 'valeur' => 'Dobby'], - ['code' => 'v', 'valeur' => '7'], - ['code' => 'h', 'valeur' => 'Numero 23']]), - 'id_notice' => 820]); + ['id' => 12089, + 'code_barres' => 123, + 'id_int_bib' => 1, + 'zone_995' => serialize([['code' => 'a', 'valeur' => 'Dobby'], + ['code' => 'v', 'valeur' => '7'], + ['code' => 'h', 'valeur' => 'Numero 23']]), + 'id_notice' => 820]); $exemplaire_troy = $this->fixture(Class_Exemplaire::class, - ['id' => 12090, - 'code_barres' => 123, - 'id_int_bib' => 1, - 'id_notice' => 820]); + ['id' => 12090, + 'code_barres' => 123, + 'id_int_bib' => 1, + 'id_notice' => 820]); $this->fixture(Class_Notice::class, - ['id' => 820, - 'titre_principal' => 'Dobby', - 'type_doc' => Class_TypeDoc::DVD, - 'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103 aEng1 aDobby Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm']); + ['id' => 820, + 'titre_principal' => 'Dobby', + 'type_doc' => Class_TypeDoc::DVD, + 'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103 aEng1 aDobby Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm']); $dobby = (new Class_WebService_SIGB_Reservation('12', - (new Class_WebService_SIGB_Exemplaire(999123)) - ->setTitre('Dobby') - ->setExemplaireOPAC($exemplaire_dobby))) - ->parseExtraAttributes(['Etat' => 'Réservation émise', - 'Rang' => '2', - 'Bibliotheque' => 'Tombouctou', + (new Class_WebService_SIGB_Exemplaire(999123)) + ->setTitre('Dobby') + ->setExemplaireOPAC($exemplaire_dobby))) + ->parseExtraAttributes(['Etat' => 'Réservation émise', + 'Rang' => '2', + 'Bibliotheque' => 'Tombouctou', 'N° de notice' => 564]); $troy = (new Class_WebService_SIGB_Reservation('13', - (new Class_WebService_SIGB_Exemplaire(888123)) - ->setTitre('Dobby') - ->setExemplaireOPAC($exemplaire_troy))) - ->parseExtraAttributes(['Etat' => 'Prêt', - 'Rang' => '1', - 'Bibliotheque' => 'Tombouctou', + (new Class_WebService_SIGB_Exemplaire(888123)) + ->setTitre('Dobby') + ->setExemplaireOPAC($exemplaire_troy))) + ->parseExtraAttributes(['Etat' => 'Prêt', + 'Rang' => '1', + 'Bibliotheque' => 'Tombouctou', 'N° de notice' => 564]); $dobby->setAvailabilityEndDate('2020-06-06'); @@ -153,9 +157,9 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes ->setWaitingToBePulled(); $this->fixture(Class_CodifAnnexe::class, - ['id' => 15, - 'libelle' => 'Istres', - 'id_origine' => 'IST']); + ['id' => 15, + 'libelle' => 'Istres', + 'id_origine' => 'IST']); $this->_emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Florence'); $this->_emprunteur @@ -172,74 +176,74 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes ->setOrdreabon('1') ->setDateFin('2020/01/01') ->setFicheSigb(['type_comm' => 2, - 'fiche' => $this->_emprunteur, - 'erreur' => '']) + 'fiche' => $this->_emprunteur, + 'erreur' => '']) ->setPseudo('Paul') ->beAbonneSIGB(); $this->fixture(Class_Notice::class, - ['id' => 10, - 'titre_principal' => 'Le combat ordinaire', - 'clef_alpha' => 'COMBAT ORDINAIRE']); + ['id' => 10, + 'titre_principal' => 'Le combat ordinaire', + 'clef_alpha' => 'COMBAT ORDINAIRE']); $this->fixture(Class_Notice::class, - ['id' => 12, - 'titre_principal' => 'Blacksad', - 'clef_alpha' => 'BLACKSAD']); + ['id' => 12, + 'titre_principal' => 'Blacksad', + 'clef_alpha' => 'BLACKSAD']); $libre_domain = $this->fixture(Class_Catalogue::class, - ['id' => 1, - 'libelle' => 'Libre']); + ['id' => 1, + 'libelle' => 'Libre']); $mes_bd = $this->fixture(Class_PanierNotice::class, - ['id' => 2, - 'id_panier' => 1, - 'libelle' => 'Mes BD', - 'date_maj' => '10/02/2011', - 'notices' => 'COMBAT ORDINAIRE;BLACKSAD', - 'user' => $current_user]); + ['id' => 2, + 'id_panier' => 1, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011', + 'notices' => 'COMBAT ORDINAIRE;BLACKSAD', + 'user' => $current_user]); $mes_bd->setCatalogues([$libre_domain]); $criteres_potter = (new Class_CriteresRecherche) ->setParams(['expressionRecherche' => 'Harry Potter', - 'page' => 2]); + 'page' => 2]); $this->fixture(Class_User_BookmarkedSearch::class, - ['id' => 5, - 'id_user' => $current_user->getId(), - 'label' => 'Potter', - 'criterias' => serialize($criteres_potter), - 'creation_date' => '2020-01-17 15:05:57']); + ['id' => 5, + 'id_user' => $current_user->getId(), + 'label' => 'Potter', + 'criterias' => serialize($criteres_potter), + 'creation_date' => '2020-01-17 15:05:57']); $this->fixture(Class_AvisNotice::class, - ['id' => 4, - 'id_user' => 666, - 'id_notice' => 20090, - 'clef_oeuvre' => 'PSYKO', - 'note' => '4', - 'entete' => 'Le Roi', - 'avis' => 'Le Roi des cons sur son throne', - 'source_author' => null]); + ['id' => 4, + 'id_user' => 666, + 'id_notice' => 20090, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi', + 'avis' => 'Le Roi des cons sur son throne', + 'source_author' => null]); $this->fixture(Class_Notice::class, - ['id' => 20090, - 'url_vignette' => '404.jpg', - 'clef_oeuvre' => 'PSYKO', - ]) + ['id' => 20090, + 'url_vignette' => '404.jpg', + 'clef_oeuvre' => 'PSYKO', + ]) ->setTitrePrincipal('Psykoooo'); $newsletter = $this->fixture(Class_Newsletter::class, - ['id' => 45, - 'titre' => 'Les nouveautés', - 'mail_subject' => 'nouveautés', - 'contenu' => 'test de newsletter: http://monurl.newsletter.fr. http://mon-domain.org']); + ['id' => 45, + 'titre' => 'Les nouveautés', + 'mail_subject' => 'nouveautés', + 'contenu' => 'test de newsletter: http://monurl.newsletter.fr. http://mon-domain.org']); $this->fixture(Class_Newsletter::class, - ['id' => 46, - 'titre' => 'Les coups de coeur', - 'mail_subject' => 'coups de coeurs', - 'contenu' => 'On a aimé: http://monurl.newsletter.fr. http://mon-domain.org']); + ['id' => 46, + 'titre' => 'Les coups de coeur', + 'mail_subject' => 'coups de coeurs', + 'contenu' => 'On a aimé: http://monurl.newsletter.fr. http://mon-domain.org']); $current_user->setNewsletters([$newsletter]); @@ -265,375 +269,356 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes Class_WebService_BibNumerique_Dilicom_Hub::setDefaultHttpClient($http); $pnb_album = $this->fixture(Class_Album::class, - ['id' => 543, - 'titre' => 'Dr House', - 'visible' => 1, - 'status' => 3, - 'id_origine' => 'Dilicom-3663608260879']); - $pnb_album->addNote('330$a',"LCP"); + ['id' => 543, + 'titre' => 'Dr House', + 'visible' => 1, + 'status' => 3, + 'id_origine' => 'Dilicom-3663608260879']); + $pnb_album->addNote('330$a', 'LCP'); $pnb_album->index(); $this->fixture(Class_Loan_Pnb::class, - ['id' => 3, - 'record_origin_id' => 'Dilicom-3663608260879', - 'subscriber_id' => '', - 'album' => $pnb_album, - 'user_id' => $current_user->getId(), - 'expected_return_date' => '2017-12-13 13:57:33', - 'loan_date' => '2017-11-13 13:57:33', - 'loan_link' => 'https://pnb-dilicom.centprod.com/v2//XXXXXXXX.do', - 'order_line_id' => '584837a045ce56ef0a072a8b']); + ['id' => 3, + 'record_origin_id' => 'Dilicom-3663608260879', + 'subscriber_id' => '', + 'album' => $pnb_album, + 'user_id' => $current_user->getId(), + 'expected_return_date' => '2017-12-13 13:57:33', + 'loan_date' => '2017-11-13 13:57:33', + 'loan_link' => 'https://pnb-dilicom.centprod.com/v2//XXXXXXXX.do', + 'order_line_id' => '584837a045ce56ef0a072a8b']); $membership = $this->fixture(Class_Membership::class, - [ 'id' => 1, - 'code' => 1, - 'libelle' => 'Abonné adulte', - 'enabled' => 1 - ]); + [ 'id' => 1, + 'code' => 1, + 'libelle' => 'Abonné adulte', + 'enabled' => 1, + ]); $this->fixture(Class_User_Membership::class, - [ 'id' => 1, - 'user' => $current_user, - 'membership' => $membership, - 'start_date' => '2012-01-01', - 'end_date' => '2020-01-01' - ]); + [ 'id' => 1, + 'user' => $current_user, + 'membership' => $membership, + 'start_date' => '2012-01-01', + 'end_date' => '2020-01-01', + ]); } } - - - -class TemplatesDispatchAbonneLoansTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesDispatchAbonneLoansTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/prets/id_profil/72'); } - /** @test */ - public function pageShouldContainsScriptToAjaxLoadLoans() { + public function pageShouldContainsScriptToAjaxLoadLoans() + { $this->assertXPathContentContains('//script', 'load("/abonne/ajax-loans/id_profil/72'); } - /** @test */ - public function pageShouldContainsSpinnerAsLoadingIcon() { + public function pageShouldContainsSpinnerAsLoadingIcon() + { $this->assertXPath('//div[@class="loading_icon spinner-border"]'); } - /** @test */ - public function scriptShouldContainsNoLoanMessage() { + public function scriptShouldContainsNoLoanMessage() + { $this->assertXPathContentContains('//script', '$(\'div.user_loans.wrapper_active:not(.hidde_content)\').parent().prepend(\'<p class="empty_list user_loans">Pas de pr'); } } - - - -abstract class TemplatesAbonnePaginatedCollectionsTestCase - extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +abstract class TemplatesAbonnePaginatedCollectionsTestCase extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Storm_Cache::beVolatile(); - $this->_dispatch(((new Intonation_Library_PaginatedCollectionHelper) - ->setCollection(new Storm_Collection($this->_getModels())))); + $this->_dispatch((new Intonation_Library_PaginatedCollectionHelper) + ->setCollection(new Storm_Collection($this->_getModels()))); } - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { $this->dispatch('/opac/index/ajax-paginated-list/page/2/id/' . $helper->getId()); } - - abstract protected function _getModels() : array ; + abstract protected function _getModels(): array; } - - - -class TemplatesDispatchAbonneLoansWithParamTest extends TemplatesIntonationAccountTestCase { - public function setUp(): void { +class TemplatesDispatchAbonneLoansWithParamTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/prets/search/late'); } - /** @test */ - public function pageShouldContainsScriptToAjaxLoadLoans() { + public function pageShouldContainsScriptToAjaxLoadLoans() + { $this->assertXPathContentContains('//script', 'load("/abonne/ajax-loans/id_profil/72/id/666/search/late'); } } - - - -class TemplatesAbonnePaginatedLoansPage2Test extends TemplatesAbonnePaginatedCollectionsTestCase { - +class TemplatesAbonnePaginatedLoansPage2Test extends TemplatesAbonnePaginatedCollectionsTestCase +{ public $view; protected $_response; - protected function _getModels() : array { - $cards = new Class_User_Cards(Class_Users::getIdentity()); - $loans = $cards->getLoansWithOutPNB([]); - - return array_map(fn($loan) => (new Intonation_Library_View_Wrapper_Loan) - ->setModel($loan) - ->setView($this->view), - $loans->getArrayCopy()); - } - /** @test */ - public function shouldContainsSearchInputWithIdInput() { + public function shouldContainsSearchInputWithIdInput() + { if (version_compare(PHP_VERSION, '8.0.0') >= 0) return $this->assertXPath('//div//form//input[@id="search_95a626ccbdc835a9c1b576a22ded8ce2"]', - $this->_response->getBody()); + $this->_response->getBody()); $this->assertXPath('//div//form//input[@id="search_4cbc1595413833d813be187b5880a8c2"]', - $this->_response->getBody()); + $this->_response->getBody()); + return null; } -} - - - - -class TemplatesAbonnePaginatedReviewsPage2Test - extends TemplatesAbonnePaginatedCollectionsTestCase { - - public $view; - protected function _getModels() : array { - $this->fixture(Class_AvisNotice::class, - ['id' => 4, - 'id_user' => 666, - 'id_notice' => 2, - 'clef_oeuvre' => 'PSYKO', - 'note' => '4', - 'entete' => 'Le Roi', - 'avis' => 'Le Roi des cons sur son throne', - 'source_author' => null]); - - $this->fixture(Class_AvisNotice::class, - ['id' => 5, - 'id_user' => 666, - 'id_notice' => 3, - 'clef_oeuvre' => 'PSYKO', - 'note' => '4', - 'entete' => 'Le Roi des cons avec sa couronne', - 'avis' => 'Le Roi des cons avec sa couronne', - 'source_author' => null]); - - $this->fixture(Class_Notice::class, - ['id' => 2, - 'clef_oeuvre' => 'PSYKO']); - $this->fixture(Class_Notice::class, - ['id' => 3, - 'clef_oeuvre' => 'PSYKOTIC']); + protected function _getModels(): array + { + $cards = new Class_User_Cards(Class_Users::getIdentity()); + $loans = $cards->getLoansWithOutPNB([]); - return array_map(fn($review) => (new Intonation_Library_View_Wrapper_ReviewsByRecord) - ->setModel($review) + return array_map(fn($loan) => (new Intonation_Library_View_Wrapper_Loan) + ->setModel($loan) ->setView($this->view), - Class_AvisNotice::groupByRecords(Class_AvisNotice::findAll())); - } - - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { - $this->dispatch('/opac/index/ajax-paginated-list/page/2/size/1/search/roi/id/' - . $helper->getId()); + $loans->getArrayCopy()); } +} +class TemplatesAbonnePaginatedReviewsPage2Test extends TemplatesAbonnePaginatedCollectionsTestCase +{ + public $view; /** @test */ - public function shouldContainsSearchInputWithIdInputD751713988987e9331980363e24189ce() { + public function shouldContainsSearchInputWithIdInputD751713988987e9331980363e24189ce() + { $this->assertXPath('//div//input[@id="search_db436b32a1026df5398c4c8e32b1c51b"]'); } - /** @test */ - public function pageSizeSelectedShouldEqualToSizeUrlParam() { + public function pageSizeSelectedShouldEqualToSizeUrlParam() + { $this->assertXPath('//div//form//select/option[@label="1"][@value=1][@selected]'); } - /** @test */ - public function inputSearchShouldHaveValueEqualToSearchUrlParam() { + public function inputSearchShouldHaveValueEqualToSearchUrlParam() + { $this->assertXPath('//div//form//input[contains(@class, "ajax_search")][@value="roi"]'); } - /** @test */ - public function shouldContainsReviewWithContentAvecSaCouronne() { + public function shouldContainsReviewWithContentAvecSaCouronne() + { $this->assertXPathContentContains('//div[@class="list-group bg-transparent no_border"]//div[@class= "list-group-item bg-transparent px-0 mb-3"]//div[@class= "card_body card_body_Intonation_Library_View_Wrapper_ReviewInRecord card-body pb-1"]//div[@class="model_description_Class_AvisNotice"]', - 'avec sa couronne'); + 'avec sa couronne'); } - /** @test */ - public function defaultRenderingShouldBeList() { + public function defaultRenderingShouldBeList() + { $this->assertXPath('//div[@class="list-group bg-transparent no_border"]'); } - /** @test */ - public function defaultLayoutShouldBeCardHorizontal() { + public function defaultLayoutShouldBeCardHorizontal() + { $this->assertXPath('//div[@class="list-group bg-transparent no_border"]//div[@class="cardify_horizontal_img col-12 col-md-4 col-lg-3 px-0 pl-md-0 pr-md-3"]'); } -} - + protected function _getModels(): array + { + $this->fixture(Class_AvisNotice::class, + ['id' => 4, + 'id_user' => 666, + 'id_notice' => 2, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi', + 'avis' => 'Le Roi des cons sur son throne', + 'source_author' => null]); + $this->fixture(Class_AvisNotice::class, + ['id' => 5, + 'id_user' => 666, + 'id_notice' => 3, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi des cons avec sa couronne', + 'avis' => 'Le Roi des cons avec sa couronne', + 'source_author' => null]); -class TemplatesAbonnePaginatedLoansPage1AndSearchTest - extends TemplatesAbonnePaginatedCollectionsTestCase { + $this->fixture(Class_Notice::class, + ['id' => 2, + 'clef_oeuvre' => 'PSYKO']); - public $view; - protected function _getModels() : array { - $cards = new Class_User_Cards(Class_Users::getIdentity()); - $loans = $cards->getPNBLoans([]); + $this->fixture(Class_Notice::class, + ['id' => 3, + 'clef_oeuvre' => 'PSYKOTIC']); - return array_map(fn($loan) => (new Intonation_Library_View_Wrapper_PNBLoan) - ->setModel($loan) + return array_map(fn($review) => (new Intonation_Library_View_Wrapper_ReviewsByRecord) + ->setModel($review) ->setView($this->view), - $loans->getArrayCopy()); + Class_AvisNotice::groupByRecords(Class_AvisNotice::findAll())); } - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { - $this->dispatch('/opac/index/ajax-paginated-list/page/1/search/house/size/10/id/' . $helper->getId()); + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { + $this->dispatch('/opac/index/ajax-paginated-list/page/2/size/1/search/roi/id/' + . $helper->getId()); } +} +class TemplatesAbonnePaginatedLoansPage1AndSearchTest extends TemplatesAbonnePaginatedCollectionsTestCase +{ + public $view; /** @test */ - public function loanTitleShouldBeAnAnchorToViewnoticeWithDrHouse() { + public function loanTitleShouldBeAnAnchorToViewnoticeWithDrHouse() + { $this->assertXPathContentContains('//div[@class="card-title card_title card_title_Intonation_Library_View_Wrapper_PNBLoan"]/a[@href= "/recherche/viewnotice/clef/DRHOUSE------101/id/20091/page/1"]', - 'Dr House'); + 'Dr House'); } - /** @test */ - public function linkToReturnPnbLoanShouldBePresent() { + public function linkToReturnPnbLoanShouldBePresent() + { $this->assertXPathContentContains('//div[@class="card_action col col-lg-12 p-0 mx-1 my-1"]/a[@href= "/bib-numerique/return-pnb-loan/page/1/search/house/size/10/id/ec2c17cefacacad7f25f875ae87956c1/loan_id/666_3"]', - Class_CharSet::fromISOtoUTF8('Retour anticipé')); + Class_CharSet::fromISOtoUTF8('Retour anticipé')); } - /** @test */ - public function linkToExtendPnbLoanShouldBePresent() { + public function linkToExtendPnbLoanShouldBePresent() + { $this->assertXPathContentContains('//div[@class="card_action col col-lg-12 p-0 mx-1 my-1"]/a[contains(@href, "/bib-numerique/extends-pnb-loan/page/1/search/house/size/10/id/ec2c17cefacacad7f25f875ae87956c1/loan_id/666_3")]', - 'Prolonger'); + 'Prolonger'); } -} - + protected function _getModels(): array + { + $cards = new Class_User_Cards(Class_Users::getIdentity()); + $loans = $cards->getPNBLoans([]); - -class TemplatesAbonnePaginatedCollectionWithNoResultTest - extends TemplatesAbonnePaginatedLoansPage2Test { - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { - $this->dispatch('/opac/index/ajax-paginated-list/size/1/page/1/search/no+data/id/' - . $helper->getId()); + return array_map(fn($loan) => (new Intonation_Library_View_Wrapper_PNBLoan) + ->setModel($loan) + ->setView($this->view), + $loans->getArrayCopy()); } + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { + $this->dispatch('/opac/index/ajax-paginated-list/page/1/search/house/size/10/id/' . $helper->getId()); + } +} +class TemplatesAbonnePaginatedCollectionWithNoResultTest extends TemplatesAbonnePaginatedLoansPage2Test +{ /** @test */ - public function noElementMessageShouldBePresentInSizeToolbar() { + public function noElementMessageShouldBePresentInSizeToolbar() + { $this->assertXPathContentContains('//div[@class="truncate_list_size_wrapper col-12 col-sm-3"]/span[@class="truncate_list_size btn btn-sm btn-info"]', - Class_CharSet::fromISOtoUTF8('Pas d\'élément')); + Class_CharSet::fromISOtoUTF8('Pas d\'élément')); } - /** @test */ - public function noElementMessageShouldBePresentInCollectionContent() { + public function noElementMessageShouldBePresentInCollectionContent() + { $this->assertXPathContentContains('//div[@class="paginated_collection col-12 mt-3 list-group bg-transparent no_border"]/p[@class="empty_list_message text-warning px-4"]', - 'Aucun document'); + 'Aucun document'); } -} - + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { + $this->dispatch('/opac/index/ajax-paginated-list/size/1/page/1/search/no+data/id/' + . $helper->getId()); + } +} - -class TemplatesAbonneDispatchAjaxLoansTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchAjaxLoansTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); } - /** @test */ - public function ajaxLoanAliceShouldDisplayButtonToutProlonger() { + public function ajaxLoanAliceShouldDisplayButtonToutProlonger() + { $this->assertXPathContentContains('//div[@class = "d-none d-md-inline text-left button_text"]', 'Tout prolonger'); } - /** @test */ - public function badgeShouldContainsNumero23() { + public function badgeShouldContainsNumero23() + { $this->assertXPathContentContains('//div//span[contains(@class,"datas_items_995_h")]', - 'Numero 23'); + 'Numero 23'); } - /** @test */ - public function shouldContainsLoanAlice() { + public function shouldContainsLoanAlice() + { $this->assertXPathContentContains('//div', 'Alice'); } - /** @test */ - public function shouldContainsLoanDrHouse() { + public function shouldContainsLoanDrHouse() + { $this->assertXPathContentContains('//div', 'Dr House'); } - /** @test */ - public function ajaxLoansShouldNotDisplayTitleHistoriqueDesPrets() { + public function ajaxLoansShouldNotDisplayTitleHistoriqueDesPrets() + { $this->assertNotXPathContentContains('//h3', 'Historique des prêts'); } - /** @test */ - public function shouldNotContainsLoanHistoryPottifar() { + public function shouldNotContainsLoanHistoryPottifar() + { $this->assertNotXPathContentContains('//div', 'Pottifar'); } - /** @test */ - public function shouldHaveBadgeDéjà Prolongé1Fois() { + public function shouldHaveBadgeDéjà Prolongé1Fois() + { $this->assertXPathContentContains('//span[contains(@class,"loan_renewed")]', Class_CharSet::fromISOtoUTF8('Déjà prolongé 1 fois')); } } - - - -abstract class TemplatesAbonneDispatchWithILSChildCardTestCase - extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +abstract class TemplatesAbonneDispatchWithILSChildCardTestCase extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture(Class_Users::class, - ['id' => 42, - 'role_level' => 2, - 'idabon' => 123456, - 'id_sigb' => 12738917239, - 'login' => 123456, - 'id_int_bib' => 1, - 'id_site' => 1, - 'password' => 123456, - 'nom' => 'Patronymique', - 'prenom' => 'handi', - 'ordreabon' => 12 - ]); + ['id' => 42, + 'role_level' => 2, + 'idabon' => 123456, + 'id_sigb' => 12738917239, + 'login' => 123456, + 'id_int_bib' => 1, + 'id_site' => 1, + 'password' => 123456, + 'nom' => 'Patronymique', + 'prenom' => 'handi', + 'ordreabon' => 12, + ]); $web_client = (new Class_Testing_WebService_SimpleWebClient) @@ -646,159 +631,148 @@ abstract class TemplatesAbonneDispatchWithILSChildCardTestCase ->setWebClient($web_client); $params = ['url_serveur' => 'http://localhost:8080/afi_Nanook/ilsdi/', - 'id_bib' => 1, - 'type' => Class_IntBib::COM_NANOOK]; + 'id_bib' => 1, + 'type' => Class_IntBib::COM_NANOOK]; $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Bibliothèque' - ]); + ['id' => 1, + 'libelle' => 'Bibliothèque', + ]); $this->fixture(Class_IntBib::class, - ['id' => 1, - 'comm_sigb' => Class_IntBib::COM_NANOOK, - 'comm_params' => serialize($params)]); + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_NANOOK, + 'comm_params' => serialize($params)]); Class_WebService_SIGB_Nanook::setService($params, $service); Class_WebService_SIGB_AbstractRESTService::shouldThrowError(true); } - - public function tearDown(): void { + public function tearDown(): void + { Class_WebService_SIGB_Nanook::reset(); parent::tearDown(); } } - - - -class TemplatesAbonneDispatchsWithILSChildCardFailuresTest - extends TemplatesAbonneDispatchWithILSChildCardTestCase { - +class TemplatesAbonneDispatchsWithILSChildCardFailuresTest extends TemplatesAbonneDispatchWithILSChildCardTestCase +{ /** @test */ - public function WithOrdreabonn1LoanlistTitleShouldNotContainsBeartEnPublic() { + public function withOrdreabonn1LoanlistTitleShouldNotContainsBeartEnPublic() + { Class_Users::find(42)->setOrdreabon(1); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); $this->assertXPathCount('//div[@class="card"]', 3); $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } - /** @test */ - public function withDifferentIdabonnloanlistShouldNotContainsBeartEnPublic() { + public function withDifferentIdabonnloanlistShouldNotContainsBeartEnPublic() + { Class_Users::find(42)->setIdabon(11234); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); $this->assertXPathCount('//div[@class="card"]', 3); $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } - /** @test - ChildCard is based on same Idabon - */ - public function withDifferentIdabonForCurrentUserloanlistShouldNotContainsBeartEnPublic() { + * ChildCard is based on same Idabon + */ + public function withDifferentIdabonForCurrentUserloanlistShouldNotContainsBeartEnPublic() + { Class_Users::getIdentity()->setIdabon(42); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); $this->assertXPathCount('//div[@class="card"]', 3); $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } - /** @test - ChildCard Only Displayed for Master Card - */ - public function withDifferentOrdreabonForCurrentUserloanlistShouldNotContainsBeartEnPublic() { + * ChildCard Only Displayed for Master Card + */ + public function withDifferentOrdreabonForCurrentUserloanlistShouldNotContainsBeartEnPublic() + { Class_Users::getIdentity()->setOrdreabon(42); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); $this->assertXPathCount('//div[@class="card"]', 3); $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } - /** @test */ - public function withWrongRoleShouldNotContainsBeartEnPublic() { + public function withWrongRoleShouldNotContainsBeartEnPublic() + { Class_Users::find(42)->setRoleLevel(1)->save(); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } - /** @test */ - public function withWrongRoleOnCurrentUserShouldNotContainsBeartEnPublic() { + public function withWrongRoleOnCurrentUserShouldNotContainsBeartEnPublic() + { Class_Users::getIdentity()->setRoleLevel(1)->save(); $this->dispatch('/opac/abonne/ajax-loans/id_profil/72'); $this->assertNotXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } } - - - -class TemplatesAbonneDispatchAjaxLoansWithILSChildCardTest - extends TemplatesAbonneDispatchWithILSChildCardTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchAjaxLoansWithILSChildCardTest extends TemplatesAbonneDispatchWithILSChildCardTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/ajax-loans/current/1/id_profil/72'); } - /** @test */ - public function loanlistShouldContainsBeartEnPublic() { + public function loanlistShouldContainsBeartEnPublic() + { $this->assertXPathContentContains('//div[@class="card"]//div[@class="document_title"]', - Class_CharSet::fromISOtoUTF8('Béart en public')); + Class_CharSet::fromISOtoUTF8('Béart en public')); } - /** @test */ - public function loanlistLoanByShouldContainsHandiPatronymique() { + public function loanlistLoanByShouldContainsHandiPatronymique() + { $this->assertXPathContentContains('//div[@class="card"]//div[@class="loan_by"]', - Class_CharSet::fromISOtoUTF8('Emprunté par <span class="by_idabon d-none">123456</span> handi Patronymique')); + Class_CharSet::fromISOtoUTF8('Emprunté par <span class="by_idabon d-none">123456</span> handi Patronymique')); } } - - - -class TemplatesAbonneDispatchReservationWithILSChildCardTest - extends TemplatesAbonneDispatchWithILSChildCardTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchReservationWithILSChildCardTest extends TemplatesAbonneDispatchWithILSChildCardTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/reservations/id_profil/72'); } - /** @test */ - public function holdListDocumentTitleShouldContainsConteDesQuatresVents() { + public function holdListDocumentTitleShouldContainsConteDesQuatresVents() + { $this->assertXPathContentContains('//div[@class="document_title"]', - 'Contes des quatre vents'); + 'Contes des quatre vents'); } - /** @test */ - public function holdlistHoldByShouldContainsHandiPatronymique() { + public function holdlistHoldByShouldContainsHandiPatronymique() + { $this->assertXPathContentContains('//div[@class="hold_by"]', - 'Réservé par <span class="by_idabon d-none">123456</span> handi Patronymique'); + 'Réservé par <span class="by_idabon d-none">123456</span> handi Patronymique'); } } - - - -class TemplatesAbonneDispatchMonHistoriqueTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchMonHistoriqueTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $pottifar_old = new Class_WebService_SIGB_LoansHistory($this->_emprunteur); @@ -806,18 +780,18 @@ class TemplatesAbonneDispatchMonHistoriqueTest extends TemplatesIntonationAccoun $notice_unimarc->newZone()->label('200')->addChild('a', 'Pottifar'); $notice = $this->fixture(Class_Notice::class, - ['id' => 890, - 'clef_alpha' => 'MYSUPERkey', - 'unimarc' => $notice_unimarc->render(), - 'facettes' => 'M8897 T1 B3 A18 Lfre']); + ['id' => 890, + 'clef_alpha' => 'MYSUPERkey', + 'unimarc' => $notice_unimarc->render(), + 'facettes' => 'M8897 T1 B3 A18 Lfre']); $exemplaire = $this->fixture(Class_Exemplaire::class, - ['id' => 891, - 'id_origine' => 1234, - 'code_barres' => 456, - 'id_int_bib' => 1, - 'zone995' => serialize([['clef' => 'a', 'valeur' => 'PottifarItem']]), - 'notice' => $notice]); + ['id' => 891, + 'id_origine' => 1234, + 'code_barres' => 456, + 'id_int_bib' => 1, + 'zone995' => serialize([['clef' => 'a', 'valeur' => 'PottifarItem']]), + 'notice' => $notice]); $pottifar_old_issue = new Class_WebService_SIGB_Emprunt('42', new Class_WebService_SIGB_Exemplaire(456)); $pottifar_old_issue @@ -832,7 +806,7 @@ class TemplatesAbonneDispatchMonHistoriqueTest extends TemplatesIntonationAccoun $pottifar_old->addLoan($pottifar_old_issue); - $this->_mock_emprunts = (new Class_Testing_WebService_SIGB_Koha_Service()) + $this->_mock_emprunts = (new Class_Testing_WebService_SIGB_Koha_Service) ->whenCalled('loansHistory') ->answers($pottifar_old) ->whenCalled('getLoansPerPage') @@ -845,19 +819,17 @@ class TemplatesAbonneDispatchMonHistoriqueTest extends TemplatesIntonationAccoun $this->dispatch('/opac/abonne/prets/history/1/id_profil/72'); } - /** @test */ - public function pageShouldDisplayTitleMonHistoriqueDePrets() { + public function pageShouldDisplayTitleMonHistoriqueDePrets() + { $this->assertXPathContentContains('//h2//span', 'Mon historique de prêts'); } } - - - -class TemplatesAbonneDispatchLoansWithHistoryTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchLoansWithHistoryTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $pottifar_old = new Class_WebService_SIGB_LoansHistory($this->_emprunteur); @@ -865,18 +837,18 @@ class TemplatesAbonneDispatchLoansWithHistoryTest extends TemplatesIntonationAcc $notice_unimarc->newZone()->label('200')->addChild('a', 'Pottifar'); $notice = $this->fixture(Class_Notice::class, - ['id' => 890, - 'clef_alpha' => 'MYSUPERkey', - 'unimarc' => $notice_unimarc->render(), - 'facettes' => 'M8897 T1 B3 A18 Lfre']); + ['id' => 890, + 'clef_alpha' => 'MYSUPERkey', + 'unimarc' => $notice_unimarc->render(), + 'facettes' => 'M8897 T1 B3 A18 Lfre']); $exemplaire = $this->fixture(Class_Exemplaire::class, - ['id' => 891, - 'id_origine' => 1234, - 'code_barres' => 456, - 'id_int_bib' => 1, - 'zone995' => serialize([['clef' => 'a', 'valeur' => 'PottifarItem']]), - 'notice' => $notice]); + ['id' => 891, + 'id_origine' => 1234, + 'code_barres' => 456, + 'id_int_bib' => 1, + 'zone995' => serialize([['clef' => 'a', 'valeur' => 'PottifarItem']]), + 'notice' => $notice]); $pottifar_old_issue = new Class_WebService_SIGB_Emprunt('42', new Class_WebService_SIGB_Exemplaire(456)); $pottifar_old_issue @@ -891,7 +863,7 @@ class TemplatesAbonneDispatchLoansWithHistoryTest extends TemplatesIntonationAcc $pottifar_old->addLoan($pottifar_old_issue); - $this->_mock_emprunts = (new Class_Testing_WebService_SIGB_Koha_Service()) + $this->_mock_emprunts = (new Class_Testing_WebService_SIGB_Koha_Service) ->setApiUser('Abdsdf') ->setApiPass('vup') ->whenCalled('loansHistory') @@ -912,90 +884,86 @@ class TemplatesAbonneDispatchLoansWithHistoryTest extends TemplatesIntonationAcc $this->dispatch('/opac/abonne/ajax-loans/history/1/id_profil/72'); } - /** @test */ - public function pageShouldContainsPottifar() { + public function pageShouldContainsPottifar() + { $this->assertXPathContentContains('//div', 'Pottifar'); } - /** @test */ - public function historyShouldBeInAnAccordion() { + public function historyShouldBeInAnAccordion() + { $this->assertXPathContentContains('//div[@class="accordion"]//h2', Class_CharSet::fromISOtoUTF8('Historique des prêts')); } - /** @test */ - public function pottifarShouldBeInACarousel() { + public function pottifarShouldBeInACarousel() + { $this->assertXPathContentContains('//div[contains(@class, "historical_loans_list col-12 mt-5")]//div[@class="accordion"]//div[contains(@class, "carousel")]//div', 'Pottifar'); } } - - - -class TemplatesAbonneDispatchHoldsTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchHoldsTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/reservations/id_profil/72'); } - /** @test */ - public function badgeShouldContainsNumero23() { + public function badgeShouldContainsNumero23() + { $this->assertXPathContentContains('//div//span[contains(@class,"datas_items_995_h")]', - 'Numero 23'); + 'Numero 23'); } - /** @test */ - public function spanInBadgesShouldHaveClassBadgeTextAndBeHydrated() { + public function spanInBadgesShouldHaveClassBadgeTextAndBeHydrated() + { $this->assertXPath('//div//span[@class="badge_text align-middle d-inline-block text-left"]'); } - /** @test */ - public function holdsDobbyPotterBadgeForAvailabilityEndDateShouldContainsSixJuin() { + public function holdsDobbyPotterBadgeForAvailabilityEndDateShouldContainsSixJuin() + { $this->assertXPathContentContains('//div[contains(@class,"badge_group_Intonation_Library_View_Wrapper_Hold")]//span[@class="badge_tag hold_expiration text-left badge badge-warning"][@title="La réservation expire le 06 juin"]//span', '06 juin'); } - /** @test */ - public function dobbyPotterHoldShouldHaveRank2() { + public function dobbyPotterHoldShouldHaveRank2() + { $this->assertXPathContentContains('//span[@class="badge_tag hold_rank text-left badge badge-secondary"][contains(@title, "Il y a 1 réservation avant la votre.")]//span', 'Rang 2'); } - /** @test */ - public function libraryPickupLocationShouldBeSetShouldBeTombouctou() { + public function libraryPickupLocationShouldBeSetShouldBeTombouctou() + { $this->assertXPathContentContains('//span[@class="badge_tag hold_pickup_location hold_not_ready text-left badge badge-secondary"][contains(@title, "Lieu de récupération")]//span', 'Tombouctou'); } - /** @test */ - public function holdStateSummaryForDobbyShouldBePresent() { + public function holdStateSummaryForDobbyShouldBePresent() + { $this->assertXPathContentContains('//p[@class="hold_state_summary"]', 'Vous pouvez aller chercher ce document à Tombouctou jusqu\'au 06 juin'); } } - - - -class TemplatesAbonneDispatchLargeNumberOfHoldsTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchLargeNumberOfHoldsTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $holds = []; - for ($i = 1 ; $i <=20 ; $i ++) - $holds [] = (new Class_WebService_SIGB_Reservation('12', - (new Class_WebService_SIGB_Exemplaire(999123 + $i)) - ->setTitre('Dobby') - ->setExemplaireOPAC(Class_Exemplaire::find(12089)))) - ->parseExtraAttributes(['Etat' => 'Réservation admise', - 'Rang' => '2', + for ($i = 1; $i <= 20; ++$i) + $holds[] = (new Class_WebService_SIGB_Reservation('12', + (new Class_WebService_SIGB_Exemplaire(999123 + $i)) + ->setTitre('Dobby') + ->setExemplaireOPAC(Class_Exemplaire::find(12089)))) + ->parseExtraAttributes(['Etat' => 'Réservation admise', + 'Rang' => '2', 'Bibliotheque' => 'Tombouctou', 'N° de notice' => 564]) ->setAvailabilityEndDate('2020-06-06'); @@ -1005,102 +973,98 @@ class TemplatesAbonneDispatchLargeNumberOfHoldsTest extends TemplatesIntonationA $this->dispatch('/opac/abonne/reservations/id_profil/72'); } - /** @test */ - public function truncateListShouldHaveASizeOf20() { + public function truncateListShouldHaveASizeOf20() + { $this->assertXPath('//div//select[contains(@title, "Limiter le nombre d")]//option[@value="20"]'); } - /** @test */ - public function truncateListShouldHaveASizeOf40() { + public function truncateListShouldHaveASizeOf40() + { $this->assertXPath('//div//select[contains(@title, "Limiter le nombre d")]//option[@value="40"]'); } - /** @test */ - public function truncateListShouldHaveASizeOf100() { + public function truncateListShouldHaveASizeOf100() + { $this->assertXPath('//div//select[contains(@title, "Limiter le nombre d")]//option[@value="100"]'); } - /** @test */ - public function inputFiltrerShouldBePresent() { + public function inputFiltrerShouldBePresent() + { $this->assertXPathContentContains('//form//label', 'Filtrer'); } - /** @test */ - public function holdsShouldBeDisplaydInListGroup() { + public function holdsShouldBeDisplaydInListGroup() + { $this->assertXPath('//div[contains(@class, "list-group")]//div[contains(@class, "list-group-item")]//div[contains(@class, "card")]'); } - /** @test */ - public function scriptShouldContainsSearchInput() { + public function scriptShouldContainsSearchInput() + { $this->assertXPathContentContains('//script', '.search_input('); } - /** @test */ - public function truncateListSizeShouldBe20Elements() { + public function truncateListSizeShouldBe20Elements() + { $this->assertXPathContentContains('//div[@class="truncate_list_size_wrapper col-12 col-sm-3"]//span[@class="truncate_list_size btn btn-sm btn-info"]', '20 éléments'); } - /** @test */ - public function scriptTruncateListToolsShouldBeLoaded() { + public function scriptTruncateListToolsShouldBeLoaded() + { $this->assertXPath('//script[contains(@src, "/library/templates/Intonation/Assets/js/truncate_list_tools.js")]'); } - /** @test */ - public function pageShouldBeHTML5Valid() { + public function pageShouldBeHTML5Valid() + { $this->assertHTML5(); } } - - - -class TemplatesAbonneDispatchReviewsTest extends TemplatesIntonationAccountTestCase { - +class TemplatesAbonneDispatchReviewsTest extends TemplatesIntonationAccountTestCase +{ /** @test */ - public function leRoiDesConsShouldBeDisplay() { + public function leRoiDesConsShouldBeDisplay() + { $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); $this->assertXPathContentContains('//div', 'Le Roi des cons sur son throne'); } - /** @test */ - public function avisCanBeDeleted() { + public function avisCanBeDeleted() + { $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); $this->assertXPath('//a[@href="/abonne/delete-review/id_profil/72/id/4"]//div[text()="Supprimer"]'); } - /** @test */ - public function donnerDesAvisLinkShouldBeDisplay() { + public function donnerDesAvisLinkShouldBeDisplay() + { Class_AvisNotice::find(4)->delete(); $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); $this->assertXPathContentContains('//div//a[contains(@href, "/abonne/donner-des-avis")]', 'Commencer maintenant'); } - /** @test */ - public function imageAltShouldNotContainsHtml() { + public function imageAltShouldNotContainsHtml() + { $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); $this->assertXPath('//div[contains(@class, "collection_truncate_list")]//div[@class="img-thumbnail"]//img[@alt=""]'); } } - - - -/* hotline : https://forge.afi-sa.net/issues/178137 */ -class TemplatesAbonneDispatchReviewsWithoutRecordTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +// hotline : https://forge.afi-sa.net/issues/178137 +class TemplatesAbonneDispatchReviewsWithoutRecordTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Notice::find(20090)->delete(); @@ -1109,68 +1073,61 @@ class TemplatesAbonneDispatchReviewsWithoutRecordTest extends TemplatesIntonatio $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); } - /** @test */ - public function leRoiDesConsShouldBeDisplay() { + public function leRoiDesConsShouldBeDisplay() + { $this->assertXPathContentContains('//div', 'Le Roi des cons sur son throne'); } - /** @test */ - public function avisCanBeDeleted() { + public function avisCanBeDeleted() + { $this->assertXPath('//a[@href="/abonne/delete-review/id_profil/72/id/4"]//div[text()="Supprimer"]'); } } - - - -class TemplatesAbonneDispatchConfigurationsTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchConfigurationsTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/configurations/id_profil/72'); } - /** @test */ - public function titlePageShouldBeMesConfigurations() { + public function titlePageShouldBeMesConfigurations() + { $this->assertXPathContentContains('//h2', 'Mes configurations'); } - /** @test */ - public function formActionShouldBeAbonneManagePreferences() { + public function formActionShouldBeAbonneManagePreferences() + { $this->assertXPath('//form[@class="user_configuration_form form row no-gutters"][@action="/abonne/manage-preferences/id_profil/72"]'); } - /** @test */ - public function linkEditInformationShouldBePresent() { + public function linkEditInformationShouldBePresent() + { $this->assertXPath('//div/a[@href="/abonne/modifier/id_profil/72"][@title="Modifier les informations me concernant"]'); } } - - - -class TemplatesAbonneDispatchDonnerDesAvisTest extends TemplatesIntonationAccountTestCase { - +class TemplatesAbonneDispatchDonnerDesAvisTest extends TemplatesIntonationAccountTestCase +{ /** @test */ - public function donnerDesAvisShouldBeDisplay() { + public function donnerDesAvisShouldBeDisplay() + { $this->dispatch('/opac/abonne/donner-des-avis/id_profil/72'); $this->assertXPathContentContains('//div', 'Donner des avis'); } } - - - -class TemplatesAbonneDispatchSuivreUneRechercheTest - extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchSuivreUneRechercheTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->onLoaderOfModel('Class_TypeDoc') @@ -1180,75 +1137,71 @@ class TemplatesAbonneDispatchSuivreUneRechercheTest $this->dispatch('/opac/abonne/suivre-une-recherche/id_profil/72'); } - /** @test */ - public function suivreUneRechercheTitleShouldBeDisplay() { + public function suivreUneRechercheTitleShouldBeDisplay() + { $this->assertXPathContentContains('//main//div//h2', 'Suivre une recherche'); } - /** @test */ - public function searchResultShouldBeDisplay() { + public function searchResultShouldBeDisplay() + { $this->assertXPath('//main//div[contains(@class, "search_result")]'); } } - - - -class TemplatesAbonneAccountWithInterdireModifTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneAccountWithInterdireModifTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_AdminVar::set('INTERDIRE_MODIF_FICHE_ABONNE', '1'); } - /** @test */ - public function editAccountShouldNotBePresent() { + public function editAccountShouldNotBePresent() + { $this->dispatch('/opac/abonne/fiche/id_profil/72'); $this->assertNotXPath('//a[contains(@href, "/abonne/modifier/id_profil/72")]'); } - /** @test */ - public function changePasswordtShouldNotBePresent() { + public function changePasswordtShouldNotBePresent() + { $this->dispatch('/opac/abonne/fiche/id_profil/72'); $this->assertNotXPath('//a[contains(@href, "/abonne/changer-mon-mot-de-passe/id_profil/72")]'); } - /** @test */ - public function editPasswordShouldRedirectWithErrorMessage() { + public function editPasswordShouldRedirectWithErrorMessage() + { $this->dispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72'); $this->assertRedirect(); $this->assertFlashMessengerContentContains('Vos informations ne peuvent pas être modifiées.'); } - /** @test */ - public function editAccountRedirectWithErrorMessage() { + public function editAccountRedirectWithErrorMessage() + { $this->dispatch('/opac/abonne/modifier/id_profil/72'); $this->assertRedirect(); $this->assertFlashMessengerContentContains('Vos informations ne peuvent pas être modifiées.'); } - /** @test */ - public function postEditAccountRedirectWithErrorMessage() { + public function postEditAccountRedirectWithErrorMessage() + { $this->postDispatch('/opac/abonne/modifier/id_profil/72', ['nom' => 'Tom']); $this->assertRedirect(); $this->assertFlashMessengerContentContains('Vos informations ne peuvent pas être modifiées.'); } } - - - -class TemplatesAbonneAccountFieldsTest extends TemplatesIntonationAccountTestCase { - - public function fields() { +class TemplatesAbonneAccountFieldsTest extends TemplatesIntonationAccountTestCase +{ + public function fields() + { return [['nom', 'dev'], ['prenom', 'dev'], ['pseudo', 'dev'], ['adresse', '5 av du paradis'], ['code_postal', '89399'], ['ville', 'soucy'], ['mail', 'user@server.com'], @@ -1257,55 +1210,69 @@ class TemplatesAbonneAccountFieldsTest extends TemplatesIntonationAccountTestCas ['mode_contact', Class_Users::MODE_CONTACT_SMS]]; } - /** * @test + * * @dataProvider fields + * + * @param mixed $field */ - public function notAllowedFieldsShouldNotCreateInput($field) { + public function notAllowedFieldsShouldNotCreateInput($field) + { Class_AdminVar::set('CHAMPS_FICHE_UTILISATEUR', ''); $this->dispatch('/opac/abonne/modifier/id_profil/72'); $this->assertNotXPath('//input[@name="' . $field . '"]'); } - /** * @test + * * @dataProvider fields + * + * @param mixed $field */ - public function allowedFieldsShouldCreateInput($field) { + public function allowedFieldsShouldCreateInput($field) + { Class_AdminVar::set('CHAMPS_FICHE_UTILISATEUR', $field); $this->dispatch('/opac/abonne/modifier/id_profil/72'); $this->assertXPath('//input[@name="' . $field . '"]'); } - /** * @test + * * @dataProvider fields + * + * @param mixed $field + * @param mixed $value */ - public function postAllowedFieldValueShouldUpdateUser($field, $value) { + public function postAllowedFieldValueShouldUpdateUser($field, $value) + { Class_AdminVar::set('CHAMPS_FICHE_UTILISATEUR', $field); $this->postDispatch('/opac/abonne/modifier/id_profil/72', [$field => $value]); $this->assertEquals($value, Class_Users::getIdentity()->callGetterByAttributeName($field)); } - /** * @test + * * @dataProvider fields + * + * @param mixed $field + * @param mixed $value */ - public function postNotAllowedFieldValueShouldNotUpdateUser($field, $value) { + public function postNotAllowedFieldValueShouldNotUpdateUser($field, $value) + { Class_AdminVar::set('CHAMPS_FICHE_UTILISATEUR', ''); $this->postDispatch('/opac/abonne/modifier/id_profil/72', [$field => $value]); $this->assertNotEquals($value, Class_Users::getIdentity()->callGetterByAttributeName($field)); } - /** * @test */ - public function postAllowedButInvalidFieldValueShouldNotUpdateUserAndDisplayError() { + public function postAllowedButInvalidFieldValueShouldNotUpdateUserAndDisplayError() + { Class_AdminVar::set('CHAMPS_FICHE_UTILISATEUR', 'mail'); $this->postDispatch('/opac/abonne/modifier/id_profil/72', ['mail' => 'toto']); $this->assertNotEquals('toto', Class_Users::getIdentity()->getMail()); @@ -1313,72 +1280,68 @@ class TemplatesAbonneAccountFieldsTest extends TemplatesIntonationAccountTestCas } } - - - -class TemplatesAbonneAccountEditTest extends TemplatesIntonationAccountTestCase { - +class TemplatesAbonneAccountEditTest extends TemplatesIntonationAccountTestCase +{ /** @test */ - public function editAccountLinkShouldBePresent() { + public function editAccountLinkShouldBePresent() + { $this->dispatch('/opac/abonne/fiche/id_profil/72'); $this->assertXPath('//a[contains(@href, "/abonne/modifier/id_profil/72")]'); } - /** @test */ - public function editPasswordLinkShouldBePresent() { + public function editPasswordLinkShouldBePresent() + { $this->dispatch('/opac/abonne/fiche/id_profil/72'); $this->assertXPath('//a[contains(@href, "/abonne/changer-mon-mot-de-passe/id_profil/72")]'); } - /** @test */ - public function editPasswordShouldContainsFormToAbonneChangerMonMotDePasse() { + public function editPasswordShouldContainsFormToAbonneChangerMonMotDePasse() + { $this->dispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72'); $this->assertXPath('//form[contains(@action, "/abonne/changer-mon-mot-de-passe/id_profil/72")]'); } - /** @test */ - public function editPasswordShouldContainsLinkToAuthLostpass() { + public function editPasswordShouldContainsLinkToAuthLostpass() + { $this->dispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72'); $this->assertXPath('//div//a[contains(@href, "/auth/lostpass/id_profil/72")]'); } - /** @test */ - public function changePasswordPost123ShouldRenderToSmallPassword() { - $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', ['current_password' => 'test', - 'new_password' => '123', + public function changePasswordPost123ShouldRenderToSmallPassword() + { + $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', ['current_password' => 'test', + 'new_password' => '123', 'confirm_new_password' => '123']); $this->assertXPathContentContains('//div', 'contient moins de 4 caract'); } - /** @test */ - public function changePasswordPost123456ShouldUpdatePasswordUser() { - $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', ['current_password' => 'test', - 'new_password' => '123456', + public function changePasswordPost123456ShouldUpdatePasswordUser() + { + $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', ['current_password' => 'test', + 'new_password' => '123456', 'confirm_new_password' => '123456']); $this->assertEquals('123456', Class_Users::getIdentity()->getPassword()); } - /** @test */ - public function changePasswordPostEmptyFieldsShouldRenderEmptyPassword() { - $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', ['current_password' => '', - 'new_password' => '', + public function changePasswordPostEmptyFieldsShouldRenderEmptyPassword() + { + $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', ['current_password' => '', + 'new_password' => '', 'confirm_new_password' => '']); $this->assertXPathContentContains('//div', 'Une valeur est requise'); } } - - - -class TemplatesAbonneDispatchAccountTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchAccountTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_FileManager::setFileSystem(null); @@ -1386,163 +1349,161 @@ class TemplatesAbonneDispatchAccountTest extends TemplatesIntonationAccountTestC $this->dispatch('/opac/abonne/fiche/id_profil/72'); } - /** @test */ - public function accountShouldContainsUserName() { + public function accountShouldContainsUserName() + { $this->assertXPathContentContains('//div', 'Paul'); } - /** @test */ - public function paulProfileImageShouldBeReadBlack() { + public function paulProfileImageShouldBeReadBlack() + { $this->assertXpath('//img[@src="' - . Class_Url::relative("/public/opac/images/abonnes/read_black.png") + . Class_Url::relative('/public/opac/images/abonnes/read_black.png') . '"]'); } - /** @test */ - public function loanPotterShouldBeDisplay() { + public function loanPotterShouldBeDisplay() + { $this->assertXPathContentContains('//div', 'Potter'); } - /** @test */ - public function loanAliceShouldBeDisplay() { + public function loanAliceShouldBeDisplay() + { $this->assertXPathContentContains('//div', 'Alice'); } - /** @test */ - public function holdDobbyBeDisplay() { + public function holdDobbyBeDisplay() + { $this->assertXPathContentContains('//div', 'Dobby Potter'); } - /** @test */ - public function paulShouldHaveBadgeLoansCount3() { + public function paulShouldHaveBadgeLoansCount3() + { $this->assertXPathContentContains('//div//a[contains(@class, "badge")]', '3 prêt(s) en cours'); } - /** @test */ - public function paulShoulHaveBadgeHoldCount2() { + public function paulShoulHaveBadgeHoldCount2() + { $this->assertXPathContentContains('//div//a[contains(@class, "badge")]', '2 réservation(s) en cours'); } - /** @test */ - public function paulShouldHaveBadgeLibraryIstres() { + public function paulShouldHaveBadgeLibraryIstres() + { $this->assertXPathContentContains('//div//a[contains(@class, "badge")]', 'Istres'); } - /** @test */ - public function paulShouldHaveBadgeValidity() { + public function paulShouldHaveBadgeValidity() + { $this->assertXPathContentContains('//div//span[contains(@class, "badge")]', '2020'); } - /** @test */ - public function paulShouldHaveBadgeCardNumber123456() { + public function paulShouldHaveBadgeCardNumber123456() + { $this->assertXPathContentContains('//div//span[contains(@class, "badge")]', '123456'); } - /** @test */ - public function paulShouldHaveBadgeLoanLate() { + public function paulShouldHaveBadgeLoanLate() + { $this->assertXPathContentContains('//div//a[contains(@class, "badge")]', '2 prêt(s) en retard'); } - /** @test */ - public function paulShouldHaveBadgeNumberOfSelection1() { + public function paulShouldHaveBadgeNumberOfSelection1() + { $this->assertXPathContentContains('//div//a[contains(@class, "badge")]', '4 sélection(s)'); } - /** @test */ - public function paulShouldHaveBadgeFollowedSearches1() { + public function paulShouldHaveBadgeFollowedSearches1() + { $this->assertXPathContentContains('//div//a[contains(@class, "badge")]', '1 recherche(s)'); } - /** @test */ - public function paulShouldHaveLinkToEditProfileImage() { + public function paulShouldHaveLinkToEditProfileImage() + { $this->assertXPath('//div//a[contains(@href, "/abonne/change-image")][contains(@title, "Modifier mon image")]'); } - /** @test */ - public function pageNewsletterDisplayShouldContainsNewsLetterLesNouveautes() { + public function pageNewsletterDisplayShouldContainsNewsLetterLesNouveautes() + { $this->assertXPathContentContains('//div[contains(@class, "card_title_Intonation_Library_View_Wrapper_Newsletter")]//a', 'Les nouveautés'); } - /** @test */ - public function pageNewsletterDisplayShouldContainsLinkMeDesinscrire() { + public function pageNewsletterDisplayShouldContainsLinkMeDesinscrire() + { $this->assertXPathContentContains('//a[contains(@href,"unsubscribe-newsletter/id/45")]', 'Me désinscrire'); } - /** @test */ - public function pageNewsletterLinkMeDesinscrireShouldContainsTitleMeDesinscrire() { + public function pageNewsletterLinkMeDesinscrireShouldContainsTitleMeDesinscrire() + { $this->assertXPathContentContains('//a[contains(@href,"unsubscribe-newsletter/id/45")]//@title', - 'Me désinscrire de la lettre d\'information Les nouveautés'); + 'Me désinscrire de la lettre d\'information Les nouveautés'); } - /** @test */ - public function pageNewsletterLinkMeDesinscrireShouldContainsAriaLabelMeDesabonnerDe() { + public function pageNewsletterLinkMeDesinscrireShouldContainsAriaLabelMeDesabonnerDe() + { $this->assertXPathContentContains('//a[contains(@href,"unsubscribe-newsletter/id/45")]//@aria-label', - 'Me désinscrire de la lettre d\'information Les nouveautés'); + 'Me désinscrire de la lettre d\'information Les nouveautés'); } - /** @test */ - public function pageNewsletterDisplayShouldContainsNewsLetterCoupsDeCoeur() { + public function pageNewsletterDisplayShouldContainsNewsLetterCoupsDeCoeur() + { $this->assertXPathContentContains('//div[contains(@class, "card_title_Intonation_Library_View_Wrapper_Newsletter")]//a', 'coups de coeur'); } - /** @test */ - public function pageWithNewsletterInformationLinkToSubscribeShouldContainsLesCoupsDeCoeur() { + public function pageWithNewsletterInformationLinkToSubscribeShouldContainsLesCoupsDeCoeur() + { $this->assertXPathContentContains('//div[contains(@class, "card_title_Intonation_Library_View_Wrapper_Newsletter")]//a[contains(@href,"subscribe-newsletter/id/46")]', 'Les coups de coeur'); } - /** @test */ - public function pageWithNewsletterInformationActionShouldContainsLinkMInscrire() { + public function pageWithNewsletterInformationActionShouldContainsLinkMInscrire() + { $this->assertXPathContentContains('//div[contains(@class, "card_action")]//a[contains(@href,"subscribe-newsletter/id/46")]', 'M\'inscrire'); } - /** @test */ - public function pageNewsletterDisplayShouldContainsTitleMinscrireALaLettre() { + public function pageNewsletterDisplayShouldContainsTitleMinscrireALaLettre() + { $this->assertXPathContentContains('//a[contains(@href,"subscribe-newsletter/id/46")]/@title', 'M\'inscrire à la lettre d\'information Les coups de coeur'); } - /** @test */ - public function pageNewsletterDisplayShouldContainsAriaLabelMAbonnerALaLettre() { + public function pageNewsletterDisplayShouldContainsAriaLabelMAbonnerALaLettre() + { $this->assertXPathContentContains('//a[contains(@href,"subscribe-newsletter/id/46")]/@aria-label', 'M\'inscrire à la lettre d\'information Les coups de coeur'); } } - - - -/* hotline: https://forge.afi-sa.net/issues/159175 */ -class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +// hotline: https://forge.afi-sa.net/issues/159175 +class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/informations/id_profil/72'); } - - public function fieldsWithContent() : array { + public function fieldsWithContent(): array + { return [ ['nom', 'Nom', 'AutoTest'], ['pr_nom', 'Prénom', 'Zoro'], @@ -1551,19 +1512,24 @@ class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase ]; } - /** * @test + * * @dataProvider fieldsWithContent + * + * @param mixed $class_name + * @param mixed $name + * @param mixed $content */ - public function allFieldsShouldBeDisplayedWithContent($class_name, $name, $content) { + public function allFieldsShouldBeDisplayedWithContent($class_name, $name, $content) + { $classes = 'user_info ' . $class_name . ' col-12 col-sm-6'; $this->assertXPath(sprintf('//dt[@class="%s"][text()="%s"]', $classes, $name)); $this->assertXPath(sprintf('//dd[@class="%s"][text()="%s"]', $classes, $content)); } - - public function fieldsWithoutContent() : array { + public function fieldsWithoutContent(): array + { return [ ['adresse', 'Adresse'], ['code_postal', 'Code postal'], @@ -1575,60 +1541,58 @@ class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase ]; } - /** * @test + * * @dataProvider fieldsWithoutContent + * + * @param mixed $class_name + * @param mixed $name */ - public function allFieldsShouldBeDisplayedWithoutContent($class_name, $name) { + public function allFieldsShouldBeDisplayedWithoutContent($class_name, $name) + { $classes = 'user_info ' . $class_name . ' col-12 col-sm-6'; $this->assertXPath(sprintf('//dt[@class="%s"][text()="%s"]', $classes, $name)); $this->assertXPath(sprintf('//dd[@class="%s"][not(text())]', $classes)); } - /** @test */ - public function shouldNotContainsLoadingIcon() { + public function shouldNotContainsLoadingIcon() + { $this->assertNotXPath('//div[contains(@class, "loading_icon")]'); } } - - - -class TemplatesAbonneDispatchClearHistoryTest extends TemplatesIntonationAccountTestCase { - +class TemplatesAbonneDispatchClearHistoryTest extends TemplatesIntonationAccountTestCase +{ /** @test */ - public function shouldRedirect() { + public function shouldRedirect() + { $this->dispatch('/opac/abonne/clear-history/id_profil/72'); $this->assertRedirect(); } } - - - -class TemplatesAbonneDispatchCardsTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchCardsTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/cards/id_profil/72'); } - /** @test */ - public function shouldForwardToConfigurationsAction() { + public function shouldForwardToConfigurationsAction() + { $this->assertXPathContentContains('//div//h2[contains(@class, "jumbotron_section_title")]', 'Mes configurations'); } } - - - -class TemplatesAbonneDispatchPagesTest extends AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchPagesTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 200]); @@ -1641,53 +1605,51 @@ class TemplatesAbonneDispatchPagesTest extends AbstractControllerTestCase { $conf ->setNewDatas(['IntonationLabelUserSelections' => 'Favoris', 'IntonationTitleUserSelections' => 'Favoris', - 'IntonationLabelUserReviews' => '%s donne ton avis', - 'IntonationTitleUserReviews' => '%s donne ton avis']) + 'IntonationLabelUserReviews' => '%s donne ton avis', + 'IntonationTitleUserReviews' => '%s donne ton avis']) ->updateProfile(); Class_Users::getIdentity()->setPrenom('josh'); } - /** @test */ - public function followASearchPageTitleShouldBeSuivreUneRecherche() { + public function followASearchPageTitleShouldBeSuivreUneRecherche() + { $this->dispatch('/opac/abonne/suivre-une-recherche/'); $this->assertXPath('//li/a[@title="Favoris"]'); } - /** @test */ - public function donnerDesAvissectionTitleShouldBeJoshDonneTonAvis() { + public function donnerDesAvissectionTitleShouldBeJoshDonneTonAvis() + { $this->dispatch('/opac/abonne/donner-des-avis/'); $this->assertXPath('//li/a[@title="josh donne ton avis"]'); } } - - - -class TemplatesAbonneWithPNBHoldsTest extends AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesAbonneWithPNBHoldsTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); - $this->_buildTemplateProfil(['id' => 90, + $this->_buildTemplateProfil(['id' => 90, 'template' => 'CHILI']); $group = $this->fixture(Class_UserGroup::class, - ['id' => '20', - 'libelle' => 'Multimedia', - 'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]]); + ['id' => '20', + 'libelle' => 'Multimedia', + 'rights' => [Class_UserGroup::RIGHT_ACCES_PNB_DILICOM]]); $logged_user = $this->fixture(Class_Users::class, - ['id' => 6, - 'nom'=>'Pito', - 'login'=>'Chat', - 'password'=>'123456', - 'id_site' => 1, - 'idabon' => '12345', - 'user_groups' => [$group]]); + ['id' => 6, + 'nom' => 'Pito', + 'login' => 'Chat', + 'password' => '123456', + 'id_site' => 1, + 'idabon' => '12345', + 'user_groups' => [$group]]); $logged_user ->beAbonneSIGB() @@ -1697,181 +1659,170 @@ class TemplatesAbonneWithPNBHoldsTest extends AbstractControllerTestCase { RessourcesNumeriquesFixtures::activateDilicom(); $this->fixture(Class_Album::class, - ['id' => 37, - 'id_origine' => 'Dilicom-88817216', - 'titre' => 'Les jardins' - ]); + ['id' => 37, + 'id_origine' => 'Dilicom-88817216', + 'titre' => 'Les jardins', + ]); - foreach(range(1, 3) as $index) + foreach (range(1, 3) as $index) $this->fixture(Class_Hold_Pnb::class, - ['id' => $index, - 'user_id' => 6, - 'record_origin_id' => 'Dilicom-88817216', - 'hold_date' => '2018-10-06 22:10:09']); + ['id' => $index, + 'user_id' => 6, + 'record_origin_id' => 'Dilicom-88817216', + 'hold_date' => '2018-10-06 22:10:09']); Class_AdminVar::set('DILICOM_PNB_ENABLE_HOLDS', 1); $this->dispatch('abonne/reservations'); } - /** @test */ - public function h2MesReservationsNumeriquesShouldBePresent() { + public function h2MesReservationsNumeriquesShouldBePresent() + { $this->assertXPathContentContains('//div/h2', 'Mes réservations de documents'); } - /** @test */ - public function holdDateShouldBeInBadgePNBHoldDate() { + public function holdDateShouldBeInBadgePNBHoldDate() + { $this->assertXPathContentContains('//div//span[@class = "badge_tag pnb_hold_date text-left badge badge-info"]', '06/10/2018'); } - /** @test */ - public function holdStatusShouldBeInBadgePNBHoldStatus() { + public function holdStatusShouldBeInBadgePNBHoldStatus() + { $this->assertXPathContentContains('//div//span[@class = "badge_tag pnb_hold_status text-left badge badge-secondary"]', 'En attente'); } - /** @test */ - public function holdRankShouldBeInBadgePNBRank() { + public function holdRankShouldBeInBadgePNBRank() + { $this->assertXPathContentContains('//div//span[@class = "badge_tag pnb_hold_rank text-left badge badge-secondary"]', 'Rang 1'); } - /** @test */ - public function actionDeleteHoldShouldPresent() { + public function actionDeleteHoldShouldPresent() + { $this->assertXPathContentContains('//div//a[@href="/abonne/delete-pnb-hold/id/1"][@class="card-link"]', 'Supprimer'); } } - - - -class TemplatesAbonneSearchHistoryTest extends AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesAbonneSearchHistoryTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 9]); $searcher = $this->fixture(Class_Users::class, - ['id' => 1, - 'login' => 'Searcher', - 'password' => 'secret', - ]); + ['id' => 1, + 'login' => 'Searcher', + 'password' => 'secret', + ]); ZendAfi_Auth::getInstance()->logUser($searcher); $criteres_potter = (new Class_CriteresRecherche) ->setParams(['expressionRecherche' => 'Harry Potter', - 'page' => 2]); + 'page' => 2]); $criteres_davis = (new Class_CriteresRecherche) ->setParams(['rech_auteurs' => 'Miles Davis', - 'annee_fin' => '1970', - 'page' => 2]); + 'annee_fin' => '1970', + 'page' => 2]); - $history = new Class_SearchHistory(); + $history = new Class_SearchHistory; $history->add($criteres_potter); $history->add($criteres_davis); $this->dispatch('/opac/abonne'); } - /** @test */ - public function clearHistoryButtonShouldBePresent() { + public function clearHistoryButtonShouldBePresent() + { $this->assertXPathContentContains('//div[@class="collection_action alone_in_the_list clear_history_button col mr-3 col-3"]/a[@class="card-link clear_history_button btn btn-sm btn-warning"]', 'Vider'); } } - - - -class TemplatesAbonneEditActionFicheTest extends Admin_AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesAbonneEditActionFicheTest extends Admin_AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 19]); (new Class_Profil_Preferences) ->setModulePref(Class_Profil::getCurrentProfil(), - (new Class_Profil_ModuleDefinition('abonne', - 'fiche')), - [Intonation_Library_View_Wrapper_User_RichContent_Agenda::class => '0']); + new Class_Profil_ModuleDefinition('abonne', + 'fiche'), + [Intonation_Library_View_Wrapper_User_RichContent_Agenda::class => '0']); $this->dispatch('/admin/widget/edit-action/id/abonne_fiche/id_profil/19'); } - /** @test */ - public function pageShouldContainsCheckboxAgendaTabDeactivated() { + public function pageShouldContainsCheckboxAgendaTabDeactivated() + { $this->assertXPath('//input[@type="checkbox"][@name="Intonation_Library_View_Wrapper_User_RichContent_Agenda"][not(@checked)]'); } - /** @test */ - public function pageShouldContainsCheckboxHomeTabActivated() { + public function pageShouldContainsCheckboxHomeTabActivated() + { $this->assertXPath('//input[@type="checkbox"][@name="Intonation_Library_View_Wrapper_User_RichContent_Home"][@checked]'); } } - - - -class TemplatesAbonneAgendaDisabledTest extends AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesAbonneAgendaDisabledTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 9]); (new Class_Profil_Preferences) ->setModulePref(Class_Profil::getCurrentProfil(), - (new Class_Profil_ModuleDefinition('abonne', - 'fiche')), - [Intonation_Library_View_Wrapper_User_RichContent_Agenda::class => '0']); + new Class_Profil_ModuleDefinition('abonne', + 'fiche'), + [Intonation_Library_View_Wrapper_User_RichContent_Agenda::class => '0']); $searcher = $this->fixture(Class_Users::class, - ['id' => 1, - 'login' => 'Searcher', - 'password' => 'secret', - ]); + ['id' => 1, + 'login' => 'Searcher', + 'password' => 'secret', + ]); ZendAfi_Auth::getInstance()->logUser($searcher); $this->dispatch('/opac/abonne'); } - /** @test */ - public function agendaTabShouldNotBePresent() { + public function agendaTabShouldNotBePresent() + { $this->assertNotXPath('//div//a[contains(@class, "user_agenda")]'); } } - - - -class TemplatesAbonneJumbotronLoansTest extends TemplatesIntonationAccountTestCase { - +class TemplatesAbonneJumbotronLoansTest extends TemplatesIntonationAccountTestCase +{ /** @test */ - public function abonneHasLoanShouldRenderScript() { + public function abonneHasLoanShouldRenderScript() + { $this->dispatch('/abonne/has-loan/id_profil/72'); $this->assertXPath('//span[@class="success badge-success text-light"]'); } } - - - require_once __DIR__ . '/../../fixtures/KohaFixtures.php'; -abstract class TemplatesAbonneKohaAjaxLoansTestCase extends AbstractControllerTestCase { - +abstract class TemplatesAbonneKohaAjaxLoansTestCase extends AbstractControllerTestCase +{ public $mock_web_client; public function setUp(): void @@ -1882,36 +1833,35 @@ abstract class TemplatesAbonneKohaAjaxLoansTestCase extends AbstractControllerTe $sigb_plage = $this->fixture(Class_IntBib::class, - ['id' => 3, - 'comm_params' => - ['url_serveur' => 'http://plage.com/cgi-bin/koha/ilsdi.pl', - 'restful' => '1'], - 'comm_sigb' => Class_IntBib::COM_KOHA_LEGACY - ]); + ['id' => 3, + 'comm_params' => ['url_serveur' => 'http://plage.com/cgi-bin/koha/ilsdi.pl', + 'restful' => '1'], + 'comm_sigb' => Class_IntBib::COM_KOHA_LEGACY, + ]); $this->fixture(Class_Bib::class, - ['id' => 3, - 'libelle' => 'Bib de la plage 2', - 'int_bib' => $sigb_plage]); + ['id' => 3, + 'libelle' => 'Bib de la plage 2', + 'int_bib' => $sigb_plage]); $user = $this->fixture(Class_Users::class, - ['id' => 3, - 'login' => 'thom', - 'password' => 'thom', - 'id_site' => 12, - 'idabon' => '572', - 'id_sigb' => '572', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, - 'int_bib' => $sigb_plage]); + ['id' => 3, + 'login' => 'thom', + 'password' => 'thom', + 'id_site' => 12, + 'idabon' => '572', + 'id_sigb' => '572', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, + 'int_bib' => $sigb_plage]); $logger = $this ->mock() ->whenCalled('log')->answers(true) ->whenCalled('logError') ->willDo( - function($url, $message): void { - throw new RuntimeException($url . ' :: ' . $message); - }); + function ($url, $message): void { + throw new RuntimeException($url . ' :: ' . $message); + }); Class_WebService_SIGB_AbstractService::setLogger($logger); Class_WebService_SIGB_AbstractRESTService::shouldThrowError(true); @@ -1919,7 +1869,7 @@ abstract class TemplatesAbonneKohaAjaxLoansTestCase extends AbstractControllerTe ZendAfi_Auth::getInstance()->logUser($user); - $this->mock_web_client = new Class_Testing_WebService_SimpleWebClient(); + $this->mock_web_client = new Class_Testing_WebService_SimpleWebClient; $sigb_comm = $sigb_plage->getSIGBComm(); $sigb_comm->setWebClient($this->mock_web_client); @@ -1938,8 +1888,8 @@ abstract class TemplatesAbonneKohaAjaxLoansTestCase extends AbstractControllerTe $this->dispatch('/opac/abonne/ajax-loans/id/3'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_CommSigb::setLogger(null); Class_WebService_SIGB_AbstractService::setLogger(null); Class_WebService_SIGB_AbstractRESTService::shouldThrowError(false); @@ -1947,119 +1897,111 @@ abstract class TemplatesAbonneKohaAjaxLoansTestCase extends AbstractControllerTe } } - - - -class TemplatesAbonneKohaAjaxLoansTest extends TemplatesAbonneKohaAjaxLoansTestCase { - +class TemplatesAbonneKohaAjaxLoansTest extends TemplatesAbonneKohaAjaxLoansTestCase +{ public $mock_web_client; protected $_response; - public function _prepareResponse() { + + public function _prepareResponse() + { $this->mock_web_client ->whenCalled('open_url') ->with('http://plage.com/cgi-bin/koha/rest.pl/user/byid/572/issues_history') ->answers(KohaFixtures::xmlGetPatronLaureIssuesHistoryError()); } - /** @test */ - public function shouldRenderEmptyListMessageWithoutFatalError() { + public function shouldRenderEmptyListMessageWithoutFatalError() + { $this->assertXPathContentContains('//div[@class="collection_truncate_list col-12"]/p', - Class_CharSet::fromISOtoUTF8('Aucun élément')); + Class_CharSet::fromISOtoUTF8('Aucun élément')); } } - - - -class TemplatesAbonneKohaAjaxLoansHistoryMoreThan20Test - extends TemplatesAbonneKohaAjaxLoansTestCase { - +class TemplatesAbonneKohaAjaxLoansHistoryMoreThan20Test extends TemplatesAbonneKohaAjaxLoansTestCase +{ public $mock_web_client; - public function _prepareResponse() { + + public function _prepareResponse() + { $this->mock_web_client ->whenCalled('open_url') ->with('http://plage.com/cgi-bin/koha/rest.pl/user/byid/572/issues_history') ->answers(KohaFixtures::jsonGetPatronLaureIssueHistoryMoreThan20()); - } - /** @test */ - public function renderedlistShouldContains21Elements() { + public function renderedlistShouldContains21Elements() + { $this->assertXPathContentContains('//span[@class="truncate_list_size_number"]', - '21'); + '21'); } - /** @test */ - public function bodyShouldContainsIdAjaxPaginatedList() { + public function bodyShouldContainsIdAjaxPaginatedList() + { $this->assertXPath('//div[contains(@id,"ajax_paginated_list")]'); } - /** @test */ - public function renderedListShouldDisplay10Elements() { + public function renderedListShouldDisplay10Elements() + { $this->assertXPathCount('//div[contains(@class,"list-group")]//div[@class="card"]', 10); } } - - - -class TemplatesAbonneKohaAjaxLoansHistoryFourItemsTest - extends TemplatesAbonneKohaAjaxLoansTestCase { - +class TemplatesAbonneKohaAjaxLoansHistoryFourItemsTest extends TemplatesAbonneKohaAjaxLoansTestCase +{ public $mock_web_client; - public function _prepareResponse() { + + public function _prepareResponse() + { $this->mock_web_client ->whenCalled('open_url') ->with('http://plage.com/cgi-bin/koha/rest.pl/user/byid/572/issues_history') ->answers(KohaFixtures::jsonGetPatronLaureIssueHistoryFourItems()); } - /** @test */ - public function bodyShouldNotContainsIdAjaxPaginatedList() { + public function bodyShouldNotContainsIdAjaxPaginatedList() + { $this->assertNotXPath('//div[contains(@id,"ajax_paginated_list")]'); } - /** @test */ - public function bodyShouldContainsCarousel() { + public function bodyShouldContainsCarousel() + { $this->assertXPath('//div[contains(@class,"carousel slide")]'); } - /** @test */ - public function bodyShouldContainsFourCardsForLoans() { - $this->assertXPathCount('//div[contains(@class,"card card_template card_Intonation_Library_View_Wrapper_Loan")]',4); + public function bodyShouldContainsFourCardsForLoans() + { + $this->assertXPathCount('//div[@class="responsive_multiple_carousel_md col-12 d-none d-md-block d-xl-none"]//div[contains(@class,"card card_template card_Intonation_Library_View_Wrapper_Loan")]', 4); } } - - - -abstract class TemplatesAbonneCacheTestCase extends AbstractControllerTestCase { - - public function setUp(): void { +abstract class TemplatesAbonneCacheTestCase extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 8932]); $this->fixture(Class_IntBib::class, - ['id' => 1, - 'comm_sigb' => Class_IntBib::COM_NANOOK, - 'comm_params' => ['url_serveur' => 'http://localhost']]); + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_NANOOK, + 'comm_params' => ['url_serveur' => 'http://localhost']]); $user = $this->fixture(Class_Users::class, - ['id' => 3, - 'login' => 'patron', - 'password' => 'patron', - 'id_int_bib' => 1, - 'id_site' => 1, - 'idabon' => '007', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]); + ['id' => 3, + 'login' => 'patron', + 'password' => 'patron', + 'id_int_bib' => 1, + 'id_site' => 1, + 'idabon' => '007', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]); $cache = $this ->mock() @@ -2077,306 +2019,283 @@ abstract class TemplatesAbonneCacheTestCase extends AbstractControllerTestCase { ZendAfi_Auth::getInstance()->logUser($user); } - - public function tearDown(): void { + public function tearDown(): void + { Storm_Cache::setDefaultZendCache(null); parent::tearDown(); } - /** @test */ - public function removeCacheShouldHaveBeenCalled() { + public function removeCacheShouldHaveBeenCalled() + { $this->assertTrue(Storm_cache::getDefaultZendCache()->methodHasBeenCalled('remove')); } } - - - -class TemplatesAbonneCacheReservationsTest extends TemplatesAbonneCacheTestCase { - - public function setUp(): void { +class TemplatesAbonneCacheReservationsTest extends TemplatesAbonneCacheTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/reservations'); } } - - - -class TemplatesAbonneCacheFicheTest extends TemplatesAbonneCacheTestCase { - - public function setUp(): void { +class TemplatesAbonneCacheFicheTest extends TemplatesAbonneCacheTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/fiche'); } } - - - -class TemplatesAbonneCachePretsTest extends TemplatesAbonneCacheTestCase { - - public function setUp(): void { +class TemplatesAbonneCachePretsTest extends TemplatesAbonneCacheTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/prets'); } } - - - -class TemplatesAbonneCacheLoansHistoryTest extends TemplatesAbonneCacheTestCase { - - public function setUp(): void { +class TemplatesAbonneCacheLoansHistoryTest extends TemplatesAbonneCacheTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/loans-history'); } } - - - -class TemplatesAbonneCacheAjaxLoansTest extends TemplatesAbonneCacheTestCase { - - public function setUp(): void { +class TemplatesAbonneCacheAjaxLoansTest extends TemplatesAbonneCacheTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/abonne/ajax-loans'); } } - - - -class TemplatesAbonneCacheSuggestionsTest extends TemplatesAbonneCacheTestCase { - - public function setUp(): void { +class TemplatesAbonneCacheSuggestionsTest extends TemplatesAbonneCacheTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture(Class_SuggestionAchat::class, - ['id' => 2, - 'user_id' => Class_Users::getIdentity()->getId(), - 'date_creation' => '2012-03-01', - 'titre' => 'Harry Potter', - 'auteur' => 'J.K.Rowling', - 'type_doc_id' => '1', - 'description_url' => 'http://harrypotter.fr', - 'commentaire' => 'Je veux le lire']); + ['id' => 2, + 'user_id' => Class_Users::getIdentity()->getId(), + 'date_creation' => '2012-03-01', + 'titre' => 'Harry Potter', + 'auteur' => 'J.K.Rowling', + 'type_doc_id' => '1', + 'description_url' => 'http://harrypotter.fr', + 'commentaire' => 'Je veux le lire']); $this->dispatch('/opac/abonne/suggestions'); } - /** @test */ - public function titleShouldBeHarryPotter() { + public function titleShouldBeHarryPotter() + { $this->assertXPath('//main//div[@class="card-title card_title card_title_Intonation_Library_View_Wrapper_Suggestion"][text()="Harry Potter"]'); } } - - - -class TemplatesAbonnePaginatedReviewsSearchConsRoiTest - extends TemplatesAbonnePaginatedReviewsPage2Test { - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { - $this->dispatch('/opac/index/ajax-paginated-list/page/1/render/ajax/size/3/search/cons+roi/id/' . $helper->getId()); - } - - +class TemplatesAbonnePaginatedReviewsSearchConsRoiTest extends TemplatesAbonnePaginatedReviewsPage2Test +{ /** @test */ - public function pageSizeSelectedShouldEqualToSizeUrlParam() { + public function pageSizeSelectedShouldEqualToSizeUrlParam() + { $this->assertXPath('//div//form//select/option[@label="3"][@value=3][@selected]'); } - /** @test */ - public function inputSearchShouldHaveValueEqualToSearchUrlParam() { + public function inputSearchShouldHaveValueEqualToSearchUrlParam() + { $this->assertXPath('//div//form//input[contains(@class, "ajax_search")][@value="cons roi"]'); } - /** @test */ - public function searchTermConRoiShouldReturn2Reviews() { + public function searchTermConRoiShouldReturn2Reviews() + { $this->assertXPathCount('//div[contains(@class, "list-group-item")]', 2); } - /** @test */ - public function nextAnchorUrlShouldContainsSearchTermConsRoi() { + public function nextAnchorUrlShouldContainsSearchTermConsRoi() + { $this->assertXPath('//a[contains(@class, "next_ajax_anchor")][contains(@href, "/search/cons+roi")]'); } -} - - - - -class TemplatesAbonnePaginatedReviewsSearchConsRoiPage2Test - extends TemplatesAbonnePaginatedReviewsPage2Test { - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { - $this->dispatch('/opac/index/ajax-paginated-list/page/2/render/ajax/size/1/search/cons+roi/id/' . $helper->getId()); + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { + $this->dispatch('/opac/index/ajax-paginated-list/page/1/render/ajax/size/3/search/cons+roi/id/' . $helper->getId()); } +} - +class TemplatesAbonnePaginatedReviewsSearchConsRoiPage2Test extends TemplatesAbonnePaginatedReviewsPage2Test +{ /** @test */ - public function inputSearchShouldHaveValueEqualToSearchUrlParam() { + public function inputSearchShouldHaveValueEqualToSearchUrlParam() + { $this->assertXPath('//input[@value="cons roi"]'); } -} - + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { + $this->dispatch('/opac/index/ajax-paginated-list/page/2/render/ajax/size/1/search/cons+roi/id/' . $helper->getId()); + } +} - -class TemplatesDispatchAbonneUserMembershipTest extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesDispatchAbonneUserMembershipTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_AdminVar::set('TEMPLATING', 1); $this->fixture(Class_Membership::class, - ['id'=>2, - 'code'=>2, - 'libelle' => 'Abonnement invalide', - 'enabled' => 1]); + ['id' => 2, + 'code' => 2, + 'libelle' => 'Abonnement invalide', + 'enabled' => 1]); $this->fixture(Class_Membership::class, - ['id'=>3, - 'code'=>3, - 'libelle' => 'Bouquets numériques', - 'enabled' => 1]); + ['id' => 3, + 'code' => 3, + 'libelle' => 'Bouquets numériques', + 'enabled' => 1]); $user = Class_Users::getIdentity(); $this->fixture(Class_User_Membership::class, - ['id' => 4, - 'membership_id' => 1, - 'user' => $user, - 'start_date' => '2012-05-01', - 'end_date' => '2013-01-01']); + ['id' => 4, + 'membership_id' => 1, + 'user' => $user, + 'start_date' => '2012-05-01', + 'end_date' => '2013-01-01']); $this->fixture(Class_User_Membership::class, - ['id' => 2, - 'membership_id' => 2, - 'user' => $user, - 'start_date' => '1970-01-01', - 'end_date' => '1971-06-06']); + ['id' => 2, + 'membership_id' => 2, + 'user' => $user, + 'start_date' => '1970-01-01', + 'end_date' => '1971-06-06']); $this->fixture(Class_User_Membership::class, - ['id' => 3, - 'membership_id' => 3, - 'user' => $user, - 'start_date' => '2019-01-01', - 'end_date' => '']); + ['id' => 3, + 'membership_id' => 3, + 'user' => $user, + 'start_date' => '2019-01-01', + 'end_date' => '']); $this->fixture(Class_User_Membership::class, - ['id' => 4, - 'membership_id' => 666, - 'user' => $user, - 'start_date' => '2019-01-01', - 'end_date' => '']); + ['id' => 4, + 'membership_id' => 666, + 'user' => $user, + 'start_date' => '2019-01-01', + 'end_date' => '']); Class_User_Membership::setTimesource(new TimeSourceForTest('2017-01-31')); $this->_buildTemplateProfil(['id'=>1]); $this->dispatch('/opac/abonne'); } - /** @test */ - public function pageShouldContainsAbonnements() { + public function pageShouldContainsAbonnements() + { $this->assertXPathContentContains('//dt[contains(@class,"user_info")]', 'Abonnements'); } - /** @test */ - public function pageShouldContainsAbonneAdulte() { + public function pageShouldContainsAbonneAdulte() + { $this->assertXPathContentContains('//dd//p//strong', 'Abonné adulte'); } - /** @test */ - public function pageShouldContainsdu() { + public function pageShouldContainsdu() + { $this->assertXPathContentContains('//dd//p//span', 'du 01/01/2012 au 01/01/2020'); } + /** @test */ - public function pageShouldContainsBouquetsNumeriques() { + public function pageShouldContainsBouquetsNumeriques() + { $this->assertXPathContentContains('//dd//p//strong', 'Bouquets numériques'); } - /** @test */ - public function pageShouldContainsDuPremierJanvier2019() { + public function pageShouldContainsDuPremierJanvier2019() + { $this->assertXPathContentContains('//dd//p//span', 'du 01/01/2019'); } - /** @test */ - public function pageShouldNotContainsAbonnementInvalide() { + public function pageShouldNotContainsAbonnementInvalide() + { $this->assertNotXPathContentContains('//dd//p//strong', 'Abonnement invalide'); } } - - - -class TemplatesAbonneDispatchFicheWithMembershipBadgeAbonnementTest - extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchFicheWithMembershipBadgeAbonnementTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_FileManager::setFileSystem(null); Class_User_ILSSubscription::setTimesource(new TimeSourceForTest('2022-01-01')); + $this->fixture(Class_User_Membership::class, - ['id'=> 12, - 'user' => Class_Users::getIdentity(), - 'membership' => Class_Membership::find(1), - 'start_date' => '2021-01-03', - 'end_date' => '2022-12-12']); + ['id' => 12, + 'user' => Class_Users::getIdentity(), + 'membership' => Class_Membership::find(1), + 'start_date' => '2021-01-03', + 'end_date' => '2022-12-12']); $this->fixture(Class_User_Membership::class, - ['id'=> 15, - 'user' => Class_Users::getIdentity(), - 'membership' => Class_Membership::find(1), - 'start_date' => '2010-01-03', - 'end_date' => '2012-06-01']); + ['id' => 15, + 'user' => Class_Users::getIdentity(), + 'membership' => Class_Membership::find(1), + 'start_date' => '2012-01-03', + 'end_date' => '2012-01-03']); $this->dispatch('/opac/abonne/fiche/id_profil/72'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_User_ILSSubscription::setTimesource(null); parent::tearDown(); } - /** @test */ - public function badgeSubscriptionContentShouldContainsAbonneAdulte12Decembre() { - $this->assertXPathContentContains('//span[contains(@class,"badge_text")]',"Abonné adulte 12/12/2022"); + public function badgeSubscriptionContentShouldContainsAbonneAdulte12Decembre() + { + $this->assertXPathContentContains('//span[contains(@class,"badge_text")]', 'Abonné adulte 12/12/2022'); } - /** @test */ - public function badgeSubscriptionCountShouldBeTwo() { - $this->assertXPathCount('//span[contains(@class,"subscription")]',2); + public function badgeSubscriptionExpiredIn2013ShouldNotBeVisible() + { + $this->assertNotXPathContentContains('//div', '2013'); } } - - - -class TemplatesAbonneDispatchFicheWithMembershipBadgeAbonnementExpiredButUniqueTest - extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchFicheWithMembershipBadgeAbonnementExpiredButUniqueTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_FileManager::setFileSystem(null); @@ -2386,26 +2305,23 @@ class TemplatesAbonneDispatchFicheWithMembershipBadgeAbonnementExpiredButUniqueT $this->dispatch('/opac/abonne/fiche/id_profil/72'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_User_ILSSubscription::setTimesource(null); parent::tearDown(); } - /** @test */ - public function badgeSubscriptionInformationTitleShouldContainsAbonneAdultePremierJanvier2020() { - $this->assertXPathContentContains('//span[contains(@class,"badge_tag danger")]//span[contains(@class,"badge_text")]',"Abonné adulte 01/01/2020"); + public function badgeSubscriptionInformationTitleShouldContainsAbonneAdultePremierJanvier2020() + { + $this->assertXPathContentContains('//span[contains(@class,"badge_tag danger")]//span[contains(@class,"badge_text")]', 'Abonné adulte 01/01/2020'); } } - - - -class TemplatesAbonneDispatchFicheBadgeAbonnementWithoutMembershipsTest - extends TemplatesIntonationAccountTestCase { - - public function setUp(): void { +class TemplatesAbonneDispatchFicheBadgeAbonnementWithoutMembershipsTest extends TemplatesIntonationAccountTestCase +{ + public function setUp(): void + { parent::setUp(); Class_FileManager::setFileSystem(null); @@ -2417,131 +2333,164 @@ class TemplatesAbonneDispatchFicheBadgeAbonnementWithoutMembershipsTest $this->dispatch('/opac/abonne/fiche/id_profil/72'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_User_ILSSubscription::setTimesource(null); parent::tearDown(); } - /** @test */ - public function badgeSubscriptionInformationContentShouldContainsAbonneAdultePremierJanvier2020() { - $this->assertXPathContentContains('//span[contains(@class,"badge_tag")]//span[contains(@class,"badge_text")]',"01/01/2020"); + public function badgeSubscriptionInformationContentShouldContainsAbonneAdultePremierJanvier2020() + { + $this->assertXPathContentContains('//span[contains(@class,"badge_tag")]//span[contains(@class,"badge_text")]', '01/01/2020'); } - /** @test */ - public function badgeSubscriptionInformationTitleShouldContainsAbonneAdultePremierJanvier2020() { - $this->assertXPathContentContains('//span[contains(@class,"badge_tag")]//span[contains(@class,"sr-only")]',"Vous êtes abonné(e) jusqu'au"); + public function badgeSubscriptionInformationTitleShouldContainsAbonneAdultePremierJanvier2020() + { + $this->assertXPathContentContains('//span[contains(@class,"badge_tag")]//span[contains(@class,"sr-only")]', "Vous êtes abonné(e) jusqu'au"); } } +// hotline : https://forge.afi-sa.net/issues/181171 +class TemplatesAbonnePaginatedReviewsSearchWithEnteteUnderscoreTest extends TemplatesAbonnePaginatedCollectionsTestCase +{ + public $view; + /** @test */ + public function inputSearchShouldHaveValueEqualToSearchUrlParam() + { + $this->assertXPath('//div//form//input[contains(@class, "ajax_search")][@value="_test"]'); + } + /** @test */ + public function shouldContainsReviewWithContentAvecSaCouronne() + { + $this->assertXPathContentContains('//div[contains(@class,"card_body_Intonation_Library_View_Wrapper_ReviewInRecord")]', + 'Test De Recherche'); + } -/* hotline : https://forge.afi-sa.net/issues/181171 */ -class TemplatesAbonnePaginatedReviewsSearchWithEnteteUnderscoreTest - extends TemplatesAbonnePaginatedCollectionsTestCase { + /** @test */ + public function reviewNumberShouldBeOneOnly() + { + $this->assertXPathCount('//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_ReviewInRecord")]', 1); + } - public $view; - protected function _getModels() : array { + protected function _getModels(): array + { $this->fixture(Class_AvisNotice::class, - ['id' => 4, - 'id_user' => 666, - 'id_notice' => 2, - 'clef_oeuvre' => 'PSYKO', - 'note' => '4', - 'entete' => 'test sur le libéllé', - 'avis' => 'test sur le libéllé complet', - 'source_author' => null]); + ['id' => 4, + 'id_user' => 666, + 'id_notice' => 2, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'test sur le libéllé', + 'avis' => 'test sur le libéllé complet', + 'source_author' => null]); $this->fixture(Class_AvisNotice::class, - ['id' => 5, - 'id_user' => 666, - 'id_notice' => 3, - 'clef_oeuvre' => 'PSYKO', - 'note' => '4', - 'entete' => 'cest_un_Test', - 'avis' => 'Cest Un Test De Recherche JS', - 'source_author' => null]); + ['id' => 5, + 'id_user' => 666, + 'id_notice' => 3, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'cest_un_Test', + 'avis' => 'Cest Un Test De Recherche JS', + 'source_author' => null]); $this->fixture(Class_Notice::class, - ['id' => 2, - 'clef_oeuvre' => 'PSYKO']); + ['id' => 2, + 'clef_oeuvre' => 'PSYKO']); $this->fixture(Class_Notice::class, - ['id' => 3, - 'clef_oeuvre' => 'PSYKOTIC']); + ['id' => 3, + 'clef_oeuvre' => 'PSYKOTIC']); return array_map(fn($review) => (new Intonation_Library_View_Wrapper_ReviewsByRecord) ->setModel($review) ->setView($this->view), - Class_AvisNotice::groupByRecords(Class_AvisNotice::findAll())); + Class_AvisNotice::groupByRecords(Class_AvisNotice::findAll())); } - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { $this->dispatch('/opac/index/ajax-paginated-list/search/_test/id/' . $helper->getId()); } +} +abstract class TemplatesAbonnePaginatedLoansSortByTestCase extends TemplatesAbonnePaginatedCollectionsTestCase +{ + public $view; - /** @test */ - public function inputSearchShouldHaveValueEqualToSearchUrlParam() { - $this->assertXPath('//div//form//input[contains(@class, "ajax_search")][@value="_test"]'); + public function positionTitleAndReturnDate(): array + { + return [['', '', '']]; } - - /** @test */ - public function shouldContainsReviewWithContentAvecSaCouronne() { - $this->assertXPathContentContains('//div[contains(@class,"card_body_Intonation_Library_View_Wrapper_ReviewInRecord")]', - 'Test De Recherche'); + /** + * @test + * + * @dataProvider positionTitleAndReturnDate + * + * @param mixed $position + * @param mixed $title + * @param mixed $return_date + */ + public function loanPositionShouldContainsExpectedTitle($position, $title, $return_date) + { + $this->assertXPathContentContains('(//div[@class="document_title"])[' + . $position . ']//span[@class="200a"]', + $title); } - - /** @test */ - public function reviewNumberShouldBeOneOnly() { - $this->assertXPathCount('//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_ReviewInRecord")]', 1); + /** + * @test + * + * @dataProvider positionTitleAndReturnDate + * + * @param mixed $position + * @param mixed $title + * @param mixed $return_date + */ + public function loanPositionShouldContainsExpectedReturnDate($position, $title, $return_date) + { + $this->assertXPathContentContains('(//span[contains(@class,"badge_tag loan_issue_date")])[' + . $position . ']', + $return_date); } -} - - - -abstract class TemplatesAbonnePaginatedLoansSortByTestCase - extends TemplatesAbonnePaginatedCollectionsTestCase { - - public $view; - protected function _getModels() : array { + protected function _getModels(): array + { Class_Users::getIdentity() ->addChildCard($this->fixture(Class_Users::class, - [ 'id' => 123, - 'nom' => 'Souricier', - 'prenom' => 'Gris', - 'login' => '01234', - 'date_fin' => '2024-01-01', - 'password' => 's3cr3t', - 'idAbon' => '091234'])); + [ 'id' => 123, + 'nom' => 'Souricier', + 'prenom' => 'Gris', + 'login' => '01234', + 'date_fin' => '2024-01-01', + 'password' => 's3cr3t', + 'idAbon' => '091234'])); $cards = new Class_User_Cards(Class_Users::getIdentity()); $item = $this->fixture(Class_Exemplaire::class, - ['id' => 1901, - 'code_barres' => 12390, - 'id_int_bib' => 1, - 'id_origine' => 123412, - 'zone995' => serialize([['code' => 'a', 'valeur' => 'OrvalItem'], - ['code' => 'v', 'valeur' => '7']]), - 'notice' => $this->fixture(Class_Notice::class, - ['id' => 1889, - 'titre_principal' => 'Chroniques de la lune', - 'type_doc' => Class_TypeDoc::LIVRE, - 'url_image' => 'https://monimage.org/chr', - 'unimarc' => (new Class_NoticeUnimarc_Fluent) - ->zoneWithChildren('200', ['a' => 'Chroniques de la lune Noire', - 'f' => 'Ledroit, froideval', - 'h' => 't. 1']) - ->render() - ])]); + ['id' => 1901, + 'code_barres' => 12390, + 'id_int_bib' => 1, + 'id_origine' => 123412, + 'zone995' => serialize([['code' => 'a', 'valeur' => 'OrvalItem'], + ['code' => 'v', 'valeur' => '7']]), + 'notice' => $this->fixture(Class_Notice::class, + ['id' => 1889, + 'titre_principal' => 'Chroniques de la lune', + 'type_doc' => Class_TypeDoc::LIVRE, + 'url_image' => 'https://monimage.org/chr', + 'unimarc' => (new Class_NoticeUnimarc_Fluent) + ->zoneWithChildren('200', ['a' => 'Chroniques de la lune Noire', + 'f' => 'Ledroit, froideval', + 'h' => 't. 1']) + ->render(), + ])]); $chroniques = new Class_WebService_SIGB_Emprunt('15', new Class_WebService_SIGB_Exemplaire(12390)); $chroniques @@ -2554,11 +2503,11 @@ abstract class TemplatesAbonnePaginatedLoansSortByTestCase $chroniques ->parseExtraAttributes(['Dateretourprevue' => '20/10/1990', - 'Section' => 'Espace jeunesse', - 'Auteur' => 'Ledroit Froideval', - 'Bibliotheque' => 'Astrolabe', - 'N° de notice' => '1315', - 'Type' => 'P1']); + 'Section' => 'Espace jeunesse', + 'Auteur' => 'Ledroit Froideval', + 'Bibliotheque' => 'Astrolabe', + 'N° de notice' => '1315', + 'Type' => 'P1']); $elric = new Class_WebService_SIGB_Emprunt('16', new Class_WebService_SIGB_Exemplaire(12391)); $elric @@ -2567,26 +2516,26 @@ abstract class TemplatesAbonnePaginatedLoansSortByTestCase ->setTitre('Le secret') ->setIssueDate('06/09/2001') ->setExemplaireOPAC($this->fixture(Class_Exemplaire::class, - ['id' => 1990, - 'id_origine' => 12391, - 'code_barres' => 12391, - 'id_int_bib' => 1, - 'zone995' => serialize([['clef' => 'a', 'valeur' => 'Bob']]), - 'notice' => $this->fixture(Class_Notice::class, - ['id' => 827, - 'titre_principal' => 'Le secret', - 'unimarc' => (new Class_NoticeUnimarc_Fluent) - ->zoneWithChildren('200', ['a' => 'Elric le nécromancien', - 'f' => 'Michael Moorcock', - 'h' => 't. 1']) - ->render() - ])])); + ['id' => 1990, + 'id_origine' => 12391, + 'code_barres' => 12391, + 'id_int_bib' => 1, + 'zone995' => serialize([['clef' => 'a', 'valeur' => 'Bob']]), + 'notice' => $this->fixture(Class_Notice::class, + ['id' => 827, + 'titre_principal' => 'Le secret', + 'unimarc' => (new Class_NoticeUnimarc_Fluent) + ->zoneWithChildren('200', ['a' => 'Elric le nécromancien', + 'f' => 'Michael Moorcock', + 'h' => 't. 1']) + ->render(), + ])])); $elric->parseExtraAttributes(['Dateretourprevue' => '25/10/2010', - 'Section' => 'Espace jeunesse', - 'Auteur' => 'Michael Moorcock', - 'Bibliotheque' => 'Almont', - 'N° de notice' => '1990']); + 'Section' => 'Espace jeunesse', + 'Auteur' => 'Michael Moorcock', + 'Bibliotheque' => 'Almont', + 'N° de notice' => '1990']); $emprunteur = new Class_WebService_SIGB_Emprunteur('1502', 'Souricier'); $emprunteur ->setLibraryCode('IST') @@ -2595,76 +2544,42 @@ abstract class TemplatesAbonnePaginatedLoansSortByTestCase $user = Class_Users::find(123); $user ->setFicheSigb(['type_comm' => 2, - 'fiche' => $emprunteur, - 'erreur' => '']) + 'fiche' => $emprunteur, + 'erreur' => '']) ->setPseudo('souriciergris@leiber.org') ->beAbonneSIGB(); $loans = $cards->getLoansWithOutPNB([]); + return array_map(fn($loan) => (new Intonation_Library_View_Wrapper_Loan) ->setModel($loan) ->setView($this->view), - $loans->getArrayCopy()); - } - - - public function positionTitleAndReturnDate() : array { - return [['', '', '']]; - } - - - /** - * @test - * @dataProvider positionTitleAndReturnDate - */ - public function loanPositionShouldContainsExpectedTitle($position, $title, $return_date) { - $this->assertXPathContentContains('(//div[@class="document_title"])[' - . $position . ']//span[@class="200a"]', - $title); - } - - - /** - * @test - * @dataProvider positionTitleAndReturnDate - */ - public function loanPositionShouldContainsExpectedReturnDate($position, $title, $return_date) { - $this->assertXPathContentContains('(//span[contains(@class,"badge_tag loan_issue_date")])[' - . $position . ']', - $return_date); + $loans->getArrayCopy()); } } - - - -class TemplatesAbonnePretsSortByIssueDateDescTest - extends TemplatesAbonnePaginatedLoansSortByTestCase { - - protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) { - $this->dispatch('/opac/abonne/ajax-loans/current/1/size/10/id/' . $helper->getId()); - } - - - public function positionTitleAndReturnDate() : array { +class TemplatesAbonnePretsSortByIssueDateDescTest extends TemplatesAbonnePaginatedLoansSortByTestCase +{ + public function positionTitleAndReturnDate(): array + { return [[2, 'Harry Potter and the deathly', '01/02/2001'], [1, 'Chroniques de la lune Noire', '01/01/2001' ], [3, 'Alice au royaume de', '01/08/2001' ], [4, 'Elric le n', '06/09/2001' ]]; } -} - - + protected function _dispatch(Intonation_Library_PaginatedCollectionHelper $helper) + { + $this->dispatch('/opac/abonne/ajax-loans/current/1/size/10/id/' . $helper->getId()); + } +} class TemplatesAbonneChangePasswordAsAdminTest extends AbstractControllerTestCase { - public function setUp(): void { parent::setUp(); Class_Crypt::setPhpCommand($this->mock() - ->whenCalled('password_hash') ->with('mdp', PASSWORD_BCRYPT) ->willDo(fn($pass, $crypt) => '$2a$08$gPuCFG7FU2psZ52z5R.ACeW295qSfRJuTd04i/zwjjNI67ZUmVIHe') @@ -2681,21 +2596,20 @@ class TemplatesAbonneChangePasswordAsAdminTest extends AbstractControllerTestCas ->answers(true)); $user = $this->fixture(Class_Users::class, - ['id' => 789789, - 'login' => 'admin Jojo', - 'password' => 'test', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL - ]); + ['id' => 789789, + 'login' => 'admin Jojo', + 'password' => 'test', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL, + ]); ZendAfi_Auth::getInstance()->logUser($user); $this->postDispatch('/opac/abonne/changer-mon-mot-de-passe/id_profil/72', - ['current_password' => 'test', - 'new_password' => 'newsecret', - 'confirm_new_password' => 'newsecret']); + ['current_password' => 'test', + 'new_password' => 'newsecret', + 'confirm_new_password' => 'newsecret']); } - /** @test */ public function changePasswordPostNewsecretShouldUpdatePasswordUser() { diff --git a/tests/scenarios/Templates/TemplatesArticlesTest.php b/tests/scenarios/Templates/TemplatesArticlesTest.php index 63a681252c758e5c32bfdf8fbeed08a13d76ae27..3ee49a042c4cc8cf1b8f4c75820ffc5ee8cb5f76 100644 --- a/tests/scenarios/Templates/TemplatesArticlesTest.php +++ b/tests/scenarios/Templates/TemplatesArticlesTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -18,134 +19,129 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -abstract class TemplatesArticlesWidgetTestCase extends AbstractControllerTestCase { - - public function setUp(): void { +abstract class TemplatesArticlesWidgetTestCase extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); - $this->_buildTemplateProfil(['id' => 1, + $this->_buildTemplateProfil(['id' => 1, 'libelle' => 'My page']) ->setBoiteOfTypeInDivision(2, - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - ['all_layout' => Intonation_Library_Widget_Carousel_Definition::LISTING, - 'size' => 6, - 'order' => 'DebutPublicationAsc', - 'id_categorie' => '34', - 'id_items' => '4-6-7-12', - 'rss' => 1, - 'link_to_all' => 1, - 'embeded_code'=> 1, - 'IntonationShowFooter' => 1, - 'layout' => 'multiple_carousel', - 'cycle' => 4, - 'rendering' => 'card']) + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + ['all_layout' => Intonation_Library_Widget_Carousel_Definition::LISTING, + 'size' => 6, + 'order' => 'DebutPublicationAsc', + 'id_categorie' => '34', + 'id_items' => '4-6-7-12', + 'rss' => 1, + 'link_to_all' => 1, + 'embeded_code' => 1, + 'IntonationShowFooter' => 1, + 'layout' => 'multiple_carousel', + 'cycle' => 4, + 'rendering' => 'card']) ->assertSave(); $this->fixture(Class_ArticleCategorie::class, - ['id' => 34, - 'libelle' => 'News', - ]); + ['id' => 34, + 'libelle' => 'News', + ]); $this->fixture(Class_Article::class, - ['id' => 4, - 'id_cat' => 34, - 'titre' => 'Winter', - 'auteur'=> Class_Users::find(1), - 'contenu' => '<p>is ...</p>']); + ['id' => 4, + 'id_cat' => 34, + 'titre' => 'Winter', + 'auteur' => Class_Users::find(1), + 'contenu' => '<p>is ...</p>']); $this->fixture(Class_Article::class, - ['id' => 6, - 'id_cat' => 34, - 'titre' => 'Sprechen Sie Deutsch ?', - 'contenu' => '<p>Ich ...</p><img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=123&">']); + ['id' => 6, + 'id_cat' => 34, + 'titre' => 'Sprechen Sie Deutsch ?', + 'contenu' => '<p>Ich ...</p><img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=123&">']); $this->fixture(Class_Article::class, - ['id' => 7, - 'id_cat' => 34, - 'titre' => 'Parlez-vous français ?', - 'contenu' => '<img src="http://wikipedia.org/big.jpg"/><p>Une b...</p>', - 'tags' => 'jeunesse;démo; ; ', - 'events_debut' => '2020-03-13 00:00:00', - 'events_fin' => '2020-07-31 00:00:00', - 'all_day' => 1]); + ['id' => 7, + 'id_cat' => 34, + 'titre' => 'Parlez-vous français ?', + 'contenu' => '<img src="http://wikipedia.org/big.jpg"/><p>Une b...</p>', + 'tags' => 'jeunesse;démo; ; ', + 'events_debut' => '2020-03-13 00:00:00', + 'events_fin' => '2020-07-31 00:00:00', + 'all_day' => 1]); $this->fixture(Class_Article::class, - ['id' => 12, - 'id_cat' => 34, - 'titre' => 'Parlez-vous vraiment français ?', - 'contenu' => '<img src="http://wikipedia.org/big.jpg"/><p>Une b...</p>, 2eme session', - 'events_debut' => '2020-04-12 00:00:00', - 'events_fin' => '2020-04-15 00:00:00', - 'all_day' => 1]); + ['id' => 12, + 'id_cat' => 34, + 'titre' => 'Parlez-vous vraiment français ?', + 'contenu' => '<img src="http://wikipedia.org/big.jpg"/><p>Une b...</p>, 2eme session', + 'events_debut' => '2020-04-12 00:00:00', + 'events_fin' => '2020-04-15 00:00:00', + 'all_day' => 1]); $this->fixture(Class_Article::class, - ['id' => 9878, - 'id_cat' => 34, - 'titre' => 'Hola', - 'contenu' => '<img src="http://wikipedia.org/big.jpg"/><p>Une b...</p>', - 'events_debut' => '2020-05-13 00:00:00', - 'events_fin' => '2020-07-31 00:00:00', - 'all_day' => 1]); + ['id' => 9878, + 'id_cat' => 34, + 'titre' => 'Hola', + 'contenu' => '<img src="http://wikipedia.org/big.jpg"/><p>Une b...</p>', + 'events_debut' => '2020-05-13 00:00:00', + 'events_fin' => '2020-07-31 00:00:00', + 'all_day' => 1]); Class_Article_Loader::setSelectTool(new Class_Article_SelectForTest); } - - public function tearDown(): void { + public function tearDown(): void + { Class_Article_Loader::setSelectTool(null); parent::tearDown(); } } - - - -class TemplatesArticlesRenderAllTest extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +class TemplatesArticlesRenderAllTest extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/widget/render-all/profile_id/1/widget_id/1'); } - /** @test */ - public function pageShouldContainsWinterInListGroup() { + public function pageShouldContainsWinterInListGroup() + { $this->assertXPathContentContains('//div[contains(@class, "list-group")]//div[contains(@class, "card-title")]', - 'Winter'); + 'Winter'); } - /** @test */ - public function pageShouldContainsHolaInListGroup() { + public function pageShouldContainsHolaInListGroup() + { $this->assertXPathContentContains('//div[contains(@class, "list-group")]//div[contains(@class, "card-title")]', - 'Hola'); + 'Hola'); } - /** @test */ - public function pageShouldContainsAllFiveArticles() { + public function pageShouldContainsAllFiveArticles() + { $this->assertXPathCount('//div[contains(@class, "list-group")]//div[contains(@class, "card-title ")]', 5); } } - - - -class TemplatesArticlesEditWidgetTest extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +class TemplatesArticlesEditWidgetTest extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/admin/widget/edit-widget/id/1/id_profil/1'); } - /** @test */ - public function onChangeDoSideEffectsScriptShouldBePresentAfterInitScripts() { - $this->assertXPathContentContains('//script[contains(text(), \'$(function(){formSelectToggleVisibilityForElement("#layout", $("#cycle").closest("tr"), ["carousel", "multiple_carousel", "multiple_carousel_plus"]);});\')]/following-sibling::script', '$(function(){$("#layout").closest("form").onChangeDoSideEffects({\'input\' : \'#layout\', + public function onChangeDoSideEffectsScriptShouldBePresentAfterInitScripts() + { + $this->assertXPathContentContains('//script[contains(text(), \'$(function(){formSelectToggleVisibilityForElement("#layout", $("#cycle").closest("tr"), ["top_highlight_carousel", "left_highlight_carousel", "carousel", "multiple_carousel", "multiple_carousel_plus"]);});\')]/following-sibling::script', '$(function(){$("#layout").closest("form").onChangeDoSideEffects({\'input\' : \'#layout\', \'side_effects\' : [ {\'value\' : \'accordion\', @@ -155,48 +151,45 @@ class TemplatesArticlesEditWidgetTest extends TemplatesArticlesWidgetTestCase { \'value\' : \'5\'}]},'); } - /** @test */ - public function editArticlesWidgetShouldContainsDebutPublictationAscSelected() { + public function editArticlesWidgetShouldContainsDebutPublictationAscSelected() + { $this->assertXPath('//select[@name="order"]//option[@value="DebutPublicationAsc"][@selected]'); } - /** @test */ - public function inputForSizeShouldBeTypeNumberAndValueSix() { + public function inputForSizeShouldBeTypeNumberAndValueSix() + { $this->assertXPath('//input[@name="size"][@type="number"][@value="6"]'); } - /** @test */ - public function formShouldContainsInputNumberForDescriptionLength() { + public function formShouldContainsInputNumberForDescriptionLength() + { $this->assertXPath('//input[@type="number"][@name="description_length"][@value="20"]'); } - /** @test */ - public function formShouldContainsCheckboxDescriptionHtml() { + public function formShouldContainsCheckboxDescriptionHtml() + { $this->assertXPath('//input[@type="checkbox"][@name="description_html"][not(@checked)]'); } - /** @test */ - public function formCycleShouldBeEqualsToFour() { + public function formCycleShouldBeEqualsToFour() + { $this->assertXPath('//input[@type="number"][@name="cycle"][@value="4"]'); } - /** @test */ - public function cycleShouldBeVisibleWhenCarouselLayoutIsSelected() { - $this->assertXPathContentContains('//script', '$(function(){formSelectToggleVisibilityForElement("#layout", $("#cycle").closest("tr"), ["carousel", "multiple_carousel", "multiple_carousel_plus"]);});'); + public function cycleShouldBeVisibleWhenCarouselLayoutIsSelected() + { + $this->assertXPathContentContains('//script', '$(function(){formSelectToggleVisibilityForElement("#layout", $("#cycle").closest("tr"), ["top_highlight_carousel", "left_highlight_carousel", "carousel", "multiple_carousel", "multiple_carousel_plus"]);});'); } } - - - -class TemplatesArticlesWidgetTest extends TemplatesArticlesWidgetTestCase { - +class TemplatesArticlesWidgetTest extends TemplatesArticlesWidgetTestCase +{ public function setUp(): void { parent::setUp(); @@ -208,317 +201,311 @@ class TemplatesArticlesWidgetTest extends TemplatesArticlesWidgetTestCase { Class_Article::find(4) ->setAuteur($this->fixture(Class_Users::class, - ['id' => 1111, - 'login' => 'Toto1234', - 'password' => '1234', - 'nom' => 'Toto', - 'prenom' => 'Alfred'])); + ['id' => 1111, + 'login' => 'Toto1234', + 'password' => '1234', + 'nom' => 'Toto', + 'prenom' => 'Alfred'])); $this->dispatch('/opac/index/index/id_profil/1'); } - - public function articleTitles() { + public function articleTitles() + { return [ ['Winter'], ['Sprechen Sie Deutsch'], - ['Parlez-vous français'] + ['Parlez-vous français'], ]; } - /** * @test + * * @dataProvider articleTitles + * + * @param mixed $title */ - public function widgetCarouselArticleShouldContainsTitle($title) { + public function widgetCarouselArticleShouldContainsTitle($title) + { $this->assertXPathContentContains('//div[contains(@class, "boite news")]//div[contains(@class, "card-title")]', - $title); + $title); } - /** @test */ - public function widgetCarouselArticleShouldNotContainsAlfredToto() { + public function widgetCarouselArticleShouldNotContainsAlfredToto() + { $this->assertNotXPathContentContains('//div[contains(@class, "boite news")]//div[@class="card-subtitle"]', 'Alfred Toto'); } - /** @test */ - public function widgetCarouselArticleHoverShoulNotContainAlfredToto() { + public function widgetCarouselArticleHoverShoulNotContainAlfredToto() + { $this->assertNotXpath('//div[contains(@class, "boite news")]//a[contains(@title,"Alfred Toto")]'); } - /** @test */ - public function pageArticleShouldBeAccessible() { + public function pageArticleShouldBeAccessible() + { $this->assertAccessible(); } + /** @test */ + public function pageWithArticlesShouldBeHTML5Valid() + { + $this->assertHTML5(); + } /** @test */ - public function articleLinkTitleShouldContainsEventDebut() { + public function articleLinkTitleShouldContainsEventDebut() + { $this->assertXPathContentContains('//a[contains(@href,"/cms/articleview/id/12")]//span[@class="sr-only"]', - 'Lire l\'article: Parlez-vous vraiment français ? 12/04/2020'); + 'Lire l\'article: Parlez-vous vraiment français ? 12/04/2020'); } } - - - -class TemplatesArticlesCmsListActionTest extends TemplatesArticlesWidgetTestCase { - +class TemplatesArticlesCmsListActionTest extends TemplatesArticlesWidgetTestCase +{ /** @test */ - public function dispatchShouldRenderSprechenSieDeutsh() { + public function dispatchShouldRenderSprechenSieDeutsh() + { $this->dispatch('/opac/cms/list/title/language/articles/7-6/id_profil/1'); $this->assertXPathContentContains('//main//div[@class="col-12 articles_list_content"]//div[@class="col-12 wrapper_article_content"]', 'Parlez-vous français ?'); } } - - - -class TemplatesArticlesCmsArticleViewTest extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +class TemplatesArticlesCmsArticleViewTest extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Article::find(7) ->setAuteur($this->fixture(Class_Users::class, - ['id' => 88393, - 'login' => 'Harlock', - 'password' => 'Arc4di4 for 3v3r'])); + ['id' => 88393, + 'login' => 'Harlock', + 'password' => 'Arc4di4 for 3v3r'])); $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); } - /** @test */ - public function etiquetteJeunesseShouldBePresent() { + public function etiquetteJeunesseShouldBePresent() + { $this->assertXPath('//div//span[@class="badge_tag badge-dark text-left badge"]//span[@class="badge_text align-middle d-inline-block text-left"][text()="jeunesse"]//span[@class="sr-only"][text()="Étiquette: "]'); } - /** @test */ - public function etiquetteDemoShouldBePresent() { + public function etiquetteDemoShouldBePresent() + { $this->assertXPath('//div//span[@class="badge_tag badge-dark text-left badge"]//span[@class="badge_text align-middle d-inline-block text-left"][text()="démo"]//span[@class="sr-only"][text()="Étiquette: "]'); } - /** @test */ - public function onlyTwoEtiquettesShouldBePresent() { + public function onlyTwoEtiquettesShouldBePresent() + { $this->assertXPathCount('//div//span[@class="badge_tag badge-dark text-left badge"]//span[@class="badge_text align-middle d-inline-block text-left"]', 2); } - /** @test */ - public function authorShouldNotBePresent() { + public function authorShouldNotBePresent() + { $this->assertNotXPathContentContains('//div', 'Harlock'); } - /** @test */ - public function parlerVousFrançaisShouldBePresent() { + public function parlerVousFrançaisShouldBePresent() + { $this->assertXPathContentContains('//main//div//h1[@class="card-title"]', 'Parlez-vous français ?'); } - /** @test */ - public function eventStartShouldBeInABadge() { + public function eventStartShouldBeInABadge() + { $this->assertXPathContentContains('//span[@class="badge_tag badge_event_start text-left badge badge-success no_truncate"]', '13/03/2020'); } - /** @test */ - public function eventEndShouldBeInABadge() { + public function eventEndShouldBeInABadge() + { $this->assertXPathContentContains('//span[@class="badge_tag badge_event_end text-left badge badge-warning no_truncate"]', '31/07/2020'); } - /** @test */ - public function calendarEventDateShouldBeFromFriday13thMarchToFriday31thJuly2020() { + public function calendarEventDateShouldBeFromFriday13thMarchToFriday31thJuly2020() + { $this->assertXPath('//span[@class="calendar_event_date"][text()="Du vendredi 13 mars au vendredi 31 juillet 2020"]'); } - /** @test */ - public function moreActionShouldBeInDropdown() { + public function moreActionShouldBeInDropdown() + { $this->assertXPathContentContains('//div[@class="card card_article col-12 mb-3"]//div[@class="card-footer d-flex flex-column flex-md-row justify-content-between"]//div[@class="dropdown"]//button', 'Plus'); } } - - - -class TemplatesArticlesCmsArticleViewWithHiddenTitleTest extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +class TemplatesArticlesCmsArticleViewWithHiddenTitleTest extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Article::find(7) ->setCacherTitre(1) ->setAuteur($this->fixture(Class_Users::class, - ['id' => 88393, - 'login' => 'Harlock', - 'password' => 'Arc4di4 for 3v3r'])); + ['id' => 88393, + 'login' => 'Harlock', + 'password' => 'Arc4di4 for 3v3r'])); $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); } - /** @test */ - public function titleH2ParlerVousFrançaisShouldNotBePresent() { + public function titleH2ParlerVousFrançaisShouldNotBePresent() + { $this->assertNotXPath('//main//div//h2[@class="card-title"]'); } - /** @test */ - public function authorShouldNotBePresent() { + public function authorShouldNotBePresent() + { $this->assertNotXPathContentContains('//div', 'Harlock'); } } - - - -abstract class TemplatesArticlesWithLocationTestCase extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +abstract class TemplatesArticlesWithLocationTestCase extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); $annecy = $this->fixture(Class_Lieu::class, - ['id' => '4156465', - 'libelle' => 'Annecy', - 'adresse' => 'Rue des tomates', - 'telephone' => '01 23 87 38 47', - 'code_postal' => '74000', - 'mail' => 'contact@annecy.fr', - 'latitude' => '45.9262592', - 'longitude' => '6.1459837']); + ['id' => '4156465', + 'libelle' => 'Annecy', + 'adresse' => 'Rue des tomates', + 'telephone' => '01 23 87 38 47', + 'code_postal' => '74000', + 'mail' => 'contact@annecy.fr', + 'latitude' => '45.9262592', + 'longitude' => '6.1459837']); Class_Article::find(7) ->setLieu($annecy); $lost_location = $this->fixture(Class_Lieu::class, - ['id' => '9283', - 'libelle' => 'Nowhere', - 'mail' => 'nobody@nowhere.fr', - 'latitude' => '', - 'longitude' => '']); + ['id' => '9283', + 'libelle' => 'Nowhere', + 'mail' => 'nobody@nowhere.fr', + 'latitude' => '', + 'longitude' => '']); $this->fixture(Class_Article::class, - ['id' => 8, - 'titre' => 'Lost in translation', - 'contenu' => 'with Bill', - 'lieu' => $lost_location]); + ['id' => 8, + 'titre' => 'Lost in translation', + 'contenu' => 'with Bill', + 'lieu' => $lost_location]); } } - - - -class TemplatesArticlesWithLocationViewTest extends TemplatesArticlesWithLocationTestCase { - - public function setUp(): void { +class TemplatesArticlesWithLocationViewTest extends TemplatesArticlesWithLocationTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); } - /** @test */ - public function locationDivShouldContainsStaticMap() { + public function locationDivShouldContainsStaticMap() + { $this->assertXPath('//div[@class = "article_location_static_map col-12 col-md-6 col-xl-4 order-3 order-md-2 pt-md-5 px-5 px-md-0"]//img[contains(@src,"https://smap.afi-sa.net/staticmap.php")]'); } - /** @test */ - public function locationDivShouldContainsAddressAnnecy() { + public function locationDivShouldContainsAddressAnnecy() + { $this->assertXPathContentContains('//div[contains(@class, "badge-group badge_group badge_group_Intonation_Library_View_Wrapper_Location")]//address', - 'Rue des tomates'); + 'Rue des tomates'); } - /** @test */ - public function mediaDivShouldLinkToPhone01_23_87_38_47() { + public function mediaDivShouldLinkToPhone0123873847() + { $this->assertXPathContentContains('//div[@class="badge-group badge_group badge_group_Intonation_Library_View_Wrapper_Location"]//a[@href="tel:01 23 87 38 47"]', - '01 23 87 38 47'); + '01 23 87 38 47'); } - /** @test */ - public function mediaDivShouldLinkToMailContactAtAnnecy() { + public function mediaDivShouldLinkToMailContactAtAnnecy() + { $this->assertXPathContentContains('//div[@class="badge-group badge_group badge_group_Intonation_Library_View_Wrapper_Location"]//a[@href="mailto:contact@annecy.fr"]', - 'contact@annecy.fr'); + 'contact@annecy.fr'); } - /** @test */ - public function metaOgForFacebookShouldBePresent() { + public function metaOgForFacebookShouldBePresent() + { $this->assertXPath('//meta[@property="og:url"][contains(@content,"cms/articleview/id/7")]'); } - /** @test */ - public function metaOgImageForFacebookShouldContains() { + public function metaOgImageForFacebookShouldContains() + { $this->assertXPath('//meta[@property="og:image"][contains(@content,"http://wikipedia.org/big.jpg")]'); } - /** @test */ - public function metaOgTitleForFacebookShouldContains() { + public function metaOgTitleForFacebookShouldContains() + { $this->assertXPath('//meta[@property="og:title"][contains(@content,"Parlez-vous français ?")]'); } } - - - -class TemplatesArticlesWithLocationRelatedToLibraryViewTest - extends TemplatesArticlesWithLocationTestCase { - - public function setUp(): void { +class TemplatesArticlesWithLocationRelatedToLibraryViewTest extends TemplatesArticlesWithLocationTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture(Class_Bib::class, - ['id' => 123, - 'libelle' => 'Médiathèque d\'annecy', - 'id_lieu' => 4156465]); + ['id' => 123, + 'libelle' => 'Médiathèque d\'annecy', + 'id_lieu' => 4156465]); $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); } - /** @test */ - public function linkToMediathequeAnnecyShouldBePresent() { + public function linkToMediathequeAnnecyShouldBePresent() + { $this->assertXPathContentContains('//div[@class="article_location_data col-12 col-md-6 col-xl-4 order-2 order-md-3"]//div[@class="card card_template card_Intonation_Library_View_Wrapper_Library"]//a[contains(@href, "bib/en-lire-plus/id/123")]', 'Médiathèque d\'annecy'); } } - - - -class TemplatesArticlesBadgesTest extends TemplatesArticlesWithLocationTestCase { - +class TemplatesArticlesBadgesTest extends TemplatesArticlesWithLocationTestCase +{ /** @test */ - public function articleBadgeDraftShouldBeBadgeDanger() { + public function articleBadgeDraftShouldBeBadgeDanger() + { Class_AdminVar::set('WORKFLOW', 1); Class_Article::find(7)->beDraft(); $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); $this->assertXPath('//span[@class="badge_tag badge_article_draft text-left badge badge-danger"]'); } - /** @test */ - public function articleBadgeLibraryShouldBeBadgePrimaryNoTruncate() { + public function articleBadgeLibraryShouldBeBadgePrimaryNoTruncate() + { $this->fixture(Class_Bib::class, - ['id' => 123, - 'libelle' => 'Médiathèque d\'annecy', - 'id_lieu' => 4156465]); + ['id' => 123, + 'libelle' => 'Médiathèque d\'annecy', + 'id_lieu' => 4156465]); $this->fixture(Class_ArticleCategorie::class, - ['id' => 12374832, - 'libelle' => 'annecy', - 'id_site' => 123]); + ['id' => 12374832, + 'libelle' => 'annecy', + 'id_site' => 123]); Class_Article::find(7) ->setIdCat(12374832); @@ -527,13 +514,13 @@ class TemplatesArticlesBadgesTest extends TemplatesArticlesWithLocationTestCase $this->assertXPathContentContains('//a[@class="badge_tag badge_article_library text-left badge badge-primary no_truncate"]', 'Médiathèque d\'annecy'); } - /** @test */ - public function articleBadgeCategoryShouldBeBadgeInfo() { + public function articleBadgeCategoryShouldBeBadgeInfo() + { $this->fixture(Class_ArticleCategorie::class, - ['id' => 12374832, - 'libelle' => 'annecy', - 'id_site' => 123]); + ['id' => 12374832, + 'libelle' => 'annecy', + 'id_site' => 123]); Class_Article::find(7) ->setIdCat(12374832); @@ -542,20 +529,18 @@ class TemplatesArticlesBadgesTest extends TemplatesArticlesWithLocationTestCase $this->assertXPathContentContains('//span[@class="badge_tag badge_article_category text-left badge badge-info"]', 'annecy'); } - /** @test */ - public function articleBadgeLocationShouldBeBadgeSecondaryNoTruncate() { + public function articleBadgeLocationShouldBeBadgeSecondaryNoTruncate() + { $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); $this->assertXPathContentContains('//span[@class="badge_tag badge_article_location text-left badge badge-secondary no_truncate"]', 'Annecy'); } } - - - -class TemplatesArticlesMapTest extends TemplatesArticlesWithLocationTestCase { - - public function setUp(): void { +class TemplatesArticlesMapTest extends TemplatesArticlesWithLocationTestCase +{ + public function setUp(): void + { parent::setUp(); ZendAfi_Auth::getInstance()->clearIdentity(); @@ -566,153 +551,151 @@ class TemplatesArticlesMapTest extends TemplatesArticlesWithLocationTestCase { Class_Profil::find(1) ->setBoiteOfTypeInDivision(3, - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - ['layout' => Intonation_Library_Widget_Carousel_Definition::MAP, - 'titre' => 'event map', - 'id_items' => '7;8']) + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + ['layout' => Intonation_Library_Widget_Carousel_Definition::MAP, + 'titre' => 'event map', + 'id_items' => '7;8']) ->assertSave(); $this->dispatch('/opac/index/index/id_profil/1'); } - /** @test */ - public function pageShouldContainsWidgetNewsWithLeafletOSM() { + public function pageShouldContainsWidgetNewsWithLeafletOSM() + { $this->assertXPath('//div[contains(@class, "news")]//div[contains(@class, "leaflet_osm")]'); } - /** @test */ - public function dataOSMShouldContainsArticleWithLatitudeAndLongitude() { + public function dataOSMShouldContainsArticleWithLatitudeAndLongitude() + { $this->assertXPath('//div[contains(@data-osm, "Parlez-vous")][contains(@data-osm, "6.1459837")][contains(@data-osm, "45.9262592")]'); } - /** @test */ - public function dataOSMShouldNotContainsArticleLostInTranslation() { + public function dataOSMShouldNotContainsArticleLostInTranslation() + { $this->assertNotXPath('//div[contains(@data-osm, "Lost in translation")]'); } } - - - -class TemplatesArticlesWithInvalidConfigurationTest extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +class TemplatesArticlesWithInvalidConfigurationTest extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Article_Loader::setSelectTool(null); Class_Profil::find(1) ->setModuleAccueilPreferences(1, - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - [ - 'order' => Intonation_Library_Widget_Carousel_Article_Definition::SORT_SELECTION, - 'id_items' => '', - 'id_categorie' => '']) + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + [ + 'order' => Intonation_Library_Widget_Carousel_Article_Definition::SORT_SELECTION, + 'id_items' => '', + 'id_categorie' => '']) ->assertSave(); $this->dispatch('/opac/index/index/id_profil/1'); } - /** @test */ - public function pageShouldContainsErrorAucunArticle() { + public function pageShouldContainsErrorAucunArticle() + { $this->assertXPathContentContains('//div[@id="boite_1"]//p', - 'Aucun article'); + 'Aucun article'); } } - - - -class TemplatesArticlesWithOrderCreationDateTest extends TemplatesArticlesWidgetTestCase { - - public function setUp(): void { +class TemplatesArticlesWithOrderCreationDateTest extends TemplatesArticlesWidgetTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Profil::find(1) ->setModuleAccueilPreferences(1, - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - [ - 'order' => Intonation_Library_Widget_Carousel_Article_Definition::SORT_CREATION_DESC - ]) + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + [ + 'order' => Intonation_Library_Widget_Carousel_Article_Definition::SORT_CREATION_DESC, + ]) ->assertSave(); $this->dispatch('/opac/index/index/id_profil/1'); } - /** @test */ - public function pageShouldContainsLinkToAddNewArticle() { + public function pageShouldContainsLinkToAddNewArticle() + { $this->assertXPathContentContains('//a[contains(@href, "admin/cms/add")]', - 'Ajouter un nouvel article'); + 'Ajouter un nouvel article'); } - /** @test */ - public function recordsWidgetShouldNotBeInNewsWidgetCarousel() { + public function recordsWidgetShouldNotBeInNewsWidgetCarousel() + { $this->assertNotXPath('//div[contains(@class, "boite news")]//div[contains(@class, "boite kiosque")]'); } } - - - -class TemplatesArticlesRenderWithDescriptionLengthTest extends AbstractControllerTestCase { - +class TemplatesArticlesRenderWithDescriptionLengthTest extends AbstractControllerTestCase +{ protected $_profile_patcher; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $profile = - $this->_buildTemplateProfil(['id' => 1, + $this->_buildTemplateProfil(['id' => 1, 'template' => 'MUSCLE']); $this->_profile_patcher = (new Class_Template_ProfilePatcher(null)) ->setProfile($profile); $this->fixture(Class_Article::class, - ['id' => 9, - 'titre' => 'Savez-vous compter ?', - 'contenu' => implode(' ' , range(1, 100))]); + ['id' => 9, + 'titre' => 'Savez-vous compter ?', + 'contenu' => implode(' ', range(1, 100))]); Class_Article_Loader::setSelectTool(new Class_Article_SelectForTest); } - - public function tearDown(): void { + public function tearDown(): void + { Class_Article_Loader::setSelectTool(null); parent::tearDown(); } - - public function getPreferencesAndContent() { + public function getPreferencesAndContent() + { return [ - [ 30 , implode(' ', range(1, 30)) . ' …' ], - [ 99 , implode(' ', range(1, 99)) . ' …' ], - [ 100 , implode(' ', range(1, 100)) ], - [ 0 , implode(' ', range(1, 100)) ] + [ 30, implode(' ', range(1, 30)) . ' …' ], + [ 99, implode(' ', range(1, 99)) . ' …' ], + [ 100, implode(' ', range(1, 100)) ], + [ 0, implode(' ', range(1, 100)) ], ]; } - /** * @dataProvider getPreferencesAndContent + * * @test + * + * @param mixed $description_length + * @param mixed $expected_content */ - public function widgetCarouselArticleShouldContainsNumbers($description_length, $expected_content) { + public function widgetCarouselArticleShouldContainsNumbers($description_length, $expected_content) + { $this->_profile_patcher ->addWidget( - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - [ - 'order' => 'Selection', - 'id_items' => '9', - 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, - 'description_length' => $description_length - ] + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + Class_Profil::DIV_MAIN, + [ + 'order' => 'Selection', + 'id_items' => '9', + 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, + 'description_length' => $description_length, + ] ); $this->dispatch('/opac/index/index/id_profil/1'); @@ -720,20 +703,20 @@ class TemplatesArticlesRenderWithDescriptionLengthTest extends AbstractControlle $this->assertXPath('//div[contains(@class, "boite news")]//p[@class="model_description_Class_Article"][text()="' . $expected_content . '"]'); } - /** * @test */ - public function widgetCarouselArticleShouldContainsNumbersFrom1To20ByDefault() { + public function widgetCarouselArticleShouldContainsNumbersFrom1To20ByDefault() + { $this->_profile_patcher ->addWidget( - Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - [ - 'order' => 'Selection', - 'id_items' => '9', - 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, - ] + Intonation_Library_Widget_Carousel_Article_Definition::CODE, + Class_Profil::DIV_MAIN, + [ + 'order' => 'Selection', + 'id_items' => '9', + 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, + ] ); $this->dispatch('/opac/index/index/id_profil/1'); @@ -742,21 +725,19 @@ class TemplatesArticlesRenderWithDescriptionLengthTest extends AbstractControlle } } - - - -class TemplatesArticlesWidgetWithDescriptionLengthTest extends AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesArticlesWidgetWithDescriptionLengthTest extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); Class_AdminVar::set('TEMPLATING', 1); ZendAfi_Auth::getInstance()->clearIdentity(); $profile = $this->fixture(Class_Profil::class, - ['id' => 34, - 'template' => 'MUSCLE' - ]); + ['id' => 34, + 'template' => 'MUSCLE', + ]); $profile->beCurrentProfil(); @@ -767,61 +748,59 @@ class TemplatesArticlesWidgetWithDescriptionLengthTest extends AbstractControlle ->onLoaderOfModel(Class_Article::class) ->whenCalled('getArticlesByPreferences') ->answers([$this->fixture(Class_Article::class, - ['id' => 7, - 'titre' => 'Parlez-vous français ?', - 'description' => '<canvas></canvas>La description s\'arrête ici et pas plus loin.', - 'contenu' => '<p>Une b...</p>'])]); + ['id' => 7, + 'titre' => 'Parlez-vous français ?', + 'description' => '<canvas></canvas>La description s\'arrête ici et pas plus loin.', + 'contenu' => '<p>Une b...</p>'])]); Class_Article_Loader::setSelectTool(new Class_Article_SelectForTest); $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'layout' => 'list', - 'size' => 1, - 'description_length' => 4]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'layout' => 'list', + 'size' => 1, + 'description_length' => 4]); $this->dispatch('/opac/widget/render/widget_id/1/profile_id/34/anchor_target/_blank'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_Article_Loader::setSelectTool(null); parent::tearDown(); } - /** @test */ - public function descriptionShouldBeTruncate() { + public function descriptionShouldBeTruncate() + { $this->assertXPathContentContains('//div[contains(@class, "news widget")]//p[contains(@class, "model_description")]', - 'La description s\'arrête ici …'); + 'La description s\'arrête ici …'); } - /** @test */ - public function allFourAnchorsWithHrefShouldHaveTargetBlank() { + public function allFourAnchorsWithHrefShouldHaveTargetBlank() + { $this->assertXPathCount('//a[@href][@target="_blank"]', '4'); } - /** @test */ - public function moreActionShouldBeInDropdownDropleftDropup() { + public function moreActionShouldBeInDropdownDropleftDropup() + { $this->assertXPathContentContains('//div[contains(@class, "card-footer")]//div[@class="dropdown dropleft dropup"]//button', 'Plus'); } - /** @test */ - public function pageShouldBeAccessible() { + public function pageShouldBeAccessible() + { $this->assertAccessible(false); } } - - - -class TemplatesArticlesWithNoLocationViewTest extends TemplatesArticlesWithLocationTestCase { - - public function setUp(): void { +class TemplatesArticlesWithNoLocationViewTest extends TemplatesArticlesWithLocationTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Article::find(7)->setLieu(null); @@ -829,18 +808,15 @@ class TemplatesArticlesWithNoLocationViewTest extends TemplatesArticlesWithLocat $this->dispatch('/opac/cms/articleview/id/7/id_profil/1'); } - /** @test */ - public function locationDivShouldNotBePresent() { + public function locationDivShouldNotBePresent() + { $this->assertNotXPath('//div[contains(@class, "article_location")]'); } } - - - -class TemplatesArticlesWithCustomFieldsViewTest extends TemplatesArticlesWithLocationTestCase { - +class TemplatesArticlesWithCustomFieldsViewTest extends TemplatesArticlesWithLocationTestCase +{ public function setUp(): void { parent::setUp(); @@ -849,57 +825,54 @@ class TemplatesArticlesWithCustomFieldsViewTest extends TemplatesArticlesWithLoc ->setIdOrigine(123) ->setRepositoryOrigine('External_Agenda:13'); $this->fixture(Class_CustomField_Meta::class, - ['id' => 123, - 'label' => 'Categorie', - 'source_id' => 'openAgendav2', - 'import_type' => 'source', - 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, - ]); + ['id' => 123, + 'label' => 'Categorie', + 'source_id' => 'openAgendav2', + 'import_type' => 'source', + 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, + ]); $this->fixture(Class_CustomField::class, - ['id' => 12, - 'meta_id' => 123, - 'label' => 'Categorie', - 'model' => 'Article', - 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, - ]); + ['id' => 12, + 'meta_id' => 123, + 'label' => 'Categorie', + 'model' => 'Article', + 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, + ]); $setup_value = $this->fixture(Class_CustomField_SetupValue::class, - ['id' => 4, - 'meta_id' => 123, - 'label' => 'Exposition', - 'source_id' => 'openAgendav2', - 'import_type' => 'source', - 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, - ]); + ['id' => 4, + 'meta_id' => 123, + 'label' => 'Exposition', + 'source_id' => 'openAgendav2', + 'import_type' => 'source', + 'field_type' => Class_CustomField_Meta::MULTI_CHECKBOX, + ]); $article - ->addCustomFieldValues(12, $setup_value ) + ->addCustomFieldValues(12, $setup_value) ->saveWithCustomFields(); $this->dispatch('/opac/cms/articleview/id/7'); } - /** @test */ - public function badgejeunesseShouldBeDisplayed() { + public function badgejeunesseShouldBeDisplayed() + { $this->assertXPathContentContains('//span[contains(@class, "badge_text")]', - 'jeunesse'); + 'jeunesse'); } - /** @test */ - public function badgeCustomFieldShouldBeDisplayed() { + public function badgeCustomFieldShouldBeDisplayed() + { $this->assertXPathContentContains('//span[contains(@class, "badge_tag custom_field custom_field_1")]', - 'Exposition'); + 'Exposition'); } } - - - -abstract class TemplatesArticlesWidgetAjaxRenderingTestCase extends AbstractControllerTestCase { - +abstract class TemplatesArticlesWidgetAjaxRenderingTestCase extends AbstractControllerTestCase +{ public function setUp(): void { parent::setUp(); @@ -909,45 +882,44 @@ abstract class TemplatesArticlesWidgetAjaxRenderingTestCase extends AbstractCont $this->_buildTemplateProfil(['id' => 34]); $this->fixture(Class_ArticleCategorie::class, - ['id' => 1, - 'libelle' => 'Ils se ressemblent' - ]); + ['id' => 1, + 'libelle' => 'Ils se ressemblent', + ]); $profile_patcher = (new Class_Template_ProfilePatcher(null)) ->setProfile(Class_Profil::find(34)); $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'layout' => 'list_with_options', - 'size' => 1000, - 'id_categorie' => 1, - 'description_length' => 4]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'layout' => 'list_with_options', + 'size' => 1000, + 'id_categorie' => 1, + 'description_length' => 4]); $id = 1; - for ($id; $id <= 112; $id ++) + for ($id; $id <= 112; ++$id) $this->fixture(Class_Article::class, - ['id' => $id, - 'titre' => 'Encore un ' . $id, - 'contenu' => 'Toujours le même … ' . $id, - 'id_cat' => 1]); + ['id' => $id, + 'titre' => 'Encore un ' . $id, + 'contenu' => 'Toujours le même … ' . $id, + 'id_cat' => 1]); Class_Article_Loader::setSelectTool(new Class_Article_SelectForTest); } - - public function tearDown(): void { + public function tearDown(): void + { Storm_Cache::setDefaultZendCache(null); Class_Article_Loader::setSelectTool(null); parent::tearDown(); } - - public function getOrders() { + public function getOrders() + { return [['Random', 'Aléatoire'], - ['DateCreationAsc', 'Date de création croissant'], ['DateCreationDesc', 'Date de création décroissant'], @@ -962,17 +934,12 @@ abstract class TemplatesArticlesWidgetAjaxRenderingTestCase extends AbstractCont ['TitleAsc', 'Titre A-z'], ['TitleDesc', 'Titre Z-a'], - ['Selection', 'Sélection']]; } } - - - -class TemplatesArticlesWidgetAjaxRenderingTest - extends TemplatesArticlesWidgetAjaxRenderingTestCase { - +class TemplatesArticlesWidgetAjaxRenderingTest extends TemplatesArticlesWidgetAjaxRenderingTestCase +{ public function setUp(): void { parent::setUp(); @@ -981,270 +948,258 @@ class TemplatesArticlesWidgetAjaxRenderingTest $this->dispatch('/widget/render/widget_id/1/profile_id/34'); } - /** @test */ - public function pageSize10ShouldBeSelected() { + public function pageSize10ShouldBeSelected() + { $this->assertXPath('//option[@value=10][@selected]'); } - /** @test */ - public function exactly112ArticlesShouldHaveBeenCounted() { + public function exactly112ArticlesShouldHaveBeenCounted() + { $this->assertXPathContentContains('//span', '112'); } - /** * @dataProvider getOrders + * * @test + * + * @param mixed $value + * @param mixed $text */ - public function givenOrderShouldBeAnOption($value, $text) { - $this->assertXPathContentContains('//select//option[@value="'.$value.'"]', $text); + public function givenOrderShouldBeAnOption($value, $text) + { + $this->assertXPathContentContains('//select//option[@value="' . $value . '"]', $text); } } - - - -class TemplatesArticlesWidgetAjaxRenderingWithOrdersTest - extends TemplatesArticlesWidgetAjaxRenderingTestCase { - +class TemplatesArticlesWidgetAjaxRenderingWithOrdersTest extends TemplatesArticlesWidgetAjaxRenderingTestCase +{ /** * @dataProvider getOrders + * * @test + * + * @param mixed $value + * @param mixed $text */ - public function givenOrderShouldBeSelected($value, $text) { - $widget = ((new Class_Systeme_Widget_Widget) + public function givenOrderShouldBeSelected($value, $text) + { + $widget = (new Class_Systeme_Widget_Widget) ->setId(1) ->setProfileId(34) - ->load()); + ->load(); $widget ->setNewDatas(['order' => $value]) ->updateProfile(); $this->dispatch('/widget/render/widget_id/1/profile_id/34'); - $this->assertXPathContentContains('//select//option[@value="'.$value.'"][@selected]', $text); + $this->assertXPathContentContains('//select//option[@value="' . $value . '"][@selected]', $text); } } - - - -abstract class TemplatesArticlesWithWidgetRenderWallTestCase extends AbstractControllerTestCase { - +abstract class TemplatesArticlesWithWidgetRenderWallTestCase extends AbstractControllerTestCase +{ public function setUp(): void { parent::setUp(); - $this->_buildTemplateProfil(['id' => 32, + $this->_buildTemplateProfil(['id' => 32, 'template' => 'MYBIBAPP']); $this->_logAdmin(); $this->fixture(Class_Article::class, - ['id' => 55, - 'titre' => 'Mes dvds', - 'description' => 'Un article avec un kiosque dans du data-code', - 'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=123&all_layout=list&"><img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=124&all_layout=list&">']); + ['id' => 55, + 'titre' => 'Mes dvds', + 'description' => 'Un article avec un kiosque dans du data-code', + 'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=123&all_layout=list&"><img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&link_to_all=1&id_panier=124&all_layout=list&">']); $this->_dispatch(); } - - protected function _dispatch() { + protected function _dispatch() + { $this->dispatch('/cms/articleview/id/55'); } - - protected function _logAdmin() { } + protected function _logAdmin() {} } - - - -class TemplatesArticlesWithWidgetRenderWallNotLoggedTest - extends TemplatesArticlesWithWidgetRenderWallTestCase { - +class TemplatesArticlesWithWidgetRenderWallNotLoggedTest extends TemplatesArticlesWithWidgetRenderWallTestCase +{ /** @test */ - public function bokehKioskShouldBeRemoved() { + public function bokehKioskShouldBeRemoved() + { $this->assertNotXPath('//img[@class="bokeh_kiosk"]'); } - /** @test */ - public function wallJSShouldBeCallWithId() { + public function wallJSShouldBeCallWithId() + { $this->assertXPathContentContains('//script[contains(text(), \'$(function(){$("#no_\')]', '.parent().masonry();});'); } - /** * @test + * * @see 129753 */ - public function profilShouldNotBeSavedWithNewModule() { + public function profilShouldNotBeSavedWithNewModule() + { $this->assertEmpty(Class_Profil::getCurrentProfil()->getCfgAccueilAsArray()['modules']); } - /** @test */ - public function rssLinkShouldContainsCacheKey() { + public function rssLinkShouldContainsCacheKey() + { $expected_settings = - ['MybibappExpandBreakpoint' => 'sm', - 'MybibappHiddenMode' => ['', 'sm', 'md', 'lg', 'xl'], - 'MybibappWidthXsmall' => '', - 'MybibappWidthSmall' => '', - 'MybibappWidthMedium' => '', - 'MybibappWidthLarge' => '', - 'MybibappWidthXlarge' => '', - 'MybibappOrderXsmall' => '', - 'MybibappOrderSmall' => '', - 'MybibappOrderMedium' => '', - 'MybibappOrderLarge' => '', - 'MybibappOrderXlarge' => '', - 'MybibappVisibilityIndex' => 1, + ['MybibappExpandBreakpoint' => 'sm', + 'MybibappHiddenMode' => ['', 'sm', 'md', 'lg', 'xl'], + 'MybibappWidthXsmall' => '', + 'MybibappWidthSmall' => '', + 'MybibappWidthMedium' => '', + 'MybibappWidthLarge' => '', + 'MybibappWidthXlarge' => '', + 'MybibappOrderXsmall' => '', + 'MybibappOrderSmall' => '', + 'MybibappOrderMedium' => '', + 'MybibappOrderLarge' => '', + 'MybibappOrderXlarge' => '', + 'MybibappVisibilityIndex' => 1, 'MybibappVisibilityRecherche' => 1, - 'MybibappVisibilityAbonne' => 1, - 'MybibappVisibilityCms' => 1, - 'MybibappVisibilityBlog' => 1, - 'MybibappVisibilityAuth' => 1, - 'MybibappShowHeader' => 1, - 'MybibappShowContent' => 1, - 'MybibappShowFooter' => '1', - 'layout' => 'wall', - 'rendering' => 'card-overlay', - 'size' => 9, - 'rss' => '1', - 'embeded_code' => false, - 'link_to_all' => '1', - 'all_layout' => 'list', - 'all_rendering' => 'card-horizontal', - 'description_length' => 20, - 'geo_fields' => '123-f-d;941-d-f', - 'titre' => '', - 'order' => 'RAND()', - 'view_link_mode' => 'view_specific', - 'boite' => '', - 'type_module' => 'KIOSQUE', - 'preferences' => ['titre' => '', - 'style_liste' => 'mur', - 'aleatoire' => '1', - 'tri' => '1', - 'boite' => '', - 'rss' => '1', - 'MybibappShowFooter' => '1', - 'link_to_all' => '1', - 'id_panier' => '123', - 'all_layout' => 'list', + 'MybibappVisibilityAbonne' => 1, + 'MybibappVisibilityCms' => 1, + 'MybibappVisibilityBlog' => 1, + 'MybibappVisibilityAuth' => 1, + 'MybibappShowHeader' => 1, + 'MybibappShowContent' => 1, + 'MybibappShowFooter' => '1', + 'layout' => 'wall', + 'rendering' => 'card-overlay', + 'size' => 9, + 'rss' => '1', + 'embeded_code' => false, + 'link_to_all' => '1', + 'all_layout' => 'list', + 'all_rendering' => 'card-horizontal', + 'description_length' => 20, + 'geo_fields' => '123-f-d;941-d-f', + 'titre' => '', + 'order' => 'RAND()', + 'view_link_mode' => 'view_specific', + 'boite' => '', + 'type_module' => 'KIOSQUE', + 'preferences' => ['titre' => '', + 'style_liste' => 'mur', + 'aleatoire' => '1', + 'tri' => '1', + 'boite' => '', + 'rss' => '1', + 'MybibappShowFooter' => '1', + 'link_to_all' => '1', + 'id_panier' => '123', + 'all_layout' => 'list', ], 'style_liste' => 'mur', - 'aleatoire' => '1', - 'tri' => '1', - 'id_panier' => '123' + 'aleatoire' => '1', + 'tri' => '1', + 'id_panier' => '123', ]; $key = md5(json_encode($expected_settings)); $this->assertXPath('//a[contains(@href, "rss/kiosque?id_profil=32&language=fr&cache_key=' . $key . '")]'); } - /** @test */ - public function enLirePlusShouldBePresentForFirstCarousel() { + public function enLirePlusShouldBePresentForFirstCarousel() + { $this->assertXPathContentContains('//div//a[contains(@href, "/widget/render-all/profile_id/32/article_id/55/widget_key/8114554cd19c8d3ef808e70f527411b6")]', 'En lire plus'); } - /** @test */ - public function enLirePlusShouldBePresentForSecondCarousel() { + public function enLirePlusShouldBePresentForSecondCarousel() + { $this->assertXPathContentContains('//div//a[contains(@href, "/widget/render-all/profile_id/32/article_id/55/widget_key/fe3385428fb49a368c0c2a67bebb2cbc")]', 'En lire plus'); } } - - - -class TemplatesArticlesRenderAllFromArticleTest - extends TemplatesArticlesWithWidgetRenderWallTestCase { - - protected function _dispatch() {} - - +class TemplatesArticlesRenderAllFromArticleTest extends TemplatesArticlesWithWidgetRenderWallTestCase +{ /** @test */ - public function shouldContainsTrollsDeTroy() { + public function shouldContainsTrollsDeTroy() + { $trolls = $this->fixture(Class_Notice::class, - ['id' => 15, - 'clef_chapeau' => 'TROLLS DE TROY', - 'clef_alpha' => 'TROLLS DE TROY ENQUETE POUR LES TROYENS', - 'tome_alpha' => 2, - 'type_doc' => Class_TypeDoc::LIVRE]) + ['id' => 15, + 'clef_chapeau' => 'TROLLS DE TROY', + 'clef_alpha' => 'TROLLS DE TROY ENQUETE POUR LES TROYENS', + 'tome_alpha' => 2, + 'type_doc' => Class_TypeDoc::LIVRE]) ->set_subfield('461', 't', 'TROLLS DE TROY'); $this->fixture(Class_PanierNotice::class, - ['id' => 123, - 'libelle' => 'Mes BD', - 'date_maj' => '10/02/2011', - 'notices' => 'COMBAT ORDINAIRE;BLACKSAD']) + ['id' => 123, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011', + 'notices' => 'COMBAT ORDINAIRE;BLACKSAD']) ->addNotice($trolls); $this->dispatch('/widget/render-all/profile_id/32/article_id/55/widget_key/fe3385428fb49a368c0c2a67bebb2cbc'); $this->assertXPathContentContains('//div[@data-action="widget_render-all"]//div[@class="card-title"]', - 'TROLLS DE TROY'); + 'TROLLS DE TROY'); } - /** @test */ - public function shouldContainsRecordTrollsDeTroy2() { + public function shouldContainsRecordTrollsDeTroy2() + { $trolls = $this->fixture(Class_Notice::class, - ['id' => 15, - 'clef_chapeau' => 'TROLLS DE TROY 2', - 'clef_alpha' => 'TROLLS DE TROY ENQUETE POUR LES TROYENS 2', - 'tome_alpha' => 3, - 'type_doc' => Class_TypeDoc::LIVRE]) + ['id' => 15, + 'clef_chapeau' => 'TROLLS DE TROY 2', + 'clef_alpha' => 'TROLLS DE TROY ENQUETE POUR LES TROYENS 2', + 'tome_alpha' => 3, + 'type_doc' => Class_TypeDoc::LIVRE]) ->set_subfield('461', 't', 'TROLLS DE TROY 2'); $this->fixture(Class_PanierNotice::class, - ['id' => 124, - 'libelle' => 'Mes BD', - 'date_maj' => '10/02/2011']) + ['id' => 124, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011']) ->addNotice($trolls); $this->dispatch('/widget/render-all/profile_id/32/article_id/55/widget_key/8114554cd19c8d3ef808e70f527411b6'); $this->assertXPathContentContains('//div[@data-action="widget_render-all"]//div[@class="card-title"]', - 'TROLLS DE TROY 2'); + 'TROLLS DE TROY 2'); } -} - - + protected function _dispatch() {} +} -class TemplatesArticlesWithWidgetRenderWallLoggedAsAdminTest - extends TemplatesArticlesWithWidgetRenderWallTestCase { +class TemplatesArticlesWithWidgetRenderWallLoggedAsAdminTest extends TemplatesArticlesWithWidgetRenderWallTestCase +{ + /** @test */ + public function adminToolsShouldNotBePresent() + { + $this->assertNotXPath('//a[contains(@href, "admin/widget/edit-widget/id/no_")]'); + } - protected function _logAdmin() { + protected function _logAdmin() + { ZendAfi_Auth::getInstance() ->logUser($this->fixture(Class_Users::class, - ['id' => 123, - 'login' => 'admin', - 'password' => 'auieauei', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN])); - } - - - /** @test */ - public function adminToolsShouldNotBePresent() { - $this->assertNotXPath('//a[contains(@href, "admin/widget/edit-widget/id/no_")]'); + ['id' => 123, + 'login' => 'admin', + 'password' => 'auieauei', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN])); } } - - - -class TemplatesArticlesSqlRequestTest - extends AbstractControllerTestCase { - +class TemplatesArticlesSqlRequestTest extends AbstractControllerTestCase +{ protected $_select; public function setUp(): void @@ -1253,7 +1208,7 @@ class TemplatesArticlesSqlRequestTest ZendAfi_Auth::getInstance()->clearIdentity(); - Class_AdminVar::set("WORKFLOW", 1); + Class_AdminVar::set('WORKFLOW', 1); $this->_select = new Class_Article_TableSelectForTest; @@ -1261,76 +1216,69 @@ class TemplatesArticlesSqlRequestTest (new Class_Template_ProfilePatcher(null)) ->setProfile($profil) ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'layout' => 'list', - 'size' => 10, - 'order' => 'EventDebut', - 'description_html' => 1]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'layout' => 'list', + 'size' => 10, + 'order' => 'EventDebut', + 'description_html' => 1]); $this->dispatch('/opac/index'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_Article_Loader::setSelectTool(null); parent::tearDown(); } - /** @test */ - public function sqlRequestForArticleShouldContainsFilterStatus() { + public function sqlRequestForArticleShouldContainsFilterStatus() + { $this->assertEquals('SELECT `cms_article`.* FROM `cms_article` WHERE ((DEBUT IS NULL) OR (DEBUT <= CURDATE())) AND ((FIN IS NULL) OR (FIN >= CURDATE())) AND (PARENT_ID=0) AND (STATUS in (3)) ORDER BY `DATE_CREATION` DESC LIMIT 1000', $this->_select->assemble()); } } - - - -class TemplatesArticlesWithLibraryUrlRewriteTest extends AbstractControllerTestCase { - +class TemplatesArticlesWithLibraryUrlRewriteTest extends AbstractControllerTestCase +{ public function setUp(): void { parent::setUp(); - $this->_buildTemplateProfil(['id' => 32, + $this->_buildTemplateProfil(['id' => 32, 'template' => 'MYBIBAPP']); $this->fixture(Class_Article::class, - ['id' => 55, - 'titre' => 'Mes dvds', - 'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&">', - 'id_cat' => 5]); + ['id' => 55, + 'titre' => 'Mes dvds', + 'contenu' => '<img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&MybibappShowFooter=1&">', + 'id_cat' => 5]); $this->fixture(Class_ArticleCategorie::class, - ['id' => 5, - 'libelle' => 'DVD', - 'id_site' => '23' - ]); + ['id' => 5, + 'libelle' => 'DVD', + 'id_site' => '23', + ]); $this->fixture(Class_Bib::class, - ['id' => 23, - 'libelle' => 'Annecy', - 'rewrite_url' => 'annecy' - ]); + ['id' => 23, + 'libelle' => 'Annecy', + 'rewrite_url' => 'annecy', + ]); $this->dispatch('/cms/articleview/id/55'); } - /** @test */ - public function linkToAnnecyShouldBeAnnecy() { + public function linkToAnnecyShouldBeAnnecy() + { $this->assertXPathContentContains('//a[contains(@href,"/annecy")][contains(@class,"badge_article_library")]', - 'Annecy'); - + 'Annecy'); } } - - - -class TemplatesArticlesWidgetWithDescriptionHTMLTest extends AbstractControllerTestCase { - +class TemplatesArticlesWidgetWithDescriptionHTMLTest extends AbstractControllerTestCase +{ public function setUp(): void { parent::setUp(); @@ -1346,36 +1294,32 @@ class TemplatesArticlesWidgetWithDescriptionHTMLTest extends AbstractControllerT ->onLoaderOfModel(Class_Article::class) ->whenCalled('getArticlesByPreferences') ->answers([$this->fixture(Class_Article::class, - ['id' => 7, - 'titre' => 'Parlez-vous français ?', - 'description' => '<a href="#">là </a><img src=""/><iframe></iframe><canvas></canvas><a href="#">ici</a>La description s\'arrête ici et pas plus loin.', - 'contenu' => '<p>Une b...</p>'])]); + ['id' => 7, + 'titre' => 'Parlez-vous français ?', + 'description' => '<a href="#">là </a><img src=""/><iframe></iframe><canvas></canvas><a href="#">ici</a>La description s\'arrête ici et pas plus loin.', + 'contenu' => '<p>Une b...</p>'])]); $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'layout' => 'list', - 'size' => 1, - 'description_html' => 1]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'layout' => 'list', + 'size' => 1, + 'description_html' => 1]); $this->dispatch('/opac/widget/render/widget_id/1/profile_id/34'); } - /** @test */ - public function descriptionShouldBeHTML() { + public function descriptionShouldBeHTML() + { $this->assertXPathContentContains('//div[contains(@class, "news widget")]//div[contains(@class, "model_description")]', - '<a href="#">là </a><a href="#">ici</a>La description s\'arrête ici et pas plus loin.'); + '<a href="#">là </a><a href="#">ici</a>La description s\'arrête ici et pas plus loin.'); } } - - - -class TemplatesArticlesCarouselFromCKEditorInMediaDivTest - extends TemplatesArticlesWidgetTestCase { - +class TemplatesArticlesCarouselFromCKEditorInMediaDivTest extends TemplatesArticlesWidgetTestCase +{ public function setUp(): void { parent::setUp(); @@ -1390,63 +1334,60 @@ class TemplatesArticlesCarouselFromCKEditorInMediaDivTest $this->dispatch('/index/index/id_profil/1'); } - /** @test */ - public function articleSprechenSieDeutschMediaShouldHaveAKiosque() { + public function articleSprechenSieDeutschMediaShouldHaveAKiosque() + { $this->assertXPath('//div[@class="list-group bg-transparent no_border"]//div[@class="card card_template card_Intonation_Library_View_Wrapper_Article"]//div[@class="card-img-top text-center"]//div[@class="boite kiosque widget col card"]'); } } - - - -class TemplatesArticlesForAsqatasunTest extends AbstractControllerTestCase { - +class TemplatesArticlesForAsqatasunTest extends AbstractControllerTestCase +{ protected $_profile_patcher; public function setUp(): void { parent::setUp(); - $profile = $this->_buildTemplateProfil(['id' => 1, + $profile = $this->_buildTemplateProfil(['id' => 1, 'template' => 'MUSCLE']); $this->_profile_patcher = (new Class_Template_ProfilePatcher(null)) ->setProfile($profile); $this->_profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Article_Definition::CODE, - Class_Profil::DIV_MAIN, - ['order' => 'Selection', - 'id_items' => '9', - 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, - 'description_length' => 100, - 'description_html' => 1]); + Class_Profil::DIV_MAIN, + ['order' => 'Selection', + 'id_items' => '9', + 'rendering' => Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION, + 'description_length' => 100, + 'description_html' => 1]); $this->fixture(Class_Article::class, - ['id' => 9, - 'titre' => 'Title article', - 'contenu' => '<p>Content for article</p>']); + ['id' => 9, + 'titre' => 'Title article', + 'contenu' => '<p>Content for article</p>']); Class_Article_Loader::setSelectTool(new Class_Article_SelectForTest); $this->dispatch('/opac/index/index/id_profil/1'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_Article_Loader::setSelectTool(null); parent::tearDown(); } - /** @test */ - public function widgetCarouselArticleShouldContainsContentIncludedInDiv() { + public function widgetCarouselArticleShouldContainsContentIncludedInDiv() + { $this->assertXPath('//div[contains(@class, "boite news")]//div[@class="model_description_Class_Article"]/p[text()="Content for article"]'); } - /** @test */ - public function widgetShouldBeHTML5Valid() { + public function widgetShouldBeHTML5Valid() + { $this->assertHTML5(); } } diff --git a/tests/scenarios/Templates/TemplatesLibraryNoveltiesTabTest.php b/tests/scenarios/Templates/TemplatesLibraryNoveltiesTabTest.php index f8c053d1616829d3514560ee6a952659d2b2eb3b..fd74425f2b3cd5748d68fdd16159037372170d30 100644 --- a/tests/scenarios/Templates/TemplatesLibraryNoveltiesTabTest.php +++ b/tests/scenarios/Templates/TemplatesLibraryNoveltiesTabTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved. * @@ -18,11 +19,10 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - -class TemplatesLibraryNoveltiesTabSettingsTest extends Admin_AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesLibraryNoveltiesTabSettingsTest extends Admin_AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 12]); @@ -39,154 +39,143 @@ class TemplatesLibraryNoveltiesTabSettingsTest extends Admin_AbstractControllerT $this->dispatch('/admin/widget/edit-action/id/bib_en-lire-plus/id_profil/12'); } - /** @test */ - public function tabNoveltiesShouldBePresent() { + public function tabNoveltiesShouldBePresent() + { $this->assertXPathContentContains('//form//label', 'Activer l\'affichage de l\'onglet Nouveautés'); } - /** @test */ - public function tabNoveltiesShouldNotBeActivated() { + public function tabNoveltiesShouldNotBeActivated() + { $this->assertXPath('//form//input[@type="checkbox"][@name="Intonation_Library_View_Wrapper_Library_RichContent_Novelties"][not(@checked)]'); } } - - - -class TemplatesLibraryNoveltiesDefaultTest extends Admin_AbstractControllerTestCase { - - public function setUp(): void { +class TemplatesLibraryNoveltiesDefaultTest extends Admin_AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); - $profile = $this->_buildTemplateProfil(['id' => 12, + $profile = $this->_buildTemplateProfil(['id' => 12, 'libelle' => 'accueil']); (new Muscle_Template)->tryOn($profile); $this->dispatch('/admin/widget/edit-action/id/bib_en-lire-plus/id_profil/13'); } - /** @test */ - public function tabNoveltiesShouldBeActivated() { + public function tabNoveltiesShouldBeActivated() + { $this->assertXPath('//form//input[@type="checkbox"][@name="Intonation_Library_View_Wrapper_Library_RichContent_Novelties"][@checked]'); } } - - - -abstract class TemplatesLibraryNoveltiesWithLibraryTestCase extends AbstractControllerTestCase { - - public function setUp(): void { +abstract class TemplatesLibraryNoveltiesWithLibraryTestCase extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); - $profile = $this->_buildTemplateProfil(['id' => 21, + $profile = $this->_buildTemplateProfil(['id' => 21, 'libelle' => 'accueil']); $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Saint Jorioz', - 'visibilite' => Class_Bib::V_NODATA, - 'rewrite_url' => 'saint_jorioz' - ]); + ['id' => 1, + 'libelle' => 'Saint Jorioz', + 'visibilite' => Class_Bib::V_NODATA, + 'rewrite_url' => 'saint_jorioz', + ]); $profile = $this->_buildTemplateProfil(['id' => 22]); (new Herisson_Template)->tryOn($profile); } } - - - -class TemplatesLibraryNoveltiesTabIndexDispatchTest - extends TemplatesLibraryNoveltiesWithLibraryTestCase { - - public function setUp(): void { +class TemplatesLibraryNoveltiesTabIndexDispatchTest extends TemplatesLibraryNoveltiesWithLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/bib/en-lire-plus/id/1'); } - /** @test */ - public function noveltiesTabShouldBeDisplay() { + public function noveltiesTabShouldBeDisplay() + { $this->assertXPathContentContains('//div/h2/span', 'Nouveautés'); } - /** @test */ - public function linkToEditNoveltiesShouldBePresent() { + public function linkToEditNoveltiesShouldBePresent() + { $this->assertXPath('//a[@href="/admin/widget/edit-action/id/bib_novelties_1/id_profil/23"]'); } } - - - -class TemplatesLibraryNoveltiesEditTest extends TemplatesLibraryNoveltiesWithLibraryTestCase { - - public function setUp(): void { +class TemplatesLibraryNoveltiesEditTest extends TemplatesLibraryNoveltiesWithLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/admin/widget/edit-action/id/bib_novelties_1/id_profil/23'); } - /** @test */ - public function formShouldContainsLayout() { + public function formShouldContainsLayout() + { $this->assertXPath('//form//select[@name="layout"]'); } - /** @test */ - public function formShouldContainsRendering() { + public function formShouldContainsRendering() + { $this->assertXPath('//form//select[@name="rendering"]'); } - /** @test */ - public function formShouldContainsAutoSelection() { + public function formShouldContainsAutoSelection() + { $this->assertXPath('//form//input[@name="auto_selection"][@type="checkbox"][@checked]'); } - /** @test */ - public function titleShouldContainsSaintJorioz() { + public function titleShouldContainsSaintJorioz() + { $this->assertXPathContentContains('//div//h1', 'Configuration des nouveautés de Saint Jorioz'); } - /** @test */ - public function formShouldContainsUncheckedShowHeader() { + public function formShouldContainsUncheckedShowHeader() + { $this->assertXPath('//form//input[@name="HerissonShowHeader"][not(@checked)]'); } - /** @test */ - public function visibilityTabShouldNotBeDisplay() { + public function visibilityTabShouldNotBeDisplay() + { $this->assertNotXPathContentContains('//form', 'Visibilité'); } - /** @test */ - public function defaultStylePackShouldBeAlignCenterNoBorder() { + public function defaultStylePackShouldBeAlignCenterNoBorder() + { $this->assertXPathContentContains('//form//select/option[@selected]', - 'Sans bordure, sans arrondi, sans ombre, sans fond'); + 'Sans bordure, sans arrondi, sans ombre, sans fond'); } } - - - -class TemplatesLibraryNoveltiesPostEditTest extends TemplatesLibraryNoveltiesWithLibraryTestCase { - +class TemplatesLibraryNoveltiesPostEditTest extends TemplatesLibraryNoveltiesWithLibraryTestCase +{ protected $_widget; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->postDispatch('/admin/widget/edit-action/id/bib_novelties_1/id_profil/23', - ['layout' => 'list', - 'rendering' => 'card-description']); + ['layout' => 'list', + 'rendering' => 'card-description']); $this->_widget = (new Class_Systeme_Widget_Action_LibraryNovelties) ->setId('bib_novelties_1') @@ -194,228 +183,212 @@ class TemplatesLibraryNoveltiesPostEditTest extends TemplatesLibraryNoveltiesWit ->load(); } - /** @test */ - public function layoutShouldHaveBeenUpdatedToList() { + public function layoutShouldHaveBeenUpdatedToList() + { $this->assertEquals('list', $this->_widget->getlayout()); } - /** @test */ - public function renderingShouldHaveBeenUpdatedToCardDescription() { + public function renderingShouldHaveBeenUpdatedToCardDescription() + { $this->assertEquals('card-description', $this->_widget->getrendering()); } - /** @test */ - public function defaultSelectionShouldBeAutoNoveltiesForSaintJorioz() { + public function defaultSelectionShouldBeAutoNoveltiesForSaintJorioz() + { $this->assertEquals('1', $this->_widget->getauto_selection()); } - /** @test */ - public function defaultStylePackShouldBeAlignCenterNoBorder() { + public function defaultStylePackShouldBeAlignCenterNoBorder() + { $this->assertEquals('Sans bordure, sans arrondi, sans ombre, sans fond', - Class_StylesPack::find($this->_widget->getHerissonStylesPack())->getLabel()); + Class_StylesPack::find($this->_widget->getHerissonStylesPack())->getLabel()); } - /** @test */ - public function cycleShouldBeFour() { + public function cycleShouldBeFour() + { $this->assertEquals('4', $this->_widget->getcycle()); } } - - - -abstract class TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase - extends AbstractControllerTestCase { - - public function setUp(): void { +abstract class TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); $profile = $this->_buildTemplateProfil(['id' => 23]); - (new Class_Profil_Preferences()) + (new Class_Profil_Preferences) ->setModulePref($profile, - (new Class_Profil_ModuleDefinition('bib', - 'en-lire-plus')), - [Intonation_Library_View_Wrapper_Library_RichContent_Novelties::class => '1']); + new Class_Profil_ModuleDefinition('bib', + 'en-lire-plus'), + [Intonation_Library_View_Wrapper_Library_RichContent_Novelties::class => '1']); $this->_fixturesPrepare(); $this->_dispatch(); } - - protected function _fixturesPrepare() :void { + protected function _fixturesPrepare(): void + { $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Saint Jorioz']); + ['id' => 1, + 'libelle' => 'Saint Jorioz']); $this->fixture(Class_Notice::class, - ['id' => 789, - 'titre_principal' => 'Despot\'s Game (Original Game Soundtrack)', - 'type' => 1, - 'facettes' => 'B1']); + ['id' => 789, + 'titre_principal' => 'Despot\'s Game (Original Game Soundtrack)', + 'type' => 1, + 'facettes' => 'B1']); $this->fixture(Class_Exemplaire::class, - ['id' => 123, - 'type_doc' => Class_TypeDoc::LOGICIEL, - 'id_notice' => 789, - 'bib' => Class_Bib::find(1), - 'date_nouveaute' => '2055-01-01']); + ['id' => 123, + 'type_doc' => Class_TypeDoc::LOGICIEL, + 'id_notice' => 789, + 'bib' => Class_Bib::find(1), + 'date_nouveaute' => '2055-01-01']); } - - abstract protected function _dispatch() : void; + abstract protected function _dispatch(): void; } - - - -class TemplatesLibraryNoveltiesTabDispatchTest - extends TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase { - - protected function _dispatch() : void { - $this->dispatch('/bib/novelties/id/1'); - } - - +class TemplatesLibraryNoveltiesTabDispatchTest extends TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase +{ /** @test */ - public function defaultLayoutShoulBeMultipleCarouselPlus() { + public function defaultLayoutShoulBeMultipleCarouselPlus() + { $this->assertXPath('//div[@class="carousel slide multiple_carousel"]'); } - /** @test */ - public function defaultRenderingShoulBeMedia() { + public function defaultRenderingShoulBeMedia() + { $this->assertXPath('//div[@class="card_with_overlay card text-center"]'); } - /** @test */ - public function despotsGameRecordShouldBeDisplay() { + public function despotsGameRecordShouldBeDisplay() + { $this->assertXPathContentContains('//div[@class="card-title"]', 'Despot\'s Game'); } - /** @test */ - public function adminActionsShouldNotBePresent() { + public function adminActionsShouldNotBePresent() + { $this->assertNotXPath('//div[@id="boite_bib_novelties_1"]//div[@class="section_configuration"]'); } -} - - - -class TemplatesLibraryNoveltiesTabDispatchFilterByItemTest - extends TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase { - - protected function _dispatch() : void { + protected function _dispatch(): void + { $this->dispatch('/bib/novelties/id/1'); } +} - - protected function _fixturesPrepare() : void{ - $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Saint Jorioz']); - - $this->fixture(Class_Bib::class, - ['id' => 2, - 'libelle' => 'Jolieville']); - - $this->fixture(Class_Notice::class, - ['id' => 789, - 'titre_principal' => 'Despot\'s Game (Original Game Soundtrack)', - 'type' => 1, - 'facettes' => 'B1']); - - $this->fixture(Class_Notice::class, - ['id' => 790, - 'titre_principal' => 'Noa', - 'type' => 1, - 'facettes' => 'B1']); - - $this->fixture(Class_Exemplaire::class, - ['id' => 123, - 'type_doc' => Class_TypeDoc::LOGICIEL, - 'id_notice' => 789, - 'bib' => Class_Bib::find(1), - 'date_nouveaute' => '2055-01-01']); - - $this->fixture(Class_Exemplaire::class, - ['id' => 124, - 'type_doc' => Class_TypeDoc::LIVRE, - 'id_notice' => 790, - 'bib' => Class_Bib::find(2), - 'date_nouveaute' => '2055-01-01']); - - $this->fixture(Class_Exemplaire::class, - ['id' => 124, - 'type_doc' => Class_TypeDoc::LIVRE, - 'id_notice' => 790, - 'bib' => Class_Bib::find(1), - 'date_nouveaute' => '1970-01-01']); - } - - +class TemplatesLibraryNoveltiesTabDispatchFilterByItemTest extends TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase +{ /** @test */ - public function defaultLayoutShoulBeMultipleCarouselPlus() { + public function defaultLayoutShoulBeMultipleCarouselPlus() + { $this->assertXPath('//div[@class="carousel slide multiple_carousel"]'); } - /** @test */ - public function defaultRenderingShoulBeMedia() { + public function defaultRenderingShoulBeMedia() + { $this->assertXPath('//div[@class="card_with_overlay card text-center"]'); } - /** @test */ - public function despotsGameRecordShouldBeDisplay() { + public function despotsGameRecordShouldBeDisplay() + { $this->assertXPathContentContains('//div[@class="card-title"]', 'Despot\'s Game'); } - /** @test */ - public function noaRecordShouldBeFiltered() { + public function noaRecordShouldBeFiltered() + { $this->assertNotXPathContentContains('//div[@class="card-title"]', 'Noa'); } - /** @test */ - public function onlyOneCardShouldBePresent() { - $this->assertXPathCount('//div[@class="card_with_overlay card text-center"]', 1); + public function onlyOneCardShouldBePresent() + { + $this->assertXPathCount('//div[@class="carousel slide multiple_carousel"][@data-interval="4000"]//div[@class="card_with_overlay card text-center"]', 1); } - /** @test */ - public function adminActionsShouldNotBePresent() { + public function adminActionsShouldNotBePresent() + { $this->assertNotXPath('//div[@id="boite_bib_novelties_1"]//div[@class="section_configuration"]'); } -} + protected function _dispatch(): void + { + $this->dispatch('/bib/novelties/id/1'); + } + protected function _fixturesPrepare(): void + { + $this->fixture(Class_Bib::class, + ['id' => 1, + 'libelle' => 'Saint Jorioz']); + $this->fixture(Class_Bib::class, + ['id' => 2, + 'libelle' => 'Jolieville']); -class TemplatesLibraryNoveltiesTabWidgetRenderTest - extends TemplatesLibraryNoveltiesTabDispatchTest { + $this->fixture(Class_Notice::class, + ['id' => 789, + 'titre_principal' => 'Despot\'s Game (Original Game Soundtrack)', + 'type' => 1, + 'facettes' => 'B1']); - protected function _dispatch() : void { - $this->dispatch('/widget/render/widget_id/bib_novelties_1/profile_id/23/anchor_target/_blank'); - } -} + $this->fixture(Class_Notice::class, + ['id' => 790, + 'titre_principal' => 'Noa', + 'type' => 1, + 'facettes' => 'B1']); + $this->fixture(Class_Exemplaire::class, + ['id' => 123, + 'type_doc' => Class_TypeDoc::LOGICIEL, + 'id_notice' => 789, + 'bib' => Class_Bib::find(1), + 'date_nouveaute' => '2055-01-01']); + $this->fixture(Class_Exemplaire::class, + ['id' => 124, + 'type_doc' => Class_TypeDoc::LIVRE, + 'id_notice' => 790, + 'bib' => Class_Bib::find(2), + 'date_nouveaute' => '2055-01-01']); + $this->fixture(Class_Exemplaire::class, + ['id' => 124, + 'type_doc' => Class_TypeDoc::LIVRE, + 'id_notice' => 790, + 'bib' => Class_Bib::find(1), + 'date_nouveaute' => '1970-01-01']); + } +} -class TemplatesLibraryNoveltiesTabWidgetRenderAllTest - extends TemplatesLibraryNoveltiesTabDispatchTest { +class TemplatesLibraryNoveltiesTabWidgetRenderTest extends TemplatesLibraryNoveltiesTabDispatchTest +{ + protected function _dispatch(): void + { + $this->dispatch('/widget/render/widget_id/bib_novelties_1/profile_id/23/anchor_target/_blank'); + } +} - protected function _dispatch() : void { +class TemplatesLibraryNoveltiesTabWidgetRenderAllTest extends TemplatesLibraryNoveltiesTabDispatchTest +{ + protected function _dispatch(): void + { $conf = (new Class_Systeme_Widget_Action) ->setId('bib_novelties_1') ->setProfileId(23) @@ -423,20 +396,30 @@ class TemplatesLibraryNoveltiesTabWidgetRenderAllTest $conf ->setNewDatas(['all_rendering' => 'card-overlay', - 'all_layout' => 'multiple_carousel_plus']) + 'all_layout' => 'multiple_carousel_plus']) ->updateProfile(); $this->dispatch('widget/render-all/profile_id/23/widget_id/bib_novelties_1'); } } +class TemplatesLibraryNoveltiesTabWidgetShowFooterTest extends TemplatesLibraryNoveltiesTabDispatchTest +{ + /** @test */ + public function linkToAllShouldBeRechercheSimple() + { + $this->assertXPathContentContains('//div//a[@href="/recherche/simple/tri/date_creation+desc%2C+alpha_titre+asc/titre/Nouveaut%C3%A9s+de+la+biblioth%C3%A8que/multifacets/HNRNR0001-B1"]', + 'En lire plus'); + } + /** @test */ + public function rssLinkShouldUseCacheKey() + { + $this->assertXPath('//div//a[@href="/rss/library-novelties/id/1/language/fr/id_profil/23"]'); + } - -class TemplatesLibraryNoveltiesTabWidgetShowFooterTest - extends TemplatesLibraryNoveltiesTabDispatchTest { - - protected function _dispatch() : void { + protected function _dispatch(): void + { $conf = (new Class_Systeme_Widget_Action_LibraryNovelties) ->setId('bib_novelties_1') ->setProfileId(23) @@ -444,41 +427,25 @@ class TemplatesLibraryNoveltiesTabWidgetShowFooterTest $conf ->setNewDatas(['IntonationShowFooter' => '1', - 'link_to_all' => '1', - 'rss' => '1']) + 'link_to_all' => '1', + 'rss' => '1']) ->updateProfile(); parent::_dispatch(); } +} - - /** @test */ - public function linkToAllShouldBeRechercheSimple() { - $this->assertXPathContentContains('//div//a[@href="/recherche/simple/tri/date_creation+desc%2C+alpha_titre+asc/titre/Nouveaut%C3%A9s+de+la+biblioth%C3%A8que/multifacets/HNRNR0001-B1"]', - 'En lire plus'); - } - - +class TemplatesLibraryNoveltiesRSSTest extends TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase +{ /** @test */ - public function rssLinkShouldUseCacheKey() { - $this->assertXPath('//div//a[@href="/rss/library-novelties/id/1/language/fr/id_profil/23"]'); + public function rssShouldContainsDespotSGame() + { + $this->assertXPathContentContains('//rss//title', + '<![CDATA[Despot\'s Game (Original Game Soundtrack), ]]>'); } -} - - - -class TemplatesLibraryNoveltiesRSSTest - extends TemplatesLibraryNoveltiesTabWithAutoSelectionTestCase { - - protected function _dispatch() : void { + protected function _dispatch(): void + { $this->dispatch('rss/library-novelties/id/1/id_profil/23/language/fr'); } - - - /** @test */ - public function rssShouldContainsDespotSGame() { - $this->assertXPathContentContains('//rss//title', - '<![CDATA[Despot\'s Game (Original Game Soundtrack), ]]>'); - } } diff --git a/tests/scenarios/Templates/TemplatesLibraryTest.php b/tests/scenarios/Templates/TemplatesLibraryTest.php index 344bd4767efe477a1a5f720c29299258a58a30a9..a2107507e0d05cc03c50891e3d11174ca60f58aa 100644 --- a/tests/scenarios/Templates/TemplatesLibraryTest.php +++ b/tests/scenarios/Templates/TemplatesLibraryTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -19,142 +20,139 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once('TemplatesTest.php'); - -abstract class TemplatesLibraryTestCase extends AbstractControllerTestCase { +require_once 'TemplatesTest.php'; - - public function setUp(): void { +abstract class TemplatesLibraryTestCase extends AbstractControllerTestCase +{ + public function setUp(): void + { parent::setUp(); Class_AdminVar::set('FEATURES_TRACKING_ENABLE', 0); - $this->_buildTemplateProfil(['id' => 1, + $this->_buildTemplateProfil(['id' => 1, 'libelle' => 'My page']) ->setBoiteOfTypeInDivision(2, - Intonation_Library_Widget_Carousel_Library_Definition::CODE, - ['layout' => Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL, - 'rendering' => 'card-description']) + Intonation_Library_Widget_Carousel_Library_Definition::CODE, + ['layout' => Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL, + 'rendering' => 'card-description']) ->assertSave(); $this->fixture('Class_Bib', - ['id' => 1, - 'libelle' => 'Annecy', - 'mail' => 'contact@annecy.fr', - 'telephone' => '04 50 12 34 56', - 'adresse' => '1 rue par là ', - 'cp' => '74000', - 'url_web' => 'https://annecy.fr', - 'ville' => 'Annecy', - 'visibilite' => Class_Bib::V_DATA, - 'rewrite_url' => 'annecy', - 'ouvertures' => [ - Class_Ouverture::chaqueLundi('08:00','13:00','14:00','17:00'), - Class_Ouverture::chaqueMardi('10:00', '12:00', '14:00', '18:00') - ]]); + ['id' => 1, + 'libelle' => 'Annecy', + 'mail' => 'contact@annecy.fr', + 'telephone' => '04 50 12 34 56', + 'adresse' => '1 rue par là ', + 'cp' => '74000', + 'url_web' => 'https://annecy.fr', + 'ville' => 'Annecy', + 'visibilite' => Class_Bib::V_DATA, + 'rewrite_url' => 'annecy', + 'ouvertures' => [ + Class_Ouverture::chaqueLundi('08:00', '13:00', '14:00', '17:00'), + Class_Ouverture::chaqueMardi('10:00', '12:00', '14:00', '18:00'), + ]]); $this->fixture('Class_Bib', - ['id' => 2, - 'libelle' => 'Bibliobus', - 'visibilite' => Class_Bib::V_INVISIBLE]); + ['id' => 2, + 'libelle' => 'Bibliobus', + 'visibilite' => Class_Bib::V_INVISIBLE]); $this->fixture('Class_Bib', - ['id' => 3, - 'libelle' => 'Seynod', - 'visibilite' => Class_Bib::V_NODATA]); + ['id' => 3, + 'libelle' => 'Seynod', + 'visibilite' => Class_Bib::V_NODATA]); $this->fixture('Class_Bib', - ['id' => 4, - 'libelle' => 'Meythet', - 'visibilite' => Class_Bib::V_DATA]); + ['id' => 4, + 'libelle' => 'Meythet', + 'visibilite' => Class_Bib::V_DATA]); $this->fixture('Class_Bib', - ['id' => 5, - 'libelle' => 'Pringy', - 'visibilite' => Class_Bib::V_DATA]); + ['id' => 5, + 'libelle' => 'Pringy', + 'visibilite' => Class_Bib::V_DATA]); } } - - - -class TemplatesLibraryWidgetWithCarouselThreeColumnsTest extends TemplatesLibraryTestCase { - public function setUp(): void { +class TemplatesLibraryWidgetWithCarouselThreeColumnsTest extends TemplatesLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); - $time = new TimeSourceForTest("2020-10-18 10:00:00"); + $time = new TimeSourceForTest('2020-10-18 10:00:00'); Class_Bib::setTimeSource($time); ZendAfi_View_Helper_RenderLibraryOpening::setTimeSource($time); $this->dispatch('/opac/index/index/id_profil/1'); } - /** @test */ - public function cardGridShouldContainsThreeCard() { - $this->assertXPathCount('//div[contains(@class, "boite ")]//div[@class="carousel-item active"]//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")]', - 3); + public function cardGridShouldContainsThreeCard() + { + $this->assertXPathCount('//div[contains(@class, "boite ")]//div[@class="responsive_carousel_md col-12 d-none d-md-block"]//div[@class="carousel-item active"]//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")]', + 3); } - /** @test */ - public function firstCardTitleShouldBeAnnecy() { - $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//a','Annecy'); + public function firstCardTitleShouldBeAnnecy() + { + $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//a', 'Annecy'); } - /** @test */ - public function firstCardShouldContainsFermeReouvertureLundiHuitHeure() { + public function firstCardShouldContainsFermeReouvertureLundiHuitHeure() + { $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//p[contains(@class, "closed")]', - 'Fermé. Réouverture Lundi à 08:00'); + 'Fermé. Réouverture Lundi à 08:00'); } - /** @test */ - public function firstCardShouldNotContainsOuvertMardiDixHeure() { + public function firstCardShouldNotContainsOuvertMardiDixHeure() + { $this->assertNotXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//ul/li[@class="default_opening_hours"]', - 'Mardi : 10h - 12h'); + 'Mardi : 10h - 12h'); } - /** @test */ - public function anchorEditLibraryShouldLinkToBibEditOne() { + public function anchorEditLibraryShouldLinkToBibEditOne() + { $this->assertXPath('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//a[contains(@class, "edit_library")][@href="/admin/bib/edit/id/1"]'); } - /** @test */ - public function anchorEditLibraryOpeningsShouldLinkToAdminOuverturesIndexIdSiteOne() { + public function anchorEditLibraryOpeningsShouldLinkToAdminOuverturesIndexIdSiteOne() + { $this->assertXPath('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//a[contains(@class, "edit_openings")][@href="/admin/ouvertures/index/id_site/1"][not(@data-popup)][@target="_blank"]'); } } - - - -class TemplatesLibraryWidgetWithCarouselFiveColumnsTest extends TemplatesLibraryTestCase { - public function setUp(): void { +class TemplatesLibraryWidgetWithCarouselFiveColumnsTest extends TemplatesLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Profil::find(1) ->updateModuleConfigAccueil(1, - ['division' => 2, - 'type_module' => Intonation_Library_Widget_Carousel_Library_Definition::CODE, - 'preferences' => ['layout' => Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS]]); + ['division' => 2, + 'type_module' => Intonation_Library_Widget_Carousel_Library_Definition::CODE, + 'preferences' => ['layout' => Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS]]); $this->dispatch('/opac/index/index/id_profil/1'); } - /** @test */ - public function cardGridShouldContainsFiveCards() { - $this->assertXPathCount('//div[contains(@class, "carousel-item active")]//div[contains(@class, "card_with_overlay card text-center")]//div[@class="card_overlay card-block card-img-overlay rounded text-center text-white"]', 5); + public function cardGridShouldContainsFiveCards() + { + $this->assertXPathCount('//div[@id="boite_1"]//div[@class="responsive_multiple_carousel_xl col-12 d-none d-xl-block"]//div[contains(@class, "carousel-item active")]//div[contains(@class, "card_with_overlay card text-center")]//div[@class="card_overlay card-block card-img-overlay rounded text-center text-white"]', 5); } } - - - -abstract class TemplatesLibraryWithLibrariansTestCase extends TemplatesLibraryTestCase { - public function setUp(): void { +abstract class TemplatesLibraryWithLibrariansTestCase extends TemplatesLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); $this @@ -164,66 +162,65 @@ abstract class TemplatesLibraryWithLibrariansTestCase extends TemplatesLibraryTe ->_buildLibrarian('arthur'); Class_User_Settings::setFileSystem( - (new Storm_FileSystem_Volatile()) - ->mkdir(USERFILES . '/images') - ->cd (USERFILES . '/images') - ->filePutContents('nelly.png', $this->_createImage()) - ->filePutContents('audrey.png', $this->_createImage()) - ->cd('/')); + (new Storm_FileSystem_Volatile) + ->mkdir(USERFILES . '/images') + ->cd(USERFILES . '/images') + ->filePutContents('nelly.png', $this->_createImage()) + ->filePutContents('audrey.png', $this->_createImage()) + ->cd('/')); ZendAfi_Auth::getInstance()->clearIdentity(); } - - protected function _buildLibrarian($login, $image = null) { + protected function _buildLibrarian($login, $image = null) + { $librarian = - Class_Users::newInstance(['login' => $login, - 'prenom' => $login, - 'password' => 'secret', - 'id_site' => 1, + Class_Users::newInstance(['login' => $login, + 'prenom' => $login, + 'password' => 'secret', + 'id_site' => 1, 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB]); - if ($image) - (new Class_User_Settings($librarian))->setProfileImage('userfiles/images/' . $image); + if ($image)(new Class_User_Settings($librarian))->setProfileImage('userfiles/images/' . $image); $librarian->assertSave(); + return $this; } - - protected function _createImage() { - $im = new Imagick(); - $im->newPseudoImage(50, 10, "gradient:red-black"); + protected function _createImage() + { + $im = new Imagick; + $im->newPseudoImage(50, 10, 'gradient:red-black'); $im->setImageFormat('png'); + return $im->getImageBlob(); } } - - - -class TemplatesLibraryViewAnnecyTest extends TemplatesLibraryTestCase { +class TemplatesLibraryViewAnnecyTest extends TemplatesLibraryTestCase +{ use Trait_ManageCustomFields; public function setUp(): void { parent::setUp(); - $this->createCheckboxFieldForLibrary('1','Services','Wifi;Projection;Restauration;l\'Médias'); + $this->createCheckboxFieldForLibrary('1', 'Services', 'Wifi;Projection;Restauration;l\'Médias'); $this->fixture(Class_CustomField::class, - ['id' => 2, - 'priority' => 2, - 'field_type' => Class_CustomField_Meta::TEXT_INPUT, - 'label' => 'Slogan', - 'model' => 'Bib']); + ['id' => 2, + 'priority' => 2, + 'field_type' => Class_CustomField_Meta::TEXT_INPUT, + 'label' => 'Slogan', + 'model' => 'Bib']); $this->fixture(Class_CustomField::class, - ['id' => 3, - 'priority' => 3, - 'field_type' => Class_CustomField_Meta::CKEDITOR, - 'label' => 'Fonds Spécifiques', - 'model' => 'Bib']); + ['id' => 3, + 'priority' => 3, + 'field_type' => Class_CustomField_Meta::CKEDITOR, + 'label' => 'Fonds Spécifiques', + 'model' => 'Bib']); Class_Bib::find(1) ->setCustomField(2, 'Vive le vélo') @@ -233,98 +230,95 @@ class TemplatesLibraryViewAnnecyTest extends TemplatesLibraryTestCase { ->setPret('C\'est génial vous pouvez emprunter') ->saveWithCustomFieldValueIds(['1' => [$this->getSetupValueForString('Wifi'), $this->getSetupValueForString('Restauration'), - $this->getSetupValueForString( 'l\'Médias')]]); + $this->getSetupValueForString('l\'Médias')]]); $this->dispatch('/annecy'); } - /** @test */ - public function responseShouldForwardToActionEnLirePlus() { + public function responseShouldForwardToActionEnLirePlus() + { $this->assertXPath('//body[contains(@class, "bib_en-lire-plus")]'); } - /** @test */ - public function pretTextShouldBeInDivClassLibraryDetailsPret() { + public function pretTextShouldBeInDivClassLibraryDetailsPret() + { $this->assertXPathContentContains('//div[@class="library_details_attribut modalites_des_prets col-12"]/p', 'C\'est génial vous pouvez emprunter'); } - /** @test */ - public function customOneLibraryBoxH4ShouldContainsServices() { - + public function customOneLibraryBoxH4ShouldContainsServices() + { $this->assertXPathContentContains('//div[@class="library_details_custom_field services col-12"]/div[@class="custom1 library_box"]//h4', - 'Services'); + 'Services'); } - /** @test */ - public function customOneLibraryBoxUlLiShouldContainsWifi() { + public function customOneLibraryBoxUlLiShouldContainsWifi() + { $this->assertXPathContentContains('//div[@class="custom1 library_box"]/ul//li', - 'Wifi'); + 'Wifi'); } - /** @test */ - public function customTwoLibraryBoxDivShouldContainsViveLeVelo() { + public function customTwoLibraryBoxDivShouldContainsViveLeVelo() + { $this->assertXPathContentContains('//div[@class="custom2 library_box"]//div', - 'Vive le vélo'); + 'Vive le vélo'); } - /** @test */ - public function customThreeLibraryBoxDivShouldContainsLaMatériauthèque() { + public function customThreeLibraryBoxDivShouldContainsLaMatériauthèque() + { $this->assertXPathContentContains('//div[@class="custom3 library_box"]//div', - 'La matériauthèque'); + 'La matériauthèque'); } - /** @test */ - public function pageShouldBeHTML5Valid() { + public function pageShouldBeHTML5Valid() + { $this->assertHTML5(); } } - - - -class TemplatesLibraryReadMoreAsAdminTest extends TemplatesLibraryTestCase { - public function setUp(): void { +class TemplatesLibraryReadMoreAsAdminTest extends TemplatesLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/bib/en-lire-plus/id/1/id_profil/1'); } - /** @test */ - public function anchorEditLibraryShouldLinkToBibEditOne() { + public function anchorEditLibraryShouldLinkToBibEditOne() + { $this->assertXPath('//a[contains(@class, "edit_library")][@href="/admin/bib/edit/id/1"]'); } - /** @test */ - public function anchorEditLibraryOpeningsShouldLinkToAdminOuverturesIndexIdSiteOne() { + public function anchorEditLibraryOpeningsShouldLinkToAdminOuverturesIndexIdSiteOne() + { $this->assertXPath('//a[contains(@class, "edit_openings")][@href="/admin/ouvertures/index/id_site/1"][not(@data-popup)][@target="_blank"]'); } - /** @test */ - public function countUsersShouldBeDisplay() { + public function countUsersShouldBeDisplay() + { $this->assertXpathContentContains('//div//p[@class="users_count"]', 'Nombre d\'utilisateurs'); } - /** @test */ - public function countRecordsShouldBeDisplay() { + public function countRecordsShouldBeDisplay() + { $this->assertXpathContentContains('//div//p[@class="documents_count"]', 'Nombre de documents'); } } - - - -class TemplatesLibraryReadMoreTest extends TemplatesLibraryWithLibrariansTestCase { - public function setUp(): void { +class TemplatesLibraryReadMoreTest extends TemplatesLibraryWithLibrariansTestCase +{ + public function setUp(): void + { parent::setUp(); Class_User_Contributions::reset(); @@ -334,182 +328,178 @@ class TemplatesLibraryReadMoreTest extends TemplatesLibraryWithLibrariansTestCas $mock_sql = $this->mock() ->whenCalled('fetchAll') ->with('select id_user, count(*) as number from notices_avis group by id_user') - ->answers([['id_user' => $arthur_id,'number' => 10]]) + ->answers([['id_user' => $arthur_id, 'number' => 10]]) ->whenCalled('fetchAll') ->with('select id_user, count(*) as number from cms_article where debut IS not null and events_fin IS not null and status = 3 group by id_user') - ->answers([['id_user' => $arthur_id,'number' => 3]]) + ->answers([['id_user' => $arthur_id, 'number' => 3]]) ->whenCalled('fetchAll') ->with('select id_user, count(*) as number from notices_paniers where notices <> "" group by id_user') - ->answers([['id_user' => $arthur_id,'number' => 7]]); + ->answers([['id_user' => $arthur_id, 'number' => 7]]); Zend_Registry::set('sql', $mock_sql); $this->dispatch('/opac/bib/en-lire-plus/id/1/id_profil/1'); } - - public function tearDown(): void { + public function tearDown(): void + { Class_User_Contributions::reset(); parent::tearDown(); } - /** @test */ - public function pageShouldContainsDivAnnecy() { + public function pageShouldContainsDivAnnecy() + { $this->assertXPath('//div', 'Annecy'); } - /** @test */ - public function badgeWebsiteShouldContainsAnnecyDotFr() { + public function badgeWebsiteShouldContainsAnnecyDotFr() + { $this->assertXPathContentContains('//a[contains(@class, "badge_tag badge_website")][@href="https://annecy.fr"]', 'Site internet'); } - /** @test */ - public function badgeWebsiteShouldContainsExternalLinkIco() { + public function badgeWebsiteShouldContainsExternalLinkIco() + { $this->assertXPath('//a[contains(@class, "badge_tag badge_website")]//i[contains(@class, fas-external-link-alt)]'); } - /** @test */ - public function jumbotronTitleShouldContainsContactInfoWithAddress() { + public function jumbotronTitleShouldContainsContactInfoWithAddress() + { $this->assertXPathContentContains('//div[contains(@class, "jumbotron_title")]//div[contains(@class, "badge-group")]//address[@class = "badge_tag badge_address text-left badge-secondary badge no_truncate"]', - '1 rue par là 74000 Annecy'); + '1 rue par là 74000 Annecy'); } - /** @test */ - public function jumbotronTitleShouldContainsLinkWithPhone() { + public function jumbotronTitleShouldContainsLinkWithPhone() + { $this->assertXPathContentContains('//div[contains(@class, "jumbotron_title")]//a[@class="badge_tag badge_phone text-left badge no_truncate badge-primary text-light"][@href="tel:0450123456"]', - '04 50 12 34 56'); + '04 50 12 34 56'); } - /** @test */ - public function jumbotronTitleShouldContainsLinkWithMail() { + public function jumbotronTitleShouldContainsLinkWithMail() + { $this->assertXPathContentContains('//div[contains(@class, "jumbotron_title")]//a[@class="badge_tag badge_mail text-left badge no_truncate badge-primary text-light"][@href="mailto:contact@annecy.fr"]', - 'contact@annecy.fr'); + 'contact@annecy.fr'); } - /** @test */ - public function pageShouldNotContainsLinkToReadMoreBibliobus() { + public function pageShouldNotContainsLinkToReadMoreBibliobus() + { $this->assertNotXPath('//a[contains(@href, "/bib/en-lire-plus/id/2")]'); } - /** @test */ - public function pageShouldContainsLinkToReadMoreMeythet() { + public function pageShouldContainsLinkToReadMoreMeythet() + { $this->assertXPath('//a[contains(@class, "next")][contains(@href, "/bib/en-lire-plus/id/4")]'); } - /** @test */ - public function firstProShouldBeArthur() { + public function firstProShouldBeArthur() + { $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//div[contains(@class, "card-title")]', 'arthur'); } - /** @test */ - public function proShouldHaveAvaterNellyDotPng() { + public function proShouldHaveAvaterNellyDotPng() + { $this->assertXPath('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][3]//img[contains(@src, "userfiles/images/nelly.png")]'); } - /** @test */ - public function secondProShouldBeAudrey() { + public function secondProShouldBeAudrey() + { $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][2]//div[contains(@class, "card-title")]', 'audrey'); } - /** @test */ - public function secondProShouldHaveAvaterAudreyDotPng() { + public function secondProShouldHaveAvaterAudreyDotPng() + { $this->assertXPath('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][2]//img[contains(@src, "userfiles/images/audrey.png")]'); } - /** @test */ - public function sebastienShouldHaveAvatarReadBlack() { + public function sebastienShouldHaveAvatarReadBlack() + { $this->assertXPath('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//img[contains(@src, "opac/images/abonnes/read_black.png")]'); } - /** @test */ - public function arthurShouldHaveAvatarReadBlack() { + public function arthurShouldHaveAvatarReadBlack() + { $this->assertXPath('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//img[contains(@src, "opac/images/abonnes/read_black.png")]'); } - /** @test */ - public function arthurShouldHaveBadgeFor10Reviews() { - $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//a[contains(@href, "/bib/avis-pro/id/1/id_profil/1/pro_id/'.Class_Users::findFirstBy(['login'=>'arthur'])->getId().'")]', '10 avis'); + public function arthurShouldHaveBadgeFor10Reviews() + { + $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//a[contains(@href, "/bib/avis-pro/id/1/id_profil/1/pro_id/' . Class_Users::findFirstBy(['login'=>'arthur'])->getId() . '")]', '10 avis'); } - /** @test */ - public function arthurShouldHaveBadgeFor3Articles() { - $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//a[contains(@href, "/bib/articles-pro/id/1/id_profil/1/pro_id/'.Class_Users::findFirstBy(['login'=>'arthur'])->getId().'")]', '3 articles'); + public function arthurShouldHaveBadgeFor3Articles() + { + $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//a[contains(@href, "/bib/articles-pro/id/1/id_profil/1/pro_id/' . Class_Users::findFirstBy(['login'=>'arthur'])->getId() . '")]', '3 articles'); } - /** @test */ - public function arthurShouldHaveBadgeFor7Selections() { - $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//a[contains(@href, "/bib/selections-pro/id/1/id_profil/1/pro_id/'.Class_Users::findFirstBy(['login'=>'arthur'])->getId().'")]', '7 sélection(s)'); + public function arthurShouldHaveBadgeFor7Selections() + { + $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Pro")][1]//a[contains(@href, "/bib/selections-pro/id/1/id_profil/1/pro_id/' . Class_Users::findFirstBy(['login'=>'arthur'])->getId() . '")]', '7 sélection(s)'); } - /** @test */ - public function addressShouldBeInBadge() { + public function addressShouldBeInBadge() + { $this->assertXPathContentContains('//div[contains(@class, "badge")]', '1 rue par là '); } } - - - -class TemplatesLibraryReadMoreWithCacheTest extends TemplatesLibraryWithLibrariansTestCase { +class TemplatesLibraryReadMoreWithCacheTest extends TemplatesLibraryWithLibrariansTestCase +{ protected $_storm_default_to_volatile = true; - - public function setUp(): void { + public function setUp(): void + { parent::setUp(); Storm_Cache::beVolatile(); - (new Storm_Cache()) + (new Storm_Cache) ->save('Cache cache !', - json_encode([1, - 1, - 'Intonation_Library_View_Wrapper_Library_RichContent_Team', - 'getContent'])); + json_encode([1, + 1, + 'Intonation_Library_View_Wrapper_Library_RichContent_Team', + 'getContent'])); $this->dispatch('/opac/bib/en-lire-plus/id/1/id_profil/1'); } - /** @test */ - public function divLibraryTeamShouldContainsCacheCache() { + public function divLibraryTeamShouldContainsCacheCache() + { $this->assertXPathContentContains('//div[contains(@class, "library_team")]', - 'Cache cache !'); + 'Cache cache !'); } } - - - -class TemplatesLibraryWidgetWithDescriptionLengthTest extends AbstractControllerTestCase { +class TemplatesLibraryWidgetWithDescriptionLengthTest extends AbstractControllerTestCase +{ protected $_storm_default_to_volatile = true; - - public function setUp(): void { + public function setUp(): void + { parent::setUp(); Class_AdminVar::set('TEMPLATING', 1); ZendAfi_Auth::getInstance()->clearIdentity(); $profile = $this->fixture('Class_Profil', - ['id' => 34, - 'template' => 'MUSCLE' - ]); + ['id' => 34, + 'template' => 'MUSCLE', + ]); $profile->beCurrentProfil(); @@ -518,73 +508,71 @@ class TemplatesLibraryWidgetWithDescriptionLengthTest extends AbstractController $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_MAIN, - ['rendering' => 'card-description', - 'libraries' => '12', - 'layout' => 'list', - 'size' => 1, - 'description_length' => 4]); + Class_Profil::DIV_MAIN, + ['rendering' => 'card-description', + 'libraries' => '12', + 'layout' => 'list', + 'size' => 1, + 'description_length' => 4]); $this->fixture('Class_Bib', - ['id' => 12, - 'libelle' => 'Esertine', - 'inscription' => 'La description s\'arrête ici et pas plus loin.']); + ['id' => 12, + 'libelle' => 'Esertine', + 'inscription' => 'La description s\'arrête ici et pas plus loin.']); $this->dispatch('/opac/widget/render/widget_id/1/profile_id/34'); } - /** @test */ - public function descriptionShouldBeTruncate() { + public function descriptionShouldBeTruncate() + { $this->assertXPathContentContains('//div[contains(@class, "library widget")]//p[contains(@class, "model_description")]', - 'La description s\'arrête ici …'); + 'La description s\'arrête ici …'); } } - - - -class TemplatesLibraryWithNoWebsiteReadMoreTest extends TemplatesLibraryWithLibrariansTestCase { - public function setUp(): void { +class TemplatesLibraryWithNoWebsiteReadMoreTest extends TemplatesLibraryWithLibrariansTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/opac/bib/en-lire-plus/id/2/id_profil/1'); } - /** @test */ - public function badgeWebsiteShouldNotBePresent() { + public function badgeWebsiteShouldNotBePresent() + { $this->assertNotXPath('//a[contains(@class, "badge_tag badge_website")]'); } } - - - -class TemplatesLibraryWithBookmarksEnabledTest extends TemplatesLibraryWithLibrariansTestCase { - public function setUp(): void { +class TemplatesLibraryWithBookmarksEnabledTest extends TemplatesLibraryWithLibrariansTestCase +{ + public function setUp(): void + { parent::setUp(); $this->fixture('Class_Bib', - ['id' => 1, - 'libelle' => 'Nyons']); + ['id' => 1, + 'libelle' => 'Nyons']); Class_AdminVar::set('ENABLE_BOOKMARKABLE_LIBRARIES', 1); } - /** @test */ - public function actionAddLibraryToBookmarksShouldBePresent() { + public function actionAddLibraryToBookmarksShouldBePresent() + { $this->dispatch('/opac/bib/en-lire-plus/id/2/id_profil/1'); $this->assertXPath('//a[contains(@class, "add_to_preferences")][@href = "/abonne/add-library-to-bookmarks/library_id/2"]'); } - /** @test */ - public function actionRemoveLibraryToBookmarksShouldBePresent() { + public function actionRemoveLibraryToBookmarksShouldBePresent() + { $frou_frou = $this->fixture('Class_Users', - ['id' => 34, - 'login' => 'froufrou', - 'password' => 's3cr3t \o/', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]); + ['id' => 34, + 'login' => 'froufrou', + 'password' => 's3cr3t \o/', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]); ZendAfi_Auth::getInstance()->logUser($frou_frou); @@ -597,10 +585,8 @@ class TemplatesLibraryWithBookmarksEnabledTest extends TemplatesLibraryWithLibra } } - - - -class TemplatesLibraryWidgetWithOSMAndLinkToProfileTest extends TemplatesIntonationTestCase { +class TemplatesLibraryWidgetWithOSMAndLinkToProfileTest extends TemplatesIntonationTestCase +{ use Trait_ManageCustomFields; public function setUp(): void @@ -609,32 +595,31 @@ class TemplatesLibraryWidgetWithOSMAndLinkToProfileTest extends TemplatesIntonat $this->fixture(Class_Profil::class, ['id' => 123]); - $this->createCheckboxFieldForLibrary(1,'Service','Wifi;Projection;Restauration;l\'Médias'); + $this->createCheckboxFieldForLibrary(1, 'Service', 'Wifi;Projection;Restauration;l\'Médias'); $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Annecy', - 'lieu' => $this->fixture(Class_Lieu::class, - ['id' => 9, - 'libelle' => 'Annecy', - 'latitude' => '1', - 'longitude' => '1']), - 'link_to_profil_id' => 123]) - ->saveWithCustomFieldValueIds( ['1'=> [ - $this->getSetupValueForString('Wifi'), - $this->getSetupValueForString( 'Projection'), - $this->getSetupValueForString( 'Restauration'), - $this->getSetupValueForString('l\'Médias')]]); + ['id' => 1, + 'libelle' => 'Annecy', + 'lieu' => $this->fixture(Class_Lieu::class, + ['id' => 9, + 'libelle' => 'Annecy', + 'latitude' => '1', + 'longitude' => '1']), + 'link_to_profil_id' => 123]) + ->saveWithCustomFieldValueIds(['1'=> [ + $this->getSetupValueForString('Wifi'), + $this->getSetupValueForString('Projection'), + $this->getSetupValueForString('Restauration'), + $this->getSetupValueForString('l\'Médias')]]); Class_Profil::find(72) - ->setCfgAccueil(['modules' => - ['21' => ['division' => 3, - 'type_module' => 'LIBRARY', - 'preferences' => ['osm_map' => 1, - 'osm_layer' => 1, - 'osm_zoom' => 3, - 'geo_json' => 'files/my_geojson.geojson', - 'filters' => 'custom_field_1']]]]) + ->setCfgAccueil(['modules' => ['21' => ['division' => 3, + 'type_module' => 'LIBRARY', + 'preferences' => ['osm_map' => 1, + 'osm_layer' => 1, + 'osm_zoom' => 3, + 'geo_json' => 'files/my_geojson.geojson', + 'filters' => 'custom_field_1']]]]) ->assertSave(); Storm_Cache::beVolatile(); @@ -652,77 +637,79 @@ class TemplatesLibraryWidgetWithOSMAndLinkToProfileTest extends TemplatesIntonat $this->dispatch('/opac/index/index/id_profil/72'); } - /** @test */ - public function customFieldServiceProjectionShouldBeAnAnchor() { - $this->assertXPathContentContains('//div[contains(@class,"boite library")]//div[@class="dropdown-menu"]//li//a[@href = "/bib/widget/id_profil/72/id_module/21/id_division/3/custom_field_1/'. $this->getSetupValueIdForString('Projection').'"]', - 'Projection'); + public function customFieldServiceProjectionShouldBeAnAnchor() + { + $this->assertXPathContentContains('//div[contains(@class,"boite library")]//div[@class="dropdown-menu"]//li//a[@href = "/bib/widget/id_profil/72/id_module/21/id_division/3/custom_field_1/' . $this->getSetupValueIdForString('Projection') . '"]', + 'Projection'); } - /** @test */ - public function cardTitleShouldContainsAnnecy() { + public function cardTitleShouldContainsAnnecy() + { $this->assertXPathContentContains('//div[contains(@class,"boite library")]//div[@class="card-title"]', 'Annecy'); } - /** @test */ - public function scriptLoaderShouldContainsOpenStreetMapJs() { + public function scriptLoaderShouldContainsOpenStreetMapJs() + { $this->assertContains('openStreetMap.js', Class_ScriptLoader::getInstance()->html()); } - /** @test */ - public function scriptLoaderShouldContainsOpenStreetMapCss() { + public function scriptLoaderShouldContainsOpenStreetMapCss() + { $this->assertContains('openStreetMap.css', Class_ScriptLoader::getInstance()->html()); } - /** @test */ - public function dataOsmGeoJsonShouldContainsMyGeoJson() { + public function dataOsmGeoJsonShouldContainsMyGeoJson() + { $this->assertXPath('//div[contains(@data-osm-geojson, "my_geojson.geojson")]'); } - /** @test */ - public function dataOsmZommShouldContains3() { + public function dataOsmZommShouldContains3() + { $this->assertXPath('//div[@data-osm-zoom=3]'); } - /** @test */ - public function dataOsmLayerShouldBe1() { + public function dataOsmLayerShouldBe1() + { $this->assertXPath('//div[contains(@data-osm-layer, "1")]'); } - /** @test */ - public function dataOsmOpenUrlIconShouldBeMapSlashOpenMarkerIconDotPng() { + public function dataOsmOpenUrlIconShouldBeMapSlashOpenMarkerIconDotPng() + { $this->assertXPath('//div[contains(@data-osm-open-url-icon, "/map/open-marker-icon.png")]'); } - /** * @see http://forge.afi-sa.fr/issues/149044 + * * @test */ - public function dataOsmClosedUrlIconShouldBeMapSlashWereClosedDotPng() { + public function dataOsmClosedUrlIconShouldBeMapSlashWereClosedDotPng() + { $this->assertXPath('//div[@data-osm-close-url-icon="/map/were-closed.png"]'); } - /** * @test + * * @see https://forge.afi-sa.net/issues/114141 */ - public function linkToDetailShouldTargetProfile123() { + public function linkToDetailShouldTargetProfile123() + { $this->assertXPathContentContains('//div[@id="boite_21"]//a[contains(@href, "/id_profil/123")]', - 'Annecy'); + 'Annecy'); } - /** @test */ - public function widgetContentShouldNotBeCached() { + public function widgetContentShouldNotBeCached() + { $this->_response->setBody(''); Class_Bib::find(1)->setLibelle('Tataouine')->assertSave(); $this->dispatch('/'); @@ -730,89 +717,83 @@ class TemplatesLibraryWidgetWithOSMAndLinkToProfileTest extends TemplatesIntonat } } - - - -class TemplatesLibraryWidgetConfigurationWithOsmTest extends TemplatesIntonationTestCase { - public function setUp(): void { +class TemplatesLibraryWidgetConfigurationWithOsmTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Profil::find(72) - ->setCfgAccueil(['modules' => - ['21' => ['division' => 3, - 'type_module' => 'LIBRARY', - 'preferences' => ['osm_map' => 1, - 'osm_layer' => 1, - 'osm_zoom' => 2, - 'geo_json' => 'files/my_geojson.geojson']]]]) + ->setCfgAccueil(['modules' => ['21' => ['division' => 3, + 'type_module' => 'LIBRARY', + 'preferences' => ['osm_map' => 1, + 'osm_layer' => 1, + 'osm_zoom' => 2, + 'geo_json' => 'files/my_geojson.geojson']]]]) ->assertSave(); $this->dispatch('/admin/widget/edit-widget/id/21/id_profil/72'); } - /** @test */ - public function osmMapInputShouldBeChecked() { + public function osmMapInputShouldBeChecked() + { $this->assertXPath('//input[@name="osm_map"][@checked]'); } - /** @test */ - public function osmLayerInputShouldBeChecked() { + public function osmLayerInputShouldBeChecked() + { $this->assertXPath('//input[@name="osm_layer"][@checked]'); } - /** @test */ - public function osmZoomValueShouldBe2() { + public function osmZoomValueShouldBe2() + { $this->assertXPath('//input[@name="osm_zoom"][@value="2"]'); } - /** @test */ - public function geoJsonInputValueShouldBeMyGeoJson() { + public function geoJsonInputValueShouldBeMyGeoJson() + { $this->assertXPath('//input[@name="geo_json"][@value="files/my_geojson.geojson"]'); } } - - - -class TemplatesLibraryWidgetWithCarouselThreeColumnsAndOpeningHoursTest extends TemplatesLibraryTestCase { - public function setUp(): void { +class TemplatesLibraryWidgetWithCarouselThreeColumnsAndOpeningHoursTest extends TemplatesLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); $template_settings = $this->fixture(Class_Template_Settings::class, - ['id' => 1, - 'template' => 'INTONATION']); + ['id' => 1, + 'template' => 'INTONATION']); $template_settings_instance = $template_settings->getSettingsInstance(); $template_settings_instance->setIntonationHydratingMapping([]); $template_settings->setSettings(serialize($template_settings_instance->toArray()))->save(); - $time = new TimeSourceForTest("2020-10-18 10:00:00"); + $time = new TimeSourceForTest('2020-10-18 10:00:00'); Class_Bib::setTimeSource($time); ZendAfi_View_Helper_RenderLibraryOpening::setTimeSource($time); $this->dispatch('/opac/index/index/id_profil/1'); } - /** @test */ - public function firstCardShouldContainsOuvertMardiDixHeure() { + public function firstCardShouldContainsOuvertMardiDixHeure() + { $this->assertXPathContentContains('//div[contains(@class, "card_Intonation_Library_View_Wrapper_Library")][1]//ul/li[@class="default_opening_hours"]', - 'Mardi : 10h - 12h'); + 'Mardi : 10h - 12h'); } } - - - -class TemplatesLibraryWithRewriteUrlNavigationTest - extends TemplatesLibraryTestCase { - - public function setUp(): void { +class TemplatesLibraryWithRewriteUrlNavigationTest extends TemplatesLibraryTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Bib::find(4) @@ -825,27 +806,24 @@ class TemplatesLibraryWithRewriteUrlNavigationTest $this->dispatch('/meythet'); } - /** @test */ - public function prevNavShouldHaveBibEnLirePlusId2Url() { + public function prevNavShouldHaveBibEnLirePlusId2Url() + { $this->assertXPath('//div[contains(@class, "jumbotron_previous")]//a[contains(@class, "previous")][@href="/annecy"]'); } - /** @test */ - public function nextNavShouldHaveBibEnLirePlusId4Url() { + public function nextNavShouldHaveBibEnLirePlusId4Url() + { $this->assertXPath('//div[contains(@class, "jumbotron_next")]//a[contains(@class, "next")][@href="/pringy"]'); } } - - - -/* hotline : https://forge.afi-sa.net/issues/131015 */ -class TemplatesLibraryWithRewriteUrlLinkTest - extends TemplatesLibraryWithLibrariansTestCase { - - public function setUp(): void { +// hotline : https://forge.afi-sa.net/issues/131015 +class TemplatesLibraryWithRewriteUrlLinkTest extends TemplatesLibraryWithLibrariansTestCase +{ + public function setUp(): void + { parent::setUp(); Class_User_Contributions::reset(); @@ -874,102 +852,94 @@ class TemplatesLibraryWithRewriteUrlLinkTest $this->dispatch('/annecy'); } - /** @test */ - public function hrefForBadgeAvisShouldHaveIdCurrentBib() { + public function hrefForBadgeAvisShouldHaveIdCurrentBib() + { $this->assertXPath('//a[contains(@class, "badge_tag")][@title="Lire les 1 avis du professionnel"][@href="/bib/avis-pro/pro_id/670/id/1"]'); } - /** @test */ - public function hrefForBadgeSelectionsShouldHaveIdCurrentBib() { + public function hrefForBadgeSelectionsShouldHaveIdCurrentBib() + { $this->assertXPath('//a[contains(@class, "badge_tag")][@title="Voir les 3 sélections de documents du professionnel"][@href="/bib/selections-pro/pro_id/670/id/1"]'); } - /** @test */ - public function hrefForBadgeArticlesShouldHaveIdCurrentBib() { + public function hrefForBadgeArticlesShouldHaveIdCurrentBib() + { $this->assertXPath('//a[contains(@class, "badge_tag")][@title="Lire les 2 articles du professionnel"][@href="/bib/articles-pro/pro_id/670/id/1"]'); } } - - - -class TemplatesLibraryWithCarouselDataInHTMLCustomFieldTest - extends AbstractControllerTestCase { - - +class TemplatesLibraryWithCarouselDataInHTMLCustomFieldTest extends AbstractControllerTestCase +{ protected $_storm_default_to_volatile = true; - - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->_buildTemplateProfil(['id' => 123123]); $library = $this->fixture(Class_Bib::class, - ['id' => 12, - 'libelle' => 'Valleiry']); + ['id' => 12, + 'libelle' => 'Valleiry']); $this->fixture(Class_CustomField::class, - ['id' => 1, - 'priority' => 1, - 'label' => 'Notices', - 'field_type' => Class_CustomField_Meta::CKEDITOR, - 'model' => 'Bib']); + ['id' => 1, + 'priority' => 1, + 'label' => 'Notices', + 'field_type' => Class_CustomField_Meta::CKEDITOR, + 'model' => 'Bib']); $library ->setCustomField('1', '<p>Les nouveautés à Valleiry</p><img class="bokeh_kiosk" data-code="KIOSQUE" data-form="titre=&style_liste=mur&aleatoire=1&tri=1&boite=&rss=1&&link_to_all=1&id_panier=123&">') ->saveWithCustomFields(); $this->fixture(Class_Notice::class, - ['id' => 123, - 'titre_principal' => 'Les aventures de Boule et Bill vol.19']); + ['id' => 123, + 'titre_principal' => 'Les aventures de Boule et Bill vol.19']); $this->dispatch('/bib/en-lire-plus/id/12'); } - /** @test */ - public function masonryWithBouleEtBillRecordTitleShouldBePresent() { + public function masonryWithBouleEtBillRecordTitleShouldBePresent() + { $this->assertXPathContentContains('//div[@class="masonry"]//div[@class="card-title"]', - 'Les aventures de Boule et Bill vol.19'); + 'Les aventures de Boule et Bill vol.19'); } } - - - -class TemplatesLibraryBibWidgetDispatchTest extends TemplatesLibraryTestCase { +class TemplatesLibraryBibWidgetDispatchTest extends TemplatesLibraryTestCase +{ /** @test */ - public function htmlShouldContainsLibraryAnnecy() { + public function htmlShouldContainsLibraryAnnecy() + { $this->dispatch('/bib/widget/id_module/1'); $this->assertXPathContentContains('//div[@class="ajax_content"]//div[@class="card-deck"]//div[@class="card-title card_title card_title_Intonation_Library_View_Wrapper_Library"]//a', 'Annecy'); } - /** @test */ - public function ajaxHtmlShouldContainsLibraryAnnecy() { + public function ajaxHtmlShouldContainsLibraryAnnecy() + { $this->dispatch('/bib/widget/id_module/1/render/ajax'); $this->assertXPathContentContains('//div[@class="ajax_content"]//div[@class="card-deck"]//div[@class="card-title card_title card_title_Intonation_Library_View_Wrapper_Library"]//a', 'Annecy'); } } - - - -class TemplatesLibraryBibRenderAllDispatchTest extends TemplatesLibraryTestCase { - +class TemplatesLibraryBibRenderAllDispatchTest extends TemplatesLibraryTestCase +{ /** @test */ - public function ajaxHtmlShouldContainsLibraryAnnecy() { + public function ajaxHtmlShouldContainsLibraryAnnecy() + { $this->dispatch('/bib/render-all/id_module/1/render/ajax'); $this->assertXPathContentContains('//div[@class="ajax_content"]//div[@class="list-group bg-transparent no_border"]//div[@class="card-title card_title card_title_Intonation_Library_View_Wrapper_Library"]//a', 'Annecy'); } - /** @test */ - public function htmlShouldContainsLibraryAnnecy() { + public function htmlShouldContainsLibraryAnnecy() + { $this->dispatch('/bib/render-all/id_module/1'); $this->assertXPathContentContains('//div[@class="ajax_content"]//div[@class="list-group bg-transparent no_border"]//div[@class="card-title card_title card_title_Intonation_Library_View_Wrapper_Library"]//a', 'Annecy'); } diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index f816f751e42c4d198239b643a75b4acd521446ff..f4c742885f3f185bd1cb70eda2441808a83b1fe5 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved. * @@ -19,91 +20,87 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -require_once('TemplatesTest.php'); - - -class TemplatesWidgetsNewsletterTest extends TemplatesIntonationTestCase { +require_once 'TemplatesTest.php'; +class TemplatesWidgetsNewsletterTest extends TemplatesIntonationTestCase +{ /** @test */ - public function newsletterWidgetShouldBePresent() { + public function newsletterWidgetShouldBePresent() + { $this->fixture(Class_Newsletter::class, - ['id' => 3, - 'titre' => 'Jeunesse', - 'mail_subject' => 'Jeunesse', - 'contenu' => 'les nouveautés jeunesse']); + ['id' => 3, + 'titre' => 'Jeunesse', + 'mail_subject' => 'Jeunesse', + 'contenu' => 'les nouveautés jeunesse']); $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPathContentContains('//div', 'Boite lettres d\'informations'); } - /** @test */ - public function inputTitreTypeShouldBeText() { + public function inputTitreTypeShouldBeText() + { $this->dispatch('/admin/widget/edit-widget/id/25/id_profil/72'); $this->assertXpath('//input[@name="titre"][@type="text"]'); } - /** @test */ - public function buttonDisableNewsletterShouldBePresent() { + public function buttonDisableNewsletterShouldBePresent() + { $this->fixture(Class_Newsletter::class, - ['id' => 3, - 'titre' => 'Jeunesse', - 'mail_subject' => 'Jeunesse', - 'contenu' => 'les nouveautés jeunesse']); + ['id' => 3, + 'titre' => 'Jeunesse', + 'mail_subject' => 'Jeunesse', + 'contenu' => 'les nouveautés jeunesse']); $this->dispatch('/opac/abonne/fiche'); $this->assertXPathContentContains('//a[@class="disable_all_newsletters btn-warning btn btn-sm"][@href="/abonne/disable-newsletter"]', - 'Ne plus recevoir de lettre d\'information'); + 'Ne plus recevoir de lettre d\'information'); } - /** @test */ - public function inputScrollAnchorIdShouldBeText() { + public function inputScrollAnchorIdShouldBeText() + { $this->dispatch('/admin/widget/edit-widget/id/25/id_profil/72'); $this->assertXpath('//input[@name="scroll_anchor_id"][@type="text"]'); } - /** @test */ - public function inputTitleImageShouldBeText() { + public function inputTitleImageShouldBeText() + { $this->dispatch('/admin/widget/edit-widget/id/25/id_profil/72'); $this->assertXpath('//input[@name="title_picto"][@type="text"]'); } } - - - -class TemplatesWidgetMenuTest extends TemplatesIntonationTestCase { - +class TemplatesWidgetMenuTest extends TemplatesIntonationTestCase +{ /** @test */ - public function menuWidgetShouldBePresent() { + public function menuWidgetShouldBePresent() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPathContentContains('//div[contains(@class, "menu")]//div', 'Boite menu'); } - /** @test */ - public function inputTitreTypeShouldBeText() { + public function inputTitreTypeShouldBeText() + { $this->dispatch('/admin/widget/edit-widget/id/26/id_profil/72'); $this->assertXpath('//input[@name="titre"][@type="text"]'); } } - - - -abstract class TemplatesWidgetRenderAllTestCase extends TemplatesIntonationTestCase { - - public function setUp(): void { +abstract class TemplatesWidgetRenderAllTestCase extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); $vacances = $this ->fixture(Class_Article::class, - ['id' => 78, - 'titre' => 'Les vacances', - 'contenu' => 'À la mer']); + ['id' => 78, + 'titre' => 'Les vacances', + 'contenu' => 'À la mer']); $this ->onLoaderOfModel(Class_Article::class) @@ -115,63 +112,61 @@ abstract class TemplatesWidgetRenderAllTestCase extends TemplatesIntonationTestC ->answers([$vacances]); $this->fixture(Class_Notice::class, - ['id' => 20090, - 'clef_oeuvre' => 'PSYKO']); + ['id' => 20090, + 'clef_oeuvre' => 'PSYKO']); $this->fixture(Class_Notice::class, - ['id' => 456, - 'titre_principal' => 'Rahan']); + ['id' => 456, + 'titre_principal' => 'Rahan']); $this->fixture(Class_AvisNotice::class, - ['id' => 4, - 'id_user' => 666, - 'id_notice' => 20090, - 'clef_oeuvre' => 'PSYKO', - 'note' => '4', - 'entete' => 'Le Roi', - 'avis' => 'Le Roi des cons sur son throne', - 'source_author' => null]); + ['id' => 4, + 'id_user' => 666, + 'id_notice' => 20090, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi', + 'avis' => 'Le Roi des cons sur son throne', + 'source_author' => null]); $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Annecy', - 'id_lieu' => 11, - 'ville' => 'Grand Annecy']); + ['id' => 1, + 'libelle' => 'Annecy', + 'id_lieu' => 11, + 'ville' => 'Grand Annecy']); $this->fixture(Class_Bib::class, - ['id' => 45, - 'libelle' => 'Cran', - 'id_lieu' => 145, - 'ville' => 'Grand Annecy']); + ['id' => 45, + 'libelle' => 'Cran', + 'id_lieu' => 145, + 'ville' => 'Grand Annecy']); $this->fixture(Class_Lieu::class, - ['id' => 11, - 'libelle' => 'Centre culturel', - 'ville' => 'Grand Annecy']); + ['id' => 11, + 'libelle' => 'Centre culturel', + 'ville' => 'Grand Annecy']); $this->fixture(Class_Lieu::class, - ['id' => 145, - 'libelle' => 'Mediatheque', - 'ville' => 'Grand Annecy']); + ['id' => 145, + 'libelle' => 'Mediatheque', + 'ville' => 'Grand Annecy']); $this->fixture(Class_Lieu::class, - ['id' => 146, - 'libelle' => 'Ludotheque', - 'ville' => 'Faverges']); + ['id' => 146, + 'libelle' => 'Ludotheque', + 'ville' => 'Faverges']); Class_Bib::newInstanceWithId(46, ['libelle' => 'Seythenex', - 'ville' => 'Faverges', + 'ville' => 'Faverges', 'id_lieu' => 146]) ->save(); } } - - - -class TemplatesWidgetRenderAllContainersTest extends TemplatesWidgetRenderAllTestCase { - - public function widgets() { +class TemplatesWidgetRenderAllContainersTest extends TemplatesWidgetRenderAllTestCase +{ + public function widgets() + { return [ [3, 'Boite menu principal'], [17, 'Boite de notices'], @@ -182,85 +177,84 @@ class TemplatesWidgetRenderAllContainersTest extends TemplatesWidgetRenderAllTes ]; } - /** * @dataProvider widgets + * + * @param mixed $widget_id + * @param mixed $content + * * @test */ - public function withWidgetShouldRenderWidgetTitleInMainH1($widget_id, $content) { + public function withWidgetShouldRenderWidgetTitleInMainH1($widget_id, $content) + { $this->dispatch('/opac/widget/render-all/profile_id/72/widget_id/' . $widget_id); $this->assertXPathContentContains('//main//div[@class="widget_all_content container-fluid"]//h1', $content); } - /** @test */ - public function unknowWidgetShouldRespond404() { + public function unknowWidgetShouldRespond404() + { $this->dispatch('/opac/widget/render-all/profile_id/72/widget_id/99'); $this->assertResponseCode(404); } } - - - -class TemplatesWidgetRenderAllAgendaTest extends TemplatesWidgetRenderAllTestCase { - - public function setUp(): void { +class TemplatesWidgetRenderAllAgendaTest extends TemplatesWidgetRenderAllTestCase +{ + public function setUp(): void + { parent::setUp(); Class_Profil::find(72) - ->setCfgAccueil(['modules' => - ['21' => ['division' => 3, - 'type_module' => 'CALENDAR', - 'preferences' => ['rss' => 1, + ->setCfgAccueil(['modules' => ['21' => ['division' => 3, + 'type_module' => 'CALENDAR', + 'preferences' => ['rss' => 1, 'enabled_filters' => 'place;place_town']]]]); $this->dispatch('/opac/widget/render-all/profile_id/72/widget_id/21'); } - /** @test */ - public function renderWidgetAgendaShouldDisplayRSSLink() { + public function renderWidgetAgendaShouldDisplayRSSLink() + { $this->assertXPath('//a[contains(@href, "/cms/calendarrss?id_module=21&id_profil=72")][contains(@class,"btn")][@type="application/rss+xml"][contains(@title,"Flux RSS de la boite")]'); } - /** @test */ - public function renderWidgetAgendaShouldContainsEditLinkForArticleVacance() { + public function renderWidgetAgendaShouldContainsEditLinkForArticleVacance() + { $this->assertXPathContentContains('//a[contains(@href, "/admin/cms/edit/id/78")]', 'Modifier'); } - /** @test */ - public function renderWidgetAgendaShouldContainsVersionLinkForArticleVacance() { + public function renderWidgetAgendaShouldContainsVersionLinkForArticleVacance() + { $this->assertXPathContentContains('//a[contains(@href, "/admin/cms/version/id/78")]', 'Historique'); } - /** @test */ - public function filterPlaceShouldBeDisplayed() { + public function filterPlaceShouldBeDisplayed() + { $this->assertXPathContentContains('//div[contains(@class, "filters")]//button[contains(@class, "button_Lieu")]', 'Lieu'); } - /** @test */ - public function filterTownShouldBeDisplayed() { + public function filterTownShouldBeDisplayed() + { $this->assertXPathContentContains('//div[contains(@class, "filters")]//button[contains(@class, "button_Ville")]', 'Ville'); } - /** @test */ - public function townGrandAnnecyShouldBeSelectable() { + public function townGrandAnnecyShouldBeSelectable() + { $this->assertXPathContentContains('//div[contains(@class, "filters")]//li//a[contains(@href, "/cms/render-all/id_module/21/place_town/Grand+Annecy")]', - 'Grand Annecy'); + 'Grand Annecy'); } } - - - -class TemplatesWidgetFilterTest extends TemplatesWidgetRenderAllTestCase { - - public function setUp(): void { +class TemplatesWidgetFilterTest extends TemplatesWidgetRenderAllTestCase +{ + public function setUp(): void + { parent::setUp(); $time_source = new TimeSourceForTest('2020-11-12 23:34:00'); @@ -268,58 +262,57 @@ class TemplatesWidgetFilterTest extends TemplatesWidgetRenderAllTestCase { Class_Calendar::setTimeSource($time_source); Class_Profil::find(1) - ->setCfgAccueil(['modules' => - ['51' => ['division' => 3, - 'type_module' => 'CALENDAR', - 'preferences' => ['enabled_filters' => 'place;place_town', - 'layout' => 'wall' + ->setCfgAccueil(['modules' => ['51' => ['division' => 3, + 'type_module' => 'CALENDAR', + 'preferences' => ['enabled_filters' => 'place;place_town', + 'layout' => 'wall', ]]]]); $ete = $this->fixture(Class_Article::class, - ['id' => 78, - 'titre' => 'L\'été', - 'contenu' => 'À la mer', - 'id_lieu' => 145]); + ['id' => 78, + 'titre' => 'L\'été', + 'contenu' => 'À la mer', + 'id_lieu' => 145]); Class_Article::getLoader() ->whenCalled('getArticlesByPreferences') - ->with(['place_town' => 'Grand Annecy', - 'display_order' => 'EventDebut', - 'id_categorie' => '', - 'events_only' => true, - 'event_date' => '2020-11', - 'id_bib' => [''], - 'id_lieu' => '', - 'custom_fields' => [], - 'published' => true, + ->with(['place_town' => 'Grand Annecy', + 'display_order' => 'EventDebut', + 'id_categorie' => '', + 'events_only' => true, + 'event_date' => '2020-11', + 'id_bib' => [''], + 'id_lieu' => '', + 'custom_fields' => [], + 'published' => true, 'event_end_after' => '2020-11-12']) ->answers([ $ete ]) ->whenCalled('getArticlesByPreferences') - ->with(['display_order' => 'EventDebut', - 'id_categorie' => '', - 'events_only' => true, - 'event_date' => '', - 'id_bib' => [''], - 'id_lieu' => '', - 'place_town' => 'Grand Annecy', - 'custom_fields' => [], - 'published' => true, + ->with(['display_order' => 'EventDebut', + 'id_categorie' => '', + 'events_only' => true, + 'event_date' => '', + 'id_bib' => [''], + 'id_lieu' => '', + 'place_town' => 'Grand Annecy', + 'custom_fields' => [], + 'published' => true, 'event_start_after' => '2020-11', - 'event_end_after' => '' + 'event_end_after' => '', ]) ->answers([ $ete ]) ->whenCalled('getArticlesByPreferences') - ->with(['place_town' => 'Grand Annecy', + ->with(['place_town' => 'Grand Annecy', 'display_order' => 'EventDebut', - 'id_categorie' => '', - 'events_only' => true, - 'event_date' => '2020-11', - 'id_bib' => [''], - 'id_lieu' => '', + 'id_categorie' => '', + 'events_only' => true, + 'event_date' => '2020-11', + 'id_bib' => [''], + 'id_lieu' => '', 'custom_fields' => [], - 'published' => true + 'published' => true, ]) ->answers([ $ete ]) @@ -328,30 +321,28 @@ class TemplatesWidgetFilterTest extends TemplatesWidgetRenderAllTestCase { $this->dispatch('/cms/calendar/id_profil/1/id_module/51/place_town/Grand+Annecy'); } - /** @test */ - public function eventLEteShouldBeDisplayedWithTownGrandAnnecySelected() { + public function eventLEteShouldBeDisplayedWithTownGrandAnnecySelected() + { $this->assertXPathContentContains('//div', 'L\'été'); } } - - - -class TemplatesWidgetRssTest extends TemplatesIntonationTestCase { - +class TemplatesWidgetRssTest extends TemplatesIntonationTestCase +{ protected $_response; protected $_record_id; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $rss = $this->fixture(Class_Rss::class, - ['id' => 30, - 'titre' => 'Veille partagée', - 'url' => 'http://veille-partagee.fr/c/205/f/3050/index.rss', - 'description' => 'Les nouveautés de l\'OPAC BOKEH', - 'tags' => 'test;bokeh;libre;git']); + ['id' => 30, + 'titre' => 'Veille partagée', + 'url' => 'http://veille-partagee.fr/c/205/f/3050/index.rss', + 'description' => 'Les nouveautés de l\'OPAC BOKEH', + 'tags' => 'test;bokeh;libre;git']); $rss->index(); $this->_record_id = $rss->getIdNotice(); @@ -373,84 +364,81 @@ class TemplatesWidgetRssTest extends TemplatesIntonationTestCase { ->whenCalled('unlink') ->answers(false)); - } - /** @test */ - public function rssNoticeajaxResourcesShouldRenderRenderItems() { + public function rssNoticeajaxResourcesShouldRenderRenderItems() + { $this->dispatch('/opac/noticeajax/resources/id/' . $this->_record_id); $this->assertContains('onload_utils', $this->_response->getBody()); } - /** @test */ - public function whenDescriptionContainsImageUrlRssRenderItemsShouldContainsImageLink() { + public function whenDescriptionContainsImageUrlRssRenderItemsShouldContainsImageLink() + { $this->dispatch('/opac/noticeajax/resources/id/' . $this->_record_id); $this->assertXPathContentContains('//div[@class="card-img-top text-center"]/img/@src', - 'https://veilles-partagees.org/wp-content/uploads/2020/04/Data-150x150.jpg'); + 'https://veilles-partagees.org/wp-content/uploads/2020/04/Data-150x150.jpg'); } - /** @test */ - public function rssNoticeajaxSSOResourcesShouldRenderNothing() { + public function rssNoticeajaxSSOResourcesShouldRenderNothing() + { $this->dispatch('/opac/noticeajax/sso-resources/id/' . $this->_record_id); $this->assertEquals('', $this->_response->getBody()); } - /** @test */ - public function rssNoticeajaxUrlResourcesShouldRenderRenderItems() { + public function rssNoticeajaxUrlResourcesShouldRenderRenderItems() + { $this->dispatch('/opac/noticeajax/url-resources/id/' . $this->_record_id); $this->assertContains('script', $this->_response->getBody()); } - /** @test */ - public function rssNoticeajaxBundleResourcesShouldRenderRenderItems() { + public function rssNoticeajaxBundleResourcesShouldRenderRenderItems() + { $this->dispatch('/opac/noticeajax/bundle-resources/id/' . $this->_record_id); $this->assertContains('script', $this->_response->getBody()); } - /** @test */ - public function newsletterWidgetShouldBePresent() { + public function newsletterWidgetShouldBePresent() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPathContentContains('//div', 'Boite RSS'); } - /** @test */ - public function inputTitreTypeShouldBeText() { + public function inputTitreTypeShouldBeText() + { $this->dispatch('/admin/widget/edit-widget/id/27/id_profil/72'); $this->assertXpath('//input[@name="titre"][@type="text"]'); } - /** @test */ - public function loadRssItemShouldRenderHtml() { + public function loadRssItemShouldRenderHtml() + { $this->dispatch('/opac/rss/render-items/id/30/id_profil/72'); $this->assertContains('onload_utils', $this->_response->getBody()); } - /** @test */ - public function whenDescriptionContainsImageUrlLoadRssItemShouldRenderHtml() { + public function whenDescriptionContainsImageUrlLoadRssItemShouldRenderHtml() + { $this->dispatch('/opac/rss/render-items/id/30/id_profil/72'); $this->assertXPathContentContains('//div[contains(@class,"card-img")]/img/@src', - 'https://veilles-partagees.org/wp-content/uploads/2020/04/Data-150x150.jpg'); + 'https://veilles-partagees.org/wp-content/uploads/2020/04/Data-150x150.jpg'); } } - - - -class TemplatesWidgetHiddenTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesWidgetHiddenTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); - $widget = (new Class_Systeme_Widget_Widget()) + $widget = (new Class_Systeme_Widget_Widget) ->setId(9) ->setProfileId(72) ->load(); @@ -462,107 +450,102 @@ class TemplatesWidgetHiddenTest extends TemplatesIntonationTestCase { $this->dispatch('/opac/index/index/id_profil/72'); } - /** @test */ - public function widgetLangueShouldNotBeVisible() { + public function widgetLangueShouldNotBeVisible() + { $this->assertNotXPath('//div[contains(@class, "langue")]'); } } - - - -class TemplatesWidgetSearchSettingsFormTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesWidgetSearchSettingsFormTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/admin/widget/edit-widget/id/8/id_profil/72'); } - /** @test */ - public function configurationShouldContainsFormDisplayMode() { + public function configurationShouldContainsFormDisplayMode() + { $this->assertXPath('//form//input[@type="radio"][@name="IntonationFormStyle"][@value="inline"][@checked]'); } } - - - -class TemplatesWidgetSearchInlineStyleTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesWidgetSearchInlineStyleTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); - $widget = ((new Class_Systeme_Widget_Widget) + $widget = (new Class_Systeme_Widget_Widget) ->setId(8) ->setProfileId(72) - ->load()); + ->load(); $widget - ->setNewDatas(['IntonationFormStyle' => 'inline', - 'select_bib' => 1, + ->setNewDatas(['IntonationFormStyle' => 'inline', + 'select_bib' => 1, 'library_selection_label' => 'Bibliothèques du réseau', ]) ->updateProfile(); $this->fixture(Class_Bib::class, - [ 'id' => 2, - 'libelle' => 'Lothlorien', - 'visibilite' => Class_Bib::V_DATA]); + [ 'id' => 2, + 'libelle' => 'Lothlorien', + 'visibilite' => Class_Bib::V_DATA]); $this->dispatch('/opac/index/index/id_profil/72'); } - /** @test */ - public function searchWidgetShouldBeWrappedIninlineForm() { + public function searchWidgetShouldBeWrappedIninlineForm() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//div[contains(@class, "form-row")]'); } - /** @test */ - public function searchButtonSubmitShouldHaveClassBtnSm() { + public function searchButtonSubmitShouldHaveClassBtnSm() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//div[contains(@class, "form-row")]//button[@type="submit"][contains(@class, "btn-sm")]'); } - /** @test */ - public function searchLabelForBibShoulNotBePresent() { + public function searchLabelForBibShoulNotBePresent() + { $this->assertNotXPath('//div[contains(@class,"boite rech_simple")]//form//label[contains(@for,"custom_multifacets_bib")]'); } - /** @test */ - public function searchOptionBibliothequeShouldDisplayFirstEntryBibliotheque() { + public function searchOptionBibliothequeShouldDisplayFirstEntryBibliotheque() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[@name="custom_multifacets_bib"]//option[1][@value="0"][@label="Bibliothèques du réseau"]'); } - /** @test */ - public function searchOptionBibliothequeShouldDisplaySecondEntryLothlorien() { + public function searchOptionBibliothequeShouldDisplaySecondEntryLothlorien() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[@name="custom_multifacets_bib"]//option[2][@value="B2"][@label="Lothlorien"]'); } - /** @test */ - public function advancedSearchButtonShouldHaveClassDropdownToggle() { + public function advancedSearchButtonShouldHaveClassDropdownToggle() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//div[@class="dropdown"]/button[contains(@class, "dropdown-toggle")]'); } - /** @test */ - public function formShouldHaveClassInlineForm() { + public function formShouldHaveClassInlineForm() + { $this->assertXPath('//div//form[@class="inline_form row no-gutters"]'); } - /** @test */ - public function expressionRechercheShouldBeInDivClassInlineForm() { + public function expressionRechercheShouldBeInDivClassInlineForm() + { $this->assertXPath('//div//form[@class="inline_form row no-gutters"]//div[@class="inline_form_fieldset renderinlineform_form col form-row align-items-center justify-content-center"]//input[@name="expressionRecherche"]'); } - /** @test */ public function pageShouldBeHTML5Valid() { @@ -570,58 +553,55 @@ class TemplatesWidgetSearchInlineStyleTest extends TemplatesIntonationTestCase { } } - - - -class TemplatesWidgetSearchToggleStyleTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesWidgetSearchToggleStyleTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); - $widget = ((new Class_Systeme_Widget_Widget) + $widget = (new Class_Systeme_Widget_Widget) ->setId(8) ->setProfileId(72) - ->load()); + ->load(); $widget ->setNewDatas(['IntonationFormStyle' => 'toggle', - 'select_annexe' => 1, - 'domains_ids' => '1-2']) + 'select_annexe' => 1, + 'domains_ids' => '1-2']) ->updateProfile(); $this->dispatch('/opac/index/index/id_profil/72'); } - /** @test */ - public function searchWidgetShouldBeWrappedToggleForm() { + public function searchWidgetShouldBeWrappedToggleForm() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//div[contains(@class, "dropdown-menu")]//form'); } - /** @test */ - public function searchButtonSubmitShouldHaveClassBtnSm() { + public function searchButtonSubmitShouldHaveClassBtnSm() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//div[contains(@class, "dropdown-menu")]//form//button[@type="submit"][contains(@class, "btn-sm")]'); } - /** @test */ - public function searchWidgetShouldContainsWrapperZendAfiFormHiddenTri() { + public function searchWidgetShouldContainsWrapperZendAfiFormHiddenTri() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//div[contains(@class, "wrapper_zendafi_form_tri")]//input[@name="tri"]'); } - /** @test */ - public function formShouldHaveClassDefaultForm() { + public function formShouldHaveClassDefaultForm() + { $this->assertXPath('//div//form[@class="form default_form row"]'); } - /** @test */ - public function expressionRechercheShouldBeInDivClassDefaultForm() { + public function expressionRechercheShouldBeInDivClassDefaultForm() + { $this->assertXPath('//div//form[@class="form default_form row"]//div[@class="default_form_group wrapper_zendafi_form_expressionrecherche wrapper_renderform_form_expressionrecherche default_form_wrapper_zendafi_form_expressionrecherche form-group container-fluid no-gutters py-1 order-4"]//input[@name="expressionRecherche"]'); } - /** @test */ public function pageShouldBeHTML5Valid() { @@ -629,122 +609,118 @@ class TemplatesWidgetSearchToggleStyleTest extends TemplatesIntonationTestCase { } } - - - -class TemplatesWidgetSearchDefaultStyleTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesWidgetSearchDefaultStyleTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); - $widget = ((new Class_Systeme_Widget_Widget) + $widget = (new Class_Systeme_Widget_Widget) ->setId(8) ->setProfileId(72) - ->load()); + ->load(); $widget - ->setNewDatas(['IntonationFormStyle' => '', - 'select_bib' => 1, - 'library_selection_label' => 'Bibliothèques du réseau', + ->setNewDatas(['IntonationFormStyle' => '', + 'select_bib' => 1, + 'library_selection_label' => 'Bibliothèques du réseau', 'doc_type_selection_label' => 'Typologie', - 'select_doc' => '5;2', - 'select_annexe' => 1, - 'domains_ids' => '1-2']) + 'select_doc' => '5;2', + 'select_annexe' => 1, + 'domains_ids' => '1-2']) ->updateProfile(); $this->fixture(Class_Bib::class, - [ 'id' => 2, - 'libelle' => 'Lothlorien', - 'visibilite' => Class_Bib::V_DATA]); + [ 'id' => 2, + 'libelle' => 'Lothlorien', + 'visibilite' => Class_Bib::V_DATA]); $this->fixture(Class_CodifAnnexe::class, - [ 'id' => 3, - 'libelle'=> 'Principal', - 'invisible' => 0]); + [ 'id' => 3, + 'libelle' => 'Principal', + 'invisible' => 0]); $this->fixture(Class_Notice::class, - ['id' => 42, - 'type_doc' => Class_TypeDoc::LIVRE]); + ['id' => 42, + 'type_doc' => Class_TypeDoc::LIVRE]); $this->fixture(Class_TypeDoc::class, - [ 'id' => Class_TypeDoc::LIVRE, - 'label'=> 'Livre']); + [ 'id' => Class_TypeDoc::LIVRE, + 'label'=> 'Livre']); Class_TypeDoc::setUsedIdsCache([Class_TypeDoc::LIVRE]); Class_Profil::getCurrentProfil()->setSelTypeDoc(Class_TypeDoc::LIVRE)->save(); - $this->dispatch('/opac/index/index/id_profil/72'); } - /** @test */ - public function searchWidgetShouldBeDefaultForm() { + public function searchWidgetShouldBeDefaultForm() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form'); } - /** @test */ - public function searchLabelForBibShoulDisplayBibliothequesDuReseau() { + public function searchLabelForBibShoulDisplayBibliothequesDuReseau() + { $this->assertXPathContentContains('//div[contains(@class,"boite rech_simple")]//form//label[contains(@for,"custom_multifacets_bib")]', 'Bibliothèques du réseau'); } - /** @test */ - public function searchOptionBibliothequeShouldDisplayToutes() { + public function searchOptionBibliothequeShouldDisplayToutes() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[@name="custom_multifacets_bib"]//option[1][@value="0"][@label="toutes"]'); } - /** @test */ - public function searchOptionBibliothequeShouldDisplayOptionLothlorien() { + public function searchOptionBibliothequeShouldDisplayOptionLothlorien() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[@name="custom_multifacets_bib"]//option[2][@value="B2"][@label="Lothlorien"]'); } - /** @test */ - public function searchLabelForAnnexeShouldDisplaySite() { + public function searchLabelForAnnexeShouldDisplaySite() + { $this->assertXPathContentContains('//div[contains(@class,"boite rech_simple")]//form//label[contains(@for,"custom_multifacets_annexe")]', 'Site'); } - /** @test */ - public function searchOptionForAnnexeShouldDisplayTous() { + public function searchOptionForAnnexeShouldDisplayTous() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[@name="custom_multifacets_annexe"]//option[1][@value="0"][@label="tous"]'); } - /** @test */ - public function searchLabelForTypedocShoulDisplayTypeDoc() { + public function searchLabelForTypedocShoulDisplayTypeDoc() + { $this->assertXPathContentContains('//div[contains(@class,"boite rech_simple")]//form//label[contains(@for,"custom_multifacets_doctype")]', 'Typologie'); } - /** @test */ - public function searchOptionTypeDocShoulDisplayTous() { + public function searchOptionTypeDocShoulDisplayTous() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[contains(@name,"custom_multifacets_doctype")]//option[1][@value="0"][@label="tous"]'); } - /** @test */ - public function searchOptionTypeDocShoulDisplayDocTypeLivre() { + public function searchOptionTypeDocShoulDisplayDocTypeLivre() + { $this->assertXPath('//div[contains(@class,"boite rech_simple")]//form//select[contains(@name,"custom_multifacets_doctype")]//option[2][@value="T1"][@label="Livre"]'); } - /** @test */ - public function formShouldHaveClassDefaultForm() { + public function formShouldHaveClassDefaultForm() + { $this->assertXPath('//div//form[@class="form default_form row"]'); } - /** @test */ - public function expressionRechercheShouldBeInDivClassDefaultForm() { + public function expressionRechercheShouldBeInDivClassDefaultForm() + { $this->assertXPath('//div//form[@class="form default_form row"]//div[@class="default_form_group wrapper_zendafi_form_expressionrecherche wrapper_renderform_form_expressionrecherche default_form_wrapper_zendafi_form_expressionrecherche form-group container-fluid no-gutters py-1 order-4"]//input[@name="expressionRecherche"]'); } - /** @test */ public function pageShouldBeHTML5Valid() { @@ -752,13 +728,11 @@ class TemplatesWidgetSearchDefaultStyleTest extends TemplatesIntonationTestCase } } - - - -class TemplatesImageWidgetTest extends TemplatesIntonationTestCase { - +class TemplatesImageWidgetTest extends TemplatesIntonationTestCase +{ /** @test */ - public function editImageWidgetShouldContainsImage() { + public function editImageWidgetShouldContainsImage() + { $this->dispatch('/admin/widget/edit-widget/id/13/id_profil/72'); $this->assertXpath('//input[@name="image"][@type="text"]'); $this->assertXpath('//input[@name="image_alt"][@type="text"]'); @@ -766,91 +740,83 @@ class TemplatesImageWidgetTest extends TemplatesIntonationTestCase { $this->assertXpath('//input[@name="link_title"][@type="text"]'); } - /** @test */ - public function editImageWidgetShouldContainsLink() { + public function editImageWidgetShouldContainsLink() + { $this->dispatch('/admin/widget/edit-widget/id/13/id_profil/72'); $this->assertXpath('//input[@name="link"][@type="url"]'); } - /** @test */ - public function dispatchFrontShouldContainsMaBanniereDotJpeg() { + public function dispatchFrontShouldContainsMaBanniereDotJpeg() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPath('//img[contains(@src, "ma-banniere.jpeg")][contains(@alt, "photo panoramique")]'); } - /** @test */ - public function dispatchFrontShouldContainsWwwwMaBanniereDotOrg() { + public function dispatchFrontShouldContainsWwwwMaBanniereDotOrg() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPath('//a[contains(@href, "www.ma-banniere.org")][contains(@title, "Accéder à www.ma-")]'); } } - - - -class TemplatesAdminToolsWidgetTest extends TemplatesIntonationTestCase { - +class TemplatesAdminToolsWidgetTest extends TemplatesIntonationTestCase +{ /** @test */ - public function editAdminWidgetShouldContainsTitre() { + public function editAdminWidgetShouldContainsTitre() + { $this->dispatch('/admin/widget/edit-widget/id/14/id_profil/72'); $this->assertXpath('//input[@name="titre"][@type="text"]'); } - /** @test */ - public function dispatchFrontShouldContainsAdminTools() { + public function dispatchFrontShouldContainsAdminTools() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPath('//a[contains(@onclick, "activate_css_editor")]'); } } - - - -class TemplatesCreditsWidgetTest extends TemplatesIntonationTestCase { - +class TemplatesCreditsWidgetTest extends TemplatesIntonationTestCase +{ /** @test */ - public function editCreditsWidgetShouldContainsTitre() { + public function editCreditsWidgetShouldContainsTitre() + { $this->dispatch('/admin/widget/edit-widget/id/15/id_profil/72'); $this->assertXpath('//input[@name="titre"][@type="text"]'); } - /** @test */ - public function dispatchFrontShouldContainsCredits() { + public function dispatchFrontShouldContainsCredits() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPathContentContains('//a', 'Propulsé par Bokeh'); } } - - - -class TemplatesScrollWidgetTest extends TemplatesIntonationTestCase { - +class TemplatesScrollWidgetTest extends TemplatesIntonationTestCase +{ /** @test */ - public function editScrollWidgetShouldContainsTop() { + public function editScrollWidgetShouldContainsTop() + { $this->dispatch('/admin/widget/edit-widget/id/16/id_profil/72'); $this->assertXpath('//input[@name="direction"][@type="radio"]'); } - /** @test */ - public function dispatchFrontShouldContainsScrollUp() { + public function dispatchFrontShouldContainsScrollUp() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPath('//button/i[contains(@class, "arrow-circle-up")]'); } } - - - -class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); $this->onLoaderOfModel(Class_Article::class) @@ -858,103 +824,101 @@ class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase { ->answers([]); $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Annecy']); + ['id' => 1, + 'libelle' => 'Annecy']); } - /** @test */ - public function editLibraryWidgetInputTitreTypeShouldBeText() { + public function editLibraryWidgetInputTitreTypeShouldBeText() + { $this->dispatch('/admin/widget/edit-widget/id/20/id_profil/72'); $this->assertXpath('//input[@name="titre"][@type="text"]'); } - /** @test */ - public function annecyLibraryShouldBePresent() { + public function annecyLibraryShouldBePresent() + { $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPath('//div[@id = "boite_20"]', 'Annecy'); } - /** @test */ - public function annecyOuverturesPageShouldRenderOpenings() { + public function annecyOuverturesPageShouldRenderOpenings() + { $this->dispatch('/opac/bib/ouvertures/id/1/id_profil/72'); $this->assertXPath('//div', 'Ouvertures'); } - /** @test */ - public function annecyInformationsShouldRenderInformations() { + public function annecyInformationsShouldRenderInformations() + { $this->dispatch('/opac/bib/informations/id/1/id_profil/72'); $this->assertXPath('//div', 'Informations'); } - /** @test */ - public function annecyCarteShouldRenderMap() { + public function annecyCarteShouldRenderMap() + { $this->dispatch('/opac/bib/carte/id/1/id_profil/72'); - $this->assertXPath('//div' ,'Carte'); + $this->assertXPath('//div', 'Carte'); } - /** @test */ - public function annecyLEquipeShouldRenderTeam() { + public function annecyLEquipeShouldRenderTeam() + { $this->fixture(Class_Users::class, - ['id' => 23, - 'nom' => 'Teprai', - 'login' => 'teprai', - 'password' => '123', - 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); + ['id' => 23, + 'nom' => 'Teprai', + 'login' => 'teprai', + 'password' => '123', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); $this->dispatch('/opac/bib/equipe/id/1/id_profil/72'); $this->assertXPath('//div', 'L\'équipe'); } - /** @test */ - public function annecyLAgendaShouldRenderAgenda() { + public function annecyLAgendaShouldRenderAgenda() + { $this->dispatch('/opac/bib/agenda/id/1/id_profil/72'); $this->assertXPath('//div', 'L\'agenda'); } - /** @test */ - public function annecyLAgendaShouldRenderButtonReset() { + public function annecyLAgendaShouldRenderButtonReset() + { $this->dispatch('/opac/bib/agenda/id/1/id_profil/72'); $this->assertXPathContentContains('//div//a[@href="/cms/calendar/id_module/21"][contains(@class, "filter_reset_button btn btn-warning")]', 'Réinitialiser'); } - /** @test */ - public function annecyCalendarShouldRenderAgenda() { + public function annecyCalendarShouldRenderAgenda() + { $this->dispatch('/opac/cms/calendar/id_module/library_1/id_profil/72'); $this->assertXPath('//div', 'L\'agenda'); } } - - - -class TemplatesDispatchLibraryAgendaWidgetTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesDispatchLibraryAgendaWidgetTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); $annecy = $this->fixture(Class_Bib::class, - ['id' => 1, - 'libelle' => 'Annecy']); + ['id' => 1, + 'libelle' => 'Annecy']); $this->fixture(Class_Lieu::class, - ['id' => 1, - 'libelle' => 'Annecy', - 'bibs' => [$annecy]]); + ['id' => 1, + 'libelle' => 'Annecy', + 'bibs' => [$annecy]]); $ete = $this->fixture(Class_Article::class, - ['id' => 78, - 'titre' => 'L\'été', - 'contenu' => 'À la mer', - 'id_lieu' => 1]); + ['id' => 78, + 'titre' => 'L\'été', + 'contenu' => 'À la mer', + 'id_lieu' => 1]); ZendAfi_View_Helper_Template_Wall::setTimeSource((new TimeSourceForTest('2022-06-06 10:10:00')) ->uniqidCallback(fn() => 'MyUn1qAndOnly')); @@ -966,30 +930,27 @@ class TemplatesDispatchLibraryAgendaWidgetTest extends TemplatesIntonationTestCa $this->dispatch('/opac/bib/agenda/id/1/id_profil/72'); } - - public function tearDown(): void { + public function tearDown(): void + { ZendAfi_View_Helper_Template_Wall::setTimeSource(null); parent::tearDown(); } - /** @test */ - public function annecyCalendarShouldContainsLete() { + public function annecyCalendarShouldContainsLete() + { $this->assertXPathContentContains('//div', 'L\'été'); } - /** @test */ - public function annecyCalendarShouldContainsDivClassMasonryWithIdMyUniqueAndOnly() { + public function annecyCalendarShouldContainsDivClassMasonryWithIdMyUniqueAndOnly() + { $this->assertXPath('//div[@class="masonry"][@id="MyUn1qAndOnly"]'); } } - - - -class TemplatesDispatchDomainWidgetTest extends TemplatesIntonationTestCase { - +class TemplatesDispatchDomainWidgetTest extends TemplatesIntonationTestCase +{ public function setUp(): void { parent::setUp(); @@ -997,203 +958,189 @@ class TemplatesDispatchDomainWidgetTest extends TemplatesIntonationTestCase { $this->dispatch('/admin/widget/edit-widget/id/24/id_profil/72'); } - /** @test */ - public function inputTitreTypeShouldBeText() { + public function inputTitreTypeShouldBeText() + { $this->assertXpath('//input[@name="titre"][@type="text"]'); } - /** @test */ - public function allLayoutShouldBePresent() { + public function allLayoutShouldBePresent() + { $this->assertXpath('//select[@name="all_layout"]'); } - /** @test */ - public function allRenderingShouldBePresent() { + public function allRenderingShouldBePresent() + { $this->assertXpath('//select[@name="all_rendering"]'); } } - - - -class TemplatesDispatchIntonationWithDomainWidgetTest extends TemplatesIntonationTestCase { - +class TemplatesDispatchIntonationWithDomainWidgetTest extends TemplatesIntonationTestCase +{ /** @test */ - public function facebookImageShouldBePresent() { + public function facebookImageShouldBePresent() + { $this->fixture(Class_Catalogue::class, - ['id' => 3, - 'libelle' => 'Jeunesse', - 'parent_id' => 0]); + ['id' => 3, + 'libelle' => 'Jeunesse', + 'parent_id' => 0]); $this->dispatch('/opac/index/index/id_profil/72'); $this->assertXPathContentContains('//div', 'Boite domaines'); } } - - - -class TemplatesDispatchAdminWidgetEditActionTest extends TemplatesIntonationTestCase { - +class TemplatesDispatchAdminWidgetEditActionTest extends TemplatesIntonationTestCase +{ /** @test */ - public function dispatchModuleShouldContainsExpectation() { + public function dispatchModuleShouldContainsExpectation() + { $this->dispatch('/opac/abonne/fiche/id_profil/72'); $this->assertXPath('//a[contains(@href, "/admin/widget/edit-action/id/abonne_fiche/id_profil/72")]'); } - /** @test */ - public function customCssClassesShouldBePresent() { + public function customCssClassesShouldBePresent() + { $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); $this->assertXPath('//input[@type="checkbox"][@value="ultra_light_widget"]'); } - /** @test */ - public function facetsOrderShouldBePresent() { + public function facetsOrderShouldBePresent() + { $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); $this->assertXPath('//input[@type="checkbox"][@name="facets_order"]'); } - /** @test */ - public function facetsClosedShouldBePresent() { + public function facetsClosedShouldBePresent() + { $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); $this->assertXPath('//input[@type="hidden"][@name="facets_closed_codes"]'); } - /** @test */ - public function radioDefaultRenderingShouldBePresent() { + public function radioDefaultRenderingShouldBePresent() + { $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); $this->assertXPath('//input[@type="radio"][@name="liste_format"][@value="2"][@checked]'); } - /** @test */ - public function customCssClassesShouldHaveBeenSaved() { + public function customCssClassesShouldHaveBeenSaved() + { $this->postDispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72', - ['boite' => 'ultra_light_widget', - 'facets_closed_codes' => 'ABC']); + ['boite' => 'ultra_light_widget', + 'facets_closed_codes' => 'ABC']); $this->assertContains('ultra_light_widget', - (new Class_Profil_Preferences())->getModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('recherche', - 'resultat', - 'simple')))); + (new Class_Profil_Preferences)->getModulePref(Class_Profil::find(72), + new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple'))); $this->assertContains('ABC', - (new Class_Profil_Preferences())->getModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('recherche', - 'resultat', - 'simple')))); + (new Class_Profil_Preferences)->getModulePref(Class_Profil::find(72), + new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple'))); } - /** @test */ - public function abonneFicheContentShouldHaveUltraLightWidgetClass() { - (new Class_Profil_Preferences())->setModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('abonne', - 'fiche')), - ['boite' => 'ultra_light_widget']); + public function abonneFicheContentShouldHaveUltraLightWidgetClass() + { + (new Class_Profil_Preferences)->setModulePref(Class_Profil::find(72), + new Class_Profil_ModuleDefinition('abonne', + 'fiche'), + ['boite' => 'ultra_light_widget']); $this->dispatch('/opac/abonne/fiche/id_profil/72'); $this->assertXPath('//div[contains(@class, "ultra_light_widget")][contains(@data-action, "abonne_fiche")]'); } } - - - -class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticeTest - extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticeTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); - (new Class_Profil_Preferences()) + (new Class_Profil_Preferences) ->setModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('recherche', - 'viewnotice1')), - ['thumbnail_fields' => '959-3;933-3']); + new Class_Profil_ModuleDefinition('recherche', + 'viewnotice1'), + ['thumbnail_fields' => '959-3;933-3']); $this->dispatch('/admin/widget/edit-action/id/recherche_viewnotice_1/id_profil/72'); } - /** @test */ - public function pageTitleShouldBeConfigartionDeLaPageDuDocumentDeTypeBook() { + public function pageTitleShouldBeConfigartionDeLaPageDuDocumentDeTypeBook() + { $this->assertXPathContentContains('//h1', 'Configuration de la page des documents de type livres'); } - /** @test */ - public function renameTabTextShouldBePresent() { + public function renameTabTextShouldBePresent() + { $this->assertXPath('//input[@type="text"][@id="IntonationLabelDocumentItems"]'); } - /** @test */ - public function changeTabIcoShouldBePresent() { + public function changeTabIcoShouldBePresent() + { $this->assertXPath('//input[@type="text"][@id="IntonationIcoDocumentItems"]'); } - /** @test */ - public function changeTabTitleShouldBePresent() { + public function changeTabTitleShouldBePresent() + { $this->assertXPath('//input[@type="text"][@id="IntonationTitleDocumentItems"]'); } - /** @test */ - public function multiInputsJsShouldBeLoaded() { + public function multiInputsJsShouldBeLoaded() + { $this->assertXPath('//script[contains(@src,"multi_inputs.js")]'); } - /** @test */ - public function multiInputThumbnailZonesValuesShouldBeDisplayed() { + public function multiInputThumbnailZonesValuesShouldBeDisplayed() + { $this->assertXPathContentContains('//script', - '"thumbnail_zone":["959","933"],"thumbnail_url":["3","3"]'); + '"thumbnail_zone":["959","933"],"thumbnail_url":["3","3"]'); } } - - - -class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticePerArticleTest - extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticePerArticleTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); - (new Class_Profil_Preferences()) + (new Class_Profil_Preferences) ->setModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('recherche', - 'viewnoticeper_art')), - ['xslt' => '/skins/soft/my.xsl']); + new Class_Profil_ModuleDefinition('recherche', + 'viewnoticeper_art'), + ['xslt' => '/skins/soft/my.xsl']); $this->dispatch('/admin/widget/edit-action/id/recherche_viewnotice_per_art/id_profil/72'); } - /** @test */ - public function inputXSLTShouldHaveValueSkinsSoftMyXSL() { + public function inputXSLTShouldHaveValueSkinsSoftMyXSL() + { $this->assertXPath('//input[@name="xslt"][@value="/skins/soft/my.xsl"]'); } - } - - - -class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticeActivationTest - extends TemplatesIntonationTestCase { - - public function checkboxInputNames() { +class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticeActivationTest extends TemplatesIntonationTestCase +{ + public function checkboxInputNames() + { return [ ['Intonation_Library_View_Wrapper_Record_RichContent_Home'], ['Intonation_Library_View_Wrapper_Record_RichContent_Items'], @@ -1201,304 +1148,282 @@ class TemplatesDispatchAdminWidgetEditActionRechercheViewNoticeActivationTest ['Intonation_Library_View_Wrapper_Record_RichContent_Media'], ['Intonation_Library_View_Wrapper_Record_RichContent_Reviews'], ['Intonation_Library_View_Wrapper_Record_RichContent_Related'], - ['Intonation_Library_View_Wrapper_Record_RichContent_Author'] + ['Intonation_Library_View_Wrapper_Record_RichContent_Author'], ]; } - - public function setInputValueAndDispatch(string $input_name, string $value) { - (new Class_Profil_Preferences()) + public function setInputValueAndDispatch(string $input_name, string $value) + { + (new Class_Profil_Preferences) ->setModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('recherche', - 'viewnotice1')), - [$input_name => $value]); + new Class_Profil_ModuleDefinition('recherche', + 'viewnotice1'), + [$input_name => $value]); $this->dispatch('/admin/widget/edit-action/id/recherche_viewnotice_1/id_profil/72'); } - /** * @dataProvider checkboxInputNames + * * @test */ - public function checkboxForDisabledInputNameShouldNotBeChecked(string $input_name) { + public function checkboxForDisabledInputNameShouldNotBeChecked(string $input_name) + { $this->setInputValueAndDispatch($input_name, '0'); $this->assertXPath('//input[@type="checkbox"][@name="' . $input_name . '"][@value="1"][not(@checked)]'); } - /** * @dataProvider checkboxInputNames + * * @test */ - public function checkboxForEnabledInputNameShouldBeChecked(string $input_name) { + public function checkboxForEnabledInputNameShouldBeChecked(string $input_name) + { $this->setInputValueAndDispatch($input_name, '1'); $this->assertXPath('//input[@type="checkbox"][@name="' . $input_name . '"][@value="1"][@checked="checked"]'); } } - - - -class TemplatesDispatchAdminWidgetActionRechercheViewNoticePostTest - extends TemplatesIntonationTestCase { - +class TemplatesDispatchAdminWidgetActionRechercheViewNoticePostTest extends TemplatesIntonationTestCase +{ protected $_prefs; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->postDispatch('/admin/widget/edit-action/id/recherche_viewnotice_1/id_profil/72', - [ - 'thumbnail_zone' => ['959', '933'], - 'thumbnail_url' => ['3', '4']]); + [ + 'thumbnail_zone' => ['959', '933'], + 'thumbnail_url' => ['3', '4']]); - $this->_prefs = (new Class_Profil_Preferences())->getModulePref(Class_Profil::find(72), - (new Class_Profil_ModuleDefinition('recherche', - 'viewnotice1'))); + $this->_prefs = (new Class_Profil_Preferences)->getModulePref(Class_Profil::find(72), + new Class_Profil_ModuleDefinition('recherche', + 'viewnotice1')); } - /** @test */ - public function preferencesThumbnailFieldsShouldContains959And933() { + public function preferencesThumbnailFieldsShouldContains959And933() + { $this->assertEquals('959-3;933-4', $this->_prefs['thumbnail_fields']); } - /** @test */ - public function shouldNotifySuccesfullSave() { + public function shouldNotifySuccesfullSave() + { $this->assertFlashMessengerContentContains('La configuration de "Configuration de la page des documents de type livres" a été sauvegardée'); } } +abstract class AbstractTemplatesWidgetWithHighlightLayoutTest extends AbstractControllerTestCase +{ + protected $_libraries = [36 => 'Annecy', + 37 => 'Cran-Gevrier', + 38 => 'Echallens', + 39 => 'Esertines sur Yverdon', + 40 => 'Montmin', + 41 => 'Seynod', + 42 => 'Talloires', + 43 => 'Valleiry']; - - -abstract class AbstractTemplatesWidgetWithHighlightLayoutTest extends AbstractControllerTestCase { - - protected - $_libraries = [36 => 'Annecy', - 37 => 'Cran-Gevrier', - 38 => 'Echallens', - 39 => 'Esertines sur Yverdon', - 40 => 'Montmin', - 41 => 'Seynod', - 42 => 'Talloires', - 43 => 'Valleiry']; - - public function setUp(): void { + public function setUp(): void + { parent::setUp(); Class_AdminVar::set('TEMPLATING', 1); $profile = $this->fixture('Class_Profil', - ['id' => 53, - 'titre' => 'Profil de test', - 'template' => 'CHILI' - ]); + ['id' => 53, + 'titre' => 'Profil de test', + 'template' => 'CHILI', + ]); - foreach($this->_libraries as $id => $libelle) { - $this->fixture('Class_Bib', ['id' => $id, 'libelle' => $libelle,]); + foreach ($this->_libraries as $id => $libelle) { + $this->fixture('Class_Bib', ['id' => $id, 'libelle' => $libelle]); } (new Class_Template_ProfilePatcher(null)) ->setProfile($profile) ->addWidget(Intonation_Library_Widget_Carousel_Library_Definition::CODE, - Class_Profil::DIV_MAIN, - $this->_widgetSettings()); + Class_Profil::DIV_MAIN, + $this->_widgetSettings()); $this->dispatch('/opac/index/index/id_profil/53'); } } - - - -class TemplatesWidgetWithLeftHighlightLayoutTest - extends AbstractTemplatesWidgetWithHighlightLayoutTest { - - protected function _widgetSettings() { - return ['rendering' => 'card', - 'libraries' => implode(';', array_keys($this->_libraries)), - 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, - 'layout' => 'left_highlight_carousel']; - } - - +class TemplatesWidgetWithLeftHighlightLayoutTest extends AbstractTemplatesWidgetWithHighlightLayoutTest +{ /** @test */ - public function libraryAnnecyShouldBeHighlighted() { + public function libraryAnnecyShouldBeHighlighted() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[@class="left_highlight_column col-12 col-md-4 col-lg-5 rounded"]//div[contains(@class, "card-img-overlay")]//div[contains(@class, "card-title")]', 'Annecy'); } - /** @test */ - public function libraryEsertinesSurYverdonShouldBeInCarouselFirstPage() { + public function libraryEsertinesSurYverdonShouldBeInCarouselFirstPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[contains(@class, "card-title")]', 'Esertines sur Yverdon'); } - /** @test */ - public function libraryCranGevrierShouldBeInCarouselFirstPage() { + public function libraryCranGevrierShouldBeInCarouselFirstPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[contains(@class, "card-title")]', 'Cran-Gevrier'); } - /** @test */ - public function libraryEchallensShouldBeInCarouselFirstPage() { - $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[@class="left_carousel_columns col-12 col-md-8 col-lg-7"]//div[contains(@class, "card-title")]', 'Echallens'); + public function libraryEchallensShouldBeInCarouselFirstPage() + { + $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[@class="left_carousel_columns col-12 col-md-8 col-lg-7"]//div[contains(@class, "card-title")]', 'Echallens', $this->_response->getBody()); } - /** @test */ - public function libraryMontminShouldBeHighlightedInCarouselSecondPage() { + public function libraryMontminShouldBeHighlightedInCarouselSecondPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[@class= "highlight_carousel_xl d-none d-xl-block"]//div[contains(@class, "carousel slide left_highlight_carousel")]//div[contains(@class, "carousel-item")][2]//div[contains(@class, "card-img-overlay")]//div[contains(@class, "card-title")]', 'Montmin'); } - /** @test */ - public function libraryAnnecyShouldBeInAMultipleCarousel() { + public function libraryAnnecyShouldBeInAMultipleCarousel() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[@class="highlight_carousel_md d-none d-md-block d-xl-none"]//div[contains(@class, "multiple_carousel")]//div[contains(@class, "card-title")]', 'Annecy'); } - /** @test */ - public function libraryAnnecyShouldBeInAOneColumnCarousel() { + public function libraryAnnecyShouldBeInAOneColumnCarousel() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[@class="highlight_carousel_sm d-md-none"]//div[@class = "carousel slide"]//div[contains(@class, "card-title")]', 'Annecy'); } -} - - - -class TemplatesWidgetWithTopHighlightLayoutTest - extends AbstractTemplatesWidgetWithHighlightLayoutTest { - - protected function _widgetSettings() { + protected function _widgetSettings() + { return ['rendering' => 'card', - 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, 'libraries' => implode(';', array_keys($this->_libraries)), - 'layout' => 'top_highlight_carousel']; + 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, + 'layout' => 'left_highlight_carousel']; } +} - +class TemplatesWidgetWithTopHighlightLayoutTest extends AbstractTemplatesWidgetWithHighlightLayoutTest +{ /** @test */ - public function libraryAnnecyShouldBeHighlighted() { + public function libraryAnnecyShouldBeHighlighted() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[@class="top_highlight_column col-12 rounded"]/div[@class="card_with_overlay card"]//div[@class="card_overlay card-block card-img-overlay rounded text-white"]//div[contains(@class, "card-title")]', 'Annecy'); } - /** @test */ - public function libraryEsertinesSurYverdonShouldBeInCarouselFirstPage() { + public function libraryEsertinesSurYverdonShouldBeInCarouselFirstPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[@class="top_carousel_columns col-12"]//div[contains(@class, "card-title")]', 'Esertines sur Yverdon'); } - /** @test */ - public function libraryCranGevrierShouldBeInCarouselFirstPage() { + public function libraryCranGevrierShouldBeInCarouselFirstPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[contains(@class, "card-title")]', 'Cran-Gevrier'); } - /** @test */ - public function libraryEchallensShouldBeInCarouselFirstPage() { + public function libraryEchallensShouldBeInCarouselFirstPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")]//div[contains(@class, "carousel-item")][1]//div[contains(@class, "card-title")]', 'Echallens'); } - /** @test */ - public function libraryTalloiresShouldBeHighlightedInCarouselSecondPage() { + public function libraryTalloiresShouldBeHighlightedInCarouselSecondPage() + { $this->assertXPathContentContains('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")]//div[contains(@class, "carousel-item")][2]//div[contains(@class, "card-img-overlay")]//div[contains(@class, "card-title")]', 'Talloires'); } -} - - + protected function _widgetSettings() + { + return ['rendering' => 'card', + 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, + 'libraries' => implode(';', array_keys($this->_libraries)), + 'layout' => 'top_highlight_carousel']; + } +} -abstract class TemplatesWidgetRenderChiliWallGridLayoutsTestCase - extends AbstractControllerTestCase { - +abstract class TemplatesWidgetRenderChiliWallGridLayoutsTestCase extends AbstractControllerTestCase +{ protected $_layout = ''; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); - $this->_buildTemplateProfil(['id' => 72, + $this->_buildTemplateProfil(['id' => 72, 'template' => 'CHILI']); (new Class_Template_ProfilePatcher(null)) ->setProfile(Class_Profil::find(72)) ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - ['layout' => $this->_layout]); + Class_Profil::DIV_MAIN, + ['layout' => $this->_layout]); - for ($i = 1 ; $i <= 20; $i++) - $this->fixture(Class_Notice::class, - ['id' => $i + 450, - 'titre_principal' => 'Rahan n°' . $i ]); + for ($i = 1; $i <= 20; ++$i) + $this->fixture(Class_Notice::class, + ['id' => $i + 450, + 'titre_principal' => 'Rahan n°' . $i ]); $this->dispatch('/opac/index/index/id_profil/72'); } } - - - -class TemplatesWidgetRenderGridLayoutTest - extends TemplatesWidgetRenderChiliWallGridLayoutsTestCase { - +class TemplatesWidgetRenderGridLayoutTest extends TemplatesWidgetRenderChiliWallGridLayoutsTestCase +{ protected $_layout = 'grid'; /** @test */ - public function divClassWallGridLgShouldContainsRahan() { + public function divClassWallGridLgShouldContainsRahan() + { $this->assertXPathContentContains('//div[@class="wall_grid_lg d-none d-lg-block"]//div[@class = "masonry masonry_grid"]', 'Rahan'); } - /** @test */ - public function divClassWallGridMdShouldContainsRahan() { + public function divClassWallGridMdShouldContainsRahan() + { $this->assertXPathContentContains('//div[@class="wall_grid_md d-lg-none"]//div[@class="carousel slide multiple_carousel"]', 'Rahan'); } - /** @test */ - public function wallGridMdShouldContainsCardDeckThreeColumns() { + public function wallGridMdShouldContainsCardDeckThreeColumns() + { $this->assertXPathCount('//div[@class="wall_grid_md d-lg-none"]//div[@class="carousel slide multiple_carousel"]//div[@class="carousel-item active"]//div[@class="card-deck"]/div[@class="card_with_overlay card"]', - 3); + 3); } - /** @test */ - public function wallGridSmShouldContainsCarouselSlideWithOnlyOneColumn() { + public function wallGridSmShouldContainsCarouselSlideWithOnlyOneColumn() + { $this->assertXPathCount('//div[@class="wall_grid_md d-lg-none"]//div[@class="carousel slide"]//div[@class="carousel-item active"]/div[@class="card_with_overlay card"]', - 1); + 1); } } - - - -class TemplatesWidgetRenderWallLayoutTest - extends TemplatesWidgetRenderChiliWallGridLayoutsTestCase { - +class TemplatesWidgetRenderWallLayoutTest extends TemplatesWidgetRenderChiliWallGridLayoutsTestCase +{ protected $_layout = 'wall'; /** @test */ - public function divClassWallGridLgShouldContainsRahan() { + public function divClassWallGridLgShouldContainsRahan() + { $this->assertXPathContentContains('//div[@class="wall_grid_lg d-none d-lg-block"]//div[@class = "masonry"]', 'Rahan'); } - /** @test */ - public function divClassWallGridMdShouldContainsRahan() { + public function divClassWallGridMdShouldContainsRahan() + { $this->assertXPathContentContains('//div[@class="wall_grid_md d-lg-none"]//div[@class="carousel slide multiple_carousel"]', 'Rahan'); } } - - - -class TemplatesWidgetWithPaginatedListTest extends AbstractControllerTestCase { - +class TemplatesWidgetWithPaginatedListTest extends AbstractControllerTestCase +{ public $view; public function setUp(): void @@ -1507,30 +1432,30 @@ class TemplatesWidgetWithPaginatedListTest extends AbstractControllerTestCase { Storm_Cache::beVolatile(); - $profile = $this->_buildTemplateProfil(['id' => 2890, + $profile = $this->_buildTemplateProfil(['id' => 2890, 'template' => 'MUSCLE']); $params = ['rendering' => 'card', - 'order' => Class_CriteresRecherche::SORT_RANDOM, - 'layout' => Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS]; + 'order' => Class_CriteresRecherche::SORT_RANDOM, + 'layout' => Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS]; (new Class_Template_ProfilePatcher(null)) ->setProfile($profile) ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - $params); + Class_Profil::DIV_MAIN, + $params); - $widget = (new Class_Systeme_Widget_Widget()) + $widget = (new Class_Systeme_Widget_Widget) ->setId(1) ->setProfileId(2890) ->load(); $records = []; - for ( $i = 1 ; $i < 21 ; $i ++) - $records [] = $this->fixture('Class_Notice', - ['id' => $i, - ]); + for ($i = 1; $i < 21; ++$i) + $records[] = $this->fixture('Class_Notice', + ['id' => $i, + ]); $records = array_map(fn($record) => (new Intonation_Library_View_Wrapper_Record) ->setModel($record) @@ -1550,82 +1475,80 @@ class TemplatesWidgetWithPaginatedListTest extends AbstractControllerTestCase { $this->dispatch('/opac/index/ajax-paginated-list/id/' . $id . '/order/RAND()'); } - /** @test */ - public function withOrderRandomShouldContainsOrderRandomSelected() { + public function withOrderRandomShouldContainsOrderRandomSelected() + { $this->assertXPath('//select[@name="order"][contains(@class, "ajaxify_form zendafi_form_ajaxify_form renderinlineform_form_order")][contains(@class,"form-control form-control-sm custom-select custom-select-sm")]//option[@value = "RAND()"][@selected]'); } - /** @test */ - public function previousButtonShouldHaveDataDisabled() { + public function previousButtonShouldHaveDataDisabled() + { $this->assertXPath('//a[contains(@class, "btn btn-sm btn-secondary ajax_anchor previous_ajax_anchor")][@data-disabled]'); } - /** @test */ - public function nextButtonShouldNotHaveDataDisabled() { + public function nextButtonShouldNotHaveDataDisabled() + { $this->assertXPath('//a[@class="btn btn-sm btn-secondary ajax_anchor next_ajax_anchor text-light"][not(@data-disabled)][@data-page="2"]'); } - /** @test */ - public function truncateListSizeShouldBe20Elements() { + public function truncateListSizeShouldBe20Elements() + { $this->assertXPathContentContains('//div[@class="truncate_list_size_wrapper col-12 col-sm-3"]//span[@class="truncate_list_size btn btn-sm btn-info"]', - Class_CharSet::fromISOtoUTF8('20 éléments')); + Class_CharSet::fromISOtoUTF8('20 éléments')); } } - - - -abstract class TemplatesWidgetCarouselWithDomainTestCase extends AbstractControllerTestCase { - +abstract class TemplatesWidgetCarouselWithDomainTestCase extends AbstractControllerTestCase +{ protected $_record; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); - $profile = $this->_buildTemplateProfil(['id' => 2890, + $profile = $this->_buildTemplateProfil(['id' => 2890, 'template' => 'MUSCLE']); - $params = ['rendering' => 'card', + $params = ['rendering' => 'card', 'id_catalogue' => 3, - 'order' => Class_CriteresRecherche::SORT_TITLE_ASC, - 'layout' => Intonation_Library_Widget_Carousel_Definition::GRID]; + 'order' => Class_CriteresRecherche::SORT_TITLE_ASC, + 'layout' => Intonation_Library_Widget_Carousel_Definition::GRID]; (new Class_Template_ProfilePatcher(null)) ->setProfile($profile) ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - $params); + Class_Profil::DIV_MAIN, + $params); $this->_record = $this->fixture(Class_Notice::class, - ['id' => 4, - 'titre_principal' => 'Le Montespan', - 'auteur_principal' => 'Jean Teul', - 'clef_alpha' => 'MONTESPAN']); + ['id' => 4, + 'titre_principal' => 'Le Montespan', + 'auteur_principal' => 'Jean Teul', + 'clef_alpha' => 'MONTESPAN']); $domain = $this->fixture(Class_Catalogue::class, - ['id' => 3, - 'libelle' => 'art']) + ['id' => 3, + 'libelle' => 'art']) ->setIndexer(true); $selection = $this->fixture(Class_PanierNotice::class, - ['id' => 2, - 'id_panier' => 2, - 'libelle' => 'Mes BD', - 'date_maj' => '10/02/2011', - 'notices' => 'MONTESPAN', - 'user' => Class_Users::getIdentity()]) + ['id' => 2, + 'id_panier' => 2, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011', + 'notices' => 'MONTESPAN', + 'user' => Class_Users::getIdentity()]) ->setCatalogues([$domain]); Zend_Registry::set('sql', - $this->mock() - ->whenCalled('query') - ->with('update notices set facettes = clean_spaces(REGEXP_REPLACE(facettes, "\\\\bHCCCC0001\\\\b", "")) where type_doc not in (8, 9, 10) and type = 1 and match(facettes) against("+HCCCC0001" in boolean mode)') - ->answers(0) - ->beStrict()); + $this->mock() + ->whenCalled('query') + ->with('update notices set facettes = clean_spaces(REGEXP_REPLACE(facettes, "\\\bHCCCC0001\\\b", "")) where type_doc not in (8, 9, 10) and type = 1 and match(facettes) against("+HCCCC0001" in boolean mode)') + ->answers(0) + ->beStrict()); $domain->setPanierNotices([$selection]); $domain->assertSave(); @@ -1633,207 +1556,199 @@ abstract class TemplatesWidgetCarouselWithDomainTestCase extends AbstractControl } } - - - -class TemplatesWidgetCarouselWithDomainTest extends TemplatesWidgetCarouselWithDomainTestCase { - +class TemplatesWidgetCarouselWithDomainTest extends TemplatesWidgetCarouselWithDomainTestCase +{ protected array $_storm_scopes = ['Class_MoteurRecherche->lancerRecherche']; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); $this->dispatch('/index'); } - /** @test */ - public function recordLeMontespanShouldBeDisplay() { + public function recordLeMontespanShouldBeDisplay() + { $this->assertXPathContentContains('//div', 'Le Montespan'); } - /** @test */ - public function fetchAllShouldBeCalledWithQ3FacetLimit9() { + public function fetchAllShouldBeCalledWithQ3FacetLimit9() + { $this->assertSql("SELECT `notices`.`id_notice`, `notices`.`facettes` FROM `notices` WHERE (MATCH(`notices`.`titres`, `notices`.`auteurs`, `notices`.`editeur`, `notices`.`collection`, `notices`.`matieres`, `notices`.`dewey`, `notices`.`other_terms`, `notices`.`facets`) AGAINST('+F_Q3' IN BOOLEAN MODE) AND `notices`.`type` = 1) ORDER BY `notices`.`url_image` = 'no' ASC, `notices`.`url_image` = '' ASC, `notices`.`alpha_titre` ASC LIMIT 9"); } - /** @test */ - public function recordLeMontespanShouldHaveBeenIndexedWithFacetQ3() { + public function recordLeMontespanShouldHaveBeenIndexedWithFacetQ3() + { $this->assertContains('Q3', Class_Notice::find(4)->getFacettes()); } } - - - -class TemplatesWidgetCarouselWithDomainFindByIdsTest - extends TemplatesWidgetCarouselWithDomainTestCase { - +class TemplatesWidgetCarouselWithDomainFindByIdsTest extends TemplatesWidgetCarouselWithDomainTestCase +{ protected array $_storm_scopes = ['Class_MoteurRecherche->lancerRecherche']; - public function setUp(): void { + public function setUp(): void + { parent::setUp(); - $params = ['rendering' => 'card', - 'size' => null, + $params = ['rendering' => 'card', + 'size' => null, 'id_catalogue' => 3, - 'order' => Class_CriteresRecherche::SORT_RANDOM, - 'layout' => Intonation_Library_Widget_Carousel_Definition::GRID]; + 'order' => Class_CriteresRecherche::SORT_RANDOM, + 'layout' => Intonation_Library_Widget_Carousel_Definition::GRID]; (new Class_Template_ProfilePatcher(null)) ->setProfile(Class_Profil::find(2890)) ->removeWidgets() ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - $params); + Class_Profil::DIV_MAIN, + $params); $this->dispatch('/index'); } - /** @test */ - public function fetchAllShouldBeCalledWithQ3FacetLimit100() { + public function fetchAllShouldBeCalledWithQ3FacetLimit100() + { $this->assertSql("SELECT `notices`.`id_notice`, `notices`.`facettes` FROM `notices` WHERE (MATCH(`notices`.`titres`, `notices`.`auteurs`, `notices`.`editeur`, `notices`.`collection`, `notices`.`matieres`, `notices`.`dewey`, `notices`.`other_terms`, `notices`.`facets`) AGAINST('+F_Q3' IN BOOLEAN MODE) AND `notices`.`type` = 1) ORDER BY `notices`.`url_image` = 'no' ASC, `notices`.`url_image` = '' ASC LIMIT 100"); } } +class TemplatesWidgetWithTopHighlightLayoutAndCycleTest extends AbstractTemplatesWidgetWithHighlightLayoutTest +{ + /** @test */ + public function carouselDataIntervalShouldBeTwoSecond() + { + $this->assertXPath('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")][@data-interval="2000"]'); + } - - -class TemplatesWidgetWithTopHighlightLayoutAndCycleTest - extends AbstractTemplatesWidgetWithHighlightLayoutTest { - - protected function _widgetSettings() { + protected function _widgetSettings() + { return ['rendering' => 'card', - 'cycle' => 2, - 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, + 'cycle' => 2, + 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, 'libraries' => implode(';', array_keys($this->_libraries)), - 'layout' => 'top_highlight_carousel']; - } - - - /** @test */ - public function carouselDataIntervalShouldBeTwoSecond() { - $this->assertXPath('//div[contains(@class, "boite library")]//div[contains(@class, "carousel slide top_highlight_carousel")][@data-interval="2000"]'); + 'layout' => 'top_highlight_carousel']; } } - - - -class TemplatesWidgetEditUnknownWidgetTest extends TemplatesIntonationTestCase { - - public function setUp(): void { +class TemplatesWidgetEditUnknownWidgetTest extends TemplatesIntonationTestCase +{ + public function setUp(): void + { parent::setUp(); $this->dispatch('/admin/widget/edit-widget/id/2478978973284729/id_profil/72'); } - /** @test */ - public function shouldReturnErrorMessage() { + public function shouldReturnErrorMessage() + { $this->assertFlashMessengerContentContains('Impossible de configurer l\'élément'); } } - - - -class TemplatesWidgetWithTopHighlightLayoutLogoTitleAndScrollAnchorIdTest - extends AbstractTemplatesWidgetWithHighlightLayoutTest { - - protected function _widgetSettings() { - return ['rendering' => 'card', - 'title_picto' => 'class fas fa-home', - 'scroll_anchor_id' => 'ma_super_boite', - 'cycle' => 2, - 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, - 'libraries' => implode(';', array_keys($this->_libraries)), - 'layout' => 'top_highlight_carousel']; - } - - +class TemplatesWidgetWithTopHighlightLayoutLogoTitleAndScrollAnchorIdTest extends AbstractTemplatesWidgetWithHighlightLayoutTest +{ /** @test */ - public function boiteLibraryTitleShouldContainsIClassFasFaHome() { + public function boiteLibraryTitleShouldContainsIClassFasFaHome() + { $this->assertXPathContentContains('//div[@class="boite library widget col-12 card"]//div[@class="widget-header card-header"]//i[@class="fas fa-home"]/following-sibling::div[@class="title_sibling_picto d-inline-block"]', - 'Boite des bibliothèques'); + 'Boite des bibliothèques'); } - /** @test */ - public function boiteLibraryShouldContainsAnchorMaSuperBoite() { + public function boiteLibraryShouldContainsAnchorMaSuperBoite() + { $this->assertXPathContentContains('//div[@class="boite library widget col-12 card"]/div[@id="ma_super_boite"][@class="scroll_anchor sr-only"][1]/span[@class="sr-only"]', - 'Ancrage pour faire défiler la page ici.'); + 'Ancrage pour faire défiler la page ici.'); } -} - - + protected function _widgetSettings() + { + return ['rendering' => 'card', + 'title_picto' => 'class fas fa-home', + 'scroll_anchor_id' => 'ma_super_boite', + 'cycle' => 2, + 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, + 'libraries' => implode(';', array_keys($this->_libraries)), + 'layout' => 'top_highlight_carousel']; + } +} -class TemplatesWidgetHideModeTest extends AbstractControllerTestCase { - - public function paramsToCss() : array { +class TemplatesWidgetHideModeTest extends AbstractControllerTestCase +{ + public function paramsToCss(): array + { return [['', ''], [null, ''], ['sm', 'd-none d-sm-block'], [[], 'd-none'], [[''], 'd-sm-none d-md-none d-lg-none d-xl-none'], - [['','sm', 'md', 'lg', 'xl'] , ''], - [['', 'md', 'lg'] , 'd-md-block d-lg-block d-sm-none d-xl-none'], - [['xl'] , 'd-xl-block d-none d-sm-none d-md-none d-lg-none']]; + [['', 'sm', 'md', 'lg', 'xl'], ''], + [['', 'md', 'lg'], 'd-md-block d-lg-block d-sm-none d-xl-none'], + [['xl'], 'd-xl-block d-none d-sm-none d-md-none d-lg-none']]; } - /** * @test + * * @dataProvider paramsToCss + * + * @param mixed $hide_params + * @param mixed $classes */ - public function withWidgetParamsCssShouldBeHasExpected($hide_params, $classes) { - $profile = $this->_buildTemplateProfil(['id' => 1, + public function withWidgetParamsCssShouldBeHasExpected($hide_params, $classes) + { + $profile = $this->_buildTemplateProfil(['id' => 1, 'template' => 'MUSCLE']); $profile_patcher = (new Class_Template_ProfilePatcher(null)) ->setProfile($profile); $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - ['MuscleHiddenMode' => $hide_params]); + Class_Profil::DIV_MAIN, + ['MuscleHiddenMode' => $hide_params]); $this->dispatch('/widget/render/widget_id/1/profile_id/1/'); $this->assertXPath('//div[@id="boite_1"][@class="boite kiosque widget col' - . ($classes ? ' ' . $classes : '') . ' card"]'); + . ($classes ? ' ' . $classes : '') . ' card"]'); } } - - - -class TemplatesWidgetHideModeAdminTest extends AbstractControllerTestCase { - - public function paramsToFormValues() : array { +class TemplatesWidgetHideModeAdminTest extends AbstractControllerTestCase +{ + public function paramsToFormValues(): array + { return - [['', ['','sm', 'md', 'lg', 'xl'], []], - [null, ['','sm', 'md', 'lg', 'xl'], []], + [['', ['', 'sm', 'md', 'lg', 'xl'], []], + [null, ['', 'sm', 'md', 'lg', 'xl'], []], ['sm', ['sm'], ['', 'md', 'lg', 'xl']], - [[], [], ['','sm', 'md', 'lg', 'xl']], + [[], [], ['', 'sm', 'md', 'lg', 'xl']], [[''], [''], ['sm', 'md', 'lg', 'xl']], - [['','sm', 'md', 'lg', 'xl'], ['','sm', 'md', 'lg', 'xl'], []], - [['', 'md', 'lg'] , ['','md', 'lg'], ['sm', 'xl']], - [['xl'] , ['xl'], ['','sm', 'md', 'lg']]]; + [['', 'sm', 'md', 'lg', 'xl'], ['', 'sm', 'md', 'lg', 'xl'], []], + [['', 'md', 'lg'], ['', 'md', 'lg'], ['sm', 'xl']], + [['xl'], ['xl'], ['', 'sm', 'md', 'lg']]]; } - /** * @test + * * @dataProvider paramsToFormValues + * + * @param mixed $hide_params + * @param mixed $checked_values + * @param mixed $unchecked_values */ public function withWidgetParamsCheckboxShouldBeChecked($hide_params, - $checked_values, - $unchecked_values) { - $profile = $this->_buildTemplateProfil(['id' => 1, + $checked_values, + $unchecked_values) + { + $profile = $this->_buildTemplateProfil(['id' => 1, 'template' => 'MUSCLE']); $profile_patcher = (new Class_Template_ProfilePatcher(null)) @@ -1841,14 +1756,14 @@ class TemplatesWidgetHideModeAdminTest extends AbstractControllerTestCase { $profile_patcher ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE, - Class_Profil::DIV_MAIN, - ['MuscleHiddenMode' => $hide_params]); + Class_Profil::DIV_MAIN, + ['MuscleHiddenMode' => $hide_params]); $this->dispatch('/admin/widget/edit-widget/id/1/id_profil/1'); - foreach($checked_values as $value) - $this->assertXPath('//form//input[@value="'.$value.'"][@checked]'); + foreach ($checked_values as $value) + $this->assertXPath('//form//input[@value="' . $value . '"][@checked]'); - foreach($unchecked_values as $value) - $this->assertXPath('//form//input[@value="'.$value.'"][not(@checked)]'); + foreach ($unchecked_values as $value) + $this->assertXPath('//form//input[@value="' . $value . '"][not(@checked)]'); } }