Commit b8acc0b6 authored by KarlPineau's avatar KarlPineau

update

parent 7ac6eaf9
......@@ -13,5 +13,5 @@
{% else %}
{# dump(entityProperty) #}
{% endif %}
<small>{% if displayPropertyId == true and displayQualifiers == true %}{% include "::property/qualifiers.html.twig" %}{% endif %}</small>
{% include "::property/qualifiers.html.twig" %}
{% endfor %}
......@@ -4,6 +4,7 @@
{% if "://" in value.mainsnak.text %}<a href="{{ value.mainsnak.text }}" target="_blank">{% endif %}
{{ value.mainsnak.text }}
{% if "://" in value.mainsnak.text %}</a>{% endif %}
{% include "::property/qualifiers.html.twig" %}
</li>
{% endfor %}
</ul>
\ No newline at end of file
<ul class="list-unstyled">
{% for value in entityPropertyValue.values %}
<li>
{{ value.mainsnak.amount }} ({{ data_data_wikidata_service.getLabelFromEntity(data_data_wikidata_service.getEntity(value.mainsnak.unit|replace({'http://www.wikidata.org/entity/': ''})), 'fr') }})
{{ value.mainsnak.amount }} {{ data_data_property_service.getQuantityPrecision(value.mainsnak.unit) }} {% include "::property/qualifiers.html.twig" %}
</li>
{% endfor %}
</ul>
\ No newline at end of file
......@@ -4,6 +4,7 @@
{% if "://" in value.mainsnak %}<a href="{{ value.mainsnak }}" target="_blank">{% endif %}
{{ value.mainsnak }}
{% if "://" in value.mainsnak %}</a>{% endif %}
{% include "::property/qualifiers.html.twig" %}
</li>
{% endfor %}
</ul>
\ No newline at end of file
<ul class="list-unstyled">
{% for value in entityPropertyValue.values %}
<li>
<span class="d-inline">{{ data_data_wikidata_service.computeTime(value.mainsnak) }}</span> <small class="d-inline">{% if displayPropertyId == true and displayQualifiers == true %}{% include "::property/qualifiers.html.twig" %}{% endif %}</small>
<span class="d-inline">{{ data_data_wikidata_service.computeTime(value.mainsnak) }}</span> {% include "::property/qualifiers.html.twig" %}
</li>
{% endfor %}
</ul>
\ No newline at end of file
<ul class="list-unstyled">
<ul class="list-inline d-inline">
{% for value in qualifierContainer.values %}
<li>
<li class="list-inline-item d-inline">
<span class="d-inline">{{ data_data_wikidata_service.computeTime(value) }}</span>
</li>
{% endfor %}
......
{# Gestion des qualificatifs #}
{% if value.qualifiers is defined %}
<ul class="list-inline">
{% for qualifierContainer in value.qualifiers %}
{% if attribute(data_data_qualifiers_service.getQualifiers(), attribute(qualifierContainer, "property")) is defined %}
<li>
{% set displayQualifiers = false %}
{% set qualifierConfig = attribute(data_data_qualifiers_service.getQualifiers(), attribute(qualifierContainer, "property")) %}
{% if value.qualifiers is defined and value.qualifiers | length > 0 %}
<small class="d-inline">
(
<ul class="list-inline d-inline">
{% for qualifierContainer in value.qualifiers %}
{% if attribute(data_data_qualifiers_service.getQualifiers(), attribute(qualifierContainer, "property")) is defined %}
<li class="list-inline-item d-inline">
{% set displayQualifiers = false %}
{% set qualifierConfig = attribute(data_data_qualifiers_service.getQualifiers(), attribute(qualifierContainer, "property")) %}
<strong class="d-inline">
{{ qualifierConfig['label'] }}
</strong>
<span class="d-inline">
{% set entityPropertyValue = qualifierContainer %}
{% include "::property/qualifiers-dispatcher.html.twig" %}
</span>
{% if loop.last == false %};{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
<strong class="d-inline">
{{ qualifierConfig['label'] }}
</strong>
<span class="d-inline">
{% set entityPropertyValue = qualifierContainer %}
{% include "::property/qualifiers-dispatcher.html.twig" %}
</span>
{% if loop.last == false %}<span class="d-inline">;</span>{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
)
</small>
{% endif %}
......@@ -13,8 +13,8 @@
{% set resumeArray = [] %}
{% if data_data_entity_service.get(entity, 'description') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.get(entity, 'description')]) %}
{% elseif data_data_entity_service.get(entity, 'P170') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.get(entity, 'P170')]) %}
{% elseif data_data_entity_service.get(entity, 'creator') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.getCreator(entity)]) %}
{% endif %}
{% if data_data_entity_service.getDateOfCreation(entity) != null %}
......
......@@ -94,7 +94,7 @@
<td>
<a href="{{ path("data_public_entity_view", {'id': entity.id}) }}">{{data_data_entity_service.get(entity, 'label')}}</a>
</td>
<td>{% if data_data_entity_service.get(entity, 'P170') != null %}{{ data_data_entity_service.get(entity, 'P170') }}{% else %}Auteur inconnu{% endif %}</td>
<td>{% if data_data_entity_service.getCreator(entity) != null %}{{ data_data_entity_service.getCreator(entity) }}{% else %}Auteur inconnu{% endif %}</td>
<td>{% if data_data_entity_service.getDateOfCreation(entity) != null %}{{ data_data_entity_service.getDateOfCreation(entity) }}{% else %}Datation inconnue{% endif %}</td>
</tr>
{% endfor %}
......
......@@ -36,8 +36,8 @@
{% set resumeArray = [] %}
{% if data_data_entity_service.get(entity, 'description') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.get(entity, 'description')]) %}
{% elseif data_data_entity_service.get(entity, 'P170') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.get(entity, 'P170')]) %}
{% elseif data_data_entity_service.getCreator(entity) != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.getCreator(entity)]) %}
{% endif %}
{% if data_data_entity_service.getDateOfCreation(entity) != null %}
......
......@@ -24,7 +24,7 @@
{% if data_data_entity_service.get(entity, 'description') != null %}
{{ data_data_entity_service.get(entity, 'description') | capitalize }}
{% else %}
{{ data_data_entity_service.get(entity, 'P170') }}
{{ data_data_entity_service.getCreator(entity) }}
{% endif %}
{% if data_data_entity_service.getDateOfCreation(entity) != null %}
......
......@@ -124,8 +124,6 @@ class ProposalChoiceController extends Controller
$listChoices = array();
foreach($propertyService->getProperties() as $propertyName => $propertyInformation) {
$question = $playerProposalChcoiceService->getValues($playerOeuvre, $propertyName, 3);
$logger->error("---> generateNewPlayerProposalChoices : question");
$logger->error(json_encode($question));
if($question != false) {
$listChoices[$propertyName] = $question;
}
......@@ -134,8 +132,6 @@ class ProposalChoiceController extends Controller
$em->persist($playerProposal);
$listChoicesRebuilt = array();
foreach($listChoices as $field => $choiceContainer) {
$logger->error("---> generateNewPlayerProposalChoices : choiceContainer");
$logger->error(json_encode($choiceContainer));
$playerProposalChoice = new PlayerProposalChoice();
$playerProposalChoice->setPlayerProposal($playerProposal);
$playerProposalChoice->setField($field);
......
......@@ -4,8 +4,8 @@
{% set resumeArray = [] %}
{% if data_data_entity_service.get(entity, 'description') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.get(entity, 'description')]) %}
{% elseif data_data_entity_service.get(entity, 'P170') != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.get(entity, 'P170')]) %}
{% elseif data_data_entity_service.getCreator(entity) != null %}
{% set resumeArray = resumeArray|merge([data_data_entity_service.getCreator(entity)]) %}
{% endif %}
{% if data_data_entity_service.getDateOfCreation(entity) != null %}
......
......@@ -28,6 +28,8 @@ class HomeController extends Controller
$propertiesCount = count($em->getRepository("DATADataBundle:EntityProperty")->findAll());
$alignmentsCount = count($entityService->find('all', ['enrichmentStatus' => 1]));
$import = count($entityService->find('all', ['importValidation' => false]));
return $this->render('DATAAdministrationBundle:Home:index.html.twig', array(
......
......@@ -102,6 +102,7 @@ class EntityController extends Controller
$qwd = null;
if($entity->getWikidataSameAs() != null) {
$qwd = $this->get('data_data.wikidata')->getQwd($entity->getWikidataSameAs());
$duplicates = $entityService->getDuplicates($entity);
}
return $this->render('DATADataBundle:Entity:view.html.twig', array(
......@@ -111,7 +112,8 @@ class EntityController extends Controller
'relatedViews' => $relatedViews,
'teachings' => $teachings,
'visits' => $visits,
'pad' => $pad
'pad' => $pad,
'duplicates' => $duplicates
));
}
......
......@@ -45,8 +45,9 @@
<a href="{{ path(data_data_entity_routing_service.getRoutingView(), {'id': entity.id}) }}">{{ data_data_entity_service.get(entity, 'label') }}</a>
{% if entity.importValidation != true %}<div class="badge badge-warning">À valider</div>{% endif %}
{% if entity.enrichmentStatus == 1 %}<div class="badge badge-info">Aligné</div>{% endif %}
{% if data_data_entity_service.getDuplicates(entity)|length > 0 %}<div class="badge badge-warning">Doublons</div>{% endif %}
</td>
<td>{% if data_data_entity_service.get(entity, 'P170') != null %}{{ data_data_entity_service.get(entity, 'P170') }}{% else %}Auteur inconnu{% endif %}</td>
<td>{% if data_data_entity_service.getCreator(entity) != null %}{{ data_data_entity_service.getCreator(entity) }}{% else %}Auteur inconnu{% endif %}</td>
<td>{% if data_data_entity_service.getDateOfCreation(entity) != null %}{{ data_data_entity_service.getDateOfCreation(entity) }}{% else %}Datation inconnue{% endif %}</td>
</tr>
{% else %}
......
......@@ -77,6 +77,17 @@
{% include 'DATADataBundle:Entity:View/view-wikipedia.html.twig' %}
</div>
<div class="col-12 col-sm-6">
{% if duplicates|length > 0 %}
<div class="alert alert-danger" role="alert">
Attention, doublons d'alignement :
<ul>
{% for duplicate in duplicates %}
<li><a href="{{ path('data_data_entity_view', {'id': duplicate.id}) }}">{{ data_data_entity_service.get(duplicate, 'label') }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% include 'DATADataBundle:Entity:View/view-informations.html.twig' %}
{% include 'DATADataBundle:Entity:View/view-visits.html.twig' %}
......
......@@ -144,9 +144,12 @@ class entity
* @param string $property
* @param string $language
* @return mixed|string|null
*
* @throws \Exception
*/
public function get($entity, $property, $language='fr') {
if($property == 'P571') {return $this->getDateOfCreation($entity);}
elseif($property == 'creator') {return $this->getCreator($entity, $language);}
if($entity->getEnrichmentStatus() == 1) {
/** @var EntityProperty $entityProperty */
......@@ -163,12 +166,48 @@ class entity
return null;
}
/**
* COMPATIBILITE : 3.0
* FONCTION : Retourne l'auteur d'une entité. Distinct de GET() car choisit entre des propriétés
*
* @param \DATA\DataBundle\Entity\Entity $entity
* @param string $language
* @return mixed|string|null
*
* @throws \Exception
*/
public function getCreator($entity, $language='fr') {
$entityProperty = null;
$prefix = "hda";
if($entity->getEnrichmentStatus() == 1) {
$prefix = "wd";
}
if($this->isPropertyExist($entity, $prefix.'-P170')) {
/** @var EntityProperty $entityProperty */
$entityProperty = $this->em->getRepository('DATADataBundle:EntityProperty')->findOneBy(['entity' => $entity, 'property' => $prefix.'-P170']);
} elseif($this->isPropertyExist($entity, $prefix.'-P84')) {
/** @var EntityProperty $entityProperty */
$entityProperty = $this->em->getRepository('DATADataBundle:EntityProperty')->findOneBy(['entity' => $entity, 'property' => $prefix.'-84']);
} elseif($this->isPropertyExist($entity, $prefix.'-P50')) {
/** @var EntityProperty $entityProperty */
$entityProperty = $this->em->getRepository('DATADataBundle:EntityProperty')->findOneBy(['entity' => $entity, 'property' => $prefix.'-50']);
}
if($entityProperty != null) {
return $this->property->getLitteralFromPropertyValue($entityProperty, $language);
}
return null;
}
/**
* COMPATIBILITE : 3.0
* FONCTION : Retourne la date de création
*
* @param $entity \DATA\DataBundle\Entity\Entity
* @return mixed|null
* @throws \Exception
*/
public function getDateOfCreation($entity) {
if($entity->getEnrichmentStatus() == 1) {
......@@ -218,6 +257,25 @@ class entity
}
}
/**
* @param \DATA\DataBundle\Entity\Entity $entity
* @return array
*/
public function getDuplicates($entity) {
$duplicates = array();
if($entity->getWikidataSameAs() != null) {
$duplicatesI = $this->find('all', ["wikidataSameAs" => $entity->getWikidataSameAs()]);
foreach ($duplicatesI as $duplicateI) {
if($duplicateI != $entity) {
$duplicates[] = $duplicateI;
}
}
}
return $duplicates;
}
/* -------------------------------------------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------------------------------------------- */
......@@ -327,6 +385,7 @@ class entity
public function getProperties($entity, $prefix=null, $sort=null) {
$properties = $this->em->getRepository('DATADataBundle:EntityProperty')->findBy(['entity' => $entity]);
$propertiesInfo = $this->property->getProperties();
$groupGropertiesInfo = $this->property->getGroupProperties();
if($prefix != null) {
$selection = [];
......@@ -337,12 +396,10 @@ class entity
$propertyId = explode('-', $property->getProperty())[1];
if(key_exists($propertyId, $propertiesInfo)) {
if($propertiesInfo[$propertyId]['displayOrder'] == "null") {
$orderProperty = count($properties)+$key;
} else if($propertiesInfo[$propertyId]['displayOrder'] == "false") {
if($propertiesInfo[$propertyId]['displayOrder'] == "false") {
$orderProperty = null;
} else {
$orderProperty = $propertiesInfo[$propertyId]['displayOrder'];
$orderProperty = intval(strval($groupGropertiesInfo[$propertiesInfo[$propertyId]["displayGroup"]]).strval($propertiesInfo[$propertyId]['displayOrder']));
}
} else {
$orderProperty = count($properties)+$key;
......
......@@ -106,6 +106,17 @@ class property
return $configProperties['properties'];
}
/**
* COMPATIBILITE : 3.0
* FONCTION : Liste les propriétés compatibles avec Clichés! ainsi que tous les attributs nécessaires
*
* @return array
*/
public function getGroupProperties() {
$configProperties = Yaml::parseFile(__DIR__ . "/../../../../web/properties.yml");
return $configProperties['groups'];
}
/**
* COMPATIBILITE : 3.0
* FONCTION : Génère une "value" correctement structurée pour EntityProperty
......@@ -190,4 +201,28 @@ class property
}
return $precisions;
}
/**
* COMPATIBILITE : 3.0
* FONCTION : Retourne la précision d'une quantité au format chaine de caractère
*
* @param string $unit
* @return string
*/
public function getQuantityPrecision($unit) {
switch ($unit) {
case "http://www.wikidata.org/entity/Q174789":
return "millimètre(s)";
case "http://www.wikidata.org/entity/Q174728":
return "centimètre(s)";
case "http://www.wikidata.org/entity/Q11573":
return "mètre(s)";
case "http://www.wikidata.org/entity/Q11570":
return "kilo(s)";
case "http://www.wikidata.org/entity/Q191118":
return "tonne(s)";
default:
return $unit;
}
}
}
\ No newline at end of file
......@@ -40,7 +40,7 @@
<tr>
<td>{{ ((favorites.getPaginationData.current-1)*100)+loop.index }}</td>
<td><a href="{{ path('data_public_entity_view', {'id': favorite.entity.id}) }}">{{data_data_entity_service.get(favorite.entity, 'label')}}</a></td>
<td>{% if data_data_entity_service.get(entity, 'P170') != null %}{{ data_data_entity_service.get(entity, 'P170') }}{% else %}Auteur inconnu{% endif %}</td>
<td>{% if data_data_entity_service.getCreator(entity) != null %}{{ data_data_entity_service.getCreator(entity) }}{% else %}Auteur inconnu{% endif %}</td>
<td>{% if data_data_entity_service.getDateOfCreation(entity) != null %}{{ data_data_entity_service.getDateOfCreation(entity) }}{% else %}Datation inconnue{% endif %}</td>
</tr>
{% else %}
......
<link rel="schema.DC" />
<meta name="DC.title" content="{{ data_data_entity_service.get(entity, 'label') }}" />
{% if data_data_entity_service.getDateOfCreation(entity) != null %}<meta name="DC.date" content="{{ data_data_entity_service.getDateOfCreation(entity) }}" />{% endif %}
{% if data_data_entity_service.get(entity, 'P170') != null %}<meta name="DC.creator" content="{{ data_data_entity_service.get(entity, 'P170') }}" />{% endif %}
{% if data_data_entity_service.getCreator(entity) != null %}<meta name="DC.creator" content="{{ data_data_entity_service.getCreator(entity) }}" />{% endif %}
{% if teachings|length > 0 %}<meta name="DC.subject" content="{% for teaching in teachings %}{% if loop.index > 1 %}, {% endif %}{{ teaching.name }}{% endfor %}" />{% endif %}
<meta name="DC.publisher" content="Clichés! - {{ app.request.getSchemeAndHttpHost() }}/data" />
<meta name="DC.language" content="fr" scheme="ISO639-1" />
......
types:
visualItem: "Q4502142"
architecture: "Q811979"
groupsOrder:
groups:
designation: 1
description: 2
image: 3
......@@ -152,10 +152,15 @@ properties:
displayGroup: "creator"
displayOrder: 2
displayCliches: "true"
P193:
label: "Maître d'oeuvre"
displayGroup: "creator"
displayOrder: 3
displayCliches: "true"
P50:
label: "Auteur"
displayGroup: "creator"
displayOrder: 3
displayOrder: 4
displayCliches: "true"
# Mouvement / Genre / style
......@@ -196,10 +201,15 @@ properties:
displayGroup: "location"
displayOrder: 4
displayCliches: "true"
P131:
label: "Localisation administrative"
displayGroup: "location"
displayOrder: 5
displayCliches: "false"
P625:
label: "Coordonnées géographiques"
displayGroup: "location"
displayOrder: 5
displayOrder: 6
displayCliches: "false"
# Conservation
......
......@@ -42,3 +42,9 @@ qualifiers:
P4241:
label: "précision sur la date"
displayOrder: "after"
P972:
label: "catalogue"
displayOrder: "after"
P195:
label: "collection"
displayOrder: "after"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment