Procházet zdrojové kódy

Ticket #4575 - Events: Enhancements. Point 4.

AntonLV před 2 roky
rodič
revize
e99fc4ab70

+ 17 - 17
inc/classes/BxDolMetatags.php

@@ -144,10 +144,12 @@
  */
 class BxDolMetatags extends BxDolFactory implements iBxDolFactoryObject
 {
+    protected static $_aLocationKeys = ['lat', 'lng', 'country', 'state', 'city', 'zip', 'street', 'street_number'];
+    
     protected $_sObject;
     protected $_aObject;
     protected $_oQuery;
-    protected $_aMetas = array ();
+    protected $_aMetas = [];
 
     /**
      * Constructor
@@ -596,22 +598,22 @@ class BxDolMetatags extends BxDolFactory implements iBxDolFactoryObject
      */
     public static function locationsRetrieveFromForm($sPrefix = '', $oForm = null)
     {
-        if ($sPrefix)
+        if($sPrefix)
             $sPrefix .= '_';
 
-        if (!$oForm)
+        if(!$oForm)
             $oForm = new BxDolForm(array(), false);
 
-        return array(
-            $oForm->getCleanValue($sPrefix.'lat'), 
-            $oForm->getCleanValue($sPrefix.'lng'), 
-            $oForm->getCleanValue($sPrefix.'country'), 
-            $oForm->getCleanValue($sPrefix.'state'), 
-            $oForm->getCleanValue($sPrefix.'city'), 
-            $oForm->getCleanValue($sPrefix.'zip'), 
-            $oForm->getCleanValue($sPrefix.'street'), 
-            $oForm->getCleanValue($sPrefix.'street_number')
-        );
+        $aResults = [];
+        foreach(self::$_aLocationKeys as $sKey) {
+            $sValue = $oForm->getCleanValue($sPrefix . $sKey);
+            if(!$sValue || $sValue == 'null')
+                $sValue = '';
+
+            $aResults[] = $sValue;
+        }
+
+        return $aResults;
     }
 
     /**
@@ -620,16 +622,14 @@ class BxDolMetatags extends BxDolFactory implements iBxDolFactoryObject
      */ 
     public static function locationsParseComponents($aAdress, $sPrefix = '')
     {
-        $aKeys = array('lat', 'lng', 'country', 'state', 'city', 'zip', 'street', 'street_number');
-
         if($sPrefix)
             $sPrefix .= '_';
 
         $aRet = array();
         $iAdress = count($aAdress);
         for($i = 0; $i < $iAdress; $i++)
-            if(isset($aKeys[$i]))
-                $aRet[$sPrefix . $aKeys[$i]] = $aAdress[$i];
+            if(isset(self::$_aLocationKeys[$i]))
+                $aRet[$sPrefix . self::$_aLocationKeys[$i]] = $aAdress[$i];
 
         return $aRet;
     }

+ 1 - 3
modules/boonex/events/js/main.js

@@ -18,9 +18,7 @@ function BxEventsMain(oOptions) {
             var oTimezone = $(oPopup).find("[name = 'timezone']");
             if(oTimezone && oTimezone.length != 0)
                 oTimezone.val(moment.tz.guess());
-    
-            console.log(oTimezone.val());
-    
+        
             $(oPopup).find("[name = 'cancel']").focus();
         }
     });   

+ 2 - 1
template/scripts/BxBaseServices.php

@@ -107,7 +107,8 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
             'GetStatBlock' => 'BxBaseDashboardServices',
             
             'PerfomActionApi' => 'BxBaseServiceGrid',
-            'SelectLabels' => 'BxBaseLabelsServices',
+
+            'GetLabels' => 'BxBaseLabelsServices',
         );
     }