SportPageController.php
1.26 KB
<?php
class SportPageController extends NodePageController
{
    public function actionIndex()
    {
        /** @var $textSection TextPage */
        $textPage = TextPage::model()->with('i18n')->findByPk($this->getNode()->data_id);
        /** @var $textSection TextPage */
        $textSection = TextPage::model()->with('i18n')->findByPk($this->getSectionNode()->data_id);
        /** @var $sportRoot TextPage */
        $sportRoot = SportRoot::model()->with('i18n')->findByPk($this->getRootNode()->data_id);
        $this->pageName = $textPage->i18n->page_name;
        $this->setSEOParams($textPage->i18n->title, $textPage->i18n->keywords, $textPage->i18n->description);
        $this->setContacts(explode(',', $textPage->contacts_data));
        $this->setContacts(explode(',', $textSection->contacts_data));
        $this->setContacts(explode(',', $sportRoot->contacts_data));
        if ($textSection->galleryBehavior->getGalleryPhotoCount() == 0)
            $this->headerGalleryId = $sportRoot->header_gallery_id;
        else
            $this->headerGalleryId = $textSection->header_gallery_id;
        $this->sectionGalleryId = $textPage->header_gallery_id;
        $this->render('index', array(
            'content' => $textPage->i18n->content,
        ));
    }
}