function fp_render_tab_array

6.x theme.inc fp_render_tab_array($tab_array)
4.x theme.inc fp_render_tab_array($tab_array)
5.x theme.inc fp_render_tab_array($tab_array)

Given a propperly formatted tab_array, this will return the HTML to draw it on a page.

Parameters

array $tab_array:

  • Array should have this structure:

    • $tab_array[i]["title"] = The title or caption of the tab. "main", or "Edit", etc.
    • $tab_array[i]["active"] = boolean. True if this is the tab we are currently looking at.
    • $tab_array[i]["on_click"] = This is a valid onClick='blah blah' that is the result of clicking the tab.

Return value

string

1 call to fp_render_tab_array()
fp_display_page in includes/theme.inc
Output the contents of the $page variable to the screen. $page is an array containing details about the page, as well as its original menu item (router_item) definition.

File

includes/theme.inc, line 936

Code

function fp_render_tab_array($tab_array) 
 {

  // fix mobile tabs
  if (fp_screen_is_mobile()) {
    return fp_render_mobile_tab_array($tab_array);
  }


  $rtn = "";

  $rtn .= "<table border='0' width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    ";

  $img_path = fp_theme_location() . "/images";


  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;
    }

    $padd = "30px;";
    if ($t > 0) 
     {
      $padd = "5px;";
    }

    $rtn .= "<td style='padding-right: $padd'></td>
        <td>";

    if ($active != TRUE) 
     { //innactive tabs...

      $theclass = "inactive_tab hand";
      $overclass = "inactive_tab_over";
      if ($on_click == "") 
       {
        $theclass = "inactive_tab";
        $overclass = "inactive_tab_over_no_link";
      }

      $rtn .= "
    
    <table align='left' cellpadding='0' onClick='$on_click' cellspacing='0' class='$theclass' onmouseover='this.className=\"$overclass\";' onmouseout='this.className=\"inactive_tab\";'>
    <tr>
      <td class='tab_tl_i' align='left' valign='baseline'  width='12'></td>
      <td class='tab_top_i' valign='baseline' ></td>
      <td class='tab_tr_i' valign='baseline' align='right' width='12'></td>
    </tr>
    <tr>
     <td class='tab_left_i' align='left' valign='baseline' width='12'>
      <img src='$img_path/tab_left_i.gif' width='12' height='18'>
    </td>
    <td align='left' nowrap class='tab_center_i'>
     <div style='padding-bottom: 3px; margin-top: -2px;' class='tab_text'>$title</div>
    </td>
    <td class='tab_right_i' align='right' valign='baseline'>
     <img src='$img_path/tab_right_i.gif' width='12' height='18'>
    </td>
    </tr>
    </table>

    ";

    }
    else {
      // active tab...
      $rtn .= "
    <table align='left' cellpadding='0' cellspacing='0' class='active_tab'>
      <tr>
        <td class='tab_tl' align='left' valign='baseline' width='12'></td>
        <td class='tab_top' valign='baseline'></td>
        <td class='tab_tr' valign='baseline' align='right' width='12'></td>
      </tr>
      <tr>
        <td class='tab_left' align='left' valign='baseline' width='12'>
        <img src='$img_path/tab_left.gif' width='12' height='18'>
        </td>
        <td align='left' nowrap class='tab_center'>
          <div style='padding-bottom: 3px; margin-top: -2px;' class='tab_text'>$title</div>
        </td>
        <td class='tab_right' align='right' valign='baseline'>
          <img src='$img_path/tab_right.gif' width='12' height='18'>
        </td>
      </tr>
    </table>      
    ";

    }

    $rtn .= "</td>";

  }


  $rtn .= "
     </tr>
     </table>";

  return $rtn;

}