Skip to content

Commit

Permalink
fixes #531 and #532
Browse files Browse the repository at this point in the history
  • Loading branch information
henriyli committed Jun 13, 2016
1 parent f21d74b commit 2a0a044
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions model/Concept.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Concept extends VocabularyDataObject

'skos:topConceptOf', # because it's too technical, not relevant for users
'skos:inScheme', # should be evident in any case
'skos:member', # this is shouldn't be shown on the group page
'skos:member', # this shouldn't be shown on the group page
'dc:created', # handled separately
'dc:modified', # handled separately
);
Expand Down Expand Up @@ -83,6 +83,20 @@ public function getType()
return $this->resource->types();
}


/**
* Returns a boolean value indicating whether the resource is a group defined in the vocab config as skosmos:groupClass.
* @return boolean
*/
public function isGroup() {
$groupClass = $this->getVocab()->getConfig()->getGroupClassURI();
if ($groupClass) {
$groupClass = EasyRdf_Namespace::shorten($groupClass) !== null ? EasyRdf_Namespace::shorten($groupClass) : $groupClass;
return in_array($groupClass, $this->getType());
}
return false;
}

/**
* Returns a boolean value indicating if the concept has been deprecated.
* @return boolean
Expand Down Expand Up @@ -316,7 +330,7 @@ public function getProperties()
}
// EasyRdf requires full URIs to be in angle brackets

if (!in_array($prop, $this->DELETED_PROPERTIES)) {
if (!in_array($prop, $this->DELETED_PROPERTIES) || ($this->isGroup() === false && $prop === 'skos:member')) {
$propres = new EasyRdf_Resource($prop, $this->graph);
$proplabel = $propres->label($this->getEnvLang()) ? $propres->label($this->getEnvLang()) : $propres->label();
$superprop = $propres->get('rdfs:subPropertyOf') ? $propres->get('rdfs:subPropertyOf')->getURI() : null;
Expand Down
2 changes: 1 addition & 1 deletion view/group-contents.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% endif %}
<li id="hierarchy{% if not vocab.config.showHierarchy %}-disabled{% endif %}"><a href="#" id="hier-trigger"{% if not vocab.config.showHierarchy %} title="{% trans 'hierarchy-disabled-help' %}"{% endif %}>{% trans "Hier-nav" %}</a></li>
{% if vocab.config.groupClassURI %}
<li id="groups" class="active"><a href="{{ request.vocabid }}/{{ request.lang }}/groups{% if request.contentLang != request.lang %}?clang={{ request.contentLang }}{% endif %}">{% trans "Group-nav" %}</a></li>
<li id="groups"{% if search_results|first.isGroup %} class="active"{% endif %}><a href="{{ request.vocabid }}/{{ request.lang }}/groups{% if request.contentLang != request.lang %}?clang={{ request.contentLang }}{% endif %}">{% trans "Group-nav" %}</a></li>
{% endif %}
{% if vocab.config.showChangeList %}
<li id="changes"><a href="{{ request.vocabid }}/{{ request.lang }}/new{% if request.contentLang != request.lang %}?clang={{ request.contentLang }}{% endif %}">{% trans "Changes-nav" %}</a></li>
Expand Down

0 comments on commit 2a0a044

Please sign in to comment.