process/show: add toplevel rendering

This commit is contained in:
Thomas Gelf 2014-11-30 12:20:39 +01:00
parent fb18806c49
commit f2989790f2
2 changed files with 38 additions and 0 deletions

View file

@ -36,6 +36,11 @@ class Bpapp_ProcessController extends Controller
if ($this->params->get('edit')) {
$bp->setEditMode();
}
if ($this->params->get('mode') === 'toplevel') {
$this->render('toplevel');
}
}
protected function addSimulation($bp)

View file

@ -0,0 +1,33 @@
<?php
$count = $this->bp->countChildren();
$howMany = 'normal';
if ($count < 20) {
$howMany = 'few';
} elseif ($count > 50) {
$howMany = 'many';
}
?>
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?>
<a href="<?= $this->url()->without('mode') ?>" title="<?= $this->escape('Switch to tree view') ?>" style="float: right"><?= $this->icon('sitemap') ?></a>
<?= $this->render('simulationlink.phtml') ?>
<?= $this->render('editlink.phtml') ?>
</h1>
</div>
<div class="content" data-base-target="_next">
<form method="post" action="<?= $this->url()->without('process') ?>" data-base-target="_self">
<?= $this->formSelect('processName', $this->processName, array('class' => 'autosubmit'), $this->processList) ?>
</form>
<div class="toplevel <?= $howMany ?>" data-base-target="_next">
<?php foreach ($this->bp->getChildren() as $name => $node): ?>
<div class="<?= strtolower($node->getStateName()) ?><?= $node->isHandled() ? ' handled' : '' ?>">
<a href="<?= $this->url('bpapp/process/show', array('processName' => $this->processName, 'process' => $name)) ?>"><?= $this->escape($name) ?></a>
</div>
<?php endforeach ?>
</div>
<?= $this->render('warnings.phtml') ?>
</div>