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


class CWidgetsWidgetFeaturesWSpinner extends CWidget {

	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $meta = array(
		"type"	=> "",
		"name"	=> "Features w/ Spinner",
		"module"	=> array(
			"name"	=> "",
			"id"	=> "",
			"type"	=> "",
		)
	);

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


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

		$items = $this->module->GetStaticItems($widget);

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

		$cnt = 1;
		foreach ($items as $key => $val) {

			$link = $this->plugins["modules"]->BuildLink(array(
				"type"	=> $val["item_link_type"],
				"link"	=> $val["item_link_link"],
				"module"=> $val["item_link_module"],
				"global"=> $val["item_link_global"],
			));

			$val["link"] = $link;

			$val["_button"]		= $val["link"] ? $this->tpl->blockReplace("Icon", $val) : "";
			$val["_title"]		= $val["item_title"] ? $this->tpl->blockReplace($link ? "Link" : "Title", $val) : "";
			$val["_subtitle"]	= $val["item_desc"] ? $this->tpl->blockReplace("Subtitle", $val) : "";
			$val["cnt"]			= $cnt ++; 

			$items[$key] = $val;
		}

		
				
		return $this->tpl->blockReplace(
			"Widget",
			array(
				"content"	=> $base->html->table(
					$this->tpl , 
					"",	
					$items
				) ,

				"icons"	=> $base->html->table(
					$this->tpl , 
					"Icons",	
					$items
				) ,

			),
			$widget,
			$widget["settings"]
		);

	}
			

}


?>