phpci/PHPCI/View/BuildsTable.phtml
2014-12-03 13:15:33 +00:00

84 lines
2.2 KiB
PHTML

<?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 = 'active';
$subcls = 'info';
$status = 'Pending';
break;
case 1:
$cls = 'warning';
$subcls = 'warning';
$status = 'Running';
break;
case 2:
$cls = 'success';
$subcls = 'success';
$status = 'Success';
break;
case 3:
$cls = 'danger';
$subcls = 'danger';
$status = 'Failed';
break;
}
?>
<tr class="<?php print $cls; ?>">
<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 class="hidden-md hidden-sm hidden-xs">
<?php
if ($build->getCommitId() !== 'Manual') {
print sprintf(
'<a href="%s" target="_blank">%s (%s)</a>',
$build->getCommitLink(),
substr($build->getCommitId(), 0, 7),
$build->getCommitterEmail()
);
} else {
print 'Manual Build';
}
?>
</td>
<td><a href="<?php print $build->getBranchLink(); ?>" target="_blank"><?php print $build->getBranch(); ?></a></td>
<td>
<span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span>
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-sm" href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">View</a>
<?php if($this->User()->getIsAdmin()): ?>
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>" class="phpci-app-delete-build">Delete Build</a></li>
</ul>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach; ?>