Beispiel #1
0
function MNI_nice_menus_build($menu, $depth = -1, $trail = null)
{
    $output = '';
    // Prepare to count the links so we can mark first, last, odd and even.
    $index = 0;
    $count = 0;
    foreach ($menu as $menu_count) {
        if ($menu_count['link']['hidden'] == 0) {
            $count++;
        }
    }
    // Get to building the menu.
    foreach ($menu as $menu_item) {
        //only subscribers see the dashboard link
        if ($menu_item['link']['link_path'] == "node/1773" && !mni_misc_functions_is_user_a_subscriber()) {
            $menu_item['link']['hidden'] = 1;
        }
        $mlid = $menu_item['link']['mlid'];
        // Check to see if it is a visible menu item.
        if (!isset($menu_item['link']['hidden']) || $menu_item['link']['hidden'] == 0) {
            // Check our count and build first, last, odd/even classes.
            $index++;
            $first_class = $index == 1 ? ' first ' : '';
            $oddeven_class = $index % 2 == 0 ? ' even ' : ' odd ';
            $last_class = $index == $count ? ' last ' : '';
            // Build class name based on menu path
            // e.g. to give each menu item individual style.
            // Strip funny symbols.
            $clean_path = str_replace(array('https://', 'http://', 'www', '<', '>', '&', '=', '?', ':', '.'), '', $menu_item['link']['href']);
            // Convert slashes to dashes.
            $clean_path = str_replace('/', '-', $clean_path);
            $class = 'menu-path-' . $clean_path;
            if ($trail && in_array($mlid, $trail)) {
                $class .= ' active-trail';
            }
            // If it has children build a nice little tree under it.
            if (!empty($menu_item['link']['has_children']) && !empty($menu_item['below']) && $depth != 0) {
                // Keep passing children into the function 'til we get them all.
                $children = theme('nice_menus_build', $menu_item['below'], $depth, $trail);
                // Set the class to parent only of children are displayed.
                $parent_class = $children && ($menu_item['link']['depth'] <= $depth || $depth == -1) ? 'menuparent ' : '';
                if ($menu_item['link']['options']['attributes']['title'] == 'drop_title') {
                    //print_r($menu_item);
                    $output .= '<div class="column">' . theme('menu_item_link', $menu_item['link'], true);
                } else {
                    $output .= '<li class="menu-' . $mlid . ' ' . $parent_class . $class . $first_class . $oddeven_class . $last_class . '">' . theme('menu_item_link', $menu_item['link']);
                }
                // Check our depth parameters.
                if ($menu_item['link']['depth'] <= $depth || $depth == -1) {
                    // Build the child UL only if children are displayed for the user.
                    if ($children) {
                        if ($menu_item['link']['depth'] == 1) {
                            $flag_pos_col = null;
                            $flag_pos_col = strpos($children, '"column"');
                            //print $flag_pos_col;
                            if ($flag_pos_col) {
                                $output .= '<div class="drop columns2"><div class="bg">';
                            } else {
                                $output .= '<div class="drop"><div class="bg">';
                            }
                        }
                        if ($flag_pos_col) {
                            $output .= '';
                        } elseif ($menu_item['link']['depth'] == 1) {
                            $output .= '<div class="column"><ul>';
                        } else {
                            $output .= '<ul>';
                        }
                        $output .= $children;
                        if ($flag_pos_col) {
                            $output .= '';
                        } elseif ($menu_item['link']['depth'] == 1) {
                            $output .= '</ul></div>';
                        } else {
                            $output .= "</ul>\n";
                        }
                        if ($menu_item['link']['depth'] == 1) {
                            $output .= '</div></div>';
                        }
                    }
                }
                if ($menu_item['link']['options']['attributes']['title'] == 'drop_title') {
                    $output .= "</div>\n";
                } else {
                    $output .= "</li>\n";
                }
            } else {
                if ($menu_item['link']['options']['attributes']['title'] == 'drop_title') {
                    $output .= '<div class="column">' . theme('menu_item_link', $menu_item['link'], true) . '</div>';
                } else {
                    $output .= '<li class="menu-' . $mlid . ' ' . $class . $first_class . $oddeven_class . $last_class . '">' . theme('menu_item_link', $menu_item['link']) . '</li>' . "\n";
                }
            }
        }
    }
    return $output;
}
Beispiel #2
0
    ?>
				<?php 
    $current_user = user_load($user->uid);
    ?>
				<div class="personal-block">
					<div class="main-heading">
						<h2>Profile</h2>
					</div>
        <?php 
    print $content;
    ?>
					<div class="major-wrap">
						<div class="product-block">
							<div id="products_avail_user_pg">
								<h3><?php 
    if (mni_misc_functions_is_user_a_subscriber()) {
        echo 'Additional ';
    }
    ?>
MNI Products Available</h3>
								<div class="key-list2">
            <?php 
    print mni_misc_functions_list_products_user_not_subscribed_to(4);
    ?>
								</div>
							</div>
						</div>
					</div>
				</div>
				<?php 
} else {