예제 #1
0
 public function actionCategory($category)
 {
     // главная страница категории новостей
     $model = NewsCategories::model()->findByAttributes(array("url" => $category));
     if (empty($model)) {
         $this->redirect("/");
     }
     if ($category == "novosti" || $category == "news" || $category == "Nouvelles") {
         $this->pageTitle = $model->title;
         $criteria = new CDbCriteria();
         $criteria->condition = "category_id =" . $model->id;
         $criteria->addCondition("lang_id = " . $this->lang);
         $modelNews = News::model()->findAll($criteria);
         $this->render("indexNovosti", array("content" => $modelNews, "categoryid" => $model->id, "categoryName" => $category));
     } else {
         $this->pageTitle = $model->title;
         $criteria = new CDbCriteria();
         $criteria->condition = "is_active=1 AND category_id =" . $model->id;
         $criteria->addCondition("lang_id = " . $this->lang);
         $modelNews = News::model()->findAll($criteria);
         $nCriteria = new CDbCriteria();
         $nCriteria->condition = "lang_id =" . $this->lang . " AND is_active=1";
         $ArtNewCategories = NewsCategories::model()->findAll($nCriteria);
         $this->render("indexEct", array("content" => $modelNews, "categories" => $ArtNewCategories));
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 /**
  * Returns the static model of the specified AR class.
  * @param string $className active record class name.
  * @return ANewsCategories the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
예제 #4
0
        echo count($modelNews);
        ?>
 <?php 
        echo Localization::translate("result_name_search", $this->lang);
        ?>
</a></p>
                    <div id="new-aboutWine" class="clearfix">
                    <div id="blog" class="clearfix">
                    <?php 
        if (!empty($modelNews)) {
            $i = 0;
            foreach ($modelNews as $object) {
                if ($i == 3) {
                    break;
                }
                $url = NewsCategories::model()->findByAttributes(array("id" => $object->category_id));
                ?>
					  <div class="cellule">
                            <a href="/news/<?php 
                echo $url->url;
                ?>
/<?php 
                echo $object->url;
                ?>
" class="bondfoto"><img src="<?php 
                echo $object->anons_pic;
                ?>
" alt="<?php 
                echo $object->name;
                ?>
"></a>
예제 #5
0
 public function actionToggleActivity()
 {
     if (isset($_REQUEST['pk'])) {
         $model = NewsCategories::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
파일: indexView.php 프로젝트: 42point/Vinum
				  
		
				  
                        <div class="blog_rock clearfix">
								  <?php 
if (!empty($model->related)) {
    foreach ($model->related as $numb) {
        $array[] = $numb->related_object_id;
    }
    $criteria = new CDbCriteria();
    $criteria->addInCondition('id', $array);
    $svNews = News::model()->findAll($criteria);
    $i = 0;
    foreach ($svNews as $items) {
        $criteriaa = new CDbCriteria();
        $svNews = NewsCategories::model()->findByAttributes(array("id" => $items->category_id));
        $url = "/news/" . $svNews->url . "/" . $items->url;
        if ($i == 0) {
            $class = "rock_content";
        } else {
            $class = "";
        }
        ?>
								   <div class="cellule <?php 
        echo $class;
        ?>
">
										<a href="<?php 
        echo $url;
        ?>
" class="bondfoto"><img src="<?php 
예제 #7
0
파일: add.php 프로젝트: 42point/Vinum
                                        <?php 
    }
    ?>
                                    </select>
                                    <?php 
}
?>
                            </div>
                            <div class="form-group">
                                <label>Название</label>
                                <input type="text" name="data[name]" value="" class="form-control alt-name-source copy-to" />
                            </div>
                            <div class="form-group">
                                <label>Категория</label>
                                <?php 
$categories = NewsCategories::model()->findAllByAttributes(array("is_active" => 1, "is_deleted" => 0));
if (is_array($categories) && count($categories)) {
    ?>
                                    <select name="data[category_id]" class="form-control">
                                    <?php 
    foreach ($categories as $cat) {
        ?>
                                        <option value="<?php 
        echo $cat->id;
        ?>
"><?php 
        echo CHtml::encode($cat->name);
        ?>
</option>
                                        <?php 
    }
예제 #8
0
파일: index.php 프로젝트: 42point/Vinum
</div>
<?php 
}
if (isset($news) && is_array($news) && count($news)) {
    switch ($this->lang) {
        case 19:
            $category = NewsCategories::model()->findByPk(1);
            break;
        case 20:
            $category = NewsCategories::model()->findByPk(7);
            break;
        case 21:
            $category = NewsCategories::model()->findByPk(8);
            break;
        default:
            $category = NewsCategories::model()->findByPk(1);
            break;
    }
    ?>
<div id="news"  class="clearfix">
    <div class="about"><a href="<?php 
    echo $category->getUrl();
    ?>
"><?php 
    echo $category->name;
    ?>
</a></div>
    <div class="cellNews">
        <ul>
            <?php 
    function renderMonthName($monthValue, $lang)
예제 #9
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/news/add" class="btn btn-success" title="Добавить новость"><i class="fa fa-plus"></i> Добавить новость</a>
                <a href="/admin/news/categories/add" class="btn btn-success" title="Добавить категорию"><i class="fa fa-plus"></i> Добавить категорию</a>
                <a href="/admin/news/categories/list" class="btn btn-success" title="Управление категориями">Управление категориями</a>
            </div>
            <div class="panel-body">
                <?php 
$this->widget('CCustomGridView', array('id' => 'news-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'cookey' => 'news-size', 'columns' => array(array('name' => 'id', 'headerHtmlOptions' => array('style' => 'width: 100px')), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'category_id', 'value' => 'NewsCategories::model()->findByPk($data->category_id)->name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right', 'type' => 'select', 'source' => CHtml::listData(NewsCategories::model()->findAll(), "id", "name")), 'filter' => CHtml::dropDownList("News[category_id]", '', CHtml::listData(NewsCategories::model()->findAll(), "id", "name"), array("class" => "form-control")), 'headerHtmlOptions' => array('style' => 'width: 130px')), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'name', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right'), 'filter' => CHtml::tag("input", array("name" => "News[name]", "type" => "text", "class" => "form-control"))), array('class' => 'booster.widgets.TbEditableColumn', 'name' => 'url', 'editable' => array('url' => $this->createUrl('eip'), 'placement' => 'right'), 'filter' => CHtml::tag("input", array("name" => "News[url]", "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::dropDownList("News[lang_id]", '', array_merge(array('' => ''), CHtml::listData(ListsItems::model()->findAllByAttributes(array("list_id" => 11)), "id", "name")), array("class" => "form-control")), 'headerHtmlOptions' => array('style' => 'width: 70px')), 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>