/** * Loading inScheme data. * This is a json utility function * @return array */ protected function getConceptSchemesData() { $schemes = array(); $apiClient = new Editor_Models_ApiClient(); if (isset($this['inScheme']) && is_array($this['inScheme'])) { $schemes = $apiClient->getConceptSchemes($this['inScheme'], $this->data['tenant']); } return $schemes; }
/** * Get a relation description in a format that allows us to send it directly to the form. * @param string $relation * @param string $schemeUuid * @param string $schemeUri */ protected function _getRelationToForm($relation, $schemeUuid, $schemeUri) { $apiClient = new Editor_Models_ApiClient(); $relationData = array('uuid' => $schemeUuid, 'concepts' => array()); if (in_array($relation, self::$classes['SemanticRelations'])) { $callback = array($this, 'getAllRelations'); } else { $callback = array($this, 'getAllMappings'); } $currentLanguage = Zend_Registry::get('Zend_Locale')->getLanguage(); $concepts = $this->getRelationsByField($relation, $schemeUri, $callback, true); if (empty($concepts)) { return array(); } $schemesData = $apiClient->getConceptSchemes(); foreach ($concepts as $concept) { $previewLabel = $concept->getMlField('prefLabel', $currentLanguage); $isInternal = $this->isInternalRelation($concept['uri'], $relation); if (!$isInternal) { $previewLabel .= '*'; } $shemes = array(); foreach ($schemesData as $schemeData) { if (in_array($schemeData['uri'], $concept['inScheme'])) { $shemes[$schemeData['uri']] = $schemeData; } } $relationData['concepts'][] = array('concept' => array('uuid' => $concept['uuid'], 'uri' => $concept['uri'], 'previewLabel' => $previewLabel, 'remove' => $isInternal), 'schemes' => $shemes); } return $relationData; }