/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Type::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'typeCreate' => $this->typeCreate, 'typeUpdate' => $this->typeUpdate]); $query->andFilterWhere(['like', 'typeName', $this->typeName])->andFilterWhere(['like', 'typeDesc', $this->typeDesc]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use common\models\Service; use common\models\Type; $types = ArrayHelper::map(Type::find()->asArray()->all(), 'type_id', 'title'); $services = ArrayHelper::map(Service::find()->where(['parent_id' => 0])->asArray()->all(), 'id', 'title'); ?> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <div class="row"> <div class="col-md-4"> <?php echo $form->field($model, 'landing_id')->textInput(['readonly' => true]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'type_id')->dropDownList($types); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'service_id')->dropDownList($services); ?> </div>
?> <?php if ($model->documentImage) { echo '<img src="' . \Yii::$app->request->BaseUrl . '/' . $model->documentImage . '" width="90px"> '; //echo Html::a('Delete Logo', ['uploads/', 'id'=>$model->id, 'field'=> 'documentImage'], ['class'=>'btn btn-danger']).'<p>'; } ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(\common\models\Category::find()->all(), 'id', 'categoryName'), ['prompt' => 'Category']); ?> <?php echo $form->field($model, 'type_id')->dropDownList(ArrayHelper::map(\common\models\Type::find()->all(), 'id', 'typeName'), ['prompt' => 'Type']); ?> <?php echo $form->field($model, 'priority_id')->dropDownList(ArrayHelper::map(\common\models\Priority::find()->all(), 'id', 'priorityName'), ['prompt' => 'Priority']); ?> <?php echo $form->field($model, 'companyAgency_id')->dropDownList(ArrayHelper::map(\common\models\Companyagency::find()->all(), 'id', 'companyAgencyName'), ['prompt' => 'Company Agency']); ?> <?php echo $form->field($model, 'section_id')->dropDownList(ArrayHelper::map(\common\models\Section::find()->all(), 'id', 'sectionName'), ['prompt' => 'Section']); ?> <div class="form-group">
static function getNotLandingBlocks($blocks_id_selected) { $models = Type::find()->where(['not in', 'type_id', $blocks_id_selected]); return $models; }
/** * Lists all Type models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Type::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
echo $form->field($model, 'file')->fileInput(); ?> </div> <div class="column2"> <?php echo $form->field($model, 'profilenumber')->textInput(['maxlength' => true, 'style' => 'width: 300px']); ?> <?php echo $form->field($model, 'sex')->dropDownList(['Male' => 'Male', 'Female' => 'Female'], ['prompt' => 'Select your sex', 'style' => 'width: 300px']); ?> <?php $type = Type::find()->all(); $listData = ArrayHelper::map($type, 'type_id', 'type_name'); echo $form->field($model, 'type_id')->dropDownList($listData, ['prompt' => 'Select position', 'style' => 'width: 300px']); ?> <?php $precinct = Precinct::find()->all(); $listData = ArrayHelper::map($precinct, 'precinct_id', 'precinctnumber'); echo $form->field($model, 'precinct_id')->dropDownList($listData, ['prompt' => 'Select your precinct', 'style' => 'width: 300px']); ?> </div> <div class="column3"> <?php echo $form->field($model, 'mothers_maiden_name')->textInput(['maxlength' => true, 'style' => 'width: 300px']); ?>