AntonLV 9 лет назад
Родитель
Сommit
1d4f2a4e13

+ 10 - 8
modules/boonex/polls/classes/BxPollsModule.php

@@ -91,24 +91,26 @@ class BxPollsModule extends BxBaseModTextModule
 	/**
      * INTERNAL METHODS
      */
-    protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl)
+    protected function _getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl, $aBrowseParams = array())
     {
         return array();
     }
 
-    protected function _getContentForTimelinePost($aEvent, $aContentInfo)
+    protected function _getContentForTimelinePost($aEvent, $aContentInfo, $aBrowseParams = array())
     {
         $CNF = &$this->_oConfig->CNF;
+        $bDynamic = isset($aBrowseParams['dynamic_mode']) && $aBrowseParams['dynamic_mode'] === true;
 
-        $aBlock = $this->_oTemplate->{$this->_oDb->isPerformed($aContentInfo[$CNF['FIELD_ID']], bx_get_logged_profile_id()) ? 'entryResults' : 'entrySubentries'}($aContentInfo);
+        $sInclude = '';
+        $sInclude .= $this->_oTemplate->addJs(array('entry.js'), $bDynamic);
+        $sInclude .= $this->_oTemplate->addCss(array('entry.css'), $bDynamic);
 
-        $aResult = parent::_getContentForTimelinePost($aEvent, $aContentInfo);
+        $aBlock = $this->_oTemplate->{$this->_oDb->isPerformed($aContentInfo[$CNF['FIELD_ID']], bx_get_logged_profile_id()) ? 'entryResults' : 'entrySubentries'}($aContentInfo, $bDynamic);
+
+        $aResult = parent::_getContentForTimelinePost($aEvent, $aContentInfo, $aBrowseParams);
         $aResult['title'] = $this->_oConfig->getTitle($aContentInfo);
         $aResult['text'] = '';
-        $aResult['raw'] = $this->_oTemplate->getJsCode('entry') . $aBlock['content'];
-
-        $this->_oTemplate->addJs(array('entry.js'));
-        $this->_oTemplate->addCss(array('entry.css'));
+        $aResult['raw'] = ($bDynamic ? $sInclude : '') . $this->_oTemplate->getJsCode('entry') . $aBlock['content'];
 
         return $aResult;
     }

+ 7 - 3
modules/boonex/polls/classes/BxPollsTemplate.php

@@ -31,7 +31,8 @@ class BxPollsTemplate extends BxBaseModTextTemplate
 
         return parent::getJsCode($sType, $aParams, $bWrap);
     }
-    public function entrySubentries ($aData)
+
+    public function entrySubentries ($aData, $bDynamic = false)
     {
         $CNF = &$this->getModule()->_oConfig->CNF;
 
@@ -44,7 +45,9 @@ class BxPollsTemplate extends BxBaseModTextTemplate
             $oVotes = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES_SUBENTRIES'], $aSubentry['id']);
 
             $aTmplVarsSubentries[] = array(
-                'subentry' => $oVotes->getElementBlock()
+                'subentry' => $oVotes->getElementBlock(array(
+                    'dynamic_mode' => $bDynamic
+                ))
             );
         }
 
@@ -61,7 +64,7 @@ class BxPollsTemplate extends BxBaseModTextTemplate
         );
     }
 
-    public function entryResults($aData)
+    public function entryResults($aData, $bDynamic = false)
     {
         $CNF = &$this->getModule()->_oConfig->CNF;
 
@@ -85,6 +88,7 @@ class BxPollsTemplate extends BxBaseModTextTemplate
                 'width' => (int)round($fPercent) . '%',
                 'votes' => $oVotes->getCounter(array('show_counter_empty' => true, 'show_counter_in_brackets' => false)),
                 'percent' => _t('_bx_polls_txt_subentry_vote_percent', $iTotal > 0 ? round($fPercent, 2) : 0),
+                'js_code' => $oVotes->getJsScript($bDynamic)
             );
         }
 

+ 1 - 0
modules/boonex/polls/template/subentries_results.html

@@ -6,6 +6,7 @@
                 <div class="bx-polls-rg-bar bx-def-round-corners" style="width:__width__">&nbsp;</div>
                 <div class="bx-polls-rg-text bx-def-padding-left bx-def-font-middle bx-def-font-grayed">__votes__&nbsp;__percent__</div>
             </div>
+            __js_code__
         </div>
     </bx_repeat:subentries>
 </div>