本文整理汇总了PHP中REDCap类的典型用法代码示例。如果您正苦于以下问题:PHP REDCap类的具体用法?PHP REDCap怎么用?PHP REDCap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了REDCap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: events_completion
/**
* @param $subject_id
* @param $debug
* determine completeness of all survey-containing events
*/
function events_completion($subject_id, $debug) {
if (isset($subject_id)) {
global $Proj, $project_id;
$today = date("Y-m-d");
$fields = array();
$arms = get_arms(array_keys($Proj->eventsForms));
$baseline_event_id = $Proj->firstEventId;
$enrollment_event_id = getNextEventId($baseline_event_id);
$tx_duration = get_single_field($subject_id, $project_id, $enrollment_event_id, 'dm_suppdm_actarmdur', null);
$tx_first_event = array_search_recursive($tx_duration . ' Weeks', $arms) !== false ? array_search_recursive($tx_duration . ' Weeks', $arms) : null;
$survey_event_ids = isset($tx_first_event) ? array_merge(array($baseline_event_id), $Proj->getEventsByArmNum($arms[$tx_first_event]['arm_num'])) : array($baseline_event_id);
foreach ($survey_event_ids AS $survey_event_id) {
$survey_event_name = $Proj->getUniqueEventNames($survey_event_id);
$survey_prefix = substr($survey_event_name, 0, strpos($survey_event_name, '_'));
$fields[] = $survey_prefix . '_completed';
$fields[] = $survey_prefix . '_date';
$fields[] = $survey_prefix . '_startdate';
$fields[] = $survey_prefix . '_deadline';
}
$data = REDCap::getData('array', $subject_id, $fields, $baseline_event_id);
foreach ($survey_event_ids AS $survey_event_id) {
$data_event_name = $Proj->getUniqueEventNames($survey_event_id);
$prefix = substr($data_event_name, 0, strpos($data_event_name, '_'));
$is_t_complete = is_t_complete($subject_id, $survey_event_id);
$t_complete = $is_t_complete ? '1' : '0';
foreach ($data[$subject_id] AS $data_event_id => $data_event) {
foreach ($data_event AS $key => $value) {
/**
* derive intra-event timing variables
*/
switch ($key) {
case $prefix . '_completed':
update_field_compare($subject_id, $project_id, $data_event_id, $t_complete, $value, $key, $debug);
break;
case $prefix . '_date':
if ($value == '' && $is_t_complete) {
update_field_compare($subject_id, $project_id, $data_event_id, $today, $value, $key, $debug);
}
break;
default:
break;
}
}
}
/**
* derive inter-event timing variables
*/
$complete_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_completed', null);
$start_date_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_startdate', null);
$deadline_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_deadline', null);
$missed_value = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_missed', null);
$t_missed = $complete_value == '0' && $today > $deadline_value && isset($deadline_value) && $deadline_value != '' ? '1' : '0';
switch ($prefix) {
case 't1':
$t_base_date = get_single_field($subject_id, $project_id, $baseline_event_id, $prefix . '_date', null);
$t_start_date = $t_base_date;
$t_deadline_date = add_date($t_base_date, 89);
break;
default:
$t_base_date = get_single_field($subject_id, $project_id, $enrollment_event_id, 'dm_rfstdtc', null);
$t_start_date = add_date($t_base_date, ($arms[$data_event_name]['day_offset'] - $arms[$data_event_name]['offset_min']));
$t_deadline_date = add_date($t_base_date, ($arms[$data_event_name]['day_offset'] + $arms[$data_event_name]['offset_max']) - 1);
break;
}
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_complete, $complete_value, $prefix . '_completed', $debug);
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_missed, $missed_value, $prefix . '_missed', $debug);
if (isset($t_base_date) && $t_base_date != '') {
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_start_date, $start_date_value, $prefix . '_startdate', $debug);
update_field_compare($subject_id, $project_id, $baseline_event_id, $t_deadline_date, $deadline_value, $prefix . '_deadline', $debug);
}
}
}
}
示例2: code_terms
/**
* @param $record
* @param $redcap_event_name
* @param $instrument
* @param $debug
*/
public static function code_terms($record, $redcap_event_name, $instrument, $debug)
{
global $Proj, $project_id, $tx_fragment_labels;
$this_event_id = $Proj->getEventIdUsingUniqueEventName($redcap_event_name);
switch ($instrument) {
case 'ae_coding':
$recode_llt = false;
$recode_pt = true;
$recode_soc = true;
$prefix = 'ae';
/**
* AE_AEMODIFY
*/
$fields = array("ae_aeterm", "ae_oth_aeterm", "ae_aemodify");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_llt($project_id, $record, $this_event_id, fix_case($data[$record][$this_event_id]['ae_aeterm']), fix_case($data[$record][$this_event_id]['ae_oth_aeterm']), $data[$record][$this_event_id]['ae_aemodify'], 'ae_aemodify', $debug, $recode_llt);
if ($debug) {
error_log("DEBUG: Coded AE_AEMODIFY {$data[$record][$this_event_id]['ae_aemodify']}: subject=$record, event=$this_event_id for AE {$data[$record][$this_event_id]['ae_aeterm']} - {$data[$record][$this_event_id]['ae_oth_aeterm']}");
}
/**
* PREFIX_AEDECOD
* uses $tx_prefixes preset array
*/
$fields = array($prefix . "_aemodify", $prefix . "_aedecod");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_pt($project_id, $record, $this_event_id, $data[$record][$this_event_id][$prefix . "_aemodify"], $data[$record][$this_event_id][$prefix . "_aedecod"], $prefix . "_aedecod", $debug, $recode_pt);
if ($debug) {
error_log("DEBUG: Coded " . strtoupper($prefix) . "_AEDECOD {$data[$record][$this_event_id][$prefix . '_aedecod']}: subject=$record, event=$this_event_id for AEMODIFY {$data[$record][$this_event_id][$prefix . '_aemodify']}");
}
/**
* PREFIX_AEBODSYS
* uses $tx_prefixes preset array
*/
$fields = array($prefix . "_aedecod", $prefix . "_aebodsys");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_bodsys($project_id, $record, $this_event_id, $data[$record][$this_event_id][$prefix . "_aedecod"], $data[$record][$this_event_id][$prefix . "_aebodsys"], $prefix . "_aebodsys", $debug, $recode_soc);
if ($debug) {
error_log("DEBUG: Coded SOC: subject=$record, event=$this_event_id for AE {$data[$record][$this_event_id][$prefix . "_aedecod"]}");
}
unset($data);
break;
/**
* ADVERSE EVENTS
* ACTION: auto-code AE
*/
case 'adverse_events':
$recode_llt = true;
$recode_pt = true;
$recode_soc = true;
/**
* AE_AEDECOD
*/
$fields = array("ae_aeterm", "ae_oth_aeterm", "ae_aemodify");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_llt($project_id, $record, $this_event_id, fix_case($data[$record][$this_event_id]['ae_aeterm']), fix_case($data[$record][$this_event_id]['ae_oth_aeterm']), $data[$record][$this_event_id]['ae_aemodify'], 'ae_aemodify', $debug, $recode_llt);
if ($debug) {
error_log("DEBUG: Coded AE_AEMODIFY {$data[$record][$this_event_id]['ae_aemodify']}: subject=$record, event=$this_event_id for AE {$data[$record][$this_event_id]['ae_aeterm']} - {$data[$record][$this_event_id]['ae_oth_aeterm']}");
}
/**
* AE_AEDECOD
*/
$fields = array("ae_aemodify", "ae_aedecod");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_pt($project_id, $record, $this_event_id, fix_case($data[$record][$this_event_id]['ae_aemodify']), $data[$record][$this_event_id]['ae_aedecod'], 'ae_aedecod', $debug, $recode_pt);
if ($debug) {
error_log("DEBUG: Coded AE_AEDECOD {$data[$record][$this_event_id]['ae_aedecod']}: subject=$record, event=$this_event_id for AE {$data[$record][$this_event_id]['ae_aemodify']}");
}
/**
* AE_AEBODSYS
*/
$fields = array("ae_aedecod", "ae_aebodsys");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_bodsys($project_id, $record, $this_event_id, $data[$record][$this_event_id]['ae_aedecod'], $data[$record][$this_event_id]['ae_aebodsys'], 'ae_aebodsys', $debug, $recode_soc);
if ($debug) {
error_log("DEBUG: Coded SOC: subject=$record, event=$this_event_id for AE {$data[$record][$this_event_id]['ae_aedecod']}");
}
unset($data);
break;
/**
* MEDICAL HISTORY
* ACTION: auto-code MH
*/
case 'key_medical_history':
$recode_llt = false;
$recode_pt = true;
$recode_soc = true;
$mh_prefixes = array('othpsy', 'othca');
/**
* MH_MHMODIFY
*/
foreach ($mh_prefixes AS $prefix) {
$fields = array($prefix . "_oth_mhterm", $prefix . "_mhmodify");
$data = REDCap::getData('array', $record, $fields, $this_event_id);
code_llt($project_id, $record, $this_event_id, fix_case($data[$record][$this_event_id][$prefix . "_oth_mhterm"]), '', $data[$record][$this_event_id][$prefix . "_mhmodify"], $prefix . "_mhmodify", $debug, $recode_llt);
//.........这里部分代码省略.........
示例3: dirname
/**
* debug
*/
$debug = $_GET['debug'] ? (bool)$_GET['debug'] : false;
/**
* includes
*/
$base_path = dirname(dirname(dirname(__FILE__)));
require_once $base_path . "/redcap_connect.php";
require_once $base_path . '/plugins/includes/functions.php';
require APP_PATH_CLASSES . "Message.php";
/**
* restricted use
*/
$allowed_pids = array('38');
REDCap::allowProjects($allowed_pids);
Kint::enabled($debug);
/**
* initialize variables
*/
$item_count = 0;
$today = date('Y-m-d');
$rows = '';
/**
* query target_email_actions for any actions that haven't yet been digested.
* digest and send them
*/
$actions_result = db_query("SELECT DISTINCT * FROM target_email_actions WHERE (digest_date IS NULL OR digest_date = '') AND project_id = '$project_id' ORDER BY redcap_data_access_group ASC, abs(record) ASC");
if ($actions_result) {
while ($actions_row = db_fetch_assoc($actions_result)) {
$item_count++;
示例4: array
/**
* restrict access to one or more pids
*/
$allowed_pids = array('38');
REDCap::allowProjects($allowed_pids);
/**
* project metadata
*/
global $Proj;
/**
* initialize variables
*/
$plugin_title = "Derive Treatment Started (trt_suppex_txstat)";
/**
* plugin title
*/
echo "<h3>$plugin_title</h3>";
/**
* MAIN LOOP
*/
$fields = array("dm_rfstdtc", "trt_suppex_txstat");
$data = REDCap::getData('array', $subjects, $fields, $Proj->firstEventId);
if ($debug && $subjects != '') {
show_var($data);
}
foreach ($data AS $subject_id => $subject) {
foreach ($subject AS $event_id => $event) {
$started = $event['dm_rfstdtc'] == '' ? 'N' : 'Y';
update_field_compare($subject_id, $project_id, $event_id, $started, $event['trt_suppex_txstat'], 'trt_suppex_txstat', $debug);
}
}
示例5: dirname
<?php
/*
* Longitudinal Reports Plugin
* Luke Stevens, Murdoch Childrens Research Institute https://www.mcri.edu.au
* Version date 16-Nov-2015
*/
require_once dirname(__FILE__) . '/config.php';
// Validate id
if (!isset($_POST['report_id'])) {
exit('0');
}
$report_id = $_POST['report_id'];
$success = LongitudinalReports::deleteReport($report_id);
if ($success) {
REDCap::logEvent("Delete longitudinal report", "report_id = {$report_id}");
}
print $success === false ? '0' : '1';
示例6: exit
$stmt->close();
return -3;
}
// mgGetNumberOfKeyValuePairsForRecord
$scrf = PAGE_FULL;
/*****************************************************************************/
if (!array_key_exists("records_to_delete_textarea", $_POST)) {
// Present the form
if (!array_key_exists("pid", $_GET) or !($proj_id = $_GET["pid"])) {
exit("<b>Missing project number</b>. Make sure your URL appends \"<tt>?pid=123</tt>\" where <i>123</i> is your project number.");
}
$scrf .= "?pid=" . $proj_id;
if (!SUPER_USER) {
// Get array of user privileges for a single user in project (will have username as array key)
$this_user = USERID;
$rights = REDCap::getUserRights($this_user);
// If $rights returns NULL, then user does not have access to this project
if (empty($this_user) or empty($rights)) {
exit("User {$this_user} does NOT have access to this project.");
}
// Check if user can delete records
if (!$rights[$this_user]['record_delete']) {
exit("User {$this_user} does NOT have permission to delete records from this project.");
}
}
// echo "<p>The project is $proj_id.</p>"
?>
<p>Please paste in a list record numbers to delete, one per-line or separated by spaces. </p>
<p>Note that there is <i>no</i> confirmation of deletion! Once you click the DELETE RECORDS button below your supplied records will be <b>permanently deleted</b> from this project, so please double-check your list before proceeding. </p>
<form action="
示例7: set_dag
public static function set_dag($record, $instrument, $debug)
{
global $project_id;
/**
* SET Data Access Group based upon dm_usubjid prefix
*/
$fields = array('dm_usubjid');
$data = REDCap::getData('array', $record, $fields);
foreach ($data AS $subject) {
foreach ($subject AS $event_id => $event) {
if ($event['dm_usubjid'] != '') {
/**
* find which DAG this subject belongs to
*/
$site_prefix = substr($event['dm_usubjid'], 0, 3) . '%';
$dag_query = "SELECT group_id, group_name FROM redcap_data_access_groups WHERE project_id = '$project_id' AND group_name LIKE '$site_prefix'";
$dag_result = db_query($dag_query);
if ($dag_result) {
$dag = db_fetch_assoc($dag_result);
if (isset($dag['group_id'])) {
/**
* For each event in project for this subject, determine if this subject_id has been added to its appropriate DAG. If it hasn't, make it so.
* First, we need a list of events for which this subject has data
*/
$subject_events_query = "SELECT DISTINCT event_id FROM redcap_data WHERE project_id = '$project_id' AND record = '$record' AND field_name = '" . $instrument . "_complete'";
$subject_events_result = db_query($subject_events_query);
if ($subject_events_result) {
while ($subject_events_row = db_fetch_assoc($subject_events_result)) {
if (isset($subject_events_row['event_id'])) {
$_GET['event_id'] = $subject_events_row['event_id']; // for logging
/**
* The subject has data in this event_id
* does the subject have corresponding DAG assignment?
*/
$has_event_data_query = "SELECT DISTINCT event_id FROM redcap_data WHERE project_id = '$project_id' AND record = '$record' AND event_id = '" . $subject_events_row['event_id'] . "' AND field_name = '__GROUPID__'";
$has_event_data_result = db_query($has_event_data_query);
if ($has_event_data_result) {
$has_event_data = db_fetch_assoc($has_event_data_result);
if (!isset($has_event_data['event_id'])) {
/**
* Subject does not have a matching DAG assignment for this data
* construct proper matching __GROUPID__ record and insert
*/
$insert_dag_query = "INSERT INTO redcap_data SET record = '$record', event_id = '" . $subject_events_row['event_id'] . "', value = '" . $dag['group_id'] . "', project_id = '$project_id', field_name = '__GROUPID__'";
if (!$debug) {
if (db_query($insert_dag_query)) {
target_log_event($insert_dag_query, 'redcap_data', 'insert', $record, $dag['group_name'], 'Assign record to Data Access Group (' . $dag['group_name'] . ')');
} else {
error_log("SQL INSERT FAILED: " . db_error() . "\n");
echo db_error() . "\n";
}
} else {
show_var($insert_dag_query);
error_log('(TESTING) NOTICE: ' . $insert_dag_query);
}
}
db_free_result($has_event_data_result);
}
}
}
db_free_result($subject_events_result);
}
}
db_free_result($dag_result);
}
}
}
}
}
示例8: renderTestRow
public function renderTestRow($id, $label, $selectedRecord, $selectedEvent)
{
// Make a dropdown that contains all record_ids.
$data = REDCap::getData('array', NULL, REDCap::getRecordIdField());
//error_log("data: ".print_r($data,true));
foreach ($data as $record_id => $arr) {
$record_id_options[$record_id] = $record_id;
}
// Get all Events
$events = REDCap::getEventNames(TRUE, FALSE);
$row = RCView::tr(array(), RCView::td(array('class' => 'td1'), self::insertHelp('test')) . RCView::td(array('class' => 'td2'), "<label for='test-{$id}'><b>{$label}:</b></label>") . RCView::td(array('class' => 'td3'), RCView::span(array(), "Test logic using " . REDCap::getRecordIdField() . ":" . RCView::select(array('id' => "test_record-{$id}", 'name' => "test_record-{$id}", 'class' => "tbi x-form-text x-form-field", 'style' => 'height:20px;border:0px;', 'onchange' => "testLogic('{$id}');"), $record_id_options, $selectedRecord)) . RCView::span(array('style' => 'display:' . (REDCap::isLongitudinal() ? 'inline;' : 'none;')), " of event " . RCView::select(array('id' => "test_event-{$id}", 'name' => "test_event-{$id}", 'class' => "tbi x-form-text x-form-field", 'style' => 'height:20px;border:0px;', 'onchange' => "testLogic('{$id}');"), $events, $selectedEvent)) . RCView::span(array(), RCView::button(array('class' => 'jqbuttonmed ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only', 'onclick' => 'testLogic("' . $id . '");', 'style' => 'margin:0px 10px;'), 'Test') . RCView::span(array('id' => 'result-' . $id)))));
return $row;
}
示例9: array
/**
* restricted use
*/
$allowed_pids = array('26');
REDCap::allowProjects($allowed_pids);
global $Proj;
Kint::enabled($debug);
/**
* APRI
*/
$uln = 40;
$chem_fields = array('chem_lbdtc', 'ast_lbstresn');
$cbc_fields = array('cbc_lbdtc', 'plat_lbstresn', 'apri_lborres');
$cbc_data = REDCap::getData('array', '', $cbc_fields);
foreach ($cbc_data AS $subject_id => $subject) {
$chem_events = array();
$chem_data = REDCap::getData('array', $subject_id, $chem_fields);
foreach ($subject AS $event_id => $event) {
$apri_score = '';
if ($event['cbc_lbdtc'] != '' && $event['plat_lbstresn'] != '' && is_numeric($event['plat_lbstresn'])) {
foreach ($chem_data AS $chem_subject) {
foreach ($chem_subject AS $chem_event) {
if ($chem_event['chem_lbdtc'] != '' && $chem_event['ast_lbstresn'] != '' && $chem_event['chem_lbdtc'] == $event['cbc_lbdtc'] && is_numeric($chem_event['ast_lbstresn'])) {
$apri_score = (string)round(((($chem_event['ast_lbstresn'] / $uln) / $event['plat_lbstresn']) * 100), 2);
}
}
}
}
update_field_compare($subject_id, $project_id, $event_id, $apri_score, $event['apri_lborres'], 'apri_lborres', $debug);
}
}
示例10: microtime
* initialize variables
*/
$timer_start = microtime(true);
$monitor_name = $_POST['monitor_name'];
$table_csv = "";
$export_filename = "TRANSPLANT_MONITORING_" . strtoupper($monitor_name);
/**
* get sim/sof data
*/
$fields = array('sim_cmstdtc', 'sof_cmstdtc');
$data = REDCap::getData('array', '', $fields);
/**
* get TX history data
*/
$hist_fields = array("dm_rfstdtc", "dm_rfendtc", "livr_mhoccur");
$hist_data = REDCap::getData('array', '', $hist_fields, $first_event_id);
$subject_sql = "SELECT data.record AS subjid, IF (demo.username IS NULL, 'N', 'Y') AS demo_locker, IF (eot.username IS NULL, 'N', 'Y') AS eot_locker, dsterm.value AS eot_status, geno.value AS genotype FROM
(SELECT DISTINCT record, project_id FROM `redcap_data`) data
LEFT OUTER JOIN
(SELECT * FROM `redcap_locking_data` WHERE form_name = 'demographics') demo
ON data.record = demo.record AND data.project_id = demo.project_id
LEFT OUTER JOIN
(SELECT * FROM `redcap_locking_data` WHERE form_name = 'early_discontinuation_eot') eot
ON data.record = eot.record AND data.project_id = eot.project_id
LEFT OUTER JOIN
(SELECT * FROM redcap_data WHERE field_name = 'eot_dsterm') dsterm
ON data.record = dsterm.record AND data.project_id = dsterm.project_id
LEFT OUTER JOIN
(SELECT * FROM redcap_data WHERE field_name = 'hcvgt_lborres') geno
ON data.record = geno.record AND data.project_id = geno.project_id
WHERE data.project_id = '$project_id'";
示例11: DateTime
if ($rbv_event['rib_cmstdtc'] != '') {
if (!$has_rbv) {
$regimen = $regimen . ' RBV';
$has_rbv = true;
}
}
}
}
if ($sim && $sof) {
$wk4_start_obj = new DateTime($event['dm_rfstdtc']);
$wk4_start_obj->add(new DateInterval('P20D'));
$wk4_start_date = $wk4_start_obj->format('Y-m-d');
$wk4_end_obj = new DateTime($event['dm_rfstdtc']);
$wk4_end_obj->add(new DateInterval('P36D'));
$wk4_end_date = $wk4_end_obj->format('Y-m-d');
$hcv_data = REDCap::getData('array', $subject_id, $hcv_fields);
foreach ($hcv_data AS $hcv_subject) {
foreach ($hcv_subject AS $hcv_event) {
if (($wk4_start_date < $hcv_event['hcv_lbdtc'] && $hcv_event['hcv_lbdtc'] < $wk4_end_date) && ($hcv_event['hcv_lbstresn'] != '' || $hcv_event['hcv_supplb_hcvdtct'] != '')) {
$data_row = array();
if ($debug) {
show_var($subject_id, 'SUBJECT', 'blue');
show_var($regimen, 'REGIMEN');
show_var($event['dm_rfstdtc'], 'START DATE');
show_var($wk4_start_date, '4WK START');
show_var($hcv_event['hcv_lbdtc'], 'HCVRNA DATE');
show_var($wk4_end_date, '4WK END');
show_var($hcv_event['hcv_lbstresn'], 'QUANT');
show_var($hcv_event['hcv_supplb_hcvdtct'], 'DETECT');
}
$data_row['subjid'] = $subject_id;
示例12: array
$misc_fields = array('hcvgt_lborres', 'hcvgt_s_lborres', 'hcv_suppfa_hcvout', 'cirr_suppfa_cirrstat', 'cirr_suppfa_decomp', 'dcp_mhoccur', 'livr_mhoccur');
foreach ($misc_fields AS $field) {
if ($field != 'hcvgt_s_lborres') {
$header_array[] = quote_wrap(get_element_label($field));
}
}
$misc_data = REDCap::getData('array', $subjects, $misc_fields, $Proj->firstEventId);
$egfr_fields = array('egfr_lborres', 'egfr_im_lborres', 'egfr_lbblfl', 'egfr_im_lbblfl');
$egfr_data = REDCap::getData('array', $subjects, $egfr_fields);
foreach ($egfr_fields AS $field) {
if ($field == 'egfr_lborres') {
$header_array[] = quote_wrap('Baseline ' . get_element_label($field));
}
}
$hcvrna_fields = array('hcv_lbblfl', 'hcv_lbstresn', 'hcv_im_lbblfl', 'hcv_im_lbstresn');
$hcvrna_data = REDCap::getData('array', $subjects, $hcvrna_fields);
foreach ($hcvrna_fields AS $field) {
if ($field == 'hcv_lbstresn') {
$header_array[] = quote_wrap('Baseline ' . get_element_label($field));
}
}
/**
* MAIN
*/
foreach ($data AS $subject_id => $subject) {
d($subject[$Proj->firstEventId]['dm_usubjid']);
/**
* SUBJECT-LEVEL vars
*/
$data_row = array();
$regimens = array();
示例13: foreach
foreach ($fields AS $field) {
$header_array[] = quote_wrap($Proj->metadata[$field]['element_label']);
}
$data = REDCap::getData('array', '', $fields, $Proj->firstEventId);
$treatment_exp_fields = array('pegifn_mhoccur', 'pegifn_suppmh_response', 'triple_mhoccur', 'triple_suppmh_cmdaa', 'triple_suppmh_response', 'nopegifn_mhoccur', 'daa_mhoccur', 'daa_suppmh_failtype', 'daa_oth_suppmh_failtype');
foreach ($treatment_exp_fields AS $field) {
$header_array[] = quote_wrap($Proj->metadata[$field]['element_label']);
}
$treatment_exp_data = REDCap::getData('array', '', $treatment_exp_fields, $Proj->firstEventId);
$misc_fields = array('hcvgt_lborres', 'hcvgt_s_lborres', 'hcv_suppfa_hcvout', 'cirr_suppfa_cirrstat', 'dcp_mhoccur', 'livr_mhoccur');
foreach ($misc_fields AS $field) {
if ($field != 'hcvgt_s_lborres') {
$header_array[] = quote_wrap($Proj->metadata[$field]['element_label']);
}
}
$misc_data = REDCap::getData('array', '', $misc_fields, $Proj->firstEventId);
/**
* MAIN
*/
foreach ($data AS $subject_id => $subject) {
d($subject[$Proj->firstEventId]['dm_usubjid']);
/**
* SUBJECT-LEVEL vars
*/
$data_row = array();
$regimens = array();
/**
* MAIN EVENT LOOP
*/
foreach ($subject AS $event_id => $event) {
$data_row[get_element_label('dm_usubjid')] = $event['dm_usubjid'] != '' ? quote_wrap($event['dm_usubjid']) : quote_wrap('--');
示例14: array
require_once $base_path . '/plugins/includes/functions.php';
require_once APP_PATH_DOCROOT . '/Config/init_project.php';
require_once APP_PATH_DOCROOT . '/ProjectGeneral/header.php';
/**
* restrict use of this plugin to the appropriate project
*/
$allowed_pid = '26';
REDCap::allowProjects($allowed_pid);
Kint::enabled($debug);
global $Proj;
$baseline_event_id = $Proj->firstEventId;
/**
* let's bring this into the 21st century
*/
$fields = array('dm_subjid', 'dm_usubjid');
$data = REDCap::getData('array', $subjects, $fields, $baseline_event_id);
foreach ($data AS $subject) {
foreach ($subject AS $event_id => $event) {
if ($event['dm_usubjid'] != '') {
/**
* find which DAG this subject belongs to
*/
$site_prefix = substr($event['dm_usubjid'], 0, 3) . '%';
$dag_query = "SELECT group_id, group_name FROM redcap_data_access_groups WHERE project_id = '$project_id' AND group_name LIKE '$site_prefix'";
$dag_result = db_query($dag_query);
if ($dag_result) {
$dag = db_fetch_assoc($dag_result);
if (isset($dag['group_id'])) {
/**
* For each event in project for this subject, determine if this subject_id has been added to its appropriate DAG. If it hasn't, make it so.
* First, we need a list of events for which this subject has data
示例15: db_query
db_query($sql);*/
// Loop through report_ids and set new report_order
$report_order = 1;
$import = array();
foreach ($new_report_ids as $this_report_id) {
/* $sql = "update redcap_reports set report_order = ".$report_order++."
where project_id = $project_id and report_id = $this_report_id";
db_query($sql);*/
$rpt = array();
$rpt['report_id'] = $this_report_id;
$rpt['report_order'] = $report_order++;
$import[] = $rpt;
}
// Deal with orphaned report_ids added simultaneously by other user while this user reorders
foreach ($append_report_ids as $this_report_id) {
/* $sql = "update redcap_reports set report_order = ".$report_order++."
where project_id = $project_id and report_id = $this_report_id";
db_query($sql);*/
$rpt = array();
$rpt['report_id'] = $this_report_id;
$rpt['report_order'] = $report_order++;
$import[] = $rpt;
}
$success = LongitudinalReports::save($import);
if (!$success) {
exit('0');
}
// Logging
REDCap::logEvent("Reorder longitudinal reports", "report_id = " . $_POST['report_ids']);
// Return Value: If there are some extra reports that exist that are not currently in the list, then refresh the user's page
print !empty($append_report_ids) ? '2' : '1';