"./?state=mp");
        parent::__construct('formEditPromotion', $op);
    }
	protected function generaCamposFormulario($datos, $errores = array()){
		$html ="";
        if (!isset($_SESSION['message'])) {
        // Se generan los mensajes de error si existen.
        $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
		$errorId = self::createMensajeError($errores, 'id', 'span', array('class' => 'error'));
        //$errorTittle = self::createMensajeError($errores, 'tittle', 'span', array('class' => 'error'));
        //$errorDescription = self::createMensajeError($errores, 'description', 'span', array('class' => 'error'));
        //$errorCode = self::createMensajeError($errores, 'code', 'span', array('class' => 'error'));
		//$errorActive = self::createMensajeError($errores, 'active', 'span', array('class' => 'error'));
		//$errorImage = self::createMensajeError($errores, 'image', 'span', array('class' => 'error'));
		$html .= '
		ELIMINAR PROMOCIÓN
						
					 
						
						     
						
					 
				';
		}
        return $html;
    }
	protected function procesaFormulario($datos){
        $result = array();
        
        $id =  $this->test_input($_POST['id']) ?? null;
        if ( is_null($id)) {
			$result['id'] = "La promoción seleccionada no existe.";
		}
        
        if (count($result) === 0) {
        	$bd = new Promotion_DAO("complucine");
			
			$exist = $bd-> promotionData($id);
			if(mysqli_num_rows($exist) == 1){
				$bd->deletePromotion($id);
				$_SESSION['message'] = "
										
										
											
												 Operacion realizada con exito 
												 Se ha eliminado la promocion correctamente en la base de datos.
												
											 
										 
										
									 
									";
				//$result = './?state=mp';
			}
			else{
				
                $result[] = "La promocion seleccionada no existe.";
			}
			$exist->free();
		}
		return $result;
	}
}
?>