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

if (!defined("STPBase")) {
	die("This file can't be accessed directly!");
}

class CWidgetsWidgetPageTitle extends CWidget {

	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $meta = array(
		"type"	=> "1",
		"name"	=> "Page Title",
		"module"	=> array(
			"name"	=> "",
			"id"	=> "",
			"type"	=> "",
		)
	);

	

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

		$set = array(
			"set_title_align"			=> "set_title_align",
			"set_subtitle_align"		=> "set_subtitle_align",
			"set_title_valign"			=> "set_title_valign",
			"set_subtitle_valign"		=> "set_subtitle_valign",

			"set_title_size"			=> "set_title_size",
			"set_title_size_lg"			=> "set_title_size_lg",
			"set_title_size_md"			=> "set_title_size_md",
			"set_title_size_sm"			=> "set_title_size_sm",
			"set_title_size_xs"			=> "set_title_size_xs",

			"set_subtitle_size"			=> "set_subtitle_size",
			"set_subtitle_size_lg"		=> "set_subtitle_size_lg",
			"set_subtitle_size_md"		=> "set_subtitle_size_md",
			"set_subtitle_size_sm"		=> "set_subtitle_size_sm",
			"set_subtitle_size_xs"		=> "set_subtitle_size_xs",

			"set_pt_css"				=> "set_pt_css",
			"set_pt_css_title"			=> "set_pt_css_title",
			"set_pt_css_subtitle"		=> "set_pt_css_subtitle",

			"set_pt_path_align"		=> "set_pt_path_align",

		);
		//prepare settings

		foreach ($set as $key => $val) {
			if (!$widget["settings"][$key]) {
				$set[$key] = $this->module->vars->data[$val];
			} else {
				$set[$key] = $widget["settings"][$key];
			}
		}


		return $this->tpl->blockReplace(
			"Main" , 
			array(
				"title"		=> $widget["widget_name"] ? $this->tpl->blockReplace(
					"Title",
					array(
						"title"	=> $widget["widget_name"]
					),
					$set
				) : "" ,

				"subtitle"	=> $widget["settings"]["lang_subtitle"] ? 
					$this->tpl->BlockReplace(
						"Subtitle",
						array(
							"header"	=> $widget["settings"]["lang_subtitle"]
						),
						$set
					)  : "",

				"module_id"	=> $widget["mod_id"] ? $widget["mod_id"]  : $widget["module_code"] ,
			),
			$set
		);
	}
	
}


?>