Esempio n. 1
0
 public function init($article, &$url, &$title, &$teaser = '', &$src = '', $size = 'noresize', &$featured = false, &$id = '')
 {
     $objectType = $this->getObjectType($article);
     $id = $article[$objectType]['id'];
     $url = SiteRouter::url($article);
     $title = $article[$objectType]['title'];
     $teaser = nl2br($article[$objectType]['teaser']);
     $src = isset($article['Media']) && $article['Media'] && isset($article['Media']['id']) && $article['Media']['id'] ? $this->Media->imageUrl($article, $size) : '';
     $featured = $article[$objectType]['featured'];
 }
 function __construct()
 {
     ini_set("session.cookie_lifetime", 2592000);
     // 30 days
     parent::__construct();
     $docroot = Config::get('DocRoot');
     Config::set('ControllerRoot', "{$docroot}/controller/com/passinggreen/www");
     Config::set('ViewRoot', "{$docroot}/view/com/passinggreen/www");
     Config::set('GoogleAnalyticsID', '');
     Config::set('VirtualRoot', realpath("{$docroot}/../html/passinggreen_com/www"));
 }
Esempio n. 3
0
 public function viewCarType()
 {
     $carType = $this->CarType->findBySlug($this->request->param('carType'));
     if (!$carType && !TEST_ENV) {
         return $this->redirect('/');
     }
     $conditions = array('CarSubtype.cat_id' => $carType['CarType']['id']);
     $order = 'CarSubtype.title';
     $carSubtype = $this->CarSubtype->find('first', compact('conditions', 'order'));
     if ($carSubtype) {
         return $this->redirect(SiteRouter::url($carSubtype));
     }
     $this->set('article', $carType);
     $this->seo = $carType['Seo'];
 }
Esempio n. 4
0
 public function body($article)
 {
     return $article[SiteRouter::getObjectType($article)]['body'];
 }
Esempio n. 5
0
 protected function beforeRenderLayout()
 {
     $this->loadModel('CategoryProduct');
     // ??? на странице если явно не указать objectType - загружаются все статьи - BUG!!!
     $conditions = array('CategoryProduct.object_type' => 'CategoryProduct');
     $order = 'CategoryProduct.sorting ASC';
     $aCategories = $this->CategoryProduct->find('all', compact('conditions', 'order'));
     $this->set('aCategories', $aCategories);
     foreach ($aCategories as $article) {
         $url = SiteRouter::url($article);
         $this->aNavBar['Products']['submenu'][] = array('href' => $url, 'label' => $article['CategoryProduct']['title']);
     }
     $this->set('aSlider', $this->Media->getObjectList('Slider'));
     $this->loadModel('Page');
     $page = $this->Page->findBySlug('klientam');
     $this->aNavBar['klientam']['label'] = $page['Page']['title'];
     $page = $this->Page->findBySlug('onas');
     $this->aNavBar['onas']['label'] = $page['Page']['title'];
     $aFeatured = $this->Product->getRandomRows(3, array('object_type' => 'Product', 'published' => 1, 'featured' => 1));
     $this->set('aFeatured', $aFeatured);
     $this->set('aProductParams', $this->aProductParams);
     $this->set('aNavBar', $this->aNavBar);
     $this->set('seo', $this->seo);
     $this->set('currCat', $this->currCat);
 }