phpci/PHPCI/View/Project.phtml
2013-05-10 16:25:51 +01:00

86 lines
2.9 KiB
PHTML

<div id="title">
<h1>Project: <?= $project->getTitle(); ?></h1>
</div>
<div class="row">
<div class="span3">
<div class="well" style="padding: 8px 0">
<ul class="nav nav-list">
<li><a href="/"><i class="icon-home"></i> Dashboard</a></li>
<li><a href="/project/view/<?= $project->getId(); ?>"><i class="icon-folder-open"></i> <?= $project->getTitle(); ?></a></li>
<li class="divider"></li>
<li class="nav-header">Options</li>
<li><a href="/project/build/<?= $project->getId(); ?>"><i class="icon-cog"></i> Build Now</a></li>
<?php if($this->User()->getIsAdmin()): ?>
<li><a href="/project/edit/<?= $project->getId(); ?>"><i class="icon-edit"></i> Edit Project</a></li>
<li><a href="javascript:confirmDelete('/project/delete/<?= $project->getId(); ?>')"><i class="icon-trash"></i> Delete Project</a></li>
<?php endif; ?>
</ul>
</div>
<br>
<p class="alert alert-info">To automatically build this project when new commits are pushed, add the URL below
<?php
switch($project->getType())
{
case 'github':
$url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'] . '/github/webhook/' . $project->getId();
print ' as a "WebHook URL" in the <a href="https://github.com/' . $project->getReference() . '/settings/hooks">Service Hooks</a> section of your Github repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
break;
case 'bitbucket':
$url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'] . '/bitbucket/webhook/' . $project->getId();
print ' as a "POST" service in the <a href="https://bitbucket.org/' . $project->getReference() . '/admin/services">Services</a> section of your Bitbucket repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
break;
}
?>
</p>
</div>
<div class="span9">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Project</th>
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
<th style="width: 1%"></th>
</tr>
</thead>
<tbody id="latest-builds">
<?= $builds; ?>
</tbody>
</table>
<?php
print '<div class="pagination"><ul>';
$pages = ceil($total / 10);
$pages = $pages == 0 ? 1 : $pages;
print '<li class="'.($page == 1 ? 'disabled' : '').'"><a href="/project/view/'.$project->getId().'?p='.($page == 1 ? '1' : $page - 1).'">&laquo;</a></li>';
for($i = 1; $i <= $pages; $i++)
{
print '<li><a href="/project/view/' . $project->getId() . '?p=' . $i . '">' . $i . '</a></li>';
}
print '<li class="'.($page == $pages ? 'disabled' : '').'"><a href="/project/view/'.$project->getId().'?p='.($page == $pages ? $pages : $page + 1).'">&raquo;</a></li>';
print '</ul></div>';
?>
</div>
</div>
<?php if($page == 1): ?>
<script>
setInterval(function()
{
$('#latest-builds').load('/project/builds/<?= $project->getId(); ?>');
}, 10000);
</script>
<?php endif; ?>