Version: current

     1 <?php
     2  /**
     3  * Виджет "Голосования"
     4  * Позволяет разместить в боковой колонке случайное активное голосование сайта
     5  *
     6  * @package widgets
     7  * @author  menedem
     8  */
     9 class PollSidebarWidget extends SidebarWidget {
    10
    11     public $needObjects = array(
    12         'ShowPoll' => 'Class',
    13     );
    14
    15     function PollWidget() {
    16         $controller = new Page_Controller();
    17         $poll = new ShowPoll($controller, 'SitePoll');
    18
    19         if ($poll && $poll->HasPoll()) {
    20             return $poll;
    21         }
    22         return false;
    23     }
    24
    25     function hasContent() {
    26         if ($this->PollWidget()) {
    27             return true;
    28         }
    29         return false;
    30     }
    31 }
    32
    33
    34

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -