Refactored project structure.
This commit is contained in:
parent
cfe93434ad
commit
c015d8c58b
308 changed files with 39 additions and 47 deletions
43
src/View/Build/errors.phtml
Normal file
43
src/View/Build/errors.phtml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
$linkTemplate = $build->getFileLinkTemplate();
|
||||
|
||||
/** @var \PHPCensor\Model\BuildError[] $errors */
|
||||
foreach ($errors as $error):
|
||||
|
||||
$link = str_replace('{BASEFILE}', basename($error->getFile()), $linkTemplate);
|
||||
$link = str_replace('{FILE}', $error->getFile(), $link);
|
||||
$link = str_replace('{LINE}', $error->getLineStart(), $link);
|
||||
$link = str_replace('{LINE_END}', $error->getLineEnd(), $link);
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($error->getIsNew()): ?>
|
||||
<span class="label label-danger"><?= Lang::get('new'); ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<span class="label label-<?= $error->getSeverityClass(); ?>">
|
||||
<?= Lang::get($error->getSeverityString()); ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= Lang::get($error->getPlugin()); ?></td>
|
||||
<td><a href="<?= $link; ?>"><?= $error->getFile(); ?></a></td>
|
||||
<td>
|
||||
<a href="<?= $link; ?>">
|
||||
<?php
|
||||
if ($error->getLineStart() == $error->getLineEnd() || !$error->getLineEnd()) {
|
||||
echo $error->getLineStart();
|
||||
} else {
|
||||
echo ($error->getLineStart() . ' - ' . $error->getLineEnd());
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
<td class="visible-line-breaks"><?= htmlspecialchars(trim($error->getMessage())); ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
30
src/View/Build/header-row.phtml
Normal file
30
src/View/Build/header-row.phtml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build $build
|
||||
*/
|
||||
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
|
||||
<?php if ($build->getCommitterEmail()): ?>
|
||||
<div class="pull-left">
|
||||
<img src="https://www.gravatar.com/avatar/<?php print md5($build->getCommitterEmail()); ?>?d=mm&s=40" class="img-circle" alt="">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h4>
|
||||
<?php print $build->getProject()->getTitle(); ?>
|
||||
|
||||
<?php if ($build->getStatus() == \PHPCensor\Model\Build::STATUS_PENDING): ?>
|
||||
<small class="pull-right"><?php Lang::out('created_x', $build->getCreateDate()->format('H:i')); ?></small>
|
||||
<?php elseif ($build->getStatus() == \PHPCensor\Model\Build::STATUS_RUNNING): ?>
|
||||
<small class="pull-right"><?php Lang::out('started_x', $build->getStartDate()->format('H:i')); ?></small>
|
||||
<?php endif; ?>
|
||||
</h4>
|
||||
<p><?php Lang::out('branch_x', $build->getBranch()); ?></p>
|
||||
</a>
|
||||
</li>
|
||||
353
src/View/Build/view.phtml
Normal file
353
src/View/Build/view.phtml
Normal file
|
|
@ -0,0 +1,353 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Model\BuildError;
|
||||
|
||||
/**
|
||||
* @var Build $build
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">
|
||||
<?php Lang::out('build_details'); ?>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body no-padding">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th><?php Lang::out('project'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<a href="<?= APP_URL . 'project/view/' . $build->getProjectId(); ?>">
|
||||
<i class="fa fa-<?= $build->getProject()->getIcon(); ?>"></i>
|
||||
<?= $build->getProject()->getTitle(); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('branch'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<?php if (Build::SOURCE_WEBHOOK_PULL_REQUEST === $build->getSource()): ?>
|
||||
<a href="<?= $build->getRemoteBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getRemoteBranch(); ?> :
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= $build->getBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getBranch(); ?>
|
||||
</a>
|
||||
<?php if ($tag = $build->getTag()): ?> /
|
||||
<a href="<?= $build->getTagLink(); ?>">
|
||||
<i class="fa fa-tag"></i> <?= $tag; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('environment'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<?php
|
||||
$environment = $build->getEnvironment();
|
||||
echo !empty($environment) ? ('<i class="fa fa-gear"> ' . $environment) : '—' ;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('merged_branches'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<a href="<?= $build->getBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i> <?= $build->getBranch(); ?>
|
||||
</a>
|
||||
+ <?php
|
||||
$branches = $build->getExtra('branches');
|
||||
if (!empty($branches)) {
|
||||
foreach($branches as $branch) {
|
||||
?><i class="fa fa-code-fork"></i> <?php print $branch ?><?php
|
||||
}
|
||||
} else {
|
||||
?>—<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">
|
||||
<?php Lang::out('commit_details'); ?>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body no-padding">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th><?php Lang::out('build_source'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<?php Lang::out($build->getSourceHumanize()); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php Lang::out('commit'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<a href="<?= $build->getCommitLink(); ?>">
|
||||
<?php print substr($build->getCommitId(), 0, 7); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('committer'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<?php print $build->getCommitterEmail(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('commit_message'); ?></th>
|
||||
<td style="text-align: right">
|
||||
<?php print $build->getCommitMessage(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">
|
||||
<?php Lang::out('timing'); ?>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body no-padding">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th><?php Lang::out('created'); ?></th>
|
||||
<td style="text-align: right" class="build-created datetime">
|
||||
<?= ($build->getCreateDate() ? $build->getCreateDate()->format('Y-m-d H:i:s') : ''); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('started'); ?></th>
|
||||
<td style="text-align: right" class="build-started datetime">
|
||||
<?= ($build->getStartDate() ? $build->getStartDate()->format('Y-m-d H:i:s') : ''); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('finished'); ?></th>
|
||||
<td style="text-align: right" class="build-finished datetime">
|
||||
<?= ($build->getFinishDate() ? $build->getFinishDate()->format('Y-m-d H:i:s') : ''); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php Lang::out('duration'); ?></th>
|
||||
<td style="text-align: right" class="build-duration duration">
|
||||
<?= $build->getDuration(); ?> <?= Lang::get('seconds'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a href="#log" data-toggle="tab"><i class="fa fa-cogs"></i> <?php print Lang::get('build_log'); ?></a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="#errors" data-toggle="tab">
|
||||
<i class="fa fa-exclamation-triangle"></i> <?php print Lang::get('errors'); ?>
|
||||
<?php if ($data['errors_total'] == 0): ?>
|
||||
<span class="errors-label label label-danger" style="display: none">0</span>
|
||||
<?php else: ?>
|
||||
<span class="errors-label label label-danger"><?php print $data['errors_total']; ?></span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="#information" data-toggle="tab"><i class="fa fa-info-circle"></i> <?php print Lang::get('information'); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="log">
|
||||
<pre style="overflow-y: visible; white-space: pre-wrap"><?php print $data['log']; ?></pre>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="errors">
|
||||
<?php if ($build->getStatus() > Build::STATUS_RUNNING): ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?= Lang::get('filters'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php if ($data['errors'] < $data['errors_total']): ?>
|
||||
<p><?= Lang::get('errors_selected'); ?>: <?= $data['errors']; ?> / <?= $data['errors_total']; ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if (!empty($isNew)) {
|
||||
echo Lang::get($isNew);
|
||||
} else {
|
||||
echo Lang::get('all_errors');
|
||||
} ?> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?plugin=<?= urlencode($plugin); ?>&severity=<?= urlencode($severity); ?>#errors"><?= Lang::get('all_errors'); ?></a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($isNews)): ?>
|
||||
<?php foreach ($isNews as $currentIsNew) : ?>
|
||||
<li <?= ($currentIsNew === $isNew) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?is_new=<?= urlencode($currentIsNew); ?>&plugin=<?= urlencode($plugin); ?>&severity=<?= urlencode($severity); ?>#errors">
|
||||
<?= Lang::get($currentIsNew); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if (!empty($plugin)) {
|
||||
echo Lang::get('plugin') . ': ' . Lang::get($plugin);
|
||||
} else {
|
||||
echo Lang::get('all_plugins');
|
||||
} ?> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?is_new=<?= urlencode($isNew); ?>&severity=<?= urlencode($severity); ?>#errors"><?= Lang::get('all_plugins'); ?></a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($plugins)): ?>
|
||||
<?php foreach ($plugins as $currentPlugin) : ?>
|
||||
<li <?= ($currentPlugin === $plugin) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?is_new=<?= urlencode($isNew); ?>&plugin=<?= urlencode($currentPlugin); ?>&severity=<?= urlencode($severity); ?>#errors">
|
||||
<?= Lang::get($currentPlugin); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if ('' !== $severity) {
|
||||
echo Lang::get('severity') . ': ' . Lang::get(BuildError::getSeverityName($severity));
|
||||
} else {
|
||||
echo Lang::get('all_severities');
|
||||
} ?> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?is_new=<?= urlencode($isNew); ?>&plugin=<?= urlencode($plugin); ?>#errors"><?= Lang::get('all_severities'); ?></a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($severities)): ?>
|
||||
<?php foreach ($severities as $currentSeverity) : ?>
|
||||
<li <?= ($currentSeverity === $severity) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?is_new=<?= urlencode($isNew); ?>&plugin=<?= urlencode($plugin); ?>&severity=<?= urlencode($currentSeverity); ?>#errors">
|
||||
<?= Lang::get(BuildError::getSeverityName($currentSeverity)); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<table class="errors-table table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php Lang::out('is_new'); ?></th>
|
||||
<th><?php Lang::out('severity'); ?></th>
|
||||
<th><?php Lang::out('plugin'); ?></th>
|
||||
<th><?php Lang::out('file'); ?></th>
|
||||
<th data-orderable="false"><?php Lang::out('line'); ?></th>
|
||||
<th data-orderable="false"><?php Lang::out('message'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php print $data['error_html']; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="paginator">
|
||||
<?= $paginator; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="information">
|
||||
<div id="plugins" class="row"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="<?php print APP_URL; ?>assets/js/build.js"></script>
|
||||
<script>
|
||||
var PER_PAGE = <?= $perPage; ?>;
|
||||
var PAGE = <?= $page; ?>;
|
||||
var BUILD_PLUGIN = '<?= $plugin; ?>';
|
||||
var BUILD_SEVERITY = '<?= $severity; ?>';
|
||||
var BUILD_IS_NEW = '<?= $isNew; ?>';
|
||||
|
||||
var ActiveBuild = new Build(<?= $build->getId(); ?>);
|
||||
ActiveBuild.setupBuild(<?= json_encode($data); ?>, <?= json_encode($build->getFileLinkTemplate()); ?>);
|
||||
|
||||
var url = document.location.toString();
|
||||
if (url.match('#')) {
|
||||
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
|
||||
}
|
||||
|
||||
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
||||
window.location.hash = e.target.hash;
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
foreach ($uiPlugins as $uiPlugin) {
|
||||
print '<script src="' . APP_URL . 'assets/js/build-plugins/' . $uiPlugin . '"></script>' . PHP_EOL;
|
||||
}
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
ActiveBuild.renderPlugins();
|
||||
|
||||
$('#delete-build').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
confirmDelete("<?= APP_URL; ?>build/delete/<?= $build->getId(); ?>")
|
||||
.onCloseConfirmed = function () {window.location = '<?= APP_URL; ?>project/view/<?= $build->getProjectId(); ?>'};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
206
src/View/BuildStatus/view.phtml
Normal file
206
src/View/BuildStatus/view.phtml
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php print $project->getTitle(); ?> - PHP Censor</title>
|
||||
|
||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
||||
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/css/ansi-colors.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/css/main.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/ionicons/css/ionicons.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/jQuery/jquery-2.2.3.min.js"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/js/class.js"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/sprintf-js/dist/sprintf.min.js"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/js/app.js?v2" type="text/javascript"></script>
|
||||
</head>
|
||||
<body class="hold-transition skin-black layout-top-nav">
|
||||
<div class="wrapper">
|
||||
<header class="main-header">
|
||||
<nav class="navbar navbar-static-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a href="<?php print APP_URL; ?>" class="logo" title="PHP Censor" style="background-color: #222D32; width: 170px; padding: 0;">
|
||||
<img src="<?php print APP_URL; ?>assets/img/php-censor-white.svg" width="170" height="auto" alt="PHP Censor" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="content-wrapper">
|
||||
<div class="container">
|
||||
<section class="content" style="padding: 15px 0 15px;">
|
||||
<?php if (!empty($latest)): ?>
|
||||
|
||||
<?php
|
||||
|
||||
$statusClass = null;
|
||||
$statusText = null;
|
||||
|
||||
switch ($latest->getStatus()) {
|
||||
case 0:
|
||||
$statusClass = 'blue';
|
||||
$statusText = 'Pending';
|
||||
break;
|
||||
case 1:
|
||||
$statusClass = 'yellow';
|
||||
$statusText = 'Running';
|
||||
break;
|
||||
case 2:
|
||||
$statusClass = 'green';
|
||||
$statusText = 'Success';
|
||||
break;
|
||||
case 3:
|
||||
$statusClass = 'red';
|
||||
$statusText = 'Failed';
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="small-box small-box-full bg-<?= $statusClass; ?>">
|
||||
<div class="inner">
|
||||
<h3 class="box-title">
|
||||
<?php print $latest->getProject()->getTitle(); ?> #<?php print $latest->getId(); ?> (<?= $statusText; ?>)
|
||||
</h3>
|
||||
<p>
|
||||
<?php if ($latest->getCommitMessage()): ?>
|
||||
<?php print $latest->getCommitMessage(); ?><br /><br />
|
||||
<?php endif; ?>
|
||||
|
||||
<strong>Branch: </strong> <?php print $latest->getBranch(); ?><br />
|
||||
<strong>Committer: </strong> <?php print $latest->getCommitterEmail(); ?>
|
||||
|
||||
<?php if (!empty($latest->getCommitId())): ?>
|
||||
<br /><strong>Commit: </strong> <?php print $latest->getCommitId(); ?><br>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header"><h3 class="box-title">Builds</h3></div>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
<th>Commit</th>
|
||||
<th>Branch</th>
|
||||
<th>Environment</th>
|
||||
<th>Duration</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="latest-builds">
|
||||
|
||||
|
||||
<?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:
|
||||
$class = 'info';
|
||||
$status = 'Pending';
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$class = 'warning';
|
||||
$status = 'Running';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$class = 'success';
|
||||
$status = 'Success';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$class = 'danger';
|
||||
$status = 'Failed';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
|
||||
<td>
|
||||
<span class='label label-<?php echo $class ?>'><?php echo $status ?></span>
|
||||
</td>
|
||||
<td><?= $build->getCreateDate()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if (!empty($build->getCommitId())) {
|
||||
print sprintf(
|
||||
'<a href="%s">%s %s</a>',
|
||||
$build->getCommitLink(),
|
||||
substr($build->getCommitId(), 0, 7),
|
||||
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||
);
|
||||
} else {
|
||||
print '—';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php if (\PHPCensor\Model\Build::SOURCE_WEBHOOK_PULL_REQUEST === $build->getSource()): ?>
|
||||
<a href="<?= $build->getRemoteBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getRemoteBranch(); ?> :
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= $build->getBranchLink();?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getBranch(); ?>
|
||||
</a>
|
||||
<?php $branches = $build->getExtra('branches'); ?>
|
||||
<?= $branches ? ' + '.implode(', ', $branches) : ''; ?>
|
||||
<?php if ($tag = $build->getTag()): ?> /
|
||||
<a href="<?= $build->getTagLink(); ?>">
|
||||
<i class="fa fa-tag"></i>
|
||||
<?= $tag; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$environment = $build->getEnvironment();
|
||||
echo !empty($environment) ? $environment : '—' ;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $build->getDuration(); ?> sec.
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<!--<footer class="main-footer">
|
||||
<div class="container">
|
||||
</div>
|
||||
</footer>-->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
28
src/View/Email/layout.phtml
Normal file
28
src/View/Email/layout.phtml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<html>
|
||||
<head>
|
||||
<style>
|
||||
<?php include(__DIR__ . '/../../../public/assets/css/ansi-colors.css'); ?>
|
||||
body { font-family: arial, verdana, sans-serif; font-size: 15px; }
|
||||
header { font-size: 25px; margin-bottom: 15px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="background: #<?php print $build->isSuccessful() ? '090' : '900'; ?>; padding: 25px;">
|
||||
<div style="background: #fff; padding: 15px; border-radius: 5px">
|
||||
<header><?php print $project->getTitle(); ?> - Build #<?php print $build->getId(); ?></header>
|
||||
<div>
|
||||
<p>
|
||||
Your commit <strong><?php print $build->getCommitId(); ?></strong> generated a
|
||||
<?php print $build->isSuccessful() ? 'success' : 'failed'; ?> build in project
|
||||
<strong><?php print $project->getTitle(); ?></strong>.
|
||||
</p>
|
||||
<?php print $content; ?>
|
||||
</div>
|
||||
<footer>
|
||||
You can review <a href="<?php print $build->getCommitLink(); ?>">your commit</a>
|
||||
and the <a href="<?php print APP_URL . 'build/view/' . $build->getId(); ?>">build log</a>.
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
2
src/View/Email/long.phtml
Normal file
2
src/View/Email/long.phtml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<p style="margin: 10px; background: #fafafa"><?php print $build->getCommitMessage(); ?></p>
|
||||
<pre class="ansi_color_bg_black ansi_color_fg_white" style="padding: 4px"><?php print \PHPCensor\Helper\AnsiConverter::convert($build->getLog()); ?></pre>
|
||||
1
src/View/Email/short.phtml
Normal file
1
src/View/Email/short.phtml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<p style="margin: 10px; background: #fafafa"><?php print $build->getCommitMessage(); ?></p>
|
||||
1
src/View/Form/Button.phtml
Normal file
1
src/View/Form/Button.phtml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<input class="btn <?= $class; ?>" type="<?= $type; ?>" value="<?= $value; ?>">
|
||||
20
src/View/Form/Checkbox.phtml
Normal file
20
src/View/Form/Checkbox.phtml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php if (!($parent instanceof \PHPCensor\Form\Element\CheckboxGroup)): ?>
|
||||
<div class="control-group <?= $containerClass ?> <?= (isset($error) ? 'error' : ''); ?>">
|
||||
<div class="controls">
|
||||
<div class="checkbox">
|
||||
<?php endif; ?>
|
||||
<label class="checkbox <?= $class; ?>" for="<?= $id ?>">
|
||||
<input type="checkbox" id="<?= $id; ?>" name="<?= $name; ?>"
|
||||
value="<?= $checkedValue; ?>"
|
||||
<?= ($checked ? 'checked' : ''); ?> <?= $required ? 'required' : '' ?>
|
||||
>
|
||||
<?= $label; ?>
|
||||
</label>
|
||||
<?php if (isset($error)): ?>
|
||||
<span class="help-block"><?= $error; ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if (!($parent instanceof \PHPCensor\Form\Element\CheckboxGroup)): ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
11
src/View/Form/CheckboxGroup.phtml
Normal file
11
src/View/Form/CheckboxGroup.phtml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<div class="control-group <?= $class; ?>">
|
||||
<?php if ($label): ?>
|
||||
<label class="control-label"><?= $label; ?></label>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="controls">
|
||||
<?php foreach ($children as $field): ?>
|
||||
<?= $field; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
5
src/View/Form/ControlGroup.phtml
Normal file
5
src/View/Form/ControlGroup.phtml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="control-group <?= $class; ?>">
|
||||
<?php foreach ($children as $field): ?>
|
||||
<?= $field; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
1
src/View/Form/Csrf.phtml
Normal file
1
src/View/Form/Csrf.phtml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<input type="hidden" id="<?= $id; ?>" name="<?= $name; ?>" value="<?= $csrf; ?>">
|
||||
9
src/View/Form/FieldSet.phtml
Normal file
9
src/View/Form/FieldSet.phtml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<fieldset class="row <?= $class; ?>">
|
||||
<?php if ($label): ?>
|
||||
<legend><?= $label; ?></legend>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($children as $field): ?>
|
||||
<?= $field; ?>
|
||||
<?php endforeach; ?>
|
||||
</fieldset>
|
||||
5
src/View/Form/Form.phtml
Normal file
5
src/View/Form/Form.phtml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<form id="<?= $id; ?>" class="<?= $class; ?>" action="<?= $action; ?>" method="<?= $method; ?>">
|
||||
<?php foreach ($children as $field): ?>
|
||||
<?= $field; ?>
|
||||
<?php endforeach; ?>
|
||||
</form>
|
||||
1
src/View/Form/Hidden.phtml
Normal file
1
src/View/Form/Hidden.phtml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<input type="hidden" id="<?= $id; ?>" name="<?= $name; ?>" value="<?= $value; ?>">
|
||||
21
src/View/Form/Radio.phtml
Normal file
21
src/View/Form/Radio.phtml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<div id="<?= $id; ?>" class="control-group <?= $containerClass; ?>">
|
||||
<?php if ($label): ?>
|
||||
<label class="control-label"><?= $label; ?></label>
|
||||
<?php endif; ?>
|
||||
<div class="controls">
|
||||
<?php foreach ($options as $val => $lbl): ?>
|
||||
<label class="radio" for="radio-<?= $id; ?>-<?= $val; ?>">
|
||||
<input type="radio" id="radio-<?= $id; ?>-<?= $val; ?>" class="<?= $class; ?>"
|
||||
name="<?= $name; ?>"
|
||||
value="<?= $val; ?>"
|
||||
<?= ($value == $val) ? ' checked="checked"' : ''; ?> <?= $required ? 'required' : '' ?>
|
||||
>
|
||||
<?= $lbl; ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (isset($error)): ?>
|
||||
<span class="help-block"><?= $error; ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
19
src/View/Form/Select.phtml
Normal file
19
src/View/Form/Select.phtml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<div class="control-group <?= $containerClass; ?>">
|
||||
<?php if ($label): ?>
|
||||
<label class="control-label" for="<?= $id ?>"><?= $label; ?></label>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="controls">
|
||||
<select id="<?= $id; ?>" class="<?= $class; ?>" name="<?= $name; ?>">
|
||||
<?php foreach ($options as $val => $lbl): ?>
|
||||
<option
|
||||
value="<?= $val; ?>" <?= ($value == $val) ? ' selected="selected"' : ''; ?>
|
||||
><?= $lbl; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<?php if (isset($error)): ?>
|
||||
<span class="help-block"><?= $error; ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
17
src/View/Form/Text.phtml
Normal file
17
src/View/Form/Text.phtml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<div class="control-group <?= $containerClass; ?> <?= (isset($error) ? 'error' : ''); ?>">
|
||||
<?php if ($label): ?>
|
||||
<label class="control-label" for="<?= $id ?>"><?= $label; ?></label>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="controls">
|
||||
<input id="<?= $id; ?>" type="<?= $type; ?>" class="<?= $class; ?>"
|
||||
name="<?= $name; ?>"
|
||||
<?= isset($value) ? ' value="' . $value . '"' : '' ?>
|
||||
<?= isset($pattern) ? ' pattern="' . $pattern . '"' : '' ?>
|
||||
<?= $required ? ' required' : '' ?>
|
||||
>
|
||||
<?php if (isset($error)): ?>
|
||||
<span class="help-block"><?= $error; ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
13
src/View/Form/TextArea.phtml
Normal file
13
src/View/Form/TextArea.phtml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<div class="control-group <?= $containerClass; ?> <?= (isset($error) ? 'error' : ''); ?>">
|
||||
<?php if ($label): ?>
|
||||
<label class="control-label" for="<?= $id ?>"><?= $label; ?></label>
|
||||
<?php endif; ?>
|
||||
<div class="controls">
|
||||
<textarea rows="<?= $rows; ?>" id="<?= $id; ?>" class="<?= $class; ?>"
|
||||
name="<?= $name; ?>" <?= $required ? ' required' : '' ?>><?= isset($value) ? $value : '' ?></textarea>
|
||||
|
||||
<?php if (isset($error)): ?>
|
||||
<span class="help-block"><?= $error; ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
10
src/View/Group/edit.phtml
Normal file
10
src/View/Group/edit.phtml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('group_add_edit'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<?php print $form; ?>
|
||||
</div>
|
||||
</div>
|
||||
52
src/View/Group/index.phtml
Normal file
52
src/View/Group/index.phtml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
?>
|
||||
<div class="clearfix" style="margin-bottom: 20px;">
|
||||
<a class="btn btn-success pull-right" href="<?php print APP_URL . 'group/edit'; ?>">
|
||||
<?php Lang::out('group_add'); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php Lang::out('group_title'); ?></th>
|
||||
<th><?php Lang::out('group_count'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($groups as $group): ?>
|
||||
<tr>
|
||||
<td><?php print $group['title']; ?></td>
|
||||
<td><?php print count($group['projects']); ?></td>
|
||||
<td>
|
||||
<div class="btn-group btn-group-right">
|
||||
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>group/edit/<?php print $group['id']; ?>"><?php Lang::out('group_edit'); ?></a>
|
||||
<?php if($this->getUser()->getIsAdmin() && (!count($group['projects']))): ?>
|
||||
<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 APP_URL ?>group/delete/<?php print $group['id']; ?>" class="delete-group"><?php Lang::out('group_delete'); ?></a></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.delete-group').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
confirmDelete(e.target.href).onCloseConfirmed = function () {window.location = window.location.href};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
29
src/View/Home/index.phtml
Normal file
29
src/View/Home/index.phtml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @var array $widgets
|
||||
*/
|
||||
|
||||
$all_widgets = array_merge(array_keys($widgets['left']), array_keys($widgets['right']));
|
||||
foreach($all_widgets as $widget) {
|
||||
?><script src="<?= APP_URL ?>assets/js/dashboard-widgets/<?= $widget ?>.js" type="text/javascript"></script><?php
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-6 col-lg-5">
|
||||
<?php foreach ($widgets['left'] as $widget => $params) { ?>
|
||||
<div id="widget-<?= $widget ?>-container">
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if (!empty($widgets['right'])) { ?>
|
||||
<div class="col-md-6 col-lg-7 pull-left">
|
||||
<?php foreach ($widgets['right'] as $widget => $params) { ?>
|
||||
<div id="widget-<?= $widget ?>-container">
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
125
src/View/Project/ajax-builds.phtml
Normal file
125
src/View/Project/ajax-builds.phtml
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @var \PHPCensor\Model\Build[] $builds
|
||||
*/
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
?>
|
||||
|
||||
<?php if(empty($builds) || !count($builds)): ?>
|
||||
<tr class="">
|
||||
<td colspan="6"><?php Lang::out('no_builds_yet'); ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach($builds as $build): ?>
|
||||
|
||||
<?php
|
||||
switch($build->getStatus())
|
||||
{
|
||||
case 0:
|
||||
$cls = 'active';
|
||||
$subcls = 'info';
|
||||
$status = Lang::get('pending');
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$cls = 'warning';
|
||||
$subcls = 'warning';
|
||||
$status = Lang::get('running');
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$cls = 'success';
|
||||
$subcls = 'success';
|
||||
$status = Lang::get('success');
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$cls = 'danger';
|
||||
$subcls = 'danger';
|
||||
$status = Lang::get('failed');
|
||||
break;
|
||||
}
|
||||
|
||||
$branches = $build->getExtra('branches');
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="<?= APP_URL ?>build/view/<?= $build->getId(); ?>">#<?= str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
|
||||
<td><span class='label label-<?= $subcls ?>'><?= $status ?></span></td>
|
||||
<td><?= $build->getCreateDate()->format('Y-m-d H:i:s'); ?></td>
|
||||
<td><?php Lang::out($build->getSourceHumanize()); ?></td>
|
||||
<td class="hidden-md hidden-sm hidden-xs">
|
||||
<?php
|
||||
if (!empty($build->getCommitId())) {
|
||||
print sprintf(
|
||||
'<a href="%s">%s %s</a>',
|
||||
$build->getCommitLink(),
|
||||
substr($build->getCommitId(), 0, 7),
|
||||
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||
);
|
||||
} else {
|
||||
print '—';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (Build::SOURCE_WEBHOOK_PULL_REQUEST === $build->getSource()): ?>
|
||||
<a href="<?= $build->getRemoteBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getRemoteBranch(); ?> :
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= $build->getBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getBranch(); ?>
|
||||
</a>
|
||||
<?= $branches ? ' + '.implode(', ', $branches) : ''; ?>
|
||||
<?php if ($tag = $build->getTag()): ?> /
|
||||
<a href="<?= $build->getTagLink(); ?>">
|
||||
<i class="fa fa-tag"></i>
|
||||
<?= $tag; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$environment = $build->getEnvironment();
|
||||
echo !empty($environment) ? $environment : '—' ;
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $build->getDuration(); ?> <?= Lang::get('seconds'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $build->getNewErrorsCount(); ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group btn-group-right">
|
||||
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
|
||||
<?php if($this->getUser()->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 APP_URL ?>build/delete/<?php print $build->getId(); ?>" class="delete-build"><?php Lang::out('delete_build'); ?></a></li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.delete-build').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
confirmDelete(e.target.href)
|
||||
.onCloseConfirmed = function () {window.location = window.location.href};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
47
src/View/Project/edit.phtml
Normal file
47
src/View/Project/edit.phtml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<script src="<?= APP_URL; ?>assets/vendor/codemirror/lib/codemirror.js"></script>
|
||||
<script src="<?= APP_URL; ?>assets/vendor/codemirror/mode/yaml/yaml.js"></script>
|
||||
<link href="<?= APP_URL; ?>assets/vendor/codemirror/lib/codemirror.css" rel="stylesheet" type="text/css" />
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
CodeMirror.fromTextArea(document.getElementById('element-build_config'), {
|
||||
mode: "yaml",
|
||||
lineWrapping: true,
|
||||
lineNumbers: true
|
||||
});
|
||||
CodeMirror.fromTextArea(document.getElementById('element-environments'), {
|
||||
mode: "yaml",
|
||||
lineWrapping: true,
|
||||
lineNumbers: true
|
||||
});
|
||||
|
||||
setupProjectForm();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-8">
|
||||
<div class="box ">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('project_details'); ?></h3>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<?php print $form; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(!is_null($key)): ?>
|
||||
<div class="col-sm-4">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<p><?php Lang::out('public_key_help'); ?></p>
|
||||
<textarea style="width: 90%; height: 150px;"><?php print $key ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
223
src/View/Project/view.phtml
Normal file
223
src/View/Project/view.phtml
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @var \JasonGrimes\Paginator $paginator
|
||||
*/
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
?>
|
||||
<script>
|
||||
var PROJECT_ID = <?= $project->getId(); ?>;
|
||||
var PROJECT_ENVIRONMENT = '<?= $environment; ?>';
|
||||
var PROJECT_BRANCH = '<?= $branch; ?>';
|
||||
var PER_PAGE = <?= $perPage; ?>;
|
||||
var PAGE = <?= $page; ?>;
|
||||
</script>
|
||||
|
||||
<div class="clearfix" style="margin-bottom: 20px;">
|
||||
<a class="btn btn-default" href="<?= APP_URL . 'project/edit/' . $project->getId(); ?>">
|
||||
<?php Lang::out('edit_project'); ?>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-danger" id="delete-project">
|
||||
<?php Lang::out('delete_project'); ?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
$build_url = APP_URL . 'project/build/' . $project->getId();
|
||||
?>
|
||||
<div class="pull-right btn-group">
|
||||
<?php if (!$project->getArchived()): ?>
|
||||
<?php if ($this->getUser()->getIsAdmin()): ?>
|
||||
<?php if (!empty($environment)): ?>
|
||||
<a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['type' => 'environment', 'id' => $environment, 'debug' => 1]); ?>">
|
||||
<?php Lang::out('build_now_debug'); ?>
|
||||
</a>
|
||||
<?php elseif (!empty($branch)): ?>
|
||||
<a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['type' => 'branch', 'id' => $branch, 'debug' => 1]); ?>">
|
||||
<?php Lang::out('build_now_debug'); ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="btn btn-danger" href="<?= $build_url . '?' . http_build_query(['debug' => 1]); ?>">
|
||||
<?php Lang::out('build_now_debug'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($environment)): ?>
|
||||
<a class="btn btn-success" href="<?= $build_url . '?' . http_build_query(['type' => 'environment', 'id' => $environment]); ?>">
|
||||
<?php Lang::out('build_now'); ?>
|
||||
</a>
|
||||
<?php elseif (!empty($branch)): ?>
|
||||
<a class="btn btn-success" href="<?= $build_url . '?' . http_build_query(['type' => 'branch', 'id' => $branch]); ?>">
|
||||
<?php Lang::out('build_now'); ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="btn btn-success" href="<?= $build_url; ?>">
|
||||
<?php Lang::out('build_now'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="btn-group branch-btn pull-right">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if (!empty($environment)) {
|
||||
Lang::out('environment_x', $environment);
|
||||
} elseif (!empty($branch)) {
|
||||
Lang::out('branch_x', $branch);
|
||||
} else {
|
||||
Lang::out('all');
|
||||
} ?> <span class="caret"></span>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>"><?php Lang::out('all'); ?></a></li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($environments)): ?>
|
||||
<?php foreach ($environments as $currentEnvironment) : ?>
|
||||
<li <?= ($currentEnvironment == $environment) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?environment=<?= urlencode($currentEnvironment); ?>">
|
||||
<i class="fa fa-cog"></i><?= $currentEnvironment; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li class="divider"></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($branches as $currentBranch) : ?>
|
||||
<li <?= ($currentBranch == $branch) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?branch=<?= urlencode($currentBranch); ?>">
|
||||
<i class="fa fa-code-fork"></i><?= $currentBranch; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9 col-md-8 col-sm-8">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('builds'); ?> (<?= $total; ?>)</h3>
|
||||
</div>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php Lang::out('id'); ?></th>
|
||||
<th><?php Lang::out('status'); ?></th>
|
||||
<th><?php Lang::out('date'); ?></th>
|
||||
<th><?php Lang::out('build_source'); ?></th>
|
||||
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
|
||||
<th><?php Lang::out('branch'); ?></th>
|
||||
<th><?php Lang::out('environment'); ?></th>
|
||||
<th><?php Lang::out('duration'); ?></th>
|
||||
<th><?php Lang::out('new_errors'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="latest-builds">
|
||||
<?= $builds; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="paginator">
|
||||
<?= $paginator; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-md-4 col-sm-4">
|
||||
|
||||
<?php if ($project->getAllowPublicStatus()): ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h4 class="box-title"><?= Lang::get('public_status_title'); ?></h4>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
|
||||
<i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<span style="word-wrap: break-word;">
|
||||
<a href="<?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?>">
|
||||
<img src="<?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?>" />
|
||||
</a>
|
||||
|
||||
<br /><br />
|
||||
<?= Lang::get('public_status_image'); ?>:<br /><strong><?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?></strong>
|
||||
|
||||
<br /><br />
|
||||
<?= Lang::get('public_status_page'); ?>:<br /><strong><?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?></strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array($project->getType(), ['github', 'gitlab', 'bitbucket'])): ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h4 class="box-title"><?php Lang::out('webhooks'); ?></h4>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
|
||||
<i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<?php
|
||||
switch($project->getType())
|
||||
{
|
||||
case 'github':
|
||||
$url = APP_URL . 'webhook/github/' . $project->getId();
|
||||
Lang::out('webhooks_help_github', $project->getReference());
|
||||
break;
|
||||
|
||||
case 'gitlab':
|
||||
$url = APP_URL. 'webhook/gitlab/' . $project->getId();
|
||||
Lang::out('webhooks_help_gitlab');
|
||||
break;
|
||||
|
||||
case 'bitbucket':
|
||||
case 'bitbucket-hg':
|
||||
$url = APP_URL . 'webhook/bitbucket/' . $project->getId();
|
||||
Lang::out('webhooks_help_bitbucket', $project->getReference());
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<br><br><strong style="word-wrap: break-word;"><?= $url; ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($project->getSshPublicKey()): ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('public_key'); ?></h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
|
||||
<i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body" style="word-break: break-all;"><?= $project->getSshPublicKey(); ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#delete-project').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
confirmDelete("<?= APP_URL; ?>project/delete/<?= $project->getId(); ?>")
|
||||
.onCloseConfirmed = function () {window.location = '/'};
|
||||
});
|
||||
})
|
||||
</script>
|
||||
29
src/View/Session.phtml
Normal file
29
src/View/Session.phtml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><?php Lang::out('log_in_to_app'); ?></title>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/css/login.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<a id="logo" href="/">
|
||||
<img src="<?php print APP_URL; ?>assets/img/php-censor-white.svg" alt="PHP Censor" width="290" height="auto" /><br />
|
||||
</a>
|
||||
<div class="" id="login-box">
|
||||
<?php print $content; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/jQuery/jquery-2.2.3.min.js"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
28
src/View/Session/forgotPassword.phtml
Normal file
28
src/View/Session/forgotPassword.phtml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php if (isset($emailed)): ?>
|
||||
<p class="alert alert-success" style="margin-bottom: 0">
|
||||
<?php Lang::out('reset_emailed'); ?>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
<?php if (empty($error)): ?>
|
||||
<div class="" style="margin-bottom: 15px;">
|
||||
<?php Lang::out('reset_header'); ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-danger">
|
||||
<?php print $error; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="">
|
||||
<form class="form" action="<?php print APP_URL; ?>session/forgot-password" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="email"><?php Lang::out('reset_email_address'); ?></label>
|
||||
<input id="email" name="email" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="btn btn-success" type="submit" value="<?php Lang::out('reset_send_email'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
9
src/View/Session/login.phtml
Normal file
9
src/View/Session/login.phtml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php if($failed): ?>
|
||||
<p class="alert alert-danger"><?php Lang::out('login_error'); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php print $form; ?>
|
||||
|
||||
<a style="margin-top: -22px;" class="pull-right" href="<?php print APP_URL; ?>session/forgot-password">
|
||||
<?php Lang::out('forgotten_password_link'); ?>
|
||||
</a>
|
||||
23
src/View/Session/resetPassword.phtml
Normal file
23
src/View/Session/resetPassword.phtml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php if (empty($error)): ?>
|
||||
<div class="box-header">
|
||||
<?php Lang::out('reset_enter_password'); ?>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<form class="form" action="<?php print APP_URL; ?>session/reset-password/<?php print $id; ?>/<?php print $key; ?>" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="password"><?php Lang::out('reset_new_password'); ?></label>
|
||||
<input type="password" id="password" name="password" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="btn btn-success" type="submit" value="<?php Lang::out('reset_change_password'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="alert alert-danger" style="margin-bottom: 0">
|
||||
<?php print $error; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
9
src/View/User/edit.phtml
Normal file
9
src/View/User/edit.phtml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
<?php print $form; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
76
src/View/User/index.phtml
Normal file
76
src/View/User/index.phtml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
?>
|
||||
<div class="clearfix" style="margin-bottom: 20px;">
|
||||
<div class="pull-right btn-group">
|
||||
<a class="btn btn-success" href="<?php print APP_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php Lang::out('email_address'); ?></th>
|
||||
<th><?php Lang::out('name'); ?></th>
|
||||
<th><?php Lang::out('is_admin'); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="users">
|
||||
<?php foreach($users['items'] as $user): ?>
|
||||
<?php
|
||||
switch($user->getIsAdmin())
|
||||
{
|
||||
case 0:
|
||||
$cls = '';
|
||||
$status = Lang::get('no');
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$cls = 'warning';
|
||||
$status = Lang::get('yes');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<tr class="<?php print $cls; ?>">
|
||||
<td><a href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php print $user->getEmail(); ?></a></td>
|
||||
<td><?php print htmlspecialchars($user->getName()); ?></td>
|
||||
<td><?php print $status; ?></td>
|
||||
<td>
|
||||
<?php if($user->getIsAdmin()): ?>
|
||||
<div class="btn-group btn-group-right">
|
||||
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
|
||||
<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 APP_URL ?>user/delete/<?php print $user->getId(); ?>" class="delete-user"><?php Lang::out('delete_user'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.delete-user').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
confirmDelete(e.target.href)
|
||||
.onCloseConfirmed = function () {window.location = window.location.href};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
14
src/View/User/profile.phtml
Normal file
14
src/View/User/profile.phtml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php if (isset($updated)): ?>
|
||||
<p class="alert alert-success"><?php Lang::out('your_details_updated'); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('update_your_details'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php print $form; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
149
src/View/WidgetAllProjects/index-projects.phtml
Normal file
149
src/View/WidgetAllProjects/index-projects.phtml
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
foreach($projects as $project):
|
||||
$statuses = [];
|
||||
$failures = 0;
|
||||
$subcls = 'gray';
|
||||
$cls = '';
|
||||
$success = null;
|
||||
$failure = null;
|
||||
|
||||
if (count($builds[$project->getId()])) {
|
||||
// Get the most recent build status to determine the main block colour.
|
||||
$last_build = $builds[$project->getId()][0];
|
||||
$status = $last_build->getStatus();
|
||||
switch($status) {
|
||||
case 0:
|
||||
$subcls = 'blue';
|
||||
break;
|
||||
case 1:
|
||||
$subcls = 'yellow';
|
||||
break;
|
||||
case 2:
|
||||
$subcls = 'green';
|
||||
break;
|
||||
case 3:
|
||||
$subcls = 'red';
|
||||
break;
|
||||
}
|
||||
// Use the last 5 builds to determine project health:
|
||||
$failures = 0;
|
||||
|
||||
foreach ($builds[$project->getId()] as $build) {
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$statuses[] = 'pending';
|
||||
break;
|
||||
case 1:
|
||||
$statuses[] = 'running';
|
||||
break;
|
||||
case 2:
|
||||
$statuses[] = 'ok';
|
||||
$success = is_null($success) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $success;
|
||||
break;
|
||||
case 3:
|
||||
$failures++;
|
||||
$statuses[] = 'failed';
|
||||
$failure = is_null($failure) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $failure;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$buildCount = count($builds[$project->getId()]);
|
||||
$lastSuccess = $successful[$project->getId()];
|
||||
$lastFailure = $failed[$project->getId()];
|
||||
$message = Lang::get('no_builds_yet');
|
||||
$shortMessage = Lang::get('no_builds_yet');
|
||||
|
||||
if ($buildCount > 0) {
|
||||
if ($failures > 0) {
|
||||
$shortMessage = Lang::get('x_of_x_failed_short', $failures, $buildCount);
|
||||
$message = Lang::get('x_of_x_failed', $failures, $buildCount);
|
||||
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinishDate())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_built_successfully');
|
||||
}
|
||||
} else {
|
||||
$message = Lang::get('all_builds_passed', $buildCount);
|
||||
$shortMessage = Lang::get('all_builds_passed_short', $buildCount, $buildCount);
|
||||
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinishDate())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_failed_build');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="project-box" id="project-box-<?= $project->getId(); ?>">
|
||||
<div class="small-box small-box-full bg-<?= $subcls; ?>">
|
||||
|
||||
<div class="inner">
|
||||
<h3>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>">
|
||||
<?= $project->getTitle(); ?>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
<?= $message; ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
|
||||
</div>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>" class="small-box-footer small-box-footer-project">
|
||||
<div class="pull-left" style="margin-left: 10px">
|
||||
<?php if ($project->getAllowPublicStatus()): ?>
|
||||
<i class="fa fa-unlock"></i>
|
||||
<?php else: ?>
|
||||
<i class="fa fa-lock"></i>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php Lang::out('view_project'); ?> (<?php print $counts[$project->getId()]; ?>) <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
|
||||
<?php for ($idx=0; $idx < 5; $idx++) {
|
||||
if (empty($builds[$project->getId()][$idx])) {
|
||||
echo '<span class="small-box-footer-build small-box-footer bg-gray"><i class="fa fa-minus"></i></span>';
|
||||
} else {
|
||||
$build = $builds[$project->getId()][$idx];
|
||||
$link = APP_URL . 'build/view/' . $build->getId();
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$class = 'bg-blue';
|
||||
$icon = 'fa-clock-o';
|
||||
break;
|
||||
case 1:
|
||||
$class = 'bg-yellow';
|
||||
$icon = 'fa-cogs';
|
||||
break;
|
||||
case 2:
|
||||
$class = 'bg-green';
|
||||
$icon = 'fa-check';
|
||||
break;
|
||||
case 3:
|
||||
$class = 'bg-red';
|
||||
$icon = 'fa-times';
|
||||
break;
|
||||
}
|
||||
echo '<a href="' . $link .'" class="small-box-footer-build small-box-footer ' . $class . '"><i class="fa ' . $icon . '"></i></a>';
|
||||
}
|
||||
} ?>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
15
src/View/WidgetAllProjects/index.phtml
Normal file
15
src/View/WidgetAllProjects/index.phtml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php foreach ($groups as $group): ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php print $group['title']; ?></h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
|
||||
<i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php print $group['summary']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
145
src/View/WidgetAllProjects/update.phtml
Normal file
145
src/View/WidgetAllProjects/update.phtml
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
$statuses = [];
|
||||
$failures = 0;
|
||||
$subcls = 'gray';
|
||||
$cls = '';
|
||||
$success = null;
|
||||
$failure = null;
|
||||
|
||||
if (count($builds)) {
|
||||
// Get the most recent build status to determine the main block colour.
|
||||
$last_build = $builds[0];
|
||||
$status = $last_build->getStatus();
|
||||
switch($status) {
|
||||
case 0:
|
||||
$subcls = 'blue';
|
||||
break;
|
||||
case 1:
|
||||
$subcls = 'yellow';
|
||||
break;
|
||||
case 2:
|
||||
$subcls = 'green';
|
||||
break;
|
||||
case 3:
|
||||
$subcls = 'red';
|
||||
break;
|
||||
}
|
||||
// Use the last 5 builds to determine project health:
|
||||
$failures = 0;
|
||||
|
||||
foreach ($builds as $build) {
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$statuses[] = 'pending';
|
||||
break;
|
||||
case 1:
|
||||
$statuses[] = 'running';
|
||||
break;
|
||||
case 2:
|
||||
$statuses[] = 'ok';
|
||||
$success = is_null($success) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $success;
|
||||
break;
|
||||
case 3:
|
||||
$failures++;
|
||||
$statuses[] = 'failed';
|
||||
$failure = is_null($failure) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $failure;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$buildCount = count($builds);
|
||||
$lastSuccess = $successful;
|
||||
$lastFailure = $failed;
|
||||
$message = Lang::get('no_builds_yet');
|
||||
$shortMessage = Lang::get('no_builds_yet');
|
||||
|
||||
if ($buildCount > 0) {
|
||||
if ($failures > 0) {
|
||||
$shortMessage = Lang::get('x_of_x_failed_short', $failures, $buildCount);
|
||||
$message = Lang::get('x_of_x_failed', $failures, $buildCount);
|
||||
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinishDate())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_built_successfully');
|
||||
}
|
||||
} else {
|
||||
$message = Lang::get('all_builds_passed', $buildCount);
|
||||
$shortMessage = Lang::get('all_builds_passed_short', $buildCount, $buildCount);
|
||||
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinishDate())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_failed_build');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="small-box small-box-full bg-<?= $subcls; ?>">
|
||||
|
||||
<div class="inner">
|
||||
<h3>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>">
|
||||
<?= $project->getTitle(); ?>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
<?php print $message; ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
|
||||
</div>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>" class="small-box-footer small-box-footer-project">
|
||||
<div class="pull-left" style="margin-left: 10px">
|
||||
<?php if ($project->getAllowPublicStatus()): ?>
|
||||
<i class="fa fa-unlock"></i>
|
||||
<?php else: ?>
|
||||
<i class="fa fa-lock"></i>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php Lang::out('view_project'); ?> (<?= $counts; ?>) <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
|
||||
<?php for ($idx=0; $idx < 5; $idx++) {
|
||||
if (empty($builds[$idx])) {
|
||||
echo '<span class="small-box-footer-build small-box-footer bg-gray"><i class="fa fa-minus"></i></span>';
|
||||
} else {
|
||||
$build = $builds[$idx];
|
||||
$link = APP_URL . 'build/view/' . $build->getId();
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$class = 'bg-blue';
|
||||
$icon = 'fa-clock-o';
|
||||
break;
|
||||
case 1:
|
||||
$class = 'bg-yellow';
|
||||
$icon = 'fa-cogs';
|
||||
break;
|
||||
case 2:
|
||||
$class = 'bg-green';
|
||||
$icon = 'fa-check';
|
||||
break;
|
||||
case 3:
|
||||
$class = 'bg-red';
|
||||
$icon = 'fa-times';
|
||||
break;
|
||||
}
|
||||
echo '<a href="' . $link .'" class="small-box-footer-build small-box-footer ' . $class . '"><i class="fa ' . $icon . '"></i></a>';
|
||||
}
|
||||
} ?>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
5
src/View/WidgetBuildErrors/empty.phtml
Normal file
5
src/View/WidgetBuildErrors/empty.phtml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
?><div class=""><?= Lang::out('no_build_errors') ?></div>
|
||||
13
src/View/WidgetBuildErrors/index.phtml
Normal file
13
src/View/WidgetBuildErrors/index.phtml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?= Lang::out('projects_with_build_errors') ?></h3>
|
||||
</div>
|
||||
<div class="box-body" id="dashboard-build-errors">
|
||||
<?= $projects ?>
|
||||
</div>
|
||||
</div>
|
||||
157
src/View/WidgetBuildErrors/update.phtml
Normal file
157
src/View/WidgetBuildErrors/update.phtml
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
foreach($builds as $project_id => $project_envs):
|
||||
if (!isset($projects[$project_id])) {
|
||||
echo '<!-- project '.$project_id.' not set -->';
|
||||
continue;
|
||||
}
|
||||
$project = $projects[$project_id];
|
||||
foreach($project_envs as $environment => $project_env):
|
||||
$statuses = [];
|
||||
$failures = 0;
|
||||
$subcls = 'gray';
|
||||
$cls = '';
|
||||
$success = null;
|
||||
$failure = null;
|
||||
|
||||
// Get the most recent build status to determine the main block colour.
|
||||
$last_build = $project_env['latest'][0];
|
||||
$status = $last_build->getStatus();
|
||||
switch($status) {
|
||||
case 0:
|
||||
$subcls = 'blue';
|
||||
break;
|
||||
case 1:
|
||||
$subcls = 'yellow';
|
||||
break;
|
||||
case 2:
|
||||
$subcls = 'green';
|
||||
break;
|
||||
case 3:
|
||||
$subcls = 'red';
|
||||
break;
|
||||
}
|
||||
// Use the last 5 builds to determine project health:
|
||||
$failures = 0;
|
||||
|
||||
foreach ($project_env['latest'] as $build) {
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$statuses[] = 'pending';
|
||||
break;
|
||||
case 1:
|
||||
$statuses[] = 'running';
|
||||
break;
|
||||
case 2:
|
||||
$statuses[] = 'ok';
|
||||
$success = is_null($success) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $success;
|
||||
break;
|
||||
case 3:
|
||||
$failures++;
|
||||
$statuses[] = 'failed';
|
||||
$failure = is_null($failure) && !is_null($build->getFinishDate()) ? $build->getFinishDate()->format('Y-m-d H:i:s') : $failure;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$buildCount = count($project_env['latest']);
|
||||
$lastSuccess = $project_env['success'];
|
||||
$lastFailure = $project_env['failed'];
|
||||
$message = Lang::get('no_builds_yet');
|
||||
$shortMessage = Lang::get('no_builds_yet');
|
||||
|
||||
if ($buildCount > 0) {
|
||||
if ($failures > 0) {
|
||||
$shortMessage = Lang::get('x_of_x_failed_short', $failures, $buildCount);
|
||||
$message = Lang::get('x_of_x_failed', $failures, $buildCount);
|
||||
|
||||
if (!is_null($lastSuccess) && !is_null($lastSuccess->getFinishDate())) {
|
||||
$message .= Lang::get('last_successful_build', $lastSuccess->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_built_successfully');
|
||||
}
|
||||
} else {
|
||||
$message = Lang::get('all_builds_passed', $buildCount);
|
||||
$shortMessage = Lang::get('all_builds_passed_short', $buildCount, $buildCount);
|
||||
|
||||
if (!is_null($lastFailure) && !is_null($lastFailure->getFinishDate())) {
|
||||
$message .= Lang::get('last_failed_build', $lastFailure->getFinishDate()->format('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$message .= Lang::get('never_failed_build');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="project-box">
|
||||
<div class="small-box small-box-full bg-<?= $subcls; ?>">
|
||||
|
||||
<div class="inner">
|
||||
<h3>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>">
|
||||
<?= $project->getTitle(); ?>
|
||||
</a>
|
||||
<?php if (!empty($environment)) { ?>
|
||||
<sup title="<?php Lang::out('environment'); ?>"><?= $environment ?></sup>
|
||||
<?php } ?>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
<?= $message; ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
|
||||
</div>
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>" class="small-box-footer small-box-footer-project">
|
||||
<div class="pull-left" style="margin-left: 10px">
|
||||
<?php if ($project->getAllowPublicStatus()): ?>
|
||||
<i class="fa fa-unlock"></i>
|
||||
<?php else: ?>
|
||||
<i class="fa fa-lock"></i>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php Lang::out('view_project'); ?> <i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
|
||||
<?php for ($idx=0; $idx < 5; $idx++) {
|
||||
if (empty($project_env['latest'][$idx])) {
|
||||
echo '<span class="small-box-footer-build small-box-footer bg-gray"><i class="fa fa-minus"></i></span>';
|
||||
} else {
|
||||
$build = $project_env['latest'][$idx];
|
||||
$link = APP_URL . 'build/view/' . $build->getId();
|
||||
switch ($build->getStatus()) {
|
||||
case 0:
|
||||
$class = 'bg-blue';
|
||||
$icon = 'fa-clock-o';
|
||||
break;
|
||||
case 1:
|
||||
$class = 'bg-yellow';
|
||||
$icon = 'fa-cogs';
|
||||
break;
|
||||
case 2:
|
||||
$class = 'bg-green';
|
||||
$icon = 'fa-check';
|
||||
break;
|
||||
case 3:
|
||||
$class = 'bg-red';
|
||||
$icon = 'fa-times';
|
||||
break;
|
||||
}
|
||||
echo '<a href="' . $link .'" class="small-box-footer-build small-box-footer ' . $class . '"><i class="fa ' . $icon . '"></i></a>';
|
||||
}
|
||||
} ?>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
13
src/View/WidgetLastBuilds/index.phtml
Normal file
13
src/View/WidgetLastBuilds/index.phtml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?php Lang::out('latest_builds'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body" id="timeline-box">
|
||||
<?= $timeline ?>
|
||||
</div>
|
||||
</div>
|
||||
135
src/View/WidgetLastBuilds/update.phtml
Normal file
135
src/View/WidgetLastBuilds/update.phtml
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* @var Build[] $builds
|
||||
*/
|
||||
|
||||
?>
|
||||
<ul class="timeline">
|
||||
<?php $last = new \DateTime('-1 Year'); ?>
|
||||
|
||||
<?php
|
||||
foreach ($builds as $build):
|
||||
$environment = $build->getEnvironment();
|
||||
$branches = $build->getExtra('branches');
|
||||
|
||||
switch ($build->getStatus()) {
|
||||
case Build::STATUS_PENDING:
|
||||
$updated = $build->getCreateDate();
|
||||
$label = Lang::get('pending');
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case Build::STATUS_RUNNING:
|
||||
$updated = $build->getStartDate();
|
||||
$label = Lang::get('running');
|
||||
$color = 'yellow';
|
||||
break;
|
||||
|
||||
case Build::STATUS_SUCCESS:
|
||||
$updated = $build->getFinishDate();
|
||||
$label = Lang::get('success');
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case Build::STATUS_FAILED:
|
||||
$updated = $build->getFinishDate();
|
||||
$label = Lang::get('failed');
|
||||
$color = 'red';
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$updated) {
|
||||
$updated = $build->getCreateDate();
|
||||
}
|
||||
|
||||
if ($updated->format('Y-m-d') != $last->format('Y-m-d')): $last = $updated;
|
||||
?>
|
||||
<li class="time-label">
|
||||
<span class="bg-gray">
|
||||
<?= $last->format('Y-m-d'); ?>
|
||||
</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
|
||||
echo $updated->format('H:i:s');
|
||||
if ($build->getStatus() != Build::STATUS_PENDING) {
|
||||
echo ' — ' . $build->getDuration(); ?> <?= Lang::get('seconds');
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
<h3 class="timeline-header">
|
||||
<a href="<?= APP_URL; ?>project/view/<?= $build->getProjectId(); ?>">
|
||||
<?= $build->getProject()->getTitle(); ?>
|
||||
</a>
|
||||
<span><?= $environment; ?></span>
|
||||
—
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>">
|
||||
<?php Lang::out('build'); ?> #<?= $build->getId(); ?>
|
||||
</a>
|
||||
—
|
||||
<?php Lang::out($build->getSourceHumanize()); ?>
|
||||
<?php if ($newErrorsCount = $build->getNewErrorsCount()): ?>
|
||||
—
|
||||
<?php Lang::out('new_errors'); ?>:
|
||||
<?= $newErrorsCount; ?>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
|
||||
<div class="timeline-body">
|
||||
<p>
|
||||
<?php if (Build::SOURCE_WEBHOOK_PULL_REQUEST === $build->getSource()): ?>
|
||||
<a href="<?= $build->getRemoteBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getRemoteBranch(); ?> :
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="<?= $build->getBranchLink(); ?>">
|
||||
<i class="fa fa-code-fork"></i>
|
||||
<?= $build->getBranch(); ?>
|
||||
</a>
|
||||
<?= $branches ? ' + '.implode(', ', $branches) : ''; ?>
|
||||
<?php if ($tag = $build->getTag()): ?> /
|
||||
<a href="<?= $build->getTagLink(); ?>">
|
||||
<i class="fa fa-tag"></i>
|
||||
<?= $tag; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if (!empty($build->getCommitId())) {
|
||||
echo ' — ';
|
||||
echo sprintf(
|
||||
'<a href="%s">%s %s</a>',
|
||||
$build->getCommitLink(),
|
||||
substr($build->getCommitId(), 0, 7),
|
||||
$build->getCommitterEmail() ? ('(' . $build->getCommitterEmail() . ')') : ''
|
||||
);
|
||||
if (!empty($build->getCommitMessage())) {
|
||||
echo '</p><p>';
|
||||
print $build->getCommitMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<!-- END timeline item -->
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<li>
|
||||
<i class="fa fa-clock-o"></i>
|
||||
</li>
|
||||
</ul>
|
||||
22
src/View/exception.phtml
Normal file
22
src/View/exception.phtml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @var $exception \Exception
|
||||
*/
|
||||
|
||||
?>
|
||||
<div class="panel panel-danger">
|
||||
<div class="box-header">
|
||||
<h2 class="box-title">Sorry, there was a problem</h2>
|
||||
</div>
|
||||
|
||||
<?php if ($this->getUser()->getIsAdmin()): ?>
|
||||
<div class="box-body">
|
||||
<strong>Message</strong>: <?= $exception->getMessage(); ?><br />
|
||||
<strong>File</strong>: <?= $exception->getFile(); ?><br />
|
||||
<strong>Line</strong>: <?= $exception->getLine(); ?><br />
|
||||
<strong>Trace</strong>:
|
||||
<pre style="white-space: pre-wrap"><?= $exception->getTraceAsString(); ?></pre>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
266
src/View/layout.phtml
Normal file
266
src/View/layout.phtml
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
$user = $this->getUser();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php print $title; ?><?php print !empty($subtitle) ? ' - ' . $subtitle : ''; ?></title>
|
||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
|
||||
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/css/ansi-colors.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/css/main.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/ionicons/css/ionicons.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<script src="<?php print APP_URL; ?>assets/js/class.js"></script>
|
||||
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/jQuery/jquery-2.2.3.min.js"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/jQueryUI/jquery-ui.min.js" type="text/javascript"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
|
||||
<link href="<?php print APP_URL; ?>assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/chartjs/Chart.min.js" type="text/javascript"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/dist/js/app.min.js" type="text/javascript"></script>
|
||||
<script src="<?php print APP_URL; ?>assets/vendor/sprintf-js/dist/sprintf.min.js"></script>
|
||||
|
||||
<script src="<?php print APP_URL; ?>assets/js/app.js?v2" type="text/javascript"></script>
|
||||
|
||||
<script>
|
||||
var APP_URL = '<?= APP_URL; ?>';
|
||||
var LANGUAGE = '<?= Lang::getLanguage(); ?>';
|
||||
|
||||
<?php if (defined('JSON_UNESCAPED_UNICODE')): ?>
|
||||
var STRINGS = <?= json_encode(Lang::getStrings(), JSON_UNESCAPED_UNICODE); ?>;
|
||||
<?php else: ?>
|
||||
var STRINGS = <?= json_encode(Lang::getStrings()); ?>;
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body class="app-layout <?php print !empty($skin) ? 'skin-' . $skin : 'skin-black'; ?>">
|
||||
<div class="wrapper row-offcanvas row-offcanvas-left">
|
||||
|
||||
<!-- header logo: style can be found in header.less -->
|
||||
<header class="main-header">
|
||||
<a href="<?php print APP_URL; ?>" class="logo" title="PHP Censor">
|
||||
<img src="<?php print APP_URL; ?>assets/img/php-censor-white.svg" width="170" height="auto" alt="PHP Censor" />
|
||||
</a>
|
||||
<!-- Header Navbar: style can be found in header.less -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||
<span class="sr-only"><?php Lang::out('toggle_navigation'); ?></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<li class="dropdown messages-menu app-pending">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-clock-o"></i>
|
||||
<span class="label label-info app-pending-count"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="header"><?php Lang::out('n_builds_pending', 0); ?></li>
|
||||
<li>
|
||||
<ul class="menu app-pending-list">
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="dropdown messages-menu app-running">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-cogs"></i>
|
||||
<span class="label label-warning app-running-count"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="header"><?php Lang::out('n_builds_running', 0); ?></li>
|
||||
<li>
|
||||
<ul class="menu app-running-list">
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<?php if (!$this->loginIsDisabled()): ?>
|
||||
<!-- User Account: style can be found in dropdown.less -->
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="glyphicon glyphicon-user"></i>
|
||||
<span><?= $user->getName(); ?> <i class="caret"></i></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- User image -->
|
||||
<li class="user-header">
|
||||
<img src="https://www.gravatar.com/avatar/<?php print md5($user->getEmail()); ?>?d=mm" class="img-circle" alt="<?php print $user->getName(); ?>" />
|
||||
<p>
|
||||
<?php print $user->getName(); ?>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
<a href="<?php print APP_URL ?>user/profile" class="btn btn-default btn-flat"><?php Lang::out('edit_profile'); ?></a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="<?php print APP_URL ?>session/logout" class="btn btn-default btn-flat"><?php Lang::out('sign_out'); ?></a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
<aside class="main-sidebar sidebar-offcanvas">
|
||||
<!-- sidebar: style can be found in sidebar.less -->
|
||||
<section class="sidebar">
|
||||
|
||||
<?php if (!$this->loginIsDisabled()): ?>
|
||||
<!-- Sidebar user panel -->
|
||||
<div class="user-panel">
|
||||
<div class="pull-left image">
|
||||
<img src="https://www.gravatar.com/avatar/<?php print md5($user->getEmail()); ?>?d=mm" class="img-circle" alt="<?php print $user->getName(); ?>" />
|
||||
</div>
|
||||
<div class="pull-left info">
|
||||
<p><?php Lang::out('hello_name', $user->getName()); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- sidebar menu: : style can be found in sidebar.less -->
|
||||
<ul class="sidebar-menu">
|
||||
<li<?php print (array_key_exists('archived', $_GET) ? '' : ' class="active"'); ?>>
|
||||
<a href="<?php print APP_URL; ?>">
|
||||
<i class="fa fa-dashboard"></i> <span><?php Lang::out('dashboard'); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if ($user->getIsAdmin()): ?>
|
||||
<li class="treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-edit"></i>
|
||||
<span><?php Lang::out('admin_options'); ?></span>
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>project/add">
|
||||
<i class="fa fa-angle-double-right"></i> <?php Lang::out('add_project'); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>group">
|
||||
<i class="fa fa-angle-double-right"></i> <?php Lang::out('project_groups'); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>user">
|
||||
<i class="fa fa-angle-double-right"></i> <?php Lang::out('manage_users'); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($groups as $group): ?>
|
||||
<li class="treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-folder"></i>
|
||||
<span><?php print $group['title']; ?></span>
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</a>
|
||||
|
||||
<?php if (count($group['projects'])): ?>
|
||||
<ul class="treeview-menu">
|
||||
<?php foreach($group['projects'] as $project): ?>
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>project/view/<?= $project->getId(); ?>">
|
||||
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
|
||||
<span><?php print $project->getTitle(); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<li class="treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-archive"></i> <span><?php Lang::out('archived_menu'); ?></span>
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</a>
|
||||
|
||||
<?php if (count($archived_projects)): ?>
|
||||
<ul class="treeview-menu">
|
||||
<?php foreach($archived_projects as $archived_project): ?>
|
||||
<li>
|
||||
<a href="<?php print APP_URL; ?>project/view/<?= $archived_project->getId(); ?>">
|
||||
<i class="fa fa-<?= $archived_project->getIcon(); ?>"></i>
|
||||
<span><?= $archived_project->getTitle(); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
<!-- /.sidebar -->
|
||||
</aside>
|
||||
|
||||
<!-- Right side column. Contains the navbar and content of the page -->
|
||||
<aside class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<div class="pull-right">
|
||||
<?php print (!empty($actions) ? $actions : ''); ?>
|
||||
</div>
|
||||
|
||||
<h1>
|
||||
<?php print !empty($title) ? $title : 'PHP Censor'; ?>
|
||||
|
||||
<?php if (!empty($subtitle)): ?>
|
||||
<small><?php print $subtitle; ?></small>
|
||||
<?php endif; ?>
|
||||
</h1>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<?php
|
||||
if (!empty($_SESSION['global_error'])) {
|
||||
$message = $_SESSION['global_error'];
|
||||
unset($_SESSION['global_error']);
|
||||
print '<div class="alert alert-danger">' . $message . '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?= $content; ?>
|
||||
</section>
|
||||
</aside>
|
||||
<footer class="main-footer">
|
||||
PHP Censor v<?= $version; ?>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
28
src/View/pagination.phtml
Normal file
28
src/View/pagination.phtml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
|
||||
/**
|
||||
* @var \JasonGrimes\Paginator $paginator
|
||||
*/
|
||||
|
||||
?>
|
||||
<ul class="pagination">
|
||||
<?php if ($paginator->getPrevUrl()): ?>
|
||||
<li><a href="<?php echo $paginator->getPrevUrl(); ?>"><?= Lang::get('prev_link'); ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($paginator->getPages() as $pageArray): ?>
|
||||
<?php if ($pageArray['url']): ?>
|
||||
<li <?php echo $pageArray['isCurrent'] ? 'class="active"' : ''; ?>>
|
||||
<a href="<?php echo $pageArray['url']; ?>"><?php echo $pageArray['num']; ?></a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="disabled"><span><?php echo $pageArray['num']; ?></span></li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($paginator->getNextUrl()): ?>
|
||||
<li><a href="<?php echo $paginator->getNextUrl(); ?>"><?= Lang::get('next_link'); ?></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
Loading…
Add table
Add a link
Reference in a new issue