tawfekov/ZF2EntityAudit

View on GitHub
view/zf2-entity-audit/index/viewentity.phtml

Summary

Maintainability
Test Coverage
<h1>Audit log for <?php echo $this->escapeHtml($this->entityLabel($entity, $className, $id, $prefixToIgnore)) ?></h1>

<form action="<?=
$this->url('audit_compare',
    array(
        'id' => $id ,
        'className' => str_replace('\\', '_', $className)
    )
);
?>" method="post">

    <div class="row">
        <div class="col-lg-12">
            <table class="table table-striped table-hover table-bordered">

                <thead>
                <tr>
                    <th colspan="4">&nbsp;</th>
                    <th colspan="2">Compare</th>
                </tr>
                <tr>
                    <th>Revision</th>
                    <th>Timestamp</th>
                    <th>User</th>
                    <th>Note</th>
                    <th>Old</th>
                    <th>New</th>
                </tr>
                </thead>

                <tbody>
                <?php
                $i = 0;
                foreach ($revisions  as $revision) {
                    ?>

                    <tr>
                        <td>
                            <a href="<?=
                            $this->url('audit_viewdetails',
                                array(
                                    'id' => $id ,
                                    'className' => str_replace('\\', '_', $className),
                                    'rev' =>$revision->getRev()
                                )
                            ); ?>">
                                <?php  echo $this->escapeHtml($revision->getRev()); ?>
                            </a>
                        </td>
                        <td>
                            <a href="<?=
                            $this->url('audit_viewdetails',
                                array(
                                    'id' => $id ,
                                    'className' => str_replace('\\', '_', $className),
                                    'rev' =>$revision->getRev()
                                )
                            ); ?>">
                                <?php echo  $this->DateTimeFormatter($revision->getTimestamp()); ?>
                            </a>
                        </td>
                        <td>
                        <span class="label label-info">
                            <?php echo  ($revision->getUser()->getEmail()) ?: 'Anonymous'; ?>
                        </span>
                        </td>

                        <td>
                            <?php echo $revision->getNote() ?>
                        </td>

                        <td>
                            <input type="radio" name="oldRev" value="<?php  echo $this->escapeHtml($revision->getRev()); ?>"
                                <?php echo  (sizeof($revisions) == 1 or $i == 1) ? 'checked="checked"': ''; ?> />
                        </td>
                        <td>
                            <input type="radio" name="newRev" value="<?php  echo $this->escapeHtml($revision->getRev()); ?>"
                                <?php echo  (!$this->escapeHtml($i)) ? 'checked="checked"': ''; ?> />
                        </td>
                    </tr>
                    <?php
                    $i++;
                }
                ?>

                </tbody>

            </table>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <input type="submit" class="btn btn-primary" value="Compare revisions" />
        </div>
    </div>

</form>