<?php
/*
	Stempora web framework
	copyright (c) 2002-2013 Stempora
		web:  www.oxylus.ro
		mail: support@oxylus.ro		

	$Id: name.php,v 0.0.1 dd/mm/yyyy hh:mm:ss oxylus Exp $
	description
*/

// dependencies

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

	function CSocialMedia() {
		//$this->CPlugin($db, $tables , $templates);
		$this->name = "socialmedia";
	}

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

		parent::DoEvents();		


		if ($_GET["mod"] == "socialmedia") {
			$sub = $_GET["sub"];
			$action = $_GET["action"];

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

			switch ($sub) {

				case "landing":
					$_GET["sub"] = $sub = "services";
				case "services":
					$data = new CSQLAdmin($sub , $this->__parent_templates,$this->db,$this->tables,$extra);
					$this->PrepareFields($data->forms["forms"]);
					return $data->DoEvents();
				break;

				case "sharethis":
				case "addthis":

						$data = new CFormSettings($this->forms_path  . $sub . ".xml" ,$_CONF["forms"]["admintemplate"] , $this->db,$this->tables);
						$this->PrepareDashboard($data->form);

						if ($data->Done()) {							

							$this->vars->SetVars(
								$this->vars->ExtractVals(
									CForm::KeyFields($data->form),
									$_POST
								)
							);
						}
						
						return $data->Show($this->vars->data);
				break;

			}
		}

	}

	
	
	function adminGetWidgets($module) {

		$this->tpl_module = $this->module->plugins["modules"]->LoadDefaultModule("socialmedia");

		$widgets = array(
			array(
				"type"				=> "1",
				"name"				=> "Social Profiles",
				"module_name"		=> $module["module_name"],
				"module"			=> $module["module_id"],
				"module_type"		=> "2",
			),

			array(
				"type"				=> "2",
				"name"				=> "Share Buttons",
				"module_name"		=> $module["module_name"],
				"module"			=> $module["module_id"],
				"module_type"		=> "2",
			),

			array(
				"type"				=> "3",
				"name"				=> "Facebook Like Box",
				"module_name"		=> $module["module_name"],
				"module"			=> $module["module_id"],
				"module_type"		=> "2",
			),

			array(
				"type"				=> "4",
				"name"				=> "Twitter Feed",
				"module_name"		=> $module["module_name"],
				"module"			=> $module["module_id"],
				"module_type"		=> "2",
			),


		);
		return $widgets;

	}

}

?>