* @package taoDelivery */ class DeliveryFieldsService extends ConfigurableService { use OntologyAwareTrait; const SERVICE_ID = 'taoDelivery/deliveryFields'; const PROPERTY_CUSTOM_LABEL = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#CustomLabel'; /** * Getting custom label from Delivery * * @param \core_kernel_classes_Resource $delivery * @param string $label * @return string */ public function getLabel(\core_kernel_classes_Resource $delivery, $label = '') { $user = \common_session_SessionManager::getSession()->getUser(); $customLabelRoles = $this->getOption(self::PROPERTY_CUSTOM_LABEL); if (array_intersect($customLabelRoles, $user->getRoles())) { $property = $this->getProperty(self::PROPERTY_CUSTOM_LABEL); if ((string)$delivery->getOnePropertyValue($property)) { $label = $delivery->getOnePropertyValue($property); } } return (string) $label; } /** * get Title of the Webpage on the Browser Tab when Run delivery Execution * * @param core_kernel_classes_Resource $delivery * @return string */ public function getDeliveryExecutionPageTitle(core_kernel_classes_Resource $delivery) { return __('TAO: %s', $delivery->getLabel()); } }