src/UI/HTML/Tabs.php
public static function createTabs( $id, $labels = array(), $contents = array(), $class = NULL )
	{
		if( count( $labels ) != count( $contents ) )
			throw new Exception( 'Number of labels and contents is not equal.' );

		$belowV3	= version_compare( 3, self::$version );
		$urlPrefix	= ( $belowV3 && getEnv( 'REDIRECT_URL' ) ) ? getEnv( 'REDIRECT_URL' ) : '';
		$tabs		= array();
		$divs		= array();
		$labels		= $labels;
		$contents	= $contents;
		foreach( $labels as $index => $label )
		{
			$tabKey		= is_int( $index ) ? 'tab-'.$index : $index;
			$divKey		= $index."-container";
			$url		= $urlPrefix."#".$divKey;
			$label		= UI_HTML_Tag::create( 'span', $label );
			$link		= UI_HTML_Tag::create( 'a', $label, array( 'href' => $url ) );
			$tabs[]		= UI_HTML_Tag::create( 'li', $link, array( 'id' => $tabKey ) );

			$divClass	= $class ? $class."-container" : NULL;
			$attributes	= array( 'id' => $divKey, 'class' => $divClass );
			$divs[]		= UI_HTML_Tag::create( 'div', $contents[$index], $attributes );
			self::$counter++;
		}
		$tabs		= UI_HTML_Tag::create( 'ul', implode( "\n", $tabs ), array( 'class' => $class ) );
		$divs		= implode( "\n", $divs );
		$content	= UI_HTML_Tag::create( 'div', $tabs.$divs, array( 'id' => $id ) );
		return $content;
	}
public static function createTabs( $id, $labels = array(), $contents = array(), $class = NULL )
	{
		if( count( $labels ) != count( $contents ) )
			throw new Exception( 'Number of labels and contents is not equal.' );

		$belowV3	= version_compare( 3, self::$version );
		$urlPrefix	= ( $belowV3 && getEnv( 'REDIRECT_URL' ) ) ? getEnv( 'REDIRECT_URL' ) : '';
		$tabs		= array();
		$divs		= array();
		$labels		= $labels;
		$contents	= $contents;
		foreach( $labels as $index => $label )
		{
			$tabKey		= is_int( $index ) ? 'tab-'.$index : $index;
			$divKey		= $index."-container";
			$url		= $urlPrefix."#".$divKey;
			$label		= UI_HTML_Tag::create( 'span', $label );
			$link		= UI_HTML_Tag::create( 'a', $label, array( 'href' => $url ) );
			$tabs[]		= UI_HTML_Tag::create( 'li', $link, array( 'id' => $tabKey ) );

			$divClass	= $class ? $class."-container" : NULL;
			$attributes	= array( 'id' => $divKey, 'class' => $divClass );
			$divs[]		= UI_HTML_Tag::create( 'div', $contents[$index], $attributes );
			self::$counter++;
		}
		$tabs		= UI_HTML_Tag::create( 'ul', implode( "\n", $tabs ), array( 'class' => $class ) );
		$divs		= implode( "\n", $divs );
		$content	= UI_HTML_Tag::create( 'div', $tabs.$divs, array( 'id' => $id ) );
		return $content;
	}
public static function createTabs ( $ id , $ labels = array ( ) , $ contents = array ( ) , $ class = NULL ) { if ( count ( $ labels ) != count ( $ contents ) ) throw new Exception ( 'Number of labels and contents is not equal.' ) ; $ belowV3 = version_compare ( 3 , self :: $ version ) ; $ urlPrefix = ( $ belowV3 && getEnv ( 'REDIRECT_URL' ) ) ? getEnv ( 'REDIRECT_URL' ) : '' ; $ tabs = array ( ) ; $ divs = array ( ) ; $ labels = $ labels ; $ contents = $ contents ; foreach ( $ labels as $ index => $ label ) { $ tabKey = is_int ( $ index ) ? 'tab-' . $ index : $ index ; $ divKey = $ index . "-container" ; $ url = $ urlPrefix . "#" . $ divKey ; $ label = UI_HTML_Tag :: create ( 'span' , $ label ) ; $ link = UI_HTML_Tag :: create ( 'a' , $ label , array ( 'href' => $ url ) ) ; $ tabs [ ] = UI_HTML_Tag :: create ( 'li' , $ link , array ( 'id' => $ tabKey ) ) ; $ divClass = $ class ? $ class . "-container" : NULL ; $ attributes = array ( 'id' => $ divKey , 'class' => $ divClass ) ; $ divs [ ] = UI_HTML_Tag :: create ( 'div' , $ contents [ $ index ] , $ attributes ) ; self :: $ counter ++ ; } $ tabs = UI_HTML_Tag :: create ( 'ul' , implode ( "\n" , $ tabs ) , array ( 'class' => $ class ) ) ; $ divs = implode ( "\n" , $ divs ) ; $ content = UI_HTML_Tag :: create ( 'div' , $ tabs . $ divs , array ( 'id' => $ id ) ) ; return $ content ; }
Builds HTML Code of Tabbed Content statically.
@access		public
@static
@param		string		$id			ID of whole Tabbed Content Block
@param		array		$label		List of Tab Labels
@param		array		$contents	List of Contents related to the Tabs
@param		string		$class		CSS Class of Tabs DIV (main container)
@return		string
Builds HTML Code of Tabbed Content statically .