show/legend: modularize view scripts

This commit is contained in:
Thomas Gelf 2016-02-11 20:47:37 +01:00
parent 1ca48e88b1
commit b6097ec27b
2 changed files with 21 additions and 19 deletions

View file

@ -0,0 +1,20 @@
<ul class="legend">
<?php foreach ($this->template->getDatasources() as $ds): ?>
<?php if ($ds->isEnabled()): ?>
<li><div class="color" style="background-color: <?= $this->escape($ds->getColorCss()) ?>"></div> <?= $this->qlink(
$ds->getName(),
$this->url()->with('disableDatasource', $ds->getPath()),
null,
array('title' => $this->translate('Click to disable'))
) ?></span></li>
<?php else: ?>
<li class="disabled"><div class="color"></div> <?= $this->qlink(
$ds->getName(),
$this->url()->with('enableDatasource', $ds->getPath()),
null,
array('title' => $this->translate('Click to enable'))
) ?></span></li>
<?php endif ?>
<?php endforeach ?>
</ul>

View file

@ -12,25 +12,7 @@
<div class="content">
<?php if (is_array($this->images)): ?>
<ul class="legend">
<?php foreach ($this->template->getDatasources() as $ds): ?>
<?php if ($ds->isEnabled()): ?>
<li><div class="color" style="background-color: <?= $this->escape($ds->getColorCss()) ?>"></div> <?= $this->qlink(
$ds->getName(),
$this->url()->with('disableDatasource', $ds->getPath()),
null,
array('title' => $this->translate('Click to disable'))
) ?></span></li>
<?php else: ?>
<li class="disabled"><div class="color"></div> <?= $this->qlink(
$ds->getName(),
$this->url()->with('enableDatasource', $ds->getPath()),
null,
array('title' => $this->translate('Click to enable'))
) ?></span></li>
<?php endif ?>
<?php endforeach ?>
</ul>
<?= $this->render('show/legend.phtml') ?>
<?php foreach ($this->images as $title => $url): ?>
<img src="<?= $url ?>" alt="" width="<?= $this->width ?>" height="<?= $this->height ?>" />
<?php endforeach ?>