File: /var/www/vhosts/creativefellows.nl/hotel.creativefellows.nl/classes/EntryController.php
<?php
class EntryController extends BaseController{
function __construct($uid_entry, $fields, $entry_data, $form, $section_arr)
{
$this->uid = $entry_data["unique_id"];
$this->position = $entry_data["position"];
$this->status = $entry_data["status"];
$this->last_edit = $entry_data["last_edit"];
$this->date_created = $uid_entry["created"];
$this->form_id = isset($entry_data["form_id"]) ? $entry_data["form_id"] : 0;
$this->meta_title = $entry_data["meta_title"];
$this->meta_desc = $entry_data["meta_desc"];
$this->redirect = $entry_data["redirect"];
$this->first_field = $fields[0]["field_naam"];
$this->page_canvas = $section_arr["naam"];
$this->section_name = $section_arr["section_name"];
$this->entry_link = $uid_entry["url"]; //$this->vl($this->section_name) ."/".
$this->form = $form;
foreach($fields as $i=> $f)
{
$field_user = preg_replace("/[^0-9a-zA-Z]/","_",strtolower($f["field_naam"]));
$this->$field_user = $f["html"];
if($i == 0 && $this->meta_title == "") $this->meta_title = $this->$field_user;
}
$first_field_value = $fields[0]["field_naam"];
$this->entry_link_label = $this->$first_field_value;
}
public function getProperty($name,$type=null,$optional=null){
switch($type)
{
default:
return $type==null ? $this->$name : "<$type>". $this->$name ."</$type>";
break;
case "url":
return preg_replace("/(http|https):\/\//","",$this->$name);
break;
case "phonelink":
return $optional. ltrim(preg_replace("/[^0-9]/i","",$this->$name), '0');
break;
case "img":
case "image":
return '<img src="'. $this->$name[0] .'"/>';
break;
case "timestamp":
return strftime("%d %B %Y",strtotime($this->$name));
break;
}
}
public function getMetaTitle()
{
return $this->meta_title;
}
public function getMetaDesc()
{
return $this->meta_desc;
}
public function getForm()
{
return $this->form;
}
public function getLink(){
return '<a href="'. $this->entry_link .'">'. $this->entry_link_label .'</a>';
}
}
?>