See file /home/user2057277/www/trawor.by/protected/controller/public/TourController.php


+ Error on line 371

        if ($data['parent']->is_premium == 1) {

<?php
Doo
::loadController('public/PublicController');

class 
TourController extends PublicController {

    const 
ENTITY 'Tour';
    const 
ENTITY_TABLE 'tour';

    const 
CATEGORY 'TourCategory';
    const 
CATEGORY_TABLE 'tour_category';

    private function 
updateTours($model) {
        
$entity Doo::loadModel($modeltrue);
        
$tours $this->db()->find($entity);

        foreach(
$tours as $tour) {
            if (
$tour->price_discount == 0) {
                
$tour->price_discount $tour->price;
                
Doo::loadModel($modeltrue);
                
$this->db()->update($tour);
            }
        }
    }

    public function 
tourList() {
        
$data['translator'] = $this->translator();

        
$data['tour-page'] = 'tour';

        
$data['parent_category_id']   = $this->params['id'];
        
$data['parent_category_name'] = $this->params['name'];
        
$data['parent_category_title'] = 'Туры';

        
$data['country_selected'] = false;
        
$data['city_selected']    = false;

        
$data['country_id'] = '';
        
$data['city_id']    = '';

        
$data['country'] = '';
        
$data['city']    = '';

        
// Parent Category
        
$parent Doo::loadModel('TourCategory'true);
        
$parent->id $this->params['id'];
        
$parent->status 1;
    
$data['parent'] = $this->db()->find($parent, array('limit' => 1));

        
// Country List
        
Doo::loadModel('PlaceCategory');
        
$sql =     ' SELECT place_category.* ' .
                
' FROM place_category' .
                
' JOIN tour_country ON tour_country.country_id = place_category.id' .
                
' JOIN tour ON tour.id = tour_country.tour_id ' .
                
' WHERE deep = 2' .
                
' AND place_category.parent_id = ' . (int)$this->params['id'] .
                
' AND tour.status = 1 ' .
                
' AND place_category.status = 1 ' .
                
' GROUP BY title' .
                
' ORDER BY title';
        
$data['country-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'PlaceCategory');

        
$countryIds = array();
        if (!empty(
$data['country-list'])) {
            foreach (
$data['country-list'] as $country) {
              
array_push($countryIds$country->id);
            }
        }

        if (!empty(
$this->params['filter'])) {
      
$data['tour-page'] = 'place';

            
$filter explode('_'$this->params['filter']);

            
$joinCountry '';
            
$joinCity    '';
            
$typeCountry '';
            
$typeCity    '';

            if (
count($filter) > 1) {
                
$data['country_selected'] = true;
                
$data['city_selected']    = true;

                
$joinCity ' JOIN tour_city AS tc ON t.id = tc.tour_id ';
                
$typeCity ' AND tc.city_id = ' $filter[1];

                
// Load Category Data
                
$category Doo::loadModel('Place'true);
                
$category->id $filter[1];

                
$data['country_id'] = $filter[0];
                
$data['city_id']    = $filter[1];

                
// Type List
            
Doo::loadModel('TourCategory');
            
$sql =  'SELECT cat.* ' .
                    
'FROM tour AS t ' .
                    
'JOIN tour_city AS tc ON t.id = tc.tour_id ' .
                    
'JOIN tour_category AS cat ON t.category_id = cat.id ' .
                    
'WHERE tc.city_id = ' $category->id ' ' .
                    
'AND t.status = 1 ' .
                    
'GROUP BY cat.title';
                
$data['type-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'TourCategory');
            } else {
                
$data['country_selected'] = true;
                
$data['city_selected']    = false;

                
$joinCountry ' JOIN tour_country AS tc ON t.id = tc.tour_id ';
                
$typeCountry ' AND tc.country_id = ' $filter[0];

                
// Load Category Data
                
$category Doo::loadModel('PlaceCategory'true);
                
$category->id $filter[0];

                
$data['country_id'] = $filter[0];
                
$data['city_id']    = '';

                
// Type List
            
Doo::loadModel('TourCategory');
            
$sql =  'SELECT cat.* ' .
                    
'FROM tour AS t ' .
                    
'JOIN tour_country AS tc ON t.id = tc.tour_id ' .
                    
'JOIN tour_category AS cat ON t.category_id = cat.id ' .
                    
'WHERE tc.country_id = ' $category->id ' ' .
                    
'AND t.status = 1 ' .
                    
'GROUP BY cat.title';
                
$data['type-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'TourCategory');

                
// Next country
                
$data['next-country'] = '';

                
// Previous country
                
$data['prev-country'] = '';
            }

            
// City List
            
$where ' AND category_id = ' $filter[0];

            
Doo::loadModel('Place'true);
            
$sql =     ' SELECT place.*' .
        
' FROM place ' .
        
' JOIN tour_city ON tour_city.city_id = place.id ' .
        
' WHERE place.status = 1 AND place.lang = "' $_SESSION['language'] . '" ' .
        
$where .
        
' GROUP BY title ' .
        
' ORDER BY title' ;
      
$data['city-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Place');

            
// Load Tours
            
Doo::loadModel('Tour');
            
$sql =     ' SELECT t.id, t.name, t.title, t.info, t.img, t.price, t.price_discount, t.currency, t.route, t.level, t.category_id, t.special, ' .
            
' td.january, td.february, td.march, td.april, td.may, td.june, ' .
            
' td.july, td.august, td.september, td.october, td.november, td.december, td.tour_id' .
                
' FROM tour AS t ' .
                
$joinCountry .
                
$joinCity .
                
' JOIN tour_date AS td ON t.id = td.tour_id ' .
                
' WHERE t.status = 1 ' .
                
$typeCountry .
                
$typeCity .
                
' AND t.lang = "' $_SESSION['language'] . '" ' .
                
' ORDER BY price_discount ASC';
            
$tourList $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');
        } else {
            
$category Doo::loadModel(self::CATEGORYtrue);
            if (!empty(
$this->params['id']) && !empty($this->params['name'])) {
                
$category->id = (int)$this->params['id'];
            } else {
                
$category->deep 0;
            }

            
// Type List
        
Doo::loadModel('TourCategory');
        
$sql =  'SELECT * ' .
                
'FROM tour_category ' .
                
'WHERE parent_id = ' . (int)$this->params['id'] . ' ' .
                
'AND deep = 2 ' .
                
'AND items > 0 ' .
                
'AND status = 1 ' .
                
'GROUP BY title';
            
$data['type-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'TourCategory');

            
$typeIds = array();
            if (!empty(
$data['type-list'])) {
                foreach (
$data['type-list'] as $type) {
                  
array_push($typeIds$type->id);
                }
            }

            
$typeQuery = !empty($data['type-list']) ? ' AND t.category_id IN (' implode(","$typeIds) . ') ' '';

            
// Load Tours
            
$tourList '';
            if (!empty(
$data['type-list'])) {
                
Doo::loadModel('Tour');
                
$sql =     ' SELECT t.id, t.name, t.title, t.info, t.img, t.price, t.price_discount, t.special, t.currency, t.route, t.level, td.january, td.february, td.march, td.april, td.may, td.june, td.july, td.august, td.september, td.october, td.november, td.december, td.tour_id ' .
                    
' FROM tour AS t ' .
                    
' JOIN tour_date AS td ON t.id = td.tour_id ' .
                    
$typeQuery .
                    
' AND t.lang = "' $_SESSION['language'] . '" ' .
                    
' AND t.status = 1 ' .
                    
' ORDER BY price_discount ASC';
                
$tourList $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');
            }

            
/*
                Загрузить для эксклюзивных туров туры из авиа
                Для категории с id 114 загружаем туры из категории с id 117
            */
            
$premiumCategoryId 114;
            
$aviaCategoryId 117;
            if ((int)
$this->params['id'] === $premiumCategoryId) {
                
Doo::loadModel('Tour');
                
$sql =     ' SELECT t.id, t.name, t.title, t.info, t.img, t.price, t.price_discount, t.special, t.currency, t.route, t.level, td.january, td.february, td.march, td.april, td.may, td.june, td.july, td.august, td.september, td.october, td.november, td.december, td.tour_id ' .
                    
' FROM tour AS t ' .
                    
' JOIN tour_date AS td ON t.id = td.tour_id ' .
                    
' AND t.category_id = ' $aviaCategoryId .
                    
' AND t.lang = "' $_SESSION['language'] . '" ' .
                    
' AND t.status = 1 ' .
                    
' ORDER BY price_discount ASC';
                
$tourList $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');
            }

            
// TODO: Добавить к списку туров туры с флагом is_personal 
            // только для раздела "Индивидуальные туры"

            // City List
            
$where = !empty($data['country-list']) ? ' AND category_id IN (' implode(","$countryIds) . ')' '';

            if (!empty(
$data['country-list'])) {
                
Doo::loadModel('Place'true);
                
$sql ' SELECT place.*' .
                     
' FROM place ' .
                     
' JOIN tour_city ON tour_city.city_id = place.id ' .
                     
' WHERE place.status = 1 AND place.lang = "' $_SESSION['language'] . '" ' .
                     
$where .
                     
' GROUP BY title ' .
                     
' ORDER BY title' ;
          
$data['city-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Place');
            }
       }
         
$category->lang $_SESSION['language'];
         
$category->status 1;
         
$category $this->db()->find($category, array('limit' => 1));

        if (empty(
$category)) {
            return array(
'/error'404);
        }

        
$data['category'] = $category;

        
// Page
        
$page Doo::loadModel('Page'true);
        
$page->title $category->title;
        
$page->title_page $category->title_page;
        
$page->img = !empty($category->img) ? $category->img '';
        
$page->seo_title $category->seo_title;
        
$page->seo_keywords $category->seo_keywords;
        
$page->seo_description $category->seo_description;
        
$data['page'] = $page;

        
// Speciality list
        
$category Doo::loadModel(self::CATEGORYtrue);
        
$category->lang $_SESSION['language'];
        
$category->status 1;
        
$category->deep 1;
        
$category->is_premium 0;
        
$data['category-list'] = $this->db()->find($category, array('asc' => 'lineage'));

        
// Currency List
        
$currency Doo::loadModel('Currency'true);
        
$data['currency-list'] = $this->db()->find($currency);

        
// Main Currency
        // EUR by default
        
$currency Doo::loadModel('Currency'true);
        
$currency->title 'EUR';
        
$mainCurrency $this->db()->find($currency, array('limit' => 1));

        
$dollar Doo::loadModel('Currency'true);
        
$dollar->title 'USD';
        
$dollar $this->db()->find($dollar, array('limit' => 1));
        
$data['dollar-euro'] = round($mainCurrency->rate $dollar->rate3);

        
// Special Tour List
        
if (!empty($typeIds)) {
          
// $rate = ($mainCurrency->rate * Doo::conf()->INCREASE_COEFFICIENT) + $mainCurrency->rate;
        
$specialList Doo::loadModel('Tour');
          
$sql =     " SELECT id, name, title, price, price_discount, info, category_id, img " .
                  
" FROM tour " .
                  
" WHERE category_id IN (" implode(','$typeIds) . ")" .
                  
" AND lang LIKE '" $_SESSION['language'] . "' " .
                  
" AND status = 1 " .
                  
" AND special = 1 " .
                  
" ORDER BY rand() limit 3";
          
$specialTours $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');

            
// Update tours with prices
            
Doo::loadClass('CurrencyConverter');

            foreach (
$specialTours as $tour) {
                
$converter = new CurrencyConverter($tour->price);
                
$tour->price_byn $converter->getBYN();
                
$tour->price_byr $converter->getBYR();

                if (
$tour->price_discount $tour->price) {
                    
$converter2 = new CurrencyConverter($tour->price_discount);
                    
$tour->price2_usd $converter2->getUSD();
                    
$tour->price2_byn $converter2->getBYN();
                }
            }

            
$data['special-list'] = $specialTours;
        }

        
// Get next 6 months
        
$nextMonths = array();
        
$currentMonth = (int)date('n');
        
$delta = ($currentMonth 9) ? 12 $currentMonth 5;
        for (
$i $currentMonth$i <= $delta$i++) {
            
$nextMonths[] = strtolower(date('F'mktime(000$i1)));
        }

        
$monthsEng = array('January','February','March','April','May','June','July','August','September','October','November','December');
        
$monthsRus = array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');

        if (!empty(
$tourList)) {
            foreach(
$tourList as $item) {
                
$monthList = array();
                foreach(
$nextMonths as $i => $month) {
                    
$n date('n'strtotime("$month 1 2011"));
                    if (!empty(
$item->$month) && $item->$month != '') {
                        if (
$currentMonth && $n >= $currentMonth) {
                            
$monthList[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$item->$month));
                        }
                        if (
$currentMonth 6) {
                            
$monthList[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$item->$month));
                        }
                    }
                }
                
$item->dates $monthList;
            }
        }

        
// Update tours with prices
        
Doo::loadClass('CurrencyConverter');

        if (!empty(
$tourList)) {
            foreach (
$tourList as $tour) {
                
$converter = new CurrencyConverter($tour->price);
                
$tour->price_usd $converter->getUSD();
                
$tour->price_byn $converter->getBYN();

                if (
$tour->price_discount $tour->price) {
                    
$converter2 = new CurrencyConverter($tour->price_discount);
                    
$tour->price2_usd $converter2->getUSD();
                    
$tour->price2_byn $converter2->getBYN();
                }
            }
        }

        
$data['tour-list'] = $this->splitToursByPrice($tourList);
        
        
$data['disable-transparent'] = false;
        
$data['transparent-menu'] = true;
        if (
$data['category']->name == 'all' || !empty($data['special-list'])) {
            
$data['disable-transparent'] = true;
            
$data['transparent-menu'] = false;
        }

        if ($data['parent']->is_premium == 1) {

            
$data['menu'] = 'premium';
        } else {
            
$data['menu'] = 'tours';
        }

        
$data['default-currency'] = $mainCurrency->rate;

        
$this->renderc('public/tour-list'$data);
    }

    private function 
splitToursByPrice($list) {
        if (empty(
$list)) return $list;

        
$requestedTourList = array();
        
$paidTourList = array();

        foreach(
$list as $tour) {
            if (
$tour->price == 0) {
                
array_push($requestedTourList$tour);
            } else {
                
array_push($paidTourList$tour);
            }
        }

        return 
array_merge($paidTourList$requestedTourList);
    }

    public function 
tourFilter() {
        if (!empty(
$_POST)) {
            
$typeQuery = !empty($_POST['type']) ? ' AND t.category_id = ' $_POST['type'] : '';

            
$joinCountry '';
            
$joinCity    '';
            
$typeCountry '';
            
$typeCity    '';

            if (!empty(
$_POST['country'])) {
                if (!empty(
$_POST['city'])) {
                    
$joinCity ' JOIN tour_city AS tc ON t.id = tc.tour_id ';
                    
$typeCity ' AND tc.city_id = ' $_POST['city'];
                } else {
                    
$joinCountry ' JOIN tour_country AS tc ON t.id = tc.tour_id ';
                    
$typeCountry ' AND tc.country_id = ' $_POST['country'];
                }
            }

            
Doo::loadModel('Tour');
            
$sql =     ' SELECT t.id, t.name, t.title, t.info, t.img, t.price, t.price_discount, t.level, t.special, t.currency, t.route, t.category_id,' .
                    
' td.january, td.february, td.march, td.april, td.may, td.june, ' .
                    
' td.july, td.august, td.september, td.october, td.november, td.december, td.tour_id' .
                    
' FROM tour AS t ' .
                    
$joinCountry .
                    
$joinCity .
                    
' JOIN tour_date AS td ON t.id = td.tour_id ' .
                    
' WHERE t.status = 1 ' .
                    
$typeCountry .
                    
$typeCity .
                    
$typeQuery .
                    
' AND t.lang = "' $_SESSION['language'] . '" ' .
                    
' ORDER BY price_discount ASC';
            
$tourList $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');

            
// Get tour dates
            
$nextMonths = array();
            
$currentMonth = (int)date('n');
            
$delta = ($currentMonth 9) ? 12 $currentMonth 5;
            for (
$i $currentMonth$i <= $delta$i++) {
                
$nextMonths[] = strtolower(date('F'mktime(000$i1)));
            }

            
$monthsEng = array('January','February','March','April','May','June','July','August','September','October','November','December');
            
$monthsRus = array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');

            if (!empty(
$tourList)) {
                foreach(
$tourList as $item) {
                    
$monthList = array();
                    foreach(
$nextMonths as $i => $month) {
                        
$n date('n'strtotime("$month 1 2011"));
                        if (!empty(
$item->$month) && $item->$month != '') {
                            if (
$currentMonth && $n >= $currentMonth) {
                                
$monthList[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$item->$month));
                            } else if (
$currentMonth 6) {
                                
$monthList[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$item->$month));
                            }
                        }
                    }
                    
$item->dates $monthList;
                }
            }

            
// Update tours with prices
            
Doo::loadClass('CurrencyConverter');

            foreach (
$tourList as $tour) {
                
$converter = new CurrencyConverter($tour->price);
                
$tour->price_usd $converter->getUSD();
                
$tour->price_byn $converter->getBYN();

                if (
$tour->price_discount $tour->price) {
                    
$converter2 = new CurrencyConverter($tour->price_discount);
                    
$tour->price2_usd $converter2->getUSD();
                    
$tour->price2_byn $converter2->getBYN();
                }
            }

            
$data['tour-list'] = $this->splitToursByPrice($tourList);

            
$this->renderc('public/tour-filter-list'$data);
        }
    }

    public function 
tour() {
        
$data['translator'] = $this->translator();

        
// Page
        
$page Doo::loadModel('Page'true);

        
// Employee
        
$tour null;
        if (!empty(
$this->params['id']) && !empty($this->params['name'])) {
            
$tour Doo::loadModel(self::ENTITYtrue);
            
$tour->id = (int)$this->params['id'];
            
$tour->lang $_SESSION['language'];
            
//$tour->status = 1;
            
$tour $this->db()->find($tour, array('limit' => 1));

            if (empty(
$tour) || $tour->name != $this->params['name']) {
                return array(
'/error'404);
            }

            
$page->seo_title $tour->seo_title;
            
$page->seo_keywords $tour->seo_keywords;
            
$page->seo_description $tour->seo_description;
        }
        
$data['page'] = $page;

        
// Update tours with prices
        
Doo::loadClass('CurrencyConverter');
        
$converter = new CurrencyConverter($tour->price);
        
$tour->price_usd $converter->getUSD();
        
$tour->price_byn $converter->getBYN();

        if (
$tour->price_discount $tour->price) {
            
$converter2 = new CurrencyConverter($tour->price_discount);
            
$tour->price2_usd $converter2->getUSD();
            
$tour->price2_byn $converter2->getBYN();
        }

        
$data['tour'] = $tour;

        
// Country List
        
Doo::loadModel('PlaceCategory');
        
$sql =     ' SELECT place_category.* ' .
                
' FROM place_category' .
                
' JOIN tour_country ON tour_country.country_id = place_category.id' .
                
' JOIN tour ON tour.id = tour_country.tour_id ' .
                
' WHERE deep = 2' .
                
' AND tour.id = ' $data['tour']->id .
                
' AND tour.status = 1 ' .
                
' AND place_category.status = 1 ' .
                
' GROUP BY title' .
                
' ORDER BY title';
        
$data['country-list'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'PlaceCategory');

        
// Speciality list
        
$category Doo::loadModel(self::CATEGORYtrue);
        
$category->lang $_SESSION['language'];
        
$category->status 1;
        
$category->deep 1;
        
$data['category-list'] = $this->db()->find($category, array('asc' => 'lineage'));

        
// Selected category
        
$item Doo::loadModel(self::CATEGORYtrue);
        
$item->id $data['tour']->category_id;
        
$item->lang $_SESSION['language'];
        
// $item->status = 1;
        
$data['category'] = $this->db()->find($item, array('limit' => 1));

        
// Parent Category
        
$parent Doo::loadModel('TourCategory'true);
        
$parent->id $data['category']->parent_id;
        
$parent->status 1;
    
$data['parent-category'] = $this->db()->find($parent, array('limit' => 1));

        
// Image List
        
$image Doo::loadModel('TourImage'true);
        
$image->tour_id $tour->id;
        
$image->status 1;
        
$data['image-list'] = $this->db()->find($image);

    
// Linked Tours
    
Doo::loadModel('Tour');
    
$sql =  " SELECT t.id, t.name, t.title, t.img, t.status, t.price, t.price_discount " .
            
" FROM tour AS t " .
            
" JOIN tour_link AS tl ON t.id = tl.tour_link_id " .
            
" WHERE tl.tour_id = " $tour->id .
            
" ORDER BY t.title ASC " .
            
" LIMIT 3";
    
$linkedTours $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');

        
// Update tours with prices
        
Doo::loadClass('CurrencyConverter');

        foreach (
$linkedTours as $linkedTour) {
            
$converter = new CurrencyConverter($linkedTour->price);

            
$linkedTour->price_byn $converter->getBYN();
            
$linkedTour->price_byr $converter->getBYR();

            if (
$linkedTour->price_discount $linkedTour->price) {
                
$converter2 = new CurrencyConverter($linkedTour->price_discount);
                
$linkedTour->price2_usd $converter2->getUSD();
                
$linkedTour->price2_byn $converter2->getBYN();
            }
        }

        
$data['linked-tours'] = $linkedTours;

        
// Tour Date List
        
$date Doo::loadModel('TourDate'true);
        
$date->tour_id $tour->id;
        
$dateData $date->db()->find($date, array('limit' => 1));

        
// Tour dates
        
$nextMonths = array();
        
$currentMonth = (int)date('n');
        
$delta $currentMonth 11;
        for (
$i $currentMonth$i <= $delta$i++) {
            
$nextMonths[] = strtolower(date('F'mktime(000$i1)));
        }

        
$monthsEng = array('January','February','March','April','May','June','July','August','September','October','November','December');
        
$monthsRus = array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');

        
$resultArr = array();
        foreach(
$nextMonths as $i => $month) {
            
$n date('n'strtotime("$month 1 2011"));
            if (!empty(
$dateData->$month) && $dateData->$month != '') {
                
$resultArr[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$dateData->$month));
            }
        }

        
// Tour Reviews
        
Doo::loadModel('Review');
        
$sql =  " SELECT r.* " .
                        
" FROM review AS r " .
                        
" JOIN tour_review AS tr ON tr.review_id = r.id " .
                        
" WHERE tr.tour_id = " $data['tour']->id .
                        
" AND r.status = 1 " .
                        
" ORDER BY r.created DESC " .
                        
" LIMIT 3";
        
$data['reviews'] = $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Review');

        
$data['show-date-list'] = !empty($resultArr);
        
$data['tour-dates'] = $resultArr;

        
$data['menu'] = 'tours';

        
$data['transparent-menu'] = false;
        
$data['disable-transparent'] = true;

        
$this->renderc('public/tour'$data);
    }

    function 
newYearTours() {
        
$data['translator'] = $this->translator();

        
// Page
        
$page Doo::loadModel('Page'true);
        
$page->name 'new-year-tours';
        
$page->lang $_SESSION['language'];
        
$page->status 1;
        
$data['page'] = $this->db()->find($page, array('limit' => 1));

        
// Load tours
        
Doo::loadModel('Tour');
        
$sql =     ' SELECT t.id, t.name, t.title, t.info, t.img, t.price, t.price_discount, t.level, t.special, t.currency, t.route, t.category_id,' .
                        
' td.january, td.february, td.march, td.april, td.may, td.june, ' .
                        
' td.july, td.august, td.september, td.october, td.november, td.december, td.tour_id' .
                
' FROM tour AS t ' .
                
' JOIN tour_date AS td ON t.id = td.tour_id ' .
                
' WHERE t.status = 1 ' .
                
' AND t.category_id IN (17, 21) ' .
                
' AND t.lang = "' $_SESSION['language'] . '" ' .
                
' ORDER BY price_discount ASC';
        
$tourList $this->db()->fetchAll($sqlnullPDO::FETCH_CLASS'Tour');

        
// Get tour dates
        
$nextMonths = array();
        
$currentMonth = (int)date('n');
        
$delta = ($currentMonth 9) ? 12 $currentMonth 5;
        for (
$i $currentMonth$i <= $delta$i++) {
            
$nextMonths[] = strtolower(date('F'mktime(000$i1)));
        }

        
$monthsEng = array('January','February','March','April','May','June','July','August','September','October','November','December');
        
$monthsRus = array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');

        if (!empty(
$tourList)) {
            foreach(
$tourList as $item) {
                
$monthList = array();
                foreach(
$nextMonths as $i => $month) {
                    
$n date('n'strtotime("$month 1 2011"));
                    if (!empty(
$item->$month) && $item->$month != '') {
                        if (
$currentMonth && $n >= $currentMonth) {
                            
$monthList[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$item->$month));
                        } else if (
$currentMonth 6) {
                            
$monthList[] = array('month' => str_ireplace($monthsEng$monthsRus$month), 'dates' => str_replace('<br/>',', '$item->$month));
                        }
                    }
                }
                
$item->dates $monthList;
            }
        }

        
// Update tours with prices
        
Doo::loadClass('CurrencyConverter');

        foreach (
$tourList as $tour) {
            
$converter = new CurrencyConverter($tour->price);
            
$tour->price_usd $converter->getUSD();
            
$tour->price_byn $converter->getBYN();

            if (
$tour->price_discount $tour->price) {
                
$converter2 = new CurrencyConverter($tour->price_discount);
                
$tour->price2_usd $converter2->getUSD();
                
$tour->price2_byn $converter2->getBYN();
            }
        }

        
$data['tour-list'] = $this->splitToursByPrice($tourList);

        
// Currency List
        
$currency Doo::loadModel('Currency'true);
        
$data['currency-list'] = $this->db()->find($currency);

        
// Main Currency
        // EUR by default
        
$currency Doo::loadModel('Currency'true);
        
$currency->title 'EUR';
        
$mainCurrency $this->db()->find($currency, array('limit' => 1));

        
$dollar Doo::loadModel('Currency'true);
        
$dollar->title 'USD';
        
$dollar $this->db()->find($dollar, array('limit' => 1));
        
$data['dollar-euro'] = round($mainCurrency->rate $dollar->rate3);

        
$data['default-currency'] = $mainCurrency->rate;
        
$data['transparent-menu'] = true;
        
$data['disable-transparent'] = false;

        
$this->renderc('public/new-year-tours'$data);
    }

}
?>


* Stack Trace...

  1. /home/user2057277/www/trawor.by/index.php(37) calling run()
  2. /home/user2057277/www/trawor.by/dooframework/app/DooWebApp.php(34) calling routeTo()
  3. /home/user2057277/www/trawor.by/dooframework/app/DooWebApp.php(114) calling tourList()


* Variables...  Conf .  GET  .  POST  .  Session  .  Cookie 


object(DooConfig)#1 (37) {
  
["AUTOLOAD"] => NULL
  
["SITE_PATH"] => string(32"/home/user2057277/www/trawor.by/"
  
["PROTECTED_FOLDER"] => string(10"protected/"
  
["BASE_PATH"] => string(45"/home/user2057277/www/trawor.by/dooframework/"
  
["LOG_PATH"] => NULL
  
["APP_URL"] => string(18"https://trawor.by/"
  
["SUBFOLDER"] => string(1"/"
  
["APP_MODE"] => string(4"prod"
  
["AUTOROUTE"] => bool(false)
  [
"DEBUG_ENABLED"] => bool(true)
  [
"ERROR_404_DOCUMENT"] => NULL
  
["ERROR_404_ROUTE"] => string(6"/error"
  
["CACHE_PATH"] => NULL
  
["AUTO_VIEW_RENDER_PATH"] => string(28"/tour/list/:id/:name/:filter"
  
["MEMCACHE"] => NULL
  
["TEMPLATE_ENGINE"] => string(7"DooView"
  
["TEMPLATE_SHOW_COMMENT"] => NULL
  
["TEMPLATE_ALLOW_PHP"] => NULL
  
["TEMPLATE_COMPILE_ALWAYS"] => NULL
  
["TEMPLATE_GLOBAL_TAGS"] => NULL
  
["MODULES"] => NULL
  
["APP_NAMESPACE_ID"] => NULL
  
["VERSION"] => string(5"3.1.1"
  
["PROJECT_TITLE"] => string(6"Trawor"
  
["ADMIN_EMAIL"] => string(14"info@trawor.by"
  
["ADMIN_NAME"] => string(14"Команда"
  
["LANGUAGE"] => string(2"ru"
  
["HOST_LANGUAGE"] => array(2) {
    [
"localhost"] =>   string(2"ru"
    
["domain"] =>   string(8"language"
  
}
  [
"COOKIE_EXPIRE"] => int(1712921528)
  [
"IMAGE_TYPE"] => string(3"jpg"
  
["IMAGE_QUALITY"] => int(80)
  [
"IMAGE_SIZE"] => array(3) {
    [
"small"] =>   int(200)
    [
"medium"] =>   int(800)
    [
"large"] =>   int(1600)
  }
  [
"NOT_AUTH"] => string(15"/not-authorized"
  
["PROFILE_HOMEPAGE"] => string(8"/profile"
  
["INCREASE_COEFFICIENT"] => float(0.02)
  [
"sessionCacheType"] => string(3"apc"
  
["VIAMARIS_UID"] => string(11"8D8dd6Gzy5s"
}
$_SESSION Variables array(2) {
  [
"language"] => string(2"ru"
  
["contact"] => string(1097"O:7:"Contact":20:{s:2:"id";s:1:"1";s:4:"name";s:8:"contacts";s:5:"title";s:29:"Контакты Минск";s:11:"description";s:25:"Наши контакты";s:5:"phone";s:17:"+375 44 733-90-90";s:3:"fax";s:0:"";s:6:"mobile";s:17:"+375 29 733-90-90";s:8:"schedule";s:88:"Пн.- Пт. : 10.00-19.00 (прием по предварительной записи)";s:5:"skype";s:10:"trawor.int";s:5:"email";s:14:"info@trawor.by";s:7:"country";s:37:"Республика Беларусь";s:4:"city";s:10:"Минск";s:7:"address";s:77:"пр-тНезависимости 49Олимпофис 420 (4 этаж)";s:6:"coords";s:20:"53.91700927.584753";s:7:"updated";s:10:"1711702414";s:4:"lang";s:2:"ru";s:6:"status";s:1:"1";s:6:"_table";s:7:"contact";s:11:"_primarykey";s:2:"id";s:7:"_fields";a:17:{i:0;s:2:"id";i:1;s:4:"name";i:2;s:5:"title";i:3;s:11:"description";i:4;s:5:"phone";i:5;s:3:"fax";i:6;s:6:"mobile";i:7;s:8:"schedule";i:8;s:5:"skype";i:9;s:5:"email";i:10;s:7:"country";i:11;s:4:"city";i:12;s:7:"address";i:13;s:6:"coords";i:14;s:7:"updated";i:15;s:4:"lang";i:16;s:6:"status";}}"
}
$_COOKIE Variables array(0) {
}

BACK TO TOP