Exemple #1
0
 public function getParts($withChild = false)
 {
     $result = $this->hasMany(ServicesPartsRecord::className(), ['serviceId' => 'id', 'lang' => 'lang'])->position();
     if (!$withChild) {
         $result->andWhere(['parentId' => 0]);
     }
     return $result;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ServicesPartsRecord::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, 'serviceId' => $this->serviceId, 'position' => $this->position]);
     $query->andFilterWhere(['like', 'lang', $this->lang])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
Exemple #3
0
 public function getChilds()
 {
     return $this->hasMany(ServicesPartsRecord::className(), ['parentId' => 'id', 'lang' => 'lang'])->position();
 }
Exemple #4
0
                <?php 
}
?>
                <?php 
echo $form->field($model, '[' . $k . ']position')->textInput();
?>
            </div>
        </div>

        <?php 
if (!$model->isNewRecord) {
    ?>
            <div class="well">
            <h4>Части</h4>
            <?php 
    echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getParts(true), 'pagination' => false]), 'columns' => [['attribute' => 'parentId', 'value' => 'parent.title', 'filter' => \app\modules\services\models\ServicesPartsRecord::dropdown($model->id)], 'title', 'content', ['class' => \yii\grid\ActionColumn::className(), 'template' => '{update} {delete}', 'controller' => 'parts', 'header' => Html::a('<i class="glyphicon glyphicon-plus"></i>&nbsp; Добавить', ['parts/create', 'serviceId' => $model->id, 'lang' => $model->lang])]]]);
    ?>
            </div>

            <div class="well">
                <h4>Портфолио</h4>
                <?php 
    echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getPortfolio()->position(), 'pagination' => false]), 'columns' => ['title', ['class' => \app\modules\core\components\ImageColumn::className()], 'content', ['class' => \yii\grid\ActionColumn::className(), 'template' => '{update} {delete}', 'controller' => 'portfolio', 'header' => Html::a('<i class="glyphicon glyphicon-plus"></i>&nbsp; Добавить', ['portfolio/create', 'serviceId' => $model->id, 'lang' => $model->lang])]]]);
    ?>
            </div>
        <?php 
}
?>
    </div>

</div>
Exemple #5
0
    <div class="well">

        <div class="row">
            <div class="col-md-6">
                <?php 
echo $form->field($model, '[' . $k . ']title')->textInput(['maxlength' => true]);
?>
                <?php 
echo \app\modules\core\widgets\IconWidget::widget();
?>
                <?php 
echo $form->field($model, '[' . $k . ']icon')->textInput();
?>
                <?php 
echo $form->field($model, '[' . $k . ']position')->textInput();
?>
            </div>
            <div class="col-md-6">
                <?php 
echo $form->field($model, '[' . $k . ']parentId')->dropDownList(\app\modules\services\models\ServicesPartsRecord::dropdown($model->serviceId), ['prompt' => 'Выбор категории']);
?>
                <?php 
echo $form->field($model, '[' . $k . ']content')->widget(\app\modules\core\components\Redactor::className());
?>
            </div>
        </div>

    </div>

</div>