<?php
/*
	DevSaver Web Framework
	Copyright (c) 2013-2016 DevSaver. 
	All rights reserved.
		web:  www.devsaver.com
		mail: support@devsaver.com				
*/


class CWidgetsWidgetLinkToDropMenu extends CWidget {

	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $meta = array(
		"type"	=> "5",
		"name"	=> "Link to Drop Menu",
		"module"	=> array(
			"name"	=> "",
			"id"	=> "",
			"type"	=> "",
		)
	);

	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function Render($widget) {

		$links = $this->plugins["menus"]->getDropdownLinks($widget["settings"]["set_category"]);

		if (!is_array($links)) {
			return "";
		}


		if (is_array($links)) {

			foreach ($links as $key => $val) {
				$links[$key]["selected"] = $val["selected"] ? $this->tpl->blockReplace("Selected" , $val) : "";
			}			
		}
		
		global $base;

		return $this->tpl->blockReplace(
			"Main" , 
			array(
				"items"	=> $base->html->table(
					$this->tpl , 
					"",	
					$links
				)
			),
			$widget 
		);
		

	}
	

}


?>