article_seo.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Article_Seo extends Object_Seo
00007 {
00013     protected $_sActCatId = null;
00014 
00020     protected $_oArtCategories = null;
00021 
00027     protected $_oArtVendors = null;
00028 
00034     protected $_oArticle = null;
00035 
00042     public function render()
00043     {
00044         $oArticle = $this->_getObject( oxConfig::getParameter( 'oxid' ) );
00045 
00046         $this->_aViewData["edit"] = $oArticle;
00047         $this->_aViewData["blShowCatSelect"] = true;
00048         $this->_aViewData["oCategories"] = $this->_getCategoryList( $oArticle );
00049         $this->_aViewData["oVendors"]    = $this->_getVendorList( $oArticle );
00050         $this->_aViewData["sCatId"]      = $this->getActCategory();
00051 
00052         return parent::render();
00053     }
00054 
00060     protected function _getSeoDataSql( $oObject, $iShopId, $iLang )
00061     {
00062         $sParam = ( $sCat = $this->getActCategory() ) ? " and oxparams = '$sCat'" : '';
00063         $sQ = "select * from oxseo where oxobjectid = '".$oObject->getId()."' and
00064                oxshopid = '{$iShopId}' and oxlang = {$iLang} {$sParam} ";
00065         return $sQ;
00066     }
00067 
00073     protected function _getCategoryList( $oArticle )
00074     {
00075         if ( $this->_oArtCategories === null ) {
00076             $this->_oArtCategories = ( $oArticle ) ? oxSeoEncoderArticle::getInstance()->getSeoCategories( $oArticle ) : false;
00077         }
00078 
00079         return $this->_oArtCategories;
00080     }
00081 
00087     protected function _getVendorList( $oArticle )
00088     {
00089         if ( $this->_oArtVendors === null ) {
00090             $this->_oArtVendors = false;
00091 
00092             if ( $oArticle->oxarticles__oxvendorid->value ) {
00093                 $oVendor = oxNew( 'oxvendor' );
00094                 if ( $oVendor->loadInLang( $this->_iEditLang, $oArticle->oxarticles__oxvendorid->value ) ) {
00095                     $this->_oArtVendors = oxNew( 'oxList', 'oxvendor' );
00096                     $this->_oArtVendors[] = $oVendor;
00097                 }
00098             }
00099         }
00100         return $this->_oArtVendors;
00101     }
00102 
00108     public function getActCategory()
00109     {
00110         if ( $this->_sActCatId === null) {
00111             $this->_sActCatId = false;
00112 
00113             $aSeoData = oxConfig::getParameter( 'aSeoData' );
00114             if ( $aSeoData && isset( $aSeoData['oxparams'] ) ) {
00115                 $this->_sActCatId = $aSeoData['oxparams'];
00116             } elseif ( ( $oCats = $this->_getCategoryList( $this->_getObject( oxConfig::getParameter( 'oxid' ) ) ) ) ) {
00117                 $oCats->rewind();
00118                 $this->_sActCatId = $oCats->current()->oxcategories__oxrootid->value;
00119             }
00120         }
00121 
00122         return $this->_sActCatId;
00123     }
00124 
00130     protected function _getSeoUrl( $oArticle )
00131     {
00132         oxSeoEncoderArticle::getInstance()->getArticleUrl( $this->_getObject( oxConfig::getParameter( 'oxid' ) ) );
00133         return parent::_getSeoUrl( $oArticle );
00134     }
00135 
00140     protected function _getObject( $sOxid )
00141     {
00142         if ( $this->_oArticle === null ) {
00143             // load object
00144             $this->_oArticle = oxNew( 'oxarticle' );
00145             if ( !$this->_oArticle->loadInLang( $this->_iEditLang, $sOxid ) ) {
00146                 $this->_oArticle = false;
00147             }
00148         }
00149         return $this->_oArticle;
00150     }
00151 
00156     protected function _getType()
00157     {
00158         return 'oxarticle';
00159     }
00160 
00165     protected function _getStdUrl( $sOxid )
00166     {
00167         $oArticle = oxNew( 'oxarticle' );
00168         $oArticle->loadInLang( $this->_iEditLang, $sOxid );
00169         return $oArticle->getLink();
00170     }
00171 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5