Esempio n. 1
0
        format:'YYYY-MM-DD HH:mm:ss'
    });

JS_CODE;
    }
}
$upload_fields = json_encode($fileInput);
$js .= <<<JS_CODE
var upload_fields = {$upload_fields};
for(var i=0;i<upload_fields.length;i++)
{
    uploader(upload_fields[i]);
}
JS_CODE;
if (in_array('colorPicker', $inputType)) {
    \backend\assets\ColorPickerAsset::register($this);
    $js .= <<<JS_CODE

\$('.colorPicker').colorPicker({
        renderCallback: function(\$elm, toggled) {
        var colors = this.color.colors;
        if(colors.HEX!='FFFFFF')
            \$elm.val('#' + colors.HEX);
        else
            \$elm.val('');
    }
}); // that's it
JS_CODE;
}
$this->registerJs($js);
if (in_array('fileInput', $inputType)) {
Esempio n. 2
0
use yii\helpers\ArrayHelper;
use common\models\cms\Column;
use backend\components\ueditor\UeditorWidget;
use common\models\cms\Flag;
use backend\assets\ColorPickerAsset;
// use backend\assets\iCheckAsset;
// use backend\assets\Select2Asset;
use backend\assets\BootstrapDatePickerAsset;
use kartik\file\FileInput;
use common\helpers\General;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\cms\cmsdownload */
/* @var $form yii\widgets\ActiveForm */
//注入相关插件
ColorPickerAsset::register($this);
// iCheckAsset::register($this);
// Select2Asset::register($this);
BootstrapDatePickerAsset::register($this);
if ($model->isNewRecord) {
    $model->status = true;
    $model->hits = 100;
    $model->author = Yii::$app->getUser()->identity->username;
    $model->publish_at = date('Y-m-d H:i');
    //Yii::$app->getFormatter()->asDatetime(time(), 'Y-m-d H:i');
} else {
    $titleOptions = ['style' => ''];
    Html::addCssStyle($titleOptions, ['color' => $model->colorval, 'font-weight' => $model->boldval]);
    $model->publish_at = date('Y-m-d H:i', $model->publish_at);
    $model->flag = explode(',', $model->flag);
}