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         // Performance
00035         if ( $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00036 
00037             // initializing language..
00038             $oLang = oxLang::getInstance();
00039             $oLang->getBaseLanguage();
00040 
00041             if ( !( $iChangeLang = oxConfig::getParameter( 'changelang' ) ) ) {
00042                 $iChangeLang = oxConfig::getParameter( 'lang' );
00043             }
00044 
00045             if ( isset( $iChangeLang ) ) {
00046                 // set new language
00047                 $oLang->setBaseLanguage( $oLang->validateLanguage( $iChangeLang ) );
00048 
00049                 // recalc basket
00050                 $oBasket = $this->getSession()->getBasket();
00051                 $oBasket->onUpdate();
00052             }
00053 
00054             $this->aLanguages = $oLang->getLanguageArray( null, true, true );
00055             parent::init();
00056         }
00057     }
00058 
00064     public function render()
00065     {
00066         parent::render();
00067 
00068         // Performance
00069         if ( $this->getConfig()->getConfigParam( 'bl_perfLoadLanguages' ) ) {
00070             reset( $this->aLanguages );
00071             while ( list( $sKey, $oVal ) = each( $this->aLanguages ) ) {
00072                 $this->aLanguages[$sKey]->link = $this->getParent()->getLink($oVal->id);
00073             }
00074             return $this->aLanguages;
00075         }
00076     }
00077 }