public function main($path) { // Gets all components from database $spaces = DataCenterDB::getSpaces(array_merge_recursive(DataCenterDB::buildJoin('facility', 'location', 'id', 'facility', 'space', 'location', array('name' => 'location_name')), DataCenterDB::buildSort('facility', 'space', array('location_name', 'name')))); $spacesTable = DataCenterDB::buildLookupTable('tense', $spaces); $tables = array(); foreach (array('present', 'future', 'past') as $tense) { if (isset($spacesTable[$tense])) { $tables[$tense] = DataCenterUI::renderWidget('table', array('rows' => $spacesTable[$tense], 'fields' => array('name', 'location' => array('field' => 'location_name'), 'size' => array('fields' => array('width', 'height', 'depth'), 'glue' => 'x'), 'power'), 'link' => array('page' => 'facilities', 'type' => 'space', 'id' => '#id', 'action' => 'view'))); } else { $tables[$tense] = null; } } // Returns 2 columm layout with a table and a map widget return DataCenterUI::renderLayout('columns', array(DataCenterUI::renderLayout('rows', array(DataCenterUI::renderWidget('heading', array('message' => 'spaces')), DataCenterUI::renderLayout('tabs', $tables))))); }