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


class CWidgetsWidgetFileList extends CWidget {

	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $meta = array(
		"type"	=> "16",
		"name"	=> "File List",
		"module"	=> array(
			"name"	=> "",
			"id"	=> "",
			"type"	=> "",
		)
	);

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

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

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

		foreach ($items as $key => $val) {			
			$items[$key]["icon"] = $this->tpl->blockreplace($val["item_icon"] ? "Icon" : "NoIcon" , $val );									
			$items[$key]["link"] =  $_CONF["url"] . "static/dl/{$widget[widget_id]}/{$val[item_id]}/item_file";
		}		

		return $this->tpl->blockReplace(
			"Main" , 
			array(
				"items"	=> $base->html->Table(
					$this->tpl , 
					"" , 
					$items,
					array(
						"collapsed"	=> $widget["settings"]["set_first"] ? "true" : "false",
					)
				),
			),
			$widget["settings"],
			$widget
		);	

	}
			

}


?>