Blame view

protected/controllers/AlbumsSectionController.php 1.64 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
  <?php
  
  class AlbumsSectionController extends NodeSectionController
  {
      /** @var SportRoot */
      public $sportRoot;
  
      public function init()
      {
          parent::init();
          $this->sportRoot = SportRoot::model()->with('i18n')->findByPk($this->getRootNode()->data_id);
          $this->headerGalleryId = $this->sportRoot->header_gallery_id;
      }
  
      public function actionAlbum($link)
      {
          /** @var $albumsSection AlbumsSection */
          $albumsSection = AlbumsSection::model()->with('i18n')->findByPk($this->getNode()->data_id);
          $this->sectionGalleryId = $albumsSection->header_gallery_id;
  
  
          /** @var $album Album */
          $album = Album::model()->with('i18n')->model()->findByAttributes(array('link' => $link));
          $this->pageName = $album->i18n->page_name;
          $this->setSEOParams($album->i18n->title, $album->i18n->keywords, $album->i18n->description);
          $this->render('album', array('album' => $album));
      }
  
      public function actionAlbums()
      {
          /** @var $albumsSection AlbumsSection */
          $albumsSection = AlbumsSection::model()->with('i18n')->findByPk($this->getNode()->data_id);
  
          $this->sectionGalleryId = $albumsSection->header_gallery_id;
  
          $this->pageName = $albumsSection->i18n->page_name;
          $this->setSEOParams($albumsSection->i18n->title, $albumsSection->i18n->keywords, $albumsSection->i18n->description);
  
          $albums = Album::model()->with('i18n')->findAll(array(
              'order' => 'date desc',
              'condition' => 'not hidden and albums_section_id =' . $albumsSection->id,
          ));
          $this->render('albums', array('albums' => $albums));
      }
  }