• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP REDCap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中REDCap的典型用法代码示例。如果您正苦于以下问题:PHP REDCap类的具体用法?PHP REDCap怎么用?PHP REDCap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了REDCap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
			}
		}
	}
}
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:78,代码来源:propup_functions.php


示例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);
//.........这里部分代码省略.........
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:101,代码来源:Prioritize.php


示例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++;
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:send_siteupload_digest.php


示例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);
	}
}
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:derive_tx_started.php


示例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';
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:18,代码来源:report_delete_ajax.php


示例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="
开发者ID:rito-mg,项目名称:REDCap,代码行数:31,代码来源:batch_delete_records.php


示例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);
					}
				}
			}
		}
	}
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:69,代码来源:Subject.php


示例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;
 }
开发者ID:mypandos,项目名称:REDCap-AutoNotify,代码行数:13,代码来源:common.php


示例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);
	}
}
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:derive_apri.php


示例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'";
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:report-transplant-monitoring.php


示例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;
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:report-4wk-hcvrna.php


示例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();
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:report_treatment_data_locking.php


示例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('--');
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:report_resource_data.php


示例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
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:push_dags.php


示例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';
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:31,代码来源:report_order_ajax.php


示例16: getData


//.........这里部分代码省略.........
         					unset($all_forms);
         					// Stop after we have all the fields for the first event listed (that's all we need)
         					break; // 2;
         //				}
         			} */
         // Loop through fields in order specified in LongitudinalReport spec
         foreach ($fields as $this_eventfield) {
             // If field is only a sorting field and not a real data field to return, then skip it
             if ($applySortFields && in_array($this_eventfield, $sortArrayRemoveFromData)) {
                 continue;
             }
             $this_eventref = LongitudinalReports::getEventFromEventField($this_eventfield);
             $this_field = LongitudinalReports::getFieldFromEventField($this_eventfield);
             // If a checkbox split into multiple fields
             //                                if (is_array($this_value) && !$combine_checkbox_values) {
             if ($Proj->isCheckbox($this_field) && !$combine_checkbox_values) {
                 // If exporting labels, get labels for this field
                 //if ($outputCsvHeadersAsLabels) {
                 $this_field_enum = parseEnum($Proj->metadata[$this_field]['element_enum']);
                 //}
                 // Loop through all checkbox choices and add as separate "fields"
                 foreach ($this_field_enum as $this_code => $this_checked_value) {
                     // Store original code before formatting
                     $this_code_orig = $this_code;
                     // If coded value is not numeric, then format to work correct in variable name (no spaces, caps, etc)
                     $this_code = Project::getExtendedCheckboxCodeFormatted($this_code);
                     // Add choice to header
                     //                                                $headers[] = ($outputCsvHeadersAsLabels)
                     //                                                        ? str_replace($orig, $repl, strip_tags(label_decode($Proj->metadata[$this_field]['element_label'])))." (choice=".str_replace(array("'","\""),array("",""),$this_field_enum[$this_code_orig]).")"
                     //                                                        : $this_field."___".$this_code;
                     if ($outputCsvHeadersAsLabels) {
                         // Longitudinal Reports - also include event name in header labels/ref
                         $event_id = $Proj->getEventIdUsingUniqueEventName($this_eventref);
                         $event_name = REDCap::getEventNames(false, true, $event_id);
                         $hdr_display = str_replace($orig, $repl, strip_tags(label_decode($Proj->metadata[$this_field]['element_label']))) . " ({$event_name})" . " (choice=" . str_replace(array("'", "\""), array("", ""), $this_field_enum[$this_code_orig]) . ")";
                         $headers[] = $hdr_display;
                     } else {
                         $headers[] = "[{$this_eventref}][{$this_field}___{$this_code}]";
                     }
                 }
                 // If a normal field or DAG/Survey fields
             } else {
                 // Get this field's form
                 $this_form = $Proj->metadata[$this_field]['form_name'];
                 // If the record ID field
                 if ($this_field == $table_pk) {
                     $headers[] = $outputCsvHeadersAsLabels ? str_replace($orig, $repl, strip_tags(label_decode($Proj->metadata[$table_pk]['element_label']))) : $table_pk;
                     //								// If longitudinal, add unique event name to line
                     //								if ($longitudinal) {
                     //									$headers[] = ($outputCsvHeadersAsLabels) ? 'Event Name' : 'redcap_event_name';
                     //								}
                 } elseif (!$outputCsvHeadersAsLabels) {
                     // Add field to header array
                     $headers[] = $this_eventfield;
                     // $this_field;
                     // Add checkbox labels to array (only for $combine_checkbox_values=TRUE)
                     //if (is_array($this_value) && $combine_checkbox_values) {
                     if ($combine_checkbox_values && $Proj->isCheckbox($this_field)) {
                         foreach (parseEnum($Proj->metadata[$this_field]['element_enum']) as $raw_coded_value => $checkbox_label) {
                             $checkbox_choice_labels[$raw_coded_value] = $checkbox_label;
                         }
                     }
                     /*                                        // Output labels for normal field or DAG/Survey fields
                                                             } elseif ($this_field == 'redcap_data_access_group') {
                                                                     $headers[] = 'Data Access Group';
                                                             } elseif ($this_field == 'redcap_survey_identifier') {
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:67,代码来源:LongitudinalRecords.php


示例17: array

$reportData['orderby_field2'] = $orderby_field2;
$reportData['orderby_sort2'] = $orderby_sort2;
$reportData['orderby_field3'] = $orderby_field3;
$reportData['orderby_sort3'] = $orderby_sort3;
$reportData['update_by'] = $userid;
$reportData['update_at'] = $now->format('Y-m-d H:i:s');
$reportData['report_complete'] = '2';
$success = true;
$data = array();
$data[] = $reportData;
// Can handle multiple records - not needed here
$success = LongitudinalReports::save($data);
// If there are errors, then roll back all changes
if (!$success) {
    //$errors > 0) {
    // Errors occurred, so undo any changes made
    //	db_query("ROLLBACK");
    // Return '0' for error
    exit('0');
} else {
    // Logging
    $log_descrip = $_GET['report_id'] != 0 ? "Edit longitudinal report" : "Create longitudinal report";
    REDCap::logEvent($log_descrip, "report_id = {$report_id}: " . print_r($reportData, true));
    // Commit changes
    //	db_query("COMMIT");
    // Response
    $dialog_title = RCView::img(array('src' => 'tick.png', 'style' => 'vertical-align:middle')) . RCView::span(array('style' => 'color:green;vertical-align:middle'), $lang['report_builder_01']);
    $dialog_content = RCView::div(array('style' => 'font-size:14px;'), $lang['report_builder_73'] . " \"" . RCView::span(array('style' => 'font-weight:bold;'), RCView::escape($title)) . "\" " . $lang['report_builder_74']);
    // Output JSON response
    print json_encode(array('report_id' => $report_id, 'newreport' => $_GET['report_id'] == 0 ? 1 : 0, 'title' => $dialog_title, 'content' => $dialog_content));
}
开发者ID:lsgs,项目名称:redcap-longitudinal-reports,代码行数:31,代码来源:report_edit_ajax.php


示例18: get_field_label

					$item = $event['cm_oth_cmindc'];
				}
				$desc_array[] = get_field_label($field, $project_id) . ': <strong>' . $item . "</strong>";
			}
		}
		$event_start = $event['cm_cmstdtc'] != '' ? $event['cm_cmstdtc'] : $rfstdtc;
		if ($event['cm_cmtrt'] != '') {
			$eventAtts[] = get_event_array($event_start, '', '', implode("<br />", $desc_array), $event['cm_cmtrt'], '', '', $url);
		}
	}
}
/**
 * transfusions
 */
$fields = array('xfsn_cmstdtc', 'xfsn_cmtrt', 'xfsn_cmdose', 'xfsn_cmindc');
$transfusion_data = REDCap::getData('array', $subjid, $fields);
foreach ($transfusion_data AS $subject) {
	foreach ($subject AS $event_id => $event) {
		$desc_array = array();
		$url = APP_PATH_WEBROOT_FULL . "redcap_v" . $redcap_version . "/DataEntry/index.php?pid=$project_id&page=transfusions&id=$subjid&event_id=$event_id";
		foreach ($event AS $field => $item) {
			if ($item != '' && !in_array($field, array('xfsn_cmstdtc', 'xfsn_cmtrt'))) {
				$desc_array[] = get_field_label($field, $project_id) . ': <strong>' . $item . "</strong>";
			}
		}
		$eventAtts[] = get_event_array($event['xfsn_cmstdtc'], '', '', implode("<br />", $desc_array), $event['xfsn_cmtrt'], 'red', '', $url);
	}
}
/**
 * generate and return JSON to timeline script.
 */
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:conmeds_json.php


示例19: schedule_surveys

/**
 * @param $record
 * @param $event_id
 * @param $group_id
 * @param $debug
 */
function schedule_surveys($record, $event_id, $group_id, $debug)
{
	global $Proj, $project_id, $user_rights, $table_pk;
	/**
	 * if the user is in a DAG
	 */
	if ($user_rights['group_id'] != "") {
		/**
		 * does this record exist?
		 */
		$q = db_query("SELECT 1 from redcap_data WHERE project_id = $project_id AND record = '$record' LIMIT 1");
		if (db_num_rows($q) > 0) {
			/**
			 * is the record in this users DAG?
			 */
			$q = db_query("SELECT 1 from redcap_data WHERE project_id = $project_id AND record = '$record' AND field_name = '__GROUPID__' AND value = '{$user_rights['group_id']}' LIMIT 1");
			if (db_num_rows($q) < 1) {
				/**
				 * record is not in Users DAG!
				 */
				REDCap::logEvent('Scheduled record is not in users DAG', '', '', $record, $event_id, $project_id);
				exit;
			}
		}
	}
	/**
	 * check to see if the subject has an existing schedule on an existing arm
	 */
	$sub = "SELECT DISTINCT e.arm_id from redcap_events_calendar c, redcap_events_metadata e WHERE c.project_id = $project_id AND c.record = '$record' AND c.event_id = e.event_id";
	$sched_arm_result = db_query("SELECT arm_num FROM redcap_events_arms WHERE project_id = $project_id AND arm_id IN (" . pre_query($sub) . ")");
	if ($sched_arm_result) {
		$trt = Treatment::getTrtInfo($record);
		if ($debug) {
			error_log(print_r($trt, true));
		}
		$tx_start_date = $trt['rfxstdtc'];
		$rand_date = $trt['rand_date'];
		$dates = array();
		$arm_num = db_result($sched_arm_re 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP REST类代码示例发布时间:2022-05-23
下一篇:
PHP RBAC类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap