Загрузка данных


<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

// Create shortcuts to some parameters.
$params  = $this->item->params;
$images  = json_decode($this->item->images);
$urls    = json_decode($this->item->urls);
$canEdit = $params->get('access-edit');
$user    = JFactory::getUser();
$info    = $params->get('info_block_position', 0);
JLoader::register('fieldattach', 'components/com_fieldsattach/helpers/fieldattach.php'); 
JLoader::register('imagemaker', 'templates/urbis/html/imagemaker.php');


$this->item->text = str_ireplace('2024 г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2025 г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2026 г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2027 г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2024&nbsp;г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2025&nbsp;г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2026&nbsp;г', date('Y').' г',$this->item->text);
$this->item->text = str_ireplace('2027&nbsp;г', date('Y').' г',$this->item->text);

//если версия для печати - грузим сразу отдельный файл
if($this->print) {
    $this->setLayout('wtb-print'); 
    echo $this->loadTemplate();
} else {
    $doc = JFactory::getDocument();

    $settit = '';
    if(!isset($doc->_metaTags['name']['browser_title'])){
        $doc->setTitle($this->item->title.' | ProBelarus.by');
    };
    
    $doc->addStyleSheet($this->baseurl.'/templates/probel/css/stylewtb.css');
?>

<script type="text/javascript" src="templates/probel/js/highslide/highslide-full.js"></script>
<script type="text/javascript" src="templates/probel/js/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="templates/probel/js/urbisscript.js"></script>
<link type="text/css" href="templates/probel/css/jquery.jscrollpane.css" rel="stylesheet" media="all" />
<link rel="stylesheet" href="templates/probel/js/highslide/highslide.css" type="text/css" />
<script type="text/javascript">
hs.graphicsDir = "<?php echo $this->baseurl ?>/templates/probel/js/highslide/graphics/"
</script>

<?php 
jimport('joomla.application.module.helper');
$modules = JModuleHelper::getModules('tour-menu-wtb');
foreach ($modules as $module) {
    echo JModuleHelper::renderModule($module);
}
?> 

<div class="item-page<?php echo $this->pageclass_sfx?>">
    <?php if ($params->get('show_title')) : ?>
    <div class="section-title">
        <h1><?php echo $this->escape($this->item->title); ?></h1>
    </div>
    <?php endif; ?>

    <?php echo $this->item->event->beforeDisplayContent; ?>
    
    <div class="itemContent full-width-layout">
        
        <!-- ==================== БЛОК 1: ДАТЫ ЗАЕЗДОВ ==================== -->
        <?php 
        $datyz = fieldattach::getValue($this->item->id, 49, false);
        if(!empty($datyz)) {
        ?>
        <div class="tour-block tour-dates-block">
            <div class="tour-block-header">
                <h3><i class="fa fa-calendar"></i> Даты заездов</h3>
            </div>
            <div class="tour-block-body">
                <?php
                $paramarr = array();
                $paramdata = str_replace(array("\r\n","\r"), "^", $datyz);	
                $paramarr = explode("^", $paramdata);
                $i = 0;
                $indataarr = array();
                foreach($paramarr as $dar){
                    $i++;
                    $datarrr = array();
                    $thisyear = date('y'); 
                    $thisyear1 = date('y', strtotime('+1 year'));
                    $thisyear2 = date('y', strtotime('-1 year'));
                    $dar = str_replace('.'.$thisyear.' -', '.20'.$thisyear.' -', $dar);
                    $dar = str_replace('.'.$thisyear1.' -', '.20'.$thisyear1.' -', $dar);
                    $dar = str_replace('.'.$thisyear2.' -', '.20'.$thisyear2.' -', $dar);
                    
                    $datarrr = explode("-", $dar);
                    $firstdate = strtotime($datarrr[0]);
                    $dar = str_replace("201", "1", $dar);
                    $dar = str_replace("202", "2", $dar);
                    
                    if(strtotime(date('d.m.Y')) < $firstdate){
                        echo '<span class="badge-zaezd actual" data-backdrop="true" data-formval="'.$dar.'" data-toggle="modal" data-target="#callformz">'.$dar.'</span>';
                        $indataarr[] = $dar;
                    } else {
                        echo '<span class="badge-zaezd">'.$dar.'</span>';
                    }
                }
                ?>
            </div>
        </div>
        <?php } ?>

        <!-- ==================== БЛОК 2: INTROTEXT ==================== -->
        <div class="tour-block tour-intro-block">
            <div class="tour-block-body">
                <?php echo $this->item->introtext; ?>
            </div>
        </div>

        <!-- ==================== БЛОК 3: ЦЕНЫ ==================== -->
        <?php if($this->item->parent_id != 62){ ?>
        <div class="tour-block tour-price-block">
            <?php 
            $this->setLayout('wtbtour-price'); 
            echo $this->loadTemplate(); 
            ?>
        </div>
        <?php } ?>
          

        <!-- ==================== БЛОК 4: ПОЛНЫЙ ТЕКСТ ==================== -->
        <div class="tour-block tour-fulltext-block">
            <div class="tour-block-body">
                <?php echo $this->item->fulltext; ?>
            </div>
        </div>

        <!-- ==================== БЛОК 4.1: КНОПКИ ==================== -->
        <div class="tour-block tour-actions-block">
            <div class="tour-block-body">
                <div class="actions-row">
                    <button class="btn btn-success btn-request" data-backdrop="true" data-toggle="modal" data-target="#callformz">
                        <i class="fa fa-pencil"></i> Оставить заявку на тур
                    </button>
                    
                    <noindex>
                        <span class="btn btn-primary btn-print">
                            <span class="span-class" realhref="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>?tmpl=component&print=1&valuta=" href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>?tmpl=component&print=1&valuta=rur" title="Печать">Печать</span>
                        </span>
                    </noindex>
                </div>
            </div>
        </div>
                  
        <!-- ==================== БЛОК 45: ФОТОГАЛЕРЕЯ (КАРУСЕЛЬ) ==================== -->
        <?php 
        $dost = fieldattach::getValue($this->item->id, 61, false);
        $articlearr = array();
        
        if(!empty($dost)){
        ?>
        <div class="tour-block tour-gallery-block">
            <div class="tour-block-header">
                <h3><i class="fa fa-camera"></i> Фотогалерея тура</h3>
            </div>
            <div class="tour-block-body">
                <div class="tour-gallery-slider">
                    <?php
                    $dostarr = explode(',', $dost);
                    $result = array();
                    
                    foreach ($dostarr as $ditem){
                        $atitle = '';
                        $atitleitem = array();
                        $article = JTable::getInstance("content");
                        $article->load($ditem);
                        $atitle = $article->get("title");
                        
                        if(!empty($atitle)){
                            $atitleitem['id'] = $ditem;    
                            $atitleitem['title'] = $atitle;
                            $atitleitem['introtext'] = $article->get("introtext");
                            $atitleitem['link'] = JRoute::_(ContentHelperRoute::getArticleRoute($ditem.':'.$article->get("alias"), $article->get("catid")));
                            $articlearr[] = $atitleitem;
                        }
                        
                        $testImage = imagemaker::makeimage($ditem, 160, 115, 'galrighttour', $atitle);
                        
                        if(!empty($testImage)) {
                            if(is_array($testImage)) {
                                $result[] = $testImage[0];
                            } else {
                                $result[] = $ditem . '^' . $testImage;
                            }
                        }
                    }
                    
                    if(!empty($result)){
                        foreach ($result as $diarray){
                            $di = explode('^', $diarray);
                            ?>
                            <div class="slider-item">
                                <a href="<?php echo $di[1]; ?>" data-fancybox="gallery" class="popup-image">
                                    <img src="<?php echo $di[1]; ?>" alt="<?php echo $di[0]; ?>" />
                                </a>
                            </div>
                            <?php
                        }
                    }
                    ?>
                </div>
            </div>
        </div>
        
        <!-- Подключаем Slick Slider -->
        <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
        <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.css"/>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
        <script type="text/javascript">
        jQuery(document).ready(function($){
            $('.tour-gallery-slider').slick({
                dots: true,
                arrows: true,
                infinite: true,
                speed: 500,
                slidesToShow: 3,
                slidesToScroll: 1,
                adaptiveHeight: true,
                responsive: [
                    {
                        breakpoint: 768,
                        settings: {
                            slidesToShow: 2,
                            slidesToScroll: 1
                        }
                    },
                    {
                        breakpoint: 480,
                        settings: {
                            slidesToShow: 1,
                            slidesToScroll: 1
                        }
                    }
                ]
            });
        });
        </script>
        <?php } ?>
                           
                  
                  
        <!-- ==================== БЛОК 6: ДОСТОПРИМЕЧАТЕЛЬНОСТИ ==================== -->
        <?php if(!empty($articlearr)){ ?>
        <div class="tour-block tour-sights-block">
            <div class="tour-block-header">
                <h3><i class="fa fa-map-marker"></i> Достопримечательности тура</h3>
            </div>
            <div class="tour-block-body">
                <div class="sights-grid">
                    <?php foreach ($articlearr as $art){ 
                        if(isset($art['title']) && !empty($art['title'])){
                            $extlink = fieldattach::getValue($art['id'], 117, false);
                            if(!empty($extlink)) $art['link'] = $extlink;
                            
                            $suffix = '...';
                            $maxlength = 150;
                            $string = strip_tags($art['introtext']);	
                            if(strlen($string) <= $maxlength) {
                                $temp = $string;
                            } else {
                                $string = substr($string, 0, $maxlength);
                                $index = strrpos($string, ' ');
                                if($index === FALSE) {
                                    $temp = $string;
                                } else {
                                    $temp = substr($string, 0, $index) . $suffix;
                                }
                            }
                    ?>
                        <div class="sight-item">
                            <div class="sight-item-inner">
                                <h4><a target="_blank" href="<?php echo $art['link']; ?>" title="<?php echo $art['title']; ?>"><?php echo $art['title']; ?></a></h4>
                                <?php if(!empty($temp)) { ?>
                                <p><?php echo $temp; ?></p>
                                <?php } ?>
                                <a target="_blank" class="btn btn-sm btn-primary" href="<?php echo $art['link']; ?>">Подробнее →</a>
                            </div>
                        </div>
                    <?php 
                        }
                    } 
                    ?>
                </div>
            </div>
        </div>
        <?php } ?>
          

        <!-- ==================== БЛОК 7: НАСЕЛЕННЫЕ ПУНКТЫ (ТЕГИ) ==================== -->
        <?php if(!empty($this->item->tags->itemTags)){ 
            JLoader::register('TagsHelperRoute', JPATH_BASE . '/components/com_tags/helpers/route.php');
        ?>
        <div class="tour-block tour-tags-block">
            <div class="tour-block-header">
                <h3><i class="fa fa-tags"></i> Населенные пункты</h3>
            </div>
            <div class="tour-block-body">
                <div class="tags-wrapper">
                    <?php foreach($this->item->tags->itemTags as $tag){ 
                        $extlink = JRoute::_(TagsHelperRoute::getTagRoute($tag->tag_id . ':' . $tag->alias));
                    ?>
                        <a target="_blank" class="tag-item" href="<?php echo $extlink; ?>" title="<?php echo $tag->title; ?>">
                            <?php echo $tag->title; ?>
                        </a>
                    <?php } ?>
                </div>
            </div>
        </div>
        <?php } ?>

        <!-- ==================== БЛОК 8: МЕНЕДЖЕРЫ ==================== -->
        <?php 
        $manager = '';
        $man = '';
        $db = JFactory::getDBO();
        $manager = fieldattach::getValue($this->item->id, 83, false);
        
        if(!empty($manager)) {
            $managers = explode(',' ,$manager);
        ?>
        <div class="tour-block tour-managers-block">
            <div class="tour-block-header">
                <h3><i class="fa fa-user"></i> Менеджеры тура</h3>
            </div>
            <div class="tour-block-body">
                <?php foreach ($managers as $manag){
                    $query = 'SELECT a.* FROM #__content as a WHERE a.id = '.$manag.' ORDER BY a.ordering';
                    $db->setQuery($query);
                    $man = $db->loadObject();
                ?>
                <div class="manager-item">
                    <div class="manager-layout">
                        <?php 
                        $manfoto = imagemaker::makeimage($man->id, 120, 120, 'slider', $man->title);
                        if(!empty($manfoto)) {
                        ?>
                        <div class="manager-photo">
                            <?php echo $manfoto; ?>
                        </div>
                        <?php } ?>
                        
                        <div class="manager-content">
                            <div class="manager-name"><?php echo $man->title; ?></div>
                            
                            <?php 
                            $dolzh = fieldattach::getValue($man->id, 63, false);
                            if(!empty($dolzh)){ 
                            ?>
                            <div class="manager-position"><?php echo $dolzh; ?></div>
                            <?php } ?>
                            
                            <div class="manager-contacts">
                                <?php 
                                $memail = fieldattach::getValue($man->id, 34, false);
                                if(!empty($memail)){ 
								echo '<input type="hidden" value="'.$man->id.'" id="nmanag" />'; 
                                ?>
                                <div class="contact-item email">
                                    <i class="fa fa-envelope"></i> 
                                    <a href="mailto:<?php echo $memail; ?>"><?php echo $memail; ?></a>
                                </div>
                                <?php } ?>
                                
                                <?php 
                                $mmtsrf = fieldattach::getValue($man->id, 107, false);
                                if(!empty($mmtsrf)){ 
                                ?>
                                <div class="contact-item phone">
                                    <i class="fa fa-phone"></i> <?php echo $mmtsrf; ?>
                                </div>
                                <?php } ?>
                                
                                <?php 
                                $mmts = fieldattach::getValue($man->id, 35, false);
                                if(!empty($mmts)){ 
                                ?>
                                <div class="contact-item phone">
                                    <i class="fa fa-phone"></i> <?php echo $mmts; ?>
                                </div>
                                <?php } ?>
                                
                                <?php 
                                $mvelcom = fieldattach::getValue($man->id, 36, false);
                                if(!empty($mvelcom)){ 
                                ?>
                                <div class="contact-item phone">
                                    <i class="fa fa-phone"></i> <?php echo $mvelcom; ?>
                                </div>
                                <?php } ?>
                                
                                <?php 
                                $mphone = fieldattach::getValue($man->id, 37, false);
                                if(!empty($mphone)){ 
                                ?>
                                <div class="contact-item phone">
                                    <i class="fa fa-phone"></i> <?php echo $mphone; ?>
                                </div>
                                <?php } ?>
                                
                                <?php 
                                $mphone2 = fieldattach::getValue($man->id, 64, false);
                                if(!empty($mphone2)){ 
                                ?>
                                <div class="contact-item phone">
                                    <i class="fa fa-phone"></i> <?php echo $mphone2; ?>
                                </div>
                                <?php } ?>
                                
                                <?php 
                                $mskype = fieldattach::getValue($man->id, 38, false);
                                if(!empty($mskype)){ 
                                ?>
                                <div class="contact-item skype">
                                    <i class="fa fa-skype"></i> 
                                    <a href="skype:<?php echo $mskype; ?>?chat"><?php echo $mskype; ?></a>
                                </div>
                                <?php } ?>
                            </div>
                            
                            <?php if(!empty($man->introtext)){ ?>
                            <div class="manager-worktime">
                                <i class="fa fa-clock-o"></i> <?php echo $man->introtext; ?>
                            </div>
                            <?php } ?>
                            
                            <button class="btn btn-consult" data-backdrop="true" data-toggle="modal" data-target="#callformz">
                                Получить консультацию
                            </button>
                        </div>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
        <?php } ?>

        <!-- ==================== БЛОК 9: ПРИКРЕПЛЕННЫЕ ФАЙЛЫ ==================== -->
        <?php 
        $isdocs = fieldattach::getFieldValue($this->item->id, 11, false, false);
        if(!empty($isdocs)) {
        ?>
        <div class="tour-block tour-files-block">
            <div class="tour-block-header">
                <h3><i class="fa fa-paperclip"></i> Прикрепленные файлы</h3>
            </div>
            <div class="tour-block-body">
                <div class="files-list">
                    <?php echo fieldattach::getFieldValue($this->item->id, 11, false); ?>
                </div>
            </div>
        </div>
        <?php } ?>


        <!-- ==================== БЛОК 10: СОЦИАЛЬНЫЕ СЕТИ ==================== -->
        <div class="tour-block tour-social-block">
            <div class="tour-block-body">
                <div class="share-section">
                    <p class="share-label"><i class="fa fa-share-alt"></i> Поделись с друзьями!</p>
                    <script src="https://yastatic.net/es5-shims/0.0.2/es5-shims.min.js"></script>
                    <script src="https://yastatic.net/share2/share.js"></script>
                    <div class="ya-share2" data-services="collections,vkontakte,facebook,odnoklassniki,twitter,linkedin,viber,whatsapp,telegram"></div>
                </div>
            </div>
        </div>

        <?php echo $this->item->event->afterDisplayContent; ?>
        

        <!-- ==================== СКРЫТЫЙ SELECT ДЛЯ МОДАЛЬНОГО ОКНА ==================== -->
        <?php if(!empty($indataarr)){ ?>
        <select class="contact selectidata hidden" style="display: none;">
            <?php foreach($indataarr as $date){ ?>
            <option value="<?php echo $date; ?>"><?php echo $date; ?></option>
            <?php } ?>
        </select>
        <?php } ?>
        <input type="hidden" id="tovar" value="<?php echo $this->item->title; ?>" />
<!-- ==================== CONTACTABLE ==================== -->
        <div id="contactable"></div>
    </div>

</div>


<link rel="stylesheet" href="templates/probel/cont/contactable.css" type="text/css" />
<script type="text/javascript" src="templates/probel/cont/jquery.validate.min.js"></script>
<script type="text/javascript" src="templates/probel/cont/jquery.contactable.js"></script>
<script type="text/javascript">jQuery(function(){jQuery('#contactable').contactable();});</script>

<?php } // конец else (не печать) ?>