{if $_modx->resource.info_visible_blocks}
{set $blocks = $_modx->resource.info_visible_blocks | split : ","}
{set $menu_block = '<ul class="nav flex-column vertical-menu">'}
{set $content_block = ""}
{foreach $blocks as $block}
{switch $block}
{case "Патенты"}
{set $menu_block = $menu_block ~ "<li class='nav-item'><a class='nav-link' href='#patents'>Патенты</a></li>"}
{set $content_block = '<div class="container"><a name="patents" id="patents"></a><div class="hdr"><h2>Патенты</h2></div>' ~ 'sertifikat_block' | chunk : ['parent_id' => 70,'limit' => 8]~ '</div>'}
{set $content_block = $content_block ~ '<div class="justify-content-center"> <div class="col-12 text-center"> <a href="{70 | url}" class="btn btn-info">Смотреть все патенты</a></div></div><br/><br/>'}
{case "Статьи"}
{set $prm = "w=510&h=330&q=80&zc=C"}
{set $articles_str = $_modx->runSnippet('!pdoPage',[
'parents' => 1,
'limit' =>6,
'useWeblinkUrl' =>1,
'includeTVs' => 'main_news_img',
'tvPrefix' => 'tv_',
'sortdir' => 'ASC',
'pageNavVar' => 'pages',
'tplPageWrapper' => '@INLINE <div class="justify-content-center"> <div class="col-12 text-center"> <a href="{68 | url}" class="btn btn-info">Смотреть все статьи</a></div></div>',
'tplWrapper' => '@INLINE
<div id="news-block">
<div class="container">
<a name="articles" id="articles"></a>
<div class="hdr">
<h2>Статьи</h2>
</div>
<div class="row">
{$output}
</div>
</div>
</div><!--articles-block-->',
'tpl' => '@INLINE
<div class="col-lg-4 col-md-6">
<div class="card">
<div class="img-card-cont">
<a href="{$link}">
<img class="card-img-top" src="{$tv_main_news_img | phpthumbon : $prm}" alt="{$pagetitle}">
</a>
</div>
<div class="card-body">
<div class="small date">{$publishedon | date : "d/m/Y"}</div>
<a href="{$link}"><h5 class="card-title">{$pagetitle}</h5></a>
<p class="card-text">{$introtext | truncate : 300 : " ... "}</p>
</div>
</div>
</div>'
])}
{if $articles_str}
{set $menu_block = $menu_block ~ "<li class='nav-item'><a class='nav-link' href='#articles'>Статьи</a></li>"}
{set $content_block = $content_block ~ $articles_str ~ $_modx->getPlaceholder("pages")}
{/if}
{case "Разное"}
{set $prm = "w=510&h=330&q=80&zc=C"}
{set $raznoe_str = $_modx->runSnippet('!pdoPage',[
'parents' => 3,
'limit' =>6,
'useWeblinkUrl' =>1,
'includeTVs' => 'main_news_img',
'tvPrefix' => 'tv_',
'sortdir' => 'ASC',
'pageNavVar' => 'pages1',
'tplPageWrapper' => '@INLINE <div class="justify-content-center"> <div class="col-12 text-center"> <a href="{72 | url}" class="btn btn-info">Перейти в раздел Разное</a></div></div>',
'tplWrapper' => '@INLINE
<div id="news-block">
<div class="container">
<a name="raznoe" id="raznoe"></a>
<div class="hdr">
<h2>Разное</h2>
</div>
<div class="row">
{$output}
</div>
</div>
</div><!--articles-block-->',
'tpl' => '@INLINE
<div class="col-lg-4 col-md-6">
<div class="card">
<div class="img-card-cont">
<a href="{$link}">
<img class="card-img-top" src="{$tv_main_news_img | phpthumbon : $prm}" alt="{$pagetitle}">
</a>
</div>
<div class="card-body">
<div class="small date">{$publishedon | date : "d/m/Y"}</div>
<a href="{$link}"><h5 class="card-title">{$pagetitle}</h5></a>
<p class="card-text">{$introtext | truncate : 300 : " ... "}</p>
</div>
</div>
</div>'
])}
{if $raznoe_str}
{set $menu_block = $menu_block ~ "<li class='nav-item'><a class='nav-link' href='#raznoe'>Разное</a></li>"}
{set $content_block = $content_block ~ $raznoe_str ~ $_modx->getPlaceholder("pages1")}
{/if}
{case "Видеоматериалы"}
{set $video_material = 91 | resource : 'main_video_materials' | fromJSON}
{foreach $video_material as $video}
{$video.video_url_migx}
{/foreach}
{if $video_material}
{set $menu_block = $menu_block ~ "<li class='nav-item'><a class='nav-link' href='#video'>Видеоматериалы</a></li>"}
{set $content_block = $content_block ~ $video_material ~ $_modx->getPlaceholder("pages2")}
{/if}
{/switch}
{/foreach}
{set $menu_block = $menu_block ~ '</ul>'}
{/if}
{$menu_block}
</div>
</div>
</div>
</div><!--end header-block-->
{$content_block}
{foreach $video_material as $video}
{$video.video_url_migx}
{/foreach}
{set $content_block = $content_block ~ $video_material ~ $_modx->getPlaceholder("pages2")}
{set $materials = ''}
{foreach $video_material as $video}
{set $material = $materials ~ $video.video_url_migx}
{/foreach}