Location: PHPKode > projects > EXtensible Production Suite (XPS) > xpsdev/install/controls/message_control.php
<?php



class Message_Control
{ 
	private $Message;
 	private $Setting_Control;
 
	public function __construct($Setting_Control)
	{
		require_once( MODELS . '/message.php');
		$this->Setting_Control = $Setting_Control;
		$this->Message = new Message($this->Setting_Control->get_setting('language'));
	}
	
	public function get_message($id)
	{
		return $this->Message->get_message($id);	 
	}
	
	public function get_label($id)
	{
		return $this->Message->get_label($id); 
	}
	
	public function get_breadcrumbs($jsfunc, $params)
	{
		//TITLE and PARENT
		if(isset($params['MODULE_ID']))
		{
			if(isset($params['child_id']))
			{
				$title = $params['child_id'];
				$parent = $params['MODULE_ID'];
			}
			else
			{
				$title = $params['MODULE_ID'];
				$parent = 'Home';
			}
		}
		else
		{
			$title = 'default';
		}
		
		//OFFSET
		if( isset($params['OFFSET']) )
		{
			$offset = $params['OFFSET'];
		}
		else
		{
			$offset = 0;
		}
		
		//FIRST CRUMB
		if(($parent=='Home') and isset($_SESSION['breadcrumbs']))
		{
			unset($_SESSION['breadcrumbs']);
		}
	
		if(!isset($_SESSION['breadcrumbs'])  )
		{
			$_SESSION['breadcrumbs'][] = array(	'title'		=> 'Home',
												'parent'	=> '',
												'onclick'	=> "launchCoreModule('HOME','')",
												'offset'	=> $offset
											   );
		}
		
		$chop_here = 0;
		foreach($_SESSION['breadcrumbs'] as $numeric_key => $breadcrumb)
		{
			if($chop_here == 1)
			{
				unset($_SESSION['breadcrumbs'][$numeric_key]);
			}
			elseif($breadcrumb['title'] == $title)
			{
				unset($_SESSION['breadcrumbs'][$numeric_key]);
				$chop_here = 1;
			}
		}
			
		$param_string = '';
		if(is_array($params))
		{
			foreach($params as $key => $val)
			{
				if( ($key != 'f') and ($key != 'MODULE_ID') )
				{
					$param_string .= '&'.$key.'='.$val;
				}
			}
		}
		
		$_SESSION['breadcrumbs'][] = array(	'title'		=> $title,
											'parent'	=> $parent,
											'onclick'	=> $jsfunc . "('" . $params['MODULE_ID'] . "', '" . $param_string . "')",
											'offset'	=> $offset
										   );
		$_SESSION['current_breadcrumb'] = end($_SESSION['breadcrumbs']);
		
		$bc_string = '';
		$first_entry = 0;
		$entry_count = 1;
		foreach($_SESSION['breadcrumbs'] as $key => $breadcrumb)
		{	
			if($first_entry==1)
			{
				$bc_string .= ' &#187; '; // entry delimiter
			}
			else
			{
				$bc_string .= '&nbsp;'; // space prion to first entry
				$first_entry = 1;
			}
			
			if( count($_SESSION['breadcrumbs']) == $entry_count)
			{
			$bc_string .= '<a class="current_breadcrumb" href="javascript: void(0)" onclick="' . $breadcrumb['onclick'] . '">' . $breadcrumb['title'] . '</a>'; //last entry
				break;
			}
			
			$bc_string .= '<a class="breadcrumb" href="javascript: void(0)" onclick="' . $breadcrumb['onclick'] . '">' . $breadcrumb['title'] . '</a>';
			$entry_count++;
		}
		
		return $bc_string;
	}
	
}//End Class
?>
Return current item: EXtensible Production Suite (XPS)