<?php

class WarrantyController extends NodeSiteController
{
    public function actionIndex()
    {
        /** @var $warrantyRoot WarrantyRoot */
        $warrantyRoot = WarrantyRoot::model()->with('i18n')->findByPk($this->getNode()->data_id);
        $this->pageName = $warrantyRoot->i18n->page_name;
        $this->setSEOParams($warrantyRoot->i18n->title, $warrantyRoot->i18n->keywords, $warrantyRoot->i18n->description);
        $this->setContacts(explode(',', $warrantyRoot->contacts_data));
        $certificates = GalleryPhoto::model()->with('i18n')->findAll(array('order' => 'rank asc', 'condition' => 'gallery_id=' . $warrantyRoot->certificate_gallery_id));
        $this->headerGalleryId = $warrantyRoot->header_gallery_id;
        $this->render('index', array(
            'content' => $warrantyRoot->i18n->content,
            'sidebar' => $warrantyRoot->i18n->sidebar,
            'certificates' => $certificates
        ));
    }
}
