oxstate.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class oxState extends oxI18n
00007 {
00008 
00014     protected $_sClassName = 'oxstate';
00015 
00019     public function __construct()
00020     {
00021         parent::__construct();
00022         $this->init("oxstates");
00023     }
00024 
00033     public function getIdByCode($sCode, $sCountryId)
00034     {
00035         $oDb = oxDb::getDb();
00036 
00037         return $oDb->getOne(
00038             "SELECT oxid FROM oxstates WHERE oxisoalpha2 = " . $oDb->quote(
00039                 $sCode
00040             ) . " AND oxcountryid = " . $oDb->quote($sCountryId)
00041         );
00042     }
00043 
00051     public function getTitleById($iStateId)
00052     {
00053         $oDb = oxDb::getDb();
00054         $sQ = "SELECT oxtitle FROM " . getViewName("oxstates") . " WHERE oxid = " . $oDb->quote($iStateId);
00055         $sStateTitle = $oDb->getOne($sQ);
00056 
00057         return (string) $sStateTitle;
00058     }
00059 }