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