From d4c2c7bc368c27df9a06423c8580c316748665d0 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 24 Jun 2016 08:38:18 +0200 Subject: [PATCH] syncrule/history: split view script logic --- .../views/scripts/syncrule/history.phtml | 71 +------------------ .../views/scripts/syncrule/runSummary.phtml | 55 ++++++++++++++ .../scripts/syncrule/syncRunDetails.phtml | 14 ++++ 3 files changed, 72 insertions(+), 68 deletions(-) create mode 100644 application/views/scripts/syncrule/runSummary.phtml create mode 100644 application/views/scripts/syncrule/syncRunDetails.phtml diff --git a/application/views/scripts/syncrule/history.phtml b/application/views/scripts/syncrule/history.phtml index 9994dd04..9acc5a14 100644 --- a/application/views/scripts/syncrule/history.phtml +++ b/application/views/scripts/syncrule/history.phtml @@ -11,74 +11,9 @@
stayHere): ?> data-base-target="_next"> run): ?>

translate('Sync run details') ?>

- - - - - - - - - - - - - -
translate('Start time') ?>escape($run->start_time) ?>
translate('Duration') ?>duration_ms / 1000) ?>
translate('Activity') ?>objects_deleted + $run->objects_created + $run->objects_modified; - if ($total === 0) { - echo $this->translate('No changes have been made'); - } else { - if ($total === 1) { - echo $this->translate('One object has been modified'); - } else { - printf( - $this->translate('%s objects have been modified'), - $total - ); - } - - $activityUrl = sprintf( - 'director/config/activities?id>%d&id<=%d', - $formerId, - $lastId - ); - - $links = array(); - if ($run->objects_created > 0) { - $links[] = $this->qlink( - sprintf('%d created', $run->objects_created), - $activityUrl, - array('action_name' => 'create') - ); - } - if ($run->objects_modified > 0) { - $links[] = $this->qlink( - sprintf('%d modified', $run->objects_modified), - $activityUrl, - array('action_name' => 'modify') - ); - } - if ($run->objects_deleted > 0) { - $links[] = $this->qlink( - sprintf('%d deleted', $run->objects_deleted), - $activityUrl, - array('action_name' => 'delete') - ); - } - - if (count($links) > 1) { - $links[] = $this->qlink( - 'Show all actions', - $activityUrl - ); - } - - if (! empty($links)) { - echo ': ' . implode(', ', $links); - } - } - ?>
+render('syncrule/syncRunDetails.phtml') ?> +
table->render() ?>
+
diff --git a/application/views/scripts/syncrule/runSummary.phtml b/application/views/scripts/syncrule/runSummary.phtml new file mode 100644 index 00000000..e4965d13 --- /dev/null +++ b/application/views/scripts/syncrule/runSummary.phtml @@ -0,0 +1,55 @@ +objects_deleted + $run->objects_created + $run->objects_modified; + if ($total === 0) { + echo $this->translate('No changes have been made'); + } else { + if ($total === 1) { + echo $this->translate('One object has been modified'); + } else { + printf( + $this->translate('%s objects have been modified'), + $total + ); + } + + $activityUrl = sprintf( + 'director/config/activities?id>%d&id<=%d', + $formerId, + $lastId + ); + + $links = array(); + if ($run->objects_created > 0) { + $links[] = $this->qlink( + sprintf('%d created', $run->objects_created), + $activityUrl, + array('action_name' => 'create') + ); + } + if ($run->objects_modified > 0) { + $links[] = $this->qlink( + sprintf('%d modified', $run->objects_modified), + $activityUrl, + array('action_name' => 'modify') + ); + } + if ($run->objects_deleted > 0) { + $links[] = $this->qlink( + sprintf('%d deleted', $run->objects_deleted), + $activityUrl, + array('action_name' => 'delete') + ); + } + + if (count($links) > 1) { + $links[] = $this->qlink( + 'Show all actions', + $activityUrl + ); + } + + if (! empty($links)) { + echo ': ' . implode(', ', $links); + } + } + ?> diff --git a/application/views/scripts/syncrule/syncRunDetails.phtml b/application/views/scripts/syncrule/syncRunDetails.phtml new file mode 100644 index 00000000..b494f762 --- /dev/null +++ b/application/views/scripts/syncrule/syncRunDetails.phtml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +
translate('Start time') ?>escape($run->start_time) ?>
translate('Duration') ?>duration_ms / 1000) ?>
translate('Activity') ?>render('syncrule/runSummary.phtml') ?>