Exemple #1
0
 public static function getPage($id, $num)
 {
     $cat = Categories::find()->where(['id' => $id])->one();
     $count = $cat->count_product;
     $realNum = $num + 1;
     $html = '';
     //достаем все жалюзи текущей категории
     $blinds = BlindCatid::find()->where(['id_cat' => $id])->offset($num * $count)->limit($count)->orderBy('id_blind DESC')->all();
     //получаем описание объекта жалюзи
     if (isset($blinds) && !empty($blinds)) {
         //start of page
         $html .= '<div class="page">';
         if ($realNum > 1) {
             $html .= '<div class="title">
                     <span>Страница ' . $realNum . '  </span>
                     <a href="#" class="hidepage">Скрыть</a>
                 </div>';
         }
         foreach ($blinds as $blind) {
             if (isset($blind)) {
                 $blindObj = Blind::find()->where(['id' => $blind->id_blind])->one();
                 //получаем картинки для жалюзи
                 $blindImgs = BlindImg::find()->where(['id_blind' => $blindObj->id])->orderBy('main DESC')->all();
             }
             if (isset($blindObj) && !empty($blindObj)) {
                 $html .= self::getItem($blindObj, $blindImgs);
             }
         }
         //end of page
         $html .= '</div>';
     }
     return $html;
 }
Exemple #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Blind::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, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
Exemple #3
0
 public function actionGet_order()
 {
     $blind = Blind::find()->where(['id' => $_GET['blId']])->one();
     $materials = \backend\modules\supplies\models\Supplies::find()->where(['id' => $_GET['mtId']])->one();
     $telephone = $_GET['tel'];
     $order = new Orders();
     $order->blind = (string) $blind->name;
     $order->materials = (string) $materials->code;
     $order->telephone = (string) $telephone;
     $order->dt_add = time();
     $order->save();
     echo $order->id;
     $email = Options::find()->where(['key' => 'email_to_prod'])->one();
     mail($email->value, "Заказ с вашего сайта", "С вашего сайта заказали:<br>Номер заказа: {$blind->id}<br>Название жалюзи: {$blind->name}<br>Код материала: {$materials->code}<br>Телефон для связ: {$telephone}", "Content-type: text/html; charset=UTF-8\r\n");
 }
Exemple #4
0
 public static function getBlind($id)
 {
     /*$html = '<div class="catalog_blocks">';*/
     $blinds = BlindCatid::find()->where(['id_cat' => $id])->all();
     $html = '';
     foreach ($blinds as $bl) {
         $product = Blind::find()->where(['id' => $bl->id_blind])->one();
         //Debag::prn($product);
         $html .= '<div class="product">
                 <a href="#">' . $product->name . '</a>
                 <div class="info">
                     <span></span>
                     <div class="hint">
                        ' . $product->description . '
                     </div>
                 </div>
             </div>';
     }
     /*$html .= '</div>';*/
     return $html;
 }
Exemple #5
0
 /**
  * Finds the Blind model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Blind the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Blind::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #6
0
}, 'filter' => "<input id='colorId' type='hidden' name='SuppliesSearch[color]' value='" . $_GET['SuppliesSearch']['color'] . "'>" . $color], ['attribute' => 'price', 'format' => 'raw', 'value' => function ($model) {
    return Html::textInput('price_' . $model->id, $model->price, ['id' => 'price_' . $model->id, 'class' => 'priceInput', 'style' => 'width:120px;']);
    //return "<input type='text' value='$model->code' name='code'>";
}], ['class' => DataColumn::className(), 'header' => 'Прикреплен', 'format' => 'raw', 'value' => function ($model) {
    $pageItem = \common\models\PageItem::find()->where(['id_item' => $model->id, 'item_type' => 'materials'])->all();
    foreach ($pageItem as $p) {
        $arr[] = $p->id_blind;
    }
    if (!empty($arr)) {
        $arr = array_unique($arr);
        $html = '';
        $html .= '<div class="blindToSupliesOne" style="width: 200px">';
        $k = 0;
        foreach ($arr as $p) {
            if ($p) {
                $title = \backend\modules\blind\models\Blind::find()->where(['id' => $p])->one();
                if ($k == 2) {
                    $html .= '</div><div class="blindToSuplies">';
                }
                $html .= '<li>' . $title->name . '<a href="#" class="undock" id-mat="' . $model->id . '" id-page="' . $p . '"> -</a></li>';
                $k++;
            }
        }
        $html .= '</div>';
        if ($k > 2) {
            $html .= '<a href="#" class="allBlindToSuplies">Показать все</a>';
        }
        return $html;
    } else {
        return '';
    }