<?php
class ViewUserControl extends ViewControl
{
	/**
	 * Set to true, if it is custom user control
	 * @var boolean
	 */
	public $userControl;
	
	public function initUserControl()
	{		
	}
	

	public function addViewPluginJSControl($name)
	{
		if($this->viewFormat == $name)
		{
			$this->AddJSFile("include/runnerJS/controls/".$name.".js", 'include/runnerJS/viewControls/ViewControl.js');
			$this->getJSControl();
			foreach ($this->settings as $settingName => $settingValue)
				$this->addJSControlSetting($settingName, $settingValue);
		}
	}
	/**
	 * Control settings filling
	 */
	public function init()
	{
		$this->userControl = true;
		
		// We need to add this dependencies ViewControl.js - for debug.
		// For build we need to add RunnerAll.js
		//$this->AddJSFile("include/runnerJS/controls/".$this->viewFormat.".js", 'include/runnerJS/viewControls/ViewControl.js');
		
					if($this->container->tName=="gestion" && $this->field=="estado")
		{
			$this->settings["name_enable"] = "Activo";                 // Name of Enable
$this->settings["name_disable"] = "Cerrado";               // Name of Enable
$this->settings["size"] = "normal";                    // Size field  values: large,normal,small,mini
$this->settings["style"] = "primary";                  // Style field  values: default,primary,success,info,warning,danger;
		}	
					if($this->container->tName=="gestion" && $this->field=="estado_pago")
		{
			$this->settings["name_enable"] = "Si";                 // Name of Enable
$this->settings["name_disable"] = "No";               // Name of Enable
$this->settings["size"] = "normal";                    // Size field  values: large,normal,small,mini
$this->settings["style"] = "info";                  // Style field  values: default,primary,success,info,warning,danger;
		}	
					if($this->container->tName=="gestion" && $this->field=="correlativo_pago")
		{
			$this->settings["name_enable"] = "On";                 // Name of Enable
$this->settings["name_disable"] = "Off";               // Name of Enable
$this->settings["size"] = "normal";                    // Size field  values: large,normal,small,mini
$this->settings["style"] = "primary";                  // Style field  values: default,primary,success,info,warning,danger;
		}	
		$this->addViewPluginJSControl("ViewToggle");
	}

	/**
	 * Get the field's content that will be exported
	 * @prarm &Array data
	 * @prarm String keylink
	 * @return String
	 */
	public function getExportValue(&$data, $keylink = "", $html = false )
	{
		return $data[ $this->field ];
	}
	
	/**
	 * Check for need to load the javascript files.
	 * Javascript files for user controls are always loaded.
	 * @return boolean
	 */
	public function neededLoadJSFiles() 
	{
		return true;
	}
	public function getPdfValue(&$data, $keylink = "")
	{
		return "''";
	}

}
?>