* @package PHPCI * @subpackage Web */ class IndexController extends b8\Controller { public function init() { $this->_buildStore = b8\Store\Factory::getStore('Build'); $this->_projectStore = b8\Store\Factory::getStore('Project'); } /** * Display PHPCI dashboard: */ 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(); } /** * AJAX get latest builds table (HTML) */ public function latest() { die($this->getLatestBuildsHtml()); } /** * Get latest builds and render as a table. */ 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(); } }