function fp_render_sidebar_left_content

7.x theme.inc fp_render_sidebar_left_content($bool_for_hamburger_menu = FALSE)
6.x theme.inc fp_render_sidebar_left_content($bool_for_hamburger_menu = FALSE)

Returns the HTML for the left sidebar content.

2 calls to fp_render_sidebar_left_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 1277

Code

function fp_render_sidebar_left_content($bool_for_hamburger_menu = FALSE) {
  global $user;

  $html = "";

  // Our links....  (we will check permissions later based on the path)
  $links = array();

  if ($_SESSION ["fp_logged_in"] != TRUE) {
    // user is not logged in.  The top-most link should be to log in.
    $links [] = array(
      'path' => 'login',
      'icon' => 'fa-sign-in',
      'desc' => t('Login'),
      'class' => 'login',
      'weight' => 0,
    );
  }
  else {
    // the user is logged in normally, the top-most link should be the dashboard  
    $links [] = array(
      'path' => '<front>',
      'icon' => 'fa-home',
      'desc' => t('Dashboard'),
      'class' => 'home',
      'weight' => 0,
    );
  }
  if ($user->is_student) {
    $links [] = array(
      'path' => 'student-profile',
      'icon' => 'fa-graduation-cap',
      'desc' => t('My Profile'),
      'class' => 'my-profile',
      'weight' => 10,
    );
  }
  $links [] = array(
    'path' => 'calendar',
    'icon' => 'fa-calendar',
    'desc' => t('Appointments'),
    'class' => 'appointments',
    'weight' => 20,
  );
  $links [] = array(
    'path' => 'student-search',
    'icon' => 'fa-users',
    'desc' => t('Students'),
    'class' => 'students',
    'weight' => 30,
  );
  $links [] = array(
    'path' => 'tools/course-search',
    'icon' => 'fa-book',
    'desc' => t('Courses'),
    'class' => 'courses',
    'weight' => 40,
  );
  $links [] = array(
    'path' => 'tools/blank-degrees',
    'icon' => 'fa-university',
    'desc' => t('Degrees'),
    'class' => 'degrees',
    'weight' => 50,
  );
  $links [] = array(
    'path' => 'stats',
    'icon' => 'fa-bar-chart',
    'desc' => t('Analytics'),
    'class' => 'analytics',
    'weight' => 60,
  );
  $links [] = array(
    'path' => 'admin-tools',
    'icon' => 'fa-bolt',
    'desc' => t('Admin Tools'),
    'class' => 'admin-tools',
    'weight' => 70,
  );

  if ($bool_for_hamburger_menu) {
    // Include a handy log-out on the mobile hamburger menu
    $links [] = array(
      'path' => 'logout',
      'icon' => 'fa-sign-out',
      'desc' => t('Log Out'),
      'class' => 'logout',
      'weight' => 999,
    );
  }


  // TODO:  hook to allow other modules to add to this list or modify it.



  // Sort links by weight
  $temp = array();
  foreach ($links as $c => $details) {
    $weight = @floatval($details ['weight']);
    $temp [] = "$weight ~ $c";
  }
  sort($temp);

  $new_links = array();
  foreach ($temp as $line) {
    $x = explode("~", $line);
    $i = intval($x [1]);
    $new_links [] = $links [$i];
  }
  $links = $new_links;

  // Display


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

  foreach ($links as $c => $link) {
    $path = $link ['path'];
    $icon = $link ['icon'];
    $desc = $link ['desc'];
    $query = @$link ['query'];
    $class = @$link ['class'];

    if ($c == 0) {
      $class .= " first";
    }
    if ($c == count($links) - 1) {
      $class .= " last";
    }

    // Do we have permission for this menu item?
    if ($path != "<front>") {
      $item = menu_get_item($path);
      if (!menu_check_user_access($item)) {
        continue;
      }
    }

    // If we are here, we have access!
    $html .= "<a href='" . fp_url($path, $query) . "'>
                <li class='$class'>                
                  <i class='fa $icon'></i>
                  <div class='desc'>$desc</div>                
                </li>
              </a>";


  } // foreach

  $html .= "</ul>";








  return $html;

}