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/EnquiryEntity.php
<?php

class EnquiryEntity 
{
  
    public function __construct($fields, array $data) {
		
		foreach($data as $el => $val)
		{
			$this->$el = $val;
		}
		
		$this->fields = $fields;
		
			
    }

    public function getId() {
        return $this->enquiry_id;
    }	
	
    public function getCompany() {
        return $this->company_name;
    }



	
    public function getCity() {
        return $this->company_city;
    }
	
    public function getContact() {
        return $this->company_contact;
    }
	
    public function getDate() {
        return strftime("%d-%m-%Y", strtotime($this->date));
    }
	
	public function getAcronym($length=2)
	{
		$words = explode(" ", $this->company_name);
		
		if(count($words) == 1) return substr($this->company_name,0,2);
		
		$acronym = "";
		
		for($i=0;$i<$length;$i++)
		{
			$acronym .= $words[$i][0];
		}
		
		return $acronym;
	}
	
		
	public function getStatus()
	{
        return $this->status;
	}
	
	public function getStatusName()
	{
		switch($this->status){
			case 1:
				return "rapport";
			break;
			
			case 2:
				return "concept";
			break;
			
			case 3:
				return "afgehandeld";
			break;
		}
		
	}
	
	public function getUserId()
	{
        return $this->user_id;
	}
	
	public function getUserName()
	{
        return $this->user_name;
	}
	
	public function getSecondaryFieldTruck()
	{
		return $this->getEnquiryType();//"iets";//$this->getTruck();
	}
	
	public function getLink(){
        return preg_replace("/ /","-",$this->getCompany());
	}
	
	public function getEnquiryTypeId()
	{	
		return $this->type_enquiry;
	}

	
	public function getEnquiryType()
	{	
		return $this->getEnquiryLabel($this->type_enquiry);
	}
	
	private function getEnquiryLabel($type_id)
	{	
		return $this->fields["Klant"][4][5][$type_id];
	}

	public function getOrigin()
	{
		return $this->fields["Klant"][5][5][$this->origin]; 
	}	
	
	public function getFollowUp()
	{	
		return $this->fields["Klant"][6][5][$this->follow_up];
	}
	
	
	public function getElementValue($element_name,$input_type,$array_values=null)
	{	
		//echo $input_type." - ";
		switch($input_type)
		{
			case "select":
			case "select_smart":
				return $array_values[$this->$element_name];
			break;
			
			case "select_smart_multiple":
				
				$items 		= explode(", ",$this->$element_name);
				$selected 	= [];
				foreach($items as $option){
					$selected[] = $array_values[$option];
				}
				return implode(", ",$selected);
				
			break;
			
			case "price":
				return "€ ".number_format($this->$element_name, 2,',','.');
			break;
			
			case "switch":
				return $this->$element_name == "1" ? "ja" : "nee";
			break;
			
			case "upload2":
							
				foreach($this->$element_name as $img){
					$data .= '<a href="/enquiry/download/'. $img->getFileId() .'" target="_blank" class="image-upload" />'. $img->getOrgName() .'</a>';
				};
				
				return $data; 
			break;
			
			case "hidden":
				return $this->$element_name;
			break;
			
			
			case "input_copied":
				
				return $this->$array_values;
				
			break;
			
			default:	
				return $this->$element_name;
			break;
		}
		
	}
	


}