本文整理汇总了PHP中REDCap::getFieldNames方法的典型用法代码示例。如果您正苦于以下问题:PHP REDCap::getFieldNames方法的具体用法?PHP REDCap::getFieldNames怎么用?PHP REDCap::getFieldNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类REDCap
的用法示例。
在下文中一共展示了REDCap::getFieldNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filesize
header('Content-Disposition: attachment; filename="'.$target_filename.'"');
header('Content-Length: ' . filesize($target_file));
ob_end_flush();
readfile_chunked($target_file);
// unlink($target_file);
REDCap::logEvent("Full Export Downloaded");
exit();
}
// Render the page
include APP_PATH_DOCROOT . 'ProjectGeneral/header.php';
//header( 'Content-type: text/html; charset=utf-8' );
// Get name of first field:
$fields = REDCap::getFieldNames();
$field_count = count($fields);
$first_field = array_shift($fields);
//echo "First field of $field_count is $first_field\n";
d($first_field, $fields);
// Get all record_ids
$ids = REDCap::getData('array',NULL,array($first_field));
$ids = array_keys($ids);
$id_count = count($ids);
//echo "Records are: <pre>" . print_r($ids,true) . "</pre>";
//echo "\nRecord count is " . count($ids);
d($ids);
// Determine batching size (with a minimum of 1 record per export).
$records_per_batch = max(1,floor($fields_per_batch / $field_count));
示例2: db_query
* forms with locked records
*/
$table_csv = "";
$locked_forms = db_query("SELECT DISTINCT form_name FROM redcap_locking_data WHERE project_id = '$project_id' ORDER BY form_name ASC");
if ($locked_forms) {
while ($locked_forms_array = db_fetch_assoc($locked_forms)) {
$filled_locked = 0;
$avail_locked = 0;
$filled_complete = 0;
$avail_complete = 0;
$filled_incomplete = 0;
$avail_incomplete = 0;
$filled_all = 0;
$avail_all = 0;
$data_row = array();
$fields = REDCap::getFieldNames($locked_forms_array['form_name']);
$fields_string = "'" . implode("', '", $fields) . "'";
/**
* pretty form names
*/
$pretty_form_names = array();
$pretty_form_name_result = db_query("SELECT form_menu_description FROM redcap_metadata WHERE project_id = '$project_id' AND form_name = '{$locked_forms_array['form_name']}' AND form_menu_description IS NOT NULL");
if ($pretty_form_name_result) {
$form_name_row = db_fetch_assoc($pretty_form_name_result);
db_free_result($pretty_form_name_result);
}
/**
* subjects with locked forms
*/
$subject_lock_result = db_query("SELECT record, event_id FROM `redcap_locking_data` WHERE project_id = '$project_id' AND form_name = '{$locked_forms_array['form_name']}'");
if ($subject_lock_result) {
示例3: db_query
$subjects_result = db_query("SELECT DISTINCT record FROM redcap_data WHERE project_id = '$project_id' AND field_name = 'dm_usubjid' AND left(value, 3) = '017'");
if ($subjects_result) {
while ($subjects_row = db_fetch_array($subjects_result)) {
$subjects[] = $subjects_row['record'];
}
}
d($subjects);
//$subjects = '42';
/**
* labs field names
*/
$change_message = 'Purging imported labs, standardizations and related derivations for site 017 (Yale) prior to REDI refresh for this site';
$forms = array('cbc_imported', 'cbc_im_standard', 'chemistry_imported', 'chemistry_im_standard', 'inr_imported', 'hcv_rna_imported', 'hcv_rna_im_standard', 'derived_values_baseline', 'derived_values');
//$forms = array('derived_values_baseline', 'derived_values');
foreach ($forms AS $form) {
$fields = REDCap::getFieldNames($form);
if (in_array($form, array('derived_values_baseline', 'derived_values'))) {
$fields = array_filter($fields, "is_imported");
}
d($form, $fields);
$data = REDCap::getData('array', $subjects, $fields);
foreach ($data AS $subject_id => $subject) {
foreach ($subject AS $event_id => $event) {
foreach ($event AS $field => $value) {
if ($value != '' && strpos($field, 'complete') === false) {
update_field_compare($subject_id, $project_id, $event_id, '', $value, $field, $debug, $change_message);
}
}
}
}
}