Skip to content

Commit

Permalink
feat(SHS-6056): WIP - finished all filters, places, audiences, depts/…
Browse files Browse the repository at this point in the history
…groups. Working on bookmark
  • Loading branch information
Marc Berger committed Feb 19, 2025
1 parent c750bfa commit 3ec0574
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions docroot/modules/humsci/hs_dashboard/src/ImportsInfoManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,63 @@ public function generateEventTable(): array {

$localist_api_data = $widget->getApiData($base_url);

$dept_groups = [];
foreach ($localist_api_data['departments'] as $department) {
$dept_groups[$department['department']['id']] = $department['department']['name'];
$localist_lookup = [
'dept_groups' => [],
'places' => [],
'filters' => [],
];

foreach (['departments' => 'department', 'groups' => 'group'] as $key => $subkey) {
if (!empty($localist_api_data[$key])) {
foreach ($localist_api_data[$key] as $item) {
if (isset($item[$subkey]['id'], $item[$subkey]['name'])) {
$localist_lookup['dept_groups'][$item[$subkey]['id']] = $item[$subkey]['name'];
}
}
}
}

foreach ($localist_api_data['groups'] as $group) {
$dept_groups[$group['group']['id']] = $group['group']['name'];
if (!empty($localist_api_data['places'])) {
foreach ($localist_api_data['places'] as $place) {
if (isset($place['place']['id'], $place['place']['name'])) {
$localist_lookup['places'][$place['place']['id']] = $place['place']['name'];
}
}
}

$places = [];
foreach ($localist_api_data['places'] as $place) {
$places[$place['place']['id']] = $place['place']['name'];
if (!empty($localist_api_data['events/filters'])) {
foreach ($localist_api_data['events/filters'] as $filters) {
foreach ($filters as $filter) {
if (isset($filter['id'], $filter['name'])) {
$localist_lookup['filters'][$filter['id']] = $filter['name'];
}
}
}
}

$localist_urls = $config_pages->get('field_url_separate')->getValue();

$temp = $config_pages->get('field_url_book_s')->getValue();
kint($temp);
foreach ($localist_urls as $url) {
parse_str(parse_url(urldecode($url['uri']), PHP_URL_QUERY), $query_parameters);

$types = [];
if (isset($query_parameters['type'])) {
foreach ($query_parameters['type'] as $type_id) {
$types[] = $localist_lookup['filters'][$type_id];
}
}

$filters = [
$dept_groups[$query_parameters['group_id']],
isset($query_parameters['venue_id']) ? $places[$query_parameters['venue_id']] : NULL,
$localist_lookup['dept_groups'][$query_parameters['group_id']],
isset($query_parameters['venue_id']) ? $localist_lookup['places'][$query_parameters['venue_id']] : NULL,
$types ? implode(', ', $types) : NULL,
];

$table_rows[] = [
'data' => [
['data' => implode(', ', $filters)],
['data' => implode(', ', array_filter($filters))],
],
];
}
Expand Down

0 comments on commit 3ec0574

Please sign in to comment.