ecoco/magento_profiler

View on GitHub
app/design/frontend/base/default/template/ecocode_profiler/collector/translation/panel/table.phtml

Summary

Maintainability
Test Coverage
<?php
/** @var Ecocode_Profiler_Helper_ValueExporter $valueExporter */
$valueExporter = $this->helper('ecocode_profiler/valueExporter');
$prefix        = 'trans-' . uniqid();

/** @var Ecocode_Profiler_Helper_Renderer $rendererHelper */
$rendererHelper = Mage::helper('ecocode_profiler/renderer');
?>


<table>
    <thead>
    <tr>
        <th>Locale</th>
        <th>Module</th>
        <th>Used Source</th>
        <th>Times used</th>
        <th>Message ID</th>
        <th>Message Preview</th>
    </tr>
    </thead>
    <tbody>
    <?php foreach ($this->getData('messages') as $index => $message): ?>
        <tr>
            <td class="font-normal text-small"><?php echo $message['locale'] ?></td>
            <td class="font-normal text-small text-bold nowrap"><?php echo $message['module'] ?></td>
            <td class="font-normal text-small text-bold nowrap"><?php echo isset($message['source']) ? $message['source'] : '-' ?></td>
            <td class="font-normal text-small"><?php echo $message['count'] ?></td>
            <td>
                <?php echo $message['code'] ?>

                <?php if ($message['parameters']): ?>
                    <button class="btn-link newline text-small sf-toggle"
                            data-toggle-selector="#parameters-<?php echo $prefix . $index ?>"
                            data-toggle-alt-content="Hide parameters">Show parameters
                    </button>

                    <div id="parameters-<?php echo $prefix . $index ?>" class="hidden">
                        <?php foreach ($message['parameters'] as $parameters): ?>
                            <?php echo $valueExporter->exportValue($parameters); ?>
                        <?php endforeach; ?>
                    </div>
                <?php endif; ?>
                <?php if ($message['traces']): ?>
                    <button class="btn-link newline text-small sf-toggle"
                            data-toggle-selector="#traces-<?php echo $prefix . $index ?>"
                            data-toggle-alt-content="Hide traces">Show traces
                    </button>

                <?php endif; ?>
            </td>
            <td><?php echo $message['translation'] ?></td>
        </tr>
        <?php if (!empty($message['traces'])): ?>
            <tr class="hidden" id="traces-<?php echo $prefix . $index ?>">
                <td colspan="3"></td>
                <td colspan="2">
                    <div id="stack-<?php echo $prefix . $index ?>">
                        <table class="">
                            <tbody>
                            <?php foreach (array_values($message['traces']) as $j => $trace): ?>
                                <tr>
                                    <td class="nowrap">#<?php echo $j + 1 ?></td>
                                    <td class="nowrap"><?php echo $trace['count']?>x</td>
                                    <td>
                                        <?php echo $rendererHelper->renderCallStack($j + 1, $trace['trace'], false) ?>
                                    </td>
                                </tr>
                            <?php endforeach; ?>

                            </tbody>
                        </table>
                    </div>
                </td>
            </tr>
        <?php endif; ?>

    <?php endforeach; ?>
    </tbody>
</table>