File: /var/www/vhosts/creativefellows.nl/jhtaxatie.creativefellows.nl/classes/BaseController.php
<?php
/**
* Description
*/
abstract class BaseController
{
/*
* Get role of user
*/
public function getUserRole()
{
return $this->user_role;
}
public function priceHuman($price,$symbol=false)
{
return ($symbol === true ? "<span style=\"color:#ccc;\">€</span> " : "" ) . number_format($price,2,',','.');
}
/*
* Get id of user
*/
public function getUserId()
{
return $this->user_id;
}
/*
* Get routename of current request
*/
public function getCurrentRouteName($request)
{
$route = $request->getAttribute('route');
return $route ? $route->getName() : null;
}
/*
* Get a form field based on input type
*/
public function getHTMLFields(array $fields_array)
{
$elements = [];
foreach($fields_array as $groupName => $fields)
{
foreach($fields as $i => $field)
{
$elements[$groupName][$i] = new HtmlElement($field);
}
}
return $elements;
}
public function getSiteUrl()
{
return $this->siteUrl;
}
public function setPageMax($int)
{
$this->pageMax = $int;
}
public function getPageMax()
{
return $this->pageMax = 20;
}
public function isOdd($number)
{
return $number & 1;
}
}
?>