function _AdvisingScreen::z__draw_mobile_tabs

4.x _AdvisingScreen.php _AdvisingScreen::z__draw_mobile_tabs($tab_array)
5.x _AdvisingScreen.php _AdvisingScreen::z__draw_mobile_tabs($tab_array)

This function is called when we know we are on a mobile browser. We have to handle tab rendering differently in order to make them all fit.

Parameters

unknown_type $tab_array:

File

classes/_AdvisingScreen.php, line 1704

Class

_AdvisingScreen

Code

function z__draw_mobile_tabs($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>Display: </b>";


  /*	  if (count($tab_array) == 1) {
	    // Just one element, no need to render the select list.
	    $rtn .= $tab_array[0]["title"];
	    $rtn .= "</td></table>";
	    return $rtn;
	  }
*/

  $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 .= "mobile_tab_selections[$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 = mobile_tab_selections[sel];
		    // Lets execute the statement...
		    eval(statement);
		    
		  }
		  
		  
		  </script>
		';

  return $rtn;

}