* * PHP version 5 * * @category Main * @package Loris * @author Tara Campbell <*****@*****.**> * @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 * @link https://github.com/aces/Loris */ header("content-type:application/json"); ini_set('default_charset', 'utf-8'); $DB = Database::singleton(); $recruitmentData = array(); $recruitmentStartDate = $DB->pselectOne("SELECT MIN(Date_registered) FROM candidate", array()); $recruitmentEndDate = $DB->pselectOne("SELECT MAX(Date_registered) FROM candidate", array()); $recruitmentData['labels'] = createChartLabels($recruitmentStartDate, $recruitmentEndDate); $list_of_sites = Utility::getAssociativeSiteList(true, false); foreach ($list_of_sites as $siteID => $siteName) { $recruitmentData['datasets'][] = array("name" => $siteName, "data" => getRecruitmentData($siteID, $recruitmentData['labels'])); } print json_encode($recruitmentData); return 0; /** * Create chart labels (dates) * * @param date $startDate start date of recruitment * @param date $endDate end date of recruitment * * @return array */ function createChartLabels($startDate, $endDate)
* @license Loris License * @link https://github.com/aces/Loris-Trunk */ header("content-type:application/json"); ini_set('default_charset', 'utf-8'); require_once "Database.class.inc"; require_once 'NDB_Client.class.inc'; require_once "Utility.class.inc"; $client = new NDB_Client(); $client->makeCommandLine(); $client->initialize(); $DB = Database::singleton(); $scanData = array(); $scanStartDate = $DB->pselectOne("SELECT MIN(AcquisitionDate) FROM mri_acquisition_dates", array()); $scanEndDate = $DB->pselectOne("SELECT MAX(AcquisitionDate) FROM mri_acquisition_dates", array()); $scanData['labels'] = createChartLabels($scanStartDate, $scanEndDate); $list_of_sites = Utility::getAssociativeSiteList(true, false); foreach ($list_of_sites as $siteID => $siteName) { $scanData['datasets'][] = array("name" => $siteName, "data" => getScanData($siteID, $scanData['labels'])); } print json_encode($scanData); exit; /** * Create chart labels (dates) * * @param date $startDate start date of scans * @param date $endDate end date of scans * * @return array */ function createChartLabels($startDate, $endDate)