From af735901fdb5a2be2b660b5adad33282bd403588 Mon Sep 17 00:00:00 2001 From: mokaddem Date: Tue, 26 Feb 2019 16:33:37 +0100 Subject: [PATCH] new: [eventview] Shows number of object in the event --- app/Controller/EventsController.php | 2 ++ app/View/Events/view.ctp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index 439df70c4..d5047671b 100644 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -1223,6 +1223,7 @@ class EventsController extends AppController $emptyEvent = (empty($event['Object']) && empty($event['Attribute'])); $this->set('emptyEvent', $emptyEvent); $attributeCount = isset($event['Attribute']) ? count($event['Attribute']) : 0; + $objectCount = isset($event['Object']) ? count($event['Object']) : 0; if (!empty($event['Object'])) { foreach ($event['Object'] as $k => $object) { if (!empty($object['Attribute'])) { @@ -1231,6 +1232,7 @@ class EventsController extends AppController } } $this->set('attribute_count', $attributeCount); + $this->set('object_count', $objectCount); // set the data for the contributors / history field $org_ids = $this->Event->ShadowAttribute->getEventContributors($event['Event']['id']); $contributors = $this->Event->Org->find('list', array('fields' => array('Org.name'), 'conditions' => array('Org.id' => $org_ids))); diff --git a/app/View/Events/view.ctp b/app/View/Events/view.ctp index df25a92cc..39baf0e72 100644 --- a/app/View/Events/view.ctp +++ b/app/View/Events/view.ctp @@ -167,9 +167,11 @@ 'class_value' => ($event['Event']['published'] == 0) ? '' : 'green', 'html' => ($event['Event']['published'] == 0) ? 'No' : 'Yes' . ((empty($event['Event']['publish_timestamp'])) ? 'N/A' : ' (' . date('Y-m-d H:i:s', ($event['Event']['publish_timestamp'])) . ')') ); + $attribute_text = $attribute_count; + $attribute_text .= $object_count > 1 ? sprintf(' (%s Objects)', h($object_count)) : sprintf(' (%s Object)', h($object_count)); $table_data[] = array( 'key' => __('#Attributes'), - 'value' => $attribute_count + 'value' => $attribute_text ); $table_data[] = array( 'key' => __('First recorded change'),