Explorar el Código

Ticket #4529 - Author block should have the same counter as in Profile Stats.

AntonLV hace 3 años
padre
commit
ce9193b9e7

+ 1 - 1
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -783,7 +783,7 @@ class BxBaseModGeneralModule extends BxDolModule
     	return 0;
     }
 
-    public function serviceGetMenuAddonManageToolsProfileStats()
+    public function serviceGetMenuAddonManageToolsProfileStats($iProfileId = 0)
     {
     	return 0;
     }

+ 18 - 11
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -257,8 +257,8 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         return $this->_oDb->getContentInfoById((int)$iContentId);
     }
 
-	public function serviceGetMenuAddonManageTools()
-	{
+    public function serviceGetMenuAddonManageTools()
+    {
         $CNF = &$this->_oConfig->CNF;
         
 		$iNumTotal = $this->_oDb->getEntriesNumByParams();
@@ -284,21 +284,28 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         }
         
         return array('counter1_value' => $iNum1, 'counter2_value' => $iNum2, 'counter3_value' => $iNumTotal, 'counter1_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter1_caption_profile_default'));
-	}
+    }
+
+    public function serviceGetMenuAddonManageToolsProfileStats($iProfileId = 0)
+    {
+        if(!$iProfileId)
+            $iProfileId = bx_get_logged_profile_id();
 
-	public function serviceGetMenuAddonManageToolsProfileStats()
-	{
-		bx_import('SearchResult', $this->_aModule);
+        $aAccountInfo = BxDolProfileQuery::getInstance()->getAccountInfoByProfileId($iProfileId);
+        if(empty($aAccountInfo) || !is_array($aAccountInfo))
+            return 0;
+
+        bx_import('SearchResult', $this->_aModule);
         $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
         $o = new $sClass();
-        $o->fillFilters(array(
-			'account_id' => getLoggedId(),
-        	'perofileStatus' => ''
-        ));
+        $o->fillFilters([
+            'account_id' => $aAccountInfo['id'],
+            'perofileStatus' => ''
+        ]);
         $o->unsetPaginate();
 
         return $o->getNum();
-	}
+    }
 
     public function serviceGetMenuAddonFavoritesProfileStats()
     {

+ 10 - 7
modules/base/text/classes/BxBaseModTextModule.php

@@ -378,18 +378,21 @@ class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolConten
     /** 
      * @ref bx_base_text-get_menu_addon_manage_tools_profile_stats "get_menu_addon_manage_tools_profile_stats"
      */
-	public function serviceGetMenuAddonManageToolsProfileStats()
-	{
-		bx_import('SearchResult', $this->_aModule);
+    public function serviceGetMenuAddonManageToolsProfileStats($iProfileId = 0)
+    {
+        if(!$iProfileId)
+            $iProfileId = bx_get_logged_profile_id();
+
+        bx_import('SearchResult', $this->_aModule);
         $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
         $o = new $sClass();
-        $o->fillFilters(array(
-			'author' => bx_get_logged_profile_id()
-        ));
+        $o->fillFilters([
+            'author' => $iProfileId
+        ]);
         $o->unsetPaginate();
 
         return $o->getNum();
-	}
+    }
 
     /**
      * @page service Service Calls

+ 1 - 1
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -802,7 +802,7 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
                 'condition' => true,
                 'content' => array(
                     'link' => BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id=' . $oProfile->id()),
-                    'content' => _t($CNF['T']['txt_all_entries_by'], $this->getModule()->_oDb->getEntriesNumByAuthor($oProfile->id()))
+                    'content' => _t($CNF['T']['txt_all_entries_by'], $this->getModule()->serviceGetMenuAddonManageToolsProfileStats($oProfile->id()))
                 )
             )));