public function getNarrowerRelationsAction() { $data = array(); $conceptRaw = Api_Models_Concepts::factory()->getConcept($this->getRequest()->getParam('uuid')); if (null !== $conceptRaw) { $concept = new Editor_Models_Concept($conceptRaw); $relations = $concept->getNarrowers(); foreach ($relations as $relation) { $data[] = $relation->toArray(array('uuid', 'uri', 'status', 'schemes', 'previewLabel', 'previewScopeNote')); } } $this->getHelper('json')->sendJson(array('status' => 'ok', 'result' => $data)); }
/** * Get the narrowers of the concept prepared for rtf. * * @param Editor_Models_Concept $concept */ protected function _getRtfNarrowers($concept, $depthLevel) { $result = array(); $narrowers = $concept->getNarrowers(); foreach ($narrowers as $key => $narrowerConcept) { $narrowerConceptData = array(); $narrowerConceptData['previewLabel'] = $this->_constructRtfFieldData('previewLabel', $narrowerConcept->getPreviewLabel()); if ($depthLevel < $this->get('maxDepth') - 1) { $narrowerConceptNarrowers = $this->_getRtfNarrowers($narrowerConcept, $depthLevel + 1); if (!empty($narrowerConceptNarrowers)) { $narrowerConceptData['narrowers'] = $narrowerConceptNarrowers; } } $result[] = $narrowerConceptData; } return $result; }