コード例 #1
0
ファイル: Controller.php プロジェクト: 42point/Vinum
 public function prepareMenu()
 {
     switch ($this->lang) {
         case 19:
             $this->menu = array(0 => array('class' => 'card', 'model' => Content::model()->findByPk(1)), 1 => array('class' => 'product', 'model' => Content::model()->findByPk(2)), 2 => array('class' => 'gift', 'model' => Content::model()->findByPk(3)), 3 => array('class' => 'week l1', 'model' => Content::model()->findByPk(4)));
             $this->innerMenu = array(0 => array('class' => 'bottle_product', 'model' => CatalogCategories::model()->findByPk(1)), 1 => array('class' => 'alcohol_product', 'model' => CatalogCategories::model()->findByPk(2)), 2 => array('class' => 'fizz_product', 'model' => CatalogCategories::model()->findByPk(3)), 3 => array('class' => 'accessories_product', 'model' => CatalogCategories::model()->findByPk(4)), 4 => array('class' => 'read_wine_product', 'model' => NewsCategories::model()->findByPk(15)), 5 => array('class' => 'boutique_product', 'model' => null, 'url' => '/boutiques', 'name' => 'О бутиках'));
             $this->catalogMenu = array(0 => array('class' => 'bottle', 'model' => CatalogCategories::model()->findByPk(1)), 1 => array('class' => 'alcohol', 'model' => CatalogCategories::model()->findByPk(2)), 2 => array('class' => 'fizz', 'model' => CatalogCategories::model()->findByPk(3)), 3 => array('class' => 'accessories', 'model' => CatalogCategories::model()->findByPk(4)), 4 => array('class' => 'read_wine', 'model' => NewsCategories::model()->findByPk(15)), 5 => array('class' => 'boutique', 'model' => null, 'url' => '/boutiques', 'name' => 'О бутиках'));
             break;
         case 20:
             $this->menu = array(0 => array('class' => 'card l1', 'model' => Content::model()->findByPk(10)), 1 => array('class' => 'product l1', 'model' => Content::model()->findByPk(11)), 2 => array('class' => 'gift l1', 'model' => Content::model()->findByPk(12)), 3 => array('class' => 'week l1', 'model' => Content::model()->findByPk(13)));
             $this->innerMenu = array(0 => array('class' => 'bottle_product', 'model' => CatalogCategories::model()->findByPk(5)), 1 => array('class' => 'alcohol_product', 'model' => CatalogCategories::model()->findByPk(6)), 2 => array('class' => 'fizz_product', 'model' => CatalogCategories::model()->findByPk(7)), 3 => array('class' => 'accessories_product', 'model' => CatalogCategories::model()->findByPk(8)), 4 => array('class' => 'read_wine_product', 'model' => NewsCategories::model()->findByPk(9)), 5 => array('class' => 'boutique_product', 'model' => null, 'url' => '/boutiques', 'name' => 'About boutiques'));
             $this->catalogMenu = array(0 => array('class' => 'bottle', 'model' => CatalogCategories::model()->findByPk(5)), 1 => array('class' => 'alcohol', 'model' => CatalogCategories::model()->findByPk(6)), 2 => array('class' => 'fizz', 'model' => CatalogCategories::model()->findByPk(7)), 3 => array('class' => 'accessories', 'model' => CatalogCategories::model()->findByPk(8)), 4 => array('class' => 'read_wine', 'model' => NewsCategories::model()->findByPk(9)), 5 => array('class' => 'boutique', 'model' => null, 'url' => '/boutiques', 'name' => 'About boutiques'));
             break;
         case 21:
             $this->menu = array(0 => array('class' => 'card', 'model' => Content::model()->findByPk(14)), 1 => array('class' => 'product l1', 'model' => Content::model()->findByPk(15)), 2 => array('class' => 'gift', 'model' => Content::model()->findByPk(16)), 3 => array('class' => 'week l1', 'model' => Content::model()->findByPk(17)));
             $this->innerMenu = array(0 => array('class' => 'bottle_product', 'model' => CatalogCategories::model()->findByPk(9)), 1 => array('class' => 'alcohol_product', 'model' => CatalogCategories::model()->findByPk(10)), 2 => array('class' => 'fizz_product', 'model' => CatalogCategories::model()->findByPk(11)), 3 => array('class' => 'accessories_product', 'model' => CatalogCategories::model()->findByPk(12)), 4 => array('class' => 'read_wine_product', 'model' => NewsCategories::model()->findByPk(10)), 5 => array('class' => '', 'model' => null, 'url' => '/boutiques', 'name' => 'Boutiques'));
             $this->catalogMenu = array(0 => array('class' => 'bottle', 'model' => CatalogCategories::model()->findByPk(9)), 1 => array('class' => 'alcohol', 'model' => CatalogCategories::model()->findByPk(10)), 2 => array('class' => 'fizz', 'model' => CatalogCategories::model()->findByPk(11)), 3 => array('class' => 'accessories', 'model' => CatalogCategories::model()->findByPk(12)), 4 => array('class' => 'read_wine', 'model' => NewsCategories::model()->findByPk(10)), 5 => array('class' => 'boutique', 'model' => null, 'url' => '/boutiques', 'name' => 'Boutiques'));
             break;
         default:
             $this->menu = array(0 => array('class' => 'card l1', 'model' => Content::model()->findByPk(1)), 1 => array('class' => 'product l1', 'model' => Content::model()->findByPk(2)), 2 => array('class' => 'gift l1', 'model' => Content::model()->findByPk(3)), 3 => array('class' => 'week l1', 'model' => Content::model()->findByPk(4)));
             $this->innerMenu = array(0 => array('class' => 'bottle_product', 'model' => CatalogCategories::model()->findByPk(1)), 1 => array('class' => 'alcohol_product', 'model' => CatalogCategories::model()->findByPk(2)), 2 => array('class' => 'fizz_product', 'model' => CatalogCategories::model()->findByPk(3)), 3 => array('class' => 'accessories_product', 'model' => CatalogCategories::model()->findByPk(4)), 4 => array('class' => 'read_wine_product', 'model' => NewsCategories::model()->findByPk(15)), 5 => array('class' => 'boutique_product', 'model' => null, 'url' => '/boutiques', 'name' => 'О бутиках'));
             $this->catalogMenu = array(0 => array('class' => 'bottle', 'model' => CatalogCategories::model()->findByPk(1)), 1 => array('class' => 'alcohol', 'model' => CatalogCategories::model()->findByPk(2)), 2 => array('class' => 'fizz', 'model' => CatalogCategories::model()->findByPk(3)), 3 => array('class' => 'accessories', 'model' => CatalogCategories::model()->findByPk(4)), 4 => array('class' => 'read_wine', 'model' => NewsCategories::model()->findByPk(15)), 5 => array('class' => 'boutique', 'model' => null, 'url' => '/boutiques', 'name' => 'О бутиках'));
             break;
     }
 }
コード例 #2
0
ファイル: edit.php プロジェクト: 42point/Vinum
</li>
                                    <?php 
    }
    ?>
                            </ul>
                        </div>
                        <?php 
}
?>
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="form-group">
                                <label>Категория</label>
                                <select name="data[category_id]" class="form-control">
                                    <?php 
$categories = CatalogCategories::model()->findAll();
if (is_array($categories) && count($categories)) {
    foreach ($categories as $c) {
        ?>
                                            <option value="<?php 
        echo $c->id;
        ?>
"<?php 
        echo $model->category_id == $c->id ? ' selected="selected"' : '';
        ?>
><?php 
        echo CHtml::encode($c->name);
        ?>
</option>
                                            <?php 
    }
コード例 #3
0
ファイル: index.php プロジェクト: 42point/Vinum
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <a href="/admin/catalog/add" class="btn btn-success" title="Добавить товар"><i class="fa fa-plus"></i> Добавить товар</a>
                <a href="/admin/catalog/categories/add" class="btn btn-success" title="Добавить категорию"><i class="fa fa-plus"></i> Добавить категорию</a>
                <a href="/admin/catalog/categories/list" class="btn btn-success" title="Управление категориями"><i class="fa fa-sitemap"></i> Управление категориями</a>
                <a href="/admin/catalog/fields/list" class="btn btn-success" title="Управление характеристиками товара"><i class="fa fa-list-alt"></i> Управление характеристиками</a>
                <a href="/admin/catalog/import" class="btn btn-warning" title="Импорт товаров"><i class="fa fa-cloud-upload"></i> Импорт</a>
                <a href="/admin/catalog/settings" class="btn btn-primary" title="Курс валют"><i class="fa fa-cogs"></i></a>
            </div>
            <div class="panel-body">
                <?php 
$this->widget('CCustomGridView', array('id' => 'catalog-objects-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'cookey' => 'catalog-objects-size', 'columns' => array(array('name' => 'id', 'headerHtmlOptions' => array('style' => 'width: 50px')), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'category_id', 'value' => 'CatalogCategories::model()->findByPk($data->category_id)->name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right', 'type' => 'select', 'source' => CHtml::listData(CatalogCategories::model()->findAll(), "id", "name")), 'filter' => CHtml::listData(CatalogCategories::model()->findAll(), "id", "name"), 'headerHtmlOptions' => array('style' => 'width: 110px')), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right'), 'filter' => CHtml::tag("input", array("name" => "CatalogObjects[name]", "type" => "text", "class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'price', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right'), 'filter' => CHtml::tag("input", array("name" => "Content[price]", "type" => "text", "class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'lang_id', 'value' => 'ListsItems::model()->findByPk($data->lang_id)->name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right', 'type' => 'select', 'source' => CHtml::listData(ListsItems::model()->findAllByAttributes(array("list_id" => 11)), "id", "name")), 'filter' => CHtml::listData(ListsItems::model()->findAllByAttributes(array("list_id" => 11)), "id", "name"), 'headerHtmlOptions' => array('style' => 'width: 70px')), array('class' => 'CCustomTogleColumn', 'toggleAction' => 'toggleOnmain', 'name' => 'on_main', 'headerHtmlOptions' => array('style' => 'width: 120px')), array('class' => 'CCustomTogleColumn', 'toggleAction' => 'toggleActivity', 'name' => 'is_active', 'headerHtmlOptions' => array('style' => 'width: 120px')), array('header' => 'Действие', 'class' => 'CCustomButtonColumn')), 'pager' => array('class' => 'CCustomPager')));
?>
            </div>
        </div>
    </div>
</div>
コード例 #4
0
 public function actionCategory($category)
 {
     $model = CatalogCategories::model()->findByAttributes(array("url" => $category, "lang_id" => $this->lang));
     if (!is_object($model)) {
         $this->redirect("/notfound");
     }
     $this->currentCategory = $model;
     $this->pageDescription = $model->meta_description;
     $this->pageTitle = $model->title;
     $this->pageKeywords = $model->meta_keywords;
     $criteria = new CDbCriteria();
     $criteria->condition = "is_active = 1 AND is_deleted = 0";
     $criteria->addCondition("lang_id = " . $this->lang);
     $criteria->addCondition("category_id = " . $model->id);
     if (isset($_REQUEST['data'])) {
         $criteria->alias = 'co';
         $data = $_REQUEST['data'];
         if (is_array($data) && count($data)) {
             $criteria->join = "";
             $i = 0;
             foreach ($data as $fieldName => $items) {
                 $field = CatalogFilteredFields::model()->findByAttributes(array("category_id" => $model->id, "name" => $fieldName));
                 if (is_object($field) && is_array($items) && count($items)) {
                     $cond = '(';
                     $i1 = true;
                     foreach ($items as $item) {
                         if (is_numeric($item)) {
                             if (!$i1) {
                                 $cond .= "OR (`fv{$i}`.`field_id` = {$field->id} AND `fv{$i}`.`int_val` = {$item}) ";
                             } else {
                                 $cond .= "(`fv{$i}`.`field_id` = {$field->id} AND `fv{$i}`.`int_val` = {$item}) ";
                                 $i1 = false;
                             }
                         }
                     }
                     $cond .= ')';
                     $criteria->join .= "INNER JOIN `catalog_filtered_fields_values` AS `fv{$i}` ON `co`.`id` = `fv{$i}`.`object_id` " . "AND {$cond} ";
                     $i++;
                 }
             }
         }
     }
     if (isset($_REQUEST['min_price']) && isset($_REQUEST['max_price'])) {
         $criteria->addBetweenCondition('price', CatalogObjects::convertPrice($_REQUEST['min_price'], true), CatalogObjects::convertPrice($_REQUEST['max_price'], true));
     }
     $isAjax = isset($_REQUEST['ajax']);
     $count = CatalogObjects::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 6;
     if ($isAjax && (isset($_REQUEST['data']) || isset($_REQUEST['min_price']) || isset($_REQUEST['max_price']))) {
         unset($_REQUEST['ajax']);
         $pages->params = $_REQUEST;
     }
     $pages->applyLimit($criteria);
     $objects = CatalogObjects::model()->findAll($criteria);
     if ($isAjax) {
         $this->renderPartial('objects', array('objects' => $objects, 'pages' => $pages));
     } else {
         $banner = Content::model()->findByPk(5);
         $this->render("index", array('model' => $model, 'objects' => $objects, 'banner' => $banner, 'pages' => $pages));
     }
 }
コード例 #5
0
 public function actionToggleActivity()
 {
     if (isset($_REQUEST['pk'])) {
         $model = CatalogCategories::model()->findByPk($_REQUEST['pk']);
         if (is_object($model)) {
             $model->is_active = $model->is_active ? 0 : 1;
             if ($model->save()) {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #6
0
ファイル: index.php プロジェクト: 42point/Vinum
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <a href="/admin/catalog" class="btn btn-success" title="Вернуться к списку товаров"><i class="fa fa-reply"></i> К списку товаров</a>
                <a href="/admin/catalog/fields/add" class="btn btn-success" title="Добавить характеристику"><i class="fa fa-plus"></i> Добавить характеристику</a>
            </div>
            <div class="panel-body">
                <?php 
$types = array('' => '', 'varchar' => 'Строка', 'int' => 'Целое число', 'text' => 'Текст', 'html' => 'Html', 'date' => 'Дата', 'list' => 'Список', 'multiple' => 'Список с множественным выбором', 'bool' => 'Флаг');
$this->widget('CCustomGridView', array('id' => 'catalog-categories-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'cookey' => 'catalog-fields-size', 'columns' => array(array('name' => 'id', 'headerHtmlOptions' => array('style' => 'width: 100px')), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'category_id', 'value' => 'CatalogCategories::model()->findByPk($data->category_id)->name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right', 'type' => 'select', 'source' => CHtml::listData(CatalogCategories::model()->findAll(), "id", "name")), 'filter' => CHtml::dropDownList("CatalogFilteredFields[category_id]", '', array_merge(array('' => ''), CHtml::listData(CatalogCategories::model()->findAll(), "id", "name")), array("class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right'), 'filter' => CHtml::tag("input", array("name" => "CatalogFilteredFields[name]", "type" => "text", "class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'title', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right'), 'filter' => CHtml::tag("input", array("name" => "CatalogFilteredFields[title]", "type" => "text", "class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'data_type', 'value' => '$data->data_type', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right', 'type' => 'select', 'source' => $types), 'filter' => CHtml::dropDownList("CatalogFilteredFields[data_type]", '', $types, array("class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'rel', 'value' => '$data->rel ? Lists::model()->findByPk($data->rel)->name : "Не задано";', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'top', 'type' => 'select', 'source' => CHtml::listData(Lists::model()->findAll(), "id", "name")), 'filter' => '', 'headerHtmlOptions' => array('style' => 'width: 120px')), array('class' => 'CCustomTogleColumn', 'toggleAction' => 'toggleFiltered', 'name' => 'in_filter', 'filter' => '', 'headerHtmlOptions' => array('style' => 'width: 130px')), array('header' => 'Действие', 'class' => 'CCustomButtonColumn')), 'pager' => array('class' => 'CCustomPager')));
?>
            </div>
        </div>
    </div>
</div>