/** * LongitudinalReports::save * @param type $saveReportsArray an array of report config parameters rptid => p1 = v1, p2 = v2 * @return boolean */ public static function save($saveReportsArray) { $success = true; $saveArray = array(); // Add 'event' level so array is in format expected by REDCap::saveData foreach ($saveReportsArray as $rptParams) { $saveArray[$rptParams['report_id']][] = $rptParams; } $result = REDCap::saveData(LR_REPORT_DATA_PROJECT_ID, 'array', $saveArray, 'overwrite'); if (isset($result['errors']) && count($result['errors']) > 0) { $success = false; REDCap::logEvent('Longitudinal Reports save failed', print_r($result['errors'], true) . PHP_EOL . ' ' . print_r($saveArray, true)); } return $success; }