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

103 lines
4.4 KiB
PHTML

<div class="row">
<div class="col-sm-5">
<?php print $summary; ?>
</div>
<div class="col-sm-7 pull-left">
<div class="box box-primary">
<div class="box-header">
<h3 class="box-title">Latest Builds</h3>
</div>
<div class="box-body">
<ul class="timeline">
<?php $last = new \DateTime('-1 Year'); ?>
<?php
foreach ($builds as $build):
switch ($build->getStatus()) {
case \PHPCI\Model\Build::STATUS_NEW:
$updated = $build->getCreated();
$label = 'Created';
$color = 'blue';
break;
case \PHPCI\Model\Build::STATUS_RUNNING:
$updated = $build->getStarted();
$label = 'Started';
$color = 'yellow';
break;
case \PHPCI\Model\Build::STATUS_SUCCESS:
$updated = $build->getFinished();
$label = 'Successful';
$color = 'green';
break;
case \PHPCI\Model\Build::STATUS_FAILED:
$updated = $build->getFinished();
$label = 'Failed';
$color = 'red';
break;
}
if ($updated->format('Y-m-d') != $last->format('Y-m-d')): $last = $updated;
?>
<li class="time-label">
<span class="bg-gray">
<?php print $last->format('M j Y'); ?>
</span>
</li>
<?php endif; ?>
<!-- /.timeline-label -->
<!-- timeline item -->
<li>
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?> bg-<?php print $color; ?>"></i>
<div class="timeline-item">
<span class="time"><i class="fa fa-clock-o"></i> <?php print $updated->format('g:ia'); ?></span>
<h3 class="timeline-header">
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
<?php print $build->getProject()->getTitle(); ?>
</a>
-
<a href="<?php print PHPCI_URL; ?>build/view/<?php print $build->getId(); ?>">
Build #<?php print $build->getId(); ?>
</a>
-
<?php print $label; ?>
</h3>
<div class="timeline-body">
<?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';
}
?>
- <?php print $build->getCommitMessage(); ?>
</div>
</div>
</li>
<!-- END timeline item -->
<?php endforeach; ?>
<li>
<i class="fa fa-clock-o"></i>
</li>
</ul>
</div>
</div>
</div>
</div>