Skip to content
Snippets Groups Projects
Commit 5c00d014 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Header image now retreived via Profile skin

parent f10a976b
Branches
Tags
2 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!7Multiple Skin Dirs
......@@ -563,14 +563,21 @@ class Class_Profil extends Storm_Model_Abstract {
* @return string
*/
public function getHeaderImg() {
$path = $this->_get('header_img');
if (!$path) {
if (file_exists(PATH_SKIN.'/images/site/banniere.png'))
$path = URL_IMG.'site/banniere.png';
else
$path = URL_IMG.'site/banniere.jpg';
}
return $path;
if ($path = $this->_get('header_img'))
return $path;
return $this->getSkinHeaderImg();
}
public function getSkinHeaderImg() {
$skin = $this->_getSkin();
if ($skin->imageExists('site/banniere.png'))
return $skin->getImageUrl('site/banniere.png');
if ($skin->imageExists('site/banniere.jpg'))
return $skin->getImageUrl('site/banniere.jpg');
return '';
}
......
......@@ -25,30 +25,31 @@ class ZendAfi_View_Helper_TagBanniere extends Zend_View_Helper_HtmlElement {
Class_ScriptLoader::getInstance()
->addScript(URL_JAVA . 'diaporama/jquery.cycle.all.min')
->addJQueryReady(sprintf('$("#banniere a.home").cycle(%s)',
json_encode(array('fx' => 'fade',
'width' => $this->_profil->getLargeurSite(),
'height' => $this->_profil->getHauteurBanniere()))));
json_encode(['fx' => 'fade',
'width' => $this->_profil->getLargeurSite(),
'height' => $this->_profil->getHauteurBanniere()])));
}
return sprintf('<div id="banniere">%s<a class="home" href="%s" style="display:block">%s</a></div>',
$this->_getLogos(),
BASE_URL,
$this->view->url([], null, true),
$this->_getImages());
}
protected function _getLogos() {
return $this->_getLogo('gauche').$this->_getLogo('droite');
return $this->_getLogo('gauche') . $this->_getLogo('droite');
}
protected function _getLogo($position) {
if ($this->_profil->_has('logo_'.$position.'_img'))
return sprintf("<div class='logo_%s'><a href='%s'><img src='%s' alt=''/></a></div>",
$position,
$this->_profil->_get('logo_'.$position.'_link'),
$this->_profil->_get('logo_'.$position.'_img'));
return sprintf(
'<div class="logo_%s"><a href="%s"><img src="%s" alt=""/></a></div>',
$position,
$this->_profil->_get('logo_'.$position.'_link'),
$this->_profil->_get('logo_'.$position.'_img'));
return '';
}
......@@ -57,11 +58,13 @@ class ZendAfi_View_Helper_TagBanniere extends Zend_View_Helper_HtmlElement {
$images = '';
$largeur_site = $this->_profil->getLargeurSite();
foreach ($this->_profil->getAllHeaderImg() as $img)
$images .= sprintf('<img alt="%s" src="%s" style="width:%dpx" />',
$this->view->_("banniere du site"),
$img,
$largeur_site);
foreach ($this->_profil->getAllHeaderImg() as $img) {
if (!$img)
continue;
$images .= sprintf('<img alt="" src="%s" style="width:%dpx" />',
$img, $largeur_site);
}
return $images;
}
......
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