function fp_render_mobile_tab_array

7.x theme.inc fp_render_mobile_tab_array($tab_array)
6.x theme.inc fp_render_mobile_tab_array($tab_array)
4.x theme.inc fp_render_mobile_tab_array($tab_array)
5.x theme.inc fp_render_mobile_tab_array($tab_array)
1 call to fp_render_mobile_tab_array()
fp_render_tab_array in includes/theme.inc
Given a propperly formatted tab_array, this will return the HTML to draw it on a page.

File

includes/theme.inc, line 1069

Code

function fp_render_mobile_tab_array($tab_array) {

  $rtn = "";

  $js_vars = "var mobileTabSelections = new Array(); ";

  if (count($tab_array) <= 1) {
    return "";
  }


  $rtn .= "<table border='0' width='200' cellpadding='0' cellspacing='0' class='fp-mobile-tabs'>
             <td>
             <b>" . t("Display") . ": </b>";


  $rtn .= "<select onChange='executeSelection()' id='mobileTabsSelect'>";

  for ($t = 0; $t < count($tab_array); $t++) 
   {
    $title = $tab_array [$t]["title"];
    $active = $tab_array [$t]["active"];
    $on_click = $tab_array [$t]["on_click"];

    if ($title == "") 
     {
      continue;
    }
    $sel = ($active == true) ? $sel = "selected" : "";

    $rtn .= "<option $sel value='$t'>$title</option>";

    $js_vars .= "mobileTabSelections[$t] = '$on_click'; \n";

  }

  $rtn .= "</select>
              </td></table>";


  $rtn .= '
      <script type="text/javascript">
      ' . $js_vars . '      
      
      function executeSelection() {
        var sel = document.getElementById("mobileTabsSelect").value;
        
        var statement = mobileTabSelections[sel];
        // Lets execute the statement...
        eval(statement);
        
      }
      
      
      </script>
    ';

  return $rtn;
}