Example #1
0
 public function init()
 {
     parent::init();
     if (!$this->id) {
         $this->id = PollRecord::getMainPollId();
     }
     if ($this->id) {
         $this->_poll = PollRecord::find()->activeStatus()->andWhere(['id' => $this->id])->andWhere('IFNULL(end_date, \'9999-99-99\')>=:actual_date')->params([':actual_date' => \Yii::$app->formatter->asDate(time(), 'y-MM-dd')])->one();
         if ($this->_poll) {
             $this->setChartOptions();
         }
     }
 }