zoukankan      html  css  js  c++  java
  • yiiwheels.widgets.datetimepicker.WhDateTimePicker language

    参考 https://github.com/2amigos/yiiwheels/blob/master/widgets/datetimepicker/WhDateTimePicker.php

    public function registerClientScript()
    {
    /* publish assets dir */
    $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
    $assetsUrl = $this->getAssetsUrl($path);
     
    /* @var $cs CClientScript */
    $cs = Yii::app()->getClientScript();
     
    $cs->registerCssFile($assetsUrl . '/css/bootstrap-datetimepicker.min.css');
    $cs->registerScriptFile($assetsUrl . '/js/bootstrap-datetimepicker.min.js', CClientScript::POS_END);
    if (isset($this->pluginOptions['language'])) {
    $cs->registerScriptFile(
    $assetsUrl . '/js/locales/bootstrap-datetimepicker.' . $this->pluginOptions['language'] . '.js'
    , CClientScript::POS_END);
    }
    /* initialize plugin */
    /* initialize plugin */
    $selector = null === $this->selector
    ? '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId()) . '_datetimepicker'
    : $this->selector;
     
    $this->getApi()->registerPlugin('datetimepicker', $selector, $this->pluginOptions);
     
    if($this->events)
    {
     
    $this->getApi()->registerEvents($selector, $this->events);
    }
    }

    如果本地的文件里没有红色标记的这句代码(CClientScript::POS_END)的话,请记得加上,再使用下面的方式即可

    <?php $this->widget(
                        'yiiwheels.widgets.datetimepicker.WhDateTimePicker',
                        array(
                              'name' => 'UserModel[expire_date]',
                              'value' => $model->expire_date,
                              'id' => 'expire_date',
                              'pluginOptions' => array(
                                  'format' => 'yyyy-MM-dd hh:mm:ss',
                                  'language' => 'zh-CN'
                                                      ),
                             )
                       );
                    ?>
    

      

  • 相关阅读:
    POJ1942-Paths on a Grid
    CodeForces 245C-Game with Coins
    codeforces 244B-Undoubtedly Lucky Numbers 搜索
    URAL
    HDU-1134 卡特兰数+java大数模板
    素数线性筛
    KMP讲解
    bzoj 3143: [Hnoi2013]游走
    bzoj 3238: [Ahoi2013]差异
    bzoj 2208: [Jsoi2010]连通数
  • 原文地址:https://www.cnblogs.com/debmzhang/p/3750076.html
Copyright © 2011-2022 走看看