2013-05-03 17:02:53 +02:00
|
|
|
<?php
|
2013-05-16 03:16:56 +02:00
|
|
|
/**
|
|
|
|
* PHPCI - Continuous Integration for PHP
|
|
|
|
*
|
|
|
|
* @copyright Copyright 2013, Block 8 Limited.
|
|
|
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
|
|
|
* @link http://www.phptesting.org/
|
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
|
|
|
|
namespace PHPCI\Controller;
|
2013-05-16 16:25:39 +02:00
|
|
|
|
2013-05-03 17:02:53 +02:00
|
|
|
use b8;
|
|
|
|
|
2013-05-16 03:30:48 +02:00
|
|
|
/**
|
|
|
|
* Index Controller - Displays the PHPCI Dashboard.
|
|
|
|
* @author Dan Cryer <dan@block8.co.uk>
|
|
|
|
* @package PHPCI
|
|
|
|
* @subpackage Web
|
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
class IndexController extends b8\Controller
|
|
|
|
{
|
2013-05-16 16:25:39 +02:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->_buildStore = b8\Store\Factory::getStore('Build');
|
|
|
|
$this->_projectStore = b8\Store\Factory::getStore('Project');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
$projects = $this->_projectStore->getWhere(array(), 50, 0, array(), array('title' => 'ASC'));
|
|
|
|
$view = new b8\View('Index');
|
|
|
|
$view->builds = $this->getLatestBuildsHtml();
|
|
|
|
$view->projects = $projects['items'];
|
|
|
|
|
|
|
|
return $view->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function latest()
|
|
|
|
{
|
|
|
|
die($this->getLatestBuildsHtml());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getLatestBuildsHtml()
|
|
|
|
{
|
|
|
|
$builds = $this->_buildStore->getWhere(array(), 10, 0, array(), array('id' => 'DESC'));
|
|
|
|
$view = new b8\View('BuildsTable');
|
|
|
|
$view->builds = $builds['items'];
|
|
|
|
|
|
|
|
return $view->render();
|
|
|
|
}
|
|
|
|
}
|