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'); } } } ?>
getAllowPublicStatus()): ?>
(getId()]; ?>)
getId()][$idx])) { echo ''; } 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 ''; } } ?>