2016-12-05 00:47:34 +01:00
<?php
2019-02-13 14:45:01 +01:00
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'galaxies', 'menuItem' => 'view_cluster'));
2020-03-12 11:51:24 +01:00
2020-04-15 15:35:52 +02:00
$extendedFromHtml = '';
$extendFromLinks = array();
if (!empty($cluster['GalaxyCluster']['extended_from'])) {
$element = $this->element('genericElements/IndexTable/Fields/links', array(
'url' => $baseurl . '/galaxy_clusters/view/',
'row' => $cluster,
'field' => array(
'data_path' => 'GalaxyCluster.extended_from.GalaxyCluster.id',
2020-04-29 16:38:04 +02:00
'title' => sprintf(__('%s (version: %s)'), $cluster['GalaxyCluster']['extended_from']['GalaxyCluster']['value'], $cluster['GalaxyCluster']['extends_version'])
2020-04-15 15:35:52 +02:00
),
));
$extendFromLinks[] = sprintf('<li>%s</li>', $element);
}
$extendedFromHtml = sprintf('<ul>%s</ul>', implode('', $extendFromLinks));
2020-12-10 22:20:42 +01:00
if ($newVersionAvailable) {
$extendedFromHtml .= sprintf('<div class="alert alert-warning">%s</div>', sprintf(__('New version available! <a href="%s">Update cluster to version <b>%s</b></a>'),
'/galaxy_clusters/updateCluster/' . $cluster['GalaxyCluster']['id'],
h($cluster['GalaxyCluster']['extended_from']['GalaxyCluster']['version'])
));
}
2020-04-15 15:35:52 +02:00
$extendedByHtml = '';
$extendByLinks = array();
foreach($cluster['GalaxyCluster']['extended_by'] as $extendCluster) {
$element = $this->element('genericElements/IndexTable/Fields/links', array(
'url' => '/galaxy_clusters/view/',
'row' => $extendCluster,
'field' => array(
'data_path' => 'GalaxyCluster.id',
2020-04-29 16:38:04 +02:00
'title' => sprintf(__('%s (parent version: %s)'), $extendCluster['GalaxyCluster']['value'], $extendCluster['GalaxyCluster']['extends_version'])
2020-04-15 15:35:52 +02:00
),
));
$extendByLinks[] = sprintf('<li>%s</li>', $element);
}
$extendedByHtml = sprintf('<ul>%s</ul>', implode('', $extendByLinks));
2020-03-12 11:51:24 +01:00
$table_data = array();
$table_data[] = array('key' => __('Cluster ID'), 'value' => $cluster['GalaxyCluster']['id']);
$table_data[] = array('key' => __('Name'), 'value' => $cluster['GalaxyCluster']['value']);
2020-06-12 15:08:01 +02:00
$table_data[] = array('key' => __('Parent Galaxy'), 'value' => $cluster['GalaxyCluster']['Galaxy']['name'] ? $cluster['GalaxyCluster']['Galaxy']['name'] : $cluster['GalaxyCluster']['Galaxy']['type']);
2020-03-12 11:51:24 +01:00
$table_data[] = array('key' => __('Description'), 'value' => $cluster['GalaxyCluster']['description']);
2020-06-16 16:36:49 +02:00
$table_data[] = array('key' => __('Published'), 'boolean' => $cluster['GalaxyCluster']['published'], 'class' => (!$cluster['GalaxyCluster']['published'] ? 'background-red bold': ''));
2020-09-23 18:13:11 +02:00
$table_data[] = array('key' => __('Default'), 'boolean' => $cluster['GalaxyCluster']['default'], 'class' => (!$cluster['GalaxyCluster']['published'] ? 'black': 'black'));
2020-04-29 16:03:01 +02:00
$table_data[] = array('key' => __('Version'), 'value' => $cluster['GalaxyCluster']['version']);
2020-12-10 22:20:42 +01:00
$table_data[] = array('key' => __('UUID'), 'value' => $cluster['GalaxyCluster']['uuid'], 'value_class' => 'quickSelect');
$table_data[] = array('key' => __('Collection UUID'), 'value' => $cluster['GalaxyCluster']['collection_uuid'], 'value_class' => 'quickSelect');
$table_data[] = array(
'key' => __('Source'),
'html' => filter_var($cluster['GalaxyCluster']['source'], FILTER_VALIDATE_URL) ?
'<a href="' . $cluster['GalaxyCluster']['source'] . '" rel="noreferrer noopener">' . h($cluster['GalaxyCluster']['source']) :
h($cluster['GalaxyCluster']['source']),
);
2020-03-12 11:51:24 +01:00
$table_data[] = array('key' => __('Authors'), 'value' => !empty($cluster['GalaxyCluster']['authors']) ? implode(', ', $cluster['GalaxyCluster']['authors']) : __('N/A'));
2020-07-02 11:27:28 +02:00
$table_data[] = array('key' => __('Distribution'), 'element' => 'genericElements/IndexTable/Fields/distribution_levels', 'element_params' => array(
'row' => $cluster['GalaxyCluster'],
'field' => array('data_path' => 'distribution')
));
2020-04-21 11:51:14 +02:00
$table_data[] = array(
'key' => __('Owner Organisation'),
2020-06-12 15:08:01 +02:00
'html' => $this->OrgImg->getOrgImg(array('name' => $cluster['GalaxyCluster']['Org']['name'], 'id' => $cluster['GalaxyCluster']['Org']['id'], 'size' => 18), true),
2020-04-21 11:51:14 +02:00
);
$table_data[] = array(
'key' => __('Creator Organisation'),
2020-06-12 15:08:01 +02:00
'html' => $this->OrgImg->getOrgImg(array('name' => $cluster['GalaxyCluster']['Orgc']['name'], 'id' => $cluster['GalaxyCluster']['Orgc']['id'], 'size' => 18), true),
2020-04-21 11:51:14 +02:00
);
2020-03-12 11:51:24 +01:00
$table_data[] = array('key' => __('Connector tag'), 'value' => $cluster['GalaxyCluster']['tag_name']);
$table_data[] = array('key' => __('Events'), 'html' => isset($cluster['GalaxyCluster']['tag_count']) ?
2020-12-10 22:20:42 +01:00
sprintf('<a href="%s">%s</a>',
2020-03-12 11:51:24 +01:00
sprintf('%s/events/index/searchtag:%s', $baseurl, h($cluster['GalaxyCluster']['tag_id'])),
2020-12-10 22:20:42 +01:00
__n('%s event', '%s events', $cluster['GalaxyCluster']['tag_count'], h($cluster['GalaxyCluster']['tag_count']))
2020-03-12 11:51:24 +01:00
):
2020-12-10 22:20:42 +01:00
'0'
2020-03-12 11:51:24 +01:00
);
2020-12-10 22:20:42 +01:00
if (!empty($extendedFromHtml)) {
$table_data[] = array('key' => __('Forked From'), 'html' => $extendedFromHtml);
}
if (!empty($extendedByHtml)) {
$table_data[] = array('key' => __('Forked By'), 'html' => $extendedByHtml);
}
2016-12-05 00:47:34 +01:00
?>
2020-03-12 11:51:24 +01:00
<div class='view'>
2018-07-20 09:29:50 +02:00
<div class="row-fluid">
<div class="span8">
<h2>
2020-09-23 18:05:09 +02:00
<?= sprintf('%s :: %s', h($cluster['GalaxyCluster']['Galaxy']['name']), $cluster['GalaxyCluster']['value']); ?>
2018-07-20 09:29:50 +02:00
</h2>
2020-03-12 11:51:24 +01:00
<?php echo $this->element('genericElements/viewMetaTable', array('table_data' => $table_data)); ?>
2018-07-20 09:29:50 +02:00
</div>
</div>
2019-03-20 14:28:08 +01:00
<div class="row-fuild">
<div id="matrix_container"></div>
</div>
2020-05-06 07:59:57 +02:00
<div class="row-fuild">
2020-05-06 08:13:05 +02:00
<div id="relations_container"></div>
2020-05-06 07:59:57 +02:00
</div>
2018-07-20 09:29:50 +02:00
<div class="row-fluid">
<div id="elements_div" class="span8"></div>
</div>
2016-12-05 00:47:34 +01:00
</div>
<script type="text/javascript">
2020-12-10 22:20:42 +01:00
$(function () {
2020-08-16 13:31:31 +02:00
$.get("<?php echo $baseurl; ?>/galaxy_elements/index/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
2018-07-20 09:29:50 +02:00
$("#elements_div").html(data);
});
2020-08-16 13:31:31 +02:00
$.get("<?php echo $baseurl; ?>/galaxy_clusters/viewGalaxyMatrix/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
2019-03-20 14:28:08 +01:00
$("#matrix_container").html(data);
});
2020-05-06 08:13:05 +02:00
$.get("/galaxy_clusters/viewRelations/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
$("#relations_container").html(data);
2020-05-06 07:59:57 +02:00
});
2016-12-05 00:47:34 +01:00
});
</script>