<?php
/*
	Stempora Web Framework
	Copyright (c) 2002-2014 Stempora. 
	All rights reserved.
		web:  www.stempora.com
		mail: support@stempora.com		
*/

// dependencies

/**
* description
*
* @library	
* @author	
* @since	
*/
class CCategory extends CPlugin{
	
	var $tplvars; 

	function CCategory() {
		//$this->CPlugin($db, $tables , $templates);
	}

	function DoEvents(){
		
	}

	function __init() {
		global $_CONF;

		if ($this->__inited) {
			return "";
		}
		$this->tpl_module = $this->module->plugins["modules"]->LoadModuleInfo();
	} 


	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function GetMenuButton($module) {

		if (is_array($modules = $this->plugins["modules"]->modules)) {

			foreach ($modules as $key => $val) {

				if (($module["mod_id"] == $val["mod_parent"]) && !$val["mod_invisible"]) {
					if (method_exists($this->plugins[$val["module_code"]] , "GetMenuButton")) {

						$tmp = $this->plugins[$val["module_code"]]->GetMenuButton($val);

						if (is_array($tmp)) {
							if (!is_array($tmp[0])) {
								$tmp = array( 0=> $tmp);
							}

						
							foreach ($tmp as $_key => $_val) {
								if (is_array($_val)) {
									$submenu[] = $_val;
								}
								
							}
							
						}

					}
				}				
			}

			return array(			
					"mod_id"	=> $module["mod_id"] ,

					"title"		=> $module["mod_name"],
					"link"		=> "#",//$module["link"],
					"selected"	=> "",
					"target"	=> "",

					"html"		=> "",
					"sub"		=> $submenu,
			);

		}
		
	}
	
}

?>