diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..e5384a8cf9d2743a1ddee2df1f7ed5d3631399a1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +################ +# GitLabCI template for Drupal projects. +# +# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. +# It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained. +# As long as you include the project, ref and three files below, any future updates added by the Drupal Association will be used in your +# pipelines automatically. However, you can modify this template if you have additional needs for your project. +# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/ +################ + +# For information on alternative values for 'ref' see https://project.pages.drupalcode.org/gitlab_templates/info/templates-version/ +# To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml +include: + - project: $_GITLAB_TEMPLATES_REPO + ref: $_GITLAB_TEMPLATES_REF + file: + - "/includes/include.drupalci.main.yml" + - "/includes/include.drupalci.variables.yml" + - "/includes/include.drupalci.workflows.yml" + +################ +# Pipeline configuration variables are defined with default values and descriptions in the file +# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml +# Uncomment the lines below if you want to override any of the variables. The following is just an example. +################ +# variables: +# SKIP_ESLINT: '1' +# OPT_IN_TEST_NEXT_MAJOR: '1' +# _CURL_TEMPLATES_REF: 'main' diff --git a/README.md b/README.md index ca25a5e888e09a4e0a46ddb95bd9f06909a42727..6c46d567c6ef007021c3dfbccb793c98906aefdd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Capdata RDF Connector CapData RDF est un composant clé du projet CapData Opéra - France 2030, -porté par la Réunion des Opéras de France dans le cadre du programme France 2030. -Ce module vise à faciliter l'alignement et l'exposition des données au format RDF, +porté par la Réunion des Opéras de France dans le cadre +du programme France 2030. Ce module vise à faciliter +l'alignement et l'exposition des données au format RDF, essentiel pour l'interopérabilité et le partage des données culturelles. Pour une description complète du module, veuillez visiter la @@ -14,4 +15,5 @@ Page de configuration propre au module: `admin/config/services/capdata-mapping`. ## Génération du fichier d'export -Commande drush pour générer le fichier d'export: `drush capdata-rdf-export --uri=https://opera-exemple.com` \ No newline at end of file +Commande drush pour générer le fichier d'export: +`drush capdata-rdf-export --uri=https://opera-exemple.com` diff --git a/capdata_connector.info.yml b/capdata_connector.info.yml index c5ecbdf6e70b357ff03af98660058d433a0dde00..4f0c8ef84539b2f3d468b7d698431abcf7d02d74 100644 --- a/capdata_connector.info.yml +++ b/capdata_connector.info.yml @@ -3,4 +3,4 @@ type: module description: 'Export des données du site Drupal dans un fichier au format RDF.' core_version_requirement: ^9 || ^10 package: CapData Opéra -configure: capdata_connector.admin_settings \ No newline at end of file +configure: capdata_connector.admin_settings diff --git a/capdata_connector.libraries.yml b/capdata_connector.libraries.yml index 9ec25a56253b292164848d786c4f03c0f79d34b1..549f0dc16ee45478f72459cc8d6da9a21bf820dc 100644 --- a/capdata_connector.libraries.yml +++ b/capdata_connector.libraries.yml @@ -1,4 +1,4 @@ capdata_settingsstyles: css: theme: - css/capdataconnector-settings-form.css: {} \ No newline at end of file + css/capdataconnector-settings-form.css: {} diff --git a/capdata_connector.links.menu.yml b/capdata_connector.links.menu.yml index 36b5d57205094ac4a0ad37d0dab71ac62200efe5..fd1bfc28bc7724b6162159e311c48a53842435c2 100644 --- a/capdata_connector.links.menu.yml +++ b/capdata_connector.links.menu.yml @@ -2,4 +2,4 @@ capdata_connector.admin_settings: title: 'Capdata Connector Settings' route_name: capdata_connector.admin_settings description: 'Configurer les paramètres du Capdata Connector' - parent: system.admin_config_services \ No newline at end of file + parent: system.admin_config_services diff --git a/capdata_connector.module b/capdata_connector.module index 90e8ac7edf7e7f37e1512e4acd13cb00217b16ae..bc9b62f577dbc16455209aac2578491ebe5d3c69 100644 --- a/capdata_connector.module +++ b/capdata_connector.module @@ -11,11 +11,11 @@ use Drupal\Core\Routing\RouteMatchInterface; * Implements hook_help(). */ function capdata_connector_help(string $route_name, RouteMatchInterface $route_match) : string { - $help = ''; - switch ($route_name) { - case 'help.page.capdata_connector': - $help = '<p>' . t('Ce module permet de gérer le mapping des différentes classes et propriétés de l\'ontologie aux structures de données de Drupal.') . '</p>'; - break; - } - return $help; -} \ No newline at end of file + $help = ''; + switch ($route_name) { + case 'help.page.capdata_connector': + $help = '<p>' . t("Ce module permet de gérer le mapping des différentes classes et propriétés de l'ontologie aux structures de données de Drupal.") . '</p>'; + break; + } + return $help; +} diff --git a/capdata_connector.routing.yml b/capdata_connector.routing.yml index 956851d597dde879391b0fb7fe5f06085f778408..05b4164e9ddb1f20ce87750639d8fc7f4a72e2d0 100644 --- a/capdata_connector.routing.yml +++ b/capdata_connector.routing.yml @@ -12,4 +12,5 @@ capdata_connector.capdata_export: _controller: '\Drupal\capdata_connector\Controller\RofExportController::capdataRdfExport' _title: 'ROF' requirements: - _access: 'TRUE' \ No newline at end of file + # Needs to be accessed by an anonymous user. + _access: 'TRUE' diff --git a/capdata_connector.services.yml b/capdata_connector.services.yml index a8decf1361e3e92db71c16fee8321579e57d63e6..cd767fa787211304c223cc93404cbd90de4ee253 100644 --- a/capdata_connector.services.yml +++ b/capdata_connector.services.yml @@ -7,4 +7,4 @@ services: - '@config.factory' - '@request_stack' - '@file_url_generator' - - '@module_handler' \ No newline at end of file + - '@module_handler' diff --git a/css/capdataconnector-settings-form.css b/css/capdataconnector-settings-form.css index adaaba5ca30d9143666a68ab6352ca9fad17e157..0c803d53cbc0c2f3b5ae9de7daf42e8b51692f95 100644 --- a/css/capdataconnector-settings-form.css +++ b/css/capdataconnector-settings-form.css @@ -1,4 +1,4 @@ -.single-capdata-property-fieldset .fieldset__wrapper{ - display: flex; - justify-content: space-between; -} \ No newline at end of file +.single-capdata-property-fieldset .fieldset__wrapper { + display: flex; + justify-content: space-between; +} diff --git a/src/CapDataConnectorManager.php b/src/CapDataConnectorManager.php index c27fdde74782b2b90ef9d3620706a2df38fcad04..10340c4f25ff0cceb77426f57673c99d805d391b 100644 --- a/src/CapDataConnectorManager.php +++ b/src/CapDataConnectorManager.php @@ -2,22 +2,7 @@ namespace Drupal\capdata_connector; -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Config\ConfigFactoryInterface; -use Symfony\Component\HttpFoundation\RequestStack; use CapDataOpera\PhpSdk\Graph\Graph; -use CapDataOpera\PhpSdk\Serializer\Serializer; -use Drupal\Core\Datetime\DrupalDateTime; -use Drupal\Component\Utility\Html; -use Drupal\Core\Url; -use Drupal\Component\Utility\UrlHelper; -use Drupal\file\Entity\File; -use Drupal\media\Entity\Media; -use Drupal\Core\File\FileUrlGeneratorInterface; -use Drupal\taxonomy\TermInterface; -use Drupal\node\NodeInterface; use CapDataOpera\PhpSdk\Model\AdressePostale; use CapDataOpera\PhpSdk\Model\ArkBnf; use CapDataOpera\PhpSdk\Model\Auteur; @@ -36,13 +21,9 @@ use CapDataOpera\PhpSdk\Model\Lieu; use CapDataOpera\PhpSdk\Model\MaitriseOeuvre; use CapDataOpera\PhpSdk\Model\MentionProduction; use CapDataOpera\PhpSdk\Model\Oeuvre; -use CapDataOpera\PhpSdk\Model\TypeEvenement; -use CapDataOpera\PhpSdk\Model\TypeOeuvre; -use CapDataOpera\PhpSdk\Model\TypeProduction; -use CapDataOpera\PhpSdk\Model\TypePublic; -use CapDataOpera\PhpSdk\Model\Pays; use CapDataOpera\PhpSdk\Model\Partenariat; use CapDataOpera\PhpSdk\Model\Participation; +use CapDataOpera\PhpSdk\Model\Pays; use CapDataOpera\PhpSdk\Model\Personne; use CapDataOpera\PhpSdk\Model\Production; use CapDataOpera\PhpSdk\Model\ProductionPrimaire; @@ -50,12 +31,29 @@ use CapDataOpera\PhpSdk\Model\Programmation; use CapDataOpera\PhpSdk\Model\Role; use CapDataOpera\PhpSdk\Model\Saison; use CapDataOpera\PhpSdk\Model\StatusJuridique; +use CapDataOpera\PhpSdk\Model\TypeEvenement; +use CapDataOpera\PhpSdk\Model\TypeOeuvre; +use CapDataOpera\PhpSdk\Model\TypeProduction; +use CapDataOpera\PhpSdk\Model\TypePublic; +use CapDataOpera\PhpSdk\Serializer\Serializer; +use Drupal\Component\Utility\Html; +use Drupal\Component\Utility\UrlHelper; +use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\Core\Entity\EntityFieldManagerInterface; +use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\File\FileUrlGeneratorInterface; +use Drupal\Core\Url; +use Drupal\node\NodeInterface; +use Drupal\taxonomy\TermInterface; +use Symfony\Component\HttpFoundation\RequestStack; /** * Defines a capData Connector manager. */ class CapDataConnectorManager { - + /** * The entity field manager. * @@ -96,7 +94,7 @@ class CapDataConnectorManager { * * @var \Drupal\Core\Extension\ModuleHandlerInterface */ - protected $moduleHandler; + protected $moduleHandler; /** * Constructs a CapDataConnectorManager object. @@ -115,19 +113,19 @@ class CapDataConnectorManager { * The module handler service. */ public function __construct(EntityFieldManagerInterface $entity_field_manager, EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, RequestStack $request_stack, FileUrlGeneratorInterface $file_url_generator, ModuleHandlerInterface $module_handler) { - $this->entityFieldManager = $entity_field_manager; - $this->entityTypeManager = $entity_type_manager; - $this->configFactory = $config_factory; - $this->requestStack = $request_stack; - $this->fileUrlGenerator = $file_url_generator; - $this->moduleHandler = $module_handler; + $this->entityFieldManager = $entity_field_manager; + $this->entityTypeManager = $entity_type_manager; + $this->configFactory = $config_factory; + $this->requestStack = $request_stack; + $this->fileUrlGenerator = $file_url_generator; + $this->moduleHandler = $module_handler; } /** - * La liste des classes Capdata. - * ex: capdataopera/php-sdk/src/Model/Lieu.php + * La liste des classes Capdata, ex: capdataopera/php-sdk/src/Model/Lieu.php . * * @return array + * capDataClassesArray */ public function getCapDataClassesInfo() { $capDataClassesArray = [ @@ -142,7 +140,7 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_typeevenement' => [ 'capdata_full_name' => 'CapData Type Evénement', @@ -155,7 +153,7 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_typeoeuvre' => [ 'capdata_full_name' => 'CapData Type Oeuvre', @@ -168,7 +166,7 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_statutjuridique' => [ 'capdata_full_name' => 'CapData Statut Juridique', @@ -181,7 +179,7 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_historiqueproduction' => [ 'capdata_full_name' => 'CapData Historique Production', @@ -194,7 +192,7 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_genreoeuvre' => [ 'capdata_full_name' => 'CapData Genre Oeuvre', @@ -207,7 +205,7 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_categorieoeuvre' => [ 'capdata_full_name' => 'CapData Catégorie Oeuvre', @@ -220,8 +218,8 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_role' => [ 'capdata_full_name' => 'CapData Role', 'capdata_short_id' => 'capdatarole', @@ -233,8 +231,8 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_pays' => [ 'capdata_full_name' => 'CapData Pays', 'capdata_short_id' => 'capdatapays', @@ -246,8 +244,8 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_typeproduction' => [ 'capdata_full_name' => 'CapData Type de production', 'capdata_short_id' => 'capdatatypeproduction', @@ -259,8 +257,8 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_fonction' => [ 'capdata_full_name' => 'CapData Fonction', 'capdata_short_id' => 'capdatafonction', @@ -272,8 +270,8 @@ class CapDataConnectorManager { 'fr_bnf' => 'Fr Bnf', 'ark_bnf' => 'Ark Bnf', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_collectivite' => [ 'capdata_full_name' => 'CapData Collectivité', 'capdata_short_id' => 'capdatacollectivite', @@ -299,7 +297,7 @@ class CapDataConnectorManager { 'catalogage_source_pays' => 'Catalogage Source Pays', 'catalogage_source_agence' => 'Catalogage Source Agence', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_adressepostale' => [ 'capdata_full_name' => 'CapData Adresse Postale', @@ -309,8 +307,8 @@ class CapDataConnectorManager { 'code_postal' => 'Code Postal', 'commune' => 'Commune', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_lieu' => [ 'capdata_full_name' => 'CapData Lieu', 'capdata_short_id' => 'capdatalieu', @@ -325,8 +323,8 @@ class CapDataConnectorManager { 'adresse_postale' => 'Adresse Postale', 'open_agenda_id' => 'Open Agenda', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_personne' => [ 'capdata_full_name' => 'CapData Personne (Artiste)', 'capdata_short_id' => 'capdatapersonne', @@ -336,7 +334,7 @@ class CapDataConnectorManager { 'nom_forme_rejet' => 'Nom Forme Rejet', 'biographie' => 'Biographie', 'a_pour_fonction' => 'A Pour Fonction', - 'a_pour_profession' => 'A Pour Profession', + 'a_pour_profession' => 'A Pour Profession', 'description' => 'Description', 'date_creation_ressource' => 'Date de création', 'date_modification_ressource' => 'Date de modification', @@ -350,10 +348,10 @@ class CapDataConnectorManager { 'page_web' => 'Page Web', 'media' => 'Media', 'image' => 'Image', - 'fr_bnf' => 'Fr Bnf', - 'ark_bnf' => 'Ark Bnf', - ] - ], + 'fr_bnf' => 'Fr Bnf', + 'ark_bnf' => 'Ark Bnf', + ], + ], 'capdata_saison' => [ 'capdata_full_name' => 'CapData Saison', 'capdata_short_id' => 'capdatasaison', @@ -366,8 +364,8 @@ class CapDataConnectorManager { 'ark_bnf' => 'Ark Bnf', 'media' => 'Media', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_participation' => [ 'capdata_full_name' => 'CapData Participation', 'capdata_short_id' => 'capdataparticipation', @@ -375,8 +373,8 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_auteur' => [ 'capdata_full_name' => 'CapData Auteur', 'capdata_short_id' => 'capdataauteur', @@ -384,8 +382,8 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_collaboration' => [ 'capdata_full_name' => 'CapData Collaboration', 'capdata_short_id' => 'capdatacollaboration', @@ -393,8 +391,8 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_interpretation' => [ 'capdata_full_name' => 'CapData Interpretation', 'capdata_short_id' => 'capdatainterpretation', @@ -402,7 +400,7 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_maitriseoeuvre' => [ 'capdata_full_name' => 'CapData Maitrise Oeuvre', @@ -411,7 +409,7 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_mentionproduction' => [ 'capdata_full_name' => 'CapData Mention Production', @@ -420,7 +418,7 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_partenariat' => [ 'capdata_full_name' => 'CapData Partenariat', @@ -429,7 +427,7 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] + ], ], 'capdata_programmation' => [ 'capdata_full_name' => 'CapData Programmation', @@ -438,8 +436,8 @@ class CapDataConnectorManager { 'a_pour_participant' => 'A pour Participant', 'a_pour_fonction' => 'A pour Fonction', 'identifiant_rof' => 'Identifiant Rof', - ] - ], + ], + ], 'capdata_oeuvre' => [ 'capdata_full_name' => 'CapData Oeuvre', 'capdata_short_id' => 'capdataoeuvre', @@ -451,7 +449,7 @@ class CapDataConnectorManager { 'date_modification_ressource' => 'Date de modification', 'catalogage_source_date' => 'Catalogage Source Date', 'catalogage_source_pays' => 'Catalogage Source Pays', - 'catalogage_source_agence' => 'Catalogage Source Agence', + 'catalogage_source_agence' => 'Catalogage Source Agence', 'media' => 'Media', 'image' => 'Image', 'fr_bnf' => 'Fr Bnf', @@ -464,15 +462,15 @@ class CapDataConnectorManager { 'intrigue' => 'Intrigue', 'source_livret' => 'Source Livret', 'date_creation' => 'Date de création', - 'duree' => 'Durée', + 'duree' => 'Durée', 'a_pour_interpretation' => 'A pour interpretation', 'categorie_oeuvre' => 'Catégorie Oeuvre', 'genre_oeuvre' => 'Genre Oeuvre', 'type_oeuvre' => 'Type Oeuvre', 'pays_creation' => 'Pays de création', 'personnage' => 'Personnage', - ] - ], + ], + ], 'capdata_productionprimaire' => [ 'capdata_full_name' => 'CapData Production Primaire', 'capdata_short_id' => 'capdataproductionprimaire', @@ -484,7 +482,7 @@ class CapDataConnectorManager { 'date_modification_ressource' => 'Date de modification', 'catalogage_source_date' => 'Catalogage Source Date', 'catalogage_source_pays' => 'Catalogage Source Pays', - 'catalogage_source_agence' => 'Catalogage Source Agence', + 'catalogage_source_agence' => 'Catalogage Source Agence', 'media' => 'Media', 'image' => 'Image', 'fr_bnf' => 'Fr Bnf', @@ -505,9 +503,9 @@ class CapDataConnectorManager { 'oeuvre_representee' => 'Oeuvre representee', 'date_premiere' => 'Date première', 'date_publication' => 'Date publication', - 'jeune_public' => 'Jeune public' - ] - ], + 'jeune_public' => 'Jeune public', + ], + ], 'capdata_production' => [ 'capdata_full_name' => 'CapData Production', 'capdata_short_id' => 'capdataproduction', @@ -519,7 +517,7 @@ class CapDataConnectorManager { 'date_modification_ressource' => 'Date de modification', 'catalogage_source_date' => 'Catalogage Source Date', 'catalogage_source_pays' => 'Catalogage Source Pays', - 'catalogage_source_agence' => 'Catalogage Source Agence', + 'catalogage_source_agence' => 'Catalogage Source Agence', 'media' => 'Media', 'image' => 'Image', 'fr_bnf' => 'Fr Bnf', @@ -541,8 +539,8 @@ class CapDataConnectorManager { 'production_primaire' => 'Production primaire', 'date_premiere' => 'Date première', 'date_publication' => 'Date publication', - 'jeune_public' => 'Jeune public' - ] + 'jeune_public' => 'Jeune public', + ], ], 'capdata_evenement' => [ 'capdata_full_name' => 'CapData Evénement', @@ -555,7 +553,7 @@ class CapDataConnectorManager { 'date_modification_ressource' => 'Date de modification', 'catalogage_source_date' => 'Catalogage Source Date', 'catalogage_source_pays' => 'Catalogage Source Pays', - 'catalogage_source_agence' => 'Catalogage Source Agence', + 'catalogage_source_agence' => 'Catalogage Source Agence', 'media' => 'Media', 'image' => 'Image', 'fr_bnf' => 'Fr Bnf', @@ -577,68 +575,75 @@ class CapDataConnectorManager { 'date_fin' => 'Date fin', 'duree' => 'Durée', 'open_agenda_id' => 'Open Agenda', - ] - ], + ], + ], ]; // Allow other modules to alter the $capDataClassesArray. $this->moduleHandler->alter('capdata_classes_info', $capDataClassesArray); return $capDataClassesArray; } + /** * La liste des champs pour un type de contenu donné. - * + * * @param string $selectedContentType - * + * Selected content type. + * * @return array + * Options */ public function getFieldsOptionsByContentType($selectedContentType) { - $entityTypeId = 'node'; - $fields = $this->entityFieldManager->getFieldDefinitions($entityTypeId, $selectedContentType); - $options = []; - foreach ($fields as $fieldName => $fieldDefinition) { - if (!empty($fieldDefinition->getTargetBundle())) { - $options[$fieldName] = $fieldDefinition->getLabel(); - } + $entityTypeId = 'node'; + $fields = $this->entityFieldManager->getFieldDefinitions($entityTypeId, $selectedContentType); + $options = []; + foreach ($fields as $fieldName => $fieldDefinition) { + if (!empty($fieldDefinition->getTargetBundle())) { + $options[$fieldName] = $fieldDefinition->getLabel(); } - return $options; + } + return $options; } /** * La liste des champs pour une taxonomie donnée. - * + * * @param string $selectedTaxonomy - * + * Selected taxonomy. + * * @return array + * Options */ public function getFieldsOptionsByTaxonomy($selectedTaxonomy) { - $entityTypeId = 'taxonomy_term'; - $fields = $this->entityFieldManager->getFieldDefinitions($entityTypeId, $selectedTaxonomy); - $options = []; - foreach ($fields as $fieldName => $fieldDefinition) { - if (!empty($fieldDefinition->getTargetBundle())) { - $options[$fieldName] = $fieldDefinition->getLabel(); - } + $entityTypeId = 'taxonomy_term'; + $fields = $this->entityFieldManager->getFieldDefinitions($entityTypeId, $selectedTaxonomy); + $options = []; + foreach ($fields as $fieldName => $fieldDefinition) { + if (!empty($fieldDefinition->getTargetBundle())) { + $options[$fieldName] = $fieldDefinition->getLabel(); } - return $options; + } + return $options; } - /** - * La liste des traitement spéciaux pour un champ donné. - * - * @return array - */ - public function getSpecialProcessingOptions() { - $options = [ - 'clean_url' => "Nettoyer l'URL", - 'remove_tags' => 'Enlever les balises HTML', - ]; - return $options; - } + /** + * La liste des traitement spéciaux pour un champ donné. + * + * @return array + * Options + */ + public function getSpecialProcessingOptions() { + $options = [ + 'clean_url' => "Nettoyer l'URL", + 'remove_tags' => 'Enlever les balises HTML', + ]; + return $options; + } /** * La liste de types de contenu. - * + * * @return array + * Content types */ public function getContentTypesList() { $contentTypes = []; @@ -651,8 +656,9 @@ class CapDataConnectorManager { /** * La liste de vocabulaires. - * + * * @return array + * Vocabularies */ public function getVocabularyList() { $vocabularies = []; @@ -664,10 +670,10 @@ class CapDataConnectorManager { } /** - * La liste des classes incluses dans l'export - * avec leurs informations stockées en configuration. - * + * La liste des classes incluses dans l'export avec leurs infos. + * * @return array + * Export Capdata classes stocked info */ public function getExportCapdataClassesStockedInfo() { $exportCapdataClassesStockedInfo = []; @@ -676,38 +682,39 @@ class CapDataConnectorManager { foreach ($capDataClasses as $capDataClassUniqueId => $capDataClassFullData) { $capdataClassPropertiesArray = []; - $includeInExport = $config->get($capDataClassUniqueId.'_include_in_export'); - $mappingType = $config->get($capDataClassUniqueId.'_mapping_type'); - // Si la classe est incluse dans l'export - if(!empty($includeInExport)){ - foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { + $includeInExport = $config->get($capDataClassUniqueId . '_include_in_export'); + $mappingType = $config->get($capDataClassUniqueId . '_mapping_type'); + // Si la classe est incluse dans l'export. + if (!empty($includeInExport)) { + foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { $capdataClassPropertiesArray[$propertyKey] = [ 'property_name' => $propertyName, - 'property_taxo_fields_dropdown' => $config->get($capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown'), - 'property_taxo_custom_processing' => $config->get($capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing'), - 'property_taxo_comments' => $config->get($capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments'), - 'property_content_fields_dropdown' => $config->get($capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown'), - 'property_content_custom_processing' => $config->get($capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing'), - 'property_content_comments' => $config->get($capDataClassUniqueId.'_content_'.$propertyKey.'_comments'), + 'property_taxo_fields_dropdown' => $config->get($capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown'), + 'property_taxo_custom_processing' => $config->get($capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing'), + 'property_taxo_comments' => $config->get($capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments'), + 'property_content_fields_dropdown' => $config->get($capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown'), + 'property_content_custom_processing' => $config->get($capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing'), + 'property_content_comments' => $config->get($capDataClassUniqueId . '_content_' . $propertyKey . '_comments'), ]; } - if(!empty($mappingType)){ - if(strpos($mappingType, "_taxo_mapping") !== false){ + if (!empty($mappingType)) { + if (strpos($mappingType, "_taxo_mapping") !== FALSE) { $exportCapdataClassesStockedInfo["taxo_mapped_classes"][$capDataClassUniqueId] = [ 'export_class_capdata_full_name' => $capDataClassFullData['capdata_full_name'], 'export_class_include_in_export' => $includeInExport, - 'export_class_mapping_type' => $config->get($capDataClassUniqueId.'_mapping_type'), - 'export_class_taxonomy_dropdown' => $config->get($capDataClassUniqueId.'_taxonomy_dropdown'), - 'export_class_content_dropdown' => $config->get($capDataClassUniqueId.'_content_dropdown'), + 'export_class_mapping_type' => $config->get($capDataClassUniqueId . '_mapping_type'), + 'export_class_taxonomy_dropdown' => $config->get($capDataClassUniqueId . '_taxonomy_dropdown'), + 'export_class_content_dropdown' => $config->get($capDataClassUniqueId . '_content_dropdown'), 'export_class_capdata_properties' => $capdataClassPropertiesArray, ]; - }elseif(strpos($mappingType, "_content_mapping") !== false){ + } + elseif (strpos($mappingType, "_content_mapping") !== FALSE) { $exportCapdataClassesStockedInfo["content_mapped_classes"][$capDataClassUniqueId] = [ 'export_class_capdata_full_name' => $capDataClassFullData['capdata_full_name'], 'export_class_include_in_export' => $includeInExport, - 'export_class_mapping_type' => $config->get($capDataClassUniqueId.'_mapping_type'), - 'export_class_taxonomy_dropdown' => $config->get($capDataClassUniqueId.'_taxonomy_dropdown'), - 'export_class_content_dropdown' => $config->get($capDataClassUniqueId.'_content_dropdown'), + 'export_class_mapping_type' => $config->get($capDataClassUniqueId . '_mapping_type'), + 'export_class_taxonomy_dropdown' => $config->get($capDataClassUniqueId . '_taxonomy_dropdown'), + 'export_class_content_dropdown' => $config->get($capDataClassUniqueId . '_content_dropdown'), 'export_class_capdata_properties' => $capdataClassPropertiesArray, ]; } @@ -719,13 +726,12 @@ class CapDataConnectorManager { /** * Export RDF-XML Graph. - * + * * @return string + * RDF-XML Graph */ public function dataExport() { - /** - * Construction du graph RDF - */ + // Construction du graph RDF. $serializer = new Serializer(); $graph = new Graph(); $host = !empty($this->configFactory->get('capdata_connector.settings')->get('capdata_connector_host')) ? $this->configFactory->get('capdata_connector.settings')->get('capdata_connector_host') : ''; @@ -733,40 +739,39 @@ class CapDataConnectorManager { $capdataOperaUrl = !empty($this->configFactory->get('capdata_connector.settings')->get('capdata_opera_url')) ? $this->configFactory->get('capdata_connector.settings')->get('capdata_opera_url') : ''; $ownOrg = new Collectivite($capdataOperaUrl); $ownOrg->setNom($siteName) - ->setSiteWeb($host) - ->setCatalogageSourceAgence($ownOrg); + ->setSiteWeb($host) + ->setCatalogageSourceAgence($ownOrg); $graph->add($ownOrg); $capdataExportData = $this->getExportCapdataClassesStockedInfo(); - // Custom hook, pour l'ajout de données supplémentaires hook_capdata_graph_beginning_alter(&$graph) au début de l'export. + // Custom hook, pour l'ajout de données supplémentaires + // hook_capdata_graph_beginning_alter(&$graph) au début de l'export. $this->moduleHandler->alter('capdata_graph_beginning', $graph, $capdataExportData); foreach ($capdataExportData["taxo_mapped_classes"] as $capDataClassUniqueId => $capDataClassInfo) { - /** - * I. Export de toutes les taxonomies - */ + // Export de toutes les taxonomies. $exportClassTaxonomyDropdown = $capDataClassInfo["export_class_taxonomy_dropdown"]; - if(!empty($exportClassTaxonomyDropdown)){ - $taxonomyTerms = $this->entityTypeManager->getStorage('taxonomy_term')->loadTree($exportClassTaxonomyDropdown); - if(!empty($taxonomyTerms)){ - $termIds = array_map(function($term) { + if (!empty($exportClassTaxonomyDropdown)) { + $taxonomyTerms = $this->entityTypeManager->getStorage('taxonomy_term')->loadTree($exportClassTaxonomyDropdown); + if (!empty($taxonomyTerms)) { + $termIds = array_map(function ($term) { /** @var \Drupal\taxonomy\Entity\Term $term */ return $term->tid; }, $taxonomyTerms); asort($termIds); $terms = $this->entityTypeManager->getStorage('taxonomy_term')->loadMultiple($termIds); foreach ($terms as $term) { - // Termes de la taxonomie + // Termes de la taxonomie. $tid = $term->id(); $label = $term->label(); - if(isset($capDataClassInfo["export_class_capdata_properties"]["cd_label"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_taxo_fields_dropdown"])){ + if (isset($capDataClassInfo["export_class_capdata_properties"]["cd_label"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_taxo_fields_dropdown"])) { $labelFieldName = $capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_taxo_fields_dropdown"]; if ($term->hasField($labelFieldName) && !$term->get($labelFieldName)->isEmpty()) { $label = $term->get($labelFieldName)->value; - if(!empty($label)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_taxo_custom_processing"])){ + if (!empty($label)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_taxo_custom_processing"])) { $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_taxo_custom_processing"]; $label = $this->customFieldProcessing($label, $customProcessing); } @@ -779,230 +784,244 @@ class CapDataConnectorManager { switch ($capDataClassUniqueId) { case 'capdata_typeproduction': - $graphItem = new TypeProduction($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $graphItem = new TypeProduction($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + case 'capdata_typepublic': - $graphItem = new TypePublic($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $graphItem = new TypePublic($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; - case 'capdata_typeevenement': - $graphItem = new TypeEvenement($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + + case 'capdata_typeevenement': + $graphItem = new TypeEvenement($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; - case 'capdata_typeoeuvre': - $graphItem = new TypeOeuvre($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + + case 'capdata_typeoeuvre': + $graphItem = new TypeOeuvre($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; - case 'capdata_statutjuridique': - $graphItem = new StatusJuridique($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + + case 'capdata_statutjuridique': + $graphItem = new StatusJuridique($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + case 'capdata_historiqueproduction': - $graphItem = new HistoriqueProduction($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $graphItem = new HistoriqueProduction($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + case 'capdata_genreoeuvre': - $graphItem = new GenreOeuvre($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $graphItem = new GenreOeuvre($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; - case 'capdata_categorieoeuvre': - $graphItem = new CategorieOeuvre($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + + case 'capdata_categorieoeuvre': + $graphItem = new CategorieOeuvre($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + case 'capdata_role': - $graphItem = new Role($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $graphItem = new Role($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + case 'capdata_pays': - $graphItem = new Pays($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $graphItem = new Pays($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; - case 'capdata_fonction': - $graphItem = new Fonction($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + + case 'capdata_fonction': + $graphItem = new Fonction($termUrl); + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $graphItem->setArkBnf($arkBnf); - } - break; + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $graphItem->setArkBnf($arkBnf); + } + break; + case 'capdata_collectivite': - $graphItem = new Collectivite($termUrl); - $this->setCapdataCollectiviteProperties($graphItem, $term, $capDataClassInfo, "taxo"); - $isniUrl = $this->setIsniCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($isniUrl)){ - $isni = new Isni($isniUrl); - $graph->add($isni); - $graphItem->setIsni($isni); - } - // A pour fonction - $capDataFonctionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])){ - $capDataFonctionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])){ - $capDataFonctionMappingType = "taxo"; - } - $capDataFonctionMappingInfo = [ - "capData_fonction_mappingtype" => $capDataFonctionMappingType, - ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], - ]; - $this->setAPourFonctionCapdataProperty($graphItem, + $graphItem = new Collectivite($termUrl); + $this->setCapdataCollectiviteProperties($graphItem, $term, $capDataClassInfo, "taxo"); + $isniUrl = $this->setIsniCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($isniUrl)) { + $isni = new Isni($isniUrl); + $graph->add($isni); + $graphItem->setIsni($isni); + } + // A pour fonction. + $capDataFonctionMappingType = ""; + if (isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])) { + $capDataFonctionMappingType = "content"; + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])) { + $capDataFonctionMappingType = "taxo"; + } + $capDataFonctionMappingInfo = [ + "capData_fonction_mappingtype" => $capDataFonctionMappingType, + ]; + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + ]; + $this->setApourFonctionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo - ); - $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Media image, sound - $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ - $refImageUrl = $mediaInfo["mediaUrl"]; - $capdataImage = new Image($refImageUrl); - $capdataImage->setContentUrl($refImageUrl); - $capdataImage->setName($graphItem->getNom()); - $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); - } - // Media sound to be implemented - } - // A pour lieu (Lieu) - $capDataLieuCustomMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ - $capDataLieuCustomMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ - $capDataLieuCustomMappingType = "taxo"; + ); + $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + // Media image, sound. + $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { + $refImageUrl = $mediaInfo["mediaUrl"]; + $capdataImage = new Image($refImageUrl); + $capdataImage->setContentUrl($refImageUrl); + $capdataImage->setName($graphItem->getNom()); + $graph->add($capdataImage); + $graphItem->setMedia($capdataImage); } - $capDataLieuCustomMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, - ]; - $this->setAPourLieuCapdataProperty($graphItem, + // Media sound to be implemented. + } + // A pour lieu (Lieu) + $capDataLieuCustomMappingType = ""; + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { + $capDataLieuCustomMappingType = "content"; + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { + $capDataLieuCustomMappingType = "taxo"; + } + $capDataLieuCustomMappingInfo = [ + "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, + ]; + $this->setApourLieuCapdataProperty($graphItem, $capDataLieuCustomMappingInfo, $currentCapdataClassMappingInfo ); - // Identifiant ROF - $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - break; + // Identifiant ROF. + $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + break; + case 'capdata_adressepostale': $graphItem = new AdressePostale($termUrl); - // Commune + // Commune. $commune = ""; - if(isset($capDataClassInfo["export_class_capdata_properties"]["commune"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_taxo_fields_dropdown"])){ + if (isset($capDataClassInfo["export_class_capdata_properties"]["commune"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_taxo_fields_dropdown"])) { $communeFieldName = $capDataClassInfo["export_class_capdata_properties"]["commune"]["property_taxo_fields_dropdown"]; - if($term->hasField($communeFieldName) && !$term->get($communeFieldName)->isEmpty()) { + if ($term->hasField($communeFieldName) && !$term->get($communeFieldName)->isEmpty()) { $commune = $term->get($communeFieldName)->value; - if(!empty($commune)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_taxo_custom_processing"])){ + if (!empty($commune)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_taxo_custom_processing"])) { $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["commune"]["property_taxo_custom_processing"]; $commune = $this->customFieldProcessing($commune, $customProcessing); } @@ -1013,13 +1032,13 @@ class CapDataConnectorManager { } // Adresse postale (texte) $adressePostaleTexte = ""; - if(isset($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_taxo_fields_dropdown"])){ + if (isset($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_taxo_fields_dropdown"])) { $adressePostaleTxtFieldName = $capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_taxo_fields_dropdown"]; if ($term->hasField($adressePostaleTxtFieldName) && !$term->get($adressePostaleTxtFieldName)->isEmpty()) { $adressePostaleTexte = $term->get($adressePostaleTxtFieldName)->value; - if(!empty($adressePostaleTexte)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_taxo_custom_processing"])){ + if (!empty($adressePostaleTexte)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_taxo_custom_processing"])) { $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_taxo_custom_processing"]; $adressePostaleTexte = $this->customFieldProcessing($adressePostaleTexte, $customProcessing); } @@ -1029,15 +1048,15 @@ class CapDataConnectorManager { } } - // Code postal + // Code postal. $codePostal = ""; - if(isset($capDataClassInfo["export_class_capdata_properties"]["code_postal"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_taxo_fields_dropdown"])){ + if (isset($capDataClassInfo["export_class_capdata_properties"]["code_postal"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_taxo_fields_dropdown"])) { $codePostalFieldName = $capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_taxo_fields_dropdown"]; if ($term->hasField($codePostalFieldName) && !$term->get($codePostalFieldName)->isEmpty()) { $codePostal = $term->get($codePostalFieldName)->value; - if(!empty($codePostal)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_taxo_custom_processing"])){ + if (!empty($codePostal)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_taxo_custom_processing"])) { $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_taxo_custom_processing"]; $codePostal = $this->customFieldProcessing($codePostal, $customProcessing); } @@ -1048,1623 +1067,1700 @@ class CapDataConnectorManager { } $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); break; + case 'capdata_lieu': $graphItem = new Lieu($termUrl); - // Name + // Name. $this->setNameTraitCapdataProperties($graphItem, $label); - // Catalog Class Properties - $this->setCatalogCapdataProperties($graphItem, - $term, + // Catalog Class Properties. + $this->setCatalogCapdataProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); + ); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - $this->setCatalogageSourceAgenceProperty($graphItem, + $this->setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo - ); - // Open agenda - $this->setOpenAgendaCapdataProperty($graphItem, - $term, + ); + // Open agenda. + $this->setOpenAgendaCapdataProperty($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - // Description - $this->setDescriptionCapdataProperty($graphItem, - $term, + ); + // Description. + $this->setDescriptionCapdataProperty($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - // Identifiant Rof - $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - break; + ); + // Identifiant Rof. + $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + break; + case 'capdata_personne': $graphItem = new Personne($termUrl); - $this->setPersonalDetails($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setPersonalDetails($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setSocialsCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $isniUrl = $this->setIsniCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($isniUrl)){ + $this->setSocialsCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $isniUrl = $this->setIsniCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($isniUrl)) { $isni = new Isni($isniUrl); $graph->add($isni); $graphItem->setIsni($isni); } $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ + $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $graphItem->setArkBnf($arkBnf); } $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Media image, sound + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $prenom = $graphItem->getPrenom(); $nom = $graphItem->getNom(); - $capdataImage->setName($prenom. ' '.$nom); + $capdataImage->setName($prenom . ' ' . $nom); $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); + $graphItem->setMedia($capdataImage); } - // Media sound to be implemented - } - // Catalogage - $this->setCatalogCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + // Media sound to be implemented. + } + // Catalogage. + $this->setCatalogCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, - ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], - ]; + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, + ]; + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + ]; $this->setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); - // A pour fonction + // A pour fonction. $capDataFonctionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "taxo"; } $capDataFonctionMappingInfo = [ "capData_fonction_mappingtype" => $capDataFonctionMappingType, - ]; - $currentCapdataClassMappingInfo =[ + ]; + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, + "mapping_type" => "taxo", + "mapped_entity" => $term, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], - ]; - $this->setAPourFonctionCapdataProperty($graphItem, + ]; + $this->setApourFonctionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour profession - $this->setAPourProfessionCapdataProperty($graphItem, + ); + // A pour profession. + $this->setApourProfessionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo - ); + ); break; - case 'capdata_saison': + + case 'capdata_saison': $graphItem = new Saison($termUrl); - $this->setReferentielCustomProperties($graphItem, - $term, + $this->setReferentielCustomProperties($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $graphItem->setArkBnf($arkBnf); - } - // Media image, sound + } + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($graphItem->getLabel()); $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); + $graphItem->setMedia($capdataImage); } - // Media sound to be implemented - } - break; - case 'capdata_participation': + // Media sound to be implemented. + } + break; + + case 'capdata_participation': $graphItem = new Participation($termUrl); $participationTaxonomyMappingInfo = [ - 'capdataExportData' => $capdataExportData, - 'host' => $host, - 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'capdataExportData' => $capdataExportData, + 'host' => $host, + 'capDataClassInfo' => $capDataClassInfo, + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_auteur': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_auteur': $graphItem = new Auteur($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_collaboration': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_collaboration': $graphItem = new Collaboration($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_interpretation': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_interpretation': $graphItem = new Interpretation($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_maitriseoeuvre': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_maitriseoeuvre': $graphItem = new MaitriseOeuvre($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_mentionproduction': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_mentionproduction': $graphItem = new MentionProduction($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_partenariat': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_partenariat': $graphItem = new Partenariat($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); - break; - case 'capdata_programmation': + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + break; + + case 'capdata_programmation': $graphItem = new Programmation($termUrl); $participationTaxonomyMappingInfo = [ 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; - $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); + $this->handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo); break; - case 'capdata_oeuvre': - $graphItem = new Oeuvre($termUrl); + + case 'capdata_oeuvre': + $graphItem = new Oeuvre($termUrl); $this->setCatalogCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Titre, description ... - $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $graphItem->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Media image, sound + $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($graphItem->getTitre()); $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); + $graphItem->setMedia($capdataImage); } - // Media sound to be implemented - } - // Participations diverses + // Media sound to be implemented. + } + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, + "mapping_type" => "taxo", + "mapped_entity" => $term, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($graphItem, + // A pour participation. + $this->setApourParticipationCapdataProperty($graphItem, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($graphItem, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($graphItem, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour Mention Production (MentionProduction ou Participation) + ); + // A pour Mention Production + // (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($graphItem, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($graphItem, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($graphItem, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($graphItem, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($graphItem, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($graphItem, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // Categorie Oeuvre + ); + // Categorie Oeuvre. $capDataCategorieOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_categorieoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_categorieoeuvre"])) { $capDataCategorieOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_categorieoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_categorieoeuvre"])) { $capDataCategorieOeuvreMappingType = "taxo"; } $capDataCategorieOeuvreMappingInfo = [ - "capData_categorieoeuvre_mappingtype" => $capDataCategorieOeuvreMappingType, + "capData_categorieoeuvre_mappingtype" => $capDataCategorieOeuvreMappingType, ]; $this->setCategorieOeuvreCapdataProperty($graphItem, $capDataCategorieOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Genre Oeuvre + ); + // Genre Oeuvre. $capDataGenreOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_genreoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_genreoeuvre"])) { $capDataGenreOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_genreoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_genreoeuvre"])) { $capDataGenreOeuvreMappingType = "taxo"; } $capDataGenreOeuvreMappingInfo = [ - "capData_genreoeuvre_mappingtype" => $capDataGenreOeuvreMappingType, + "capData_genreoeuvre_mappingtype" => $capDataGenreOeuvreMappingType, ]; $this->setGenreOeuvreCapdataProperty($graphItem, $capDataGenreOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Type Oeuvre + ); + // Type Oeuvre. $capDataTypeOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeoeuvre"])) { $capDataTypeOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeoeuvre"])) { $capDataTypeOeuvreMappingType = "taxo"; } $capDataTypeOeuvreMappingInfo = [ - "capData_typeoeuvre_mappingtype" => $capDataTypeOeuvreMappingType, + "capData_typeoeuvre_mappingtype" => $capDataTypeOeuvreMappingType, ]; $this->setTypeOeuvreCapdataProperty($graphItem, $capDataTypeOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Personnage (Role) + ); + // Personnage (Role) $capDataRoleMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_role"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_role"])) { $capDataRoleMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_role"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_role"])) { $capDataRoleMappingType = "taxo"; } $capDataRoleMappingInfo = [ - "capData_role_mappingtype" => $capDataRoleMappingType, + "capData_role_mappingtype" => $capDataRoleMappingType, ]; $this->setPersonnageCapdataProperty($graphItem, $capDataRoleMappingInfo, $currentCapdataClassMappingInfo ); - // Oeuvre titreFormeRejet, sourceLivret, intrigue .. + // Oeuvre titreFormeRejet, sourceLivret, intrigue .. $this->setOeuvreDetails($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Oeuvre dates - $this->setOeuvreDatesCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - break; + // Oeuvre dates. + $this->setOeuvreDatesCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + break; + case 'capdata_productionprimaire': $graphItem = new ProductionPrimaire($termUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Titre, description ... - $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $graphItem->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $this->setProductionDatesProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Media image, sound + $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($graphItem->getTitre()); $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); + $graphItem->setMedia($capdataImage); } - // Media sound to be implemented + // Media sound to be implemented. } - // Participations diverses + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, + "mapping_type" => "taxo", + "mapped_entity" => $term, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($graphItem, + // A pour participation. + $this->setApourParticipationCapdataProperty($graphItem, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($graphItem, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($graphItem, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour Mention Production (MentionProduction ou Participation) + ); + // A pour Mention Production + // (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($graphItem, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($graphItem, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($graphItem, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($graphItem, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour collaboration (Collaboration ou participation) $capDataCollaborationMappingType = ""; $capDataCollaborationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollaborationMappingInfo = [ - "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, - "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, - ]; - $this->setAPourCollaborationCapdataProperty($graphItem, + "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, + "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, + ]; + $this->setApourCollaborationCapdataProperty($graphItem, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($graphItem, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($graphItem, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour maitrise oeuvre (MaitriseOeuvre ou participation) $capDataMaitriseOeuvreMappingType = ""; $capDataMaitriseOeuvreCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMaitriseOeuvreMappingInfo = [ - "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, - "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, - ]; - $this->setAPourMaitriseOeuvreCapdataProperty($graphItem, + "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, + "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, + ]; + $this->setApourMaitriseOeuvreCapdataProperty($graphItem, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour programmation (Programmation ou participation) $capDataProgrammationMappingType = ""; $capDataProgrammationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataProgrammationMappingInfo = [ - "capData_programmation_mappingtype" => $capDataProgrammationMappingType, - "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, - ]; - $this->setAPourProgrammationCapdataProperty($graphItem, + "capData_programmation_mappingtype" => $capDataProgrammationMappingType, + "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, + ]; + $this->setApourProgrammationCapdataProperty($graphItem, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour saison (Saison) + ); + // A pour saison (Saison) $capDataSaisonMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_saison"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "taxo"; } $capDataSaisonMappingInfo = [ - "capData_saison_mappingtype" => $capDataSaisonMappingType, + "capData_saison_mappingtype" => $capDataSaisonMappingType, ]; - $this->setAPourSaisonCapdataProperty($graphItem, + $this->setApourSaisonCapdataProperty($graphItem, $capDataSaisonMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type production (TypeProduction) $capDataTypeProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "taxo"; } $capDataTypeProductionMappingInfo = [ - "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, + "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, ]; - $this->setAPourTypeProductionCapdataProperty($graphItem, + $this->setApourTypeProductionCapdataProperty($graphItem, $capDataTypeProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type public (TypePublic) $capDataTypePublicMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "taxo"; } $capDataTypePublicMappingInfo = [ - "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, + "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, ]; - $this->setAPourTypePublicCapdataProperty($graphItem, + $this->setApourTypePublicCapdataProperty($graphItem, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo - ); - // Historique (HistoriqueProduction) + ); + // Historique (HistoriqueProduction) $capDataHistoriqueProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "taxo"; } $capDataHistoriqueProductionMappingInfo = [ - "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, + "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, ]; $this->setHistoriqueCapdataProperty($graphItem, $capDataHistoriqueProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Lieu Publication (Lieu) $capDataLieuPublicationMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "taxo"; } $capDataLieuPublicationMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, + "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, ]; $this->setLieuPublicationCapdataProperty($graphItem, $capDataLieuPublicationMappingInfo, $currentCapdataClassMappingInfo - ); - // Oeuvre representee (Oeuvre) + ); + // Oeuvre representee (Oeuvre) $capDataOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "taxo"; } $capDataOeuvreMappingInfo = [ - "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, + "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, ]; $this->setOeuvreRepresenteeCapdataProperty($graphItem, $capDataOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - break; + ); + break; + case 'capdata_production': $graphItem = new Production($termUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Titre, description ... - $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $graphItem->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $this->setProductionDatesProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Media image, sound + $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($graphItem->getTitre()); $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); + $graphItem->setMedia($capdataImage); } - // Media sound to be implemented + // Media sound to be implemented. } - // Participations diverses + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, + "mapping_type" => "taxo", + "mapped_entity" => $term, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($graphItem, + // A pour participation. + $this->setApourParticipationCapdataProperty($graphItem, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($graphItem, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($graphItem, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour Mention Production (MentionProduction ou Participation) + ); + // A pour Mention Production + // (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($graphItem, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($graphItem, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($graphItem, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($graphItem, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour collaboration (Collaboration ou participation) $capDataCollaborationMappingType = ""; $capDataCollaborationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollaborationMappingInfo = [ - "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, - "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, - ]; - $this->setAPourCollaborationCapdataProperty($graphItem, + "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, + "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, + ]; + $this->setApourCollaborationCapdataProperty($graphItem, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($graphItem, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($graphItem, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour maitrise oeuvre (MaitriseOeuvre ou participation) $capDataMaitriseOeuvreMappingType = ""; $capDataMaitriseOeuvreCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMaitriseOeuvreMappingInfo = [ - "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, - "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, - ]; - $this->setAPourMaitriseOeuvreCapdataProperty($graphItem, + "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, + "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, + ]; + $this->setApourMaitriseOeuvreCapdataProperty($graphItem, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour programmation (Programmation ou participation) $capDataProgrammationMappingType = ""; $capDataProgrammationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataProgrammationMappingInfo = [ - "capData_programmation_mappingtype" => $capDataProgrammationMappingType, - "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, - ]; - $this->setAPourProgrammationCapdataProperty($graphItem, + "capData_programmation_mappingtype" => $capDataProgrammationMappingType, + "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, + ]; + $this->setApourProgrammationCapdataProperty($graphItem, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour saison (Saison) + ); + // A pour saison (Saison) $capDataSaisonMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_saison"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "taxo"; } $capDataSaisonMappingInfo = [ - "capData_saison_mappingtype" => $capDataSaisonMappingType, + "capData_saison_mappingtype" => $capDataSaisonMappingType, ]; - $this->setAPourSaisonCapdataProperty($graphItem, + $this->setApourSaisonCapdataProperty($graphItem, $capDataSaisonMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type production (TypeProduction) $capDataTypeProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "taxo"; } $capDataTypeProductionMappingInfo = [ - "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, + "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, ]; - $this->setAPourTypeProductionCapdataProperty($graphItem, + $this->setApourTypeProductionCapdataProperty($graphItem, $capDataTypeProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type public (TypePublic) $capDataTypePublicMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "taxo"; } $capDataTypePublicMappingInfo = [ - "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, + "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, ]; - $this->setAPourTypePublicCapdataProperty($graphItem, + $this->setApourTypePublicCapdataProperty($graphItem, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo - ); - // Historique (HistoriqueProduction) + ); + // Historique (HistoriqueProduction) $capDataHistoriqueProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "taxo"; } $capDataHistoriqueProductionMappingInfo = [ - "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, + "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, ]; $this->setHistoriqueCapdataProperty($graphItem, $capDataHistoriqueProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Lieu Publication (Lieu) $capDataLieuPublicationMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "taxo"; } $capDataLieuPublicationMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, + "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, ]; $this->setLieuPublicationCapdataProperty($graphItem, $capDataLieuPublicationMappingInfo, $currentCapdataClassMappingInfo - ); - // Oeuvre representee (Oeuvre) + ); + // Oeuvre representee (Oeuvre) $capDataOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "taxo"; } $capDataOeuvreMappingInfo = [ - "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, + "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, ]; $this->setOeuvreRepresenteeCapdataProperty($graphItem, $capDataOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Production Primaire (ProductionPrimaire) + ); + // Production Primaire (ProductionPrimaire) $capDataProductionPrimaireMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_productionprimaire"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_productionprimaire"])) { $capDataProductionPrimaireMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_productionprimaire"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_productionprimaire"])) { $capDataProductionPrimaireMappingType = "taxo"; } $capDataProductionPrimaireMappingInfo = [ - "capData_productionprimaire_mappingtype" => $capDataProductionPrimaireMappingType, + "capData_productionprimaire_mappingtype" => $capDataProductionPrimaireMappingType, ]; $this->setProductionPrimaireCapdataProperty($graphItem, $capDataProductionPrimaireMappingInfo, $currentCapdataClassMappingInfo - ); + ); break; - case 'capdata_evenement': + + case 'capdata_evenement': $graphItem = new Evenement($termUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "taxo", + "mapped_entity" => $term, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Titre, description ... - $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setCapdataTitle($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setDescriptionCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + $this->setArkBnfTraitCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($arkBnfUrl)){ + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $graphItem->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - // Media image, sound + $this->setCapdataImageProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($graphItem->getTitre()); $graph->add($capdataImage); - $graphItem->setMedia($capdataImage); + $graphItem->setMedia($capdataImage); } - // Media sound to be implemented - } - // Participations diverses + // Media sound to be implemented. + } + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, + "mapping_type" => "taxo", + "mapped_entity" => $term, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($graphItem, + // A pour participation. + $this->setApourParticipationCapdataProperty($graphItem, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($graphItem, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($graphItem, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour Mention Production (MentionProduction ou Participation) + ); + // A pour Mention Production + // (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($graphItem, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($graphItem, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($graphItem, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($graphItem, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour collaboration (Collaboration ou participation) $capDataCollaborationMappingType = ""; $capDataCollaborationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollaborationMappingInfo = [ - "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, - "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, - ]; - $this->setAPourCollaborationCapdataProperty($graphItem, + "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, + "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, + ]; + $this->setApourCollaborationCapdataProperty($graphItem, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($graphItem, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($graphItem, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour maitrise oeuvre (MaitriseOeuvre ou participation) $capDataMaitriseOeuvreMappingType = ""; $capDataMaitriseOeuvreCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMaitriseOeuvreMappingInfo = [ - "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, - "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, - ]; - $this->setAPourMaitriseOeuvreCapdataProperty($graphItem, + "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, + "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, + ]; + $this->setApourMaitriseOeuvreCapdataProperty($graphItem, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour programmation (Programmation ou participation) $capDataProgrammationMappingType = ""; $capDataProgrammationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataProgrammationMappingInfo = [ - "capData_programmation_mappingtype" => $capDataProgrammationMappingType, - "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, - ]; - $this->setAPourProgrammationCapdataProperty($graphItem, + "capData_programmation_mappingtype" => $capDataProgrammationMappingType, + "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, + ]; + $this->setApourProgrammationCapdataProperty($graphItem, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type public (TypePublic) $capDataTypePublicMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "taxo"; } $capDataTypePublicMappingInfo = [ - "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, + "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, ]; - $this->setAPourTypePublicCapdataProperty($graphItem, + $this->setApourTypePublicCapdataProperty($graphItem, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo - ); - // Open agenda - $this->setOpenAgendaCapdataProperty($graphItem, - $term, + ); + // Open agenda. + $this->setOpenAgendaCapdataProperty($graphItem, + $term, $capDataClassInfo["export_class_capdata_properties"], "taxo" - ); + ); // A pour type evenement (typeEvenement) $capDataTypeEvenementMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeevenement"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeevenement"])) { $capDataTypeEvenementMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeevenement"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeevenement"])) { $capDataTypeEvenementMappingType = "taxo"; } $capDataTypeEvenementMappingInfo = [ - "capData_typeevenement_mappingtype" => $capDataTypeEvenementMappingType, + "capData_typeevenement_mappingtype" => $capDataTypeEvenementMappingType, ]; - $this->setAPourTypeEvenementCapdataProperty($graphItem, + $this->setApourTypeEvenementCapdataProperty($graphItem, $capDataTypeEvenementMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour lieu (Lieu) $capDataLieuCustomMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { $capDataLieuCustomMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { $capDataLieuCustomMappingType = "taxo"; } $capDataLieuCustomMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, + "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, ]; - $this->setAPourLieuCapdataProperty($graphItem, + $this->setApourLieuCapdataProperty($graphItem, $capDataLieuCustomMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour production (Production) + ); + // A pour production (Production) $capDataProductionCustomMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_production"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_production"])) { $capDataProductionCustomMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_production"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_production"])) { $capDataProductionCustomMappingType = "taxo"; } $capDataProductionCustomMappingInfo = [ - "capData_production_mappingtype" => $capDataProductionCustomMappingType, + "capData_production_mappingtype" => $capDataProductionCustomMappingType, ]; - $this->setAPourProductionCapdataProperty($graphItem, + $this->setApourProductionCapdataProperty($graphItem, $capDataProductionCustomMappingInfo, $currentCapdataClassMappingInfo - ); - // Dates - $this->setEventDatesCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); - break; + ); + // Dates. + $this->setEventDatesCapdataProperties($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], "taxo"); + break; + default: - $graphItem = null; - break; + $graphItem = NULL; + break; } - if(isset($graphItem) && !empty($graphItem)){ + if (isset($graphItem) && !empty($graphItem)) { $this->moduleHandler->alter('capdata_graph_item', $graphItem, $term, $graph); $graph->add($graphItem); } @@ -2672,428 +2768,441 @@ class CapDataConnectorManager { } } } - /** - * II. Export de tous les contenus - */ - // cas où les classe capdata lieu, capdata type public sont des contenus + // II. Export de tous les contenus + // Cas où les classe capdata lieu, capdata type public sont des contenus. foreach ($capdataExportData["content_mapped_classes"] as $capDataClassUniqueId => $capDataClassInfo) { $exportClassContentDropdown = $capDataClassInfo["export_class_content_dropdown"]; - if(!empty($exportClassContentDropdown)){ + if (!empty($exportClassContentDropdown)) { $nodeStorage = $this->entityTypeManager->getStorage('node'); - switch ($capDataClassUniqueId) { + switch ($capDataClassUniqueId) { case 'capdata_typeproduction': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $showTypes = $nodeStorage->loadMultiple($results); - foreach ($showTypes as $showType) { - $nid = $showType->id(); - $resourceUrl = $host . "/node/" . $nid; - $typeProduction = new TypeProduction($resourceUrl); - $this->setReferentielCustomProperties($typeProduction, - $showType, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typeProduction, $showType, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $typeProduction->setArkBnf($arkBnf); - } - $graph->add($typeProduction); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $showTypes = $nodeStorage->loadMultiple($results); + foreach ($showTypes as $showType) { + $nid = $showType->id(); + $resourceUrl = $host . "/node/" . $nid; + $typeProduction = new TypeProduction($resourceUrl); + $this->setReferentielCustomProperties($typeProduction, + $showType, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typeProduction, $showType, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $typeProduction->setArkBnf($arkBnf); } - break; + $graph->add($typeProduction); + } + break; + case 'capdata_typepublic': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $publicTypes = $nodeStorage->loadMultiple($results); - foreach ($publicTypes as $publicType) { - $nid = $publicType->id(); - $resourceUrl = $host . "/node/" . $nid; - $typePublic = new TypePublic($resourceUrl); - $this->setReferentielCustomProperties($typePublic, - $publicType, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typePublic, $publicType, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $typePublic->setArkBnf($arkBnf); - } - $graph->add($typePublic); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $publicTypes = $nodeStorage->loadMultiple($results); + foreach ($publicTypes as $publicType) { + $nid = $publicType->id(); + $resourceUrl = $host . "/node/" . $nid; + $typePublic = new TypePublic($resourceUrl); + $this->setReferentielCustomProperties($typePublic, + $publicType, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typePublic, $publicType, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $typePublic->setArkBnf($arkBnf); } - break; + $graph->add($typePublic); + } + break; + case 'capdata_typeevenement': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $eventTypes = $nodeStorage->loadMultiple($results); - foreach ($eventTypes as $eventType) { - $nid = $eventType->id(); - $resourceUrl = $host . "/node/" . $nid; - $typeEvenement = new TypeEvenement($resourceUrl); - $this->setReferentielCustomProperties($typeEvenement, - $eventType, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typeEvenement, $eventType, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $typeEvenement->setArkBnf($arkBnf); - } - $graph->add($typeEvenement); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $eventTypes = $nodeStorage->loadMultiple($results); + foreach ($eventTypes as $eventType) { + $nid = $eventType->id(); + $resourceUrl = $host . "/node/" . $nid; + $typeEvenement = new TypeEvenement($resourceUrl); + $this->setReferentielCustomProperties($typeEvenement, + $eventType, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typeEvenement, $eventType, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $typeEvenement->setArkBnf($arkBnf); } - break; + $graph->add($typeEvenement); + } + break; + case 'capdata_typeoeuvre': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $artWorkTypes = $nodeStorage->loadMultiple($results); - foreach ($artWorkTypes as $artWorkType) { - $nid = $artWorkType->id(); - $resourceUrl = $host . "/node/" . $nid; - $typeOeuvre = new TypeOeuvre($resourceUrl); - $this->setReferentielCustomProperties($typeOeuvre, - $artWorkType, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typeOeuvre, $artWorkType, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $typeOeuvre->setArkBnf($arkBnf); - } - $graph->add($typeOeuvre); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $artWorkTypes = $nodeStorage->loadMultiple($results); + foreach ($artWorkTypes as $artWorkType) { + $nid = $artWorkType->id(); + $resourceUrl = $host . "/node/" . $nid; + $typeOeuvre = new TypeOeuvre($resourceUrl); + $this->setReferentielCustomProperties($typeOeuvre, + $artWorkType, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($typeOeuvre, $artWorkType, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $typeOeuvre->setArkBnf($arkBnf); } - break; + $graph->add($typeOeuvre); + } + break; + case 'capdata_statutjuridique': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $statutJuridiqueNodes = $nodeStorage->loadMultiple($results); - foreach ($statutJuridiqueNodes as $statutJuridiqueNode) { - $nid = $statutJuridiqueNode->id(); - $resourceUrl = $host . "/node/" . $nid; - $statutJuridique = new StatusJuridique($resourceUrl); - $this->setReferentielCustomProperties($statutJuridique, - $statutJuridiqueNode, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($statutJuridique, $statutJuridiqueNode, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $statutJuridique->setArkBnf($arkBnf); - } - $graph->add($statutJuridique); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $statutJuridiqueNodes = $nodeStorage->loadMultiple($results); + foreach ($statutJuridiqueNodes as $statutJuridiqueNode) { + $nid = $statutJuridiqueNode->id(); + $resourceUrl = $host . "/node/" . $nid; + $statutJuridique = new StatusJuridique($resourceUrl); + $this->setReferentielCustomProperties($statutJuridique, + $statutJuridiqueNode, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($statutJuridique, $statutJuridiqueNode, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $statutJuridique->setArkBnf($arkBnf); } - break; + $graph->add($statutJuridique); + } + break; + case 'capdata_genreoeuvre': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $genreOeuvreNodes = $nodeStorage->loadMultiple($results); - foreach ($genreOeuvreNodes as $genreOeuvreNode) { - $nid = $genreOeuvreNode->id(); - $resourceUrl = $host . "/node/" . $nid; - $genreOeuvre = new GenreOeuvre($resourceUrl); - $this->setReferentielCustomProperties($genreOeuvre, - $genreOeuvreNode, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($genreOeuvre, $genreOeuvreNode, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $genreOeuvre->setArkBnf($arkBnf); - } - $graph->add($genreOeuvre); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $genreOeuvreNodes = $nodeStorage->loadMultiple($results); + foreach ($genreOeuvreNodes as $genreOeuvreNode) { + $nid = $genreOeuvreNode->id(); + $resourceUrl = $host . "/node/" . $nid; + $genreOeuvre = new GenreOeuvre($resourceUrl); + $this->setReferentielCustomProperties($genreOeuvre, + $genreOeuvreNode, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($genreOeuvre, $genreOeuvreNode, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $genreOeuvre->setArkBnf($arkBnf); } - break; + $graph->add($genreOeuvre); + } + break; + case 'capdata_historiqueproduction': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $historiqueProductionNodes = $nodeStorage->loadMultiple($results); - foreach ($historiqueProductionNodes as $historiqueProductionNode) { - $nid = $historiqueProductionNode->id(); - $resourceUrl = $host . "/node/" . $nid; - $historiqueProduction = new HistoriqueProduction($resourceUrl); - $this->setReferentielCustomProperties($historiqueProduction, - $historiqueProductionNode, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($historiqueProduction, $historiqueProductionNode, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $historiqueProduction->setArkBnf($arkBnf); - } - $graph->add($historiqueProduction); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $historiqueProductionNodes = $nodeStorage->loadMultiple($results); + foreach ($historiqueProductionNodes as $historiqueProductionNode) { + $nid = $historiqueProductionNode->id(); + $resourceUrl = $host . "/node/" . $nid; + $historiqueProduction = new HistoriqueProduction($resourceUrl); + $this->setReferentielCustomProperties($historiqueProduction, + $historiqueProductionNode, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($historiqueProduction, $historiqueProductionNode, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $historiqueProduction->setArkBnf($arkBnf); } - break; + $graph->add($historiqueProduction); + } + break; + case 'capdata_categorieoeuvre': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $oeuvreCategories = $nodeStorage->loadMultiple($results); - foreach ($oeuvreCategories as $oeuvreCategory) { - $nid = $oeuvreCategory->id(); - $resourceUrl = $host . "/node/" . $nid; - $categorieOeuvre = new CategorieOeuvre($resourceUrl); - $this->setReferentielCustomProperties($categorieOeuvre, - $oeuvreCategory, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($categorieOeuvre, $oeuvreCategory, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $categorieOeuvre->setArkBnf($arkBnf); - } - $graph->add($categorieOeuvre); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $oeuvreCategories = $nodeStorage->loadMultiple($results); + foreach ($oeuvreCategories as $oeuvreCategory) { + $nid = $oeuvreCategory->id(); + $resourceUrl = $host . "/node/" . $nid; + $categorieOeuvre = new CategorieOeuvre($resourceUrl); + $this->setReferentielCustomProperties($categorieOeuvre, + $oeuvreCategory, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($categorieOeuvre, $oeuvreCategory, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $categorieOeuvre->setArkBnf($arkBnf); } - break; + $graph->add($categorieOeuvre); + } + break; + case 'capdata_role': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $roleNodes = $nodeStorage->loadMultiple($results); - foreach ($roleNodes as $roleNode) { - $nid = $roleNode->id(); - $resourceUrl = $host . "/node/" . $nid; - $role = new Role($resourceUrl); - $this->setReferentielCustomProperties($role, - $roleNode, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($role, $roleNode, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $role->setArkBnf($arkBnf); - } - $graph->add($role); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $roleNodes = $nodeStorage->loadMultiple($results); + foreach ($roleNodes as $roleNode) { + $nid = $roleNode->id(); + $resourceUrl = $host . "/node/" . $nid; + $role = new Role($resourceUrl); + $this->setReferentielCustomProperties($role, + $roleNode, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($role, $roleNode, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $role->setArkBnf($arkBnf); } - break; + $graph->add($role); + } + break; + case 'capdata_pays': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $countries = $nodeStorage->loadMultiple($results); - foreach ($countries as $country) { - $nid = $country->id(); - $resourceUrl = $host . "/node/" . $nid; - $pays = new Pays($resourceUrl); - $this->setReferentielCustomProperties($pays, - $country, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($pays, $country, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $pays->setArkBnf($arkBnf); - } - $graph->add($pays); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $countries = $nodeStorage->loadMultiple($results); + foreach ($countries as $country) { + $nid = $country->id(); + $resourceUrl = $host . "/node/" . $nid; + $pays = new Pays($resourceUrl); + $this->setReferentielCustomProperties($pays, + $country, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($pays, $country, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $pays->setArkBnf($arkBnf); } - break; + $graph->add($pays); + } + break; + case 'capdata_fonction': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $refFonctions = $nodeStorage->loadMultiple($results); - foreach ($refFonctions as $refFonction) { - $nid = $refFonction->id(); - $resourceUrl = $host . "/node/" . $nid; - $fonction = new Fonction($resourceUrl); - $this->setReferentielCustomProperties($fonction, - $refFonction, - $capDataClassInfo["export_class_capdata_properties"], - "content" - ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($fonction, $refFonction, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ - $arkBnf = new ArkBnf($arkBnfUrl); - $graph->add($arkBnf); - $fonction->setArkBnf($arkBnf); - } - $graph->add($fonction); + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $refFonctions = $nodeStorage->loadMultiple($results); + foreach ($refFonctions as $refFonction) { + $nid = $refFonction->id(); + $resourceUrl = $host . "/node/" . $nid; + $fonction = new Fonction($resourceUrl); + $this->setReferentielCustomProperties($fonction, + $refFonction, + $capDataClassInfo["export_class_capdata_properties"], + "content" + ); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($fonction, $refFonction, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { + $arkBnf = new ArkBnf($arkBnfUrl); + $graph->add($arkBnf); + $fonction->setArkBnf($arkBnf); } - break; + $graph->add($fonction); + } + break; + case 'capdata_collectivite': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $collectivities = $nodeStorage->loadMultiple($results); - foreach ($collectivities as $collectivity) { - $nid = $collectivity->id(); - $resourceUrl = $host . "/node/" . $nid; - $collectivite = new Collectivite($resourceUrl); - $this->setCapdataCollectiviteProperties($collectivite, $collectivity, $capDataClassInfo, "content"); - $isniUrl = $this->setIsniCapdataProperty($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($isniUrl)){ - $isni = new Isni($isniUrl); - $graph->add($isni); - $collectivite->setIsni($isni); - } - // A pour fonction - $capDataFonctionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])){ - $capDataFonctionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])){ - $capDataFonctionMappingType = "taxo"; - } - $capDataFonctionMappingInfo = [ - "capData_fonction_mappingtype" => $capDataFonctionMappingType, - ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $collectivity, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], - ]; - $this->setAPourFonctionCapdataProperty($collectivite, - $capDataFonctionMappingInfo, - $currentCapdataClassMappingInfo - ); - $this->setCapdataImageProperty($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Media image, sound - $mediaInfo = $this->getCapdataMediaPropertyInfo($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ - $refImageUrl = $mediaInfo["mediaUrl"]; - $capdataImage = new Image($refImageUrl); - $capdataImage->setContentUrl($refImageUrl); - $capdataImage->setName($collectivite->getNom()); - $graph->add($capdataImage); - $collectivite->setMedia($capdataImage); - } - // Media sound to be implemented - } - // A pour lieu (Lieu) - $capDataLieuCustomMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ - $capDataLieuCustomMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ - $capDataLieuCustomMappingType = "taxo"; + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $collectivities = $nodeStorage->loadMultiple($results); + foreach ($collectivities as $collectivity) { + $nid = $collectivity->id(); + $resourceUrl = $host . "/node/" . $nid; + $collectivite = new Collectivite($resourceUrl); + $this->setCapdataCollectiviteProperties($collectivite, $collectivity, $capDataClassInfo, "content"); + $isniUrl = $this->setIsniCapdataProperty($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($isniUrl)) { + $isni = new Isni($isniUrl); + $graph->add($isni); + $collectivite->setIsni($isni); + } + // A pour fonction. + $capDataFonctionMappingType = ""; + if (isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])) { + $capDataFonctionMappingType = "content"; + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])) { + $capDataFonctionMappingType = "taxo"; + } + $capDataFonctionMappingInfo = [ + "capData_fonction_mappingtype" => $capDataFonctionMappingType, + ]; + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $collectivity, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + ]; + $this->setApourFonctionCapdataProperty($collectivite, + $capDataFonctionMappingInfo, + $currentCapdataClassMappingInfo + ); + $this->setCapdataImageProperty($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); + // Media image, sound. + $mediaInfo = $this->getCapdataMediaPropertyInfo($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { + $refImageUrl = $mediaInfo["mediaUrl"]; + $capdataImage = new Image($refImageUrl); + $capdataImage->setContentUrl($refImageUrl); + $capdataImage->setName($collectivite->getNom()); + $graph->add($capdataImage); + $collectivite->setMedia($capdataImage); } - $capDataLieuCustomMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, - ]; - $this->setAPourLieuCapdataProperty($collectivite, - $capDataLieuCustomMappingInfo, - $currentCapdataClassMappingInfo - ); - // Identifiant ROF - $this->setIdentifiantRofProperty($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); - $graph->add($collectivite); + // Media sound to be implemented. } - break; + // A pour lieu (Lieu) + $capDataLieuCustomMappingType = ""; + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { + $capDataLieuCustomMappingType = "content"; + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { + $capDataLieuCustomMappingType = "taxo"; + } + $capDataLieuCustomMappingInfo = [ + "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, + ]; + $this->setApourLieuCapdataProperty($collectivite, + $capDataLieuCustomMappingInfo, + $currentCapdataClassMappingInfo + ); + // Identifiant ROF. + $this->setIdentifiantRofProperty($collectivite, $collectivity, $capDataClassInfo["export_class_capdata_properties"], "content"); + $graph->add($collectivite); + } + break; + case 'capdata_adressepostale': - $query = $nodeStorage->getQuery(); - $query->accessCheck(FALSE); - $query->condition('type', $exportClassContentDropdown); - $query->condition('status', 1); - $results = $query->execute(); - $adressesPostales = $nodeStorage->loadMultiple($results); - foreach ($adressesPostales as $adrPostale) { - $nid = $adrPostale->id(); - $resourceUrl = $host . "/node/" . $nid; - $capdataAdressePostale = new AdressePostale($resourceUrl); - // Commune - $commune = ""; - if(isset($capDataClassInfo["export_class_capdata_properties"]["commune"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_fields_dropdown"])){ - $communeFieldName = $capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_fields_dropdown"]; - if ($adrPostale->hasField($communeFieldName) && !$adrPostale->get($communeFieldName)->isEmpty()) { - $commune = $adrPostale->get($communeFieldName)->value; - if(!empty($commune)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_custom_processing"])){ - $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_custom_processing"]; - $commune = $this->customFieldProcessing($commune, $customProcessing); - } - $capdataAdressePostale->setCommune($commune); - } + $query = $nodeStorage->getQuery(); + $query->accessCheck(FALSE); + $query->condition('type', $exportClassContentDropdown); + $query->condition('status', 1); + $results = $query->execute(); + $adressesPostales = $nodeStorage->loadMultiple($results); + foreach ($adressesPostales as $adrPostale) { + $nid = $adrPostale->id(); + $resourceUrl = $host . "/node/" . $nid; + $capdataAdressePostale = new AdressePostale($resourceUrl); + // Commune. + $commune = ""; + if (isset($capDataClassInfo["export_class_capdata_properties"]["commune"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_fields_dropdown"])) { + $communeFieldName = $capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_fields_dropdown"]; + if ($adrPostale->hasField($communeFieldName) && !$adrPostale->get($communeFieldName)->isEmpty()) { + $commune = $adrPostale->get($communeFieldName)->value; + if (!empty($commune)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_custom_processing"])) { + $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["commune"]["property_content_custom_processing"]; + $commune = $this->customFieldProcessing($commune, $customProcessing); } + $capdataAdressePostale->setCommune($commune); } } - // Adresse postale (texte) - $adressePostaleTexte = ""; - if(isset($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_fields_dropdown"])){ - $adressePostaleTxtFieldName = $capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_fields_dropdown"]; - if ($adrPostale->hasField($adressePostaleTxtFieldName) && !$adrPostale->get($adressePostaleTxtFieldName)->isEmpty()) { - $adressePostaleTexte = $adrPostale->get($adressePostaleTxtFieldName)->value; - if(!empty($adressePostaleTexte)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_custom_processing"])){ - $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_custom_processing"]; - $adressePostaleTexte = $this->customFieldProcessing($adressePostaleTexte, $customProcessing); - } - $capdataAdressePostale->setAdressePostale($adressePostaleTexte); - } + } + } + // Adresse postale (texte) + $adressePostaleTexte = ""; + if (isset($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_fields_dropdown"])) { + $adressePostaleTxtFieldName = $capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_fields_dropdown"]; + if ($adrPostale->hasField($adressePostaleTxtFieldName) && !$adrPostale->get($adressePostaleTxtFieldName)->isEmpty()) { + $adressePostaleTexte = $adrPostale->get($adressePostaleTxtFieldName)->value; + if (!empty($adressePostaleTexte)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_custom_processing"])) { + $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["adresse_postale_txt"]["property_content_custom_processing"]; + $adressePostaleTexte = $this->customFieldProcessing($adressePostaleTexte, $customProcessing); } + $capdataAdressePostale->setAdressePostale($adressePostaleTexte); } } - // Code postal - $codePostal = ""; - if(isset($capDataClassInfo["export_class_capdata_properties"]["code_postal"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_fields_dropdown"])){ - $codePostalFieldName = $capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_fields_dropdown"]; - if ($adrPostale->hasField($codePostalFieldName) && !$adrPostale->get($codePostalFieldName)->isEmpty()) { - $codePostal = $adrPostale->get($codePostalFieldName)->value; - if(!empty($codePostal)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_custom_processing"])){ - $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_custom_processing"]; - $codePostal = $this->customFieldProcessing($codePostal, $customProcessing); - } - $capdataAdressePostale->setCodePostal($codePostal); - } + } + } + // Code postal. + $codePostal = ""; + if (isset($capDataClassInfo["export_class_capdata_properties"]["code_postal"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_fields_dropdown"])) { + $codePostalFieldName = $capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_fields_dropdown"]; + if ($adrPostale->hasField($codePostalFieldName) && !$adrPostale->get($codePostalFieldName)->isEmpty()) { + $codePostal = $adrPostale->get($codePostalFieldName)->value; + if (!empty($codePostal)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_custom_processing"])) { + $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["code_postal"]["property_content_custom_processing"]; + $codePostal = $this->customFieldProcessing($codePostal, $customProcessing); } + $capdataAdressePostale->setCodePostal($codePostal); } } - // Identifiant Rof - $this->setIdentifiantRofProperty($capdataAdressePostale, $adrPostale, $capDataClassInfo["export_class_capdata_properties"], "content"); - $graph->add($capdataAdressePostale); } - break; + } + // Identifiant Rof. + $this->setIdentifiantRofProperty($capdataAdressePostale, $adrPostale, $capDataClassInfo["export_class_capdata_properties"], "content"); + $graph->add($capdataAdressePostale); + } + break; + case 'capdata_lieu': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3105,15 +3214,15 @@ class CapDataConnectorManager { $nid = $lieuGeographique->id(); $resourceUrl = $host . "/node/" . $nid; $lieu = new Lieu($resourceUrl); - // Label + // Label. $label = $lieuGeographique->getTitle(); - if(isset($capDataClassInfo["export_class_capdata_properties"]["cd_label"])){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_content_fields_dropdown"])){ + if (isset($capDataClassInfo["export_class_capdata_properties"]["cd_label"])) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_content_fields_dropdown"])) { $labelFieldName = $capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_content_fields_dropdown"]; if ($lieuGeographique->hasField($labelFieldName) && !$lieuGeographique->get($labelFieldName)->isEmpty()) { $label = $lieuGeographique->get($labelFieldName)->value; - if(!empty($label)){ - if(!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_content_custom_processing"])){ + if (!empty($label)) { + if (!empty($capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_content_custom_processing"])) { $customProcessing = $capDataClassInfo["export_class_capdata_properties"]["cd_label"]["property_content_custom_processing"]; $label = $this->customFieldProcessing($label, $customProcessing); } @@ -3122,49 +3231,51 @@ class CapDataConnectorManager { } } $this->setNameTraitCapdataProperties($lieu, $label); - // Catalogage - $this->setCatalogCapdataProperties($lieu, - $lieuGeographique, + // Catalogage. + $this->setCatalogCapdataProperties($lieu, + $lieuGeographique, $capDataClassInfo["export_class_capdata_properties"], "content" - ); + ); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $lieuGeographique, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $lieuGeographique, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($lieu, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); - // Open agenda - $this->setOpenAgendaCapdataProperty($lieu, - $lieuGeographique, + // Open agenda. + $this->setOpenAgendaCapdataProperty($lieu, + $lieuGeographique, $capDataClassInfo["export_class_capdata_properties"], "content" - ); - // Description - $this->setDescriptionCapdataProperty($lieu, - $lieuGeographique, + ); + // Description. + $this->setDescriptionCapdataProperty($lieu, + $lieuGeographique, $capDataClassInfo["export_class_capdata_properties"], "content" - ); - // Identifiant Rof + ); + // Identifiant Rof. $this->setIdentifiantRofProperty($lieu, $lieuGeographique, $capDataClassInfo["export_class_capdata_properties"], "content"); $graph->add($lieu); - } - break; + } + break; + case 'capdata_personne': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3176,91 +3287,94 @@ class CapDataConnectorManager { $nid = $artist->id(); $resourceUrl = $host . "/node/" . $nid; $personne = new Personne($resourceUrl); - $this->setPersonalDetails($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setPersonalDetails($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setIdentifiantRofProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setSocialsCapdataProperties($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - $isniUrl = $this->setIsniCapdataProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($isniUrl)){ + $this->setSocialsCapdataProperties($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); + $isniUrl = $this->setIsniCapdataProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($isniUrl)) { $isni = new Isni($isniUrl); $graph->add($isni); $personne->setIsni($isni); } $this->setDescriptionCapdataProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setArkBnfTraitCapdataProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setArkBnfTraitCapdataProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $personne->setArkBnf($arkBnf); - } + } $this->setCapdataImageProperty($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Media image, sound + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $prenom = $personne->getPrenom(); $nom = $personne->getNom(); - $capdataImage->setName($prenom. ' '.$nom); + $capdataImage->setName($prenom . ' ' . $nom); $graph->add($capdataImage); - $personne->setMedia($capdataImage); + $personne->setMedia($capdataImage); } - // Media sound to be implemented - } - // Catalogage + // Media sound to be implemented. + } + // Catalogage. $this->setCatalogCapdataProperties($personne, $artist, $capDataClassInfo["export_class_capdata_properties"], "content"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $artist, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $artist, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($personne, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); - // A pour fonction + // A pour fonction. $capDataFonctionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "taxo"; } $capDataFonctionMappingInfo = [ - "capData_fonction_mappingtype" => $capDataFonctionMappingType, + "capData_fonction_mappingtype" => $capDataFonctionMappingType, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $artist, + "mapping_type" => "content", + "mapped_entity" => $artist, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - $this->setAPourFonctionCapdataProperty($personne, + $this->setApourFonctionCapdataProperty($personne, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour profession - $this->setAPourProfessionCapdataProperty($personne, + ); + // A pour profession. + $this->setApourProfessionCapdataProperty($personne, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo - ); - $this->moduleHandler->alter('capdata_graph_item', $personne, $artist, $graph); + ); + $this->moduleHandler->alter('capdata_graph_item', $personne, $artist, $graph); $graph->add($personne); } break; + case 'capdata_saison': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3277,30 +3391,31 @@ class CapDataConnectorManager { $capDataClassInfo["export_class_capdata_properties"], "content" ); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($saison, $season, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($saison, $season, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $saison->setArkBnf($arkBnf); - } - // Media image, sound + } + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($saison, $season, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($saison->getLabel()); $graph->add($capdataImage); - $saison->setMedia($capdataImage); + $saison->setMedia($capdataImage); } - // Media sound to be implemented - } - // Alter - $this->moduleHandler->alter('capdata_graph_item', $saison, $season, $graph); + // Media sound to be implemented. + } + // Alter. + $this->moduleHandler->alter('capdata_graph_item', $saison, $season, $graph); $graph->add($saison); } break; + case 'capdata_participation': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3316,12 +3431,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($participation, $participationItem, $participationContentMappingInfo); $graph->add($participation); } - break; + break; + case 'capdata_auteur': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3337,12 +3453,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($auteur, $authorItem, $participationContentMappingInfo); $graph->add($auteur); } - break; + break; + case 'capdata_collaboration': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3358,12 +3475,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($collaboration, $collaborationItem, $participationContentMappingInfo); $graph->add($collaboration); } - break; + break; + case 'capdata_interpretation': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3379,12 +3497,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($interpretation, $interpretationItem, $participationContentMappingInfo); $graph->add($interpretation); } - break; + break; + case 'capdata_maitriseoeuvre': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3400,12 +3519,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($maitriseOeuvre, $maitriseOeuvreItem, $participationContentMappingInfo); $graph->add($maitriseOeuvre); } - break; + break; + case 'capdata_mentionproduction': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3421,12 +3541,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($mentionProduction, $mentionProductionItem, $participationContentMappingInfo); $graph->add($mentionProduction); } - break; + break; + case 'capdata_partenariat': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3442,12 +3563,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($partenariat, $partenariatItem, $participationContentMappingInfo); $graph->add($partenariat); } - break; + break; + case 'capdata_programmation': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3463,12 +3585,13 @@ class CapDataConnectorManager { 'capdataExportData' => $capdataExportData, 'host' => $host, 'capDataClassInfo' => $capDataClassInfo, - 'ownOrg' => $ownOrg + 'ownOrg' => $ownOrg, ]; $this->handleParticipationContentMapping($programmation, $programmationItem, $participationContentMappingInfo); $graph->add($programmation); } - break; + break; + case 'capdata_oeuvre': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3480,270 +3603,281 @@ class CapDataConnectorManager { $nid = $oeuvreItem->id(); $resourceUrl = $host . "/node/" . $nid; $oeuvre = new Oeuvre($resourceUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $oeuvreItem, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $oeuvreItem, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($oeuvre, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Titre, description ... - $this->setCapdataTitle($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setDescriptionCapdataProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setArkBnfTraitCapdataProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setDescriptionCapdataProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setArkBnfTraitCapdataProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $oeuvre->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setCapdataImageProperty($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Media image, sound + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($oeuvre->getTitre()); $graph->add($capdataImage); - $oeuvre->setMedia($capdataImage); + $oeuvre->setMedia($capdataImage); } - // Media sound to be implemented + // Media sound to be implemented. } - // Participations diverses + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $oeuvreItem, + "mapping_type" => "content", + "mapped_entity" => $oeuvreItem, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($oeuvre, + // A pour participation. + $this->setApourParticipationCapdataProperty($oeuvre, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($oeuvre, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($oeuvre, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour Mention Production (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($oeuvre, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($oeuvre, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($oeuvre, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($oeuvre, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($oeuvre, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($oeuvre, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // Categorie Oeuvre + ); + // Categorie Oeuvre. $capDataCategorieOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_categorieoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_categorieoeuvre"])) { $capDataCategorieOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_categorieoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_categorieoeuvre"])) { $capDataCategorieOeuvreMappingType = "taxo"; } $capDataCategorieOeuvreMappingInfo = [ - "capData_categorieoeuvre_mappingtype" => $capDataCategorieOeuvreMappingType, + "capData_categorieoeuvre_mappingtype" => $capDataCategorieOeuvreMappingType, ]; $this->setCategorieOeuvreCapdataProperty($oeuvre, $capDataCategorieOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Genre Oeuvre + ); + // Genre Oeuvre. $capDataGenreOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_genreoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_genreoeuvre"])) { $capDataGenreOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_genreoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_genreoeuvre"])) { $capDataGenreOeuvreMappingType = "taxo"; } $capDataGenreOeuvreMappingInfo = [ - "capData_genreoeuvre_mappingtype" => $capDataGenreOeuvreMappingType, + "capData_genreoeuvre_mappingtype" => $capDataGenreOeuvreMappingType, ]; $this->setGenreOeuvreCapdataProperty($oeuvre, $capDataGenreOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Type Oeuvre + ); + // Type Oeuvre. $capDataTypeOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeoeuvre"])) { $capDataTypeOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeoeuvre"])) { $capDataTypeOeuvreMappingType = "taxo"; } $capDataTypeOeuvreMappingInfo = [ - "capData_typeoeuvre_mappingtype" => $capDataTypeOeuvreMappingType, + "capData_typeoeuvre_mappingtype" => $capDataTypeOeuvreMappingType, ]; $this->setTypeOeuvreCapdataProperty($oeuvre, $capDataTypeOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Personnage (Role) + ); + // Personnage (Role) $capDataRoleMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_role"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_role"])) { $capDataRoleMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_role"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_role"])) { $capDataRoleMappingType = "taxo"; } $capDataRoleMappingInfo = [ - "capData_role_mappingtype" => $capDataRoleMappingType, + "capData_role_mappingtype" => $capDataRoleMappingType, ]; $this->setPersonnageCapdataProperty($oeuvre, $capDataRoleMappingInfo, $currentCapdataClassMappingInfo - ); - // Oeuvre titreFormeRejet, sourceLivret, intrigue .. + ); + // Oeuvre titreFormeRejet, sourceLivret, intrigue .. $this->setOeuvreDetails($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Oeuvre dates - $this->setOeuvreDatesCapdataProperties($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Alter + // Oeuvre dates. + $this->setOeuvreDatesCapdataProperties($oeuvre, $oeuvreItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + // Alter. $this->moduleHandler->alter('capdata_graph_item', $oeuvre, $oeuvreItem, $graph); $graph->add($oeuvre); } - break; + break; + case 'capdata_productionprimaire': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -3755,381 +3889,397 @@ class CapDataConnectorManager { $nid = $show->id(); $resourceUrl = $host . "/node/" . $nid; $production = new ProductionPrimaire($resourceUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $show, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $show, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($production, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); // Titre, description ... - $this->setCapdataTitle($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setDescriptionCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setArkBnfTraitCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setDescriptionCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setArkBnfTraitCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $production->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setProductionDatesProperties($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setCapdataImageProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Media image, sound + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($production->getTitre()); $graph->add($capdataImage); - $production->setMedia($capdataImage); + $production->setMedia($capdataImage); } - // Media sound to be implemented + // Media sound to be implemented. } - // Participations diverses + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $show, + "mapping_type" => "content", + "mapped_entity" => $show, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($production, + // A pour participation. + $this->setApourParticipationCapdataProperty($production, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($production, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($production, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour Mention Production (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($production, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($production, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($production, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($production, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour collaboration (Collaboration ou participation) $capDataCollaborationMappingType = ""; $capDataCollaborationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollaborationMappingInfo = [ - "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, - "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, - ]; - $this->setAPourCollaborationCapdataProperty($production, + "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, + "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, + ]; + $this->setApourCollaborationCapdataProperty($production, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($production, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($production, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour maitrise oeuvre (MaitriseOeuvre ou participation) $capDataMaitriseOeuvreMappingType = ""; $capDataMaitriseOeuvreCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMaitriseOeuvreMappingInfo = [ - "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, - "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, - ]; - $this->setAPourMaitriseOeuvreCapdataProperty($production, + "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, + "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, + ]; + $this->setApourMaitriseOeuvreCapdataProperty($production, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour programmation (Programmation ou participation) $capDataProgrammationMappingType = ""; $capDataProgrammationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataProgrammationMappingInfo = [ - "capData_programmation_mappingtype" => $capDataProgrammationMappingType, - "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, - ]; - $this->setAPourProgrammationCapdataProperty($production, + "capData_programmation_mappingtype" => $capDataProgrammationMappingType, + "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, + ]; + $this->setApourProgrammationCapdataProperty($production, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour saison (Saison) + ); + // A pour saison (Saison) $capDataSaisonMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_saison"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "taxo"; } $capDataSaisonMappingInfo = [ - "capData_saison_mappingtype" => $capDataSaisonMappingType, + "capData_saison_mappingtype" => $capDataSaisonMappingType, ]; - $this->setAPourSaisonCapdataProperty($production, + $this->setApourSaisonCapdataProperty($production, $capDataSaisonMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type production (TypeProduction) $capDataTypeProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "taxo"; } $capDataTypeProductionMappingInfo = [ - "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, + "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, ]; - $this->setAPourTypeProductionCapdataProperty($production, + $this->setApourTypeProductionCapdataProperty($production, $capDataTypeProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type public (TypePublic) $capDataTypePublicMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "taxo"; } $capDataTypePublicMappingInfo = [ - "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, + "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, ]; - $this->setAPourTypePublicCapdataProperty($production, + $this->setApourTypePublicCapdataProperty($production, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo - ); - // Historique (HistoriqueProduction) + ); + // Historique (HistoriqueProduction) $capDataHistoriqueProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "taxo"; } $capDataHistoriqueProductionMappingInfo = [ - "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, + "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, ]; $this->setHistoriqueCapdataProperty($production, $capDataHistoriqueProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Lieu Publication (Lieu) $capDataLieuPublicationMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "taxo"; } $capDataLieuPublicationMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, + "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, ]; $this->setLieuPublicationCapdataProperty($production, $capDataLieuPublicationMappingInfo, $currentCapdataClassMappingInfo - ); - // Oeuvre representee (Oeuvre) + ); + // Oeuvre representee (Oeuvre) $capDataOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "taxo"; } $capDataOeuvreMappingInfo = [ - "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, + "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, ]; $this->setOeuvreRepresenteeCapdataProperty($production, $capDataOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - $this->moduleHandler->alter('capdata_graph_item', $production, $show, $graph); + ); + $this->moduleHandler->alter('capdata_graph_item', $production, $show, $graph); $graph->add($production); } - break; + break; + case 'capdata_production': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -4141,396 +4291,413 @@ class CapDataConnectorManager { $nid = $show->id(); $resourceUrl = $host . "/node/" . $nid; $production = new Production($resourceUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $show, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $show, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($production, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); // Titre, description ... - $this->setCapdataTitle($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setDescriptionCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setArkBnfTraitCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setDescriptionCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setArkBnfTraitCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $production->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setProductionDatesProperties($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setCapdataImageProperty($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Media image, sound + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($production, $show, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($production->getTitre()); $graph->add($capdataImage); - $production->setMedia($capdataImage); + $production->setMedia($capdataImage); } - // Media sound to be implemented + // Media sound to be implemented. } - // Participations diverses + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $show, + "mapping_type" => "content", + "mapped_entity" => $show, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($production, + // A pour participation. + $this->setApourParticipationCapdataProperty($production, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($production, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($production, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour Mention Production (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($production, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($production, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($production, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($production, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour collaboration (Collaboration ou participation) $capDataCollaborationMappingType = ""; $capDataCollaborationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollaborationMappingInfo = [ - "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, - "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, - ]; - $this->setAPourCollaborationCapdataProperty($production, + "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, + "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, + ]; + $this->setApourCollaborationCapdataProperty($production, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($production, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($production, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour maitrise oeuvre (MaitriseOeuvre ou participation) $capDataMaitriseOeuvreMappingType = ""; $capDataMaitriseOeuvreCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMaitriseOeuvreMappingInfo = [ - "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, - "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, - ]; - $this->setAPourMaitriseOeuvreCapdataProperty($production, + "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, + "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, + ]; + $this->setApourMaitriseOeuvreCapdataProperty($production, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour programmation (Programmation ou participation) $capDataProgrammationMappingType = ""; $capDataProgrammationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataProgrammationMappingInfo = [ - "capData_programmation_mappingtype" => $capDataProgrammationMappingType, - "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, - ]; - $this->setAPourProgrammationCapdataProperty($production, + "capData_programmation_mappingtype" => $capDataProgrammationMappingType, + "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, + ]; + $this->setApourProgrammationCapdataProperty($production, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour saison (Saison) + ); + // A pour saison (Saison) $capDataSaisonMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_saison"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_saison"])) { $capDataSaisonMappingType = "taxo"; } $capDataSaisonMappingInfo = [ - "capData_saison_mappingtype" => $capDataSaisonMappingType, + "capData_saison_mappingtype" => $capDataSaisonMappingType, ]; - $this->setAPourSaisonCapdataProperty($production, + $this->setApourSaisonCapdataProperty($production, $capDataSaisonMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type production (TypeProduction) $capDataTypeProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeproduction"])) { $capDataTypeProductionMappingType = "taxo"; } $capDataTypeProductionMappingInfo = [ - "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, + "capData_typeproduction_mappingtype" => $capDataTypeProductionMappingType, ]; - $this->setAPourTypeProductionCapdataProperty($production, + $this->setApourTypeProductionCapdataProperty($production, $capDataTypeProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour type public (TypePublic) $capDataTypePublicMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "taxo"; } $capDataTypePublicMappingInfo = [ - "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, + "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, ]; - $this->setAPourTypePublicCapdataProperty($production, + $this->setApourTypePublicCapdataProperty($production, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo - ); - // Historique (HistoriqueProduction) + ); + // Historique (HistoriqueProduction) $capDataHistoriqueProductionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_historiqueproduction"])) { $capDataHistoriqueProductionMappingType = "taxo"; } $capDataHistoriqueProductionMappingInfo = [ - "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, + "capData_historiqueproduction_mappingtype" => $capDataHistoriqueProductionMappingType, ]; $this->setHistoriqueCapdataProperty($production, $capDataHistoriqueProductionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // Lieu Publication (Lieu) $capDataLieuPublicationMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { $capDataLieuPublicationMappingType = "taxo"; } $capDataLieuPublicationMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, + "capData_lieu_mappingtype" => $capDataLieuPublicationMappingType, ]; $this->setLieuPublicationCapdataProperty($production, $capDataLieuPublicationMappingInfo, $currentCapdataClassMappingInfo - ); - // Oeuvre representee (Oeuvre) + ); + // Oeuvre representee (Oeuvre) $capDataOeuvreMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_oeuvre"])) { $capDataOeuvreMappingType = "taxo"; } $capDataOeuvreMappingInfo = [ - "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, + "capData_oeuvre_mappingtype" => $capDataOeuvreMappingType, ]; $this->setOeuvreRepresenteeCapdataProperty($production, $capDataOeuvreMappingInfo, $currentCapdataClassMappingInfo - ); - // Production Primaire (ProductionPrimaire) + ); + // Production Primaire (ProductionPrimaire) $capDataProductionPrimaireMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_productionprimaire"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_productionprimaire"])) { $capDataProductionPrimaireMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_productionprimaire"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_productionprimaire"])) { $capDataProductionPrimaireMappingType = "taxo"; } $capDataProductionPrimaireMappingInfo = [ - "capData_productionprimaire_mappingtype" => $capDataProductionPrimaireMappingType, + "capData_productionprimaire_mappingtype" => $capDataProductionPrimaireMappingType, ]; $this->setProductionPrimaireCapdataProperty($production, $capDataProductionPrimaireMappingInfo, $currentCapdataClassMappingInfo - ); - // Alter - $this->moduleHandler->alter('capdata_graph_item', $production, $show, $graph); + ); + // Alter. + $this->moduleHandler->alter('capdata_graph_item', $production, $show, $graph); $graph->add($production); } - break; + break; + case 'capdata_evenement': $query = $nodeStorage->getQuery(); $query->accessCheck(FALSE); @@ -4542,259 +4709,267 @@ class CapDataConnectorManager { $nid = $eventItem->id(); $resourceUrl = $host . "/node/" . $nid; $evenement = new Evenement($resourceUrl); - // Catalogage + // Catalogage. $this->setCatalogCapdataProperties($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); $capDataCollectiviteMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "default_collectivite" => $ownOrg, ]; - $currentCapdataClassMappingInfo =[ - "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $eventItem, - "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], + $currentCapdataClassMappingInfo = [ + "host" => $host, + "mapping_type" => "content", + "mapped_entity" => $eventItem, + "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; $this->setCatalogageSourceAgenceProperty($evenement, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); // Titre, description ... - $this->setCapdataTitle($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setDescriptionCapdataProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - $this->setArkBnfTraitCapdataProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($arkBnfUrl)){ + $this->setCapdataTitle($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setDescriptionCapdataProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + $this->setArkBnfTraitCapdataProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + $arkBnfUrl = $this->setExternalArkBnfCapdataProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); + if (!empty($arkBnfUrl)) { $arkBnf = new ArkBnf($arkBnfUrl); $graph->add($arkBnf); $evenement->setArkBnf($arkBnf); - } + } $this->setIdentifiantRofProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); $this->setCapdataImageProperty($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Media image, sound + // Media image, sound. $mediaInfo = $this->getCapdataMediaPropertyInfo($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - if(!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])){ - if($mediaInfo["mediaType"] == "image"){ + if (!empty($mediaInfo) && isset($mediaInfo["mediaType"]) && !empty($mediaInfo["mediaUrl"])) { + if ($mediaInfo["mediaType"] == "image") { $refImageUrl = $mediaInfo["mediaUrl"]; $capdataImage = new Image($refImageUrl); $capdataImage->setContentUrl($refImageUrl); $capdataImage->setName($evenement->getTitre()); $graph->add($capdataImage); - $evenement->setMedia($capdataImage); + $evenement->setMedia($capdataImage); } - // Media sound to be implemented - } - // Participations diverses + // Media sound to be implemented. + } + // Participations diverses. $capDataParticipationMappingType = ""; $capDataParticipationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_participation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_participation"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_participation"])) { $capDataParticipationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_mapping_type"] == "capdata_participation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataParticipationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_participation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataParticipationMappingInfo = [ - "capData_participation_mappingtype" => $capDataParticipationMappingType, - "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, + "capData_participation_mappingtype" => $capDataParticipationMappingType, + "capData_participation_correspondance" => $capDataParticipationCorrespondantEntity, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $eventItem, + "mapping_type" => "content", + "mapped_entity" => $eventItem, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], - ]; - // A pour participation - $this->setAPourParticipationCapdataProperty($evenement, + ]; + // A pour participation. + $this->setApourParticipationCapdataProperty($evenement, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour auteur (Auteur ou participation) $capDataAuteurMappingType = ""; $capDataAuteurCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_auteur"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_auteur"])) { $capDataAuteurMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_mapping_type"] == "capdata_auteur_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataAuteurCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_auteur"]["export_class_taxonomy_dropdown"]; - } + } } $capDataAuteurMappingInfo = [ - "capData_auteur_mappingtype" => $capDataAuteurMappingType, - "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, - ]; - $this->setAPourAuteurCapdataProperty($evenement, + "capData_auteur_mappingtype" => $capDataAuteurMappingType, + "capData_auteur_correspondance" => $capDataAuteurCorrespondantEntity, + ]; + $this->setApourAuteurCapdataProperty($evenement, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour Mention Production (MentionProduction ou Participation) $capDataMentionProductionMappingType = ""; $capDataMentionProductionCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_mentionproduction"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"])) { $capDataMentionProductionMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_mapping_type"] == "capdata_mentionproduction_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMentionProductionCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_mentionproduction"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMentionProductionMappingInfo = [ - "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, - "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, - ]; - $this->setAPourMentionProductionCapdataProperty($evenement, + "capData_mentionproduction_mappingtype" => $capDataMentionProductionMappingType, + "capData_mentionproduction_correspondance" => $capDataMentionProductionCorrespondantEntity, + ]; + $this->setApourMentionProductionCapdataProperty($evenement, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour partenariat (Partenariat ou participation) $capDataPartenariatMappingType = ""; $capDataPartenariatCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_partenariat"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"])) { $capDataPartenariatMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_mapping_type"] == "capdata_partenariat_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPartenariatCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_partenariat"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPartenariatMappingInfo = [ - "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, - "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, - ]; - $this->setAPourPartenariatCapdataProperty($evenement, + "capData_partenariat_mappingtype" => $capDataPartenariatMappingType, + "capData_partenariat_correspondance" => $capDataPartenariatCorrespondantEntity, + ]; + $this->setApourPartenariatCapdataProperty($evenement, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour collaboration (Collaboration ou participation) $capDataCollaborationMappingType = ""; $capDataCollaborationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collaboration"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"])) { $capDataCollaborationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_mapping_type"] == "capdata_collaboration_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollaborationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collaboration"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollaborationMappingInfo = [ - "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, - "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, - ]; - $this->setAPourCollaborationCapdataProperty($evenement, + "capData_collaboration_mappingtype" => $capDataCollaborationMappingType, + "capData_collaboration_correspondance" => $capDataCollaborationCorrespondantEntity, + ]; + $this->setApourCollaborationCapdataProperty($evenement, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour interpretation (Interpretation ou participation) $capDataInterpretationMappingType = ""; $capDataInterpretationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_interpretation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"])) { $capDataInterpretationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_mapping_type"] == "capdata_interpretation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataInterpretationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_interpretation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataInterpretationMappingInfo = [ - "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, - "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, - ]; - $this->setAPourInterpretationCapdataProperty($evenement, + "capData_interpretation_mappingtype" => $capDataInterpretationMappingType, + "capData_interpretation_correspondance" => $capDataInterpretationCorrespondantEntity, + ]; + $this->setApourInterpretationCapdataProperty($evenement, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour maitrise oeuvre (MaitriseOeuvre ou participation) $capDataMaitriseOeuvreMappingType = ""; $capDataMaitriseOeuvreCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"])) { $capDataMaitriseOeuvreMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_mapping_type"] == "capdata_maitriseoeuvre_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataMaitriseOeuvreCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_maitriseoeuvre"]["export_class_taxonomy_dropdown"]; - } + } } $capDataMaitriseOeuvreMappingInfo = [ - "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, - "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, - ]; - $this->setAPourMaitriseOeuvreCapdataProperty($evenement, + "capData_maitriseoeuvre_mappingtype" => $capDataMaitriseOeuvreMappingType, + "capData_maitriseoeuvre_correspondance" => $capDataMaitriseOeuvreCorrespondantEntity, + ]; + $this->setApourMaitriseOeuvreCapdataProperty($evenement, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo @@ -4802,119 +4977,128 @@ class CapDataConnectorManager { // A pour programmation (Programmation ou participation) $capDataProgrammationMappingType = ""; $capDataProgrammationCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_programmation"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_programmation"])) { $capDataProgrammationMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_mapping_type"] == "capdata_programmation_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataProgrammationCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_programmation"]["export_class_taxonomy_dropdown"]; - } + } } $capDataProgrammationMappingInfo = [ - "capData_programmation_mappingtype" => $capDataProgrammationMappingType, - "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, - ]; - $this->setAPourProgrammationCapdataProperty($evenement, + "capData_programmation_mappingtype" => $capDataProgrammationMappingType, + "capData_programmation_correspondance" => $capDataProgrammationCorrespondantEntity, + ]; + $this->setApourProgrammationCapdataProperty($evenement, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo ); - + // A pour type public (TypePublic) $capDataTypePublicMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typepublic"])) { $capDataTypePublicMappingType = "taxo"; } $capDataTypePublicMappingInfo = [ - "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, + "capData_typepublic_mappingtype" => $capDataTypePublicMappingType, ]; - $this->setAPourTypePublicCapdataProperty($evenement, + $this->setApourTypePublicCapdataProperty($evenement, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo - ); - // Open agenda - $this->setOpenAgendaCapdataProperty($evenement, - $eventItem, + ); + // Open agenda. + $this->setOpenAgendaCapdataProperty($evenement, + $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content" - ); + ); // A pour type evenement (typeEvenement) $capDataTypeEvenementMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_typeevenement"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_typeevenement"])) { $capDataTypeEvenementMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_typeevenement"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_typeevenement"])) { $capDataTypeEvenementMappingType = "taxo"; } $capDataTypeEvenementMappingInfo = [ - "capData_typeevenement_mappingtype" => $capDataTypeEvenementMappingType, + "capData_typeevenement_mappingtype" => $capDataTypeEvenementMappingType, ]; - $this->setAPourTypeEvenementCapdataProperty($evenement, + $this->setApourTypeEvenementCapdataProperty($evenement, $capDataTypeEvenementMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour lieu (Lieu) $capDataLieuCustomMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_lieu"])) { $capDataLieuCustomMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_lieu"])) { $capDataLieuCustomMappingType = "taxo"; } $capDataLieuCustomMappingInfo = [ - "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, + "capData_lieu_mappingtype" => $capDataLieuCustomMappingType, ]; - $this->setAPourLieuCapdataProperty($evenement, + $this->setApourLieuCapdataProperty($evenement, $capDataLieuCustomMappingInfo, $currentCapdataClassMappingInfo - ); - // A pour production (Production) + ); + // A pour production (Production) $capDataProductionCustomMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_production"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_production"])) { $capDataProductionCustomMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_production"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_production"])) { $capDataProductionCustomMappingType = "taxo"; } $capDataProductionCustomMappingInfo = [ - "capData_production_mappingtype" => $capDataProductionCustomMappingType, + "capData_production_mappingtype" => $capDataProductionCustomMappingType, ]; - $this->setAPourProductionCapdataProperty($evenement, + $this->setApourProductionCapdataProperty($evenement, $capDataProductionCustomMappingInfo, $currentCapdataClassMappingInfo - ); - // Dates + ); + // Dates. $this->setEventDatesCapdataProperties($evenement, $eventItem, $capDataClassInfo["export_class_capdata_properties"], "content"); - // Alter - $this->moduleHandler->alter('capdata_graph_item', $evenement, $eventItem, $graph); + // Alter. + $this->moduleHandler->alter('capdata_graph_item', $evenement, $eventItem, $graph); $graph->add($evenement); } - break; + break; + default: - break; + break; } } } - // Custom hook, pour l'ajout de données supplémentaires hook_capdata_graph_alter(&$graph) à la fin de l'export + // Custom hook, pour l'ajout de données supplémentaires + // hook_capdata_graph_alter(&$graph) à la fin de l'export. $this->moduleHandler->alter('capdata_graph', $graph, $capdataExportData); - // Finally, output the graph + // Finally, output the graph. $data = $serializer->serialize($graph, 'rdfxml'); return $data; } /** * Set NameTrait Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param string $name + * Name. */ public function setNameTraitCapdataProperties($graphItem, $name): void { $graphItem->setName($name); @@ -4922,72 +5106,80 @@ class CapDataConnectorManager { /** * Set Catalog Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setCatalogCapdataProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Date création ressource - $creationDateObj =""; - if ($mappedEntity instanceof \Drupal\taxonomy\TermInterface) { + // Date création ressource. + $creationDateObj = ""; + if ($mappedEntity instanceof TermInterface) { // $mappedEntity is a taxonomy term - $creationDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->changed->value); - }else{ - $creationDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->created->value); + $creationDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->changed->value); + } + else { + $creationDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->created->value); } - if(isset($exportClassCapdataProperties["date_creation_ressource"])){ - if(!empty($exportClassCapdataProperties["date_creation_ressource"]["property_".$mappingType."_fields_dropdown"])){ - $dateCreationFieldName = $exportClassCapdataProperties["date_creation_ressource"]["property_".$mappingType."_fields_dropdown"]; + if (isset($exportClassCapdataProperties["date_creation_ressource"])) { + if (!empty($exportClassCapdataProperties["date_creation_ressource"]["property_" . $mappingType . "_fields_dropdown"])) { + $dateCreationFieldName = $exportClassCapdataProperties["date_creation_ressource"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($dateCreationFieldName) && !$mappedEntity->get($dateCreationFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($dateCreationFieldName)->date)){ + if (!empty($mappedEntity->get($dateCreationFieldName)->date)) { $creationDateObj = $mappedEntity->get($dateCreationFieldName)->date; - }else{ - // timestamp field - $creationDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($dateCreationFieldName)->value); + } + else { + // Timestamp field. + $creationDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($dateCreationFieldName)->value); } } } } - // Date modification ressource - $modifDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->changed->value); - if(isset($exportClassCapdataProperties["date_modification_ressource"])){ - if(!empty($exportClassCapdataProperties["date_modification_ressource"]["property_".$mappingType."_fields_dropdown"])){ - $dateModifFieldName = $exportClassCapdataProperties["date_modification_ressource"]["property_".$mappingType."_fields_dropdown"]; + // Date modification ressource. + $modifDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->changed->value); + if (isset($exportClassCapdataProperties["date_modification_ressource"])) { + if (!empty($exportClassCapdataProperties["date_modification_ressource"]["property_" . $mappingType . "_fields_dropdown"])) { + $dateModifFieldName = $exportClassCapdataProperties["date_modification_ressource"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($dateModifFieldName) && !$mappedEntity->get($dateModifFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($dateModifFieldName)->date)){ + if (!empty($mappedEntity->get($dateModifFieldName)->date)) { $modifDateObj = $mappedEntity->get($dateModifFieldName)->date; - }else{ - // timestamp field - $modifDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($dateModifFieldName)->value); + } + else { + // Timestamp field. + $modifDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($dateModifFieldName)->value); } } } } $creationDate = ""; - if(!empty($creationDateObj)){ + if (!empty($creationDateObj)) { $creationDateObj->setTimezone(new \DateTimeZone('UTC')); $creationDate = $creationDateObj->format('Y-m-d\TH:i:s\Z'); } $modifDate = ""; - if(!empty($modifDateObj)){ + if (!empty($modifDateObj)) { $modifDateObj->setTimezone(new \DateTimeZone('UTC')); $modifDate = $modifDateObj->format('Y-m-d\TH:i:s\Z'); } - // Catalogage source date + // Catalogage source date. $sourceDate = ""; - if(isset($exportClassCapdataProperties["catalogage_source_date"])){ - if(!empty($exportClassCapdataProperties["catalogage_source_date"]["property_".$mappingType."_fields_dropdown"])){ - $sourceDateFieldName = $exportClassCapdataProperties["catalogage_source_date"]["property_".$mappingType."_fields_dropdown"]; + if (isset($exportClassCapdataProperties["catalogage_source_date"])) { + if (!empty($exportClassCapdataProperties["catalogage_source_date"]["property_" . $mappingType . "_fields_dropdown"])) { + $sourceDateFieldName = $exportClassCapdataProperties["catalogage_source_date"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($sourceDateFieldName) && !$mappedEntity->get($sourceDateFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($sourceDateFieldName)->date)){ + if (!empty($mappedEntity->get($sourceDateFieldName)->date)) { $sourceDateObj = $mappedEntity->get($sourceDateFieldName)->date; - }else{ - // timestamp field - $sourceDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($sourceDateFieldName)->value); + } + else { + // Timestamp field. + $sourceDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($sourceDateFieldName)->value); } $sourceDateObj->setTimezone(new \DateTimeZone('UTC')); $sourceDate = $sourceDateObj->format('Y-m-d\TH:i:s\Z'); @@ -4995,53 +5187,56 @@ class CapDataConnectorManager { } } - if(!empty($creationDate)){ + if (!empty($creationDate)) { $graphItem->setDateCreationRessource($creationDate); } - if(!empty($modifDate)){ + if (!empty($modifDate)) { $graphItem->setDateModificationRessource($modifDate); } - if(!empty($sourceDate)){ + if (!empty($sourceDate)) { $graphItem->setCatalogageSourceDate($sourceDate); } } - /** * Set Catalogage source agence property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataCollectiviteMappingInfo + * CapData collectivite mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setCatalogageSourceAgenceProperty($graphItem, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo): void { - // Catalogage source agence - $sourceAgences = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + // Catalogage source agence. + $sourceAgences = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["catalogage_source_agence"])){ - if(!empty($exportClassCapdataProperties["catalogage_source_agence"]["property_".$mappingType."_fields_dropdown"])){ - $sourceAgenceFieldName = $exportClassCapdataProperties["catalogage_source_agence"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["catalogage_source_agence"])) { + if (!empty($exportClassCapdataProperties["catalogage_source_agence"]["property_" . $mappingType . "_fields_dropdown"])) { + $sourceAgenceFieldName = $exportClassCapdataProperties["catalogage_source_agence"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($sourceAgenceFieldName) && !$mappedEntity->get($sourceAgenceFieldName)->isEmpty()) { $sourceAgenceItems = $mappedEntity->get($sourceAgenceFieldName); foreach ($sourceAgenceItems as $referenceSourceAgence) { $sourceAgenceItem = $referenceSourceAgence->entity; - if(!empty($sourceAgenceItem)){ - $referenceSourceAgenceId = $sourceAgenceItem->id(); - if(!empty($capDataCollectiviteMappingInfo)){ - if(!empty($capDataCollectiviteMappingInfo["capData_collectivite_mappingtype"])){ + if (!empty($sourceAgenceItem)) { + $referenceSourceAgenceId = $sourceAgenceItem->id(); + if (!empty($capDataCollectiviteMappingInfo)) { + if (!empty($capDataCollectiviteMappingInfo["capData_collectivite_mappingtype"])) { $collectiviteMappingType = $capDataCollectiviteMappingInfo["capData_collectivite_mappingtype"]; $referenceSourceAgenceUrl = ""; - if($collectiviteMappingType == "taxo" && $sourceAgenceItem instanceof \Drupal\taxonomy\TermInterface){ + if ($collectiviteMappingType == "taxo" && $sourceAgenceItem instanceof TermInterface) { $referenceSourceAgenceUrl = $host . "/taxonomy/term/" . $referenceSourceAgenceId; - }elseif($collectiviteMappingType == "content" && $sourceAgenceItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($collectiviteMappingType == "content" && $sourceAgenceItem instanceof NodeInterface) { $referenceSourceAgenceUrl = $host . "/node/" . $referenceSourceAgenceId; } - if(!empty($referenceSourceAgenceUrl)){ + if (!empty($referenceSourceAgenceUrl)) { $sourceAgences[] = new ExternalThing($referenceSourceAgenceUrl); } } @@ -5055,54 +5250,60 @@ class CapDataConnectorManager { } if (!empty($sourceAgences)) { $graphItem->setCatalogageSourceAgence($sourceAgences); - }elseif(!empty($capDataCollectiviteMappingInfo["default_collectivite"])){ + } + elseif (!empty($capDataCollectiviteMappingInfo["default_collectivite"])) { $graphItem->setCatalogageSourceAgence($capDataCollectiviteMappingInfo["default_collectivite"]); } } /** * Set Collectivite Capdata Properties. - * + * * @param mixed $collectivite + * Collectivite. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $capDataCollectiviteClassInfo + * CapData collectivite class info. * @param string $collectiviteMappingType + * Collectivite mapping type. */ public function setCapdataCollectiviteProperties($collectivite, $mappedEntity, $capDataCollectiviteClassInfo, $collectiviteMappingType): void { - // Label + // Label. $label = ""; - if($collectiviteMappingType == "content"){ + if ($collectiviteMappingType == "content") { $label = $mappedEntity->getTitle(); - }else{ + } + else { $label = $mappedEntity->label(); } - if(isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"])){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_".$collectiviteMappingType."_fields_dropdown"])){ - $labelFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_".$collectiviteMappingType."_fields_dropdown"]; + if (isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"])) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_" . $collectiviteMappingType . "_fields_dropdown"])) { + $labelFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_" . $collectiviteMappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($labelFieldName) && !$mappedEntity->get($labelFieldName)->isEmpty()) { $label = $mappedEntity->get($labelFieldName)->value; - if(!empty($label)){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_".$collectiviteMappingType."_custom_processing"])){ - $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_".$collectiviteMappingType."_custom_processing"]; + if (!empty($label)) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_" . $collectiviteMappingType . "_custom_processing"])) { + $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["cd_label"]["property_" . $collectiviteMappingType . "_custom_processing"]; $label = $this->customFieldProcessing($label, $customProcessing); } } } } } - if(!empty($label)){ + if (!empty($label)) { $collectivite->setNom($label); } - // Siret + // Siret. $siret = ""; - if(isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"])){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_".$collectiviteMappingType."_fields_dropdown"])){ - $siretFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_".$collectiviteMappingType."_fields_dropdown"]; - if($mappedEntity->hasField($siretFieldName) && !$mappedEntity->get($siretFieldName)->isEmpty()) { + if (isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"])) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_" . $collectiviteMappingType . "_fields_dropdown"])) { + $siretFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_" . $collectiviteMappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($siretFieldName) && !$mappedEntity->get($siretFieldName)->isEmpty()) { $siret = $mappedEntity->get($siretFieldName)->value; - if(!empty($siret)){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_".$collectiviteMappingType."_custom_processing"])){ - $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_".$collectiviteMappingType."_custom_processing"]; + if (!empty($siret)) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_" . $collectiviteMappingType . "_custom_processing"])) { + $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["siret"]["property_" . $collectiviteMappingType . "_custom_processing"]; $siret = $this->customFieldProcessing($siret, $customProcessing); } $collectivite->setSiret($siret); @@ -5110,44 +5311,46 @@ class CapDataConnectorManager { } } } - // Description - if($collectiviteMappingType == "content"){ - $this->setDescriptionCapdataProperty($collectivite, - $mappedEntity, + // Description. + if ($collectiviteMappingType == "content") { + $this->setDescriptionCapdataProperty($collectivite, + $mappedEntity, $capDataCollectiviteClassInfo["export_class_capdata_properties"], "content" - ); - }elseif($collectiviteMappingType == "taxo"){ - $this->setDescriptionCapdataProperty($collectivite, - $mappedEntity, + ); + } + elseif ($collectiviteMappingType == "taxo") { + $this->setDescriptionCapdataProperty($collectivite, + $mappedEntity, $capDataCollectiviteClassInfo["export_class_capdata_properties"], "taxo" - ); + ); } - // Has Socials Trait properties - if($collectiviteMappingType == "content"){ - $this->setSocialsCapdataProperties($collectivite, - $mappedEntity, + // Has Socials Trait properties. + if ($collectiviteMappingType == "content") { + $this->setSocialsCapdataProperties($collectivite, + $mappedEntity, $capDataCollectiviteClassInfo["export_class_capdata_properties"], "content" - ); - }elseif($collectiviteMappingType == "taxo"){ - $this->setSocialsCapdataProperties($collectivite, - $mappedEntity, + ); + } + elseif ($collectiviteMappingType == "taxo") { + $this->setSocialsCapdataProperties($collectivite, + $mappedEntity, $capDataCollectiviteClassInfo["export_class_capdata_properties"], "taxo" - ); + ); } - // Nom forme rejet + // Nom forme rejet. $nomFormeRejet = ""; - if(isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"])){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_".$collectiviteMappingType."_fields_dropdown"])){ - $nomFormeRejetFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_".$collectiviteMappingType."_fields_dropdown"]; - if($mappedEntity->hasField($nomFormeRejetFieldName) && !$mappedEntity->get($nomFormeRejetFieldName)->isEmpty()) { + if (isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"])) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_" . $collectiviteMappingType . "_fields_dropdown"])) { + $nomFormeRejetFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_" . $collectiviteMappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($nomFormeRejetFieldName) && !$mappedEntity->get($nomFormeRejetFieldName)->isEmpty()) { $nomFormeRejet = $mappedEntity->get($nomFormeRejetFieldName)->value; - if(!empty($nomFormeRejet)){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_".$collectiviteMappingType."_custom_processing"])){ - $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_".$collectiviteMappingType."_custom_processing"]; + if (!empty($nomFormeRejet)) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_" . $collectiviteMappingType . "_custom_processing"])) { + $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["nom_forme_rejet"]["property_" . $collectiviteMappingType . "_custom_processing"]; $nomFormeRejet = $this->customFieldProcessing($nomFormeRejet, $customProcessing); } $collectivite->setNomFormeRejet($nomFormeRejet); @@ -5155,16 +5358,16 @@ class CapDataConnectorManager { } } } - // Open agenda + // Open agenda. $openAgenda = ""; - if(isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"])){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_".$collectiviteMappingType."_fields_dropdown"])){ - $openAgendaFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_".$collectiviteMappingType."_fields_dropdown"]; - if($mappedEntity->hasField($openAgendaFieldName) && !$mappedEntity->get($openAgendaFieldName)->isEmpty()) { + if (isset($capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"])) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_" . $collectiviteMappingType . "_fields_dropdown"])) { + $openAgendaFieldName = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_" . $collectiviteMappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($openAgendaFieldName) && !$mappedEntity->get($openAgendaFieldName)->isEmpty()) { $openAgenda = $mappedEntity->get($openAgendaFieldName)->value; - if(!empty($openAgenda)){ - if(!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_".$collectiviteMappingType."_custom_processing"])){ - $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_".$collectiviteMappingType."_custom_processing"]; + if (!empty($openAgenda)) { + if (!empty($capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_" . $collectiviteMappingType . "_custom_processing"])) { + $customProcessing = $capDataCollectiviteClassInfo["export_class_capdata_properties"]["open_agenda_id"]["property_" . $collectiviteMappingType . "_custom_processing"]; $openAgenda = $this->customFieldProcessing($openAgenda, $customProcessing); } $collectivite->setOpenAgenda("https://openagenda.com/" . $openAgenda); @@ -5172,48 +5375,54 @@ class CapDataConnectorManager { } } } - // Catalog Class properties - if($collectiviteMappingType == "content"){ - $this->setCatalogCapdataProperties($collectivite, - $mappedEntity, + // Catalog Class properties. + if ($collectiviteMappingType == "content") { + $this->setCatalogCapdataProperties($collectivite, + $mappedEntity, $capDataCollectiviteClassInfo["export_class_capdata_properties"], "content" - ); - }elseif($collectiviteMappingType == "taxo"){ - $this->setCatalogCapdataProperties($collectivite, - $mappedEntity, + ); + } + elseif ($collectiviteMappingType == "taxo") { + $this->setCatalogCapdataProperties($collectivite, + $mappedEntity, $capDataCollectiviteClassInfo["export_class_capdata_properties"], "taxo" - ); + ); } } /** * Set Socials Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setSocialsCapdataProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Facebook + // Facebook. $facebook = ""; - if(isset($exportClassCapdataProperties["facebook"])){ - if(!empty($exportClassCapdataProperties["facebook"]["property_".$mappingType."_fields_dropdown"])){ - $facebookFieldName = $exportClassCapdataProperties["facebook"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($facebookFieldName) && !$mappedEntity->get($facebookFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["facebook"])) { + if (!empty($exportClassCapdataProperties["facebook"]["property_" . $mappingType . "_fields_dropdown"])) { + $facebookFieldName = $exportClassCapdataProperties["facebook"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($facebookFieldName) && !$mappedEntity->get($facebookFieldName)->isEmpty()) { $facebookFieldDefinition = $mappedEntity->getFieldDefinition($facebookFieldName); - if($facebookFieldDefinition->getType() == 'link'){ + if ($facebookFieldDefinition->getType() == 'link') { $facebookUri = $mappedEntity->get($facebookFieldName)->uri; - $facebookUrl = Url::fromUri($facebookUri, ['absolute' => TRUE]); + $facebookUrl = Url::fromUri($facebookUri, ['absolute' => TRUE]); $facebook = $facebookUrl->toString(); - }else{ + } + else { $facebook = $mappedEntity->get($facebookFieldName)->value; } - if(!empty($facebook)){ - if(!empty($exportClassCapdataProperties["facebook"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["facebook"]["property_".$mappingType."_custom_processing"]; + if (!empty($facebook)) { + if (!empty($exportClassCapdataProperties["facebook"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["facebook"]["property_" . $mappingType . "_custom_processing"]; $facebook = $this->customFieldProcessing($facebook, $customProcessing); } $facebook = $this->cleanUrl($facebook); @@ -5222,23 +5431,24 @@ class CapDataConnectorManager { } } } - // Twitter + // Twitter. $twitter = ""; - if(isset($exportClassCapdataProperties["twitter"])){ - if(!empty($exportClassCapdataProperties["twitter"]["property_".$mappingType."_fields_dropdown"])){ - $twitterFieldName = $exportClassCapdataProperties["twitter"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($twitterFieldName) && !$mappedEntity->get($twitterFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["twitter"])) { + if (!empty($exportClassCapdataProperties["twitter"]["property_" . $mappingType . "_fields_dropdown"])) { + $twitterFieldName = $exportClassCapdataProperties["twitter"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($twitterFieldName) && !$mappedEntity->get($twitterFieldName)->isEmpty()) { $twitterFieldDefinition = $mappedEntity->getFieldDefinition($twitterFieldName); - if($twitterFieldDefinition->getType() == 'link'){ + if ($twitterFieldDefinition->getType() == 'link') { $twitterUri = $mappedEntity->get($twitterFieldName)->uri; - $twitterUrl = Url::fromUri($twitterUri, ['absolute' => TRUE]); + $twitterUrl = Url::fromUri($twitterUri, ['absolute' => TRUE]); $twitter = $twitterUrl->toString(); - }else{ + } + else { $twitter = $mappedEntity->get($twitterFieldName)->value; } - if(!empty($twitter)){ - if(!empty($exportClassCapdataProperties["twitter"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["twitter"]["property_".$mappingType."_custom_processing"]; + if (!empty($twitter)) { + if (!empty($exportClassCapdataProperties["twitter"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["twitter"]["property_" . $mappingType . "_custom_processing"]; $twitter = $this->customFieldProcessing($twitter, $customProcessing); } $twitter = $this->cleanUrl($twitter); @@ -5247,23 +5457,24 @@ class CapDataConnectorManager { } } } - // Site web + // Site web. $siteWeb = ""; - if(isset($exportClassCapdataProperties["page_web"])){ - if(!empty($exportClassCapdataProperties["page_web"]["property_".$mappingType."_fields_dropdown"])){ - $siteWebFieldName = $exportClassCapdataProperties["page_web"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($siteWebFieldName) && !$mappedEntity->get($siteWebFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["page_web"])) { + if (!empty($exportClassCapdataProperties["page_web"]["property_" . $mappingType . "_fields_dropdown"])) { + $siteWebFieldName = $exportClassCapdataProperties["page_web"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($siteWebFieldName) && !$mappedEntity->get($siteWebFieldName)->isEmpty()) { $siteWebFieldDefinition = $mappedEntity->getFieldDefinition($siteWebFieldName); - if($siteWebFieldDefinition->getType() == 'link'){ + if ($siteWebFieldDefinition->getType() == 'link') { $siteWebUri = $mappedEntity->get($siteWebFieldName)->uri; - $siteWebUrl = Url::fromUri($siteWebUri, ['absolute' => TRUE]); + $siteWebUrl = Url::fromUri($siteWebUri, ['absolute' => TRUE]); $siteWeb = $siteWebUrl->toString(); - }else{ + } + else { $siteWeb = $mappedEntity->get($siteWebFieldName)->value; } - if(!empty($siteWeb)){ - if(!empty($exportClassCapdataProperties["page_web"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["page_web"]["property_".$mappingType."_custom_processing"]; + if (!empty($siteWeb)) { + if (!empty($exportClassCapdataProperties["page_web"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["page_web"]["property_" . $mappingType . "_custom_processing"]; $siteWeb = $this->customFieldProcessing($siteWeb, $customProcessing); } $siteWeb = $this->cleanUrl($siteWeb); @@ -5276,79 +5487,90 @@ class CapDataConnectorManager { /** * Set Image capdata Property. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ - public function setCapdataImageProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Image + public function setCapdataImageProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { + // Image. $refImageUrl = ""; - if(isset($exportClassCapdataProperties["image"])){ - if(!empty($exportClassCapdataProperties["image"]["property_".$mappingType."_fields_dropdown"])){ - $imageTraitFieldName = $exportClassCapdataProperties["image"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($imageTraitFieldName) && !$mappedEntity->get($imageTraitFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["image"])) { + if (!empty($exportClassCapdataProperties["image"]["property_" . $mappingType . "_fields_dropdown"])) { + $imageTraitFieldName = $exportClassCapdataProperties["image"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($imageTraitFieldName) && !$mappedEntity->get($imageTraitFieldName)->isEmpty()) { $imgFieldDefinition = $mappedEntity->getFieldDefinition($imageTraitFieldName); - if($imgFieldDefinition->getType() == 'image'){ - /** @var File $refImage */ + if ($imgFieldDefinition->getType() == 'image') { + /** @var \Drupal\file\Entity\File $refImage */ $refImage = $mappedEntity->get($imageTraitFieldName)->entity; $uriRefImage = $refImage->getFileUri(); $refImageUrl = $this->fileUrlGenerator->generateAbsoluteString($uriRefImage); - }elseif($imgFieldDefinition->getType() == "entity_reference" && $imgFieldDefinition->getSetting('target_type') == 'media'){ + } + elseif ($imgFieldDefinition->getType() == "entity_reference" && $imgFieldDefinition->getSetting('target_type') == 'media') { $handlerSettings = $imgFieldDefinition->getSetting('handler_settings'); $targetBundles = $handlerSettings['target_bundles']; - if(in_array('image', $targetBundles)){ - /** @var Media $refImage */ + if (in_array('image', $targetBundles)) { + /** @var \Drupal\media\Entity\Media $refImage */ $refImage = $mappedEntity->get($imageTraitFieldName)->entity; $uriRefImage = $refImage->get('field_media_image')->entity->getFileUri(); $refImageUrl = $this->fileUrlGenerator->generateAbsoluteString($uriRefImage); } } - if(!empty($refImageUrl)){ + if (!empty($refImageUrl)) { $graphItem->setImage($refImageUrl); } } } } - } + } /** * Get Media Property Info. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType - * + * Mapping type. + * * @return array + * Media info */ - public function getCapdataMediaPropertyInfo($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType){ + public function getCapdataMediaPropertyInfo($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType) { // Image, Sound ... $refImageUrl = ""; - $refSoundUrl = ""; + // $refSoundUrl = ""; $mediaInfo = []; - if(isset($exportClassCapdataProperties["media"])){ - if(!empty($exportClassCapdataProperties["media"]["property_".$mappingType."_fields_dropdown"])){ - $mediaTraitFieldName = $exportClassCapdataProperties["media"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($mediaTraitFieldName) && !$mappedEntity->get($mediaTraitFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["media"])) { + if (!empty($exportClassCapdataProperties["media"]["property_" . $mappingType . "_fields_dropdown"])) { + $mediaTraitFieldName = $exportClassCapdataProperties["media"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($mediaTraitFieldName) && !$mappedEntity->get($mediaTraitFieldName)->isEmpty()) { $mediaFieldDefinition = $mappedEntity->getFieldDefinition($mediaTraitFieldName); - if($mediaFieldDefinition->getType() == 'image'){ - /** @var File $refImage */ + if ($mediaFieldDefinition->getType() == 'image') { + /** @var \Drupal\file\Entity\File $refImage */ $refImage = $mappedEntity->get($mediaTraitFieldName)->entity; $uriRefImage = $refImage->getFileUri(); $refImageUrl = $this->fileUrlGenerator->generateAbsoluteString($uriRefImage); - }elseif($mediaFieldDefinition->getType() == "entity_reference" && $mediaFieldDefinition->getSetting('target_type') == 'media'){ + } + elseif ($mediaFieldDefinition->getType() == "entity_reference" && $mediaFieldDefinition->getSetting('target_type') == 'media') { $handlerSettings = $mediaFieldDefinition->getSetting('handler_settings'); $targetBundles = $handlerSettings['target_bundles']; - if(in_array('image', $targetBundles)){ - /** @var Media $refImage */ + if (in_array('image', $targetBundles)) { + /** @var \Drupal\media\Entity\Media $refImage */ $refImage = $mappedEntity->get($mediaTraitFieldName)->entity; $uriRefImage = $refImage->get('field_media_image')->entity->getFileUri(); $refImageUrl = $this->fileUrlGenerator->generateAbsoluteString($uriRefImage); } } - if(!empty($refImageUrl)){ + if (!empty($refImageUrl)) { $mediaInfo["mediaType"] = "image"; $mediaInfo["mediaUrl"] = $refImageUrl; } @@ -5361,22 +5583,26 @@ class CapDataConnectorManager { /** * Set Identifiant Rof. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setIdentifiantRofProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { $identifiantRof = ""; - if(isset($exportClassCapdataProperties["identifiant_rof"])){ - if(!empty($exportClassCapdataProperties["identifiant_rof"]["property_".$mappingType."_fields_dropdown"])){ - $identifiantRofFieldName = $exportClassCapdataProperties["identifiant_rof"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($identifiantRofFieldName) && !$mappedEntity->get($identifiantRofFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["identifiant_rof"])) { + if (!empty($exportClassCapdataProperties["identifiant_rof"]["property_" . $mappingType . "_fields_dropdown"])) { + $identifiantRofFieldName = $exportClassCapdataProperties["identifiant_rof"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($identifiantRofFieldName) && !$mappedEntity->get($identifiantRofFieldName)->isEmpty()) { $identifiantRof = $mappedEntity->get($identifiantRofFieldName)->value; - if(!empty($identifiantRof)){ - if(!empty($exportClassCapdataProperties["identifiant_rof"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["identifiant_rof"]["property_".$mappingType."_custom_processing"]; + if (!empty($identifiantRof)) { + if (!empty($exportClassCapdataProperties["identifiant_rof"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["identifiant_rof"]["property_" . $mappingType . "_custom_processing"]; $identifiantRof = $this->customFieldProcessing($identifiantRof, $customProcessing); } $graphItem->setIdentifiantRof($identifiantRof); @@ -5388,23 +5614,27 @@ class CapDataConnectorManager { /** * Set OpenAgenda Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setOpenAgendaCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Open agenda + // Open agenda. $openAgenda = ""; - if(isset($exportClassCapdataProperties["open_agenda_id"])){ - if(!empty($exportClassCapdataProperties["open_agenda_id"]["property_".$mappingType."_fields_dropdown"])){ - $openAgendaFieldName = $exportClassCapdataProperties["open_agenda_id"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($openAgendaFieldName) && !$mappedEntity->get($openAgendaFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["open_agenda_id"])) { + if (!empty($exportClassCapdataProperties["open_agenda_id"]["property_" . $mappingType . "_fields_dropdown"])) { + $openAgendaFieldName = $exportClassCapdataProperties["open_agenda_id"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($openAgendaFieldName) && !$mappedEntity->get($openAgendaFieldName)->isEmpty()) { $openAgenda = $mappedEntity->get($openAgendaFieldName)->value; - if(!empty($openAgenda)){ - if(!empty($exportClassCapdataProperties["open_agenda_id"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["open_agenda_id"]["property_".$mappingType."_custom_processing"]; + if (!empty($openAgenda)) { + if (!empty($exportClassCapdataProperties["open_agenda_id"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["open_agenda_id"]["property_" . $mappingType . "_custom_processing"]; $openAgenda = $this->customFieldProcessing($openAgenda, $customProcessing); } $graphItem->setOpenAgenda("https://openagenda.com/" . $openAgenda); @@ -5416,23 +5646,27 @@ class CapDataConnectorManager { /** * Set Description Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setDescriptionCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Description + // Description. $description = ""; - if(isset($exportClassCapdataProperties["description"])){ - if(!empty($exportClassCapdataProperties["description"]["property_".$mappingType."_fields_dropdown"])){ - $descriptionFieldName = $exportClassCapdataProperties["description"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($descriptionFieldName) && !$mappedEntity->get($descriptionFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["description"])) { + if (!empty($exportClassCapdataProperties["description"]["property_" . $mappingType . "_fields_dropdown"])) { + $descriptionFieldName = $exportClassCapdataProperties["description"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($descriptionFieldName) && !$mappedEntity->get($descriptionFieldName)->isEmpty()) { $description = $mappedEntity->get($descriptionFieldName)->value; - if(!empty($description)){ - if(!empty($exportClassCapdataProperties["description"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["description"]["property_".$mappingType."_custom_processing"]; + if (!empty($description)) { + if (!empty($exportClassCapdataProperties["description"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["description"]["property_" . $mappingType . "_custom_processing"]; $description = $this->customFieldProcessing($description, $customProcessing); } $description = str_replace(["\x08", "\x03"], " ", $description); @@ -5445,154 +5679,173 @@ class CapDataConnectorManager { /** * Set ArkBnfTrait Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setArkBnfTraitCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // frBnf + // frBnf. $frBnf = ""; - if(isset($exportClassCapdataProperties["fr_bnf"])){ - if(!empty($exportClassCapdataProperties["fr_bnf"]["property_".$mappingType."_fields_dropdown"])){ - $frBnfFieldName = $exportClassCapdataProperties["fr_bnf"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($frBnfFieldName) && !$mappedEntity->get($frBnfFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["fr_bnf"])) { + if (!empty($exportClassCapdataProperties["fr_bnf"]["property_" . $mappingType . "_fields_dropdown"])) { + $frBnfFieldName = $exportClassCapdataProperties["fr_bnf"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($frBnfFieldName) && !$mappedEntity->get($frBnfFieldName)->isEmpty()) { $frBnf = $mappedEntity->get($frBnfFieldName)->value; - if(!empty($frBnf)){ - if(!empty($exportClassCapdataProperties["fr_bnf"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["fr_bnf"]["property_".$mappingType."_custom_processing"]; + if (!empty($frBnf)) { + if (!empty($exportClassCapdataProperties["fr_bnf"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["fr_bnf"]["property_" . $mappingType . "_custom_processing"]; $frBnf = $this->customFieldProcessing($frBnf, $customProcessing); } $graphItem->setFrBnf($frBnf); } } } - } + } } - /** * Set ArkBnfTrait ArkBnf Capdata Property. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType - * + * Mapping type. + * * @return string + * ArkBnf */ - public function setExternalArkBnfCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType){ - // ArkBnf + public function setExternalArkBnfCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType) { + // ArkBnf. $arkBnf = ""; - if(isset($exportClassCapdataProperties["ark_bnf"])){ - if(!empty($exportClassCapdataProperties["ark_bnf"]["property_".$mappingType."_fields_dropdown"])){ - $arkBnfFieldName = $exportClassCapdataProperties["ark_bnf"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($arkBnfFieldName) && !$mappedEntity->get($arkBnfFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["ark_bnf"])) { + if (!empty($exportClassCapdataProperties["ark_bnf"]["property_" . $mappingType . "_fields_dropdown"])) { + $arkBnfFieldName = $exportClassCapdataProperties["ark_bnf"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($arkBnfFieldName) && !$mappedEntity->get($arkBnfFieldName)->isEmpty()) { $arkBnfFieldDefinition = $mappedEntity->getFieldDefinition($arkBnfFieldName); - if($arkBnfFieldDefinition->getType() == 'link'){ + if ($arkBnfFieldDefinition->getType() == 'link') { $arkBnfUri = $mappedEntity->get($arkBnfFieldName)->uri; - $arkBnfUrl = Url::fromUri($arkBnfUri, ['absolute' => TRUE]); + $arkBnfUrl = Url::fromUri($arkBnfUri, ['absolute' => TRUE]); $arkBnf = $arkBnfUrl->toString(); - }else{ + } + else { $arkBnf = $mappedEntity->get($arkBnfFieldName)->value; } - if(!empty($arkBnf)){ - if(!empty($exportClassCapdataProperties["ark_bnf"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["ark_bnf"]["property_".$mappingType."_custom_processing"]; + if (!empty($arkBnf)) { + if (!empty($exportClassCapdataProperties["ark_bnf"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["ark_bnf"]["property_" . $mappingType . "_custom_processing"]; $arkBnf = $this->customFieldProcessing($arkBnf, $customProcessing); } $arkBnf = $this->cleanUrl($arkBnf); } } } - } - return $arkBnf; - } - + } + return $arkBnf; + } /** * Set ISNI Capdata Property. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType - * + * Mapping type. + * * @return string + * Isni */ - public function setIsniCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType){ - // ISNI + public function setIsniCapdataProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType) { + // ISNI. $isni = ""; - if(isset($exportClassCapdataProperties["isni"])){ - if(!empty($exportClassCapdataProperties["isni"]["property_".$mappingType."_fields_dropdown"])){ - $isniFieldName = $exportClassCapdataProperties["isni"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($isniFieldName) && !$mappedEntity->get($isniFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["isni"])) { + if (!empty($exportClassCapdataProperties["isni"]["property_" . $mappingType . "_fields_dropdown"])) { + $isniFieldName = $exportClassCapdataProperties["isni"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($isniFieldName) && !$mappedEntity->get($isniFieldName)->isEmpty()) { $isniFieldDefinition = $mappedEntity->getFieldDefinition($isniFieldName); - if($isniFieldDefinition->getType() == 'link'){ + if ($isniFieldDefinition->getType() == 'link') { $isniUri = $mappedEntity->get($isniFieldName)->uri; - $isniUrl = Url::fromUri($isniUri, ['absolute' => TRUE]); + $isniUrl = Url::fromUri($isniUri, ['absolute' => TRUE]); $isni = $isniUrl->toString(); - }else{ + } + else { $isni = $mappedEntity->get($isniFieldName)->value; } - if(!empty($isni)){ - if(!empty($exportClassCapdataProperties["isni"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["isni"]["property_".$mappingType."_custom_processing"]; + if (!empty($isni)) { + if (!empty($exportClassCapdataProperties["isni"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["isni"]["property_" . $mappingType . "_custom_processing"]; $isni = $this->customFieldProcessing($isni, $customProcessing); } $isni = $this->cleanUrl($isni); } } } - } - return $isni; - } + } + return $isni; + } /** * Set Custom Referentiel Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ - public function setReferentielCustomProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Label + public function setReferentielCustomProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { + // Label. $label = ""; - if($mappingType == "content"){ + if ($mappingType == "content") { $label = $mappedEntity->getTitle(); - }else{ + } + else { $label = $mappedEntity->label(); } - if(isset($exportClassCapdataProperties["cd_label"])){ - if(!empty($exportClassCapdataProperties["cd_label"]["property_".$mappingType."_fields_dropdown"])){ - $labelFieldName = $exportClassCapdataProperties["cd_label"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($labelFieldName) && !$mappedEntity->get($labelFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["cd_label"])) { + if (!empty($exportClassCapdataProperties["cd_label"]["property_" . $mappingType . "_fields_dropdown"])) { + $labelFieldName = $exportClassCapdataProperties["cd_label"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($labelFieldName) && !$mappedEntity->get($labelFieldName)->isEmpty()) { $label = $mappedEntity->get($labelFieldName)->value; - if(!empty($label)){ - if(!empty($exportClassCapdataProperties["cd_label"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["cd_label"]["property_".$mappingType."_custom_processing"]; + if (!empty($label)) { + if (!empty($exportClassCapdataProperties["cd_label"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["cd_label"]["property_" . $mappingType . "_custom_processing"]; $label = $this->customFieldProcessing($label, $customProcessing); } } } } } - if(!empty($label)){ + if (!empty($label)) { $label = trim($label, " \t\n\r\0\v\xc2\xa0"); $graphItem->setLabel($label); } - // alt Label + // Alt Label. $altLabel = ""; - if(isset($exportClassCapdataProperties["alt_label"])){ - if(!empty($exportClassCapdataProperties["alt_label"]["property_".$mappingType."_fields_dropdown"])){ - $altLabelFieldName = $exportClassCapdataProperties["alt_label"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($altLabelFieldName) && !$mappedEntity->get($altLabelFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["alt_label"])) { + if (!empty($exportClassCapdataProperties["alt_label"]["property_" . $mappingType . "_fields_dropdown"])) { + $altLabelFieldName = $exportClassCapdataProperties["alt_label"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($altLabelFieldName) && !$mappedEntity->get($altLabelFieldName)->isEmpty()) { $altLabel = $mappedEntity->get($altLabelFieldName)->value; - if(!empty($altLabel)){ - if(!empty($exportClassCapdataProperties["alt_label"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["alt_label"]["property_".$mappingType."_custom_processing"]; + if (!empty($altLabel)) { + if (!empty($exportClassCapdataProperties["alt_label"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["alt_label"]["property_" . $mappingType . "_custom_processing"]; $altLabel = $this->customFieldProcessing($altLabel, $customProcessing); } $graphItem->setAltLabel($altLabel); @@ -5600,71 +5853,75 @@ class CapDataConnectorManager { } } } - // Image + // Image. $refImageUrl = ""; - if(isset($exportClassCapdataProperties["image"])){ - if(!empty($exportClassCapdataProperties["image"]["property_".$mappingType."_fields_dropdown"])){ - $imageTraitFieldName = $exportClassCapdataProperties["image"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($imageTraitFieldName) && !$mappedEntity->get($imageTraitFieldName)->isEmpty()) { + if (isset($exportClassCapdataProperties["image"])) { + if (!empty($exportClassCapdataProperties["image"]["property_" . $mappingType . "_fields_dropdown"])) { + $imageTraitFieldName = $exportClassCapdataProperties["image"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($imageTraitFieldName) && !$mappedEntity->get($imageTraitFieldName)->isEmpty()) { $imgFieldDefinition = $mappedEntity->getFieldDefinition($imageTraitFieldName); - if($imgFieldDefinition->getType() == 'image'){ - /** @var File $refImage */ + if ($imgFieldDefinition->getType() == 'image') { + /** @var \Drupal\file\Entity\File $refImage */ $refImage = $mappedEntity->get($imageTraitFieldName)->entity; $uriRefImage = $refImage->getFileUri(); $refImageUrl = $this->fileUrlGenerator->generateAbsoluteString($uriRefImage); - }elseif($imgFieldDefinition->getType() == "entity_reference" && $imgFieldDefinition->getSetting('target_type') == 'media'){ + } + elseif ($imgFieldDefinition->getType() == "entity_reference" && $imgFieldDefinition->getSetting('target_type') == 'media') { $handlerSettings = $imgFieldDefinition->getSetting('handler_settings'); $targetBundles = $handlerSettings['target_bundles']; - if(in_array('image', $targetBundles)){ - /** @var Media $refImage */ + if (in_array('image', $targetBundles)) { + /** @var \Drupal\media\Entity\Media $refImage */ $refImage = $mappedEntity->get($imageTraitFieldName)->entity; $uriRefImage = $refImage->get('field_media_image')->entity->getFileUri(); $refImageUrl = $this->fileUrlGenerator->generateAbsoluteString($uriRefImage); } } - if(!empty($refImageUrl)){ + if (!empty($refImageUrl)) { $graphItem->setImage($refImageUrl); } } } } - // Description - if($mappingType == "content"){ - $this->setDescriptionCapdataProperty($graphItem, - $mappedEntity, + // Description. + if ($mappingType == "content") { + $this->setDescriptionCapdataProperty($graphItem, + $mappedEntity, $exportClassCapdataProperties, "content" - ); - }elseif($mappingType == "taxo"){ - $this->setDescriptionCapdataProperty($graphItem, - $mappedEntity, + ); + } + elseif ($mappingType == "taxo") { + $this->setDescriptionCapdataProperty($graphItem, + $mappedEntity, $exportClassCapdataProperties, "taxo" ); } - // ArkBnf Trait - if($mappingType == "content"){ - $this->setArkBnfTraitCapdataProperty($graphItem, - $mappedEntity, + // ArkBnf Trait. + if ($mappingType == "content") { + $this->setArkBnfTraitCapdataProperty($graphItem, + $mappedEntity, $exportClassCapdataProperties, "content" - ); - }elseif($mappingType == "taxo"){ - $this->setArkBnfTraitCapdataProperty($graphItem, - $mappedEntity, + ); + } + elseif ($mappingType == "taxo") { + $this->setArkBnfTraitCapdataProperty($graphItem, + $mappedEntity, $exportClassCapdataProperties, "taxo" ); } - // Identifiant Rof - if($mappingType == "content"){ - $this->setIdentifiantRofProperty($graphItem, + // Identifiant Rof. + if ($mappingType == "content") { + $this->setIdentifiantRofProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, "content" ); - }elseif($mappingType == "taxo"){ - $this->setIdentifiantRofProperty($graphItem, + } + elseif ($mappingType == "taxo") { + $this->setIdentifiantRofProperty($graphItem, $mappedEntity, $exportClassCapdataProperties, "taxo" @@ -5674,23 +5931,27 @@ class CapDataConnectorManager { /** * Set Personal info Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ - public function setPersonalDetails($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Prenom + public function setPersonalDetails($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { + // Prenom. $prenom = ""; - if(isset($exportClassCapdataProperties["prenom"])){ - if(!empty($exportClassCapdataProperties["prenom"]["property_".$mappingType."_fields_dropdown"])){ - $prenomFieldName = $exportClassCapdataProperties["prenom"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($prenomFieldName) && !$mappedEntity->get($prenomFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["prenom"])) { + if (!empty($exportClassCapdataProperties["prenom"]["property_" . $mappingType . "_fields_dropdown"])) { + $prenomFieldName = $exportClassCapdataProperties["prenom"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($prenomFieldName) && !$mappedEntity->get($prenomFieldName)->isEmpty()) { $prenom = $mappedEntity->get($prenomFieldName)->value; - if(!empty($prenom)){ - if(!empty($exportClassCapdataProperties["prenom"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["prenom"]["property_".$mappingType."_custom_processing"]; + if (!empty($prenom)) { + if (!empty($exportClassCapdataProperties["prenom"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["prenom"]["property_" . $mappingType . "_custom_processing"]; $prenom = $this->customFieldProcessing($prenom, $customProcessing); } $graphItem->setPrenom($prenom); @@ -5699,16 +5960,16 @@ class CapDataConnectorManager { } } - // Nom + // Nom. $nom = ""; - if(isset($exportClassCapdataProperties["nom"])){ - if(!empty($exportClassCapdataProperties["nom"]["property_".$mappingType."_fields_dropdown"])){ - $nomFieldName = $exportClassCapdataProperties["nom"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($nomFieldName) && !$mappedEntity->get($nomFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["nom"])) { + if (!empty($exportClassCapdataProperties["nom"]["property_" . $mappingType . "_fields_dropdown"])) { + $nomFieldName = $exportClassCapdataProperties["nom"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($nomFieldName) && !$mappedEntity->get($nomFieldName)->isEmpty()) { $nom = $mappedEntity->get($nomFieldName)->value; - if(!empty($nom)){ - if(!empty($exportClassCapdataProperties["nom"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["nom"]["property_".$mappingType."_custom_processing"]; + if (!empty($nom)) { + if (!empty($exportClassCapdataProperties["nom"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["nom"]["property_" . $mappingType . "_custom_processing"]; $nom = $this->customFieldProcessing($nom, $customProcessing); } $graphItem->setNom($nom); @@ -5717,34 +5978,34 @@ class CapDataConnectorManager { } } - // Nom forme rejet + // Nom forme rejet. $nomFormeRejet = ""; - if(isset($exportClassCapdataProperties["nom_forme_rejet"])){ - if(!empty($exportClassCapdataProperties["nom_forme_rejet"]["property_".$mappingType."_fields_dropdown"])){ - $nomFormeRejetFieldName = $exportClassCapdataProperties["nom_forme_rejet"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($nomFormeRejetFieldName) && !$mappedEntity->get($nomFormeRejetFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["nom_forme_rejet"])) { + if (!empty($exportClassCapdataProperties["nom_forme_rejet"]["property_" . $mappingType . "_fields_dropdown"])) { + $nomFormeRejetFieldName = $exportClassCapdataProperties["nom_forme_rejet"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($nomFormeRejetFieldName) && !$mappedEntity->get($nomFormeRejetFieldName)->isEmpty()) { $nomFormeRejet = $mappedEntity->get($nomFormeRejetFieldName)->value; - if(!empty($nomFormeRejet)){ - if(!empty($exportClassCapdataProperties["nom_forme_rejet"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["nom_forme_rejet"]["property_".$mappingType."_custom_processing"]; + if (!empty($nomFormeRejet)) { + if (!empty($exportClassCapdataProperties["nom_forme_rejet"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["nom_forme_rejet"]["property_" . $mappingType . "_custom_processing"]; $nomFormeRejet = $this->customFieldProcessing($nomFormeRejet, $customProcessing); } $graphItem->setNomFormeRejet($nomFormeRejet); } } } - } + } - // Biographie + // Biographie. $biographie = ""; - if(isset($exportClassCapdataProperties["biographie"])){ - if(!empty($exportClassCapdataProperties["biographie"]["property_".$mappingType."_fields_dropdown"])){ - $biographieFieldName = $exportClassCapdataProperties["biographie"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($biographieFieldName) && !$mappedEntity->get($biographieFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["biographie"])) { + if (!empty($exportClassCapdataProperties["biographie"]["property_" . $mappingType . "_fields_dropdown"])) { + $biographieFieldName = $exportClassCapdataProperties["biographie"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($biographieFieldName) && !$mappedEntity->get($biographieFieldName)->isEmpty()) { $biographie = $mappedEntity->get($biographieFieldName)->value; - if(!empty($biographie)){ - if(!empty($exportClassCapdataProperties["biographie"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["biographie"]["property_".$mappingType."_custom_processing"]; + if (!empty($biographie)) { + if (!empty($exportClassCapdataProperties["biographie"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["biographie"]["property_" . $mappingType . "_custom_processing"]; $biographie = $this->customFieldProcessing($biographie, $customProcessing); } $graphItem->setBiographie($biographie); @@ -5756,38 +6017,42 @@ class CapDataConnectorManager { /** * Set A Pour Fonction property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataFonctionMappingInfo + * CapData fonction mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourFonctionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo): void { - $fonctionsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourFonctionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo): void { + $fonctionsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_fonction"])){ - if(!empty($exportClassCapdataProperties["a_pour_fonction"]["property_".$mappingType."_fields_dropdown"])){ - $aPourFonctionFieldName = $exportClassCapdataProperties["a_pour_fonction"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_fonction"])) { + if (!empty($exportClassCapdataProperties["a_pour_fonction"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourFonctionFieldName = $exportClassCapdataProperties["a_pour_fonction"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourFonctionFieldName) && !$mappedEntity->get($aPourFonctionFieldName)->isEmpty()) { $fonctionItems = $mappedEntity->get($aPourFonctionFieldName); foreach ($fonctionItems as $referenceFonction) { $fonctionItem = $referenceFonction->entity; - if(!empty($fonctionItem)){ - $referenceFonctionId = $fonctionItem->id(); - if(!empty($capDataFonctionMappingInfo)){ - if(!empty($capDataFonctionMappingInfo["capData_fonction_mappingtype"])){ + if (!empty($fonctionItem)) { + $referenceFonctionId = $fonctionItem->id(); + if (!empty($capDataFonctionMappingInfo)) { + if (!empty($capDataFonctionMappingInfo["capData_fonction_mappingtype"])) { $fonctionMappingType = $capDataFonctionMappingInfo["capData_fonction_mappingtype"]; $referenceFonctionUrl = ""; - if($fonctionMappingType == "taxo" && $fonctionItem instanceof \Drupal\taxonomy\TermInterface){ + if ($fonctionMappingType == "taxo" && $fonctionItem instanceof TermInterface) { $referenceFonctionUrl = $host . "/taxonomy/term/" . $referenceFonctionId; - }elseif($fonctionMappingType == "content" && $fonctionItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($fonctionMappingType == "content" && $fonctionItem instanceof NodeInterface) { $referenceFonctionUrl = $host . "/node/" . $referenceFonctionId; } - if(!empty($referenceFonctionUrl)){ + if (!empty($referenceFonctionUrl)) { $fonctionsArray[] = new ExternalThing($referenceFonctionUrl); } } @@ -5806,63 +6071,70 @@ class CapDataConnectorManager { /** * Set A Pour Participant property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataPersonneMappingInfo + * CapData personne mapping info. * @param array $capDataCollectiviteMappingInfo + * CapData collectivite mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourParticipantCapdataProperty($graphItem, $capDataPersonneMappingInfo, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo): void { - $participantsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourParticipantCapdataProperty($graphItem, $capDataPersonneMappingInfo, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo): void { + $participantsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_participant"])){ - if(!empty($exportClassCapdataProperties["a_pour_participant"]["property_".$mappingType."_fields_dropdown"])){ - $aPourParticipantFieldName = $exportClassCapdataProperties["a_pour_participant"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_participant"])) { + if (!empty($exportClassCapdataProperties["a_pour_participant"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourParticipantFieldName = $exportClassCapdataProperties["a_pour_participant"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourParticipantFieldName) && !$mappedEntity->get($aPourParticipantFieldName)->isEmpty()) { $participantItems = $mappedEntity->get($aPourParticipantFieldName); foreach ($participantItems as $referenceParticipant) { $participantItem = $referenceParticipant->entity; - if(!empty($participantItem)){ - $referenceParticipantId = $participantItem->id(); + if (!empty($participantItem)) { + $referenceParticipantId = $participantItem->id(); // Le participant est une personne ou une collectivite? - if(!empty($capDataPersonneMappingInfo) && !empty($capDataCollectiviteMappingInfo)){ - if(!empty($capDataPersonneMappingInfo["capData_personne_correspondance"]) + if (!empty($capDataPersonneMappingInfo) && !empty($capDataCollectiviteMappingInfo)) { + if (!empty($capDataPersonneMappingInfo["capData_personne_correspondance"]) && $participantItem->bundle() == $capDataPersonneMappingInfo["capData_personne_correspondance"] - ){ - // Le participant est une personne - if(!empty($capDataPersonneMappingInfo["capData_personne_mappingtype"])){ + ) { + // Le participant est une personne. + if (!empty($capDataPersonneMappingInfo["capData_personne_mappingtype"])) { $personneMappingType = $capDataPersonneMappingInfo["capData_personne_mappingtype"]; $referenceParticipantUrl = ""; - if($personneMappingType == "taxo" && $participantItem instanceof \Drupal\taxonomy\TermInterface){ + if ($personneMappingType == "taxo" && $participantItem instanceof TermInterface) { $referenceParticipantUrl = $host . "/taxonomy/term/" . $referenceParticipantId; - }elseif($personneMappingType == "content" && $participantItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($personneMappingType == "content" && $participantItem instanceof NodeInterface) { $referenceParticipantUrl = $host . "/node/" . $referenceParticipantId; } - if(!empty($referenceParticipantUrl)){ + if (!empty($referenceParticipantUrl)) { $participantsArray[] = new ExternalThing($referenceParticipantUrl); } } - }elseif(!empty($capDataCollectiviteMappingInfo["capData_collectivite_correspondance"]) - && $participantItem->bundle() == $capDataCollectiviteMappingInfo["capData_collectivite_correspondance"] - ){ - // Le participant est une collectivite - if(!empty($capDataCollectiviteMappingInfo["capData_collectivite_mappingtype"])){ + } + elseif (!empty($capDataCollectiviteMappingInfo["capData_collectivite_correspondance"]) + && $participantItem->bundle() == $capDataCollectiviteMappingInfo["capData_collectivite_correspondance"] + ) { + // Le participant est une collectivite. + if (!empty($capDataCollectiviteMappingInfo["capData_collectivite_mappingtype"])) { $collectiviteMappingType = $capDataCollectiviteMappingInfo["capData_collectivite_mappingtype"]; $referenceParticipantUrl = ""; - if($collectiviteMappingType == "taxo" && $participantItem instanceof \Drupal\taxonomy\TermInterface){ + if ($collectiviteMappingType == "taxo" && $participantItem instanceof TermInterface) { $referenceParticipantUrl = $host . "/taxonomy/term/" . $referenceParticipantId; - }elseif($collectiviteMappingType == "content" && $participantItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($collectiviteMappingType == "content" && $participantItem instanceof NodeInterface) { $referenceParticipantUrl = $host . "/node/" . $referenceParticipantId; } - if(!empty($referenceParticipantUrl)){ + if (!empty($referenceParticipantUrl)) { $participantsArray[] = new ExternalThing($referenceParticipantUrl); - } - } + } + } } } } @@ -5875,42 +6147,46 @@ class CapDataConnectorManager { if (!empty($participantsArray)) { $graphItem->setAPourParticipant($participantsArray); } - } + } /** * Set A Pour Profession property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataFonctionMappingInfo + * CapData fonction mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourProfessionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo): void { - $professionsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourProfessionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo): void { + $professionsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_profession"])){ - if(!empty($exportClassCapdataProperties["a_pour_profession"]["property_".$mappingType."_fields_dropdown"])){ - $aPourProfessionFieldName = $exportClassCapdataProperties["a_pour_profession"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_profession"])) { + if (!empty($exportClassCapdataProperties["a_pour_profession"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourProfessionFieldName = $exportClassCapdataProperties["a_pour_profession"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourProfessionFieldName) && !$mappedEntity->get($aPourProfessionFieldName)->isEmpty()) { $professionItems = $mappedEntity->get($aPourProfessionFieldName); foreach ($professionItems as $referenceProfession) { $professionItem = $referenceProfession->entity; - if(!empty($professionItem)){ - $referenceProfessionId = $professionItem->id(); - if(!empty($capDataFonctionMappingInfo)){ - if(!empty($capDataFonctionMappingInfo["capData_fonction_mappingtype"])){ + if (!empty($professionItem)) { + $referenceProfessionId = $professionItem->id(); + if (!empty($capDataFonctionMappingInfo)) { + if (!empty($capDataFonctionMappingInfo["capData_fonction_mappingtype"])) { $fonctionMappingType = $capDataFonctionMappingInfo["capData_fonction_mappingtype"]; $referenceProfessionUrl = ""; - if($fonctionMappingType == "taxo" && $professionItem instanceof \Drupal\taxonomy\TermInterface){ + if ($fonctionMappingType == "taxo" && $professionItem instanceof TermInterface) { $referenceProfessionUrl = $host . "/taxonomy/term/" . $referenceProfessionId; - }elseif($fonctionMappingType == "content" && $professionItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($fonctionMappingType == "content" && $professionItem instanceof NodeInterface) { $referenceProfessionUrl = $host . "/node/" . $referenceProfessionId; } - if(!empty($referenceProfessionUrl)){ + if (!empty($referenceProfessionUrl)) { $professionsArray[] = new ExternalThing($referenceProfessionUrl); } } @@ -5929,97 +6205,111 @@ class CapDataConnectorManager { /** * Set Capdata Title property. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setCapdataTitle($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { $title = ""; - if($mappingType == "content"){ + if ($mappingType == "content") { $title = $mappedEntity->getTitle(); - }else{ + } + else { $title = $mappedEntity->label(); } - if(isset($exportClassCapdataProperties["titre"])){ - if(!empty($exportClassCapdataProperties["titre"]["property_".$mappingType."_fields_dropdown"])){ - $titleFieldName = $exportClassCapdataProperties["titre"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($titleFieldName) && !$mappedEntity->get($titleFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["titre"])) { + if (!empty($exportClassCapdataProperties["titre"]["property_" . $mappingType . "_fields_dropdown"])) { + $titleFieldName = $exportClassCapdataProperties["titre"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($titleFieldName) && !$mappedEntity->get($titleFieldName)->isEmpty()) { $title = $mappedEntity->get($titleFieldName)->value; - if(!empty($title)){ - if(!empty($exportClassCapdataProperties["titre"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["titre"]["property_".$mappingType."_custom_processing"]; + if (!empty($title)) { + if (!empty($exportClassCapdataProperties["titre"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["titre"]["property_" . $mappingType . "_custom_processing"]; $title = $this->customFieldProcessing($title, $customProcessing); } } } } } - if(!empty($title)){ + if (!empty($title)) { $graphItem->setTitre($title); } } /** * Set A Pour Auteur property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataAuteurMappingInfo + * CapData auteur mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourAuteurCapdataProperty($graphItem, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $auteursArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourAuteurCapdataProperty($graphItem, $capDataAuteurMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $auteursArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_auteur"])){ - if(!empty($exportClassCapdataProperties["a_pour_auteur"]["property_".$mappingType."_fields_dropdown"])){ - $aPourAuteurFieldName = $exportClassCapdataProperties["a_pour_auteur"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_auteur"])) { + if (!empty($exportClassCapdataProperties["a_pour_auteur"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourAuteurFieldName = $exportClassCapdataProperties["a_pour_auteur"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourAuteurFieldName) && !$mappedEntity->get($aPourAuteurFieldName)->isEmpty()) { $auteurItems = $mappedEntity->get($aPourAuteurFieldName); foreach ($auteurItems as $referenceAuteur) { $auteurItem = $referenceAuteur->entity; - if(!empty($auteurItem)){ - $referenceAuteurId = $auteurItem->id(); - // L'auteur est de la classe Auteur ou de la classe Participation? - if(!empty($capDataAuteurMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataAuteurMappingInfo["capData_auteur_correspondance"]) + if (!empty($auteurItem)) { + $referenceAuteurId = $auteurItem->id(); + // L'auteur est de la classe Auteur + // ou de la classe Participation? + if (!empty($capDataAuteurMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataAuteurMappingInfo["capData_auteur_correspondance"]) && $auteurItem->bundle() == $capDataAuteurMappingInfo["capData_auteur_correspondance"] - ){ - // L'auteur est de la classe Auteur qui herite ses proprietes de la classe Participation - if(!empty($capDataAuteurMappingInfo["capData_auteur_mappingtype"])){ + ) { + // L'auteur est de la classe Auteur + // qui herite ses proprietes de la classe Participation. + if (!empty($capDataAuteurMappingInfo["capData_auteur_mappingtype"])) { $auteurMappingType = $capDataAuteurMappingInfo["capData_auteur_mappingtype"]; $referenceAuteurUrl = ""; - if($auteurMappingType == "taxo" && $auteurItem instanceof \Drupal\taxonomy\TermInterface){ + if ($auteurMappingType == "taxo" && $auteurItem instanceof TermInterface) { $referenceAuteurUrl = $host . "/taxonomy/term/" . $referenceAuteurId; - }elseif($auteurMappingType == "content" && $auteurItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($auteurMappingType == "content" && $auteurItem instanceof NodeInterface) { $referenceAuteurUrl = $host . "/node/" . $referenceAuteurId; } - if(!empty($referenceAuteurUrl)){ + if (!empty($referenceAuteurUrl)) { $auteursArray[] = new ExternalThing($referenceAuteurUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $auteurItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - // L'auteur est de la classe Participation - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $auteurItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + // L'auteur est de la classe Participation. + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceAuteurUrl = ""; - if($participationMappingType == "taxo" && $auteurItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $auteurItem instanceof TermInterface) { $referenceAuteurUrl = $host . "/taxonomy/term/" . $referenceAuteurId; - }elseif($participationMappingType == "content" && $auteurItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $auteurItem instanceof NodeInterface) { $referenceAuteurUrl = $host . "/node/" . $referenceAuteurId; } - if(!empty($referenceAuteurUrl)){ + if (!empty($referenceAuteurUrl)) { $auteursArray[] = new ExternalThing($referenceAuteurUrl); - } - } + } + } } } } @@ -6033,66 +6323,76 @@ class CapDataConnectorManager { $graphItem->setAPourAuteur($auteursArray); } } - + /** * Set A Pour Mention Production property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataMentionProductionMappingInfo + * CapData mention production mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourMentionProductionCapdataProperty($graphItem, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $mentionsProductionArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourMentionProductionCapdataProperty($graphItem, $capDataMentionProductionMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $mentionsProductionArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_mention_production"])){ - if(!empty($exportClassCapdataProperties["a_pour_mention_production"]["property_".$mappingType."_fields_dropdown"])){ - $aPourMentionProductionFieldName = $exportClassCapdataProperties["a_pour_mention_production"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_mention_production"])) { + if (!empty($exportClassCapdataProperties["a_pour_mention_production"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourMentionProductionFieldName = $exportClassCapdataProperties["a_pour_mention_production"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourMentionProductionFieldName) && !$mappedEntity->get($aPourMentionProductionFieldName)->isEmpty()) { $mentionProductionItems = $mappedEntity->get($aPourMentionProductionFieldName); foreach ($mentionProductionItems as $referenceMentionProduction) { $mentionProductionItem = $referenceMentionProduction->entity; - if(!empty($mentionProductionItem)){ - $referenceMentionProductionId = $mentionProductionItem->id(); - // La mention production est de la classe MentionProduction ou de la classe Participation? - if(!empty($capDataMentionProductionMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataMentionProductionMappingInfo["capData_mentionproduction_correspondance"]) + if (!empty($mentionProductionItem)) { + $referenceMentionProductionId = $mentionProductionItem->id(); + // La mention production est de la classe MentionProduction + // ou de la classe Participation? + if (!empty($capDataMentionProductionMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataMentionProductionMappingInfo["capData_mentionproduction_correspondance"]) && $mentionProductionItem->bundle() == $capDataMentionProductionMappingInfo["capData_mentionproduction_correspondance"] - ){ - // La mention production est de la classe MentionProduction qui herite ses proprietes de la classe Participation - if(!empty($capDataMentionProductionMappingInfo["capData_mentionproduction_mappingtype"])){ + ) { + // La mention production + // est de la classe MentionProduction + // qui herite ses proprietes de la classe Participation. + if (!empty($capDataMentionProductionMappingInfo["capData_mentionproduction_mappingtype"])) { $mentionProductionMappingType = $capDataMentionProductionMappingInfo["capData_mentionproduction_mappingtype"]; $referenceMentionProductionUrl = ""; - if($mentionProductionMappingType == "taxo" && $mentionProductionItem instanceof \Drupal\taxonomy\TermInterface){ + if ($mentionProductionMappingType == "taxo" && $mentionProductionItem instanceof TermInterface) { $referenceMentionProductionUrl = $host . "/taxonomy/term/" . $referenceMentionProductionId; - }elseif($mentionProductionMappingType == "content" && $mentionProductionItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($mentionProductionMappingType == "content" && $mentionProductionItem instanceof NodeInterface) { $referenceMentionProductionUrl = $host . "/node/" . $referenceMentionProductionId; } - if(!empty($referenceMentionProductionUrl)){ + if (!empty($referenceMentionProductionUrl)) { $mentionsProductionArray[] = new ExternalThing($referenceMentionProductionUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $mentionProductionItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - // La mention production est de la classe Participation - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $mentionProductionItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + // La mention production est de la classe Participation. + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceMentionProductionUrl = ""; - if($participationMappingType == "taxo" && $mentionProductionItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $mentionProductionItem instanceof TermInterface) { $referenceMentionProductionUrl = $host . "/taxonomy/term/" . $referenceMentionProductionId; - }elseif($participationMappingType == "content" && $mentionProductionItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $mentionProductionItem instanceof NodeInterface) { $referenceMentionProductionUrl = $host . "/node/" . $referenceMentionProductionId; } - if(!empty($referenceMentionProductionUrl)){ + if (!empty($referenceMentionProductionUrl)) { $mentionsProductionArray[] = new ExternalThing($referenceMentionProductionUrl); - } - } + } + } } } } @@ -6105,64 +6405,71 @@ class CapDataConnectorManager { if (!empty($mentionsProductionArray)) { $graphItem->setAPourMentionProduction($mentionsProductionArray); } - } + } /** * Set A Pour Partenariat property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataPartenariatMappingInfo + * CapData partenariat mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourPartenariatCapdataProperty($graphItem, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $partenariatsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourPartenariatCapdataProperty($graphItem, $capDataPartenariatMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $partenariatsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_partenariat"])){ - if(!empty($exportClassCapdataProperties["a_pour_partenariat"]["property_".$mappingType."_fields_dropdown"])){ - $aPourPartenariatFieldName = $exportClassCapdataProperties["a_pour_partenariat"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_partenariat"])) { + if (!empty($exportClassCapdataProperties["a_pour_partenariat"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourPartenariatFieldName = $exportClassCapdataProperties["a_pour_partenariat"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourPartenariatFieldName) && !$mappedEntity->get($aPourPartenariatFieldName)->isEmpty()) { $partenariatItems = $mappedEntity->get($aPourPartenariatFieldName); foreach ($partenariatItems as $referencePartenariat) { $partenariatItem = $referencePartenariat->entity; - if(!empty($partenariatItem)){ - $referencePartenariatId = $partenariatItem->id(); - if(!empty($capDataPartenariatMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataPartenariatMappingInfo["capData_partenariat_correspondance"]) + if (!empty($partenariatItem)) { + $referencePartenariatId = $partenariatItem->id(); + if (!empty($capDataPartenariatMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataPartenariatMappingInfo["capData_partenariat_correspondance"]) && $partenariatItem->bundle() == $capDataPartenariatMappingInfo["capData_partenariat_correspondance"] - ){ - if(!empty($capDataPartenariatMappingInfo["capData_partenariat_mappingtype"])){ + ) { + if (!empty($capDataPartenariatMappingInfo["capData_partenariat_mappingtype"])) { $partenariatMappingType = $capDataPartenariatMappingInfo["capData_partenariat_mappingtype"]; $referencePartenariatUrl = ""; - if($partenariatMappingType == "taxo" && $partenariatItem instanceof \Drupal\taxonomy\TermInterface){ + if ($partenariatMappingType == "taxo" && $partenariatItem instanceof TermInterface) { $referencePartenariatUrl = $host . "/taxonomy/term/" . $referencePartenariatId; - }elseif($partenariatMappingType == "content" && $partenariatItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($partenariatMappingType == "content" && $partenariatItem instanceof NodeInterface) { $referencePartenariatUrl = $host . "/node/" . $referencePartenariatId; } - if(!empty($referencePartenariatUrl)){ + if (!empty($referencePartenariatUrl)) { $partenariatsArray[] = new ExternalThing($referencePartenariatUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $partenariatItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $partenariatItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referencePartenariatUrl = ""; - if($participationMappingType == "taxo" && $partenariatItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $partenariatItem instanceof TermInterface) { $referencePartenariatUrl = $host . "/taxonomy/term/" . $referencePartenariatId; - }elseif($participationMappingType == "content" && $partenariatItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $partenariatItem instanceof NodeInterface) { $referencePartenariatUrl = $host . "/node/" . $referencePartenariatId; } - if(!empty($referencePartenariatUrl)){ + if (!empty($referencePartenariatUrl)) { $partenariatsArray[] = new ExternalThing($referencePartenariatUrl); - } - } + } + } } } } @@ -6179,60 +6486,67 @@ class CapDataConnectorManager { /** * Set A Pour Collaboration property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataCollaborationMappingInfo + * CapData collaboration mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourCollaborationCapdataProperty($graphItem, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $collaborationsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourCollaborationCapdataProperty($graphItem, $capDataCollaborationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $collaborationsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_collaboration"])){ - if(!empty($exportClassCapdataProperties["a_pour_collaboration"]["property_".$mappingType."_fields_dropdown"])){ - $aPourCollaborationFieldName = $exportClassCapdataProperties["a_pour_collaboration"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_collaboration"])) { + if (!empty($exportClassCapdataProperties["a_pour_collaboration"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourCollaborationFieldName = $exportClassCapdataProperties["a_pour_collaboration"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourCollaborationFieldName) && !$mappedEntity->get($aPourCollaborationFieldName)->isEmpty()) { $collaborationItems = $mappedEntity->get($aPourCollaborationFieldName); foreach ($collaborationItems as $referenceCollaboration) { $collaborationItem = $referenceCollaboration->entity; - if(!empty($collaborationItem)){ - $referenceCollaborationId = $collaborationItem->id(); - if(!empty($capDataCollaborationMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataCollaborationMappingInfo["capData_collaboration_correspondance"]) + if (!empty($collaborationItem)) { + $referenceCollaborationId = $collaborationItem->id(); + if (!empty($capDataCollaborationMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataCollaborationMappingInfo["capData_collaboration_correspondance"]) && $collaborationItem->bundle() == $capDataCollaborationMappingInfo["capData_collaboration_correspondance"] - ){ - if(!empty($capDataCollaborationMappingInfo["capData_collaboration_mappingtype"])){ + ) { + if (!empty($capDataCollaborationMappingInfo["capData_collaboration_mappingtype"])) { $collaborationMappingType = $capDataCollaborationMappingInfo["capData_collaboration_mappingtype"]; $referenceCollaborationUrl = ""; - if($collaborationMappingType == "taxo" && $collaborationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($collaborationMappingType == "taxo" && $collaborationItem instanceof TermInterface) { $referenceCollaborationUrl = $host . "/taxonomy/term/" . $referenceCollaborationId; - }elseif($collaborationMappingType == "content" && $collaborationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($collaborationMappingType == "content" && $collaborationItem instanceof NodeInterface) { $referenceCollaborationUrl = $host . "/node/" . $referenceCollaborationId; } - if(!empty($referenceCollaborationUrl)){ + if (!empty($referenceCollaborationUrl)) { $collaborationsArray[] = new ExternalThing($referenceCollaborationUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $collaborationItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $collaborationItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceCollaborationUrl = ""; - if($participationMappingType == "taxo" && $collaborationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $collaborationItem instanceof TermInterface) { $referenceCollaborationUrl = $host . "/taxonomy/term/" . $referenceCollaborationId; - }elseif($participationMappingType == "content" && $collaborationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $collaborationItem instanceof NodeInterface) { $referenceCollaborationUrl = $host . "/node/" . $referenceCollaborationId; } - if(!empty($referenceCollaborationUrl)){ + if (!empty($referenceCollaborationUrl)) { $collaborationsArray[] = new ExternalThing($referenceCollaborationUrl); - } - } + } + } } } } @@ -6245,64 +6559,71 @@ class CapDataConnectorManager { if (!empty($collaborationsArray)) { $graphItem->setAPourCollaboration($collaborationsArray); } - } + } /** * Set A Pour Interpretation property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataInterpretationMappingInfo + * CapData interpretation mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current capdata class mapping info. */ - public function setAPourInterpretationCapdataProperty($graphItem, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $interpretationsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourInterpretationCapdataProperty($graphItem, $capDataInterpretationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $interpretationsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_interpretation"])){ - if(!empty($exportClassCapdataProperties["a_pour_interpretation"]["property_".$mappingType."_fields_dropdown"])){ - $aPourInterpretationFieldName = $exportClassCapdataProperties["a_pour_interpretation"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_interpretation"])) { + if (!empty($exportClassCapdataProperties["a_pour_interpretation"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourInterpretationFieldName = $exportClassCapdataProperties["a_pour_interpretation"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourInterpretationFieldName) && !$mappedEntity->get($aPourInterpretationFieldName)->isEmpty()) { $interpretationItems = $mappedEntity->get($aPourInterpretationFieldName); foreach ($interpretationItems as $referenceIntepretation) { $interpretationItem = $referenceIntepretation->entity; - if(!empty($interpretationItem)){ - $referenceInterpretationId = $interpretationItem->id(); - if(!empty($capDataInterpretationMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataInterpretationMappingInfo["capData_interpretation_correspondance"]) + if (!empty($interpretationItem)) { + $referenceInterpretationId = $interpretationItem->id(); + if (!empty($capDataInterpretationMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataInterpretationMappingInfo["capData_interpretation_correspondance"]) && $interpretationItem->bundle() == $capDataInterpretationMappingInfo["capData_interpretation_correspondance"] - ){ - if(!empty($capDataInterpretationMappingInfo["capData_interpretation_mappingtype"])){ + ) { + if (!empty($capDataInterpretationMappingInfo["capData_interpretation_mappingtype"])) { $interpretationMappingType = $capDataInterpretationMappingInfo["capData_interpretation_mappingtype"]; $referenceInterpretationUrl = ""; - if($interpretationMappingType == "taxo" && $interpretationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($interpretationMappingType == "taxo" && $interpretationItem instanceof TermInterface) { $referenceInterpretationUrl = $host . "/taxonomy/term/" . $referenceInterpretationId; - }elseif($interpretationMappingType == "content" && $interpretationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($interpretationMappingType == "content" && $interpretationItem instanceof NodeInterface) { $referenceInterpretationUrl = $host . "/node/" . $referenceInterpretationId; } - if(!empty($referenceInterpretationUrl)){ + if (!empty($referenceInterpretationUrl)) { $interpretationsArray[] = new ExternalThing($referenceInterpretationUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $interpretationItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $interpretationItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceInterpretationUrl = ""; - if($participationMappingType == "taxo" && $interpretationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $interpretationItem instanceof TermInterface) { $referenceInterpretationUrl = $host . "/taxonomy/term/" . $referenceInterpretationId; - }elseif($participationMappingType == "content" && $interpretationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $interpretationItem instanceof NodeInterface) { $referenceInterpretationUrl = $host . "/node/" . $referenceInterpretationId; } - if(!empty($referenceInterpretationUrl)){ + if (!empty($referenceInterpretationUrl)) { $interpretationsArray[] = new ExternalThing($referenceInterpretationUrl); - } - } + } + } } } } @@ -6319,60 +6640,67 @@ class CapDataConnectorManager { /** * Set A Pour Maitrise Oeuvre property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataMaitriseOeuvreMappingInfo + * CapData maitrise oeuvre mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourMaitriseOeuvreCapdataProperty($graphItem, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $maitriseOeuvresArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourMaitriseOeuvreCapdataProperty($graphItem, $capDataMaitriseOeuvreMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $maitriseOeuvresArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_maitrise_oeuvre"])){ - if(!empty($exportClassCapdataProperties["a_pour_maitrise_oeuvre"]["property_".$mappingType."_fields_dropdown"])){ - $aPourMaitriseOeuvreFieldName = $exportClassCapdataProperties["a_pour_maitrise_oeuvre"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_maitrise_oeuvre"])) { + if (!empty($exportClassCapdataProperties["a_pour_maitrise_oeuvre"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourMaitriseOeuvreFieldName = $exportClassCapdataProperties["a_pour_maitrise_oeuvre"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourMaitriseOeuvreFieldName) && !$mappedEntity->get($aPourMaitriseOeuvreFieldName)->isEmpty()) { $maitriseOeuvreItems = $mappedEntity->get($aPourMaitriseOeuvreFieldName); foreach ($maitriseOeuvreItems as $referenceMaitriseOeuvre) { $maitriseOeuvreItem = $referenceMaitriseOeuvre->entity; - if(!empty($maitriseOeuvreItem)){ - $referenceMaitriseOeuvreId = $maitriseOeuvreItem->id(); - if(!empty($capDataMaitriseOeuvreMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataMaitriseOeuvreMappingInfo["capData_maitriseoeuvre_correspondance"]) + if (!empty($maitriseOeuvreItem)) { + $referenceMaitriseOeuvreId = $maitriseOeuvreItem->id(); + if (!empty($capDataMaitriseOeuvreMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataMaitriseOeuvreMappingInfo["capData_maitriseoeuvre_correspondance"]) && $maitriseOeuvreItem->bundle() == $capDataMaitriseOeuvreMappingInfo["capData_maitriseoeuvre_correspondance"] - ){ - if(!empty($capDataMaitriseOeuvreMappingInfo["capData_maitriseoeuvre_mappingtype"])){ + ) { + if (!empty($capDataMaitriseOeuvreMappingInfo["capData_maitriseoeuvre_mappingtype"])) { $maitriseOeuvreMappingType = $capDataMaitriseOeuvreMappingInfo["capData_maitriseoeuvre_mappingtype"]; $referenceMaitriseOeuvreUrl = ""; - if($maitriseOeuvreMappingType == "taxo" && $maitriseOeuvreItem instanceof \Drupal\taxonomy\TermInterface){ + if ($maitriseOeuvreMappingType == "taxo" && $maitriseOeuvreItem instanceof TermInterface) { $referenceMaitriseOeuvreUrl = $host . "/taxonomy/term/" . $referenceMaitriseOeuvreId; - }elseif($maitriseOeuvreMappingType == "content" && $maitriseOeuvreItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($maitriseOeuvreMappingType == "content" && $maitriseOeuvreItem instanceof NodeInterface) { $referenceMaitriseOeuvreUrl = $host . "/node/" . $referenceMaitriseOeuvreId; } - if(!empty($referenceMaitriseOeuvreUrl)){ + if (!empty($referenceMaitriseOeuvreUrl)) { $maitriseOeuvresArray[] = new ExternalThing($referenceMaitriseOeuvreUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $maitriseOeuvreItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $maitriseOeuvreItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceMaitriseOeuvreUrl = ""; - if($participationMappingType == "taxo" && $maitriseOeuvreItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $maitriseOeuvreItem instanceof TermInterface) { $referenceMaitriseOeuvreUrl = $host . "/taxonomy/term/" . $referenceMaitriseOeuvreId; - }elseif($participationMappingType == "content" && $maitriseOeuvreItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $maitriseOeuvreItem instanceof NodeInterface) { $referenceMaitriseOeuvreUrl = $host . "/node/" . $referenceMaitriseOeuvreId; } - if(!empty($referenceMaitriseOeuvreUrl)){ + if (!empty($referenceMaitriseOeuvreUrl)) { $maitriseOeuvresArray[] = new ExternalThing($referenceMaitriseOeuvreUrl); - } - } + } + } } } } @@ -6386,63 +6714,70 @@ class CapDataConnectorManager { $graphItem->setAPourMaitriseOeuvre($maitriseOeuvresArray); } } - + /** * Set A Pour Programmation property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataProgrammationMappingInfo + * CapData programmation mapping info. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourProgrammationCapdataProperty($graphItem, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $programmationsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourProgrammationCapdataProperty($graphItem, $capDataProgrammationMappingInfo, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $programmationsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_programmation"])){ - if(!empty($exportClassCapdataProperties["a_pour_programmation"]["property_".$mappingType."_fields_dropdown"])){ - $aPourProgrammationFieldName = $exportClassCapdataProperties["a_pour_programmation"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_programmation"])) { + if (!empty($exportClassCapdataProperties["a_pour_programmation"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourProgrammationFieldName = $exportClassCapdataProperties["a_pour_programmation"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourProgrammationFieldName) && !$mappedEntity->get($aPourProgrammationFieldName)->isEmpty()) { $programmationItems = $mappedEntity->get($aPourProgrammationFieldName); foreach ($programmationItems as $referenceProgrammation) { $programmationItem = $referenceProgrammation->entity; - if(!empty($programmationItem)){ - $referenceProgrammationId = $programmationItem->id(); - if(!empty($capDataProgrammationMappingInfo) && !empty($capDataParticipationMappingInfo)){ - if(!empty($capDataProgrammationMappingInfo["capData_programmation_correspondance"]) + if (!empty($programmationItem)) { + $referenceProgrammationId = $programmationItem->id(); + if (!empty($capDataProgrammationMappingInfo) && !empty($capDataParticipationMappingInfo)) { + if (!empty($capDataProgrammationMappingInfo["capData_programmation_correspondance"]) && $programmationItem->bundle() == $capDataProgrammationMappingInfo["capData_programmation_correspondance"] - ){ - if(!empty($capDataProgrammationMappingInfo["capData_programmation_mappingtype"])){ + ) { + if (!empty($capDataProgrammationMappingInfo["capData_programmation_mappingtype"])) { $programmationMappingType = $capDataProgrammationMappingInfo["capData_programmation_mappingtype"]; $referenceProgrammationUrl = ""; - if($programmationMappingType == "taxo" && $programmationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($programmationMappingType == "taxo" && $programmationItem instanceof TermInterface) { $referenceProgrammationUrl = $host . "/taxonomy/term/" . $referenceProgrammationId; - }elseif($programmationMappingType == "content" && $programmationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($programmationMappingType == "content" && $programmationItem instanceof NodeInterface) { $referenceProgrammationUrl = $host . "/node/" . $referenceProgrammationId; } - if(!empty($referenceProgrammationUrl)){ + if (!empty($referenceProgrammationUrl)) { $programmationsArray[] = new ExternalThing($referenceProgrammationUrl); } } - }elseif(!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) - && $programmationItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] - ){ - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + } + elseif (!empty($capDataParticipationMappingInfo["capData_participation_correspondance"]) + && $programmationItem->bundle() == $capDataParticipationMappingInfo["capData_participation_correspondance"] + ) { + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceProgrammationUrl = ""; - if($participationMappingType == "taxo" && $programmationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $programmationItem instanceof TermInterface) { $referenceProgrammationUrl = $host . "/taxonomy/term/" . $referenceProgrammationId; - }elseif($participationMappingType == "content" && $programmationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $programmationItem instanceof NodeInterface) { $referenceProgrammationUrl = $host . "/node/" . $referenceProgrammationId; } - if(!empty($referenceProgrammationUrl)){ + if (!empty($referenceProgrammationUrl)) { $programmationsArray[] = new ExternalThing($referenceProgrammationUrl); - } - } + } + } } } } @@ -6459,38 +6794,42 @@ class CapDataConnectorManager { /** * Set A Pour Participation property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataParticipationMappingInfo + * CapData participation mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourParticipationCapdataProperty($graphItem, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { - $participationsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourParticipationCapdataProperty($graphItem, $capDataParticipationMappingInfo, $currentCapdataClassMappingInfo): void { + $participationsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_participation"])){ - if(!empty($exportClassCapdataProperties["a_pour_participation"]["property_".$mappingType."_fields_dropdown"])){ - $aPourParticipationFieldName = $exportClassCapdataProperties["a_pour_participation"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_participation"])) { + if (!empty($exportClassCapdataProperties["a_pour_participation"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourParticipationFieldName = $exportClassCapdataProperties["a_pour_participation"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourParticipationFieldName) && !$mappedEntity->get($aPourParticipationFieldName)->isEmpty()) { $participationItems = $mappedEntity->get($aPourParticipationFieldName); foreach ($participationItems as $referenceParticipation) { $participationItem = $referenceParticipation->entity; - if(!empty($participationItem)){ - $referenceParticipationId = $participationItem->id(); - if(!empty($capDataParticipationMappingInfo)){ - if(!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])){ + if (!empty($participationItem)) { + $referenceParticipationId = $participationItem->id(); + if (!empty($capDataParticipationMappingInfo)) { + if (!empty($capDataParticipationMappingInfo["capData_participation_mappingtype"])) { $participationMappingType = $capDataParticipationMappingInfo["capData_participation_mappingtype"]; $referenceParticipationUrl = ""; - if($participationMappingType == "taxo" && $participationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($participationMappingType == "taxo" && $participationItem instanceof TermInterface) { $referenceParticipationUrl = $host . "/taxonomy/term/" . $referenceParticipationId; - }elseif($participationMappingType == "content" && $participationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($participationMappingType == "content" && $participationItem instanceof NodeInterface) { $referenceParticipationUrl = $host . "/node/" . $referenceParticipationId; } - if(!empty($referenceParticipationUrl)){ + if (!empty($referenceParticipationUrl)) { $participationsArray[] = new ExternalThing($referenceParticipationUrl); } } @@ -6509,38 +6848,42 @@ class CapDataConnectorManager { /** * Set A Pour Saison property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataSaisonMappingInfo + * CapData saison mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourSaisonCapdataProperty($graphItem, $capDataSaisonMappingInfo, $currentCapdataClassMappingInfo): void { - $saisonsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourSaisonCapdataProperty($graphItem, $capDataSaisonMappingInfo, $currentCapdataClassMappingInfo): void { + $saisonsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_saison"])){ - if(!empty($exportClassCapdataProperties["a_pour_saison"]["property_".$mappingType."_fields_dropdown"])){ - $aPourSaisonFieldName = $exportClassCapdataProperties["a_pour_saison"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_saison"])) { + if (!empty($exportClassCapdataProperties["a_pour_saison"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourSaisonFieldName = $exportClassCapdataProperties["a_pour_saison"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourSaisonFieldName) && !$mappedEntity->get($aPourSaisonFieldName)->isEmpty()) { $saisonItems = $mappedEntity->get($aPourSaisonFieldName); foreach ($saisonItems as $referenceSaison) { $saisonItem = $referenceSaison->entity; - if(!empty($saisonItem)){ - $referenceSaisonId = $saisonItem->id(); - if(!empty($capDataSaisonMappingInfo)){ - if(!empty($capDataSaisonMappingInfo["capData_saison_mappingtype"])){ + if (!empty($saisonItem)) { + $referenceSaisonId = $saisonItem->id(); + if (!empty($capDataSaisonMappingInfo)) { + if (!empty($capDataSaisonMappingInfo["capData_saison_mappingtype"])) { $saisonMappingType = $capDataSaisonMappingInfo["capData_saison_mappingtype"]; $referenceSaisonUrl = ""; - if($saisonMappingType == "taxo" && $saisonItem instanceof \Drupal\taxonomy\TermInterface){ + if ($saisonMappingType == "taxo" && $saisonItem instanceof TermInterface) { $referenceSaisonUrl = $host . "/taxonomy/term/" . $referenceSaisonId; - }elseif($saisonMappingType == "content" && $saisonItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($saisonMappingType == "content" && $saisonItem instanceof NodeInterface) { $referenceSaisonUrl = $host . "/node/" . $referenceSaisonId; } - if(!empty($referenceSaisonUrl)){ + if (!empty($referenceSaisonUrl)) { $saisonsArray[] = new ExternalThing($referenceSaisonUrl); } } @@ -6559,38 +6902,42 @@ class CapDataConnectorManager { /** * Set A Pour Type Production property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataTypeProductionMappingInfo + * CapData type production mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourTypeProductionCapdataProperty($graphItem, $capDataTypeProductionMappingInfo, $currentCapdataClassMappingInfo): void { - $typesProductionArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourTypeProductionCapdataProperty($graphItem, $capDataTypeProductionMappingInfo, $currentCapdataClassMappingInfo): void { + $typesProductionArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_type_production"])){ - if(!empty($exportClassCapdataProperties["a_pour_type_production"]["property_".$mappingType."_fields_dropdown"])){ - $aPourTypeProductionFieldName = $exportClassCapdataProperties["a_pour_type_production"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_type_production"])) { + if (!empty($exportClassCapdataProperties["a_pour_type_production"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourTypeProductionFieldName = $exportClassCapdataProperties["a_pour_type_production"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourTypeProductionFieldName) && !$mappedEntity->get($aPourTypeProductionFieldName)->isEmpty()) { $typeProductionItems = $mappedEntity->get($aPourTypeProductionFieldName); foreach ($typeProductionItems as $referenceTypeProduction) { $typeProductionItem = $referenceTypeProduction->entity; - if(!empty($typeProductionItem)){ - $referenceTypeProductionId = $typeProductionItem->id(); - if(!empty($capDataTypeProductionMappingInfo)){ - if(!empty($capDataTypeProductionMappingInfo["capData_typeproduction_mappingtype"])){ + if (!empty($typeProductionItem)) { + $referenceTypeProductionId = $typeProductionItem->id(); + if (!empty($capDataTypeProductionMappingInfo)) { + if (!empty($capDataTypeProductionMappingInfo["capData_typeproduction_mappingtype"])) { $typeProductionMappingType = $capDataTypeProductionMappingInfo["capData_typeproduction_mappingtype"]; $referenceTypeProductionUrl = ""; - if($typeProductionMappingType == "taxo" && $typeProductionItem instanceof \Drupal\taxonomy\TermInterface){ + if ($typeProductionMappingType == "taxo" && $typeProductionItem instanceof TermInterface) { $referenceTypeProductionUrl = $host . "/taxonomy/term/" . $referenceTypeProductionId; - }elseif($typeProductionMappingType == "content" && $typeProductionItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($typeProductionMappingType == "content" && $typeProductionItem instanceof NodeInterface) { $referenceTypeProductionUrl = $host . "/node/" . $referenceTypeProductionId; } - if(!empty($referenceTypeProductionUrl)){ + if (!empty($referenceTypeProductionUrl)) { $typesProductionArray[] = new ExternalThing($referenceTypeProductionUrl); } } @@ -6609,38 +6956,42 @@ class CapDataConnectorManager { /** * Set A Pour Type Public property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataTypePublicMappingInfo + * CapData type public mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourTypePublicCapdataProperty($graphItem, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo): void { - $typesPublicArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourTypePublicCapdataProperty($graphItem, $capDataTypePublicMappingInfo, $currentCapdataClassMappingInfo): void { + $typesPublicArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_type_public"])){ - if(!empty($exportClassCapdataProperties["a_pour_type_public"]["property_".$mappingType."_fields_dropdown"])){ - $aPourTypePublicFieldName = $exportClassCapdataProperties["a_pour_type_public"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_type_public"])) { + if (!empty($exportClassCapdataProperties["a_pour_type_public"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourTypePublicFieldName = $exportClassCapdataProperties["a_pour_type_public"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourTypePublicFieldName) && !$mappedEntity->get($aPourTypePublicFieldName)->isEmpty()) { $typePublicItems = $mappedEntity->get($aPourTypePublicFieldName); foreach ($typePublicItems as $referenceTypePublic) { $typePublicItem = $referenceTypePublic->entity; - if(!empty($typePublicItem)){ - $referenceTypePublicId = $typePublicItem->id(); - if(!empty($capDataTypePublicMappingInfo)){ - if(!empty($capDataTypePublicMappingInfo["capData_typepublic_mappingtype"])){ + if (!empty($typePublicItem)) { + $referenceTypePublicId = $typePublicItem->id(); + if (!empty($capDataTypePublicMappingInfo)) { + if (!empty($capDataTypePublicMappingInfo["capData_typepublic_mappingtype"])) { $typePublicMappingType = $capDataTypePublicMappingInfo["capData_typepublic_mappingtype"]; $referenceTypePublicUrl = ""; - if($typePublicMappingType == "taxo" && $typePublicItem instanceof \Drupal\taxonomy\TermInterface){ + if ($typePublicMappingType == "taxo" && $typePublicItem instanceof TermInterface) { $referenceTypePublicUrl = $host . "/taxonomy/term/" . $referenceTypePublicId; - }elseif($typePublicMappingType == "content" && $typePublicItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($typePublicMappingType == "content" && $typePublicItem instanceof NodeInterface) { $referenceTypePublicUrl = $host . "/node/" . $referenceTypePublicId; } - if(!empty($referenceTypePublicUrl)){ + if (!empty($referenceTypePublicUrl)) { $typesPublicArray[] = new ExternalThing($referenceTypePublicUrl); } } @@ -6659,38 +7010,42 @@ class CapDataConnectorManager { /** * Set Historique Capdata property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataHistoriqueProductionMappingInfo + * CapData historique production mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setHistoriqueCapdataProperty($graphItem, $capDataHistoriqueProductionMappingInfo, $currentCapdataClassMappingInfo): void { - $historiquesArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $historiquesArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["historique"])){ - if(!empty($exportClassCapdataProperties["historique"]["property_".$mappingType."_fields_dropdown"])){ - $historiqueFieldName = $exportClassCapdataProperties["historique"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["historique"])) { + if (!empty($exportClassCapdataProperties["historique"]["property_" . $mappingType . "_fields_dropdown"])) { + $historiqueFieldName = $exportClassCapdataProperties["historique"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($historiqueFieldName) && !$mappedEntity->get($historiqueFieldName)->isEmpty()) { $historiqueItems = $mappedEntity->get($historiqueFieldName); foreach ($historiqueItems as $referenceHistorique) { $historiqueItem = $referenceHistorique->entity; - if(!empty($historiqueItem)){ - $referenceHistoriqueId = $historiqueItem->id(); - if(!empty($capDataHistoriqueProductionMappingInfo)){ - if(!empty($capDataHistoriqueProductionMappingInfo["capData_historiqueproduction_mappingtype"])){ + if (!empty($historiqueItem)) { + $referenceHistoriqueId = $historiqueItem->id(); + if (!empty($capDataHistoriqueProductionMappingInfo)) { + if (!empty($capDataHistoriqueProductionMappingInfo["capData_historiqueproduction_mappingtype"])) { $historiqueMappingType = $capDataHistoriqueProductionMappingInfo["capData_historiqueproduction_mappingtype"]; $referenceHistoriqueUrl = ""; - if($historiqueMappingType == "taxo" && $historiqueItem instanceof \Drupal\taxonomy\TermInterface){ + if ($historiqueMappingType == "taxo" && $historiqueItem instanceof TermInterface) { $referenceHistoriqueUrl = $host . "/taxonomy/term/" . $referenceHistoriqueId; - }elseif($historiqueMappingType == "content" && $historiqueItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($historiqueMappingType == "content" && $historiqueItem instanceof NodeInterface) { $referenceHistoriqueUrl = $host . "/node/" . $referenceHistoriqueId; } - if(!empty($referenceHistoriqueUrl)){ + if (!empty($referenceHistoriqueUrl)) { $historiquesArray[] = new ExternalThing($referenceHistoriqueUrl); } } @@ -6709,38 +7064,42 @@ class CapDataConnectorManager { /** * Set Lieu Publication property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataLieuPublicationMappingInfo + * CapData lieu publication mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setLieuPublicationCapdataProperty($graphItem, $capDataLieuPublicationMappingInfo, $currentCapdataClassMappingInfo): void { - $lieuPublicationArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $lieuPublicationArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["lieu_publication"])){ - if(!empty($exportClassCapdataProperties["lieu_publication"]["property_".$mappingType."_fields_dropdown"])){ - $lieuPublicationFieldName = $exportClassCapdataProperties["lieu_publication"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["lieu_publication"])) { + if (!empty($exportClassCapdataProperties["lieu_publication"]["property_" . $mappingType . "_fields_dropdown"])) { + $lieuPublicationFieldName = $exportClassCapdataProperties["lieu_publication"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($lieuPublicationFieldName) && !$mappedEntity->get($lieuPublicationFieldName)->isEmpty()) { $lieuPublicationItems = $mappedEntity->get($lieuPublicationFieldName); foreach ($lieuPublicationItems as $referenceLieuPublication) { $lieuPublicationItem = $referenceLieuPublication->entity; - if(!empty($lieuPublicationItem)){ - $referenceLieuPublicationId = $lieuPublicationItem->id(); - if(!empty($capDataLieuPublicationMappingInfo)){ - if(!empty($capDataLieuPublicationMappingInfo["capData_lieu_mappingtype"])){ + if (!empty($lieuPublicationItem)) { + $referenceLieuPublicationId = $lieuPublicationItem->id(); + if (!empty($capDataLieuPublicationMappingInfo)) { + if (!empty($capDataLieuPublicationMappingInfo["capData_lieu_mappingtype"])) { $lieuPublicationMappingType = $capDataLieuPublicationMappingInfo["capData_lieu_mappingtype"]; $referenceLieuPublicationUrl = ""; - if($lieuPublicationMappingType == "taxo" && $lieuPublicationItem instanceof \Drupal\taxonomy\TermInterface){ + if ($lieuPublicationMappingType == "taxo" && $lieuPublicationItem instanceof TermInterface) { $referenceLieuPublicationUrl = $host . "/taxonomy/term/" . $referenceLieuPublicationId; - }elseif($lieuPublicationMappingType == "content" && $lieuPublicationItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($lieuPublicationMappingType == "content" && $lieuPublicationItem instanceof NodeInterface) { $referenceLieuPublicationUrl = $host . "/node/" . $referenceLieuPublicationId; } - if(!empty($referenceLieuPublicationUrl)){ + if (!empty($referenceLieuPublicationUrl)) { $lieuPublicationArray[] = new ExternalThing($referenceLieuPublicationUrl); } } @@ -6759,38 +7118,42 @@ class CapDataConnectorManager { /** * Set Oeuvre Representee Capdata property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataOeuvreMappingInfo + * CapData oeuvre mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setOeuvreRepresenteeCapdataProperty($graphItem, $capDataOeuvreMappingInfo, $currentCapdataClassMappingInfo): void { - $oeuvresArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $oeuvresArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["oeuvre_representee"])){ - if(!empty($exportClassCapdataProperties["oeuvre_representee"]["property_".$mappingType."_fields_dropdown"])){ - $oeuvreRepresenteeFieldName = $exportClassCapdataProperties["oeuvre_representee"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["oeuvre_representee"])) { + if (!empty($exportClassCapdataProperties["oeuvre_representee"]["property_" . $mappingType . "_fields_dropdown"])) { + $oeuvreRepresenteeFieldName = $exportClassCapdataProperties["oeuvre_representee"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($oeuvreRepresenteeFieldName) && !$mappedEntity->get($oeuvreRepresenteeFieldName)->isEmpty()) { $oeuvreItems = $mappedEntity->get($oeuvreRepresenteeFieldName); foreach ($oeuvreItems as $referenceOeuvre) { $oeuvreItem = $referenceOeuvre->entity; - if(!empty($oeuvreItem)){ - $referenceOeuvreId = $oeuvreItem->id(); - if(!empty($capDataOeuvreMappingInfo)){ - if(!empty($capDataOeuvreMappingInfo["capData_oeuvre_mappingtype"])){ + if (!empty($oeuvreItem)) { + $referenceOeuvreId = $oeuvreItem->id(); + if (!empty($capDataOeuvreMappingInfo)) { + if (!empty($capDataOeuvreMappingInfo["capData_oeuvre_mappingtype"])) { $oeuvreMappingType = $capDataOeuvreMappingInfo["capData_oeuvre_mappingtype"]; $referenceOeuvreUrl = ""; - if($oeuvreMappingType == "taxo" && $oeuvreItem instanceof \Drupal\taxonomy\TermInterface){ + if ($oeuvreMappingType == "taxo" && $oeuvreItem instanceof TermInterface) { $referenceOeuvreUrl = $host . "/taxonomy/term/" . $referenceOeuvreId; - }elseif($oeuvreMappingType == "content" && $oeuvreItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($oeuvreMappingType == "content" && $oeuvreItem instanceof NodeInterface) { $referenceOeuvreUrl = $host . "/node/" . $referenceOeuvreId; } - if(!empty($referenceOeuvreUrl)){ + if (!empty($referenceOeuvreUrl)) { $oeuvresArray[] = new ExternalThing($referenceOeuvreUrl); } } @@ -6809,38 +7172,42 @@ class CapDataConnectorManager { /** * Set Production Primaire property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataProductionPrimaireMappingInfo + * CapData production primaire mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setProductionPrimaireCapdataProperty($graphItem, $capDataProductionPrimaireMappingInfo, $currentCapdataClassMappingInfo): void { - $productionsPrimairesArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $productionsPrimairesArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["production_primaire"])){ - if(!empty($exportClassCapdataProperties["production_primaire"]["property_".$mappingType."_fields_dropdown"])){ - $productionPrimaireFieldName = $exportClassCapdataProperties["production_primaire"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["production_primaire"])) { + if (!empty($exportClassCapdataProperties["production_primaire"]["property_" . $mappingType . "_fields_dropdown"])) { + $productionPrimaireFieldName = $exportClassCapdataProperties["production_primaire"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($productionPrimaireFieldName) && !$mappedEntity->get($productionPrimaireFieldName)->isEmpty()) { $productionPrimaireItems = $mappedEntity->get($productionPrimaireFieldName); foreach ($productionPrimaireItems as $referenceProductionPrimaire) { $productionPrimaireItem = $referenceProductionPrimaire->entity; - if(!empty($productionPrimaireItem)){ - $referenceProductionPrimaireId = $productionPrimaireItem->id(); - if(!empty($capDataProductionPrimaireMappingInfo)){ - if(!empty($capDataProductionPrimaireMappingInfo["capData_productionprimaire_mappingtype"])){ + if (!empty($productionPrimaireItem)) { + $referenceProductionPrimaireId = $productionPrimaireItem->id(); + if (!empty($capDataProductionPrimaireMappingInfo)) { + if (!empty($capDataProductionPrimaireMappingInfo["capData_productionprimaire_mappingtype"])) { $productionPrimaireMappingType = $capDataProductionPrimaireMappingInfo["capData_productionprimaire_mappingtype"]; $referenceProductionPrimaireUrl = ""; - if($productionPrimaireMappingType == "taxo" && $productionPrimaireItem instanceof \Drupal\taxonomy\TermInterface){ + if ($productionPrimaireMappingType == "taxo" && $productionPrimaireItem instanceof TermInterface) { $referenceProductionPrimaireUrl = $host . "/taxonomy/term/" . $referenceProductionPrimaireId; - }elseif($productionPrimaireMappingType == "content" && $productionPrimaireItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($productionPrimaireMappingType == "content" && $productionPrimaireItem instanceof NodeInterface) { $referenceProductionPrimaireUrl = $host . "/node/" . $referenceProductionPrimaireId; } - if(!empty($referenceProductionPrimaireUrl)){ + if (!empty($referenceProductionPrimaireUrl)) { $productionsPrimairesArray[] = new ExternalThing($referenceProductionPrimaireUrl); } } @@ -6859,191 +7226,203 @@ class CapDataConnectorManager { /** * Handle participation content mapping. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\node\NodeInterface $node + * Node. * @param array $participationContentMappingInfo + * Participation content mapping info. */ public function handleParticipationContentMapping($graphItem, $node, $participationContentMappingInfo): void { - if(!empty($participationContentMappingInfo)){ + if (!empty($participationContentMappingInfo)) { $capdataExportData = $participationContentMappingInfo['capdataExportData']; $host = $participationContentMappingInfo['host']; $capDataClassInfo = $participationContentMappingInfo['capDataClassInfo']; - $ownOrg = $participationContentMappingInfo['ownOrg']; - if(!empty($capdataExportData) && !empty($host) && !empty($node) && !empty($capDataClassInfo) && !empty($ownOrg) && !empty($graphItem)){ + $ownOrg = $participationContentMappingInfo['ownOrg']; + if (!empty($capdataExportData) && !empty($host) && !empty($node) && !empty($capDataClassInfo) && !empty($ownOrg) && !empty($graphItem)) { // A pour fonction (Fonction) $capDataFonctionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "taxo"; } $capDataFonctionMappingInfo = [ - "capData_fonction_mappingtype" => $capDataFonctionMappingType, + "capData_fonction_mappingtype" => $capDataFonctionMappingType, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "content", - "mapped_entity" => $node, + "mapping_type" => "content", + "mapped_entity" => $node, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - $this->setAPourFonctionCapdataProperty($graphItem, + $this->setApourFonctionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo - ); + ); // A pour participant (Personne ou Collectivite) $capDataPersonneMappingType = ""; $capDataPersonneCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_personne"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_personne"])) { $capDataPersonneMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_content_dropdown"]) - ){ + ) { $capDataPersonneCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_personne"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_personne"])) { $capDataPersonneMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPersonneCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPersonneMappingInfo = [ - "capData_personne_mappingtype" => $capDataPersonneMappingType, - "capData_personne_correspondance" => $capDataPersonneCorrespondantEntity, + "capData_personne_mappingtype" => $capDataPersonneMappingType, + "capData_personne_correspondance" => $capDataPersonneCorrespondantEntity, ]; $capDataCollectiviteMappingType = ""; $capDataCollectiviteCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_content_dropdown"]) - ){ + ) { $capDataCollectiviteCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { $capDataCollectiviteMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataCollectiviteCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_taxonomy_dropdown"]; - } + } } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "capData_collectivite_correspondance" => $capDataCollectiviteCorrespondantEntity, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "capData_collectivite_correspondance" => $capDataCollectiviteCorrespondantEntity, + "default_collectivite" => $ownOrg, ]; - $this->setAPourParticipantCapdataProperty($graphItem, + $this->setApourParticipantCapdataProperty($graphItem, $capDataPersonneMappingInfo, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); - // Identifiant Rof + // Identifiant Rof. $this->setIdentifiantRofProperty($graphItem, $node, $capDataClassInfo["export_class_capdata_properties"], "content" - ); - } - } - } + ); + } + } + } /** * Handle participation taxonomy mapping. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface $term + * Term. * @param array $participationTaxonomyMappingInfo + * Participation taxonomy mapping info. */ public function handleParticipationTaxonomyMapping($graphItem, $term, $participationTaxonomyMappingInfo): void { - if(!empty($participationTaxonomyMappingInfo)){ + if (!empty($participationTaxonomyMappingInfo)) { $capdataExportData = $participationTaxonomyMappingInfo['capdataExportData']; $host = $participationTaxonomyMappingInfo['host']; $capDataClassInfo = $participationTaxonomyMappingInfo['capDataClassInfo']; $ownOrg = $participationTaxonomyMappingInfo['ownOrg']; - if(!empty($capdataExportData) && !empty($host) && !empty($term) && !empty($capDataClassInfo) && !empty($ownOrg) && !empty($graphItem)){ + if (!empty($capdataExportData) && !empty($host) && !empty($term) && !empty($capDataClassInfo) && !empty($ownOrg) && !empty($graphItem)) { // A pour fonction (Fonction) $capDataFonctionMappingType = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "content"; - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_fonction"])) { $capDataFonctionMappingType = "taxo"; } $capDataFonctionMappingInfo = [ "capData_fonction_mappingtype" => $capDataFonctionMappingType, ]; - $currentCapdataClassMappingInfo =[ + $currentCapdataClassMappingInfo = [ "host" => $host, - "mapping_type" => "taxo", - "mapped_entity" => $term, + "mapping_type" => "taxo", + "mapped_entity" => $term, "mapped_entity_properties" => $capDataClassInfo["export_class_capdata_properties"], ]; - $this->setAPourFonctionCapdataProperty($graphItem, + $this->setApourFonctionCapdataProperty($graphItem, $capDataFonctionMappingInfo, $currentCapdataClassMappingInfo ); // A pour participant (Personne ou Collectivite) $capDataPersonneMappingType = ""; $capDataPersonneCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_personne"])){ + if (isset($capdataExportData["content_mapped_classes"]["capdata_personne"])) { $capDataPersonneMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_content_mapping" + if ($capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_content_dropdown"]) - ){ + ) { $capDataPersonneCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_personne"]["export_class_content_dropdown"]; } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_personne"])){ + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_personne"])) { $capDataPersonneMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_taxo_mapping" + if ($capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_mapping_type"] == "capdata_personne_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_taxonomy_dropdown"]) - ){ + ) { $capDataPersonneCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_personne"]["export_class_taxonomy_dropdown"]; - } + } } $capDataPersonneMappingInfo = [ - "capData_personne_mappingtype" => $capDataPersonneMappingType, - "capData_personne_correspondance" => $capDataPersonneCorrespondantEntity, + "capData_personne_mappingtype" => $capDataPersonneMappingType, + "capData_personne_correspondance" => $capDataPersonneCorrespondantEntity, ]; $capDataCollectiviteMappingType = ""; $capDataCollectiviteCorrespondantEntity = ""; - if(isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])){ - $capDataCollectiviteMappingType = "content"; - if($capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_content_mapping" + if (isset($capdataExportData["content_mapped_classes"]["capdata_collectivite"])) { + $capDataCollectiviteMappingType = "content"; + if ($capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_content_mapping" && !empty($capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_content_dropdown"]) - ){ - $capDataCollectiviteCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_content_dropdown"]; - } - }elseif(isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])){ - $capDataCollectiviteMappingType = "taxo"; - if($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_taxo_mapping" + ) { + $capDataCollectiviteCorrespondantEntity = $capdataExportData["content_mapped_classes"]["capdata_collectivite"]["export_class_content_dropdown"]; + } + } + elseif (isset($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"])) { + $capDataCollectiviteMappingType = "taxo"; + if ($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_mapping_type"] == "capdata_collectivite_taxo_mapping" && !empty($capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_taxonomy_dropdown"]) - ){ - $capDataCollectiviteCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_taxonomy_dropdown"]; - } + ) { + $capDataCollectiviteCorrespondantEntity = $capdataExportData["taxo_mapped_classes"]["capdata_collectivite"]["export_class_taxonomy_dropdown"]; + } } $capDataCollectiviteMappingInfo = [ - "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, - "capData_collectivite_correspondance" => $capDataCollectiviteCorrespondantEntity, - "default_collectivite" => $ownOrg, + "capData_collectivite_mappingtype" => $capDataCollectiviteMappingType, + "capData_collectivite_correspondance" => $capDataCollectiviteCorrespondantEntity, + "default_collectivite" => $ownOrg, ]; - $this->setAPourParticipantCapdataProperty($graphItem, + $this->setApourParticipantCapdataProperty($graphItem, $capDataPersonneMappingInfo, $capDataCollectiviteMappingInfo, $currentCapdataClassMappingInfo ); - // Identifiant Rof + // Identifiant Rof. $this->setIdentifiantRofProperty($graphItem, $term, $capDataClassInfo["export_class_capdata_properties"], @@ -7055,89 +7434,99 @@ class CapDataConnectorManager { /** * Set Date Premiere, Date publication Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setProductionDatesProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Date premiere + // Date premiere. $datePremiere = ""; - if(isset($exportClassCapdataProperties["date_premiere"])){ - if(!empty($exportClassCapdataProperties["date_premiere"]["property_".$mappingType."_fields_dropdown"])){ - $datePremiereFieldName = $exportClassCapdataProperties["date_premiere"]["property_".$mappingType."_fields_dropdown"]; + if (isset($exportClassCapdataProperties["date_premiere"])) { + if (!empty($exportClassCapdataProperties["date_premiere"]["property_" . $mappingType . "_fields_dropdown"])) { + $datePremiereFieldName = $exportClassCapdataProperties["date_premiere"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($datePremiereFieldName) && !$mappedEntity->get($datePremiereFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($datePremiereFieldName)->date)){ + if (!empty($mappedEntity->get($datePremiereFieldName)->date)) { $datePremiereObj = $mappedEntity->get($datePremiereFieldName)->date; - }else{ - // timestamp field - $datePremiereObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($datePremiereFieldName)->value); + } + else { + // Timestamp field. + $datePremiereObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($datePremiereFieldName)->value); } $datePremiereObj->setTimezone(new \DateTimeZone('UTC')); $datePremiere = $datePremiereObj->format('Y-m-d\TH:i:s\Z'); } } } - if(!empty($datePremiere)){ + if (!empty($datePremiere)) { $graphItem->setDatePremiere($datePremiere); } - // Date publication + // Date publication. $datePublication = ""; - if(isset($exportClassCapdataProperties["date_publication"])){ - if(!empty($exportClassCapdataProperties["date_publication"]["property_".$mappingType."_fields_dropdown"])){ - $datePublicationFieldName = $exportClassCapdataProperties["date_publication"]["property_".$mappingType."_fields_dropdown"]; + if (isset($exportClassCapdataProperties["date_publication"])) { + if (!empty($exportClassCapdataProperties["date_publication"]["property_" . $mappingType . "_fields_dropdown"])) { + $datePublicationFieldName = $exportClassCapdataProperties["date_publication"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($datePublicationFieldName) && !$mappedEntity->get($datePublicationFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($datePublicationFieldName)->date)){ + if (!empty($mappedEntity->get($datePublicationFieldName)->date)) { $datePublicationObj = $mappedEntity->get($datePublicationFieldName)->date; - }else{ - // timestamp field - $datePublicationObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($datePublicationFieldName)->value); + } + else { + // Timestamp field. + $datePublicationObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($datePublicationFieldName)->value); } $datePublicationObj->setTimezone(new \DateTimeZone('UTC')); $datePublication = $datePublicationObj->format('Y-m-d\TH:i:s\Z'); } } } - if(!empty($datePublication)){ + if (!empty($datePublication)) { $graphItem->setDatePublication($datePublication); } } /** * Set A Pour Type Evenement property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataTypeEvenementMappingInfo + * CapData type evenement mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourTypeEvenementCapdataProperty($graphItem, $capDataTypeEvenementMappingInfo, $currentCapdataClassMappingInfo): void { - $typesEvenementArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourTypeEvenementCapdataProperty($graphItem, $capDataTypeEvenementMappingInfo, $currentCapdataClassMappingInfo): void { + $typesEvenementArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["type_evenement"])){ - if(!empty($exportClassCapdataProperties["type_evenement"]["property_".$mappingType."_fields_dropdown"])){ - $typeEvenementFieldName = $exportClassCapdataProperties["type_evenement"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["type_evenement"])) { + if (!empty($exportClassCapdataProperties["type_evenement"]["property_" . $mappingType . "_fields_dropdown"])) { + $typeEvenementFieldName = $exportClassCapdataProperties["type_evenement"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($typeEvenementFieldName) && !$mappedEntity->get($typeEvenementFieldName)->isEmpty()) { $typeEvenementItems = $mappedEntity->get($typeEvenementFieldName); foreach ($typeEvenementItems as $referenceTypeEvenement) { $typeEvenementItem = $referenceTypeEvenement->entity; - if(!empty($typeEvenementItem)){ - $referenceTypeEvenementId = $typeEvenementItem->id(); - if(!empty($capDataTypeEvenementMappingInfo)){ - if(!empty($capDataTypeEvenementMappingInfo["capData_typeevenement_mappingtype"])){ + if (!empty($typeEvenementItem)) { + $referenceTypeEvenementId = $typeEvenementItem->id(); + if (!empty($capDataTypeEvenementMappingInfo)) { + if (!empty($capDataTypeEvenementMappingInfo["capData_typeevenement_mappingtype"])) { $typeEvenementMappingType = $capDataTypeEvenementMappingInfo["capData_typeevenement_mappingtype"]; $referenceTypeEvenementUrl = ""; - if($typeEvenementMappingType == "taxo" && $typeEvenementItem instanceof \Drupal\taxonomy\TermInterface){ + if ($typeEvenementMappingType == "taxo" && $typeEvenementItem instanceof TermInterface) { $referenceTypeEvenementUrl = $host . "/taxonomy/term/" . $referenceTypeEvenementId; - }elseif($typeEvenementMappingType == "content" && $typeEvenementItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($typeEvenementMappingType == "content" && $typeEvenementItem instanceof NodeInterface) { $referenceTypeEvenementUrl = $host . "/node/" . $referenceTypeEvenementId; } - if(!empty($referenceTypeEvenementUrl)){ + if (!empty($referenceTypeEvenementUrl)) { $typesEvenementArray[] = new ExternalThing($referenceTypeEvenementUrl); } } @@ -7156,38 +7545,42 @@ class CapDataConnectorManager { /** * Set A pour lieu property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataLieuCustomMappingInfo + * CapData lieu custom mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourLieuCapdataProperty($graphItem, $capDataLieuCustomMappingInfo, $currentCapdataClassMappingInfo): void { - $lieuGeoArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourLieuCapdataProperty($graphItem, $capDataLieuCustomMappingInfo, $currentCapdataClassMappingInfo): void { + $lieuGeoArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_lieu"])){ - if(!empty($exportClassCapdataProperties["a_pour_lieu"]["property_".$mappingType."_fields_dropdown"])){ - $lieuGeoFieldName = $exportClassCapdataProperties["a_pour_lieu"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_lieu"])) { + if (!empty($exportClassCapdataProperties["a_pour_lieu"]["property_" . $mappingType . "_fields_dropdown"])) { + $lieuGeoFieldName = $exportClassCapdataProperties["a_pour_lieu"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($lieuGeoFieldName) && !$mappedEntity->get($lieuGeoFieldName)->isEmpty()) { $lieuGeoItems = $mappedEntity->get($lieuGeoFieldName); foreach ($lieuGeoItems as $referenceLieuGeo) { $lieuGeoItem = $referenceLieuGeo->entity; - if(!empty($lieuGeoItem)){ - $referenceLieuGeoId = $lieuGeoItem->id(); - if(!empty($capDataLieuCustomMappingInfo)){ - if(!empty($capDataLieuCustomMappingInfo["capData_lieu_mappingtype"])){ + if (!empty($lieuGeoItem)) { + $referenceLieuGeoId = $lieuGeoItem->id(); + if (!empty($capDataLieuCustomMappingInfo)) { + if (!empty($capDataLieuCustomMappingInfo["capData_lieu_mappingtype"])) { $lieuGeoMappingType = $capDataLieuCustomMappingInfo["capData_lieu_mappingtype"]; $referenceLieuGeoUrl = ""; - if($lieuGeoMappingType == "taxo" && $lieuGeoItem instanceof \Drupal\taxonomy\TermInterface){ + if ($lieuGeoMappingType == "taxo" && $lieuGeoItem instanceof TermInterface) { $referenceLieuGeoUrl = $host . "/taxonomy/term/" . $referenceLieuGeoId; - }elseif($lieuGeoMappingType == "content" && $lieuGeoItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($lieuGeoMappingType == "content" && $lieuGeoItem instanceof NodeInterface) { $referenceLieuGeoUrl = $host . "/node/" . $referenceLieuGeoId; } - if(!empty($referenceLieuGeoUrl)){ + if (!empty($referenceLieuGeoUrl)) { $lieuGeoArray[] = new ExternalThing($referenceLieuGeoUrl); } } @@ -7206,38 +7599,42 @@ class CapDataConnectorManager { /** * Set A Pour Production property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataProductionCustomMappingInfo + * CapData production custom mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ - public function setAPourProductionCapdataProperty($graphItem, $capDataProductionCustomMappingInfo, $currentCapdataClassMappingInfo): void { - $productionsArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + public function setApourProductionCapdataProperty($graphItem, $capDataProductionCustomMappingInfo, $currentCapdataClassMappingInfo): void { + $productionsArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["a_pour_production"])){ - if(!empty($exportClassCapdataProperties["a_pour_production"]["property_".$mappingType."_fields_dropdown"])){ - $aPourProductionFieldName = $exportClassCapdataProperties["a_pour_production"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["a_pour_production"])) { + if (!empty($exportClassCapdataProperties["a_pour_production"]["property_" . $mappingType . "_fields_dropdown"])) { + $aPourProductionFieldName = $exportClassCapdataProperties["a_pour_production"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($aPourProductionFieldName) && !$mappedEntity->get($aPourProductionFieldName)->isEmpty()) { $productionItems = $mappedEntity->get($aPourProductionFieldName); foreach ($productionItems as $referenceProduction) { $productionItem = $referenceProduction->entity; - if(!empty($productionItem)){ - $referenceProductionId = $productionItem->id(); - if(!empty($capDataProductionCustomMappingInfo)){ - if(!empty($capDataProductionCustomMappingInfo["capData_production_mappingtype"])){ + if (!empty($productionItem)) { + $referenceProductionId = $productionItem->id(); + if (!empty($capDataProductionCustomMappingInfo)) { + if (!empty($capDataProductionCustomMappingInfo["capData_production_mappingtype"])) { $productionMappingType = $capDataProductionCustomMappingInfo["capData_production_mappingtype"]; $referenceProductionUrl = ""; - if($productionMappingType == "taxo" && $productionItem instanceof \Drupal\taxonomy\TermInterface){ + if ($productionMappingType == "taxo" && $productionItem instanceof TermInterface) { $referenceProductionUrl = $host . "/taxonomy/term/" . $referenceProductionId; - }elseif($productionMappingType == "content" && $productionItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($productionMappingType == "content" && $productionItem instanceof NodeInterface) { $referenceProductionUrl = $host . "/node/" . $referenceProductionId; } - if(!empty($referenceProductionUrl)){ + if (!empty($referenceProductionUrl)) { $productionsArray[] = new ExternalThing($referenceProductionUrl); } } @@ -7254,109 +7651,118 @@ class CapDataConnectorManager { } } - /** * Set Date debut, Date fin, Annulation Properties. - * + * * @param mixed $graphItem + * Graph Item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setEventDatesCapdataProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Date debut + // Date debut. $dateDebut = ""; - if(isset($exportClassCapdataProperties["date_debut"])){ - if(!empty($exportClassCapdataProperties["date_debut"]["property_".$mappingType."_fields_dropdown"])){ - $dateDebutFieldName = $exportClassCapdataProperties["date_debut"]["property_".$mappingType."_fields_dropdown"]; + if (isset($exportClassCapdataProperties["date_debut"])) { + if (!empty($exportClassCapdataProperties["date_debut"]["property_" . $mappingType . "_fields_dropdown"])) { + $dateDebutFieldName = $exportClassCapdataProperties["date_debut"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($dateDebutFieldName) && !$mappedEntity->get($dateDebutFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($dateDebutFieldName)->date)){ + if (!empty($mappedEntity->get($dateDebutFieldName)->date)) { $dateDebutObj = $mappedEntity->get($dateDebutFieldName)->date; - }else{ - // timestamp field - $dateDebutObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($dateDebutFieldName)->value); + } + else { + // Timestamp field. + $dateDebutObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($dateDebutFieldName)->value); } $dateDebutObj->setTimezone(new \DateTimeZone('UTC')); $dateDebut = $dateDebutObj->format('Y-m-d\TH:i:s\Z'); } } } - if(!empty($dateDebut)){ + if (!empty($dateDebut)) { $graphItem->setDateDebut($dateDebut); } - // Date fin + // Date fin. $dateFin = ""; - if(isset($exportClassCapdataProperties["date_fin"])){ - if(!empty($exportClassCapdataProperties["date_fin"]["property_".$mappingType."_fields_dropdown"])){ - $dateFinFieldName = $exportClassCapdataProperties["date_fin"]["property_".$mappingType."_fields_dropdown"]; + if (isset($exportClassCapdataProperties["date_fin"])) { + if (!empty($exportClassCapdataProperties["date_fin"]["property_" . $mappingType . "_fields_dropdown"])) { + $dateFinFieldName = $exportClassCapdataProperties["date_fin"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($dateFinFieldName) && !$mappedEntity->get($dateFinFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($dateFinFieldName)->date)){ + if (!empty($mappedEntity->get($dateFinFieldName)->date)) { $dateFinObj = $mappedEntity->get($dateFinFieldName)->date; - }else{ - // timestamp field - $dateFinObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($dateFinFieldName)->value); + } + else { + // Timestamp field. + $dateFinObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($dateFinFieldName)->value); } $dateFinObj->setTimezone(new \DateTimeZone('UTC')); $dateFin = $dateFinObj->format('Y-m-d\TH:i:s\Z'); } } } - if(!empty($dateFin)){ + if (!empty($dateFin)) { $graphItem->setDateFin($dateFin); } - // Annulation - $bAnnulation = false; - if(isset($exportClassCapdataProperties["annulation"])){ - if(!empty($exportClassCapdataProperties["annulation"]["property_".$mappingType."_fields_dropdown"])){ - $bAnnulationFieldName = $exportClassCapdataProperties["annulation"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($bAnnulationFieldName) && !$mappedEntity->get($bAnnulationFieldName)->isEmpty()){ + // Annulation. + $bAnnulation = FALSE; + if (isset($exportClassCapdataProperties["annulation"])) { + if (!empty($exportClassCapdataProperties["annulation"]["property_" . $mappingType . "_fields_dropdown"])) { + $bAnnulationFieldName = $exportClassCapdataProperties["annulation"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($bAnnulationFieldName) && !$mappedEntity->get($bAnnulationFieldName)->isEmpty()) { $bAnnulation = $mappedEntity->get($bAnnulationFieldName)->value; - if(!empty($bAnnulation)){ - if(!empty($exportClassCapdataProperties["annulation"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["annulation"]["property_".$mappingType."_custom_processing"]; + if (!empty($bAnnulation)) { + if (!empty($exportClassCapdataProperties["annulation"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["annulation"]["property_" . $mappingType . "_custom_processing"]; $bAnnulation = $this->customFieldProcessing($bAnnulation, $customProcessing); } - $graphItem->setAnnulation(true); + $graphItem->setAnnulation(TRUE); } } } - } + } } /** * Set Categorie Oeuvre property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataCategorieOeuvreMappingInfo + * CapData categorie oeuvre mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setCategorieOeuvreCapdataProperty($graphItem, $capDataCategorieOeuvreMappingInfo, $currentCapdataClassMappingInfo): void { - $categoriesOeuvreArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $categoriesOeuvreArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["categorie_oeuvre"])){ - if(!empty($exportClassCapdataProperties["categorie_oeuvre"]["property_".$mappingType."_fields_dropdown"])){ - $categorieOeuvreFieldName = $exportClassCapdataProperties["categorie_oeuvre"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["categorie_oeuvre"])) { + if (!empty($exportClassCapdataProperties["categorie_oeuvre"]["property_" . $mappingType . "_fields_dropdown"])) { + $categorieOeuvreFieldName = $exportClassCapdataProperties["categorie_oeuvre"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($categorieOeuvreFieldName) && !$mappedEntity->get($categorieOeuvreFieldName)->isEmpty()) { $categorieOeuvreItems = $mappedEntity->get($categorieOeuvreFieldName); foreach ($categorieOeuvreItems as $referenceCategorieOeuvre) { $categorieOeuvreItem = $referenceCategorieOeuvre->entity; - if(!empty($categorieOeuvreItem)){ - $referenceCategorieOeuvreId = $categorieOeuvreItem->id(); - if(!empty($capDataCategorieOeuvreMappingInfo)){ - if(!empty($capDataCategorieOeuvreMappingInfo["capData_categorieoeuvre_mappingtype"])){ + if (!empty($categorieOeuvreItem)) { + $referenceCategorieOeuvreId = $categorieOeuvreItem->id(); + if (!empty($capDataCategorieOeuvreMappingInfo)) { + if (!empty($capDataCategorieOeuvreMappingInfo["capData_categorieoeuvre_mappingtype"])) { $categorieOeuvreMappingType = $capDataCategorieOeuvreMappingInfo["capData_categorieoeuvre_mappingtype"]; $referenceCategorieOeuvreUrl = ""; - if($categorieOeuvreMappingType == "taxo" && $categorieOeuvreItem instanceof \Drupal\taxonomy\TermInterface){ + if ($categorieOeuvreMappingType == "taxo" && $categorieOeuvreItem instanceof TermInterface) { $referenceCategorieOeuvreUrl = $host . "/taxonomy/term/" . $referenceCategorieOeuvreId; - }elseif($categorieOeuvreMappingType == "content" && $categorieOeuvreItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($categorieOeuvreMappingType == "content" && $categorieOeuvreItem instanceof NodeInterface) { $referenceCategorieOeuvreUrl = $host . "/node/" . $referenceCategorieOeuvreId; } - if(!empty($referenceCategorieOeuvreUrl)){ + if (!empty($referenceCategorieOeuvreUrl)) { $categoriesOeuvreArray[] = new ExternalThing($referenceCategorieOeuvreUrl); } } @@ -7375,38 +7781,42 @@ class CapDataConnectorManager { /** * Set Genre Oeuvre property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataGenreOeuvreMappingInfo + * CapData genre oeuvre mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setGenreOeuvreCapdataProperty($graphItem, $capDataGenreOeuvreMappingInfo, $currentCapdataClassMappingInfo): void { - $genresOeuvreArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $genresOeuvreArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["genre_oeuvre"])){ - if(!empty($exportClassCapdataProperties["genre_oeuvre"]["property_".$mappingType."_fields_dropdown"])){ - $genreOeuvreFieldName = $exportClassCapdataProperties["genre_oeuvre"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["genre_oeuvre"])) { + if (!empty($exportClassCapdataProperties["genre_oeuvre"]["property_" . $mappingType . "_fields_dropdown"])) { + $genreOeuvreFieldName = $exportClassCapdataProperties["genre_oeuvre"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($genreOeuvreFieldName) && !$mappedEntity->get($genreOeuvreFieldName)->isEmpty()) { $genreOeuvreItems = $mappedEntity->get($genreOeuvreFieldName); foreach ($genreOeuvreItems as $referenceGenreOeuvre) { $genreOeuvreItem = $referenceGenreOeuvre->entity; - if(!empty($genreOeuvreItem)){ - $referenceGenreOeuvreId = $genreOeuvreItem->id(); - if(!empty($capDataGenreOeuvreMappingInfo)){ - if(!empty($capDataGenreOeuvreMappingInfo["capData_genreoeuvre_mappingtype"])){ + if (!empty($genreOeuvreItem)) { + $referenceGenreOeuvreId = $genreOeuvreItem->id(); + if (!empty($capDataGenreOeuvreMappingInfo)) { + if (!empty($capDataGenreOeuvreMappingInfo["capData_genreoeuvre_mappingtype"])) { $genreOeuvreMappingType = $capDataGenreOeuvreMappingInfo["capData_genreoeuvre_mappingtype"]; $referenceGenreOeuvreUrl = ""; - if($genreOeuvreMappingType == "taxo" && $genreOeuvreItem instanceof \Drupal\taxonomy\TermInterface){ + if ($genreOeuvreMappingType == "taxo" && $genreOeuvreItem instanceof TermInterface) { $referenceGenreOeuvreUrl = $host . "/taxonomy/term/" . $referenceGenreOeuvreId; - }elseif($genreOeuvreMappingType == "content" && $genreOeuvreItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($genreOeuvreMappingType == "content" && $genreOeuvreItem instanceof NodeInterface) { $referenceGenreOeuvreUrl = $host . "/node/" . $referenceGenreOeuvreId; } - if(!empty($referenceGenreOeuvreUrl)){ + if (!empty($referenceGenreOeuvreUrl)) { $genresOeuvreArray[] = new ExternalThing($referenceGenreOeuvreUrl); } } @@ -7421,42 +7831,46 @@ class CapDataConnectorManager { if (!empty($genresOeuvreArray)) { $graphItem->setGenreOeuvre($genresOeuvreArray); } - } + } /** * Set Type Oeuvre property. - * + * * @param mixed $graphItem + * Graph Item. * @param array $capDataTypeOeuvreMappingInfo + * CapData type oeuvre mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setTypeOeuvreCapdataProperty($graphItem, $capDataTypeOeuvreMappingInfo, $currentCapdataClassMappingInfo): void { - $typesOeuvreArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $typesOeuvreArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["type_oeuvre"])){ - if(!empty($exportClassCapdataProperties["type_oeuvre"]["property_".$mappingType."_fields_dropdown"])){ - $typeOeuvreFieldName = $exportClassCapdataProperties["type_oeuvre"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["type_oeuvre"])) { + if (!empty($exportClassCapdataProperties["type_oeuvre"]["property_" . $mappingType . "_fields_dropdown"])) { + $typeOeuvreFieldName = $exportClassCapdataProperties["type_oeuvre"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($typeOeuvreFieldName) && !$mappedEntity->get($typeOeuvreFieldName)->isEmpty()) { $typeOeuvreItems = $mappedEntity->get($typeOeuvreFieldName); foreach ($typeOeuvreItems as $referenceTypeOeuvre) { $typeOeuvreItem = $referenceTypeOeuvre->entity; - if(!empty($typeOeuvreItem)){ - $referenceTypeOeuvreId = $typeOeuvreItem->id(); - if(!empty($capDataTypeOeuvreMappingInfo)){ - if(!empty($capDataTypeOeuvreMappingInfo["capData_typeoeuvre_mappingtype"])){ + if (!empty($typeOeuvreItem)) { + $referenceTypeOeuvreId = $typeOeuvreItem->id(); + if (!empty($capDataTypeOeuvreMappingInfo)) { + if (!empty($capDataTypeOeuvreMappingInfo["capData_typeoeuvre_mappingtype"])) { $typeOeuvreMappingType = $capDataTypeOeuvreMappingInfo["capData_typeoeuvre_mappingtype"]; $referenceTypeOeuvreUrl = ""; - if($typeOeuvreMappingType == "taxo" && $typeOeuvreItem instanceof \Drupal\taxonomy\TermInterface){ + if ($typeOeuvreMappingType == "taxo" && $typeOeuvreItem instanceof TermInterface) { $referenceTypeOeuvreUrl = $host . "/taxonomy/term/" . $referenceTypeOeuvreId; - }elseif($typeOeuvreMappingType == "content" && $typeOeuvreItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($typeOeuvreMappingType == "content" && $typeOeuvreItem instanceof NodeInterface) { $referenceTypeOeuvreUrl = $host . "/node/" . $referenceTypeOeuvreId; } - if(!empty($referenceTypeOeuvreUrl)){ + if (!empty($referenceTypeOeuvreUrl)) { $typesOeuvreArray[] = new ExternalThing($referenceTypeOeuvreUrl); } } @@ -7475,38 +7889,42 @@ class CapDataConnectorManager { /** * Set Personnage Capdata property. - * + * * @param mixed $graphItem + * Graph item. * @param array $capDataRoleMappingInfo + * CapData role mapping info. * @param array $currentCapdataClassMappingInfo + * Current Capdata class mapping info. */ public function setPersonnageCapdataProperty($graphItem, $capDataRoleMappingInfo, $currentCapdataClassMappingInfo): void { - $personnagesArray = null; - if(!empty($currentCapdataClassMappingInfo)){ - $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; + $personnagesArray = NULL; + if (!empty($currentCapdataClassMappingInfo)) { + $exportClassCapdataProperties = $currentCapdataClassMappingInfo["mapped_entity_properties"]; $mappingType = $currentCapdataClassMappingInfo["mapping_type"]; $mappedEntity = $currentCapdataClassMappingInfo["mapped_entity"]; $host = $currentCapdataClassMappingInfo["host"]; - if(!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)){ - if(isset($exportClassCapdataProperties["personnage"])){ - if(!empty($exportClassCapdataProperties["personnage"]["property_".$mappingType."_fields_dropdown"])){ - $personnageFieldName = $exportClassCapdataProperties["personnage"]["property_".$mappingType."_fields_dropdown"]; + if (!empty($mappedEntity) && !empty($mappingType) && !empty($exportClassCapdataProperties)) { + if (isset($exportClassCapdataProperties["personnage"])) { + if (!empty($exportClassCapdataProperties["personnage"]["property_" . $mappingType . "_fields_dropdown"])) { + $personnageFieldName = $exportClassCapdataProperties["personnage"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($personnageFieldName) && !$mappedEntity->get($personnageFieldName)->isEmpty()) { $personnageItems = $mappedEntity->get($personnageFieldName); foreach ($personnageItems as $referencePersonnage) { $personnageItem = $referencePersonnage->entity; - if(!empty($personnageItem)){ - $referencePersonnageId = $personnageItem->id(); - if(!empty($capDataRoleMappingInfo)){ - if(!empty($capDataRoleMappingInfo["capData_role_mappingtype"])){ + if (!empty($personnageItem)) { + $referencePersonnageId = $personnageItem->id(); + if (!empty($capDataRoleMappingInfo)) { + if (!empty($capDataRoleMappingInfo["capData_role_mappingtype"])) { $roleMappingType = $capDataRoleMappingInfo["capData_role_mappingtype"]; $referencePersonnageUrl = ""; - if($roleMappingType == "taxo" && $personnageItem instanceof \Drupal\taxonomy\TermInterface){ + if ($roleMappingType == "taxo" && $personnageItem instanceof TermInterface) { $referencePersonnageUrl = $host . "/taxonomy/term/" . $referencePersonnageId; - }elseif($roleMappingType == "content" && $personnageItem instanceof \Drupal\node\NodeInterface){ + } + elseif ($roleMappingType == "content" && $personnageItem instanceof NodeInterface) { $referencePersonnageUrl = $host . "/node/" . $referencePersonnageId; } - if(!empty($referencePersonnageUrl)){ + if (!empty($referencePersonnageUrl)) { $personnagesArray[] = new ExternalThing($referencePersonnageUrl); } } @@ -7525,23 +7943,27 @@ class CapDataConnectorManager { /** * Set Oeuvre titreFormeRejet, intrigue, source livret Capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ - public function setOeuvreDetails($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Titre form rejet + public function setOeuvreDetails($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { + // Titre form rejet. $titreFormeRejet = ""; - if(isset($exportClassCapdataProperties["titre_forme_rejet"])){ - if(!empty($exportClassCapdataProperties["titre_forme_rejet"]["property_".$mappingType."_fields_dropdown"])){ - $titreFormeRejetFieldName = $exportClassCapdataProperties["titre_forme_rejet"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($titreFormeRejetFieldName) && !$mappedEntity->get($titreFormeRejetFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["titre_forme_rejet"])) { + if (!empty($exportClassCapdataProperties["titre_forme_rejet"]["property_" . $mappingType . "_fields_dropdown"])) { + $titreFormeRejetFieldName = $exportClassCapdataProperties["titre_forme_rejet"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($titreFormeRejetFieldName) && !$mappedEntity->get($titreFormeRejetFieldName)->isEmpty()) { $titreFormeRejet = $mappedEntity->get($titreFormeRejetFieldName)->value; - if(!empty($titreFormeRejet)){ - if(!empty($exportClassCapdataProperties["titre_forme_rejet"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["titre_forme_rejet"]["property_".$mappingType."_custom_processing"]; + if (!empty($titreFormeRejet)) { + if (!empty($exportClassCapdataProperties["titre_forme_rejet"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["titre_forme_rejet"]["property_" . $mappingType . "_custom_processing"]; $titreFormeRejet = $this->customFieldProcessing($titreFormeRejet, $customProcessing); } $graphItem->setTitreFormeRejet($titreFormeRejet); @@ -7550,16 +7972,16 @@ class CapDataConnectorManager { } } - // Intrigue + // Intrigue. $intrigue = ""; - if(isset($exportClassCapdataProperties["intrigue"])){ - if(!empty($exportClassCapdataProperties["intrigue"]["property_".$mappingType."_fields_dropdown"])){ - $intrigueFieldName = $exportClassCapdataProperties["intrigue"]["property_".$mappingType."_fields_dropdown"]; - if($mappedEntity->hasField($intrigueFieldName) && !$mappedEntity->get($intrigueFieldName)->isEmpty()){ + if (isset($exportClassCapdataProperties["intrigue"])) { + if (!empty($exportClassCapdataProperties["intrigue"]["property_" . $mappingType . "_fields_dropdown"])) { + $intrigueFieldName = $exportClassCapdataProperties["intrigue"]["property_" . $mappingType . "_fields_dropdown"]; + if ($mappedEntity->hasField($intrigueFieldName) && !$mappedEntity->get($intrigueFieldName)->isEmpty()) { $intrigue = $mappedEntity->get($intrigueFieldName)->value; - if(!empty($intrigue)){ - if(!empty($exportClassCapdataProperties["intrigue"]["property_".$mappingType."_custom_processing"])){ - $customProcessing = $exportClassCapdataProperties["intrigue"]["property_".$mappingType."_custom_processing"]; + if (!empty($intrigue)) { + if (!empty($exportClassCapdataProperties["intrigue"]["property_" . $mappingType . "_custom_processing"])) { + $customProcessing = $exportClassCapdataProperties["intrigue"]["property_" . $mappingType . "_custom_processing"]; $intrigue = $this->customFieldProcessing($intrigue, $customProcessing); } $graphItem->setIntrigue($intrigue); @@ -7571,83 +7993,96 @@ class CapDataConnectorManager { /** * Set Date de creation, duree capdata Properties. - * + * * @param mixed $graphItem + * Graph item. * @param \Drupal\taxonomy\TermInterface|\Drupal\node\NodeInterface $mappedEntity + * Mapped entity. * @param array $exportClassCapdataProperties + * Export class Capdata properties. * @param string $mappingType + * Mapping type. */ public function setOeuvreDatesCapdataProperties($graphItem, $mappedEntity, $exportClassCapdataProperties, $mappingType): void { - // Date de création - $creationDateObj =""; - if ($mappedEntity instanceof \Drupal\taxonomy\TermInterface) { + // Date de création. + $creationDateObj = ""; + if ($mappedEntity instanceof TermInterface) { // $mappedEntity is a taxonomy term - $creationDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->changed->value); - }else{ - $creationDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->created->value); + $creationDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->changed->value); } - if(isset($exportClassCapdataProperties["date_creation"])){ - if(!empty($exportClassCapdataProperties["date_creation"]["property_".$mappingType."_fields_dropdown"])){ - $dateCreationFieldName = $exportClassCapdataProperties["date_creation"]["property_".$mappingType."_fields_dropdown"]; + else { + $creationDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->created->value); + } + if (isset($exportClassCapdataProperties["date_creation"])) { + if (!empty($exportClassCapdataProperties["date_creation"]["property_" . $mappingType . "_fields_dropdown"])) { + $dateCreationFieldName = $exportClassCapdataProperties["date_creation"]["property_" . $mappingType . "_fields_dropdown"]; if ($mappedEntity->hasField($dateCreationFieldName) && !$mappedEntity->get($dateCreationFieldName)->isEmpty()) { - if(!empty($mappedEntity->get($dateCreationFieldName)->date)){ + if (!empty($mappedEntity->get($dateCreationFieldName)->date)) { $creationDateObj = $mappedEntity->get($dateCreationFieldName)->date; - }else{ - // timestamp field - $creationDateObj = DrupalDateTime::createFromTimestamp((int)$mappedEntity->get($dateCreationFieldName)->value); + } + else { + // Timestamp field. + $creationDateObj = DrupalDateTime::createFromTimestamp((int) $mappedEntity->get($dateCreationFieldName)->value); } } } } $creationDate = ""; - if(!empty($creationDateObj)){ + if (!empty($creationDateObj)) { $creationDateObj->setTimezone(new \DateTimeZone('UTC')); $creationDate = $creationDateObj->format('Y-m-d\TH:i:s\Z'); - if(!empty($creationDate)){ + if (!empty($creationDate)) { $graphItem->setDateDeCreation($creationDate); - } + } } } /** * Clean URL. - * + * * @param string $url - * + * The URL. + * * @return string + * The cleaned URL. */ - private function cleanUrl($url){ - $cleanUrl = ''; - - if (UrlHelper::isValid($url, true)) { - $cleanUrl = $url; - } else { - $url = "https://" . $url; - if (UrlHelper::isValid($url, true)) { - $cleanUrl = $url; - } + private function cleanUrl($url) { + $cleanUrl = ''; + + if (UrlHelper::isValid($url, TRUE)) { + $cleanUrl = $url; + } + else { + $url = "https://" . $url; + if (UrlHelper::isValid($url, TRUE)) { + $cleanUrl = $url; } - return $cleanUrl; + } + return $cleanUrl; } /** * Custom Field Processing. - * + * * @param string $fieldValue + * The field value. * @param string $customProcessing - * + * The custom processing type. + * * @return string + * The processed value. */ - private function customFieldProcessing($fieldValue, $customProcessing){ + private function customFieldProcessing($fieldValue, $customProcessing) { $processedValue = $fieldValue; switch ($customProcessing) { case 'remove_tags': - $processedValue = Html::decodeEntities(strip_tags($fieldValue)); - break; + $processedValue = Html::decodeEntities(strip_tags($fieldValue)); + break; + default: - break; + break; } return $processedValue; } -} \ No newline at end of file +} diff --git a/src/Commands/CapdataConnectorCommands.php b/src/Commands/CapdataConnectorCommands.php index 80a9d001af4df1d54ed123c73a5746ce02cd9e13..5776fbab18412ba47a4b6aed619146bf42c29fb6 100644 --- a/src/Commands/CapdataConnectorCommands.php +++ b/src/Commands/CapdataConnectorCommands.php @@ -2,8 +2,8 @@ namespace Drupal\capdata_connector\Commands; -use Drush\Commands\DrushCommands; use Drupal\capdata_connector\CapDataConnectorManager; +use Drush\Commands\DrushCommands; /** * A Drush commandfile. @@ -16,55 +16,55 @@ use Drupal\capdata_connector\CapDataConnectorManager; * - http://cgit.drupalcode.org/devel/tree/src/Commands/DevelCommands.php * - http://cgit.drupalcode.org/devel/tree/drush.services.yml */ -class CapdataConnectorCommands extends DrushCommands -{ +class CapdataConnectorCommands extends DrushCommands { - /** - * The CapData Connector manager. - * - * @var \Drupal\capdata_connector\CapDataConnectorManager - */ - protected $capdataConnectorManager; + /** + * The CapData Connector manager. + * + * @var \Drupal\capdata_connector\CapDataConnectorManager + */ + protected $capdataConnectorManager; - /** - * CapdataConnectorCommands constructor. - * - * @param \Drupal\capdata_connector\CapDataConnectorManager $capdata_connector_manager - * The CapData Connector manager. - */ - public function __construct(CapDataConnectorManager $capdata_connector_manager) { - $this->capdataConnectorManager = $capdata_connector_manager; - } + /** + * CapdataConnectorCommands constructor. + * + * @param \Drupal\capdata_connector\CapDataConnectorManager $capdata_connector_manager + * The CapData Connector manager. + */ + public function __construct(CapDataConnectorManager $capdata_connector_manager) { + $this->capdataConnectorManager = $capdata_connector_manager; + } + + /** + * Generate RDF data export file (capdata-export.rdf). + * + * @command capdata_connector:rdf-export + * @aliases capdata-rdf-export + */ + public function rdfExport() { + $this->logger()->notice('Starting export.'); - /** - * Generate RDF data export file (capdata-export.rdf). - * - * @command capdata_connector:rdf-export - * @aliases capdata-rdf-export - */ - public function rdfExport() - { - $this->logger()->notice('Starting export.'); + $data = $this->capdataConnectorManager->dataExport(); + $file = getcwd() . '/.well-known/capdata-export.rdf'; + $compressedFile = $file . '.gz'; - $data = $this->capdataConnectorManager->dataExport(); - $file = getcwd() . '/.well-known/capdata-export.rdf'; - $compressedFile = $file . '.gz'; + if (file_put_contents($file, $data)) { + $this->logger()->notice('File capdata-export.rdf generated.'); - if (file_put_contents($file, $data)) { - $this->logger()->notice('File capdata-export.rdf generated.'); - - // Open the gz file (w9 is the highest compression) - $fp = gzopen($compressedFile, 'w9'); - - // Compress the file - gzwrite($fp, file_get_contents($file)); - - // Close the gz file - gzclose($fp); + // Open the gz file (w9 is the highest compression) + $fp = gzopen($compressedFile, 'w9'); - $this->logger()->notice('File capdata-export.rdf compressed.'); - } else { - $this->logger()->error('File capdata-export.rdf could not be generated.'); - } + // Compress the file. + gzwrite($fp, file_get_contents($file)); + + // Close the gz file. + gzclose($fp); + + $this->logger()->notice('File capdata-export.rdf compressed.'); } + else { + $this->logger()->error('File capdata-export.rdf could not be generated.'); + } + } + } diff --git a/src/Controller/RofExportController.php b/src/Controller/RofExportController.php index 66127ee321ad2564eed8bcad9ac2ccfff1d42b34..68573fe6f5b225f3bfbbfad930f11d39236d8505 100644 --- a/src/Controller/RofExportController.php +++ b/src/Controller/RofExportController.php @@ -2,73 +2,74 @@ namespace Drupal\capdata_connector\Controller; -use Drupal\Core\Controller\ControllerBase; use Drupal\capdata_connector\CapDataConnectorManager; +use Drupal\Core\Controller\ControllerBase; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\HeaderUtils; +use Symfony\Component\HttpFoundation\Response; /** * Returns responses for rof export routes. */ class RofExportController extends ControllerBase { - /** - * The CapData Connector manager. - * - * @var \Drupal\capdata_connector\CapDataConnectorManager - */ - protected $capdataConnectorManager; + /** + * The CapData Connector manager. + * + * @var \Drupal\capdata_connector\CapDataConnectorManager + */ + protected $capdataConnectorManager; - /** - * RofExportController constructor. - * - * @param \Drupal\capdata_connector\CapDataConnectorManager $capdata_connector_manager - * The CapData Connector manager. - */ - public function __construct(CapDataConnectorManager $capdata_connector_manager) { - $this->capdataConnectorManager = $capdata_connector_manager; - } + /** + * RofExportController constructor. + * + * @param \Drupal\capdata_connector\CapDataConnectorManager $capdata_connector_manager + * The CapData Connector manager. + */ + public function __construct(CapDataConnectorManager $capdata_connector_manager) { + $this->capdataConnectorManager = $capdata_connector_manager; + } - /** - * {@inheritdoc} - * - * @param \Symfony\Component\DependencyInjection\ContainerInterface $container - * The Drupal service container. - * - * @return static - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('capdata_connector.capdata_manager') - ); - } + /** + * {@inheritdoc} + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * The Drupal service container. + * + * @return static + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('capdata_connector.capdata_manager') + ); + } - /** - * Builds the RDF export response. - */ - public function capdataRdfExport() { - $data = ''; - $file = getcwd() . '/.well-known/capdata-export.rdf'; + /** + * Builds the RDF export response. + */ + public function capdataRdfExport() { + $data = ''; + $file = getcwd() . '/.well-known/capdata-export.rdf'; - if (file_exists($file)) { - $data = file_get_contents($file); - } + if (file_exists($file)) { + $data = file_get_contents($file); + } - if (empty($data)) { - $data = $this->capdataConnectorManager->dataExport(); - } + if (empty($data)) { + $data = $this->capdataConnectorManager->dataExport(); + } - $response = new Response(); - $response->setContent($data); + $response = new Response(); + $response->setContent($data); - $response->headers->set('Content-Type', 'application/rdf+xml'); - $disposition = HeaderUtils::makeDisposition( - HeaderUtils::DISPOSITION_ATTACHMENT, - 'capdata-export.rdf' - ); - $response->headers->set('Content-Disposition', $disposition); + $response->headers->set('Content-Type', 'application/rdf+xml'); + $disposition = HeaderUtils::makeDisposition( + HeaderUtils::DISPOSITION_ATTACHMENT, + 'capdata-export.rdf' + ); + $response->headers->set('Content-Disposition', $disposition); - return $response; - } -} \ No newline at end of file + return $response; + } + +} diff --git a/src/Form/CapDataConnectorSettingsForm.php b/src/Form/CapDataConnectorSettingsForm.php index 06c659eaff0146e6c874f3c48d1a6eb5f3de91be..d26384c3a88f83a5934e254038301f58f0929c6d 100644 --- a/src/Form/CapDataConnectorSettingsForm.php +++ b/src/Form/CapDataConnectorSettingsForm.php @@ -2,11 +2,11 @@ namespace Drupal\capdata_connector\Form; +use Drupal\capdata_connector\CapDataConnectorManager; +use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Config\ConfigFactoryInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\capdata_connector\CapDataConnectorManager; use Symfony\Component\HttpFoundation\RequestStack; /** @@ -26,7 +26,7 @@ class CapDataConnectorSettingsForm extends ConfigFormBase { * * @var \Symfony\Component\HttpFoundation\RequestStack */ - protected $requestStack; + protected $requestStack; /** * CapData Connector Settings form constructor. @@ -87,8 +87,8 @@ class CapDataConnectorSettingsForm extends ConfigFormBase { */ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('capdata_connector.settings'); - $taxonomiesArray = $this->capdataConnectorManager->getVocabularyList(); - $contentTypesArray = $this->capdataConnectorManager->getContentTypesList(); + $taxonomiesArray = $this->capdataConnectorManager->getVocabularyList(); + $contentTypesArray = $this->capdataConnectorManager->getContentTypesList(); $capDataClasses = $this->capdataConnectorManager->getCapDataClassesInfo(); $form['capdata_opera_url'] = [ @@ -99,30 +99,33 @@ class CapDataConnectorSettingsForm extends ConfigFormBase { ]; foreach ($capDataClasses as $capDataClassUniqueId => $capDataClassFullData) { - $form[$capDataClassUniqueId.'_info'] = [ + $form[$capDataClassUniqueId . '_info'] = [ '#type' => 'details', - '#title' => $this->t($capDataClassFullData['capdata_full_name']), + '#title' => $capDataClassFullData['capdata_full_name'], '#weight' => 1, '#collapsible' => TRUE, ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_include_in_export'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_include_in_export'] = [ '#type' => 'checkbox', '#title' => $this->t("Inclure cette classe dans l'export"), - '#default_value' => $config->get($capDataClassUniqueId.'_include_in_export'), - '#description' => $this->t("Cocher cette case pour inclure cette classe dans l'export au format RDF") + '#default_value' => $config->get($capDataClassUniqueId . '_include_in_export'), + '#description' => $this->t("Cocher cette case pour inclure cette classe dans l'export au format RDF"), ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_mapping_type'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_mapping_type'] = [ '#type' => 'radios', '#title' => $this->t('Mapper cette classe à une entité Drupal:'), '#options' => [ - $capDataClassUniqueId.'_taxo_mapping' => $this->t('Taxonomie'), - $capDataClassUniqueId.'_content_mapping' => $this->t('Type de contenu'), + $capDataClassUniqueId . '_taxo_mapping' => $this->t('Taxonomie'), + $capDataClassUniqueId . '_content_mapping' => $this->t('Type de contenu'), + ], + '#default_value' => $config->get($capDataClassUniqueId . '_mapping_type'), + '#attributes' => [ + 'data-capdata-class-identifier' => $capDataClassUniqueId, + 'data-capdata-trigger-identifier' => $capDataClassUniqueId . "_mapping_type_trigger", ], - '#default_value' => $config->get($capDataClassUniqueId.'_mapping_type'), - '#attributes' => ['data-capdata-class-identifier' => $capDataClassUniqueId, 'data-capdata-trigger-identifier' => $capDataClassUniqueId."_mapping_type_trigger"], '#ajax' => [ 'callback' => '::capdataWrapperInfoCallback', - 'wrapper' => $capDataClassFullData['capdata_short_id'].'-info-wrapper', + 'wrapper' => $capDataClassFullData['capdata_short_id'] . '-info-wrapper', 'progress' => [ 'type' => 'throbber', 'message' => $this->t('Chargement en cours...'), @@ -131,165 +134,177 @@ class CapDataConnectorSettingsForm extends ConfigFormBase { ]; $selectedMappingType = ""; - if (!empty($form_state->getValues())){ - $selectedMappingType = $form_state->getValue($capDataClassUniqueId.'_mapping_type'); - }else{ - $selectedMappingType = $config->get($capDataClassUniqueId.'_mapping_type'); + if (!empty($form_state->getValues())) { + $selectedMappingType = $form_state->getValue($capDataClassUniqueId . '_mapping_type'); + } + else { + $selectedMappingType = $config->get($capDataClassUniqueId . '_mapping_type'); } - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'] = [ '#type' => 'container', - '#attributes' => ['id' => $capDataClassFullData['capdata_short_id'].'-info-wrapper'], + '#attributes' => ['id' => $capDataClassFullData['capdata_short_id'] . '-info-wrapper'], ]; - if(!empty($selectedMappingType)){ - if($selectedMappingType == $capDataClassUniqueId."_taxo_mapping"){ - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_taxonomy_dropdown'] = [ + if (!empty($selectedMappingType)) { + if ($selectedMappingType == $capDataClassUniqueId . "_taxo_mapping") { + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_taxonomy_dropdown'] = [ '#type' => 'select', - '#title' => $this->t('Choisir la taxonomie correspondante:'), + '#title' => $this->t('Choisir la taxonomie correspondante:'), '#options' => $taxonomiesArray, '#empty_option' => $this->t('-Sélectionner-'), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_taxonomy_dropdown')) ? $form_state->getValue($capDataClassUniqueId.'_taxonomy_dropdown') : $config->get($capDataClassUniqueId.'_taxonomy_dropdown'), - '#attributes' => ['data-capdata-class-identifier' => $capDataClassUniqueId, 'data-capdata-trigger-identifier' => $capDataClassUniqueId."_taxonomy_dropdown_trigger"], - // Il va falloir charger les champs de la taxonomie sélectionnée + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_taxonomy_dropdown')) ? $form_state->getValue($capDataClassUniqueId . '_taxonomy_dropdown') : $config->get($capDataClassUniqueId . '_taxonomy_dropdown'), + '#attributes' => [ + 'data-capdata-class-identifier' => $capDataClassUniqueId, + 'data-capdata-trigger-identifier' => $capDataClassUniqueId . "_taxonomy_dropdown_trigger", + ], + // Il va falloir charger les champs de la taxonomie sélectionnée. '#ajax' => [ 'callback' => '::capdataTaxonomyFieldsDropdownCallback', - 'wrapper' => $capDataClassFullData['capdata_short_id'].'-properties-mappingcontainer', + 'wrapper' => $capDataClassFullData['capdata_short_id'] . '-properties-mappingcontainer', ], ]; - // Mapping des propriétés de la classe CapData aux champs de la taxonomie sélectionnée. - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'] = [ + // Mapping des propriétés de la classe CapData + // aux champs de la taxonomie sélectionnée. + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'] = [ '#type' => 'details', - '#title' => $this->t("Mapping des champs de la classe ".$capDataClassFullData['capdata_full_name']), + '#title' => $this->t("Mapping des champs de la classe") . " " . $capDataClassFullData['capdata_full_name'], '#collapsible' => TRUE, ]; $selectedTaxonomy = ""; - if (!empty($form_state->getValues())){ - $selectedTaxonomy = $form_state->getValue($capDataClassUniqueId.'_taxonomy_dropdown'); + if (!empty($form_state->getValues())) { + $selectedTaxonomy = $form_state->getValue($capDataClassUniqueId . '_taxonomy_dropdown'); $triggering_element = $form_state->getTriggeringElement(); - if(!empty($triggering_element)){ + if (!empty($triggering_element)) { $triggeringElementIdentifier = $triggering_element['#attributes']['data-capdata-trigger-identifier']; - if(!empty($triggeringElementIdentifier)){ - if($triggeringElementIdentifier == $capDataClassUniqueId."_mapping_type_trigger" && empty($selectedTaxonomy)){ - $selectedTaxonomy = $config->get($capDataClassUniqueId.'_taxonomy_dropdown'); + if (!empty($triggeringElementIdentifier)) { + if ($triggeringElementIdentifier == $capDataClassUniqueId . "_mapping_type_trigger" && empty($selectedTaxonomy)) { + $selectedTaxonomy = $config->get($capDataClassUniqueId . '_taxonomy_dropdown'); } } } - }else{ - $selectedTaxonomy = $config->get($capDataClassUniqueId.'_taxonomy_dropdown'); + } + else { + $selectedTaxonomy = $config->get($capDataClassUniqueId . '_taxonomy_dropdown'); } - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'] = [ '#type' => 'container', - '#attributes' => ['id' => $capDataClassFullData['capdata_short_id'].'-properties-mappingcontainer'], + '#attributes' => ['id' => $capDataClassFullData['capdata_short_id'] . '-properties-mappingcontainer'], ]; if (!empty($selectedTaxonomy)) { - foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { + foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { // Propriété 1, Propriété 2, etc. - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'] = [ '#type' => 'fieldset', '#attributes' => [ - 'class' => ['single-capdata-property-fieldset'] + 'class' => ['single-capdata-property-fieldset'], ], ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_taxo_'.$propertyKey.'_name'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_taxo_' . $propertyKey . '_name'] = [ '#type' => 'markup', - '#markup' => '<strong>'.$this->t($propertyName).': </strong>', + '#markup' => '<strong>' . $propertyName . ': </strong>', ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown'] = [ '#type' => 'select', - '#title' => $this->t('Choisir un champ de la taxonomie <br>'). $taxonomiesArray[$selectedTaxonomy], + '#title' => $this->t('Choisir un champ de la taxonomie <br>') . $taxonomiesArray[$selectedTaxonomy], '#options' => $this->capdataConnectorManager->getFieldsOptionsByTaxonomy($selectedTaxonomy), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown')) ? $form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown') : $config->get($capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown'), + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown')) ? $form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown') : $config->get($capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown'), '#empty_option' => $this->t('-Sélectionner-'), ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing'] = [ '#type' => 'select', '#title' => $this->t('Choisir un traitement spécifique <br> pour la valeur de ce champ'), '#options' => $this->capdataConnectorManager->getSpecialProcessingOptions(), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing')) ? $form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing') : $config->get($capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing'), + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing')) ? $form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing') : $config->get($capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing'), '#empty_option' => $this->t('-Sélectionner-'), ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments'] = [ '#type' => 'textarea', '#title' => $this->t('Commentaire'), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments')) ? $form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments') : $config->get($capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments'), + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments')) ? $form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments') : $config->get($capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments'), '#description' => $this->t('Commentaires supplémentaires'), ]; } } - }elseif($selectedMappingType == $capDataClassUniqueId."_content_mapping"){ - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_content_dropdown'] = [ + } + elseif ($selectedMappingType == $capDataClassUniqueId . "_content_mapping") { + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_content_dropdown'] = [ '#type' => 'select', - '#title' => $this->t('Choisir le type de contenu correspondant:'), + '#title' => $this->t('Choisir le type de contenu correspondant:'), '#options' => $contentTypesArray, '#empty_option' => $this->t('-Sélectionner-'), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_content_dropdown')) ? $form_state->getValue($capDataClassUniqueId.'_content_dropdown') : $config->get($capDataClassUniqueId.'_content_dropdown'), - '#attributes' => ['data-capdata-class-identifier' => $capDataClassUniqueId, 'data-capdata-trigger-identifier' => $capDataClassUniqueId."_content_dropdown_trigger"], - // Il va falloir charger les champs du type de contenu sélectionné + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_content_dropdown')) ? $form_state->getValue($capDataClassUniqueId . '_content_dropdown') : $config->get($capDataClassUniqueId . '_content_dropdown'), + '#attributes' => [ + 'data-capdata-class-identifier' => $capDataClassUniqueId, + 'data-capdata-trigger-identifier' => $capDataClassUniqueId . "_content_dropdown_trigger", + ], + // Il va falloir charger les champs du type de contenu sélectionné. '#ajax' => [ 'callback' => '::capdataContentFieldsDropdownCallback', - 'wrapper' => $capDataClassFullData['capdata_short_id'].'-properties-mappingcontainer', + 'wrapper' => $capDataClassFullData['capdata_short_id'] . '-properties-mappingcontainer', ], ]; - // Mapping des propriétés de la classe CapData aux champs du type de contenu sélectionné. - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'] = [ + // Mapping des propriétés de la classe CapData + // aux champs du type de contenu sélectionné. + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'] = [ '#type' => 'details', - '#title' => $this->t("Mapping des champs de la classe ".$capDataClassFullData['capdata_full_name']), + '#title' => $this->t("Mapping des champs de la classe") . " " . $capDataClassFullData['capdata_full_name'], '#collapsible' => TRUE, ]; $selectedContentType = ""; - if (!empty($form_state->getValues())){ - $selectedContentType = $form_state->getValue($capDataClassUniqueId.'_content_dropdown'); + if (!empty($form_state->getValues())) { + $selectedContentType = $form_state->getValue($capDataClassUniqueId . '_content_dropdown'); $triggering_element = $form_state->getTriggeringElement(); - if(!empty($triggering_element)){ + if (!empty($triggering_element)) { $triggeringElementIdentifier = $triggering_element['#attributes']['data-capdata-trigger-identifier']; - if(!empty($triggeringElementIdentifier)){ - if($triggeringElementIdentifier == $capDataClassUniqueId."_mapping_type_trigger" && empty($selectedContentType)){ - $selectedContentType = $config->get($capDataClassUniqueId.'_content_dropdown'); + if (!empty($triggeringElementIdentifier)) { + if ($triggeringElementIdentifier == $capDataClassUniqueId . "_mapping_type_trigger" && empty($selectedContentType)) { + $selectedContentType = $config->get($capDataClassUniqueId . '_content_dropdown'); } } } - }else{ - $selectedContentType = $config->get($capDataClassUniqueId.'_content_dropdown'); + } + else { + $selectedContentType = $config->get($capDataClassUniqueId . '_content_dropdown'); } - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'] = [ '#type' => 'container', - '#attributes' => ['id' => $capDataClassFullData['capdata_short_id'].'-properties-mappingcontainer'], + '#attributes' => ['id' => $capDataClassFullData['capdata_short_id'] . '-properties-mappingcontainer'], ]; if (!empty($selectedContentType)) { - foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { + foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { // Propriété 1, Propriété 2, etc. - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'] = [ '#type' => 'fieldset', '#attributes' => [ - 'class' => ['single-capdata-property-fieldset'] + 'class' => ['single-capdata-property-fieldset'], ], ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_content_'.$propertyKey.'_name'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_content_' . $propertyKey . '_name'] = [ '#type' => 'markup', - '#markup' => '<strong>'.$this->t($propertyName).': </strong>', + '#markup' => '<strong>' . $propertyName . ': </strong>', ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown'] = [ '#type' => 'select', - '#title' => $this->t('Choisir un champ du type de contenu <br> '). $contentTypesArray[$selectedContentType], + '#title' => $this->t('Choisir un champ du type de contenu <br>') . ' ' . $contentTypesArray[$selectedContentType], '#options' => $this->capdataConnectorManager->getFieldsOptionsByContentType($selectedContentType), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown')) ? $form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown') : $config->get($capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown'), + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown')) ? $form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown') : $config->get($capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown'), '#empty_option' => $this->t('-Sélectionner-'), ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing'] = [ '#type' => 'select', '#title' => $this->t('Choisir un traitement spécifique <br> pour la valeur de ce champ'), '#options' => $this->capdataConnectorManager->getSpecialProcessingOptions(), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing')) ? $form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing') : $config->get($capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing'), + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing')) ? $form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing') : $config->get($capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing'), '#empty_option' => $this->t('-Sélectionner-'), ]; - $form[$capDataClassUniqueId.'_info'][$capDataClassUniqueId.'_info_container'][$capDataClassUniqueId.'_properties_mapping'][$capDataClassUniqueId.'_properties_mapping_container'][$capDataClassUniqueId.'_'.$propertyKey.'_fieldset'][$capDataClassUniqueId.'_content_'.$propertyKey.'_comments'] = [ + $form[$capDataClassUniqueId . '_info'][$capDataClassUniqueId . '_info_container'][$capDataClassUniqueId . '_properties_mapping'][$capDataClassUniqueId . '_properties_mapping_container'][$capDataClassUniqueId . '_' . $propertyKey . '_fieldset'][$capDataClassUniqueId . '_content_' . $propertyKey . '_comments'] = [ '#type' => 'textarea', '#title' => $this->t('Commentaire'), - '#default_value' => !empty($form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_comments')) ? $form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_comments') : $config->get($capDataClassUniqueId.'_content_'.$propertyKey.'_comments'), + '#default_value' => !empty($form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_comments')) ? $form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_comments') : $config->get($capDataClassUniqueId . '_content_' . $propertyKey . '_comments'), '#description' => $this->t('Commentaires supplémentaires'), ]; } @@ -314,23 +329,23 @@ class CapDataConnectorSettingsForm extends ConfigFormBase { $capDataClasses = $this->capdataConnectorManager->getCapDataClassesInfo(); foreach ($capDataClasses as $capDataClassUniqueId => $capDataClassFullData) { $config - ->set($capDataClassUniqueId.'_include_in_export', $form_state->getValue($capDataClassUniqueId.'_include_in_export')) - ->set($capDataClassUniqueId.'_mapping_type', $form_state->getValue($capDataClassUniqueId.'_mapping_type')) - ->set($capDataClassUniqueId.'_taxonomy_dropdown', $form_state->getValue($capDataClassUniqueId.'_taxonomy_dropdown')) - ->set($capDataClassUniqueId.'_content_dropdown', $form_state->getValue($capDataClassUniqueId.'_content_dropdown')); - foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { - $config - ->set($capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown', $form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_fields_dropdown')) - ->set($capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing', $form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_custom_processing')) - ->set($capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments', $form_state->getValue($capDataClassUniqueId.'_taxo_'.$propertyKey.'_comments')) - ->set($capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown', $form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_fields_dropdown')) - ->set($capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing', $form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_custom_processing')) - ->set($capDataClassUniqueId.'_content_'.$propertyKey.'_comments', $form_state->getValue($capDataClassUniqueId.'_content_'.$propertyKey.'_comments')); + ->set($capDataClassUniqueId . '_include_in_export', $form_state->getValue($capDataClassUniqueId . '_include_in_export')) + ->set($capDataClassUniqueId . '_mapping_type', $form_state->getValue($capDataClassUniqueId . '_mapping_type')) + ->set($capDataClassUniqueId . '_taxonomy_dropdown', $form_state->getValue($capDataClassUniqueId . '_taxonomy_dropdown')) + ->set($capDataClassUniqueId . '_content_dropdown', $form_state->getValue($capDataClassUniqueId . '_content_dropdown')); + foreach ($capDataClassFullData['capdata_properties'] as $propertyKey => $propertyName) { + $config + ->set($capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown', $form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_fields_dropdown')) + ->set($capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing', $form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_custom_processing')) + ->set($capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments', $form_state->getValue($capDataClassUniqueId . '_taxo_' . $propertyKey . '_comments')) + ->set($capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown', $form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_fields_dropdown')) + ->set($capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing', $form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_custom_processing')) + ->set($capDataClassUniqueId . '_content_' . $propertyKey . '_comments', $form_state->getValue($capDataClassUniqueId . '_content_' . $propertyKey . '_comments')); } } $host = ""; $currentRequest = $this->requestStack->getCurrentRequest(); - if(!empty($currentRequest)){ + if (!empty($currentRequest)) { $host = $currentRequest->getSchemeAndHttpHost(); } $config->set('capdata_connector_host', $host); @@ -339,69 +354,80 @@ class CapDataConnectorSettingsForm extends ConfigFormBase { parent::submitForm($form, $form_state); } - - /** + * The Capdata Wrapper Info Callback. + * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * * @return array + * returned array */ public function capdataWrapperInfoCallback(array $form, FormStateInterface $form_state) { $triggeringElement = $form_state->getTriggeringElement(); - if(!empty($triggeringElement)){ + if (!empty($triggeringElement)) { $capdataClassIdAttr = $triggeringElement['#attributes']['data-capdata-class-identifier']; - $capdataClassId = $capdataClassIdAttr."_info"; - $capdataClassInfoContainer = $capdataClassIdAttr."_info_container"; + $capdataClassId = $capdataClassIdAttr . "_info"; + $capdataClassInfoContainer = $capdataClassIdAttr . "_info_container"; return $form[$capdataClassId][$capdataClassInfoContainer]; - }else{ + } + else { return []; } } /** + * The Capdata Taxonomy Fields Dropdown Callback. + * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * * @return array + * returned array */ public function capdataTaxonomyFieldsDropdownCallback(array $form, FormStateInterface $form_state) { $triggeringElement = $form_state->getTriggeringElement(); - if(!empty($triggeringElement)){ + if (!empty($triggeringElement)) { $capdataClassIdAttr = $triggeringElement['#attributes']['data-capdata-class-identifier']; - $capdataClassId = $capdataClassIdAttr."_info"; - $capdataClassInfoContainer = $capdataClassIdAttr."_info_container"; - $capdataClassPropertiesMapping = $capdataClassIdAttr."_properties_mapping"; - $capdataClassPropertiesMappingContainer = $capdataClassIdAttr."_properties_mapping_container"; + $capdataClassId = $capdataClassIdAttr . "_info"; + $capdataClassInfoContainer = $capdataClassIdAttr . "_info_container"; + $capdataClassPropertiesMapping = $capdataClassIdAttr . "_properties_mapping"; + $capdataClassPropertiesMappingContainer = $capdataClassIdAttr . "_properties_mapping_container"; return $form[$capdataClassId][$capdataClassInfoContainer][$capdataClassPropertiesMapping][$capdataClassPropertiesMappingContainer]; - }else{ + } + else { return []; } } /** + * The Capdata Content Fields Dropdown Callback. + * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * * @return array + * returned array */ public function capdataContentFieldsDropdownCallback(array $form, FormStateInterface $form_state) { $triggeringElement = $form_state->getTriggeringElement(); - if(!empty($triggeringElement)){ + if (!empty($triggeringElement)) { $capdataClassIdAttr = $triggeringElement['#attributes']['data-capdata-class-identifier']; - $capdataClassId = $capdataClassIdAttr."_info"; - $capdataClassInfoContainer = $capdataClassIdAttr."_info_container"; - $capdataClassPropertiesMapping = $capdataClassIdAttr."_properties_mapping"; - $capdataClassPropertiesMappingContainer = $capdataClassIdAttr."_properties_mapping_container"; + $capdataClassId = $capdataClassIdAttr . "_info"; + $capdataClassInfoContainer = $capdataClassIdAttr . "_info_container"; + $capdataClassPropertiesMapping = $capdataClassIdAttr . "_properties_mapping"; + $capdataClassPropertiesMappingContainer = $capdataClassIdAttr . "_properties_mapping_container"; return $form[$capdataClassId][$capdataClassInfoContainer][$capdataClassPropertiesMapping][$capdataClassPropertiesMappingContainer]; - }else{ + } + else { return []; } } -} \ No newline at end of file + +}