php-censor/PHPCI/View/BuildsTable.phtml

83 lines
2.3 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): ?>
2013-05-10 13:28:43 +02:00
<?php
switch($build->getStatus())
{
case 0:
$cls = 'active';
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 = 'danger';
$subcls = 'danger';
2013-05-10 13:28:43 +02:00
$status = 'Failed';
break;
}
?>
<tr class="<?php print $cls; ?>">
2014-01-28 22:27:39 +01:00
<td><a href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
<td><a href="<?php echo PHPCI_URL ?>project/view/<?php print $build->getProjectId(); ?>">
<?php
if (is_object($build->getProject())) {
print htmlspecialchars($build->getProject()->getTitle());
} else {
print ' - ';
}
?></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) ) {
2014-01-28 22:27:39 +01:00
?> <span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span> <?php
2013-06-05 21:59:05 +02:00
}
?>
<?php
foreach($plugins as $plugin => $pluginstatus):
$subcls = $pluginstatus?'label label-success':'label label-danger';
2014-01-28 22:27:39 +01:00
?> <span class='<?php echo $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">
2014-01-28 22:27:39 +01:00
<a class="btn btn-default btn-small" href="<?php echo 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">
2014-01-28 22:27:39 +01:00
<li><a href="<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>" class="phpci-app-delete-build">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; ?>