public function render() {

		$app = Application::getInstance();

		$ret = '';

		foreach ($this->items as $item) {
			
			// check on permissions
			if (isset($item->url) and !(is_a($app->currentUser, 'Pair\User') and !$app->currentUser->canAccess($item->url))) {
				continue;
			}
			
			switch ($item->type) {
				
				// single menu item rendering
				case 'single':

					$class  = ($item->url == $app->activeMenuItem ? ' active' : '');

					if ($item->class) {
						$class .= ' ' . $item->class;
					}

					// if url set <a>, otherwise set <div>
					$ret .= $item->url ? '<a href="' . $item->url . '"' : '<div'; 
					
					$ret .= ' class="item' . $class . '"' .
						($item->target ? ' target="' . $item->target . '"' : '') .
						(!is_null($item->badge) ? ' data-badge="' . (int)$item->badge . '" ' : '') .
						'>' .
						(!is_null($item->badge) ? '<span class="badge">' . $item->badge . '</span>' : '') .
						'<span class="title">' . $item->title . '</span>';

					// if url close </a>, otherwise close </div>
					$ret .= $item->url ? '</a>' : '</div>'; 
					break;

				// menu item with many sub-items rendering
				case 'multi':

					$links		= '';
					$menuClass	= '';

					// builds each sub-item link
					foreach ($item->list as $i) {

						// check on permissions
						if (isset($i->url) and !(is_a($app->currentUser, 'Pair\User') and !$app->currentUser->canAccess($i->url))) {
							continue;
						}
						
						if ($i->url == $app->activeMenuItem) {
							$class		= ' active';
							$menuClass	= ' open';
						} else {
							$class		= '';
						}

						if ($i->class) {
							$class .= ' ' . $i->class;
						}

						$links .= '<a class="item' . $class . '" href="' . $i->url . '">' .
							(!is_null($i->badge) ? '<span class="badge">' . $i->badge . '</span>' : '') .
							'<span class="title">' . $i->title . '</span>' .
							'</a>';
					}
					
					// prevent empty multi-menu
					if ('' == $links) {
						break;
					}
					
					// assembles the multi-menu
					$ret .= '<div class="dropDownMenu' . $menuClass . '">' .
						'<div class="title">' . $item->title . '</div>' .
						'<div class="itemGroup">' . $links . '</div></div>';
					break;
					
				case 'separator':

					if (!$item->title) $item->title = '&nbsp;';
					$ret .= '<div class="separator">' . $item->title . '</div>';
					break;

			}

		}

		return $ret;

	}
public function render() {

		$app = Application::getInstance();

		$ret = '';

		foreach ($this->items as $item) {
			
			// check on permissions
			if (isset($item->url) and !(is_a($app->currentUser, 'Pair\User') and !$app->currentUser->canAccess($item->url))) {
				continue;
			}
			
			switch ($item->type) {
				
				// single menu item rendering
				case 'single':

					$class  = ($item->url == $app->activeMenuItem ? ' active' : '');

					if ($item->class) {
						$class .= ' ' . $item->class;
					}

					// if url set <a>, otherwise set <div>
					$ret .= $item->url ? '<a href="' . $item->url . '"' : '<div'; 
					
					$ret .= ' class="item' . $class . '"' .
						($item->target ? ' target="' . $item->target . '"' : '') .
						(!is_null($item->badge) ? ' data-badge="' . (int)$item->badge . '" ' : '') .
						'>' .
						(!is_null($item->badge) ? '<span class="badge">' . $item->badge . '</span>' : '') .
						'<span class="title">' . $item->title . '</span>';

					// if url close </a>, otherwise close </div>
					$ret .= $item->url ? '</a>' : '</div>'; 
					break;

				// menu item with many sub-items rendering
				case 'multi':

					$links		= '';
					$menuClass	= '';

					// builds each sub-item link
					foreach ($item->list as $i) {

						// check on permissions
						if (isset($i->url) and !(is_a($app->currentUser, 'Pair\User') and !$app->currentUser->canAccess($i->url))) {
							continue;
						}
						
						if ($i->url == $app->activeMenuItem) {
							$class		= ' active';
							$menuClass	= ' open';
						} else {
							$class		= '';
						}

						if ($i->class) {
							$class .= ' ' . $i->class;
						}

						$links .= '<a class="item' . $class . '" href="' . $i->url . '">' .
							(!is_null($i->badge) ? '<span class="badge">' . $i->badge . '</span>' : '') .
							'<span class="title">' . $i->title . '</span>' .
							'</a>';
					}
					
					// prevent empty multi-menu
					if ('' == $links) {
						break;
					}
					
					// assembles the multi-menu
					$ret .= '<div class="dropDownMenu' . $menuClass . '">' .
						'<div class="title">' . $item->title . '</div>' .
						'<div class="itemGroup">' . $links . '</div></div>';
					break;
					
				case 'separator':

					if (!$item->title) $item->title = '&nbsp;';
					$ret .= '<div class="separator">' . $item->title . '</div>';
					break;

			}

		}

		return $ret;

	}
public function render ( ) { $ app = Application :: getInstance ( ) ; $ ret = '' ; foreach ( $ this -> items as $ item ) { // check on permissions if ( isset ( $ item -> url ) and ! ( is_a ( $ app -> currentUser , 'Pair\User' ) and ! $ app -> currentUser -> canAccess ( $ item -> url ) ) ) { continue ; } switch ( $ item -> type ) { // single menu item rendering case 'single' : $ class = ( $ item -> url == $ app -> activeMenuItem ? ' active' : '' ) ; if ( $ item -> class ) { $ class .= ' ' . $ item -> class ; } // if url set <a>, otherwise set <div> $ ret .= $ item -> url ? '<a href="' . $ item -> url . '"' : '<div' ; $ ret .= ' class="item' . $ class . '"' . ( $ item -> target ? ' target="' . $ item -> target . '"' : '' ) . ( ! is_null ( $ item -> badge ) ? ' data-badge="' . ( int ) $ item -> badge . '" ' : '' ) . '>' . ( ! is_null ( $ item -> badge ) ? '<span class="badge">' . $ item -> badge . '</span>' : '' ) . '<span class="title">' . $ item -> title . '</span>' ; // if url close </a>, otherwise close </div> $ ret .= $ item -> url ? '</a>' : '</div>' ; break ; // menu item with many sub-items rendering case 'multi' : $ links = '' ; $ menuClass = '' ; // builds each sub-item link foreach ( $ item -> list as $ i ) { // check on permissions if ( isset ( $ i -> url ) and ! ( is_a ( $ app -> currentUser , 'Pair\User' ) and ! $ app -> currentUser -> canAccess ( $ i -> url ) ) ) { continue ; } if ( $ i -> url == $ app -> activeMenuItem ) { $ class = ' active' ; $ menuClass = ' open' ; } else { $ class = '' ; } if ( $ i -> class ) { $ class .= ' ' . $ i -> class ; } $ links .= '<a class="item' . $ class . '" href="' . $ i -> url . '">' . ( ! is_null ( $ i -> badge ) ? '<span class="badge">' . $ i -> badge . '</span>' : '' ) . '<span class="title">' . $ i -> title . '</span>' . '</a>' ; } // prevent empty multi-menu if ( '' == $ links ) { break ; } // assembles the multi-menu $ ret .= '<div class="dropDownMenu' . $ menuClass . '">' . '<div class="title">' . $ item -> title . '</div>' . '<div class="itemGroup">' . $ links . '</div></div>' ; break ; case 'separator' : if ( ! $ item -> title ) $ item -> title = '&nbsp;' ; $ ret .= '<div class="separator">' . $ item -> title . '</div>' ; break ; } } return $ ret ; }
Builds HTML of this menu.

@return string
Builds HTML of this menu .