php-censor/PHPCI/View/BuildsTable.phtml

74 lines
2.1 KiB
PHTML
Raw Normal View History

2013-05-10 13:28:43 +02:00
<?php if(empty($builds) || !count($builds)): ?>
<tr class="">
<td colspan="6">No builds yet.</td>
</tr>
<?php endif; ?>
<?php foreach($builds as $build): ?>
<?php
switch($build->getStatus())
{
case 0:
$cls = 'info';
2013-06-05 21:59:05 +02:00
$subcls = 'info';
2013-05-10 13:28:43 +02:00
$status = 'Pending';
2013-06-05 21:59:05 +02:00
2013-05-10 13:28:43 +02:00
break;
case 1:
$cls = 'warning';
2013-06-05 21:59:05 +02:00
$subcls = 'warning';
2013-05-10 13:28:43 +02:00
$status = 'Running';
break;
case 2:
$cls = 'success';
2013-06-05 21:59:05 +02:00
$subcls = 'success';
2013-05-10 13:28:43 +02:00
$status = 'Success';
break;
case 3:
$cls = 'error';
2013-06-05 21:59:05 +02:00
$subcls = 'important';
2013-05-10 13:28:43 +02:00
$status = 'Failed';
break;
}
?>
<tr class="<?php print $cls; ?>">
<td><a href="<?= PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
<td><a href="<?= PHPCI_URL ?>project/view/<?php print $build->getProjectId(); ?>"><?php print $build->getProject()->getTitle(); ?></a></td>
<td><a href="<?php print $build->getCommitLink(); ?>"><?php print $build->getCommitId(); ?></a></td>
<td><a href="<?php print $build->getBranchLink(); ?>"><?php print $build->getBranch(); ?></a></td>
<td>
<?php
$plugins = json_decode($build->getPlugins(), true);
2013-06-05 21:59:05 +02:00
if ( !is_array($plugins) ) {
$plugins = array();
}
2013-06-05 21:59:05 +02:00
if ( 0 === count($plugins) ) {
?> <span class='label label-<?= $subcls ?>'><?= $status ?></span> <?php
2013-06-05 21:59:05 +02:00
}
?>
<?php
foreach($plugins as $plugin => $pluginstatus):
$subcls = $pluginstatus?'label label-success':'label label-important';
?> <span class='<?= $subcls ?>'><?php print $this->Build()->formatPluginName($plugin); ?></span> <?php endforeach; ?>
<br style='clear:both;' />
</td>
2013-05-10 13:28:43 +02:00
<td>
<div class="btn-group">
<a class="btn btn-default btn-small" href="<?= PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">View</a>
2013-05-10 17:25:51 +02:00
<?php if($this->User()->getIsAdmin()): ?>
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
2013-05-10 13:28:43 +02:00
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:confirmDelete('<?= PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>');">Delete Build</a></li>
2013-05-10 13:28:43 +02:00
</ul>
2013-05-10 17:25:51 +02:00
<?php endif; ?>
2013-05-10 13:28:43 +02:00
</div>
</td>
</tr>
<?php endforeach; ?>