Ver código fonte

#255 Clean-up: homepage cover

Alex Trofimov 10 anos atrás
pai
commit
cde1f02abf

+ 0 - 8
inc/classes/BxDolTemplate.php

@@ -1142,14 +1142,6 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
                 break;
             case 'cover':
                 $oCover = BxDolCover::getInstance($this);
-
-                $iId = (int)getParam('sys_site_cover_' . (bx_get('i') == 'home' ? 'home' : 'common'));
-                if($iId != 0 && $oCover)
-                	$oCover->setCoverImageUrl(array(
-                		'id' => $iId,
-                		'transcoder' => BX_DOL_TRANSCODER_OBJ_COVER
-                	));
-
                 $sRet = $oCover ? $oCover->display() : '';
                 break;
             case 'dol_images':

+ 10 - 1
template/scripts/BxBaseCover.php

@@ -41,7 +41,16 @@ class BxBaseCover extends BxDolCover
 
             if (!$mixedOptions || !is_array($mixedOptions))
                 return $this->_oTemplate->parseHtmlByName($this->_sTemplateNameEmpty, array());
-            
+
+            if (!$this->_sCoverImageUrl) {
+                $iId = (int)getParam('sys_site_cover_common');
+                if ($iId != 0)
+                	$this->setCoverImageUrl(array(
+                		'id' => $iId,
+                		'transcoder' => BX_DOL_TRANSCODER_OBJ_COVER
+                    ));
+            }
+                
             if ($this->_sCoverImageUrl)
                 $mixedOptions['bx_if:bg'] = array (
                     'condition' => true,

+ 5 - 0
template/scripts/BxBasePageHome.php

@@ -20,9 +20,14 @@ class BxBasePageHome extends BxTemplPage
         $this->addMarkers(array('site_title' => getParam('site_title')));
 
         $oCover = BxDolCover::getInstance();
+        $iFileIdCover = (int)getParam('sys_site_cover_home');
         $oCover->set(array(
             'class' => 'bx-cover-homepage',
             'title' => _t('_sys_txt_homepage_cover', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')),
+            'bx_if:bg' => array (
+                'condition' => $iFileIdCover,
+                'content' => array('image_url' => ($iFileIdCover ? BxDolTranscoder::getObjectInstance(BX_DOL_TRANSCODER_OBJ_COVER)->getFileUrlById($iFileIdCover) : '')),
+            ),            
         ));
     }