Esempio n. 1
0
 public function search($params)
 {
     $query = Preferences::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['changemark' => $this->changemark, 'id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'codes', $this->codes])->andFilterWhere(['like', 'name1', $this->name1])->andFilterWhere(['like', 'classmark', $this->classmark])->andFilterWhere(['like', 'classmarkcn', $this->classmarkcn]);
     return $dataProvider;
 }
Esempio n. 2
0
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'tagNames')->widget(\dosamigos\selectize\SelectizeTextInput::className(), ['loadUrl' => ['tag/list'], 'options' => ['class' => 'form-control'], 'clientOptions' => ['plugins' => ['remove_button'], 'valueField' => 'name', 'labelField' => 'name', 'searchField' => ['name'], 'create' => true]])->hint('提示:用逗号或者回车键分隔标签');
?>

    <?php 
echo $form->field($model, 'content')->widget(\kucha\ueditor\UEditor::className(), ['clientOptions' => ['initialFrameHeight' => '200', 'lang' => 'zh-cn', 'toolbars' => [['fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', '|', 'lineheight', '|', 'indent', '|']]]]);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Preferences::findAll(['classmark' => 'sStatus', 'status' => 1]), 'codes', 'name1'));
?>


  
	<?php 
if (!Yii::$app->request->isAjax) {
    ?>
	  	<div class="form-group">
	        <?php 
    echo Html::submitButton($model->isNewRecord ? '新增' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
    ?>
	    </div>
	<?php 
}
?>
Esempio n. 3
0
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
/**
 * @var yii\web\View $this
 * @var common\models\Preferences $model
 * @var yii\widgets\ActiveForm $form
 */
?>
<div class="preferences-form">

    <?php 
$form = ActiveForm::begin(['id' => 'preferences-form', 'type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 3]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'columnSize' => Form::SIZE_LARGE, 'attributes' => ['codes' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter 参数编码...', 'maxlength' => 4]], 'name1' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter 参数名称...', 'maxlength' => 80]], 'classmark' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter 项目分类-英文...', 'maxlength' => 30, 'value' => $model->isNewRecord && Yii::$app->request->get('create-classmark') ? Yii::$app->request->get('create-classmark') : $model->classmark]], 'classmarkcn' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter 项目分类-中文...', 'maxlength' => 50, 'value' => $model->isNewRecord && Yii::$app->request->get('create-classmark') ? \common\models\Preferences::getClassmarkcnByClassmark(Yii::$app->request->get('create-classmark')) : $model->classmarkcn]], 'status' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => $model->getStatusOptions()]]]);
?>
    <div class="form-group">
        <div class="col-sm-offset-3 col-sm-9">
            <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Save') : Yii::t('app', 'Update'), ['id' => 'btn-modal-footer', 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        </div>
    </div>
    <?php 
//echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Save') : Yii::t('app', 'Update'), ['id' => 'btn-modal-footer','class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
ActiveForm::end();
?>
Esempio n. 4
0
 public function actionJson($classmark = '')
 {
     if ($classmark) {
         $models = Preferences::find()->andFilterWhere(['classmark' => $classmark])->all();
         $data = array_map(function ($model) {
             return $model->attributes;
         }, $models);
         $response = Yii::$app->response;
         $response->format = Response::FORMAT_JSON;
         $response->data = $data;
         $response->send();
         //等同于 return $response;
     }
     return '';
 }