Blame view

protected/views/news/index.php 5 KB
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
  <?php
  /**
   * @var $this NewsController
   * @var $news News[]
   * @var $contacts Contact[]
   * @var $pages CPagination
   * @var $category NewsCategory
   */
  ?>
  <?php $this->renderPartial('//snippets/headerGallery'); ?>
  
  <div class="wrapper content-wrapper">
      <div class="col-wrapper">
          <div class="col2">
              <p class="section-title"><?php echo Yii::t('site', 'Рубрики');?></p>
              <ul class="sidebar-nav">
                  <?php
                  foreach ($this->getNewsCategories() as $item) {
                      if (isset($category) && $category->id == $item->id)
                          echo '<li class="active">';
                      else
                          echo '<li>';
                      if ($item->type == 2)
                          echo CHtml::link($item->i18n->name, array('news/publications', 'link' => $item->link)), '</li>';
                      elseif ($item->type == 1 || $item->type == 3)
                          echo CHtml::link($item->i18n->name, array('news/category', 'link' => $item->link)), '</li>';
                      else
                          echo CHtml::link($item->i18n->name, array('news/show', 'link' => $item->link)), '</li>';
                  }
                  ?>
              </ul>
          </div>
          <div class="col8">
              <h1><?php echo CHtml::encode($this->pageName);?></h1>
  
              <div class="news-page-list">
                  <?php foreach ($news as $item): ?>
                  <div class="news-page-item">
                      <h2><?php echo CHtml::link($item->i18n->name, array('news/view', 'link' => $item->link, 'node_id'=>Node::idByDataId('newsRoot', $item->newsCategory->news_root_id)))?></h2>
  
                      <p class="news-info">
                          <?php
                          $timestamp = CDateTimeParser::parse($item->date, 'yyyy-MM-dd hh:mm:ss');
                          echo Yii::app()->getDateFormatter()->format('d MMMM yyyy', $timestamp);
                          echo ' ', Yii::t('site', 'Рубрика'), ': ';
                          echo CHtml::link($item->newsCategory->i18n->name, array('news/category', 'link' => $item->newsCategory->link))
                          ?>
                      </p>
  
                      <div class="text-content">
                          <?php echo CHtml::link(CHtml::image($item->imageBehavior->getFileUrl('preview')), array('news/view', 'link' => $item->link, 'node_id'=>Node::idByDataId('newsRoot', $item->newsCategory->news_root_id)));?>
  
                          <?php echo $item->i18n->short?>
                      </div>
                      <div class="soc-share">
                          <?php
                          $this->renderPartial('//snippets/likes', array(
                              'url' => $this->createAbsoluteUrl('news/view', array('link' => $item->link, 'node_id'=>Node::idByDataId('newsRoot', $item->newsCategory->news_root_id))),
                          ));
                          ?>
                      </div>
                  </div>
                  <?php endforeach;?>
              </div>
              <div class="paginator-wrapper">
                  <div class="paginator-to-left">
                      <div class="paginator-to-right">
                          <?php $this->widget(
                          'LinkPager',
                          array(
                              'pages' => $pages,
                              'cssFile' => false,
                              'nextPageLabel' => Yii::t('site', 'Следующая'),
                              'prevPageLabel' => Yii::t('site', 'Предыдущая'),
                              'header' => false, //Yii::t('site', 'Страницы:'),
                          ));  ?>
  
                      </div>
                  </div>
              </div>
              <?php //$this->renderPartial('_newsFooter');?>
          </div>
          <div class="col2">
  
              <p class="section-title"><?php echo Yii::t('site','Контакты для прессы');?></p>
  
              <div class="text-content">
                  <?php echo Yii::t('site','По всем вопросам связанным с прессой обращайтесь в наш PR-отдел');?>
              </div>
  
              <?php $this->renderPartial('//snippets/sidebarContacts');?>
  
              <?php
              if (isset($category)) {
                  $this->renderPartial('_photofact', array('galleryIds' => array($category->photofact_gallery_id)));
              } else {
                  /** @var $cats NewsCategory[] */
                  $cats = NewsCategory::model()->findAll();
                  $galleryIds = array();
                  foreach($cats as $cat){
                      if(isset($cat->photofact_gallery_id))
                          $galleryIds[]=$cat->photofact_gallery_id;
                  }
                  $this->renderPartial('_photofact', array('galleryIds' => $galleryIds));
              }
              ?>
          </div>
      </div>
      <div class="col-wrapper">
          <div class="col2">&nbsp;</div>
          <div class="col10">
              <?php $this->renderPartial('_newsFooter');?>
          </div>
      </div>
  </div>