From 970332eefe4bca63f5b2ba7221dd4c0f0d5e880a Mon Sep 17 00:00:00 2001
From: Szymon Kasprzyk
Date: Mon, 6 Nov 2023 15:50:57 +0100
Subject: [PATCH] bioit provider update
---
.../vf-wp-intranet/acf-json/training.json | 47 ++++++++++++++++---
.../vf-wp-intranet/functions/bioit-feed.php | 11 ++++-
.../vf-summary--training-on-demand.php | 25 +++++++---
.../training/vf-summary--training-past.php | 25 +++++++---
.../training/vf-summary--training.php | 26 +++++++---
5 files changed, 105 insertions(+), 29 deletions(-)
diff --git a/wp-content/themes/vf-wp-intranet/acf-json/training.json b/wp-content/themes/vf-wp-intranet/acf-json/training.json
index a4efeccaf..4e5ce2c2e 100644
--- a/wp-content/themes/vf-wp-intranet/acf-json/training.json
+++ b/wp-content/themes/vf-wp-intranet/acf-json/training.json
@@ -483,7 +483,7 @@
]
],
"wrapper": {
- "width": "33",
+ "width": "25",
"class": "",
"id": ""
},
@@ -524,7 +524,7 @@
]
],
"wrapper": {
- "width": "33",
+ "width": "25",
"class": "",
"id": ""
},
@@ -560,7 +560,7 @@
]
],
"wrapper": {
- "width": "33",
+ "width": "25",
"class": "",
"id": ""
},
@@ -597,7 +597,7 @@
]
],
"wrapper": {
- "width": "33",
+ "width": "25",
"class": "",
"id": ""
},
@@ -615,6 +615,42 @@
"ajax": 0,
"placeholder": ""
},
+ {
+ "key": "field_6548f3a302c08",
+ "label": "EMBL Centre",
+ "name": "vf-wp-training-embl_centre",
+ "aria-label": "",
+ "type": "text",
+ "instructions": "for Bio-IT courses only",
+ "required": 0,
+ "conditional_logic": [
+ [
+ {
+ "field": "field_6540d05cdce6e",
+ "operator": "==",
+ "value": "live"
+ }
+ ],
+ [
+ {
+ "field": "field_6540d05cdce6e",
+ "operator": "==",
+ "value": "on-demand"
+ }
+ ]
+ ],
+ "wrapper": {
+ "width": "25",
+ "class": "",
+ "id": ""
+ },
+ "relevanssi_exclude": 0,
+ "default_value": "",
+ "maxlength": "",
+ "placeholder": "",
+ "prepend": "",
+ "append": ""
+ },
{
"key": "field_642d4b84d03ad",
"label": "One line overview of course",
@@ -832,6 +868,5 @@
"hide_on_screen": "",
"active": true,
"description": "",
- "show_in_rest": 0,
- "modified": 1698764227
+ "show_in_rest": 0
}
\ No newline at end of file
diff --git a/wp-content/themes/vf-wp-intranet/functions/bioit-feed.php b/wp-content/themes/vf-wp-intranet/functions/bioit-feed.php
index a38cdfdc9..d2b950b65 100644
--- a/wp-content/themes/vf-wp-intranet/functions/bioit-feed.php
+++ b/wp-content/themes/vf-wp-intranet/functions/bioit-feed.php
@@ -83,9 +83,14 @@ function insert_bioit_posts_from_xml($xmldata) {
if (!empty($endDate)) {
$formattedendDate = date('Ymd', strtotime($endDate));
}
+ $emblCentre = isset($associative_array['provider']) ? $associative_array['provider'] : '';
+
$provider = isset($associative_array['provider']) ? $associative_array['provider'] : '';
- if ($provider != 'EMBL Bio-IT') {
- $provider = 'Data Centres';
+ if ($provider == 'Bio-IT') {
+ $provider = 'EMBL Bio-IT';
+ }
+ elseif ($provider != 'Bio-IT') {
+ $provider = 'EMBL Centres';
}
$location = isset($associative_array['location']) ? $associative_array['location'] : '';
$overview = isset($associative_array['overview']) ? $associative_array['overview'] : 'Please visit the course page for more information';
@@ -111,6 +116,7 @@ function insert_bioit_posts_from_xml($xmldata) {
add_post_meta($post_id, 'vf-wp-training-end_date', $formattedendDate);
add_post_meta($post_id, 'vf-wp-training-info', $overview);
add_post_meta($post_id, 'vf-wp-training-url', $permalink);
+ add_post_meta($post_id, 'vf-wp-training-embl_centre', $emblCentre);
add_post_meta($post_id, 'vf-wp-training-registration-deadline', $formattedStartDate);
add_post_meta($post_id, 'vf-wp-training-category', 'Data science');
add_post_meta($post_id, 'vf-wp-training-training_type', 'live');
@@ -137,6 +143,7 @@ function insert_bioit_posts_from_xml($xmldata) {
update_post_meta($existing_post_id, 'vf-wp-training-end_date', $formattedendDate);
update_post_meta($existing_post_id, 'vf-wp-training-info', $overview);
update_post_meta($existing_post_id, 'vf-wp-training-url', $permalink);
+ update_post_meta($existing_post_id, 'vf-wp-training-embl_centre', $emblCentre);
update_post_meta($existing_post_id, 'vf-wp-training-category', 'Data science');
update_post_meta($existing_post_id, 'vf-wp-training-registration-deadline', $formattedStartDate);
update_post_meta($existing_post_id, 'vf-wp-training-training_type', 'live');
diff --git a/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-on-demand.php b/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-on-demand.php
index 8541d769d..af8c47462 100644
--- a/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-on-demand.php
+++ b/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-on-demand.php
@@ -58,14 +58,15 @@
class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue">
-
+ name)); }
- echo implode(', ', $org_list); ?>">
- name); }
- echo implode(', ', $org_list); ?>
+ $prov_list = [];
+ if ($org->name === 'EMBL Centres') {
+ $prov_list[] = $emblCentres; }
+ else {
+ $prov_list[] = strtoupper($org->name); } }
+ echo implode(', ', $prov_list); ?>
@@ -77,6 +78,16 @@ class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue">">
+
+ name); }
+ echo implode(', ', $org_list); ?>"
+
current_post +1 < $onDemandLoop->post_count) {
echo '
';
diff --git a/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-past.php b/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-past.php
index 149838b79..6e7ae3140 100644
--- a/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-past.php
+++ b/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training-past.php
@@ -113,14 +113,15 @@
class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue">
-
+ name)); }
- echo implode(', ', $org_list); ?>">
- name); }
- echo implode(', ', $org_list); ?>
+ $prov_list = [];
+ if ($org->name === 'EMBL Centres') {
+ $prov_list[] = $emblCentres; }
+ else {
+ $prov_list[] = strtoupper($org->name); } }
+ echo implode(', ', $prov_list); ?>
@@ -133,6 +134,16 @@ class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue">">
+
+ name); }
+ echo implode(', ', $org_list); ?>"
+
Open'; } ?>
diff --git a/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training.php b/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training.php
index f26cc9486..cfa66c7d7 100644
--- a/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training.php
+++ b/wp-content/themes/vf-wp-intranet/partials/training/vf-summary--training.php
@@ -25,6 +25,7 @@
$additionalInfo = get_field('vf-wp-training-info',$post_id, false, false);
$audience = get_field('vf-wp-training-audience',$post_id);
$type = get_field('vf-wp-training-training_type',$post_id);
+$emblCentres = get_field('vf-wp-training-embl_centre',$post_id);
$keywords = get_field('keyword',$post_id);
@@ -140,14 +141,15 @@
class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue">
-
+ name)); }
- echo implode(', ', $org_list); ?>">
- name); }
- echo implode(', ', $org_list); ?>
+ $prov_list = [];
+ if ($org->name === 'EMBL Centres') {
+ $prov_list[] = $emblCentres; }
+ else {
+ $prov_list[] = strtoupper($org->name); } }
+ echo implode(', ', $prov_list); ?>
@@ -160,6 +162,16 @@ class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue">">
+
+ name); }
+ echo implode(', ', $org_list); ?>"
+
Open'; } ?>