Explorar o código

#3130 Return back setLocationVals for form object method since it's used in custom mods

Alex Trofimov %!s(int64=5) %!d(string=hai) anos
pai
achega
44ddefd4aa
Modificáronse 2 ficheiros con 48 adicións e 0 borrados
  1. 21 0
      inc/classes/BxDolLocationField.php
  2. 27 0
      template/scripts/BxBaseFormView.php

+ 21 - 0
inc/classes/BxDolLocationField.php

@@ -50,6 +50,27 @@ class BxDolLocationField extends BxDolFactoryObject
 
         return $oForm->getCleanValue($s);
     }
+
+    public function setLocationVals ($aInput, $aVals, $oForm)
+    {	
+        $oForm->setSpecificValue($aInput['name'] . '_lat', $aVals['lat']);
+        $oForm->setSpecificValue($aInput['name'] . '_lng', $aVals['lng']);
+        $oForm->setSpecificValue($aInput['name'] . '_country', $aVals['country']);
+        $oForm->setSpecificValue($aInput['name'] . '_state', $aVals['state']);
+        $oForm->setSpecificValue($aInput['name'] . '_city', $aVals['city']);
+        $oForm->setSpecificValue($aInput['name'] . '_zip', $aVals['zip']);
+        $oForm->setSpecificValue($aInput['name'] . '_street', $aVals['street']);
+        $oForm->setSpecificValue($aInput['name'] . '_street_number', $aVals['street_number']);
+
+        return true;
+    }
+
+    public function setLocationVal ($aInput, $sIndex, $sVal, $oForm)	
+    {	
+        $s = $aInput['name'] . '_' . $sIndex;
+        $oForm->setSpecificValue($s, $sVal);
+        return true;
+    }
 }
 
 /** @} */

+ 27 - 0
template/scripts/BxBaseFormView.php

@@ -1716,6 +1716,33 @@ BLAH;
         return $o->genInputLocation($aInput, $this);
     }
     
+    public function setLocationVals ($aInput, $aVals)
+    {
+        $o = BxDolLocationField::getObjectInstance(getParam('sys_location_field_default'));
+        if (!$o)
+            return false;
+
+        return $o->setLocationVals ($aInput, $aVals, $this);
+    }
+
+    public function setLocationVal ($aInput, $sIndex, $sVal)
+    {
+        $o = BxDolLocationField::getObjectInstance(getParam('sys_location_field_default'));
+        if (!$o)
+            return false;
+
+        return $o->setLocationVal ($aInput, $sIndex, $sVal, $this);
+    }
+
+    protected function getLocationVal ($aInput, $sIndex)
+    {
+        $o = BxDolLocationField::getObjectInstance(getParam('sys_location_field_default'));
+        if (!$o)
+            return false;
+
+        return $o->getLocationVal ($aInput, $sIndex, $this);
+    }
+
     function genInputPassword(&$aInput)
     {
         return $this->oTemplate->parseHtmlByName('form_field_password.html', array('input' => $this->genInputStandard($aInput)));