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