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

// dependencies

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

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

		$this->name = "widgetspage";
	}

	function DoEvents(){
		global $base, $_CONF, $_TSM , $_VARS , $_USER , $_BASE , $_SESS;

		if ($_GET["mod"] == $this->name) {


			$this->tpl_module = $this->module->plugins["modules"]->getModuleInfo($_GET["module_id"]);
			//debug($this->tpl_module,1);
			parent::DoEvents();

			$sub = $_GET["sub"];
			$action = $_GET["action"];

			//read the module
			$this->plugins["modules"]->ValidateModule($this->tpl_module);

			switch ($sub) {

				case "landing":
					$sub = "texts";
				case "texts":
					return $this->__adminTexts();
				break;
			}
		}
	}

	
	function onCreate($module_data) {
			
		$layout = $this->plugins["layouts"]->SaveLayout(
			array(
				"name"			=> $module_data["mod_name"],
				"block"			=> array(
					"css"		=> "no-margin-top",
					"col"	=> array(
						0 => array(
							"size"	=> 3 , 					
							"widget"	=> array( 
							)
						),					
						1 => array(
							"size"	=> 6 , 
							"widget"	=> array( 
								$this->plugins["comments"]->GetCommentsWidget()
							)
						),					
						2 => array(
							"size"	=> 3 , 
							"widget"	=> array( 
							),
						)
					)
				)				
			)
		);


		//update the layout id
		$this->plugins["modules"]->UpdateModuleSettings(
			$module_data["mod_id"] , 
			array(
				"set_layout"			=> $layout,
			)		
		);

		$this->CreatePageTitleBlock(array(
			"module_id"	=> $module_data["mod_id"],
			"title"		=> $module_data["mod_name"],
			"subtitle"	=> "You can edit this section in the Module Head tab",
			"show"		=> 1,
		));

	}

}

?>