<?php
	/*
	 *
	 * 2003 - 2023 @ Yal Publicidad - yPanel
	 * www.yalpublicidad.com
	 * online@yalpublicidad.com
	 *
	 *
	 */
	
	/* Autorizo acceso */
		defined('YPANEL_INI') or die( 'No dispones de acceso' );

function crearBotonToggle($id, $value, $checked, $disabled = false, $onClick = NULL){
	return BotonToggle::crear($id, $value, $checked, $disabled, $onClick);
}

class BotonToggle{
	public static function crear( $id, $value, $checked, $disabled = false, $onClick = NULL ){
		if( empty( $id ) || empty( $value ) ) return NULL; 
		if( empty( $checked ) ) $checked=false;
			
		$disabled	= ( $disabled === true ) ? ' disabled ' : '';
		$ckd		= ( $checked == true || $checked != 0 || $checked != '0' ) ? ' checked ' : '';
		$on			= ( !empty($onClick) ) ? ' onClick="' . $onClick . '"' : '';
		// creo boton toggle
		$bToggle = '<div class="tgl-item"><input type="checkbox" class="tgl tgl-light" id="' . $id . '" name="' . $id . '" value="' . $value . '"' . $on . $ckd . $disabled . ' /><label class="tgl-btn" for="' . $id . '"></label></div>';
			
			return $bToggle;
	}
}
	
?>