/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsObjectTypes::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getOType() { return $this->hasOne(CsObjectTypes::className(), ['id' => 'object_type_id']); }
<?php echo Yii::t('app', 'Requests Notifications'); ?> </label> <i class="fa fa-chevron-right chevron"></i> </div> <div class="wrapper" style="border-top:none;margin-bottom:10px !important;"> <?php echo $form->field($model, 'object_id', ['feedbackIcon' => ['default' => 'envelope', 'success' => 'ok', 'error' => 'exclamation-sign', 'defaultOptions' => ['class' => 'text-primary']]])->textInput(); ?> <?php echo $form->field($model, 'object_type_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjectTypes::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Select object type ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'ime')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'loc_id')->widget(GooglePlacesAutoComplete::className(), ['autocompleteOptions' => []]); ?> <?php echo $form->field($model, 'note')->textInput(['maxlength' => true]); ?> <?php
<?php echo $form->field($model_trans, 'name_pl_gen')->input(['value' => $model->name]); ?> <?php echo $form->field($model_trans, 'name_gender')->dropDownList(['m' => 'muški', 'f' => 'ženski', 'n' => 'srednji'], ['style' => 'width:50%']); ?> <hr> <?php echo $form->field($model, 'object_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjects::find()->all(), 'id', 'tName'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]); ?> <?php echo $form->field($model, 'object_type_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjectTypes::find()->all(), 'id', 'tName'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]); ?> <?php echo $form->field($model, 'class')->dropDownList(['abstract' => 'abstract', 'object' => 'object', 'product' => 'product', 'model' => 'model', 'part' => 'part'], ['style' => 'width:50%']); ?> <?php echo $form->field($model, 'favour')->checkbox()->label(); ?> <?php echo $form->field($model, 'imageFile')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['previewFileType' => 'any', 'showCaption' => false, 'showUpload' => false, 'browseClass' => 'btn btn-info shadow', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => Yii::t('app', 'Izaberite slike ili PDF'), 'removeLabel' => Yii::t('app', 'Izbaci sve'), 'resizeImage' => true, 'maxImageWidth' => 200, 'maxImageHeight' => 200, 'resizePreference' => 'width']]); ?> <?php
/** * Finds the CsObjectTypes model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CsObjectTypes the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsObjectTypes::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }