HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/jhtaxatie.creativefellows.nl/classes/TaxationFormData.php
<?php


final class TaxationFormData extends Data
{
	protected $field_groups = [];
	protected $method 		= "post";
	protected $enctype 		= "multipart/form-data";
	protected $is_admin 	= false;
	protected $action		= "/heftruck-inruilen";
	
	protected $form_error_message = "Het formulier kan nog niet verstuurd worden, een aantal gemarkeerde velden bevatten waardes die niet lijken te kloppen.";
	protected $html;
	protected $class;
		
	function __construct(array $fields, array $post_data=[],$debug=false)
	{	
		
				
		$i = 0;
		foreach($fields as $group => $fields)
		{	
			$formGroup = new TaxationFormFieldGroup($group,$post_data,$debug);
			
			$formGroup->setFields($fields);
			$formGroup->setVisibility(($i == 0 ? true : false));
			$this->setGroup( $formGroup );
			$i++;
		}	
	}
	
	public function setClass($class)
	{
		$this->class = $class;
	}
	
	public function class()
	{
		return $this->class;
	}

	public function setAction($action)
	{
		$this->action = $action;
	}
	
	public function isAdmin($is_admin = true)
	{
		$this->is_admin = $is_admin;
	}	
	
	public function setGroup($group)
	{		
		$this->field_groups[] = $group;
	}
	
	public function groups()
	{		
		return $this->field_groups;
	}
	
	private function action()
	{
		return $this->action;
	}
	
	private function method()
	{
		return $this->method;
	}
	
	public function setMethod($method)
	{
		$this->method = $method;
	}

	public function render()
	{
		return $this->getHtml();
	}
	
	public function setType($enctype)
	{
		 $this->enctype = $enctype;
	}
	
	public function getHtml($confirm=false, $class=null)
	{
		
		$this->html = '<form action="'. $this->action() .'" method="post" class="form '. $this->class() .'" enctype="'. $this->enctype .'" data-abide novalidate>';
				
			foreach($this->groups() as $group)
			{	
				$this->html .= $group->html();	
			}
			$this->html .= $this->formError();

		$this->html .= '</form>';	
	
		return $this->html;
		
		
	}
	
	
	public function fieldsHtml()
	{
		$html = '';
		
		foreach($this->groups() as $g => $group)
		{	
			// hide images in email
			if($g >= 2) continue;
		
			$html .= $group->emailHtml();	
		}
		
		return $html;
	}

	
	private function formError()
	{
		return '<div class="small-12 columns">
					<div data-abide-error class="callout alert text-center" aria-live="assertive" style="display: none;">
						<p><i class="fi-alert"></i> '. $this->form_error_message .'</p>
					</div>
				</div>';
	}
	
	
}