oxcountrylist.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxCountryList extends oxList
00009 {
00017     public function __construct( $sObjectsInListName = 'oxcountry' )
00018     {
00019         parent::__construct( 'oxcountry' );
00020     }
00021 
00030     public function selectString( $sSQL )
00031     {
00032         parent::selectString( $sSQL );
00033         uasort( $this->_aArray, array( $this, '_localCompare' ) );
00034     }
00035 
00043     public function loadActiveCountries( $iLang = null )
00044     {
00045         $sSufix = oxLang::getInstance()->getLanguageTag( $iLang );
00046 
00047         $sSelect = "SELECT oxid, oxtitle$sSufix as oxtitle FROM oxcountry WHERE oxactive = '1' ORDER BY oxtitle$sSufix ";
00048         $this->selectString( $sSelect );
00049     }
00050 
00060     protected function _localCompare( $oA, $oB )
00061     {
00062         if ( $oA->oxcountry__oxorder->value != $oB->oxcountry__oxorder->value ) {
00063             if ( $oA->oxcountry__oxorder->value < $oB->oxcountry__oxorder->value ) {
00064                 return -1;
00065             } else {
00066                 return 1;
00067             }
00068         }
00069 
00070         $aReplaceWhat = array( '/ä/', '/ö/', '/ü/', '/Ü/', '/Ä/', '/Ö/', '/ß/',
00071                                '/&auml;/', '/&ouml;/', '/&uuml;/', '/&Auml;/', '/&Ouml;/', '/&Uuml;/', '/&szlig;/' );
00072         $aReplaceTo   = array( 'az', 'oz', 'uz', 'Uz', 'Az', 'Oz', 'sz', 'az', 'oz', 'uz', 'Az', 'Oz', 'Uz', 'sz' );
00073 
00074         $sACodedTitle = preg_replace( $aReplaceWhat, $aReplaceTo, $oA->oxcountry__oxtitle->value );
00075         $sBCodedTitle = preg_replace( $aReplaceWhat, $aReplaceTo, $oB->oxcountry__oxtitle->value );
00076         
00077         $iRes = strcasecmp( $sACodedTitle, $sBCodedTitle );
00078         
00079         // if equal, using case sensitive compare
00080         if ( $iRes === 0 ) {
00081             $iRes = strcmp( $sACodedTitle, $sBCodedTitle ) ;
00082         }
00083         
00084         return $iRes;
00085     }
00086 }

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