<?php
class sbLayout {
	/**
	 * Function  that prints the header of our board	
	 * @param $my_id
	 * @param $type
	 * 			What kind of header do you want to print: 1: default (home/profile/latest posts/faq), 2: extended1 (home/profile/view/pending messages/faq) ,3:extended2 (home/profile/reply/view/pdf/faq)
	 * @return void
	 * TODO: lots of stuff, mainly vars need to be passed etc
	 */
	function printSimpleboardHeader($my_id,$type,$view="") {
		global $sbConfig, $sbIcons,$sbp;
		echo '<link rel="stylesheet" href="components/com_simpleboard/template/'.  $sbConfig['template'] . '/forum.css" type="text/css" />';
		echo '<table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">';
		echo '<tr><td align="center">';
        echo '<table border="0" width="100%">';
        include($sbp.'/searchbox.php');
        echo '<tr><td align="center"><b><font size="2">'.$board_title.'</font></b>';
        echo $sbConfig['board_offline'] ? '<br /><font color="red">' ._FORUM_IS_OFFLINE. '</font>' : '&nbsp;' ;
        echo '</td></tr></table><br />';
		echo '<div align="center">';		
		echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid).'">';
	    echo $sbIcons['home'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['home'].'" border="0" alt="'._HOME.'"  title="'._HOME.'" />' : _HOME; 
   	    echo '</a>';
   	    if ($my_id != 0)
		{
		    echo $sbIcons['profile'] ?'':'| ';
		    echo '<a href="'. $sbConfig['cb_profile'] ? sefRelToAbs('index.php?option=com_comprofiler&amp;Itemid='.$cbitemid) :  sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=userprofile&amp;do=show').'">';
	       	echo $sbIcons['profile'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['profile'].'" border="0" alt="'._GEN_MYPROFILE.'" title="'._GEN_MYPROFILE.'"/>' : _GEN_MYPROFILE;
	    	echo '</a>';
	  	}   	    
		switch ($type) {
				case 3:
				    echo $sbIcons['menureply'] ?'':'| '; 
					echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;replyto='.$thread.'&amp;catid='.$catid).'">';
					echo $sbIcons['menureply'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['menureply'].'" border="0" alt="'._GEN_POST_REPLY.'" title="'._GEN_POST_REPLY.'"/>' : _GEN_POST_REPLY;?>
			        echo '</a>';
			        if ($view=="flat")
			        {
		            echo $sbIcons['threadedview'] ?'':'| '; 
		            echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&amp;view=threaded&amp;id='.$id.'&amp;catid='.$catid).'">';
		            echo $sbIcons['threadedview'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['threadedview'].'" border="0" alt="'._GEN_THREADED_VIEW.'" title="'._GEN_THREADED_VIEW.'"/>' : _GEN_THREADED_VIEW;
		            echo '</a>';
      			    }
			          else
			          {
		            echo $sbIcons['flatview'] ?'':'| '; echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&amp;id='.$id.'&amp;view=flat&amp;catid='.$catid).'">';
		            echo $sbIcons['flatview'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['flatview'].'" border="0" alt="'._GEN_FLAT_VIEW.'" title="'._GEN_FLAT_VIEW.'"/>' : _GEN_FLAT_VIEW;
		            echo "</a>";
			          }
			 
					 if ($sbConfig['enablePDF'] ) {
					 |
			 <a href="<?php echo $mls;?>/index.php?option=com_simpleboard&id=<?php echo $id;?>&catid=<?php echo $catid;?>&func=sb_pdf" target="_blank" border="0">
		 	<?php echo $useIcons ? '<img src="<?php echo $mls;?>/images/M_images/pdf_button.png" height="16" width="16" alt="PDF" border="0" title="<?php echo _GEN_PDF_A;?>" />' : _GEN_PDF; ?>
			</a>			
					break;
				case 2:
					if ($view=="flat")
					{
						echo $sbIcons['threadedview'] ?'':'| '; echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&amp;view=threaded&amp;id='.$id.'&amp;catid='.$catid).'">';
						echo $sbIcons['threadedview'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['threadedview'].'" border="0" alt="'._GEN_THREADED_VIEW.'" title="'._GEN_THREADED_VIEW.'"/>' : _GEN_THREADED_VIEW;
						echo '</a>';
					}
					else
					{
						echo $sbIcons['flatview'] ?'':'| '; echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&amp;id='.$id.'&amp;view=flat&amp;catid='.$catid).'">';
						echo $sbIcons['flatview'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['flatview'].'" border="0" alt="'._GEN_FLAT_VIEW.'" title="'._GEN_FLAT_VIEW.'"/>' : _GEN_FLAT_VIEW;
						echo "</a>";
					}

					if ($is_moderator || $is_admin){
						if ($numPending>0)
						{
							$numcolor='<font color="red">';
							echo $sbIcons['pendingmessages'] ?'':' | '; echo ' <a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=review&action=list&amp;catid='.$catid).'">';
							echo $sbIcons['pendingmessages'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['pendingmessages'].'" border="0" alt="'.$numPending.' '._SHOWCAT_PENDING.'" />' : $numcolor.''.$numPending.'</font> '._SHOWCAT_PENDING;
							echo '</a>';
						}else{
							echo $sbIcons['nopendingmsgs'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['nopendingmsgs'].'" border="0" alt="'._SHOWCAT_NOPENDING.'" title="'._SHOWCAT_NOPENDING.'" />' : ' | '._SHOWCAT_NOPENDING;
						}
					}
					break;
				case 1:
				default: 
			    	   	echo $sbIcons['showlatest'] ?'':'| ';
			    	   	echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=latest').'">';
	     				echo $sbIcons['showlatest'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['showlatest'].'" border="0" alt="'._GEN_LATEST_POSTS.'" title="'._GEN_LATEST_POSTS.'"/>' : _GEN_LATEST_POSTS; 
						echo '</a>';
					break;
			
		}
		echo $sbIcons['help'] ?'':'| ';
		echo '<a href="'. sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=faq').'">';
     	echo $sbIcons['help'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['help'].'" border="0" alt="'._GEN_HELP.'" title="'._GEN_HELP.'"/>' : _GEN_HELP; 
		echo '</a>';
		echo '</div>';
		echo '<br />';
	}
}



