oxcmp_lang.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxcmp_lang extends oxView
00009 {
00014     public $aLanguages = null;
00015 
00020     protected $_blIsComponent = true;
00021 
00032     public function init()
00033     {
00034         $myConfig = $this->getConfig();
00035 
00036         // Performance
00037         if ( !$myConfig->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00038             return;
00039         }
00040 
00041         $oLang = oxLang::getInstance();
00042         $iLang = $oLang->getBaseLanguage();
00043         $iChangeLang = oxConfig::getParameter( 'lang' );
00044 
00045         if ( oxConfig::getParameter( 'changelang' ) ) {
00046             $iChangeLang = oxConfig::getParameter("changelang");
00047         }
00048 
00049         if ( isset( $iChangeLang ) ) {
00050             // set new language
00051             $iChangeLang = $oLang->validateLanguage( $iChangeLang );
00052             $oLang->setTplLanguage( $iChangeLang );
00053             $oLang->setBaseLanguage( $iChangeLang );
00054 
00055             // recalc basket
00056             $oBasket = $this->getSession()->getBasket();
00057             $oBasket->onUpdate();
00058         }
00059 
00060         $this->aLanguages = $oLang->getLanguageArray( null, true, true );
00061 
00062         parent::init();
00063     }
00064 
00070     public function render()
00071     {
00072         parent::render();
00073         $myConfig = $this->getConfig();
00074 
00075         // Performance
00076         if ( !$myConfig->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00077             return;
00078         }
00079 
00080         reset($this->aLanguages);
00081 
00082         while ( list( $sKey, $oVal ) = each( $this->aLanguages ) ) {
00083             $this->aLanguages[$sKey]->link = $this->getParent()->getLink($oVal->id);
00084         }
00085         return $this->aLanguages;
00086     }
00087 }

Generated on Wed May 13 13:25:55 2009 for OXID eShop CE by  doxygen 1.5.5