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