<?php
namespace App\Smarty\Functions; class CorporateContactLabel { static public function create($params, $smarty) { $defaultOutput = ''; if ($params['default']) { $defaultOutput = $params['default']; } if (is_object($params['ref']) and get_class($params['ref'])=='Entity\CorporateContact') { $corporateContact = $params['ref']; } elseif ( is_numeric($params['ref']) and $params['ref']>0 ) { $corporateContact = \Entity\CorporateContact::select($params['ref']); if (!$corporateContact->recordExists()) { return $defaultOutput; } } else { return $defaultOutput; } if ($params['assign']) { $smarty->assign($params['assign'], $corporateContact); return ''; } if ($params['hideLink']) { return $corporateContact->getId(); } else { return sprintf("<span class=\"remoteLoadLink\" onclick=\"RemoteLoad.loadEntity(this, '%s', '%s');\">#%s</span>", 'corporateContact', $corporateContact->getId(), $corporateContact->getId()); } } }