mirror of https://github.com/MISP/MISP
chg: [GalaxyCluster] Fetcher function arrange the data before returing
its resultspull/6120/head
parent
34ee5cb791
commit
0732d20326
|
@ -243,9 +243,6 @@ class GalaxiesController extends AppController
|
|||
);
|
||||
$clusters = $this->Galaxy->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(),$options, $full=true);
|
||||
$clusters = $this->Galaxy->GalaxyCluster->unsetFieldsForExport($clusters);
|
||||
foreach ($clusters as $k => $cluster) {
|
||||
$clusters[$k] = $this->Galaxy->GalaxyCluster->arrangeDataForExport($cluster);
|
||||
}
|
||||
$content = json_encode($clusters, JSON_PRETTY_PRINT);
|
||||
$this->response->body($content);
|
||||
if ($this->request->data['download'] == 'download') {
|
||||
|
|
|
@ -206,7 +206,6 @@ class GalaxyClustersController extends AppController
|
|||
throw new NotFoundException('Cluster not found.');
|
||||
}
|
||||
if ($this->_isRest()) {
|
||||
$cluster = $this->GalaxyCluster->arrangeDataForExport($cluster);
|
||||
return $this->RestResponse->viewData($cluster, $this->response->type());
|
||||
} else {
|
||||
$cluster = $this->GalaxyCluster->attachExtendByInfo($this->Auth->user(), $cluster);
|
||||
|
@ -265,16 +264,19 @@ class GalaxyClustersController extends AppController
|
|||
$this->request->data = $origCluster;
|
||||
unset($this->request->data['GalaxyCluster']['id']);
|
||||
unset($this->request->data['GalaxyCluster']['uuid']);
|
||||
foreach ($origCluster['GalaxyElement'] as $k => $element) {
|
||||
unset($origCluster['GalaxyElement'][$k]['id']);
|
||||
unset($origCluster['GalaxyElement'][$k]['galaxy_cluster_id']);
|
||||
foreach ($origCluster['GalaxyCluster']['GalaxyElement'] as $k => $element) {
|
||||
unset($origCluster['GalaxyCluster']['GalaxyElement'][$k]['id']);
|
||||
unset($origCluster['GalaxyCluster']['GalaxyElement'][$k]['galaxy_cluster_id']);
|
||||
}
|
||||
$this->request->data['GalaxyCluster']['extends_uuid'] = $origCluster['GalaxyCluster']['uuid'];
|
||||
$this->request->data['GalaxyCluster']['extends_version'] = $origCluster['GalaxyCluster']['version'];
|
||||
$this->request->data['GalaxyCluster']['elements'] = json_encode($origCluster['GalaxyElement']);
|
||||
$this->request->data['GalaxyCluster']['elementsDict'] = $origCluster['GalaxyElement'];
|
||||
$this->request->data['GalaxyCluster']['elements'] = json_encode($origCluster['GalaxyCluster']['GalaxyElement']);
|
||||
$this->request->data['GalaxyCluster']['elementsDict'] = $origCluster['GalaxyCluster']['GalaxyElement'];
|
||||
$this->request->data['GalaxyCluster']['authors'] = json_encode($origCluster['GalaxyCluster']['authors']);
|
||||
}
|
||||
unset($origClusterMeta['Galaxy']);
|
||||
unset($origClusterMeta['Org']);
|
||||
unset($origClusterMeta['Orgc']);
|
||||
$this->set('origCluster', $origCluster);
|
||||
$this->set('origClusterMeta', $origClusterMeta);
|
||||
} else {
|
||||
|
@ -366,7 +368,7 @@ class GalaxyClustersController extends AppController
|
|||
if ($cluster['GalaxyCluster']['default']) {
|
||||
throw new MethodNotAllowedException('Default galaxy cluster cannot be edited');
|
||||
}
|
||||
$this->GalaxyCluster->data = array('GalaxyCluster' => $cluster['GalaxyCluster'], 'GalaxyElement' => $cluster['GalaxyElement']);
|
||||
$this->GalaxyCluster->data = array('GalaxyCluster' => $cluster['GalaxyCluster'], 'GalaxyElement' => $cluster['GalaxyCluster']['GalaxyElement']);
|
||||
|
||||
$this->loadModel('Attribute');
|
||||
$distributionLevels = $this->Attribute->distributionLevels;
|
||||
|
@ -386,7 +388,7 @@ class GalaxyClustersController extends AppController
|
|||
if (!empty($origCluster)) {
|
||||
$origCluster = $origCluster[0];
|
||||
$this->set('forkUuid', $cluster['GalaxyCluster']['extends_uuid']);
|
||||
$origClusterMeta = $origCluster['GalaxyCluster'];
|
||||
$origClusterMeta = $origCluster['GalaxyCluster']['GalaxyCluster'];
|
||||
$this->set('origCluster', $origCluster);
|
||||
$this->set('origClusterMeta', $origClusterMeta);
|
||||
}
|
||||
|
@ -847,9 +849,9 @@ class GalaxyClustersController extends AppController
|
|||
}
|
||||
}
|
||||
$missingElements = array();
|
||||
forEach($parentCluster['GalaxyElement'] as $k => $parentElement) {
|
||||
forEach($parentCluster['GalaxyCluster']['GalaxyElement'] as $k => $parentElement) {
|
||||
$found = false;
|
||||
forEach($cluster['GalaxyElement'] as $k => $clusterElement) {
|
||||
forEach($cluster['GalaxyCluster']['GalaxyElement'] as $k => $clusterElement) {
|
||||
if ($parentElement['key'] == $clusterElement['key'] &&
|
||||
$parentElement['value'] == $clusterElement['value']) {
|
||||
$found = true;
|
||||
|
@ -861,8 +863,8 @@ class GalaxyClustersController extends AppController
|
|||
}
|
||||
}
|
||||
$this->set('missingElements', $missingElements);
|
||||
$this->set('parentElements', $parentCluster['GalaxyElement']);
|
||||
$this->set('clusterElements', $cluster['GalaxyElement']);
|
||||
$this->set('parentElements', $parentCluster['GalaxyCluster']['GalaxyElement']);
|
||||
$this->set('clusterElements', $cluster['GalaxyCluster']['GalaxyElement']);
|
||||
$this->set('forkVersion', $forkVersion);
|
||||
$this->set('parentVersion', $parentVersion);
|
||||
$this->set('newVersionAvailable', $parentVersion > $forkVersion);
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
}
|
||||
foreach ($clusters as $cluster) {
|
||||
$cluster = $this->attachOwnerInsideCluster($cluster);
|
||||
if (!empty($cluster['GalaxyClusterRelation'])) {
|
||||
foreach($cluster['GalaxyClusterRelation'] as $relation) {
|
||||
if (!empty($cluster['GalaxyCluster']['GalaxyClusterRelation'])) {
|
||||
foreach($cluster['GalaxyCluster']['GalaxyClusterRelation'] as $relation) {
|
||||
$referencedClusterUuid = $relation['referenced_galaxy_cluster_uuid'];
|
||||
if (!isset($this->lookup[$referencedClusterUuid])) {
|
||||
$referencedCluster = $this->GalaxyCluster->fetchGalaxyClusters($this->user, array(
|
||||
|
@ -101,19 +101,19 @@
|
|||
|
||||
private function attachOwnerInsideCluster($cluster)
|
||||
{
|
||||
if (!empty($cluster['Org']) && !isset($cluster['GalaxyCluster']['Org'])) {
|
||||
if (!empty($cluster['GalaxyCluster']['Org']) && !isset($cluster['GalaxyCluster']['Org'])) {
|
||||
$cluster['GalaxyCluster']['Org'] = array(
|
||||
'id' => $cluster['Org']['id'],
|
||||
'name' => $cluster['Org']['name'],
|
||||
);
|
||||
}
|
||||
if (!empty($cluster['Orgc']) && !isset($cluster['GalaxyCluster']['Orgc'])) {
|
||||
if (!empty($cluster['GalaxyCluster']['Orgc']) && !isset($cluster['GalaxyCluster']['Orgc'])) {
|
||||
$cluster['GalaxyCluster']['Orgc'] = array(
|
||||
'id' => $cluster['Orgc']['id'],
|
||||
'name' => $cluster['Orgc']['name'],
|
||||
);
|
||||
}
|
||||
if (!empty($cluster['SharingGroup']) && !isset($cluster['GalaxyCluster']['SharingGroup'])) {
|
||||
if (!empty($cluster['GalaxyCluster']['SharingGroup']) && !isset($cluster['GalaxyCluster']['SharingGroup'])) {
|
||||
$cluster['GalaxyCluster']['SharingGroup'] = array(
|
||||
'id' => $cluster['SharingGroup']['id'],
|
||||
'name' => $cluster['SharingGroup']['name'],
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
'children' => array()
|
||||
));
|
||||
// add relation info between the two clusters
|
||||
foreach($cluster['GalaxyClusterRelation'] as $relation) {
|
||||
foreach($cluster['GalaxyCluster']['GalaxyClusterRelation'] as $relation) {
|
||||
if (empty($relation['GalaxyCluster'])) { // unkown cluster, create placeholder
|
||||
$relation['GalaxyCluster'] = array(
|
||||
'uuid' => $relation['referenced_galaxy_cluster_uuid'],
|
||||
|
@ -40,8 +40,8 @@
|
|||
'GalaxyCluster' => $cluster['GalaxyCluster'],
|
||||
'children' => array()
|
||||
));
|
||||
if (!empty($cluster['TargettingClusterRelation'])) {
|
||||
foreach($cluster['TargettingClusterRelation'] as $relation) {
|
||||
if (!empty($cluster['GalaxyCluster']['TargettingClusterRelation'])) {
|
||||
foreach($cluster['GalaxyCluster']['TargettingClusterRelation'] as $relation) {
|
||||
if (isset($relation['GalaxyCluster'])) { // not set if Cluster is unkown
|
||||
$tmp = array(
|
||||
'Relation' => array_diff_key($relation, array_flip(array('GalaxyCluster'))),
|
||||
|
@ -60,28 +60,4 @@
|
|||
);
|
||||
return $tree;
|
||||
}
|
||||
|
||||
private function attachOwnerInsideCluster($cluster)
|
||||
{
|
||||
if (!empty($cluster['Org']) && !isset($cluster['GalaxyCluster']['Org'])) {
|
||||
$cluster['GalaxyCluster']['Org'] = array(
|
||||
'id' => $cluster['Org']['id'],
|
||||
'name' => $cluster['Org']['name'],
|
||||
);
|
||||
}
|
||||
if (!empty($cluster['Orgc']) && !isset($cluster['GalaxyCluster']['Orgc'])) {
|
||||
$cluster['GalaxyCluster']['Orgc'] = array(
|
||||
'id' => $cluster['Orgc']['id'],
|
||||
'name' => $cluster['Orgc']['name'],
|
||||
);
|
||||
}
|
||||
if (!empty($cluster['SharingGroup']) && !isset($cluster['GalaxyCluster']['SharingGroup'])) {
|
||||
$cluster['GalaxyCluster']['SharingGroup'] = array(
|
||||
'id' => $cluster['SharingGroup']['id'],
|
||||
'name' => $cluster['SharingGroup']['name'],
|
||||
'description' => $cluster['SharingGroup']['description'],
|
||||
);
|
||||
}
|
||||
return $cluster;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,12 +156,14 @@ class GalaxyCluster extends AppModel
|
|||
$this->GalaxyClusterRelation->deleteAll(array('GalaxyClusterRelation.galaxy_cluster_uuid' => $this->uuid));
|
||||
}
|
||||
|
||||
public function arrangeDataForExport($cluster)
|
||||
public function arrangeData($cluster)
|
||||
{
|
||||
$models = array('Galaxy', 'GalaxyElement', 'GalaxyClusterRelation', 'Org', 'Orgc', 'TargettingClusterRelation');
|
||||
foreach ($models as $model) {
|
||||
$cluster['GalaxyCluster'][$model] = $cluster[$model];
|
||||
unset($cluster[$model]);
|
||||
if (isset($cluster[$model])) {
|
||||
$cluster['GalaxyCluster'][$model] = $cluster[$model];
|
||||
unset($cluster[$model]);
|
||||
}
|
||||
}
|
||||
return $cluster;
|
||||
}
|
||||
|
@ -330,22 +332,22 @@ class GalaxyCluster extends AppModel
|
|||
}
|
||||
$modelsToUnset = array('GalaxyClusterRelation', 'TargettingClusterRelation');
|
||||
forEach($modelsToUnset as $modelName) {
|
||||
forEach($cluster[$modelName] as $i => $relation) {
|
||||
unset($clusters[$k][$modelName][$i]['id']);
|
||||
unset($clusters[$k][$modelName][$i]['galaxy_cluster_id']);
|
||||
unset($clusters[$k][$modelName][$i]['referenced_galaxy_cluster_id']);
|
||||
forEach($cluster['GalaxyCluster'][$modelName] as $i => $relation) {
|
||||
unset($clusters[$k]['GalaxyCluster'][$modelName][$i]['id']);
|
||||
unset($clusters[$k]['GalaxyCluster'][$modelName][$i]['galaxy_cluster_id']);
|
||||
unset($clusters[$k]['GalaxyCluster'][$modelName][$i]['referenced_galaxy_cluster_id']);
|
||||
if (isset($relation['Tag'])) {
|
||||
forEach($relation['Tag'] as $j => $tags) {
|
||||
unset($clusters[$k][$modelName][$i]['Tag'][$j]['id']);
|
||||
unset($clusters[$k][$modelName][$i]['Tag'][$j]['org_id']);
|
||||
unset($clusters[$k][$modelName][$i]['Tag'][$j]['user_id']);
|
||||
unset($clusters[$k]['GalaxyCluster'][$modelName][$i]['Tag'][$j]['id']);
|
||||
unset($clusters[$k]['GalaxyCluster'][$modelName][$i]['Tag'][$j]['org_id']);
|
||||
unset($clusters[$k]['GalaxyCluster'][$modelName][$i]['Tag'][$j]['user_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
forEach($cluster['GalaxyElement'] as $i => $element) {
|
||||
unset($clusters[$k]['GalaxyElement'][$i]['id']);
|
||||
unset($clusters[$k]['GalaxyElement'][$i]['galaxy_cluster_id']);
|
||||
forEach($cluster['GalaxyCluster']['GalaxyElement'] as $i => $element) {
|
||||
unset($clusters[$k]['GalaxyCluster']['GalaxyElement'][$i]['id']);
|
||||
unset($clusters[$k]['GalaxyCluster']['GalaxyElement'][$i]['galaxy_cluster_id']);
|
||||
}
|
||||
}
|
||||
return $clusters;
|
||||
|
@ -708,6 +710,7 @@ class GalaxyCluster extends AppModel
|
|||
}
|
||||
$clusters = $this->find('all', $params);
|
||||
foreach ($clusters as $i => $cluster) {
|
||||
$clusters[$i] = $this->arrangeData($clusters[$i]);
|
||||
$clusters[$i] = $this->GalaxyClusterRelation->massageRelationTag($clusters[$i]);
|
||||
}
|
||||
return $clusters;
|
||||
|
@ -1113,9 +1116,9 @@ class GalaxyCluster extends AppModel
|
|||
private function __prepareForPushToServer($cluster, $server)
|
||||
{
|
||||
if ($cluster['GalaxyCluster']['distribution'] == 4) {
|
||||
if (!empty($cluster['SharingGroup']['SharingGroupServer'])) {
|
||||
if (!empty($cluster['GalaxyCluster']['SharingGroup']['SharingGroupServer'])) {
|
||||
$found = false;
|
||||
foreach ($event['SharingGroup']['SharingGroupServer'] as $sgs) {
|
||||
foreach ($cluster['GalaxyCluster']['SharingGroup']['SharingGroupServer'] as $sgs) {
|
||||
if ($sgs['server_id'] == $server['Server']['id']) {
|
||||
$found = true;
|
||||
}
|
||||
|
@ -1123,7 +1126,7 @@ class GalaxyCluster extends AppModel
|
|||
if (!$found) {
|
||||
return 403;
|
||||
}
|
||||
} else if (empty($cluster['SharingGroup']['roaming'])) {
|
||||
} else if (empty($cluster['GalaxyCluster']['SharingGroup']['roaming'])) {
|
||||
return 403;
|
||||
}
|
||||
}
|
||||
|
@ -1144,8 +1147,8 @@ class GalaxyCluster extends AppModel
|
|||
unset($cluster['GalaxyCluster'][$field]);
|
||||
}
|
||||
// Add the local server to the list of instances in the SG
|
||||
if (isset($cluster['SharingGroup']) && isset($cluster['SharingGroup']['SharingGroupServer'])) {
|
||||
foreach ($cluster['SharingGroup']['SharingGroupServer'] as &$s) {
|
||||
if (isset($cluster['GalaxyCluster']['SharingGroup']) && isset($cluster['GalaxyCluster']['SharingGroup']['SharingGroupServer'])) {
|
||||
foreach ($cluster['GalaxyCluster']['SharingGroup']['SharingGroupServer'] as &$s) {
|
||||
if ($s['server_id'] == 0) {
|
||||
$s['Server'] = array(
|
||||
'id' => 0,
|
||||
|
@ -1167,9 +1170,9 @@ class GalaxyCluster extends AppModel
|
|||
|
||||
private function __prepareElementsForSync($cluster, $server)
|
||||
{
|
||||
if (!empty($cluster['GalaxyElement'])) {
|
||||
foreach($cluster['GalaxyElement'] as $k => $element) {
|
||||
$cluster['GalaxyElement'][$k] = $this->__updateElementForSync($element, $server);
|
||||
if (!empty($cluster['GalaxyCluster']['GalaxyElement'])) {
|
||||
foreach($cluster['GalaxyCluster']['GalaxyElement'] as $k => $element) {
|
||||
$cluster['GalaxyCluster']['GalaxyElement'][$k] = $this->__updateElementForSync($element, $server);
|
||||
}
|
||||
}
|
||||
return $cluster;
|
||||
|
@ -1178,16 +1181,16 @@ class GalaxyCluster extends AppModel
|
|||
private function __prepareRelationsForSync($cluster, $server)
|
||||
{
|
||||
$this->Event = ClassRegistry::init('Event');
|
||||
if (!empty($cluster['GalaxyClusterRelation'])) {
|
||||
foreach($cluster['GalaxyClusterRelation'] as $k => $relation) {
|
||||
$cluster['GalaxyClusterRelation'][$k] = $this->__updateRelationsForSync($relation, $server);
|
||||
if (empty($cluster['GalaxyClusterRelation'][$k])) {
|
||||
unset($cluster['GalaxyClusterRelation'][$k]);
|
||||
if (!empty($cluster['GalaxyCluster']['GalaxyClusterRelation'])) {
|
||||
foreach($cluster['GalaxyCluster']['GalaxyClusterRelation'] as $k => $relation) {
|
||||
$cluster['GalaxyCluster']['GalaxyClusterRelation'][$k] = $this->__updateRelationsForSync($relation, $server);
|
||||
if (empty($cluster['GalaxyCluster']['GalaxyClusterRelation'][$k])) {
|
||||
unset($cluster['GalaxyCluster']['GalaxyClusterRelation'][$k]);
|
||||
} else {
|
||||
$cluster['GalaxyClusterRelation'][$k] = $this->Event->__removeNonExportableTags($cluster['GalaxyClusterRelation'][$k], 'GalaxyClusterRelation');
|
||||
$cluster['GalaxyCluster']['GalaxyClusterRelation'][$k] = $this->Event->__removeNonExportableTags($cluster['GalaxyCluster']['GalaxyClusterRelation'][$k], 'GalaxyClusterRelation');
|
||||
}
|
||||
}
|
||||
$cluster['GalaxyClusterRelation'] = array_values($cluster['GalaxyClusterRelation']);
|
||||
$cluster['GalaxyCluster']['GalaxyClusterRelation'] = array_values($cluster['GalaxyCluster']['GalaxyClusterRelation']);
|
||||
}
|
||||
return $cluster;
|
||||
}
|
||||
|
@ -1395,21 +1398,21 @@ class GalaxyCluster extends AppModel
|
|||
|
||||
public function attachClusterToRelations($user, $cluster)
|
||||
{
|
||||
if (!empty($cluster['GalaxyClusterRelation'])) {
|
||||
foreach ($cluster['GalaxyClusterRelation'] as $k => $relation) {
|
||||
if (!empty($cluster['GalaxyCluster']['GalaxyClusterRelation'])) {
|
||||
foreach ($cluster['GalaxyCluster']['GalaxyClusterRelation'] as $k => $relation) {
|
||||
$conditions = array('conditions' => array('GalaxyCluster.uuid' => $relation['referenced_galaxy_cluster_uuid']));
|
||||
$relatedCluster = $this->fetchGalaxyClusters($user, $conditions, false);
|
||||
if (!empty($relatedCluster)) {
|
||||
$cluster['GalaxyClusterRelation'][$k]['GalaxyCluster'] = $relatedCluster[0]['GalaxyCluster'];
|
||||
$cluster['GalaxyCluster']['GalaxyClusterRelation'][$k]['GalaxyCluster'] = $relatedCluster[0]['GalaxyCluster'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($cluster['TargettingClusterRelation'])) {
|
||||
foreach ($cluster['TargettingClusterRelation'] as $k => $relation) {
|
||||
if (!empty($cluster['GalaxyCluster']['TargettingClusterRelation'])) {
|
||||
foreach ($cluster['GalaxyCluster']['TargettingClusterRelation'] as $k => $relation) {
|
||||
$conditions = array('conditions' => array('GalaxyCluster.uuid' => $relation['galaxy_cluster_uuid']));
|
||||
$relatedCluster = $this->fetchGalaxyClusters($user, $conditions, false);
|
||||
if (!empty($relatedCluster)) {
|
||||
$cluster['TargettingClusterRelation'][$k]['GalaxyCluster'] = $relatedCluster[0]['GalaxyCluster'];
|
||||
$cluster['GalaxyCluster']['TargettingClusterRelation'][$k]['GalaxyCluster'] = $relatedCluster[0]['GalaxyCluster'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1429,7 +1432,7 @@ class GalaxyCluster extends AppModel
|
|||
if (!empty($relation['GalaxyClusterRelationTag'])) {
|
||||
$relation['GalaxyClusterRelation']['Tag'] = $relation['GalaxyClusterRelationTag'][0]['Tag'];
|
||||
}
|
||||
$cluster['TargettingClusterRelation'][] = $relation['GalaxyClusterRelation'];
|
||||
$cluster['GalaxyCluster']['TargettingClusterRelation'][] = $relation['GalaxyClusterRelation'];
|
||||
}
|
||||
}
|
||||
return $cluster;
|
||||
|
|
|
@ -76,18 +76,19 @@ class GalaxyClusterRelation extends AppModel
|
|||
$this->Event = ClassRegistry::init('Event');
|
||||
$conditions = array();
|
||||
if (!$user['Role']['perm_site_admin']) {
|
||||
$alias = $this->alias;
|
||||
$sgids = $this->Event->cacheSgids($user, true);
|
||||
$conditions['AND']['OR'] = array(
|
||||
array(
|
||||
'AND' => array(
|
||||
'GalaxyClusterRelation.distribution >' => 0,
|
||||
'GalaxyClusterRelation.distribution <' => 4
|
||||
"${alias}.distribution >" => 0,
|
||||
"${alias}.distribution <" => 4
|
||||
),
|
||||
),
|
||||
array(
|
||||
'AND' => array(
|
||||
'GalaxyClusterRelation.sharing_group_id' => $sgids,
|
||||
'GalaxyClusterRelation.distribution' => 4
|
||||
"${alias}.sharing_group_id" => $sgids,
|
||||
"${alias}.distribution" => 4
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -141,26 +142,36 @@ class GalaxyClusterRelation extends AppModel
|
|||
|
||||
public function massageRelationTag($cluster)
|
||||
{
|
||||
if (!empty($cluster['GalaxyClusterRelation'])) {
|
||||
foreach ($cluster['GalaxyClusterRelation'] as $k => $relation) {
|
||||
if (!empty($cluster['GalaxyCluster'][$this->alias])) {
|
||||
foreach ($cluster['GalaxyCluster'][$this->alias] as $k => $relation) {
|
||||
if (!empty($relation['GalaxyClusterRelationTag'])) {
|
||||
foreach ($relation['GalaxyClusterRelationTag'] as $relationTag) {
|
||||
$cluster['GalaxyClusterRelation'][$k]['Tag'][] = $relationTag['Tag'];
|
||||
$cluster['GalaxyCluster'][$this->alias][$k]['Tag'][] = $relationTag['Tag'];
|
||||
}
|
||||
unset($cluster['GalaxyClusterRelation'][$k]['GalaxyClusterRelationTag']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($cluster['TargettingClusterRelation'])) {
|
||||
foreach ($cluster['TargettingClusterRelation'] as $k => $relation) {
|
||||
if (!empty($relation['GalaxyClusterRelationTag'])) {
|
||||
foreach ($relation['GalaxyClusterRelationTag'] as $relationTag) {
|
||||
$cluster['TargettingClusterRelation'][$k]['Tag'][] = $relationTag['Tag'];
|
||||
}
|
||||
unset($cluster['TargettingClusterRelation'][$k]['GalaxyClusterRelationTag']);
|
||||
}
|
||||
unset($cluster['GalaxyCluster'][$this->alias][$k]['GalaxyClusterRelationTag']);
|
||||
}
|
||||
}
|
||||
// if (!empty($cluster['GalaxyClusterRelation'])) {
|
||||
// foreach ($cluster['GalaxyClusterRelation'] as $k => $relation) {
|
||||
// if (!empty($relation['GalaxyClusterRelationTag'])) {
|
||||
// foreach ($relation['GalaxyClusterRelationTag'] as $relationTag) {
|
||||
// $cluster['GalaxyClusterRelation'][$k]['Tag'][] = $relationTag['Tag'];
|
||||
// }
|
||||
// unset($cluster['GalaxyClusterRelation'][$k]['GalaxyClusterRelationTag']);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!empty($cluster['TargettingClusterRelation'])) {
|
||||
// foreach ($cluster['TargettingClusterRelation'] as $k => $relation) {
|
||||
// if (!empty($relation['GalaxyClusterRelationTag'])) {
|
||||
// foreach ($relation['GalaxyClusterRelationTag'] as $relationTag) {
|
||||
// $cluster['TargettingClusterRelation'][$k]['Tag'][] = $relationTag['Tag'];
|
||||
// }
|
||||
// unset($cluster['TargettingClusterRelation'][$k]['GalaxyClusterRelationTag']);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return $cluster;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ var hexagonPoints = '30,15 22.5,28 7.5,28 0,15 7.5,2.0 22.5,2'
|
|||
var hexagonPointsSmaller = '21,10.5 15.75,19.6 5.25,19.6 0,10.5 5.25,1.4 15.75,1.4'
|
||||
var hexagonTranslate = -10.5;
|
||||
var graph = <?= json_encode($relations) ?>;
|
||||
console.log(graph)
|
||||
var store;
|
||||
var nodes, links, edgepaths, edgelabels, edgetags;
|
||||
var width, height, margin;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
$table_data = array();
|
||||
$table_data[] = array('key' => __('Cluster ID'), 'value' => $cluster['GalaxyCluster']['id']);
|
||||
$table_data[] = array('key' => __('Name'), 'value' => $cluster['GalaxyCluster']['value']);
|
||||
$table_data[] = array('key' => __('Parent Galaxy'), 'value' => $cluster['Galaxy']['name'] ? $cluster['Galaxy']['name'] : $cluster['Galaxy']['type']);
|
||||
$table_data[] = array('key' => __('Parent Galaxy'), 'value' => $cluster['GalaxyCluster']['Galaxy']['name'] ? $cluster['GalaxyCluster']['Galaxy']['name'] : $cluster['GalaxyCluster']['Galaxy']['type']);
|
||||
$table_data[] = array('key' => __('Description'), 'value' => $cluster['GalaxyCluster']['description']);
|
||||
$table_data[] = array('key' => __('Version'), 'value' => $cluster['GalaxyCluster']['version']);
|
||||
$table_data[] = array('key' => __('UUID'), 'value' => $cluster['GalaxyCluster']['uuid']);
|
||||
|
@ -49,11 +49,11 @@
|
|||
$table_data[] = array('key' => __('Distribution'), 'element' => 'genericElements/IndexTable/Fields/distribution_levels', 'element_params' => array('row' => $cluster['GalaxyCluster'], 'field' => array('data_path' => 'distribution')));
|
||||
$table_data[] = array(
|
||||
'key' => __('Owner Organisation'),
|
||||
'html' => $this->OrgImg->getOrgImg(array('name' => $cluster['Org']['name'], 'id' => $cluster['Org']['id'], 'size' => 18), true),
|
||||
'html' => $this->OrgImg->getOrgImg(array('name' => $cluster['GalaxyCluster']['Org']['name'], 'id' => $cluster['GalaxyCluster']['Org']['id'], 'size' => 18), true),
|
||||
);
|
||||
$table_data[] = array(
|
||||
'key' => __('Creator Organisation'),
|
||||
'html' => $this->OrgImg->getOrgImg(array('name' => $cluster['Orgc']['name'], 'id' => $cluster['Orgc']['id'], 'size' => 18), true),
|
||||
'html' => $this->OrgImg->getOrgImg(array('name' => $cluster['GalaxyCluster']['Orgc']['name'], 'id' => $cluster['GalaxyCluster']['Orgc']['id'], 'size' => 18), true),
|
||||
);
|
||||
$table_data[] = array('key' => __('Connector tag'), 'value' => $cluster['GalaxyCluster']['tag_name']);
|
||||
$table_data[] = array('key' => __('Events'), 'html' => isset($cluster['GalaxyCluster']['tag_count']) ?
|
||||
|
@ -72,7 +72,7 @@
|
|||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<h2>
|
||||
<?php echo isset($cluster['Galaxy']['name']) ? h($cluster['Galaxy']['name']) : h($cluster['GalaxyCluster']['type']) . ': ' . $cluster['GalaxyCluster']['value']; ?>
|
||||
<?php echo isset($cluster['GalaxyCluster']['Galaxy']['name']) ? h($cluster['GalaxyCluster']['Galaxy']['name']) : h($cluster['GalaxyCluster']['type']) . ': ' . $cluster['GalaxyCluster']['value']; ?>
|
||||
</h2>
|
||||
<?php echo $this->element('genericElements/viewMetaTable', array('table_data' => $table_data)); ?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue