Example #1
0
File: index.php Project: apuc/admin
    $cat = \common\models\BlindCatid::find()->where(['id_blind' => $model->id])->all();
    $title = '<ul>';
    foreach ($cat as $c) {
        $catObj = \backend\modules\category\models\Category::find()->where(['id' => $c->id_cat])->one();
        $title .= "<li>" . $catObj->name . "</li>";
    }
    $title .= "</ul>";
    return $title;
}], ['attribute' => 'status', 'format' => 'text', 'value' => function ($model) {
    if ($model->status == 1) {
        return 'Опубликовано';
    } else {
        return 'Не опубликовано';
    }
}], ['class' => DataColumn::className(), 'header' => 'Цена', 'format' => 'html', 'value' => function ($model) {
    $page2BlindID = PageToBlind::find()->where(['id_blind' => $model->id])->all();
    $supIds = [];
    foreach ($page2BlindID as $page) {
        $s = PageItem::find()->where(['id_page' => $page->id_pages, 'item_type' => 'materials'])->all();
        $supIds = array_merge($supIds, $s);
    }
    foreach ($supIds as $s) {
        $sup = Supplies::find()->where(['id' => $s->id_item])->one();
        $prices[] = $sup->price;
    }
    if (isset($prices) && !empty($prices)) {
        $pricesMin = min($prices);
        $pricesMax = max($prices);
    }
    return "<div style='width: 100px'>" . $pricesMin . " - " . $pricesMax . "</div>";
}], ['class' => DataColumn::className(), 'header' => 'Действия', 'format' => 'html', 'value' => function ($model) {
Example #2
0
 public function actionDel_page_blind()
 {
     $id = PageBlinds::find()->where(['name' => $_GET[id]])->one();
     $del = PageToBlind::deleteAll(['id_pages' => $id->id]);
 }
Example #3
0
 public static function getSupplies($id, $idPage = 0)
 {
     if ($idPage == 0) {
         $page = PageToBlind::find()->where(['id_blind' => $id])->one();
         $idPage = $page->id_pages;
     }
     $allPagess = PageToBlind::find()->where(['id_blind' => $id])->all();
     /*Debag::prn($allPagess);*/
     $i = 0;
     $count = count($allPagess);
     foreach ($allPagess as $ap) {
         if ($ap->id_pages == $idPage) {
             $next = $allPagess[$i + 1]->id_pages;
             if ($i == 0) {
                 $end = end($allPagess);
                 $end = $end->id_pages;
             } else {
                 if ($i == $count - 1) {
                     $next = $allPagess[0]->id_pages;
                 }
                 $end = $allPagess[$i - 1]->id_pages;
             }
         }
         $i++;
     }
     $html = '
             <div class="title">
                 <b>Вызов</b> <span>замерщика с образцами</span> бесплатный<br>
                 Бесплатное <span>3D моделирование жалюзей</span> <b>на ваших окнах</b>
             </div>
                 <a href="#" class="close"></a>
                 <a href="#" class="cause">Вызвать замерщика</a>
             <div class="popup_content">
                 <div class="prices">';
     $html .= PageBlinds::getNameTitle($idPage);
     if ($count > 1) {
         $html .= '<a href="#" id-page="' . $end . '" id-blind="' . $id . '" class="left pageChange">' . PageBlinds::getNameTitle($end) . '</a>
                     <a href="#" id-page="' . $next . '" id-blind="' . $id . '" class="right pageChange">' . PageBlinds::getNameTitle($next) . '</a>';
     }
     $html .= '</div>';
     //$supplies = BlindIdmaterials::find()->where(['id_blind'=>$id])->all();
     $supplies = PageItem::find()->where(['id_page' => $idPage])->all();
     /*$blm = BlindMaterials::find()->where(['id_blind'=>$id])->all();
       foreach($blm as $b){
           $arrBlmID[] = $b->id_materials;
       }*/
     $k = 1;
     $j = 0;
     foreach ($supplies as $v) {
         //$supl = \backend\modules\supplies\models\Supplies::find()->where(['id'=>$v->id_materials])->one();
         if ($v->item_type == 'zagolovok') {
             $zag = PageForTitle::getName($v->id_item);
             if ($j != 0) {
                 $html .= "</div></div></div>";
             } else {
                 $j = 1;
             }
             $html .= '<div class="group">
                         <div class="title">' . $zag . '</div>
                         <div class="group_items">';
             $k = 1;
             continue;
             //echo self::getTitle($id,$v->id_materials).'<br>';
         }
         $supl = \backend\modules\supplies\models\Supplies::find()->where(['id' => $v->id_item])->one();
         if ($k == 1) {
             $html .= '<div class="line">';
         }
         $html .= '<div class="item">
                     <a href="#"><img src="' . $supl->images . '" alt="" width="163px"/></a>
                     <span>Код: ' . $supl->code . '</span>
                     <a href="#" class="order" blind-id="' . $id . '" suuples-id="' . $v->id_item . '">Заказать</a>
                 </div>';
         if ($k == 5) {
             $html .= '</div>';
             $k = 1;
         }
         if ($v->item_type == 'zagolovok') {
             $html .= '';
             //echo self::getTitle($id,$v->id_materials).'<br>';
         }
         $k++;
     }
     $html .= '</div></div></div></div>';
     return $html;
 }
Example #4
0
File: _form.php Project: apuc/admin
echo $form->field($model, 'description')->widget(CKEditor::className(), ['editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions('elfinder', ['preset' => 'standard', 'inline' => false])]);
?>
        </div>
        <div id="panel2" class="tab-pane fade <?php 
echo $tabContent2;
?>
">
            <h3>Материалы</h3>

            <?php 
echo $form->field($model, 'pagename')->textInput(['maxlength' => true, 'class' => 'form-control pagenameInp']);
?>
<a class="btn btn-success" href="#" id="addPage">Добавить страницу</a>
            <hr>
           <?php 
$pages = \common\models\PageToBlind::find()->where(['id_blind' => $blind->id])->all();
$ul = '';
$k = 0;
foreach ($pages as $p) {
    if ($k == 0) {
        $title = \common\models\PageBlinds::getNameTitleAdmin($p->id_pages);
        $inp = $title;
        $title = str_replace(' ', '_', $title);
        //$ul .= '<li class="active"><a href="#panel'.$title.'">'.$title.'</a><span page-id="'.$title.'" class="delPages">x</span></li>';
        $ul .= '<li class="active"><a href="#panel' . $title . '"><input id-page="' . $title . '" type="text" class="insetName" value="' . $inp . '"/></a><span page-id="' . $title . '" class="delPages">x</span></li>';
        $page = \common\models\PageItem::find()->where(['id_page' => $p->id_pages])->all();
        $html = '<div id="panel' . $title . '" class="tabPanel activeMy"><h3>' . $inp . '</h3>';
        $html .= '<table id="t_' . $title . '" class="table table-bordered">';
        foreach ($page as $pg) {
            if ($pg->item_type == 'materials') {
                $html .= \common\classes\Supplies::getOneAddSupplies($pg->id_item, $title);
Example #5
0
 public static function getCount($id)
 {
     //Debag::prn($id);
     //$sup = Supplies::find()->where(['type_blind' => $id])->all();
     $page2BlindID = PageToBlind::find()->where(['id_blind' => $id])->all();
     $supIds = [];
     foreach ($page2BlindID as $page) {
         $s = PageItem::find()->where(['id_page' => $page->id_pages, 'item_type' => 'materials'])->all();
         $supIds = array_merge($supIds, $s);
     }
     $colors = [];
     $materials = [];
     $count = [];
     $prices = [];
     foreach ($supIds as $s) {
         $sup = Supplies::find()->where(['id' => $s->id_item])->one();
         //Debag::prn($sup);
         $colors[] = $sup->color;
         $materials[] = $sup->type_mat;
         $prices[] = $sup->price;
     }
     $colors = count(array_unique($colors));
     $materials = count(array_unique($materials));
     //Debag::prn($prices);
     if (isset($prices) && !empty($prices)) {
         $prices = min($prices);
         $count['min_price'] = $prices;
     }
     $count['colors'] = $colors;
     $count['materials'] = $materials;
     //$count['min_price']= $prices;
     // Debag::prn($colors);
     return $count;
 }