first commit
This commit is contained in:
46
templates_user/menu/menu.php
Normal file
46
templates_user/menu/menu.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<div id="menu-container-<?= $this -> menu['id'];?>">
|
||||
<?= \front\view\Menu::pages( $this -> menu['pages'], 0, $this -> current_page );?>
|
||||
</div>
|
||||
<? if ( $this -> menu['id'] == 1 ):?>
|
||||
<script class="footer" type="text/javascript">
|
||||
var windowsize = $(window).width();
|
||||
|
||||
$(window).resize(function() {
|
||||
windowsize = $(window).width();
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '#mobile-menu-btn', function()
|
||||
{
|
||||
if ( windowsize <= 767 )
|
||||
{
|
||||
if ( $( this ).hasClass( 'active' ) )
|
||||
{
|
||||
$( this ).removeClass( 'active' );
|
||||
$( '#main-menu' ).removeClass( 'visible' );
|
||||
$( '#mobile-menu-btn i' ).addClass( 'fa-bars' ).removeClass( 'fa-times' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$( this ).addClass( 'active' );
|
||||
$( '#main-menu' ).addClass( 'visible' );
|
||||
$( '#mobile-menu-btn i' ).removeClass( 'fa-bars' ).addClass( 'fa-times' );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '#menu-container-<?= $this -> menu['id'];?> > ul > li > a', function(e)
|
||||
{
|
||||
if ( windowsize <= 767 )
|
||||
{
|
||||
if ( $( this ).parent().hasClass( 'parent' ) )
|
||||
e.preventDefault();
|
||||
|
||||
if ( !$( this ).parent().hasClass( 'active' ) )
|
||||
{
|
||||
$( '#menu-container-<?= $this -> menu['id'];?> > ul > li' ).removeClass( 'active' );
|
||||
$( this ).parent().addClass( 'active' );
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<? endif;?>
|
||||
59
templates_user/menu/pages.php
Normal file
59
templates_user/menu/pages.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?
|
||||
if ( is_array( $this -> pages ) )
|
||||
{
|
||||
$settings = \front\factory\Settings::settings_details();
|
||||
|
||||
echo '<ul class="level-' . $this -> level . ' clear">';
|
||||
|
||||
foreach ( $this -> pages as $page )
|
||||
{
|
||||
$url = "";
|
||||
if ($settings['links_structure'])
|
||||
{
|
||||
if ($page['language']['seo_link'])
|
||||
{
|
||||
$url = '/'.\admin\factory\Pages::google_url_preview($page['id'], $page['language']['title'], $page['language']['lang_id'], 0, 0, $page['language']['seo_link']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = '/'. \admin\factory\Pages::google_url_preview($page['id'], $page['language']['title'], $page['language']['lang_id'], 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
$page['language']['seo_link'] ? $url = '/' . $page['language']['seo_link'] : $url = '/s-' . $page['id'] . '-' . \S::seo( $page['language']['title'] );
|
||||
|
||||
if ( $page['page_type'] == 3 and $page['language']['link'] )
|
||||
$url = $page['language']['link'];
|
||||
|
||||
unset( $children );
|
||||
|
||||
if ( is_array( $page['pages'] ) ): foreach ( $page['pages'] as $page_tmp ):
|
||||
$children[] = $page_tmp['id'];
|
||||
endforeach; endif;
|
||||
|
||||
echo '<li id="link-' . $page['id'] . '" class="';
|
||||
|
||||
if ($page['id'] == $this -> current_page )
|
||||
echo ' active';
|
||||
|
||||
if( is_array( $page['pages'] ) and in_array( $this -> current_page, $children ) )
|
||||
echo ' open';
|
||||
|
||||
if ( is_array( $page['pages'] ) )
|
||||
echo ' parent';
|
||||
|
||||
echo '">';
|
||||
echo '<a href="';
|
||||
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' and $page['page_type'] != 3 )
|
||||
echo '/' . \S::get_session( 'current-lang' );
|
||||
echo $url . '"'; if ( $page['language']['noindex'] ) echo 'rel="nofollow"'; echo ' title="' . $page['language']['title'] . '"'; if ( is_array( $page['pages'] ) ) echo "class='menu-trigger'"; echo '>';
|
||||
echo $page['language']['title'];
|
||||
if ( is_array( $page['pages'] ) )
|
||||
echo '<i class="fa fa-caret-down"></i>';
|
||||
echo '</a>';
|
||||
echo \front\view\Menu::pages( $page['pages'], $this -> level + 1, $this -> current_page );
|
||||
echo '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
?>
|
||||
26
templates_user/menu/submenu.php
Normal file
26
templates_user/menu/submenu.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?
|
||||
if ( is_array( $this -> pages ) )
|
||||
{
|
||||
|
||||
echo '<ul class="level-' . $this -> level . '" id="submenu-' . $this -> page_id . '">';
|
||||
foreach ( $this -> pages as $page )
|
||||
{
|
||||
$page['language']['seo_link'] ? $url = '/' . $page['language']['seo_link'] : $url = '/s-' . $page['id'] . '-' . \S::seo( $page['language']['title'] );
|
||||
|
||||
if ( $page['page_type'] == 3 and $page['link'] )
|
||||
$url = $page['link'];
|
||||
|
||||
echo '<li id="link-' . $page['id'] . '" class="'; if ( $page['id'] == $this -> current_page ) echo ' active'; echo '">';
|
||||
echo '<a href="';
|
||||
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
|
||||
echo '/' . \S::get_session( 'current-lang' );
|
||||
echo $url . '"'; if ( $page['language']['noindex'] ) echo 'rel="nofollow"'; echo ' title="' . $page['language']['title'] . '"'; if ( is_array( $page['pages'] ) ) echo "class='menu-trigger'"; echo '>';
|
||||
echo $page['language']['title'];
|
||||
if ( is_array( $page['pages'] ) )
|
||||
echo '<i class="fa fa-chevron-down"></i>';
|
||||
echo '</a>';
|
||||
echo \front\view\Menu::submenu( $page['pages'], $this -> current_page, $this -> page_id, $this -> level + 1 );
|
||||
echo '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
Reference in New Issue
Block a user