Ejemplo n.º 1
0
 /**
  * Register widget assets.
  */
 public function registerClientScript()
 {
     $view = $this->getView();
     $containerID = $this->inline ? $this->containerOptions['id'] : $this->options['id'];
     $options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '';
     $asset = TimePickerAsset::register($view);
     if ($this->language !== null) {
         $asset->language = $this->language;
         $bundle = DatePickerLanguageAsset::register($view);
         $view->registerJsFile($bundle->baseUrl . "/ui/i18n/datepicker-{$this->language}.js", ['depends' => [JuiAsset::className()]]);
     }
     if (!empty($this->clientEvents)) {
         foreach ($this->clientEvents as $event => $handler) {
             $view->registerJs("jQuery('#{$containerID}').on('{$event}', {$handler});");
         }
     }
     $view->registerJs("jQuery('#{$containerID}').{$this->mode}picker({$options});");
 }
Ejemplo n.º 2
0
 /**
  * Register widget assets.
  */
 public function registerClientScript()
 {
     $view = $this->getView();
     $containerID = $this->inline ? $this->containerOptions['id'] : $this->options['id'];
     $language = $this->language ? $this->language : Yii::$app->language;
     $name = $this->mode . 'picker';
     $timeAssetBundle = TimePickerAsset::register($view);
     if ($language !== 'en-US') {
         $timeAssetBundle->language = $language;
         $dateAssetBundle = DatePickerLanguageAsset::register($view);
         $dateAssetBundle->language = $language;
     }
     $this->registerClientOptions($name, $containerID);
     $this->registerClientEvents($name, $containerID);
 }