function fp_render_top_nav_content

6.x theme.inc fp_render_top_nav_content($bool_for_hamburger_menu = FALSE)

Returns the HTML for the top navigation content of the screen itself.

If the bool_for_hamburger_menu == true, then we are trying to render this for our mobile hamburger menu, so we will alter a little bit.

2 calls to fp_render_top_nav_content()
AdvisingScreen::output_to_browser in classes/AdvisingScreen.php
This method outputs the screen to the browser by performing an include(path-to-theme-file.php). All necessary information must be placed into certain variables before the include happens.
fp_render_mobile_hamburger_menu in includes/theme.inc
This will create the HTML content for the "mobile hamburger" menu, which appears when we press the 3 lines icon or "hamburger" icon on a mobile device.

File

includes/theme.inc, line 1462

Code

function fp_render_top_nav_content($bool_for_hamburger_menu = FALSE) {
  global $user;
  $html = "";

  $name = "";
  if ($user->is_faculty) {
    $name = fp_get_faculty_name($user->cwid);
  }
  else {
    $name = fp_get_student_name($user->cwid);
  }



  $badge = "";
  // If user has new alerts to view, we should show a "badge" on the icon over the alerts icon
  $alert_count_by_type = fp_get_alert_count_by_type();
  if ($alert_count_by_type && is_array($alert_count_by_type) && count($alert_count_by_type) > 0) {
    $unread_total = 0;
    foreach ($alert_count_by_type as $module => $alert_types) {
      if ($alert_types && is_array($alert_types)) {
        foreach ($alert_types as $k => $details) {
          $ur = intval($details ['unread']);
          if ($ur < 0) {
            $ur = 0; // bug that can happen after deletions, it can be in negative numbers.
          }
          $unread_total += $ur;
        }
      }
    }
    if ($unread_total > 0) {
      $badge = "<span class='tub-alert-count'><i class='fa fa-circle'></i></span>";
    }
  }


  if (!$bool_for_hamburger_menu) {

    $html .= "<ul class='top-nav-ul'>";

    // If we have a student selected, then we will display a link to go back to that student.
    if ($user->is_faculty) {
      if (@trim($_SESSION ["last_student_selected"]) != '') {
        $csid = trim($_SESSION ["last_student_selected"]);
        $sname = trim(fp_get_student_name($csid));
        if ($sname) {
          $sname = htmlentities($sname);
          $cur_stu_link = l("<i class='fa fa-id-card-o'></i>", "student-select", "current_student_id=$csid", array("title" => t("Return to @sname", array("@sname" => $sname))));
          $html .= "<li class='current-student-link'>$cur_stu_link</li>";
        }
      }
    }

    if (user_has_permission('view_any_advising_session')) {
      $html .= "<li class='student-search'>" . student_search_render_small_search() . "</li>";
    }
    if (user_has_permission('view_advisee_alerts')) {
      $html .= "<li class='alerts'><span class='tub-icon-element-alert'><a href='" . fp_url('alerts') . "'><i class='fa fa-bell'></i>$badge</a></span></li>";
    }
    $html .= "<li class='user-options last'>";




    $user_menu_links = array(
      0 => l(t('My Settings'), 'user-settings'),
      1 => l(t('Log Out'), 'logout'),
    );

    // Call a hook to allow others to modify this.
    invoke_hook('user_menu_links_alter', array(&$user_menu_links));

    $html .= "    
            <div class='tub-element tub-float-right-a tub-last-element tub-user-menu tub-icon-element dropdown'>
                <div class='tub-element-wrapper'>
                  <a href='javascript:fpToggleUserMenu();' class='tub-link dropdown-trigger'>
                    <i class='fa fa-user'></i><span class='tub-caret-down'><i class='fa fa-caret-down'></i></span>
                  </a>
                </div>
  
                  <div id='tub-user-pulldown' style='display:none;' >
                      $name
                    <ul class='user-pulldown'>
                    ";

    foreach ($user_menu_links as $link) {
      $html .= "<li>" . $link . "</li>";
    }


    $html .= "
                    </ul>
  
                  </div>
                  
            </div>  
        
        
          
        </li>      
      </ul>
    ";

    // We are also going to have a hidden "hamburger" icon, which gets displayed
    // when we shrink to mobile.  It will be invisible by default.
    $html .= "<div class='mobile-hamburger-icon' style='display: none;'>
                <a href='javascript:fpToggleHamburgerMenu();'><i class='fa fa-bars'></i></a>
              </div>";

  }
  else {
    // This IS for our *** hamburger menu **** !
    $cog_class = "cog-only";
    $html .= "<ul class='top-nav-ul'>";
    if (user_has_permission('view_advisee_alerts')) {
      $html .= "<li class='alerts first'><span class='tub-icon-element-alert'><a href='" . fp_url('alerts') . "'><i class='fa fa-bell'></i>$badge</a></span></li>";
      $cog_class = "last";
    }
    $html .= "
        <li class='user-options last $cog_class'>  
          <a href='" . fp_url('user-settings') . "'><i class='fa fa-cog'></i></a>
        </li>      
      </ul>
    ";

  }


  return $html;
}