Commit 06194bfb authored by efalcy's avatar efalcy

hotline #110044 : optimize display with profil cache information and records

parent 9802b6f4
Pipeline #10042 failed with stage
in 19 minutes and 19 seconds
- ticket #110044 : Magasin de themes : Optimisation de l'affichage du resultat de recherche
\ No newline at end of file
......@@ -205,6 +205,9 @@ class Class_Profil extends Storm_Model_Abstract {
protected
$_cfg_site_array_cache,
$_cfg_modules_array_cache,
$_cfg_notice_array_cache,
$_cfg_menus_array_cache,
$_default_values_cache = [],
$_default_cfg_menus_cache,
$_default_cfg_notice_cache,
......@@ -1044,7 +1047,9 @@ class Class_Profil extends Storm_Model_Abstract {
* @return array
*/
public function getCfgMenusAsArray() {
return $this->_getCfgAsArrayNamed('Menus');
return $this->_cfg_menus_array_cache
? $this->_cfg_menus_array_cache
: ($this->_cfg_menus_array_cache = $this->_getCfgAsArrayNamed('Menus'));
}
......@@ -1073,7 +1078,9 @@ class Class_Profil extends Storm_Model_Abstract {
* @return array
*/
public function getCfgAccueilAsArray() {
return $this->_getCfgAsArrayNamed('Accueil');
return $this->_cfg_accueil_array_cache
? $this->_cfg_accueil_array_cache
: ($this->_cfg_accueil_array_cache = $this->_getCfgAsArrayNamed('Accueil'));
}
......@@ -1081,13 +1088,15 @@ class Class_Profil extends Storm_Model_Abstract {
* @return array
*/
public function getCfgNoticeAsArray() {
if ($this->_cfg_notice_array_cache)
return $this->_cfg_notice_array_cache;
$cfg = $this->_getCfgAsArrayNamed('Notice');
$module = new Class_Systeme_ModulesNotice();
$cfg['exemplaires'] = array_merge($module->getValeursParDefaut('exemplaires'),
$cfg['exemplaires'] ? $cfg['exemplaires'] : []);
return $cfg;
return $this->_cfg_notice_array_cache = $cfg;
}
......@@ -1095,7 +1104,9 @@ class Class_Profil extends Storm_Model_Abstract {
* @return array
*/
public function getCfgModulesAsArray() {
return $this->_getCfgAsArrayNamed('Modules');
return $this->_cfg_modules_array_cache
? $this->_cfg_modules_array_cache
: ($this->_cfg_modules_array_cache = $this->_getCfgAsArrayNamed('Modules'));
}
......@@ -2478,6 +2489,9 @@ class Class_Profil extends Storm_Model_Abstract {
$this->_default_cfg_accueil_cache = [];
$this->_raw_cfg_cache = [];
$this->_loaded_modules_cache = [];
$this->_cfg_modules_array_cache = null;
$this->_cfg_notice_array_cache = null;
$this->_cfg_menus_array_cache = null;
return $this;
}
}
......@@ -24,10 +24,15 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
protected
$_selectable_action = false,
$_main_title,
$_description,
$_badges,
$_allow_XSL = false;
public function getMainTitle() {
return $this->_model->getTitrePrincipal(' ') . $this->_model->getSubtitle();
return $this->_main_title ?
$this->_main_title :
($this->_main_title = $this->_model->getTitrePrincipal(' ') . $this->_model->getSubtitle());
}
......@@ -82,6 +87,10 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
public function getDescription() {
if ($this->_description)
return $this->_description;
$xsl = (new Class_Notice_Xsl($this->_model, Class_Profil::getCurrentProfil()))
->beSearchResult();
......@@ -89,7 +98,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
? $this->_view->Notice_Xsl($xsl)
: $this->_view->truncate($this->_model->getResume());
return $this->getBadges() . $description;
return ($this->_description = $this->getBadges() . $description);
}
......@@ -129,6 +138,8 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
public function getBadges() {
if ($this->_badges)
return $this->_badges;
$badges = [((new Intonation_Library_Badge)
->setTag('div')
->setClass(' pb-1 mb-1 px-0 card-title only_visible_in_viewnotice')
......@@ -200,7 +211,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$badges = $this->_addSerieBadges($badges);
return $this->_view->renderBadges($badges);
return $this->_badges = $this->_view->renderBadges($badges);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment