//Collect form names and form menu names into arrays $form_info = array(); foreach ($Proj->eventsForms[$row['event_id']] as $this_form) { $form_info[$this_form]['form_menu_description'] = $Proj->forms[$this_form]['menu']; $form_info[$this_form]['form_status'] = ''; } //Retrieve all known form status values for forms for this record $sql = "select distinct m.form_name, if(d2.value is null, '0', d2.value) as value \n\t\t\t\t\t\t\tfrom (redcap_data d, redcap_metadata m) left join redcap_data d2 \n\t\t\t\t\t\t\ton d2.project_id = m.project_id and d2.record = d.record and d2.event_id = d.event_id \n\t\t\t\t\t\t\tand d2.field_name = concat(m.form_name, '_complete')\n\t\t\t\t\t\t\twhere d.project_id = {$project_id} and d.project_id = m.project_id and d.record = '" . prep($row['record']) . "' \n\t\t\t\t\t\t\tand d.field_name = m.field_name and m.form_name in (" . prep_implode($Proj->eventsForms[$row['event_id']]) . ")\n\t\t\t\t\t\t\tand d.event_id = {$row['event_id']}"; $q = db_query($sql); while ($row4 = db_fetch_assoc($q)) { $form_info[$row4['form_name']]['form_status'] = $row4['value']; } // Determine if record also exists as a survey response for some instruments $surveyResponses = array(); if ($surveys_enabled) { $surveyResponses = Survey::getResponseStatus($project_id, $row['record'], $row['event_id']); } foreach ($form_info as $this_form => $attr) { // If it's a survey response, display different icons if (isset($surveyResponses[$row['record']][$row['event_id']][$this_form])) { //Determine color of button based on response status switch ($surveyResponses[$row['record']][$row['event_id']][$this_form]) { case '2': $holder_color = 'tick_circle_frame.png'; break; default: $holder_color = 'circle_orange_tick.png'; } } else { //Determine color of button based on form status value switch ($attr['form_status']) {
foreach ($grid_form_status as $this_event_id => $these_forms) { ksort($instance_count[$this_event_id]); foreach ($these_forms as $this_form => $these_instances) { // Seed all defaults for this form $grid_form_status[$this_event_id][$this_form] = $instance_count[$this_event_id]; // Add form instance foreach ($these_instances as $this_instance => $this_form_status) { $grid_form_status[$this_event_id][$this_form][$this_instance] = $this_form_status; } } } } // Determine if this record also exists as a survey response for some instruments $surveyResponses = array(); if ($surveys_enabled) { $surveyResponses = Survey::getResponseStatus($project_id, $id); } // Get Custom Record Label and Secondary Unique Field values (if applicable) if ($existing_record) { $this_custom_record_label_secondary_pk = "<span style='color:#800000;margin-left:3px;'>" . Records::getCustomRecordLabelsSecondaryFieldAllRecords(addDDEending($_GET['id']), false, $arm, true, '') . "</span>"; } else { $this_custom_record_label_secondary_pk = ""; } // JavaScript for setting floating table headers ?> <script type="text/javascript"> $(function(){ // Center the record ID name with the table var eg = $('#event_grid_table'); if (eg.width() < 700) { $('#record_display_name').width( eg.width() );