Răsfoiți Sursa

Ticket #4561 - Ads: Enhancements. Point 2.

AntonLV 2 ani în urmă
părinte
comite
ea23a9daaf

+ 12 - 1
modules/boonex/ads/classes/BxAdsChartGrowth.php

@@ -11,11 +11,17 @@
 
 class BxAdsChartGrowth extends BxDolChartGrowth
 {
+    protected $_sModule;
+    protected $_oModule;
+
     protected function __construct($aObject)
     {
+        $this->_sModule = 'bx_ads';
+        $this->_oModule = BxDolModule::getInstance($this->_sModule);
+
         parent::__construct($aObject);
     }
-    
+
     public function actionLoadDataByInterval()
     {
         $this->addMarkers([
@@ -24,6 +30,11 @@ class BxAdsChartGrowth extends BxDolChartGrowth
 
         return parent::actionLoadDataByInterval();
     }
+
+    public function checkAllowedView($isPerformAction = false)
+    {
+        return CHECK_ACTION_RESULT_ALLOWED;
+    }
 }
 
 /** @} */

+ 11 - 0
modules/boonex/ads/classes/BxAdsChartGrowthSpeed.php

@@ -11,8 +11,14 @@
 
 class BxAdsChartGrowthSpeed extends BxDolChartGrowthSpeed
 {
+    protected $_sModule;
+    protected $_oModule;
+
     protected function __construct($aObject)
     {
+        $this->_sModule = 'bx_ads';
+        $this->_oModule = BxDolModule::getInstance($this->_sModule);
+
         parent::__construct($aObject);
     }
 
@@ -24,6 +30,11 @@ class BxAdsChartGrowthSpeed extends BxDolChartGrowthSpeed
 
         return parent::actionLoadDataByInterval();
     }
+
+    public function checkAllowedView($isPerformAction = false)
+    {
+        return CHECK_ACTION_RESULT_ALLOWED;
+    }
 }
 
 /** @} */

+ 9 - 0
modules/boonex/ads/classes/BxAdsTemplate.php

@@ -27,6 +27,9 @@ class BxAdsTemplate extends BxBaseModTextTemplate
     {
         $CNF = &$this->_oConfig->CNF;
 
+        if(($mixedResult = $this->_oModule->checkAllowedEdit($aContentInfo)) !== CHECK_ACTION_RESULT_ALLOWED)
+            return MsgBox($mixedResult);
+
         $sDateFrom = date('Y-m-d', $aContentInfo[$CNF['FIELD_ADDED']]);
         $sDateTo = date('Y-m-d', time());
 
@@ -110,6 +113,9 @@ class BxAdsTemplate extends BxBaseModTextTemplate
     {
         $CNF = &$this->_oConfig->CNF;
 
+        if(($mixedResult = $this->_oModule->checkAllowedEdit($aContentInfo)) !== CHECK_ACTION_RESULT_ALLOWED)
+            return MsgBox($mixedResult);
+
         $aTmplVarsDataLabels = $aTmplVarsDataSet = [];
         foreach(['impressions', 'clicks'] as $sItem) {
             $sTitle = bx_html_attribute(_t($CNF['T']['chart_label_' . $sItem]));
@@ -139,6 +145,9 @@ class BxAdsTemplate extends BxBaseModTextTemplate
     {
         $CNF = &$this->_oConfig->CNF;
 
+        if(($mixedResult = $this->_oModule->checkAllowedEdit($aContentInfo)) !== CHECK_ACTION_RESULT_ALLOWED)
+            return MsgBox($mixedResult);
+
         $aTmplVarsDataLabels = $aTmplVarsDataSet = [];
         
         //--- Get income local.