OXID eShop CE  4.9.6
 All Classes Files Functions Variables Pages
oxstate.php
Go to the documentation of this file.
1 <?php
2 
6 class oxState extends oxI18n
7 {
8 
14  protected $_sClassName = 'oxstate';
15 
19  public function __construct()
20  {
22  $this->init("oxstates");
23  }
24 
33  public function getIdByCode($sCode, $sCountryId)
34  {
35  $oDb = oxDb::getDb();
36 
37  return $oDb->getOne(
38  "SELECT oxid FROM oxstates WHERE oxisoalpha2 = " . $oDb->quote(
39  $sCode
40  ) . " AND oxcountryid = " . $oDb->quote($sCountryId)
41  );
42  }
43 
51  public function getTitleById($iStateId)
52  {
53  $oDb = oxDb::getDb();
54  $sQ = "SELECT oxtitle FROM " . getViewName("oxstates") . " WHERE oxid = " . $oDb->quote($iStateId);
55  $sStateTitle = $oDb->getOne($sQ);
56 
57  return (string) $sStateTitle;
58  }
59 }