Blame view

protected/views/albumsSection/albums.php 3.88 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
  <?php
  /**
   * @var $this SportController
   * @var $albums Album[]
   */
  /** @var $items Album[] */
  $byYear = array();
  foreach ($albums as $album) {
  
      $y = (int)substr($album->date, 0, 4);
      if (!isset($byYear[$y])) $byYear[$y] = array();
      $byYear[$y][] = $album;
  }
  ?>
  <?php $this->renderPartial('//snippets/headerGallery'); ?>
  
  <div class="wrapper content-wrapper">
      <div class="col-wrapper">
          <div class="col2 aside-no-title">
              <?php $this->renderPartial('//snippets/bajaBanner');?>
              <?php $this->renderPartial('//sport/_sidebar');?>
          </div>
          <div class="col7">
              <h1><?php echo CHtml::encode($this->pageName);?></h1>
              <?php foreach ($byYear as $year => $items): ?>
              <h2><?php echo $year?> год</h2>
  
              <div class="sport-gallery-list">
                  <?php foreach ($items as $item): ?>
                  <div class="sport-gallery-item">
                      <div class="sport-gallery-preview">
                          <?php echo CHtml::link(CHtml::image($item->imageBehavior->getFileUrl('preview')), array('albumsSection/album', 'link' => $item->link))?>
  
                      </div>
                      <div class="sport-gallery-name">
                          <p>
                              <?php echo CHtml::link($item->i18n->name, array('albumsSection/album', 'link' => $item->link))?>
                              <br/>
                              <?php
                              $photoCount = $item->photoGalleryBehavior->getGalleryPhotoCount();
                              $videoCount = $item->videoGalleryBehavior->getGalleryPhotoCount();
                              echo Yii::t('site', '{n} фотографий|{n} фотографии|{n} фотографии|{n} фотографии', $photoCount), ', ';
                              echo Yii::t('site', '{n} видео|{n} видео|{n} видео|{n} видео', $videoCount)
                              ?></p>
                      </div>
                  </div>
                  <?php endforeach;?>
              </div>
              <?php endforeach; ?>
          </div>
          <div class="col3">
              <?php $this->renderPartial('//sport/_nearestEvents');?>
              <?php $this->renderPartial('//sport/_mediaFeed');?>
              <p class="section-title">
                  <?php
                  echo Yii::t('site', 'Актуальные новости автоспорта');
                  echo CHtml::link('', array('site/feed'), array('class' => 'rss-icon'));
                  ?></p>
              <?php foreach (SportController::getLatestNews() as $item): ?>
              <div class="news-item">
                  <div class="preview-img">
                      <?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)))?>
                  </div>
                  <div class="news-content">
                      <p>
                          <?php
                          $timestamp = CDateTimeParser::parse($item->date, 'yyyy-MM-dd hh:mm:ss');
                          echo CHtml::link($item->i18n->name, array('news/view', 'link' => $item->link, 'node_id' => Node::idByDataId('newsRoot', $item->newsCategory->news_root_id)));
                          echo '<br/> — ';
                          echo Yii::app()->getDateFormatter()->format('d MMMM yyyy', $timestamp);
                          ?>
                      </p>
                  </div>
              </div>
              <?php endforeach;?>
  
              <span><?php
                  /** @var $cat NewsCategory */
                  $cat = NewsCategory::model()->findByPk(2);
                  echo CHtml::link(Yii::t('site', 'Архив новостей'), array('news/category', 'link' => $cat->link, 'node_id' => Node::idByDataId('newsRoot', $cat->news_root_id)));
                  ?>»</span>
          </div>
      </div>
  </div>