OXID eShop CE  4.10.5
 All Classes Namespaces Files Functions Variables Pages
payment_country.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
18  public function render()
19  {
20  $myConfig = $this->getConfig();
22 
23  // remove itm from list
24  unset($this->_aViewData["sumtype"][2]);
25 
26  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
27  if ($soxId != "-1" && isset($soxId)) {
28  // load object
29  $oPayment = oxNew("oxpayment");
30  $oPayment->loadInLang($this->_iEditLang, $soxId);
31 
32  $oOtherLang = $oPayment->getAvailableInLangs();
33  if (!isset($oOtherLang[$this->_iEditLang])) {
34  // echo "language entry doesn't exist! using: ".key($oOtherLang);
35  $oPayment->loadInLang(key($oOtherLang), $soxId);
36  }
37  $this->_aViewData["edit"] = $oPayment;
38 
39  // remove already created languages
40  $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
41  if (count($aLang)) {
42  $this->_aViewData["posslang"] = $aLang;
43  }
44 
45  foreach ($oOtherLang as $id => $language) {
46  $oLang = new stdClass();
47  $oLang->sLangDesc = $language;
48  $oLang->selected = ($id == $this->_iEditLang);
49  $this->_aViewData["otherlang"][$id] = clone $oLang;
50  }
51  }
52 
53  if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
54  $oPaymentCountryAjax = oxNew('payment_country_ajax');
55  $this->_aViewData['oxajax'] = $oPaymentCountryAjax->getColumns();
56 
57  return "popups/payment_country.tpl";
58  }
59 
60  return "payment_country.tpl";
61  }
62 
66  public function addcountry()
67  {
68  $sOxId = $this->getEditObjectId();
69  $aChosenCntr = oxRegistry::getConfig()->getRequestParameter("allcountries");
70  if (isset($sOxId) && $sOxId != "-1" && is_array($aChosenCntr)) {
71  foreach ($aChosenCntr as $sChosenCntr) {
72  $oObject2Payment = oxNew('oxbase');
73  $oObject2Payment->init('oxobject2payment');
74  $oObject2Payment->oxobject2payment__oxpaymentid = new oxField($sOxId);
75  $oObject2Payment->oxobject2payment__oxobjectid = new oxField($sChosenCntr);
76  $oObject2Payment->oxobject2payment__oxtype = new oxField("oxcountry");
77  $oObject2Payment->save();
78  }
79  }
80  }
81 
85  public function removecountry()
86  {
87  $sOxId = $this->getEditObjectId();
88  $aChosenCntr = oxRegistry::getConfig()->getRequestParameter("countries");
89  if (isset($sOxId) && $sOxId != "-1" && is_array($aChosenCntr)) {
90  foreach ($aChosenCntr as $sChosenCntr) {
91  $oObject2Payment = oxNew('oxbase');
92  $oObject2Payment->init('oxobject2payment');
93  $oObject2Payment->delete($sChosenCntr);
94  }
95  }
96  }
97 }