Go to the documentation of this file.00001 <?php
00002
00003
00009 class dyn_trusted_ratings extends Shop_Config
00010 {
00011
00017 protected $_aSkipMultiline = array('aTsLangIds', 'aHomeCountry', 'aTsActiveLangIds');
00018
00025 public function render()
00026 {
00027 parent::render();
00028
00029 $this->_aViewData['oxid'] = $this->getConfig()->getShopId();
00030 $this->_aViewData["alllang"] = oxRegistry::getLang()->getLanguageArray();
00031
00032 return "dyn_trusted_ratings.tpl";
00033 }
00034
00038 public function save()
00039 {
00040 $myConfig = $this->getConfig();
00041 $sOxId = $this->getEditObjectId();
00042
00043
00044 $aConfStrs = oxRegistry::getConfig()->getRequestParameter("confstrs");
00045 $aConfAArs = oxRegistry::getConfig()->getRequestParameter("confaarrs");
00046 $aConfBools = oxRegistry::getConfig()->getRequestParameter("confbools");
00047
00048
00049 if (is_array($aConfAArs['aTsLangIds'])) {
00050
00051 $blActive = (isset($aConfBools["blTsWidget"]) && $aConfBools["blTsWidget"] == "true") ? true : false;
00052 $sPkg = "OXID_ESALES";
00053
00054 $aActiveLangs = array();
00055 foreach ($aConfAArs['aTsLangIds'] as $sLangId => $sId) {
00056 $aActiveLangs[$sLangId] = false;
00057 if ($sId) {
00058 $sTsUser = $myConfig->getConfigParam('sTsUser');
00059 $sTsPass = $myConfig->getConfigParam('sTsPass');
00060
00061 $sResult = $this->_validateId($sId, (bool) $blActive, $sTsUser, $sTsPass, $sPkg);
00062
00063
00064 $aActiveLangs[$sLangId] = $sResult == "OK" ? true : false;
00065
00066
00067 if ($sResult && $sResult != "OK") {
00068 $this->_aViewData["errorsaving"] = "DYN_TRUSTED_RATINGS_ERR_{$sResult}";
00069 }
00070 }
00071 }
00072
00073 $myConfig->saveShopConfVar("arr", "aTsActiveLangIds", $aActiveLangs, $sOxId);
00074 }
00075
00076 parent::save();
00077 }
00078
00084 protected function _getServiceWsdl()
00085 {
00086 $sWsdl = false;
00087 $oConfig = $this->getConfig();
00088 $aTsConfig = $oConfig->getConfigParam("aTsConfig");
00089 if (is_array($aTsConfig)) {
00090 $sWsdl = $aTsConfig["blTestMode"] ? $oConfig->getConfigParam("sTsServiceTestWsdl") : $oConfig->getConfigParam("sTsServiceWsdl");
00091 }
00092
00093 return $sWsdl;
00094 }
00095
00107 protected function _validateId($sId, $blActive, $sUser, $sPass, $sPkg)
00108 {
00109 $sReturn = false;
00110 if (($sWsdl = $this->_getServiceWsdl())) {
00111 try {
00112 $oClient = new SoapClient($sWsdl);
00113 $sReturn = $oClient->updateRatingWidgetState($sId, (int) $blActive, $sUser, $sPass, $sPkg);
00114 } catch (SoapFault $oFault) {
00115 $sReturn = $oFault->faultstring;
00116 }
00117 }
00118
00119 return $sReturn;
00120 }
00121
00127 public function getViewId()
00128 {
00129 return 'dyn_interface';
00130 }
00131
00139 protected function _multilineToArray($sMultiline)
00140 {
00141 $aArr = $sMultiline;
00142 if (!is_array($aArr)) {
00143 $aArr = parent::_multilineToArray($aArr);
00144 }
00145
00146 return $aArr;
00147 }
00148
00156 protected function _multilineToAarray($sMultiline)
00157 {
00158 $aArr = $sMultiline;
00159 if (!is_array($aArr)) {
00160 $aArr = parent::_multilineToAarray($aArr);
00161 }
00162
00163 return $aArr;
00164 }
00165 }