You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FullcalendarWidget.php 731B

8 vuotta sitten
123456789101112131415161718192021222324252627
  1. <?php
  2. namespace common\components\fullcalendar;
  3. use yii\web\View;
  4. use yii\helpers\Html;
  5. use yii\helpers\Json;
  6. class FullcalendarWidget extends \yii\base\Widget{
  7. public $options=[];
  8. public $htmlOptions=[];
  9. public function run(){
  10. if (!isset($this->options['id'])) {
  11. $this->options['id'] = $this->getId();
  12. }
  13. $this->htmlOptions['id']=$id = $this->options['id'];
  14. $view = $this->getView();
  15. FullcalendarAsset::register($view);
  16. echo Html::beginTag('div',$this->htmlOptions);
  17. echo Html::endTag('div');
  18. $encodeoptions=Json::encode($this->options);
  19. $view->registerJs("jQuery('#$id').fullCalendar($encodeoptions);");
  20. //echo("jQuery('#$id').fullCalendar($encodeoptions);") ;
  21. }
  22. }