/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ObjectGroupRecord::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, 'Deleted' => $this->Deleted, 'RoomID' => $this->RoomID, 'IsWicket' => $this->IsWicket, 'WicketCounter' => $this->WicketCounter, 'WicketLimit' => $this->WicketLimit]); $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'Description', $this->Description])->andFilterWhere(['like', 'Image', $this->Image]); return $dataProvider; }
* * (c) Dektrium project <http://github.com/dektrium> * * For the full copyright and license information, please view the LICENSE.md * file that was distributed with this source code. */ use common\models\cf\ObjectGroupRecord; use yii\bootstrap\Nav; use yii\helpers\Html; use yii\web\View; /** * @var View $this */ $this->title = Yii::t('app', 'Object Records'); $this->params['breadcrumbs'][] = $this->title; $objectGroups = ObjectGroupRecord::find()->all(); $tabs = []; $tabs[] = ['label' => 'Без группы', 'url' => ['/objects/index'], 'active' => isset($groupId) && $groupId === 0]; foreach ($objectGroups as $group) { $tabs[] = ['label' => $group->Name, 'url' => ['/objects/index', 'groupId' => $group->ID]]; } ?> <div class="row"> <div class="btn-group pull-right"> <?php echo Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('app', 'Create Object'), ['create', 'groupId' => isset($groupId) ? $groupId : 0], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('<i class="fa fa-object-ungroup"></i> ' . Yii::t('app', 'Create Object group'), ['/objects/create-group'], ['class' => 'btn btn-default']); ?> <?php
/* @var $model common\models\cf\ObjectRecord */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="object-record-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'Name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'GroupID')->dropdownList(\common\models\cf\ObjectGroupRecord::find()->select(['Name', 'ID'])->indexBy('ID')->column(), ['prompt' => 'Без группы']); ?> <?php echo $form->field($model, 'RoomID')->dropdownList(\common\models\cf\RoomRecord::find()->select(['Name', 'ID'])->indexBy('ID')->column(), ['prompt' => 'Выберите зал']); ?> <?php echo $form->field($model, 'HardID')->textInput(); ?> <?php echo $form->field($model, 'CoinPrice')->textInput(); ?> <?php