Skip to content

Commit

Permalink
bioit provider update
Browse files Browse the repository at this point in the history
  • Loading branch information
kasprzyk-sz committed Nov 6, 2023
1 parent 9242c3a commit 970332e
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 29 deletions.
47 changes: 41 additions & 6 deletions wp-content/themes/vf-wp-intranet/acf-json/training.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
]
],
"wrapper": {
"width": "33",
"width": "25",
"class": "",
"id": ""
},
Expand Down Expand Up @@ -524,7 +524,7 @@
]
],
"wrapper": {
"width": "33",
"width": "25",
"class": "",
"id": ""
},
Expand Down Expand Up @@ -560,7 +560,7 @@
]
],
"wrapper": {
"width": "33",
"width": "25",
"class": "",
"id": ""
},
Expand Down Expand Up @@ -597,7 +597,7 @@
]
],
"wrapper": {
"width": "33",
"width": "25",
"class": "",
"id": ""
},
Expand All @@ -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",
Expand Down Expand Up @@ -832,6 +868,5 @@
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1698764227
"show_in_rest": 0
}
11 changes: 9 additions & 2 deletions wp-content/themes/vf-wp-intranet/functions/bioit-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');
Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@
class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue"><?php echo $category; ?></span>
<?php } ?>
<?php if (($organiser)) { ?>
<span class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeGrey | provider-od-<?php $org_list = [];
<span class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeGrey">
<?php
foreach( $organiser as $org ) {
$org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
<?php $org_list = [];
foreach( $organiser as $org ) {
$org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?></span>
$prov_list = [];
if ($org->name === 'EMBL Centres') {
$prov_list[] = $emblCentres; }
else {
$prov_list[] = strtoupper($org->name); } }
echo implode(', ', $prov_list); ?></span>
<?php } ?>
<?php if (!empty($odType)) { ?>
<span class="customFormat"><?php echo $odType; ?></span></p>
Expand All @@ -77,6 +78,16 @@ class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue"><?php
<span class="type-<?php echo strtolower(str_replace(' ', '_', $odType)); ?>"><?php echo $odType; ?></span>
<span class="category-od-<?php echo $categorySlug; ?>"><?php echo $category; ?></span>
<span class="keywords | search-data-od"><?php echo $keywords; ?></span>
<span class="provider-<?php
$org_list = [];
foreach( $organiser as $org ) {
$org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
<?php
foreach( $organiser as $org ) {
$org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?>"
</span>
</div>
<?php if ($onDemandLoop->current_post +1 < $onDemandLoop->post_count) {
echo '<hr class="vf-divider">';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@
class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue"><?php echo $category; ?></span>
<?php } ?>
<?php if (($organiser)) { ?>
<span class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeGrey | provider-<?php $org_list = [];
<span class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeGrey">
<?php
foreach( $organiser as $org ) {
$org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
<?php $org_list = [];
foreach( $organiser as $org ) {
$org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?></span>
$prov_list = [];
if ($org->name === 'EMBL Centres') {
$prov_list[] = $emblCentres; }
else {
$prov_list[] = strtoupper($org->name); } }
echo implode(', ', $prov_list); ?></span>
<?php } ?>
<?php if (!empty($format)) { ?>
<span class="customFormat"><?php echo $format; ?></span></p>
Expand All @@ -133,6 +134,16 @@ class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue"><?php
<span class="fee-<?php echo $feeSlug; ?>"><?php echo $fee; ?></span>
<span class="category-<?php echo $categorySlug; ?>"><?php echo $category; ?></span>
<span class="keywords | search-data"><?php echo $keywords; ?></span>
<span class="provider-<?php
$org_list = [];
foreach( $organiser as $org ) {
$org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
<?php
foreach( $organiser as $org ) {
$org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?>"
</span>
<?php
if ($registrationStatus == 'Waiting list only') { echo '<span class="status-open">Open</span>'; } ?>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down Expand Up @@ -140,14 +141,15 @@
class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue"><?php echo $category; ?></span>
<?php } ?>
<?php if (($organiser)) { ?>
<span class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeGrey | provider-<?php $org_list = [];
<span class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeGrey">
<?php
foreach( $organiser as $org ) {
$org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
<?php $org_list = [];
foreach( $organiser as $org ) {
$org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?></span>
$prov_list = [];
if ($org->name === 'EMBL Centres') {
$prov_list[] = $emblCentres; }
else {
$prov_list[] = strtoupper($org->name); } }
echo implode(', ', $prov_list); ?></span>
<?php } ?>
<?php if (!empty($format)) { ?>
<span class="customFormat"><?php echo $format; ?></span></p>
Expand All @@ -160,6 +162,16 @@ class="vf-badge vf-badge--primary vf-u-margin__right--200 customBadgeBlue"><?php
<span class="fee-<?php echo $feeSlug; ?>"><?php echo $fee; ?></span>
<span class="category-<?php echo $categorySlug; ?>"><?php echo $category; ?></span>
<span class="keywords | search-data"><?php echo $keywords; ?></span>
<span class="provider-<?php
$org_list = [];
foreach( $organiser as $org ) {
$org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
<?php
foreach( $organiser as $org ) {
$org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?>"
</span>
<?php
if ($registrationStatus == 'Waiting list only') { echo '<span class="status-open">Open</span>'; } ?>
</div>
Expand Down

0 comments on commit 970332e

Please sign in to comment.