RomanL %!s(int64=8) %!d(string=hai) anos
pai
achega
7c85bbfcb8

+ 4 - 11
modules/boonex/charts/classes/BxChartsDb.php

@@ -27,7 +27,7 @@ class BxChartsDb extends BxBaseModGeneralDb
     public function saveTopByLikes($sModuleName, $sTableName)
     {
         $iInterval = intval(getParam('bx_charts_chart_top_contents_by_likes_interval_day'));
-        $sQuery = "INSERT INTO `" . $this->_sTableTopByLikes . "` (`object_id`, `module`, `value`) SELECT `object_id`,'" . $sModuleName . "', COUNT(`id`) FROM `" . $sTableName . "` WHERE `date` > " . ($iInterval > 0 ? $this->getTimeFromDaysBefore($iInterval) : 0) . " GROUP BY `object_id` ORDER BY  COUNT(`id`) DESC LIMIT 0, " . intval(getParam('bx_charts_chart_top_contents_by_likes_count')) . "";
+        $sQuery = "INSERT INTO `" . $this->_sTableTopByLikes . "` (`object_id`, `module`, `value`) SELECT `object_id`,'" . $sModuleName . "', COUNT(`id`) FROM `" . $sTableName . "` WHERE `date` > " . ($iInterval > 0 ? $this->getTimeFromDaysBefore($iInterval) : 0) . " GROUP BY `object_id` ORDER BY  COUNT(`id`) DESC LIMIT 0, " . intval(getParam('bx_charts_chart_top_contents_by_likes_count'));
         $this->query($sQuery);
     }
     
@@ -77,7 +77,6 @@ class BxChartsDb extends BxBaseModGeneralDb
         $iInterval = intval(getParam('bx_charts_chart_most_followed_profiles_interval_day'));
         $sQuery = "INSERT INTO `" . $this->_sTableMostFollowedProfiles . "` (`object_id`, `profile_module`, `followers_count`)  SELECT `sys_profiles`.`content_id`, `sys_profiles`.`type` , COUNT(`sys_profiles_conn_subscriptions`.`id`) FROM `sys_profiles_conn_subscriptions`
   INNER JOIN `sys_profiles`  ON `sys_profiles`.`id` = `sys_profiles_conn_subscriptions`.`content` WHERE sys_profiles.type='" . $sProfileModuleName . "' AND  `sys_profiles_conn_subscriptions`.`added` > " . ($iInterval > 0 ? $this->getTimeFromDaysBefore($iInterval) : 0) . " GROUP BY `sys_profiles`.`content_id`, `sys_profiles`.`type` ORDER BY COUNT(`sys_profiles_conn_subscriptions`.`id`) DESC LIMIT 0," . intval(getParam('bx_charts_chart_most_followed_profiles_count'));
-        echo  $sQuery.'<hr>';
         $this->query($sQuery);
     }
     
@@ -92,17 +91,11 @@ class BxChartsDb extends BxBaseModGeneralDb
         return $this->getAll("SELECT SUM(`followers_count`) AS followers_count, `object_id`, `profile_module` as `module` FROM `" . $this->_sTableMostFollowedProfiles . "` GROUP BY `object_id`, `module` ORDER BY SUM(`followers_count`) DESC LIMIT 0," . intval(getParam('bx_charts_chart_most_followed_profiles_count')));
     }
     
-    /* Content part */
-    public function getStatistic()
-    {
-        return $this->getAll("SELECT * FROM `sys_statistics` WHERE 1 ORDER BY `order`");
-    }
-
     /* Growth part */
     public function getGrowth($sTableName)
     {
         $iInterval = intval(getParam('bx_charts_chart_growth_interval_day'));
-        $sQuery =  "SELECT " . getParam('bx_charts_chart_growth_group_by') . "(FROM_UNIXTIME(`added`))  AS `period`, YEAR(FROM_UNIXTIME(`added`))  AS `year`,  COUNT(*) AS `count` FROM " . $sTableName . " WHERE `added` > " . ($iInterval > 0 ? $this->getTimeFromDaysBefore($iInterval) : 0) . " GROUP BY `period` ORDER BY `period` ASC";
+        $sQuery =  "SELECT " . getParam('bx_charts_chart_growth_group_by') . "(FROM_UNIXTIME(`added`))  AS `period`, YEAR(FROM_UNIXTIME(`added`))  AS `year`,  COUNT(*) AS `count` FROM " . $sTableName . " WHERE `added` > " . ($iInterval > 0 ? $this->getTimeFromDaysBefore($iInterval) : 0) . " GROUP BY `period`, `year` ORDER BY `year`, `period` ASC";
         return $this->getAll($sQuery);
     }
     
@@ -111,11 +104,11 @@ class BxChartsDb extends BxBaseModGeneralDb
         $iInterval = intval(getParam('bx_charts_chart_growth_interval_day'));
         $mixedStartDate = $this->getTimeFromDaysBefore($iInterval);
         
-        $sQuery =  "SELECT  COUNT(*) AS `count` FROM " . $sTableName . " WHERE `added` < " . ($iInterval > 0 ? $mixedStartDate : 0) . "";
+        $sQuery =  "SELECT  COUNT(*) AS `count` FROM " . $sTableName . " WHERE `added` < " . ($iInterval > 0 ? $mixedStartDate : 0);
         $mixedStartValue = $this->getOne($sQuery);
       
         if ($iInterval == 0){
-            $sQuery =  "SELECT  MIN(`added`) as `mindata` FROM " . $sTableName;
+            $sQuery =  "SELECT  MIN(`added`) AS `mindata` FROM " . $sTableName;
             $mixedStartDate = $this->getOne($sQuery);
         }
         return array($mixedStartValue,$mixedStartDate);

+ 0 - 46
modules/boonex/charts/classes/BxChartsModule.php

@@ -198,29 +198,6 @@ class BxChartsModule extends BxDolModule
         return $this->_oTemplate->getChart('MostFollowedProfiles', 40);
     }
     
-     /**
-     * @page service Service Calls
-     * @section bx_charts Charts
-     * @subsection bx_charts-other Other
-     * @subsubsection bx_charts-on-profile get_chart_content_by_modules
-     * 
-     * @code bx_srv('bx_charts', 'get_chart_content_by_modules', [...]); @endcode
-     * 
-     * Get Chart Content By Modules
-     * 
-     * @return an html for chart. 
-     * 
-     * @see BxChartsModule::serviceGetChartContentByModules
-     */
-    /** 
-     * @ref bx_charts-get_chart_content_by_modules "get_chart_content_by_modules"
-     */
-
-    public function serviceGetChartContentByModules()
-    {
-        return $this->_oTemplate->getChart('ContentByModules', 100);
-    }
-    
     /**
      * @page service Service Calls
      * @section bx_charts Charts
@@ -285,29 +262,6 @@ class BxChartsModule extends BxDolModule
             echo  '{"type":"horizontalBar",  "data": {"labels":' . json_encode($aValues['labels']) . ',"datasets": [{"label": "' . _t('_bx_charts_most_followed_profiles_legend') . '","backgroundColor": "' . $this->aColors[0] . '","borderColor": "' . $this->aColors[0] . '","borderWidth": 1,"data": ' . json_encode($aValues['values']) . '}]}, "options": {"legend": {"position": "bottom"}}, "links": ' . json_encode($aValues['links']) . '}';
         }
         
-        if ($Id == 'ContentByModules'){
-            $aValues = array('labels' => array(), 'values' => array(), 'colors' => array(), 'links' => array());
-            $aItems = $this->_oDb->getStatistic();
-            foreach($aItems as $aItem) {
-                
-                $iValue = 0;
-                if(!empty($aItem['query']))
-                    $iValue = (int)$this->_oDb->getOne($aItem['query']);
-                else if(BxDolRequest::serviceExists($aItem['module'], 'get_query_statistics'))
-                    $iValue = (int)BxDolService::call($aItem['module'], 'get_query_statistics', array($aItem));
-                
-                $sLink = '';
-                if(!empty($aItem['link']))
-                    $sLink = BxDolPermalinks::getInstance()->permalink($aItem['link']);
-                
-                array_push($aValues['labels'], _t($aItem['title']) . ' - ' . $iValue);
-                array_push($aValues['values'], $iValue);
-                array_push($aValues['links'], $sLink);
-            }
-            $aValues['colors'] = array_slice($this->aColors, 0, count($aValues['values']));
-            echo  '{"type": "doughnut", "data":{"labels":' . json_encode($aValues['labels']) . ',"datasets":[{"data":' . json_encode($aValues['values']) . ',"backgroundColor":' . json_encode($aValues['colors']) . '}]}, "options": {"legend": {"position": "bottom"}}, "links": ' . json_encode($aValues['links']) . '}';
-        }
-        
         if ($Id == 'GrowthByModules'){
             $aValues = array('labels' => array(), 'values1' => array(), 'values2' => array(), 'links' => array());
             $sModuleName = $sTableName = bx_get('m');

+ 0 - 2
modules/boonex/charts/install/langs/en.xml

@@ -26,8 +26,6 @@
   <string name="_bx_charts_page_block_title_chart_most_active_profiles"><![CDATA[Most active profiles]]></string>
   <string name="_bx_charts_page_block_title_system_chart_most_followed_profiles"><![CDATA[Most followed profiles]]></string>
   <string name="_bx_charts_page_block_title_chart_most_followed_profiles"><![CDATA[Most followed profiles]]></string>
-  <string name="_bx_charts_page_block_title_system_chart_content_by_modules"><![CDATA[Content]]></string>
-  <string name="_bx_charts_page_block_title_chart_content_by_modules"><![CDATA[Content]]></string>
   <string name="_bx_charts_page_block_title_system_chart_growth_by_modules"><![CDATA[Growth]]></string>
   <string name="_bx_charts_page_block_title_chart_growth_by_modules"><![CDATA[Growth]]></string>
   <string name="_bx_charts_most_active_profiles_legend_posts"><![CDATA[Posted items]]></string>

+ 1 - 2
modules/boonex/charts/install/sql/enable.sql

@@ -48,8 +48,7 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `
 ('sys_dashboard', @iPBCellDashboard,  @sName, '_bx_charts_page_block_title_system_chart_top_contents_by_likes', '_bx_charts_page_block_title_chart_top_contents_by_likes', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:31:"get_chart_top_contents_by_likes";}', 0, 1, 1, @iPBOrderDashboard),
 ('sys_dashboard', @iPBCellDashboard,  @sName, '_bx_charts_page_block_title_system_chart_most_active_profiles', '_bx_charts_page_block_title_chart_most_active_profiles', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:30:"get_chart_most_active_profiles";}', 0, 1, 1, @iPBOrderDashboard + 1),
 ('sys_dashboard', @iPBCellDashboard,  @sName, '_bx_charts_page_block_title_system_chart_most_followed_profiles', '_bx_charts_page_block_title_chart_most_followed_profiles', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:32:"get_chart_most_followed_profiles";}', 0, 1, 1, @iPBOrderDashboard + 2),
-('sys_dashboard', @iPBCellDashboard,  @sName, '_bx_charts_page_block_title_system_chart_content_by_modules', '_bx_charts_page_block_title_chart_content_by_modules', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:28:"get_chart_content_by_modules";}', 0, 1, 1, @iPBOrderDashboard + 3),
-('sys_dashboard', @iPBCellDashboard,  @sName, '_bx_charts_page_block_title_system_chart_growth_by_modules', '_bx_charts_page_block_title_chart_growth_by_modules', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:27:"get_chart_growth_by_modules";}', 0, 1, 1, @iPBOrderDashboard + 4);
+('sys_dashboard', @iPBCellDashboard,  @sName, '_bx_charts_page_block_title_system_chart_growth_by_modules', '_bx_charts_page_block_title_chart_growth_by_modules', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:27:"get_chart_growth_by_modules";}', 0, 1, 1, @iPBOrderDashboard + 3);
 
 -- CRON
 INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES

+ 0 - 1
modules/boonex/charts/template/chart-growth.html

@@ -7,5 +7,4 @@
         </select>
     </div>
 </bx_if:show_module_selector>
-
 __chart__

+ 1 - 1
modules/boonex/invites/install/sql/enable.sql

@@ -50,7 +50,7 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('bx_invites_enable_request_invite', 'on', @iCategId, '_bx_invites_option_enable_request_invite', 'checkbox', '', '', '', 3),
 ('bx_invites_requests_email', '', @iCategId, '_bx_invites_option_requests_email', 'digit', '', '', '', 4),
 ('bx_invites_enable_reg_by_inv', 'on', @iCategId, '_bx_invites_option_enable_reg_by_inv', 'checkbox', '', '', '', 5),
-('bx_invites_requests_notifications', 'on', @iCategId, '_bx_invites_option_requests_notifictaions', 'checkbox', '', '', '', 6);
+('bx_invites_requests_notifications', 'on', @iCategId, '_bx_invites_option_requests_notifications', 'checkbox', '', '', '', 6);
 
 
 -- ACL

+ 25 - 6
modules/boonex/russian/data/langs/bx_charts/ru.xml

@@ -4,16 +4,35 @@
 	<string name="_bx_charts_adm_stg_cpt_type"><![CDATA[Графики]]></string>
 	<string name="_bx_charts_adm_stg_cpt_category_chart_top_contents_by_likes"><![CDATA[Популярный контент по лайкам]]></string>
 	<string name="_bx_charts_adm_stg_cpt_category_chart_most_active_profiles"><![CDATA[Наиболее активные профили]]></string>
-	<string name="_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_modules_enabled"><![CDATA[Доступно для модулей]]></string>
+  <string name="_bx_charts_adm_stg_cpt_category_chart_most_followed_profiles"><![CDATA[Наиболее следуемые профили]]></string>
+  <string name="_bx_charts_adm_stg_cpt_category_chart_growth"><![CDATA[Рост контента]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_modules_enabled"><![CDATA[Доступно для модулей]]></string>
 	<string name="_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_count"><![CDATA[Количество]]></string>
-	<string name="_bx_charts_adm_stg_cpt_chart_most_active_profiles_modules_enabled"><![CDATA[Доступно для профайлов из]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_interval_day"><![CDATA[Интервал в днях (0 для всех данных)]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_most_active_profiles_modules_enabled"><![CDATA[Доступно для профайлов из]]></string>
 	<string name="_bx_charts_adm_stg_cpt_chart_most_active_profiles_count"><![CDATA[Количество]]></string>
-	<string name="_bx_charts_adm_stg_cpt_chart_most_active_profiles_posts_for_module"><![CDATA[Для модулей]]></string>
-	<string name="_bx_charts_page_block_title_system_chart_top_contents_by_likes"><![CDATA[Популярный контент по лайкам]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_most_active_profiles_interval_day"><![CDATA[Интервал в днях (0 для всех данных)]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_most_active_profiles_posts_for_module"><![CDATA[Для модулей]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_most_followed_profiles_modules_enabled"><![CDATA[Наиболее следуемые профили]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_most_followed_profiles_count"><![CDATA[Количество]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_most_followed_profiles_interval_day"><![CDATA[Интервал в днях (0 для всех данных)]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_growth_modules_enabled"><![CDATA[Активно для]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_growth_interval_day"><![CDATA[Интервал в днях (0 для всех данных)]]></string>
+  <string name="_bx_charts_adm_stg_cpt_chart_growth_group_by"><![CDATA[Группировать по]]></string>
+  <string name="_bx_charts_page_block_title_system_chart_top_contents_by_likes"><![CDATA[Популярный контент по лайкам]]></string>
 	<string name="_bx_charts_page_block_title_chart_top_contents_by_likes"><![CDATA[Популярный контент по лайкам]]></string>
 	<string name="_bx_charts_page_block_title_system_chart_most_active_profiles"><![CDATA[Наиболее активные профили]]></string>
-	<string name="_bx_charts_page_block_title_chart_most_active_profiles"><![CDATA[Наиболее активные профили]]></string>
+  <string name="_bx_charts_page_block_title_system_chart_most_followed_profiles"><![CDATA[Наиболее следуемые профили]]></string>
+  <string name="_bx_charts_page_block_title_chart_most_followed_profiles"><![CDATA[Наиболее следуемые профили]]></string>
+  <string name="_bx_charts_page_block_title_system_chart_growth_by_modules"><![CDATA[Рост контента]]></string>
+  <string name="_bx_charts_page_block_title_chart_growth_by_modules"><![CDATA[Рост контента]]></string>
+  <string name="_bx_charts_page_block_title_chart_most_active_profiles"><![CDATA[Наиболее активные профили]]></string>
 	<string name="_bx_charts_most_active_profiles_legend_posts"><![CDATA[Опубликовано]]></string>
-	<string name="_bx_charts_most_active_profiles_legend_views"><![CDATA[Просмотров]]></string>
+  <string name="_bx_charts_growth_legend"><![CDATA[Рост контента]]></string>
+  <string name="_bx_charts_growth_speed_legend"><![CDATA[Скорость роста контента]]></string>
+  <string name="_bx_charts_most_active_profiles_legend_views"><![CDATA[Просмотров]]></string>
   <string name="_bx_charts_txt_empty_title_item"><![CDATA[Элемент]]></string>
+  <string name="_bx_charts_txt_growth_group_by_day"><![CDATA[День]]></string>
+  <string name="_bx_charts_txt_growth_group_by_week"><![CDATA[Неделя]]></string>
+  <string name="_bx_charts_txt_growth_group_by_month"><![CDATA[Месяц]]></string>
 </resources>