<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
</div>

<div class="content">
<?php if (! $this->run): ?>
<p class="warning">
<?= $this->translate('This Sync Rule has never been run before.') ?>
</p>
<?php endif ?>
<?php if ($rule->sync_state === 'unknown'): ?>
<p><?= $this->translate(
    "It's currently unknown whether we are in sync with this rule."
    . ' You should either check for changes or trigger a new Sync Run.'
) ?></p>
<?php elseif ($rule->sync_state === 'in-sync'): ?>
<p><?= sprintf(
    $this->translate(
        'This Sync Rule was last found to by in Sync at %s.'
    ),
    $rule->last_attempt
) /*
TODO: check whether...
      - there have been imports since then, differing from former ones
      - there have been activities since then
*/ ?></p>
<?php elseif ($rule->sync_state === 'pending-changes'): ?>
<p class="warning"><?= $this->translate(
    'There are pending changes for this Sync Rule. You should trigger a new'
    . ' Sync Run.'
) ?></p>
<?php elseif ($rule->sync_state === 'failing'): ?>
<p class="error"><?= sprintf(
    $this->translate(
        'This Sync Rule failed when last checked at %s: %s'
    ),
    $rule->last_attempt,
    $rule->last_error_message
) /*
TODO: check whether...
      - there have been imports since then, differing from former ones
      - there have been activities since then
*/ ?></p>
<?php endif ?>
<?= $this->checkForm ?>
<?= $this->runForm ?>
<?php if ($this->run): ?>
 <h3><?= $this->translate('Last sync run details') ?></h3>
 <?= $this->render('syncrule/syncRunDetails.phtml') ?><br />
<?php if ($run->rule_name !== $rule->rule_name): ?>
<?= $this->escape(sprintf(
    $this->translate("It has been renamed since then, it's former name was %s"),
    $run->rule_name
)) ?>
<?php endif ?>
<?php endif ?>
