示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Items::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, 'cat_id' => $this->cat_id, 'brend_id' => $this->brend_id, 'material' => $this->material, 'pie' => $this->pie, 'lad' => $this->lad, 'inlay' => $this->inlay, 'q_volume' => $this->q_volume, 'q_tone' => $this->q_tone]);
     $query->andFilterWhere(['like', 'strings', $this->strings])->andFilterWhere(['like', 'anker', $this->anker])->andFilterWhere(['like', 'form', $this->form])->andFilterWhere(['like', 'bridj', $this->bridj])->andFilterWhere(['like', 'shema', $this->shema])->andFilterWhere(['like', 'add', $this->add]);
     return $dataProvider;
 }
示例#2
0
文件: Order.php 项目: kotmonstr/gitar
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getItem()
 {
     return $this->hasOne(Items::className(), ['id' => 'item_id']);
 }
示例#3
0
文件: index.php 项目: kotmonstr/gitar
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

<!--    <p>-->
<!--        --><?//= Html::a('Create Order', ['create'], ['class' => 'btn btn-success']) ?>
<!--    </p>-->

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'email:email', 'tel', ['attribute' => 'Товар', 'format' => 'html', 'value' => function ($dataProvider) {
    return $dataProvider->item->name;
}], ['attribute' => 'фото товара', 'format' => 'html', 'value' => function ($dataProvider) {
    return Items::isgetImage($dataProvider->item_id) ? Html::img(Items::getNameByItemId($dataProvider->item_id), ['width' => 240, 'height' => 75]) : Html::img('/image/default.jpg', ['width' => 240, 'height' => 75]);
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
</div>
</div>
</div>
</div>

<script>
    $('.glyphicon-pencil').hide();

</script>
示例#4
0
文件: index.php 项目: kotmonstr/gitar
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Создать товар', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'name', 'format' => 'html', 'value' => function ($dataProvider) {
    return Html::a($dataProvider->name, '/items/update?id=' . $dataProvider->id, ['title' => 'Редактировать']);
}], ['attribute' => 'cat_id', 'format' => 'html', 'value' => function ($dataProvider) {
    return $dataProvider->cat->name;
}], ['attribute' => 'brend_id', 'format' => 'html', 'value' => function ($dataProvider) {
    return $dataProvider->brend->name;
}], ['attribute' => 'Основное фото', 'format' => 'html', 'value' => function ($dataProvider) {
    return Items::getMainPhoto($dataProvider->id, 240, 75);
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
</div>
</div>
</div>
</div>
示例#5
0
文件: view.php 项目: kotmonstr/gitar
                        class="glyphicon glyphicon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">
            <div class="row">
                <div class="items-view">

                    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

                    <p>
                        <?php 
echo Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
                        <?php 
echo Html::a('Удалить', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
                    </p>

                    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['name', ['attribute' => 'cat_id', 'format' => 'raw', 'value' => $model->cat->name], ['attribute' => 'brend_id', 'format' => 'raw', 'value' => $model->brend->name], 'strings', 'anker', 'form', 'bridj', 'material', ['attribute' => 'pie', 'value' => $model->pie ? 'Есть' : 'Нет'], 'lad', ['attribute' => 'inlay', 'value' => $model->inlay ? 'Есть' : 'Нет'], 'shema', 'q_volume', 'q_tone', 'add', 'price', ['attribute' => 'Основное Фото', 'format' => 'html', 'value' => Items::getMainPhoto($model->id)], ['attribute' => 'Дополнительные фото', 'format' => 'html', 'value' => Photo::getPhotosHTML($model->id)]]]);
?>

                </div>
            </div>
        </div>
    </div>
</div>
示例#6
0
文件: view.php 项目: kotmonstr/gitar
echo Url::toRoute('/order/index');
?>
" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">
            <div class="row">
<div class="order-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
<!--        --><?//= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?php 
echo Html::a('Удалить', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['name', 'email:email', 'tel', 'message:ntext', ['attribute' => 'created_at', 'value' => date("d.m.Y H:i:s", $model->created_at)], ['attribute' => 'item_id', 'value' => $model->item->name], ['attribute' => 'Фото', 'value' => Items::getNameByItemId($model->item_id), 'format' => $model->item_id ? ['image', ['width' => '150', 'height' => '150']] : ['image', ['width' => '0', 'height' => '0']]]]]);
?>

</div>
</div>
</div>
</div>
</div>
示例#7
0
文件: Brend.php 项目: kotmonstr/gitar
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getItems()
 {
     return $this->hasMany(Items::className(), ['brend_id' => 'id']);
 }
示例#8
0
 function getImageMain($imageId)
 {
     $imageName = Items::findOne($imageId);
     return $imageName->main_image ? '/upload/items_images_main/' . $imageName->main_image : '/image/default.jpg';
 }
示例#9
0
 public function actionGetItemsByCatId()
 {
     $id = Yii::$app->request->post('id');
     $modelItems = Items::getItemsByCatId($id);
     //vd($model);
     Yii::$app->response->format = Response::FORMAT_JSON;
     return $this->renderAjax('_get-items-by-cat-id', ['modelItems' => $modelItems]);
 }